CreateEditorOptions
CreateEditorOptions:
{ canPerformTrackedChange?: (operation: "create" | "accept" | "reject", revisionId?: string) => boolean;}Options for creating an editor instance.
Examples
Section titled “Examples”// Create editor with empty documentconst editor = await system.createEditor(targetElement);// Create editor with existing documentconst doc = await system.loadDocument(docJSON);const editor = await system.createEditor(targetElement, { document: doc });// Create editor with custom UI settingsconst editor = await system.createEditor(targetElement, { ui: { locale: 'de', unit: 'cm', ruler: { enabled: false }, },});
// Create editor with custom actions and toolbarconst editor = await system.createEditor(targetElement, { ui: { actions: [ { id: 'custom.save', label: 'Save', shortcuts: ['Mod+S'], handler: async () => { const doc = await editor.currentDocument().saveDocument(); }, }, ], toolbar: { items: [ { type: 'built-in', id: 'undo', builtInType: 'undo' }, { type: 'built-in', id: 'redo', builtInType: 'redo' }, { type: 'separator', id: 'sep-1' }, { type: 'action', id: 'save-btn', actionId: 'custom.save' }, ], }, },});DocAuthSystem.createEditorfor creating editors.UIOptionsfor available UI configuration options.
Properties
Section titled “Properties”document?
Section titled “document?”
optionaldocument:DocAuthDocument
The document to attach to this editor. If no document is provided, an empty document will be created.
DocAuthEditor.setCurrentDocument for setting the document after the editor is created.
canPerformTrackedChange()?
Section titled “canPerformTrackedChange()?”
optionalcanPerformTrackedChange: (operation,revisionId?) =>boolean
Decides whether this editor may create, accept, or reject a tracked change.
Return false, or throw, to deny the operation. revisionId is provided for
accept and reject operations. This callback applies only to editor-originated
operations; document transactions remain under host control.
Parameters
Section titled “Parameters”operation
Section titled “operation”"create" | "accept" | "reject"
revisionId?
Section titled “revisionId?”Returns
Section titled “Returns”
optionalui:UIOptions