# Editor options and events

Look up creation options, replacement settings and the complete public event map.

Use this page to look up fields, and [Editor usage](/en/api/editor) for invocation steps. Signatures come from the public `@quirekit/core` entry; internal imports are unnecessary.

## Creation options

Extensions, Schema and commands are established at creation. `setOptions()` does not recompile extensions. Mounting through `element` requires an adapter for the selected `mode`; omitting the mode selects retained `html`, rather than native `dom`.

Register `onCreate`, `onUpdate` and similar callbacks through creation options. `create` fires synchronously during construction, so subscribing after `new Editor()` returns misses it. Use the callback's `editor` argument inside `onCreate`.

### QuireEditorOptions

`@quirekit/core` · MIT

Options used to create a QuireKit editor instance.

```ts
export interface QuireEditorOptions extends QuireEditorEventCallbacks {
    readonly content?: QuireEditorContent;
    readonly contentType?: QuireMarkdownContentType | undefined;
    readonly markdown?: QuireMarkdownManagerOptions | undefined;
    readonly docx?: QuireDocxManagerOptions | undefined;
    readonly schema?: Schema;
    readonly editorProps?: QuireEditorProps | undefined;
    readonly parseOptions?: ParseOptions | undefined;
    readonly autofocus?: FocusPosition | undefined;
    readonly editable?: boolean | undefined;
    readonly textDirection?: "ltr" | "rtl" | "auto" | undefined;
    readonly injectCSS?: boolean | undefined;
    readonly injectNonce?: string | undefined;
    readonly coreExtensionOptions?: CoreExtensionOptions | undefined;
    readonly enableCoreExtensions?: boolean | Partial<Record<CoreExtensionName, false>> | undefined;
    readonly enableContentCheck?: boolean | undefined;
    readonly emitContentError?: boolean | undefined;
    readonly enableExtensionDispatchTransaction?: boolean | undefined;
    readonly enableInputRules?: QuireEnableRules | undefined;
    readonly enablePasteRules?: QuireEnableRules | undefined;
    readonly extensions?: readonly QuireAnyExtension[];
    readonly element?: Element | {
        readonly mount: HTMLElement;
    } | ((editor: HTMLElement) => void) | null | undefined;
    readonly mode?: QuireViewMode;
    readonly viewId?: string;
}
```

**content** — Initial editor content as a ProseMirror document or JSON document.

**contentType** — Explicit content type for initial string content.

**markdown** — Markdown parser and serializer options used by markdown content APIs.

**docx** — Instance-owned DOCX defaults, runtime loader, and diagnostic listener.

**schema** — Schema used to create the default document when content is omitted.

**editorProps** — Direct ProseMirror-style view props applied before plugin props.

**parseOptions** — Default options used while parsing editor content.

**autofocus** — Initial focus target applied after mounting.

**editable** — Whether the editor should accept editing input.

**textDirection** — Default text direction for editor content.

**injectCSS** — Whether Tiptap-compatible base CSS should be injected.

**injectNonce** — Optional CSP nonce used by injected CSS.

**coreExtensionOptions** — Configuration forwarded to built-in extensions.

**enableCoreExtensions** — Whether built-in extensions are enabled.

**enableContentCheck** — Whether initial content should be validated strictly.

**emitContentError** — Whether invalid initial content should emit a contentError event.

**enableExtensionDispatchTransaction** — Whether extensions can intercept transaction dispatch.

**enableInputRules** — Whether input rules are enabled globally or for specific extensions.

**enablePasteRules** — Whether paste rules are enabled globally or for specific extensions.

**extensions** — Extensions installed into the editor.

**element** — Element, mount wrapper, callback, or null used for the primary view.

**mode** — View mode mounted into `element`.

**viewId** — Optional stable identity for the primary mounted view.

**onMount** — Emitted after the primary editor view is mounted.

**onUnmount** — Emitted after the primary editor view is unmounted.

**onBeforeCreate** — Emitted after options are registered and before create hooks run.

