Loading...
Loading...
Tiptap editor API patterns for vmark WYSIWYG development. Use when working with editor commands, node traversal, selection handling, or format operations.
npx skill4agent add xiaolai/vmark tiptap-editorisActivegetAttributes// Direct commands
editor.commands.toggleBold()
editor.commands.setHeading({ level: 2 })
editor.commands.setContent(doc, { emitUpdate: false })
// Chained commands (for multiple operations)
editor.chain().focus().setHeading({ level: 2 }).run()
editor.chain().focus().toggleMark("underline").run()
// State queries
editor.isActive("blockquote")
editor.isActive("heading", { level: 2 })
editor.getAttributes("link")proseMirrorToMdast.tsmdastToProseMirror.tsMultiSelection.tssrc/hooks/mcpBridge/cursorHandlers.tsdoc.textContent$pos// WRONG - loses block structure
const text = doc.textContent;
// RIGHT - respects block boundaries
const $pos = doc.resolve(from);
const currentNode = $pos.parent;
const blockStart = $pos.before($pos.depth);
const blockEnd = $pos.after($pos.depth);sourceLinesrc/plugins/markdownArtifacts/HtmlNodeView.tsreferences/patterns.mdreferences/examples.mdeditor.commands.xxx()editor.chain().focus().xxx().run()doc.resolve(pos)$poseditor.isActive()editor.getAttributes()