@eigenpal/docx-editor-vue

v1.8.3 · 6 published subpaths with full TypeScript signatures and JSDoc.

Subpaths

Package root

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

Functions (3)

provideLocalefunctionSource ↗

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

provideLocale(myTranslations);

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

renderAsyncfunctionSource ↗

Render a DOCX editor into a container element using Vue.

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

useTranslationfunctionSource ↗

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)

DocxEditorHandleinterfaceSource ↗

Imperative handle returned by Vue renderAsync().

export interface DocxEditorHandle extends EditorHandle
MemberTypeSummary
scrollToParaId(paraId: string, options?: ScrollToParaIdOptions) => 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%).

DocxEditorPropsinterfaceSource ↗

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.
colorMode?'light' | 'dark' | 'system'Color theme mode for UI styling. `'system'` follows the OS preference.
commentsSidebarOpen?booleanControlled comments-sidebar visibility; source of truth when set. Pair with `onCommentsSidebarOpenChange`; omit for the default self-managed behavior.
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).
onCommentsSidebarOpenChange?(open: boolean) => voidFires with the next open state whenever the editor wants to show or hide the comments sidebar. Fires in both controlled and uncontrolled modes.
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.
onOpen?(file: File) => void | Promise<void>Callback when a DOCX file is selected through `File > Open` or Cmd/Ctrl+O. Pass it to route the picked file through your own import pipeline. Omit it to keep the built-in local document load behavior.
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.
showFileOpen?booleanWhether to show `File > Open` and enable Cmd/Ctrl+O (default: true). Set false when you provide your own open action elsewhere.
showHelpMenu?booleanWhether to show the Help menu in the menu bar (default: true).
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.
watermarkPresets?readonly string[]Text-watermark presets shown in the watermark dialog's preset dropdown. Omit to use the built-in MS Word phrases (`DEFAULT_WATERMARK_PRESETS`). Pass an empty array to hide the preset dropdown.

Type aliases (3)

DocxEditorReftypeSource ↗

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;
    scrollToParaId(paraId: string, options?: ScrollToParaIdOptions): boolean;
    scrollToPage(pageNumber: number): void;
    scrollToPosition(pmPos: number): void;
    scrollToCommentId(commentId: number): boolean;
    scrollToChangeId(revisionId: number): boolean;
    highlightRange(from: number, to: 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;
};

EditorModetypeSource ↗

export type EditorMode = 'editing' | 'suggesting' | 'viewing';

RenderAsyncOptionstypeSource ↗

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)

i18nPluginconstSource ↗

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

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

VERSIONconstSource ↗

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"

On this page