API
Props
modelValue?: JSONContent | nulleditable?: booleanmode?: 'edit' | 'preview'outlinePlacement?: 'left' | 'right'messages?: Partial<Record<string, string>> | nullenabledExportItems?: ('pdf' | 'html' | 'image' | 'print')[] | nullenabledInsertMenuItems?: ('image' | 'video' | 'table' | 'local-file' | 'columns' | 'highlight-block' | 'date' | 'code-block' | 'formula' | 'blockquote' | 'emoji' | 'link' | 'divider' | 'countdown' | 'markdown-import')[] | nullenabledToolbarActions?: ('blockquote')[] | nullplaceholder?: stringcollaboration?: RichTextEditorCollaborationOptions | null
Collaboration Options
ts
interface RichTextEditorCollaborationUser {
name: string
color: string
userId?: string
clientUniqueCode?: string
[key: string]: unknown
}
interface RichTextEditorCollaborationOptions {
document: RichTextEditorCollaborationDocument
field?: string
provider?: RichTextEditorCollaborationProvider | null
user?: RichTextEditorCollaborationUser | null
initializeContent?: boolean
initialContent?: JSONContent | null
}| Field | Description |
|---|---|
document | External Y.Doc. |
field | Yjs fragment name. All clients in the same room must use the same value; normal usage keeps it as content. |
provider | External collaboration provider such as y-websocket. Required for remote cursors and selections. |
user | Current user info. The same user opening multiple windows must use different clientUniqueCode values. |
initializeContent | Lets this client write initialContent into an empty collaborative fragment. Use only for a brand-new empty room when this client owns initialization. |
initialContent | Initial JSON content. Do not pass this when the backend already has a Yjs snapshot. |
Use documentType: 'rich' with the unified collaboration service. word is reserved for a future dedicated Word component.
Messages
The editor UI stays in Chinese by default. Use messages to override only the keys you need.
vue
<RichTextEditor
v-model="content"
:messages="{
'insert.localFile': 'Attachment',
'export.label': 'Download',
}"
/>Available messages keys include:
insert.labelinsert.section.generalinsert.section.appsinsert.section.externalinsert.imageinsert.videoinsert.tableinsert.localFileinsert.columnsinsert.highlightBlockinsert.dateinsert.codeBlockinsert.formulainsert.blockquoteinsert.emojiinsert.linkinsert.dividerinsert.countdowninsert.markdownImportexport.labelexport.pdfexport.pdf.loadingexport.htmlexport.html.loadingexport.imageexport.image.loadingprint.labelprint.loadingquote.applyquote.cancelquote.borderColorquote.backgroundColoroutline.labeloutline.collapseoutline.empty.descriptionoutline.empty.tipstatus.wordCountUnitstatus.presentation.enterstatus.presentation.exitstatus.fullscreen.enterstatus.fullscreen.exitcountdown.selectTimecountdown.settingsTitleformula.insertTitle
Events
update:modelValuechangelocal-file-uploadlocal-file-download
Instance Methods
exportPdf(): Promise<Blob | null>exportImage(options?): Promise<Blob | null>exportHtml(): string | nullinsertImage(payload | payload[]): booleaninsertVideo(payload): booleaninsertFile(payload): booleaninsertLocalFile(payload): booleanopenLocalFilePicker(): voidfocus(): voidgetJSON(): JSONContent | null