Export Plugin
Toolbar menu to download the current document. Formats map onto the same Editor boundaries as the public API — no parallel serializer.
Install and CSS: Editor API — Getting Started. Boundaries: JSON / HTML / Markdown / published.
Demo
Usage
ts
import { Editor, ExportPlugin, createDefaultPlugins } from 'on-codemerge';
const editor = new Editor(host, {
plugins: [...createDefaultPlugins()], // or ExportPlugin() alone + essentials
});
editor.command('exportDoc'); // opens format menuPublic API (v2)
Factory: ExportPlugin().
| Command | |
|---|---|
exportDoc | Opens the export menu |
| Shortcut | Command |
|---|---|
Mod-Alt-e | exportDoc |
No factory options. There is no editor.exportTo* — the menu calls ExportService with the live EditorAPI.
Formats
| Menu id | Output | Source |
|---|---|---|
html | document.html | editor.getPublishedDocument() |
markdown | document.md | editor.getMarkdown() |
text | document.txt | plain text from getHTML() |
pdf | print dialog | getPublishedDocument() → browser print |
Programmatic equivalent without the menu:
ts
import { downloadBlob } from 'on-codemerge/sdk';
downloadBlob(editor.getMarkdown(), 'document.md', 'text/markdown');
downloadBlob(editor.getPublishedDocument(), 'document.html', 'text/html');Headless (no Editor): exportMarkdown(doc) / exportHTML(doc) from on-codemerge — see Editor API — Headless IO.
Related
- Editor API —
getMarkdown,getPublishedDocument - SDK reference —
downloadBlob,composePublishedDocument