**onCreate** — Emitted after the editor has created its initial state.

**onContentError** — Emitted when editor content cannot be parsed.

**onBeforeTransaction** — Emitted before a transaction is applied.

**onTransaction** — Emitted after a transaction is applied.

**onSelectionUpdate** — Emitted after the selection changes.

**onFocus** — Emitted when the editor receives focus.

**onBlur** — Emitted when the editor loses focus.

**onClipboardPasteResult** — Input-owned result, including refused transactions that cannot emit update.

**onDelete** — Emitted when the delete extension observes removed content.

**onUpdate** — Emitted after document or selection state changes.

**onDestroy** — Emitted before the editor is destroyed.

**onPaste** — Called when content is pasted into the editor.

**onDrop** — Called when content is dropped into the editor.

## Content replacement options

`setContent()` and `replaceDocument()` share these options. Updates are emitted unless disabled with `emitUpdate`; enable `errorOnInvalidContent` explicitly. See [content operations](/en/guide/content) for semantics and validation limits.

### QuireSetContentOptions

`@quirekit/core` · MIT

QuireKit setContent options with explicit Markdown content selection.

```ts
export interface QuireSetContentOptions extends SetContentOptions {
    readonly contentType?: QuireMarkdownContentType | undefined;
    readonly parseOptions?: ParseOptions;
    readonly errorOnInvalidContent?: boolean;
    readonly emitUpdate?: boolean;
}
```

**contentType** — Explicit content type for string content.

**parseOptions** — Options forwarded to HTML parsing once HTML content parsing is available.

**errorOnInvalidContent** — Whether invalid content should throw instead of falling back.

**emitUpdate** — Whether extension update hooks should run after replacing content.

## Event map

Events describe state or input facts and do not establish a second mutation channel. `transaction` includes `appendedTransactions`. Compare accepted and previous documents to detect content changes, rather than inspecting only the root transaction. `setEditable()` also emits `update` by default; see [event usage](/en/concepts/lifecycle).

### QuireEditorEvents

`@quirekit/core` · MIT

Editor events exposed through Tiptap-compatible event methods.

```ts
export interface QuireEditorEvents {
    readonly mount: EditorEvents["mount"];
    readonly unmount: EditorEvents["unmount"];
    readonly beforeCreate: QuireEditorEventPayload;
    readonly create: QuireEditorEventPayload;
    readonly contentError: EditorEvents["contentError"];
    readonly beforeTransaction: QuireEditorBeforeTransactionEvent;
    readonly transaction: QuireEditorTransactionEvent;
    readonly selectionUpdate: QuireEditorSelectionUpdateEvent;
    readonly focus: QuireEditorFocusEvent;
    readonly blur: QuireEditorBlurEvent;
    readonly paste: QuireEditorPasteEvent;
    readonly clipboardPasteResult: QuireClipboardPasteResult;
    readonly drop: QuireEditorDropEvent;
    readonly delete: QuireEditorDeleteEvent;
    readonly update: QuireEditorUpdateEvent;
    readonly destroy: void;
}
```

**mount** — Emitted after the primary editor view is mounted.

**unmount** — Emitted after the primary editor view is unmounted.

**beforeCreate** — Emitted after options are registered and before create hooks run.

**create** — Emitted after the editor has created its initial state.

**contentError** — Emitted when editor content cannot be parsed.

**beforeTransaction** — Emitted before a transaction is applied.

**transaction** — Emitted after a transaction is applied.

**selectionUpdate** — Emitted after the selection changes.

**focus** — Emitted when the editor receives focus.

**blur** — Emitted when the editor loses focus.

**paste** — Emitted when a view runtime handles paste.

**clipboardPasteResult** — Input-owned result, including refused transactions that cannot emit update.

**drop** — Emitted when a view runtime handles drop.

**delete** — Emitted when the delete extension observes removed content.

**update** — Emitted after document or selection state changes.

**destroy** — Emitted before the editor is destroyed.
