Back to API Reference
Interface

IClipboardAdapter

abstract

Per-format clipboard pipeline stage. Copy adapters translate the canonical attributed selection into an external format; paste adapters translate that format into attributed destination content. The editor's Copy walks every registered adapter to build a multi-format clipboard write; on Paste the highest-Priority adapter whose Format is present on the clipboard wins.

Remarks

Format mapping (semantic ↔ external markup) is declared per modifier type in ClipboardModifierBindMap; adapters are the orchestration layer that walks the active modifier set + a serializer / parser for the format. This matches the design used by ProseMirror (MarkType.toDOM/parseDOM), Lexical (LexicalNode.exportDOM/importDOM), and CKEditor 5 (model ↔ view converters): the syntactic shape is per-format, the semantic effect is per-modifier, and the adapter is the bridge. Built-in adapters registered by default on every UniTextEditable: PlainTextClipboardAdapter — universal floor; always wins when nothing richer is present. UniTextSourceClipboardAdapter — perfect-fidelity round-trip via the vendor-tree format UniTextSource. TagHtmlClipboardAdapter — HTML channel (paste from browsers / Word / Notion; copy as HTML). MarkdownClipboardAdapter — Markdown channel. The built-in set above is fixed per field.

Implementations(4)

Types that implement IClipboardAdapter.

public ClipboardFormat Format{ get }

Clipboard format this adapter writes on copy and accepts on paste. The editor uses this to populate the multi-format write and to pick the appropriate adapter on paste.

public int Priority{ get }

Selection priority on paste. Higher wins. Built-in priorities: UniTextSourceClipboardAdapter=100 (lossless), HTML=50, Markdown=40, PlainTextClipboardAdapter=0 (floor). Custom adapters that should preempt the built-ins use values above 100.

public abstract string SerializeCopy()

Serialize the current selection into this adapter's clipboard format. Returns the text payload to attach under Format's identifier, or / empty to skip this format in the multi-format write (e.g. an HTML adapter with no applicable modifiers in the selection).

public abstract ClipboardPasteContent DeserializePaste()

Deserialize external clipboard payload into visible text and resolved destination spans. Returns to abort and let the pipeline fall through to the next-best format on the clipboard.