New

docx-editor 1.x has shipped. Vue support, i18n, agents. Read the migration guide →

API Referencev1.3.36 subpaths

@eigenpal/docx-editor-vue

Subpaths

Package root: @eigenpal/docx-editor-vue

Functions(3)

Provide locale strings to descendant components. Call in a parent's `setup()`:

provideLocale(myTranslations);

export declare function provideLocale(i18n?: MaybeRef<Translations | undefined>): void;

Render a DOCX editor into a container element using Vue.

export declare function renderAsync(input: DocxInput, container: HTMLElement, options?: RenderAsyncOptions): Promise<DocxEditorHandle>;

`useTranslation` composable — returns `t(key, vars?)`. Inject-based, so a `provideLocale(...)` call must sit above it in the component tree.

export declare function useTranslation(): {
    t: TFunction;
};

Interfaces(2)

interface

DocxEditorHandle

packages/vue/src/renderAsync.ts:23

Imperative handle returned by Vue `renderAsync()`.

export interface DocxEditorHandle extends EditorHandle
MemberTypeSummary
scrollToParaId(paraId: string) => booleanScroll to a body paragraph by Word `w14:paraId`.
scrollToPosition(pmPos: number) => voidScroll to a raw ProseMirror document position.
setZoom(zoom: number) => voidSet zoom level (1.0 = 100%).

Public props for the Vue editor component.

export interface DocxEditorProps
MemberTypeSummary
author?stringAuthor name used for comments and tracked changes created in the UI. Defaults to `'User'`.
className?stringAdditional CSS class name on the editor root.
disableFindReplaceShortcuts?booleanDisable Cmd/Ctrl+F and Cmd/Ctrl+H interception.
document?Document | nullPre-parsed document model, alternative to documentBuffer.
documentBuffer?DocxInput | nullDocument data — ArrayBuffer, Uint8Array, Blob, or File.
documentName?stringDocument name shown in the title bar.
documentNameEditable?booleanWhether the document name is editable.
externalPlugins?Plugin[]External ProseMirror plugins supplied by the host app.
fontFamilies?ReadonlyArray<string | FontOption>Custom list of fonts shown in the font-family dropdown.
fonts?ReadonlyArray<FontDefinition>Custom font faces to register before the editor measures text. Each entry injects an `@font-face` rule. Pass a URL (woff2/woff/ttf/otf), an ArrayBuffer, or omit `src` to load by name from Google Fonts. Multiple entries can share `family` to register different weights/styles.
i18n?TranslationsTranslation overrides merged with English fallback.
initialZoom?numberInitial zoom level.
mode?EditorModeEditor mode: direct editing, suggesting, or viewing.
onChange?(document: Document) => voidCallback fired whenever the document changes. Mirrors the `@change` event.
onCommentAdd?(comment: Comment) => voidCallback fired when a top-level comment is added via the UI.
onCommentDelete?(comment: Comment) => voidCallback fired when a comment (and its replies) is deleted via the UI.
onCommentReply?(reply: Comment, parent: Comment) => voidCallback fired when a reply is added to a comment via the UI.
onCommentResolve?(comment: Comment) => voidCallback fired when a comment is resolved via the UI. Receives the comment with `done: true`.
onCommentsChange?(comments: Comment[]) => voidCallback fired with the full comment array whenever it changes (add/reply/resolve/delete).
onDocumentNameChange?(name: string) => voidCallback when the document name changes.
onEditorViewReady?(view: EditorView) => voidCallback fired once the underlying ProseMirror EditorView is ready.
onError?(error: Error) => voidCallback fired when the editor errors (parse/layout/font). Mirrors the `@error` event.
onModeChange?(mode: EditorMode) => voidCallback when the editing mode changes.
onPrint?() => voidCallback fired when the print action is triggered. Pass it to enable the `File > Print` menu entry; omit to hide. The `editor.print()` ref method also invokes this callback.
onSelectionChange?(state: SelectionState | null) => voidCallback fired when the selection changes, with the current selection state (or null).
readOnly?booleanWhether the editor is read-only.
renderTitleBarRight?() => VNodeChildCustom right-side actions renderer for the title bar. Slots remain preferred in templates.
showMenuBar?booleanWhether to show the title/menu bar. Vue-only chrome toggle.
showOutline?booleanWhether to show the document outline panel initially.
showOutlineButton?booleanWhether to show the floating outline toggle button.
showRuler?booleanWhether to show page rulers.
showToolbar?booleanWhether to show the main formatting toolbar.
showZoomControl?booleanWhether to show the zoom controls in the toolbar.
style?StyleValueAdditional inline styles on the editor root.
theme?Theme | nullTheme override used for toolbar color palettes when the document has no theme.
toolbarExtra?() => VNodeChildCustom toolbar content appended after the built-in controls.

Type aliases(3)

Public ref shape for `<DocxEditor>`. Exposes the full editor-scope `EditorRefLike` contract so the agent bridge can attach to either React or Vue without an adapter shim.

export type DocxEditorRef = EditorRefLike & {
    getAgent(): null;
    save(): Promise<ArrayBuffer | null>;
    setZoom(zoom: number): void;
    getZoom(): number;
    focus(): void;
    scrollToPage(pageNumber: number): void;
    scrollToPosition(pmPos: number): void;
    openPrintPreview(): void;
    print(): void;
    loadDocument(doc: Document): void;
    loadDocumentBuffer(buffer: DocxInput): Promise<void>;
    destroy(): void;
    getContentControls(filter?: ContentControlFilter): PMContentControl[];
    scrollToContentControl(filter: ContentControlFilter): boolean;
    setContentControlContent(filter: ContentControlFilter, text: string, options?: {
        force?: boolean;
    }): boolean;
    removeContentControl(filter: ContentControlFilter, options?: {
        force?: boolean;
        keepContent?: boolean;
    }): boolean;
    setContentControlValue(filter: ContentControlFilter, value: ContentControlValue, options?: {
        force?: boolean;
    }): boolean;
};
export type EditorMode = 'editing' | 'suggesting' | 'viewing';

Options for `renderAsync`.

export type RenderAsyncOptions = Omit<DocxEditorProps, 'documentBuffer' | 'document'> & {
    onReady?: () => void;
    onError?: (error: Error) => void;
    onChange?: (document: Document) => void;
    onRename?: (name: string) => void;
    onMenuAction?: (action: string) => void;
    onModeChange?: (mode: EditorMode) => void;
};

Variables(2)

Vue plugin for i18n. Install via `app.use(i18nPlugin, translations)`.

i18nPlugin: {
    install(app: App, i18n?: Translations): void;
}

eigenpal/docx-editor-vue

Curated root entry for the documented Vue 3 editor API. Advanced surfaces stay public through explicit subpaths: - `@eigenpal/docx-editor-vue/ui` - `@eigenpal/docx-editor-vue/dialogs` - `@eigenpal/docx-editor-vue/composables` - `@eigenpal/docx-editor-vue/plugin-api`

Framework-agnostic document utilities live in `@eigenpal/docx-editor-core`. Agent/MCP surfaces live in `@eigenpal/docx-editor-agents`.

VERSION = "0.0.2"