Skip to content

fix(tiptap): preserve array/object component props in normalizeProps#477

Closed
hendrikheil wants to merge 0 commit into
nuxt-content:mainfrom
hendrikheil:main
Closed

fix(tiptap): preserve array/object component props in normalizeProps#477
hendrikheil wants to merge 0 commit into
nuxt-content:mainfrom
hendrikheil:main

Conversation

@hendrikheil

@hendrikheil hendrikheil commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • normalizeProps in src/app/src/utils/tiptap/props.ts was calling String(value).trim() on every prop value, turning arrays of objects (e.g. YAML authorsOne: [{name: 'John', role: 'contributor'}]) into "[object Object],[object Object]" during the comark → Tiptap → comark round-trip
  • Fix adds a type guard to pass object, array, and null values through unchanged; primitives are still stringified as before
  • Updated createParagraphElement parameter type to match the widened return type

Fixes #457.

Reproduction

Open the docus playground on main and edit the /authors page in Studio — saving the page will corrupt the YAML array-of-objects props to inline JSON.

Root cause

When a component uses YAML block props with array-of-object values:

::authors
---
authorsOne:
  - name: John Doe
    role: contributor
---
::

The round-trip through the Studio editor would destroy the arrays, serialising them to inline JSON props instead of preserving the YAML block format.

Test plan

  • Unit tests added for normalizeProps covering array-of-objects, plain objects, array-of-primitives, null, and className
  • Integration test added for full comark→tiptap→comark→markdown round-trip with YAML array-of-objects props
  • All 342 tests pass

@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

@hendrikheil is attempting to deploy a commit to the Nuxt Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new

pkg-pr-new Bot commented Jun 10, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/nuxt-studio@477

commit: 10f9c9c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Comark re-rendering causes invalid .md syntax

1 participant