Skip to content

feat(ui): edit components and their props in the editor with a shared node view - #405

Merged
vite-hub[bot] merged 4 commits into
mainfrom
feat/editor-component-view
Nov 11, 2026
Merged

vite-hub[bot] merged 4 commits into
mainfrom
feat/editor-component-view

Conversation

@onmax

@onmax onmax commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

In comark-ui's editor, ::chart{type="stacked"}, :::card{title="…"} and :badge[New]{color="success"} show up as an unlabeled div or span, with no way to see or edit their props. So the ViteHub Console, ViteHub Content's CMS and Drop each end up writing their own Tiptap node view.

This adds one view to comark-ui/editor/vue. A block shows its name and props in a bar above its content, an inline component gets a tag after its text, and slots stay editable in place under their #name. Clicking the props opens a panel with typed fields for the props the host describes, a name and value for every other prop, and a row to add one. The view only calls updateAttributes({ props }), which is one setNodeMarkup transaction, so the schema and the Markdown the codec writes don't change and a room's server codec can leave the view out.

The API:

  • ComarkKit.configure({ componentView }) takes any NodeViewRenderer for comarkBlock and comarkInline. ComarkKit stays DOM-free.
  • componentView({ components, field }) from comark-ui/editor/vue is the view. components maps a name to { label?, icon?, props? }, and each prop is { type?, label?, description?, default?, options? }. type is string, number, boolean or json; any other name, like image, edits as text until field draws it. field(ctx) returns the control for a prop, or undefined for the built-in one, and ctx.update(value) writes it.
  • useComarkEditor and ComarkEditor turn the view on by default. They take components and field (ComarkEditor takes it as a #field slot), and components: false goes back to bare elements.

Strings are written as name="…" and every other value as :name JSON text, which is what Comark parses back. An unchecked boolean drops the prop unless its default is true.

How the Console would adopt it: in console-markdown-editor.vue, drop the addExtensions override that swaps in its own view for comarkBlock and comarkInline, and add componentView: componentView({ components, field }) to the kit's existing .configure() beside starterKit. components maps straight from ConsoleDocumentComponent[] (label, and props with the same type names and default). field draws the media picker for image and file props, looking up store from its own definitions by component and name. Then console-comark-component.vue, consoleComponentProp and consoleComponentWithProp go away. One difference: the Console writes numbers and booleans as raw values under name, and this writes them under :name.

Before/after on Drop

packages/ui/test/editor-view.test.ts mounts the editor in happy-dom, added as a dev dependency. A doc with ::card-group, two :::card (one with a #footer slot), ::chart and :badge round-trips byte for byte with the view drawn, and the schema is the same with and without it. Editing type, title and labels through the panel, adding and removing name/value props, a host field, and the #field slot all land in the written Markdown. In Chromium on the playground, typing in the panel (Backspace and Enter included), Escape, and typing in a slot all work, and the source pane follows.

Not done: no rendered preview of data-only blocks like ::chart, since it would need comark-charts' Vega parse in the browser. I haven't tried it in a live collaborative room, only that the view edits through transactions and leaves the schema alone. I checked the playground with vp dev, not a docs build. main's playground has no dark scheme, so the dark capture has no before.

… node view

ComarkKit's component nodes drew as a bare div or span, so every host wrote its own view.
componentView() from comark-ui/editor/vue draws a block's name and props in a bar, an inline
component's tag, slots under their #name, and a props panel with typed fields from the host's
schema, names and values otherwise, and a field hook for the host's own controls. The Vue
bindings turn it on; ComarkKit takes it as componentView. It sets the props attribute through
transactions only, so the schema and the written Markdown stay the same.
@pkg-pr-new

pkg-pr-new Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

comark-annotate

pnpm add https://pkg.pr.new/comark-annotate@405

comark-badge

pnpm add https://pkg.pr.new/comark-badge@405

comark-cards

pnpm add https://pkg.pr.new/comark-cards@405

comark-carousel

pnpm add https://pkg.pr.new/comark-carousel@405

comark-cast

pnpm add https://pkg.pr.new/comark-cast@405

comark-charts

pnpm add https://pkg.pr.new/comark-charts@405

comark-chat

pnpm add https://pkg.pr.new/comark-chat@405

comark-chips

pnpm add https://pkg.pr.new/comark-chips@405

comark-cjk

pnpm add https://pkg.pr.new/comark-cjk@405

comark-code

pnpm add https://pkg.pr.new/comark-code@405

comark-code-notes

pnpm add https://pkg.pr.new/comark-code-notes@405

comark-colors

pnpm add https://pkg.pr.new/comark-colors@405

comark-comments

pnpm add https://pkg.pr.new/comark-comments@405

comark-critic

pnpm add https://pkg.pr.new/comark-critic@405

comark-deflist

pnpm add https://pkg.pr.new/comark-deflist@405

comark-details

pnpm add https://pkg.pr.new/comark-details@405

comark-diagrams

pnpm add https://pkg.pr.new/comark-diagrams@405

comark-diff

pnpm add https://pkg.pr.new/comark-diff@405

comark-embed

pnpm add https://pkg.pr.new/comark-embed@405

comark-fields

pnpm add https://pkg.pr.new/comark-fields@405

comark-figure

pnpm add https://pkg.pr.new/comark-figure@405

comark-file-tree

pnpm add https://pkg.pr.new/comark-file-tree@405

comark-footnotes

pnpm add https://pkg.pr.new/comark-footnotes@405

comark-github

pnpm add https://pkg.pr.new/comark-github@405

comark-icon

pnpm add https://pkg.pr.new/comark-icon@405

comark-include

pnpm add https://pkg.pr.new/comark-include@405

comark-keys

pnpm add https://pkg.pr.new/comark-keys@405

comark-links

pnpm add https://pkg.pr.new/comark-links@405

comark-linter

pnpm add https://pkg.pr.new/comark-linter@405

comark-magic-move

pnpm add https://pkg.pr.new/comark-magic-move@405

comark-mark

pnpm add https://pkg.pr.new/comark-mark@405

markdown-it-to-comark

pnpm add https://pkg.pr.new/markdown-it-to-comark@405

marked-to-comark

pnpm add https://pkg.pr.new/marked-to-comark@405

comark-mathml

pnpm add https://pkg.pr.new/comark-mathml@405

comark-media

pnpm add https://pkg.pr.new/comark-media@405

comark-metrics

pnpm add https://pkg.pr.new/comark-metrics@405

migrate-to-comark

pnpm add https://pkg.pr.new/migrate-to-comark@405

comark-outline

pnpm add https://pkg.pr.new/comark-outline@405

comark-properties

pnpm add https://pkg.pr.new/comark-properties@405

comark-qr

pnpm add https://pkg.pr.new/comark-qr@405

comark-quiz

pnpm add https://pkg.pr.new/comark-quiz@405

comark-reading-time

pnpm add https://pkg.pr.new/comark-reading-time@405

remark-to-comark

pnpm add https://pkg.pr.new/remark-to-comark@405

comark-sources

pnpm add https://pkg.pr.new/comark-sources@405

comark-steps

pnpm add https://pkg.pr.new/comark-steps@405

comark-table

pnpm add https://pkg.pr.new/comark-table@405

comark-tabs

pnpm add https://pkg.pr.new/comark-tabs@405

comark-tests

pnpm add https://pkg.pr.new/comark-tests@405

comark-time

pnpm add https://pkg.pr.new/comark-time@405

comark-ui

pnpm add https://pkg.pr.new/comark-ui@405

comark-xref

pnpm add https://pkg.pr.new/comark-xref@405

comark-zoom

pnpm add https://pkg.pr.new/comark-zoom@405

commit: 1b6e973

@vite-hub

vite-hub Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Completed Not started —
View session Waiting 2026-11-11T21:55:46.334Z 5m 58s
View session Completed 2026-11-11T21:33:23.299Z 11m 44s
View session Waiting 2026-11-11T20:35:55.625Z 27m 57s

Latest result

Pull request merged.

Final answers

Session

Pull request merged.

Session

Waiting for GitHub merge request c0f8e12d-1371-4fe4-b929-76c7304eee12.

View session

Ready; no repair needed. Verified Pullfrog’s prior P1 bound-string decoding, JSON draft loss, and conditional-slot fallback fixes. All six hosted checks passed. Local vp fmt --check and git diff --check passed; vp lint exited 0 with one missing-build-type warning. Focused editor tests were blocked by missing workspace exports; the cached prerequisite build hit the prepare hook’s read-only .git/config error. Working tree is clean.

View session

Pushed 1b6e973, fixing Pullfrog P1 bound-string decoding, P1 JSON draft loss, and P1 conditional-slot fallback. All three threads resolved. From packages/ui, vp test run test/editor-view.test.ts test/editor-vue.test.ts passed all 15 tests. Changed-file lint, formatting, git diff --check, and the cached prerequisite build passed. Awaiting hosted checks.

Session

Marked the draft ready for review so it can merge.

Session

Marked the draft ready for review so it can merge.

Session

Marked the draft ready for review so it can merge.

Session

Marked the draft ready for review so it can merge.

Session

Marked the draft ready for review so it can merge.

Session

Marked the draft ready for review so it can merge.

View session

Verified the expected HEAD and inspected the diff and supplied feedback; no actionable defect found. git diff HEAD^ HEAD --check passed, and the working tree is clean. Dependency refresh timed out after 300 seconds; checkDependencies still reports the host’s shared install slot occupied. Focused tests and lint remain unverified. Awaiting hosted CI.

@vite-hub
vite-hub Bot marked this pull request as ready for review November 11, 2026 21:12

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Three supported editing paths need fixes: conditional field slots hide built-in controls, unrelated transactions discard JSON drafts, and bound string literals gain unwanted quote characters when edited.

Reviewed changes — Reviewed the shared Vue component node view, its public editor integration, prop serialization, playground, documentation, and tests.

  • Shared component view. Block and inline components gain labeled chrome, editable content and slots, and a native props popover with typed and raw fields.
  • Host integration. ComarkKit, useComarkEditor, and ComarkEditor expose component metadata, custom field renderers, view overrides, and an opt-out without changing the schema.
  • Transaction handling. Prop edits preserve unrelated attributes, including when a retained host-field callback completes later, while parser options remain intact.
  • Examples and verification. The playground and guide demonstrate the feature; both focused Vue suites pass all 10 tests and changed-file lint passes, but full workspace validation was blocked by the prepare hook error could not lock config file .git/config: Read-only file system.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.1-sol(xhigh) | 𝕏

Comment thread packages/ui/src/editor-vue.ts Resolved

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found; no P0 or P1 findings remain.

Reviewed changes — Reviewed 1b6e973, the fixes added since the previous Pullfrog review at e5fb595.

  • Restored conditional-slot fallbacks. Comment-only slots and empty fragments retain built-in fields, while real host controls still replace them.
  • Preserved pending JSON edits. Valid and incomplete drafts survive unrelated content and prop transactions, and successful commits preserve intervening edits.
  • Decoded bound strings. Text fields, selects, and host fields receive decoded values rather than serialized quote characters.
  • Added regression coverage. All 15 focused editor tests passed, and lint on the changed implementation and tests reported zero errors or warnings.

Pullfrog  | View workflow run | Using gpt-6.1-sol(xhigh) | 𝕏

@vite-hub
vite-hub Bot merged commit 11c83eb into main Nov 11, 2026
6 checks passed
@vite-hub
vite-hub Bot deleted the feat/editor-component-view branch November 11, 2026 22:04
This was referenced Nov 11, 2026
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.

1 participant