Skip to content

Blocks

Vizel treats every paragraph, heading, list item, table cell, and custom node as a block. Blocks are the unit of selection, drag, copy, and undo. The block primitives ship as always-on core: you do not need to enable a feature toggle to use them.

Block-aware editing extensions

ExtensionAlways on?What it does
MultiBlockSelectionYesRange selection across multiple blocks with block-aware Backspace / Delete / Tab / Shift+Tab
BlockClipboardYesBlock-aware copy / cut / paste that writes application/x-vizel-blocks (lossless JSON), plus text/html, text/markdown, and text/plain mirrors
DragHandleOpt-in via features.interaction.dragHandlePer-item drag handle for blocks and list items at any nesting depth
BlockMenuRenders from any drag handleDelete, duplicate, turn into another block type

Because clipboard and selection are always on, every editor instance supports keyboard reorder (Alt+Up / Alt+Down) and lossless paste between two Vizel editors out of the box.

Block operations from your code

Vizel exposes a typed VizelCommand layer that lets you trigger the same operation that the slash menu, block menu, and toolbar use.

CommandBehavior
deleteBlockRemove the current block
duplicateBlockInsert a clone right after the current block
turnInto(nodeType)Convert the current block to the given node type
moveBlockUp / moveBlockDownReorder the current block within its parent

These commands appear automatically in the block menu when the drag handle is enabled. To bind them to your own button, dispatch the underlying Tiptap chain:

tsx
<button onClick={() => editor?.chain().focus().duplicateBlock().run()}>
  Duplicate
</button>
vue
<button @click="editor?.chain().focus().duplicateBlock().run()">
  Duplicate
</button>
svelte
<button onclick={() => editor.current?.chain().focus().duplicateBlock().run()}>
  Duplicate
</button>

Clipboard payloads

BlockClipboard writes four MIME types on every copy:

MIME typePurpose
application/x-vizel-blocksLossless JSON. A Vizel editor that recognizes the marker rehydrates the exact node tree.
text/markdownMarkdown serialization through the active flavor. Falls back to encoding modes (see Markdown).
text/htmlHTML serialization. Useful for pasting into rich-text email clients.
text/plainPlain-text fallback.

On paste, Vizel prefers application/x-vizel-blocks when both editors are on the same version. Cross-editor or cross-app paste falls back to Markdown, then HTML, then plain text.

Try this if you want to ...

Released under the MIT License.