Skip to content

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 menu

Public API (v2) ​

Factory: ExportPlugin().

Command
exportDocOpens the export menu
ShortcutCommand
Mod-Alt-eexportDoc

No factory options. There is no editor.exportTo* — the menu calls ExportService with the live EditorAPI.

Formats ​

Menu idOutputSource
htmldocument.htmleditor.getPublishedDocument()
markdowndocument.mdeditor.getMarkdown()
textdocument.txtplain text from getHTML()
pdfprint dialoggetPublishedDocument() → 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.

Released under the MIT License.