Utilities & types

Helper functions, components and TypeScript types exported by the package.

Functions

ExportDescription
hasExtension(editor, name)Whether an extension (including nested ones) is registered.
announce(message, politeness?)Announce a message to screen readers through a shared live region.
printHTML(html, { title })Print HTML through a hidden iframe (used by PDF export).
createStandaloneHTML(html, { title, lang })Wrap editor HTML into a styled standalone document.
serialize(editor, format, title?)Get { content, mimeType, extension } for html, json, markdown, text or rtf.
exportDocument(editor, format, filename?)Serialize and download (or print for pdf).
jsonToRTF(json)Convert a Tiptap JSON document to RTF.
toPlainText(editor)Plain text with blank lines between blocks.
downloadFile(content, filename, mimeType?)Trigger a browser download.
getUserColor(name)Stable caret colour for a user name (collaboration entry).

Components

ExportDescription
EchoEditorThe editor component.
EchoEditorPluginVue plugin that registers EchoEditor globally.
ActionButtonThe toolbar button used by built-in extensions — reuse it for consistent custom buttons.
ThemeToggle, ThemePickerDark mode toggle and colour / radius picker.
CollaborationUsersPresence avatars (collaboration entry).

Types

import type {
  EchoEditorProps,
  EchoEditorEmits,
  EchoEditorOnChange,
  EditorInstance,        // Tiptap Editor
  JSONContent,
  GeneralOptions,        // spacer / divider / toolbar / button
  ButtonView,
  ButtonViewReturn,
  ButtonViewParams,
  Group,
  Command,               // slash command
  ExportFormat,
  Theme,
  LocaleConfig,
  LocaleMessages,
  EchoEditorPluginDefinition,
  UseEditorStateOptions,
} from 'vue-echo-editor'

import type { CollaborationKitOptions, CollaborationUser, CollaborationProvider } from 'vue-echo-editor/collaboration'

Extension option types are exported next to each extension (HeadingOptions, TableOptions, ExportOptions, …).