@eigenpal/docx-editor-vue 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +204 -0
- package/README.md +60 -0
- package/dist/KeyboardShortcutsDialog-BtJB9UOD.js +2902 -0
- package/dist/KeyboardShortcutsDialog-D72k5DXR.cjs +1 -0
- package/dist/MenuBar-BrQW4COn.cjs +4 -0
- package/dist/MenuBar-D_Dvwb0F.js +3313 -0
- package/dist/RenderedDomContext-CHc18N_2.js +2 -0
- package/dist/TablePropertiesDialog-Ct5XChwd.cjs +1 -0
- package/dist/TablePropertiesDialog-cJx_xxxE.js +987 -0
- package/dist/_plugin-vue_export-helper-B52Kst-M.js +8 -0
- package/dist/_plugin-vue_export-helper-CX7YVcP6.cjs +1 -0
- package/dist/components/DocxEditor/types.d.ts +100 -0
- package/dist/components/EditorToolbarContext.d.ts +9 -0
- package/dist/components/Toolbar/presets.d.ts +42 -0
- package/dist/components/dialogs/index.d.ts +27 -0
- package/dist/components/imageContextMenuTypes.d.ts +30 -0
- package/dist/components/imageSelectionTypes.d.ts +14 -0
- package/dist/components/insertTableState.d.ts +9 -0
- package/dist/components/sidebar/cardStyles.d.ts +3 -0
- package/dist/components/sidebar/cardUtils.d.ts +1 -0
- package/dist/components/sidebar/resolveItemPositions.d.ts +4 -0
- package/dist/components/sidebar/sidebarUtils.d.ts +4 -0
- package/dist/components/tableStylePresets.d.ts +53 -0
- package/dist/components/toolbarUtils.d.ts +1 -0
- package/dist/components/ui/Icons.d.ts +1 -0
- package/dist/components/ui/hyperlinkPopupTypes.d.ts +20 -0
- package/dist/composables/index.d.ts +30 -0
- package/dist/composables/useAutoSave.d.ts +40 -0
- package/dist/composables/useClipboard.d.ts +22 -0
- package/dist/composables/useCommentLifecycle.d.ts +52 -0
- package/dist/composables/useCommentManagement.d.ts +41 -0
- package/dist/composables/useCommentSidebarItems.d.ts +24 -0
- package/dist/composables/useContextMenus.d.ts +39 -0
- package/dist/composables/useDocumentLifecycle.d.ts +11 -0
- package/dist/composables/useDocxEditor.d.ts +56 -0
- package/dist/composables/useDocxEditorRefApi.d.ts +49 -0
- package/dist/composables/useDragAutoScroll.d.ts +11 -0
- package/dist/composables/useFileIO.d.ts +30 -0
- package/dist/composables/useFindReplace.d.ts +34 -0
- package/dist/composables/useFixedDropdown.d.ts +14 -0
- package/dist/composables/useFormattingActions.d.ts +40 -0
- package/dist/composables/useHistory.d.ts +9 -0
- package/dist/composables/useHyperlinkManagement.d.ts +38 -0
- package/dist/composables/useImageActions.d.ts +30 -0
- package/dist/composables/useKeyboardShortcuts.d.ts +17 -0
- package/dist/composables/useMenuActions.d.ts +23 -0
- package/dist/composables/useOutlineSidebar.d.ts +17 -0
- package/dist/composables/usePageSetupControls.d.ts +22 -0
- package/dist/composables/usePagesPointer.d.ts +70 -0
- package/dist/composables/useSelectionHighlight.d.ts +19 -0
- package/dist/composables/useSelectionSync.d.ts +13 -0
- package/dist/composables/useTableResize.d.ts +7 -0
- package/dist/composables/useTableSelection.d.ts +10 -0
- package/dist/composables/useToolbarDropdowns.d.ts +14 -0
- package/dist/composables/useTrackedChanges.d.ts +12 -0
- package/dist/composables/useVisualLineNavigation.d.ts +11 -0
- package/dist/composables/useWheelZoom.d.ts +10 -0
- package/dist/composables/useZoom.d.ts +16 -0
- package/dist/composables.cjs +1 -0
- package/dist/composables.js +485 -0
- package/dist/dialogs.cjs +1 -0
- package/dist/dialogs.js +3 -0
- package/dist/docx-editor-vue.css +2 -0
- package/dist/i18n/LocaleContext.d.ts +1 -0
- package/dist/i18n/index.d.ts +26 -0
- package/dist/index.cjs +20 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +3600 -0
- package/dist/lib/utils.d.ts +10 -0
- package/dist/plugin-api/RenderedDomContext.d.ts +1 -0
- package/dist/plugin-api/index.d.ts +18 -0
- package/dist/plugin-api/types.d.ts +28 -0
- package/dist/plugin-api.cjs +1 -0
- package/dist/plugin-api.js +62 -0
- package/dist/renderAsync.d.ts +31 -0
- package/dist/styles/index.d.ts +12 -0
- package/dist/styles/zIndex.d.ts +24 -0
- package/dist/styles.cjs +1 -0
- package/dist/styles.js +5 -0
- package/dist/ui.cjs +18 -0
- package/dist/ui.d.ts +79 -0
- package/dist/ui.js +963 -0
- package/dist/useTableResize-1oSe9Kjk.js +480 -0
- package/dist/useTableResize-lWdIgX9x.cjs +1 -0
- package/dist/utils/commentFactories.d.ts +7 -0
- package/dist/utils/domQueries.d.ts +28 -0
- package/dist/utils/imageClipboard.d.ts +9 -0
- package/dist/utils/paraTextHelpers.d.ts +29 -0
- package/dist/utils/refApiQueries.d.ts +46 -0
- package/dist/zIndex-CH0jZ7U7.cjs +1 -0
- package/dist/zIndex-CxELVe_L.js +12 -0
- package/package.json +119 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n};Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return e}});
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Plugin } from 'prosemirror-state';
|
|
2
|
+
import { Document, Theme } from '@eigenpal/docx-editor-core/types/document';
|
|
3
|
+
import { DocxInput } from '@eigenpal/docx-editor-core/utils';
|
|
4
|
+
import { FontOption } from '@eigenpal/docx-editor-core/utils/fontOptions';
|
|
5
|
+
import { StyleValue, VNodeChild } from 'vue';
|
|
6
|
+
import { EditorRefLike } from '@eigenpal/docx-editor-agents/bridge';
|
|
7
|
+
import { Translations } from '@eigenpal/docx-editor-i18n';
|
|
8
|
+
export type EditorMode = 'editing' | 'suggesting' | 'viewing';
|
|
9
|
+
/**
|
|
10
|
+
* Public props for the Vue editor component.
|
|
11
|
+
*/
|
|
12
|
+
export interface DocxEditorProps {
|
|
13
|
+
/** Document data — ArrayBuffer, Uint8Array, Blob, or File. */
|
|
14
|
+
documentBuffer?: DocxInput | null;
|
|
15
|
+
/** Pre-parsed document model, alternative to documentBuffer. */
|
|
16
|
+
document?: Document | null;
|
|
17
|
+
/** Whether to show the main formatting toolbar. */
|
|
18
|
+
showToolbar?: boolean;
|
|
19
|
+
/** Whether to show the title/menu bar. Vue-only chrome toggle. */
|
|
20
|
+
showMenuBar?: boolean;
|
|
21
|
+
/** Whether to show page rulers. */
|
|
22
|
+
showRuler?: boolean;
|
|
23
|
+
/** Document name shown in the title bar. */
|
|
24
|
+
documentName?: string;
|
|
25
|
+
/** Whether the editor is read-only. */
|
|
26
|
+
readOnly?: boolean;
|
|
27
|
+
/** Editor mode: direct editing, suggesting, or viewing. */
|
|
28
|
+
mode?: EditorMode;
|
|
29
|
+
/** Callback when the editing mode changes. */
|
|
30
|
+
onModeChange?: (mode: EditorMode) => void;
|
|
31
|
+
/** Translation overrides merged with English fallback. */
|
|
32
|
+
i18n?: Translations;
|
|
33
|
+
/** Theme override used for toolbar color palettes when the document has no theme. */
|
|
34
|
+
theme?: Theme | null;
|
|
35
|
+
/** External ProseMirror plugins supplied by the host app. */
|
|
36
|
+
externalPlugins?: Plugin[];
|
|
37
|
+
/** Whether to show the zoom controls in the toolbar. */
|
|
38
|
+
showZoomControl?: boolean;
|
|
39
|
+
/** Initial zoom level. */
|
|
40
|
+
initialZoom?: number;
|
|
41
|
+
/** Custom toolbar content appended after the built-in controls. */
|
|
42
|
+
toolbarExtra?: () => VNodeChild;
|
|
43
|
+
/** Additional CSS class name on the editor root. */
|
|
44
|
+
className?: string;
|
|
45
|
+
/** Additional inline styles on the editor root. */
|
|
46
|
+
style?: StyleValue;
|
|
47
|
+
/** Whether to show the document outline panel initially. */
|
|
48
|
+
showOutline?: boolean;
|
|
49
|
+
/** Whether to show the floating outline toggle button. */
|
|
50
|
+
showOutlineButton?: boolean;
|
|
51
|
+
/** Custom list of fonts shown in the font-family dropdown. */
|
|
52
|
+
fontFamilies?: ReadonlyArray<string | FontOption>;
|
|
53
|
+
/**
|
|
54
|
+
* Callback fired when the print action is triggered. Pass it to enable the
|
|
55
|
+
* `File > Print` menu entry; omit to hide. The `editor.print()` ref method
|
|
56
|
+
* also invokes this callback.
|
|
57
|
+
*/
|
|
58
|
+
onPrint?: () => void;
|
|
59
|
+
/** Disable Cmd/Ctrl+F and Cmd/Ctrl+H interception. */
|
|
60
|
+
disableFindReplaceShortcuts?: boolean;
|
|
61
|
+
/** Custom logo/icon renderer for the title bar. Slots remain preferred in templates. */
|
|
62
|
+
renderLogo?: () => VNodeChild;
|
|
63
|
+
/** Callback when the document name changes. */
|
|
64
|
+
onDocumentNameChange?: (name: string) => void;
|
|
65
|
+
/** Whether the document name is editable. */
|
|
66
|
+
documentNameEditable?: boolean;
|
|
67
|
+
/** Custom right-side actions renderer for the title bar. Slots remain preferred in templates. */
|
|
68
|
+
renderTitleBarRight?: () => VNodeChild;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Public ref shape for `<DocxEditor>`. Exposes the full editor-scope
|
|
72
|
+
* `EditorRefLike` contract so the agent bridge can attach to either
|
|
73
|
+
* React or Vue without an adapter shim.
|
|
74
|
+
*/
|
|
75
|
+
export type DocxEditorRef = EditorRefLike & {
|
|
76
|
+
/** Agent instance access is React-only today; Vue returns null for API parity. */
|
|
77
|
+
getAgent(): null;
|
|
78
|
+
/** Save the document and return DOCX bytes, matching React's component ref. */
|
|
79
|
+
save(): Promise<ArrayBuffer | null>;
|
|
80
|
+
/** Set zoom level (1.0 = 100%). */
|
|
81
|
+
setZoom(zoom: number): void;
|
|
82
|
+
/** Get current zoom level. */
|
|
83
|
+
getZoom(): number;
|
|
84
|
+
/** Focus the editor's hidden ProseMirror view. Vue-only — not in EditorRefLike. */
|
|
85
|
+
focus(): void;
|
|
86
|
+
/** Scroll the visible pages to a 1-indexed page number. */
|
|
87
|
+
scrollToPage(pageNumber: number): void;
|
|
88
|
+
/** Scroll to a raw ProseMirror document position. */
|
|
89
|
+
scrollToPosition(pmPos: number): void;
|
|
90
|
+
/** Open print preview / browser print. */
|
|
91
|
+
openPrintPreview(): void;
|
|
92
|
+
/** Print the document. */
|
|
93
|
+
print(): void;
|
|
94
|
+
/** Load a pre-parsed document programmatically. */
|
|
95
|
+
loadDocument(doc: Document): void;
|
|
96
|
+
/** Load a DOCX buffer programmatically. */
|
|
97
|
+
loadDocumentBuffer(buffer: DocxInput): Promise<void>;
|
|
98
|
+
/** Tear down the editor (destroys the PM view + frees listeners). */
|
|
99
|
+
destroy(): void;
|
|
100
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared toolbar prop bag — mirrors React's ToolbarProps. Loosely
|
|
3
|
+
* typed because the consumer surface here is just the slot-down
|
|
4
|
+
* channel; tightening would require dragging the entire
|
|
5
|
+
* ToolbarProps interface across the framework boundary.
|
|
6
|
+
*/
|
|
7
|
+
export type EditorToolbarProps = Record<string, unknown>;
|
|
8
|
+
export declare function provideEditorToolbar(props: EditorToolbarProps): void;
|
|
9
|
+
export declare function useEditorToolbar(): EditorToolbarProps;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { FontOption } from '@eigenpal/docx-editor-core/utils/fontOptions';
|
|
2
|
+
export declare const defaultFonts: FontOption[];
|
|
3
|
+
export declare const fontSizePresets: number[];
|
|
4
|
+
export declare const paragraphStyles: ({
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
previewStyle: {
|
|
8
|
+
fontSize: string;
|
|
9
|
+
fontWeight?: undefined;
|
|
10
|
+
color?: undefined;
|
|
11
|
+
};
|
|
12
|
+
} | {
|
|
13
|
+
id: string;
|
|
14
|
+
label: string;
|
|
15
|
+
previewStyle: {
|
|
16
|
+
fontSize: string;
|
|
17
|
+
fontWeight: string;
|
|
18
|
+
color?: undefined;
|
|
19
|
+
};
|
|
20
|
+
} | {
|
|
21
|
+
id: string;
|
|
22
|
+
label: string;
|
|
23
|
+
previewStyle: {
|
|
24
|
+
fontSize: string;
|
|
25
|
+
color: string;
|
|
26
|
+
fontWeight?: undefined;
|
|
27
|
+
};
|
|
28
|
+
} | {
|
|
29
|
+
id: string;
|
|
30
|
+
label: string;
|
|
31
|
+
previewStyle: {
|
|
32
|
+
fontSize: string;
|
|
33
|
+
fontWeight: string;
|
|
34
|
+
color: string;
|
|
35
|
+
};
|
|
36
|
+
})[];
|
|
37
|
+
export declare const lineSpacingOptions: {
|
|
38
|
+
label: string;
|
|
39
|
+
value: number;
|
|
40
|
+
}[];
|
|
41
|
+
export declare const ZOOM_PRESETS: number[];
|
|
42
|
+
export declare const DEFAULT_ZOOM_PERCENT = 100;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @eigenpal/docx-editor-vue/dialogs
|
|
3
|
+
*
|
|
4
|
+
* Modal dialog components — hyperlinks, find/replace, page setup, image
|
|
5
|
+
* properties, and keyboard shortcuts. Mirrors the React dialogs subpath.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { HyperlinkDialog, FindReplaceDialog } from '@eigenpal/docx-editor-vue/dialogs';
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export { default as FindReplaceDialog } from './FindReplaceDialog.vue';
|
|
16
|
+
export { default as FootnotePropertiesDialog } from './FootnotePropertiesDialog.vue';
|
|
17
|
+
export { default as HyperlinkDialog } from './HyperlinkDialog.vue';
|
|
18
|
+
export { default as ImagePositionDialog } from './ImagePositionDialog.vue';
|
|
19
|
+
export { default as ImagePropertiesDialog } from './ImagePropertiesDialog.vue';
|
|
20
|
+
export { default as InsertImageDialog } from './InsertImageDialog.vue';
|
|
21
|
+
export { default as InsertSymbolDialog } from './InsertSymbolDialog.vue';
|
|
22
|
+
export { default as InsertTableDialog } from './InsertTableDialog.vue';
|
|
23
|
+
export { default as KeyboardShortcutsDialog } from './KeyboardShortcutsDialog.vue';
|
|
24
|
+
export { default as PageSetupDialog } from './PageSetupDialog.vue';
|
|
25
|
+
export { default as PasteSpecialDialog } from './PasteSpecialDialog.vue';
|
|
26
|
+
export { default as SplitCellDialog } from './SplitCellDialog.vue';
|
|
27
|
+
export { default as TablePropertiesDialog } from './TablePropertiesDialog.vue';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { WrapType } from '@eigenpal/docx-editor-core/docx/wrapTypes';
|
|
2
|
+
type ImageAttrsCssFloat = 'left' | 'right' | 'none' | null;
|
|
3
|
+
export interface ImageContextMenuState {
|
|
4
|
+
open: boolean;
|
|
5
|
+
position: {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
};
|
|
9
|
+
pmPos: number;
|
|
10
|
+
currentWrapType: WrapType;
|
|
11
|
+
currentCssFloat?: ImageAttrsCssFloat;
|
|
12
|
+
inlinePositionEmu?: {
|
|
13
|
+
horizontalEmu: number;
|
|
14
|
+
verticalEmu: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Item appended below a divider — mirrors the React side
|
|
19
|
+
* (`ImageContextMenuTextAction`). `dividerAfter` lets the host group
|
|
20
|
+
* the items the same way Word does (Cut/Copy/Paste then divider then
|
|
21
|
+
* Delete).
|
|
22
|
+
*/
|
|
23
|
+
export interface ImageContextMenuTextAction {
|
|
24
|
+
action: string;
|
|
25
|
+
label: string;
|
|
26
|
+
shortcut?: string;
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
dividerAfter?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared `ImageSelectionInfo` type — imported by
|
|
3
|
+
* `ImageSelectionOverlay.vue` (for `defineProps`) and
|
|
4
|
+
* `useImageActions.ts` (for the composable's `selectedImage` ref).
|
|
5
|
+
* Pulled out of the .vue SFC so a plain .ts module can reference it
|
|
6
|
+
* without going through the `*.vue` wildcard shim, which doesn't
|
|
7
|
+
* carry named type exports.
|
|
8
|
+
*/
|
|
9
|
+
export interface ImageSelectionInfo {
|
|
10
|
+
element: HTMLElement;
|
|
11
|
+
pmPos: number;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Last-used Insert-Table dimensions. Module-level so the dialog reopens with
|
|
3
|
+
* whatever the user picked last time (mirrors React lifting this to component
|
|
4
|
+
* state that survives reopen).
|
|
5
|
+
*/
|
|
6
|
+
export declare const rememberedTableSize: {
|
|
7
|
+
rows: number;
|
|
8
|
+
cols: number;
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './sidebarUtils';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CommentSidebarItem } from '../../composables/useCommentSidebarItems';
|
|
2
|
+
import { ResolvedPosition as CoreResolvedPosition } from '@eigenpal/docx-editor-core/plugin-api/resolveItemPositions';
|
|
3
|
+
export type ResolvedPosition = CoreResolvedPosition<CommentSidebarItem>;
|
|
4
|
+
export declare const resolveItemPositions: (items: CommentSidebarItem[], anchorPositions: Map<string, number>, renderedDomContext: import('@eigenpal/docx-editor-core').RenderedDomContext | null, zoom: number, cardHeights: Map<string, number>, lastKnown: Map<string, number>) => CoreResolvedPosition<CommentSidebarItem>[];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CSSProperties } from 'vue';
|
|
2
|
+
export { getCommentText, formatDate, getInitials, getAvatarColor, truncateText, type TrackedChangeEntry, } from '@eigenpal/docx-editor-core/utils/comments';
|
|
3
|
+
/** Inline style for an avatar bubble — mirrors React's avatarStyle(). */
|
|
4
|
+
export declare function avatarStyle(name: string, size?: 32 | 28): CSSProperties;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { CSSProperties } from 'vue';
|
|
2
|
+
export interface TableStyleBorder {
|
|
3
|
+
style: string;
|
|
4
|
+
size?: number;
|
|
5
|
+
color?: {
|
|
6
|
+
rgb: string;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export interface TableStylePreset {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
/** Table-level borders */
|
|
13
|
+
tableBorders?: {
|
|
14
|
+
top?: TableStyleBorder;
|
|
15
|
+
bottom?: TableStyleBorder;
|
|
16
|
+
left?: TableStyleBorder;
|
|
17
|
+
right?: TableStyleBorder;
|
|
18
|
+
insideH?: TableStyleBorder;
|
|
19
|
+
insideV?: TableStyleBorder;
|
|
20
|
+
};
|
|
21
|
+
/** Conditional formatting per cell position */
|
|
22
|
+
conditionals?: Record<string, {
|
|
23
|
+
backgroundColor?: string;
|
|
24
|
+
borders?: {
|
|
25
|
+
top?: TableStyleBorder | null;
|
|
26
|
+
bottom?: TableStyleBorder | null;
|
|
27
|
+
left?: TableStyleBorder | null;
|
|
28
|
+
right?: TableStyleBorder | null;
|
|
29
|
+
};
|
|
30
|
+
bold?: boolean;
|
|
31
|
+
color?: string;
|
|
32
|
+
}>;
|
|
33
|
+
/** Which conditional formatting is active by default */
|
|
34
|
+
look?: {
|
|
35
|
+
firstRow?: boolean;
|
|
36
|
+
lastRow?: boolean;
|
|
37
|
+
firstCol?: boolean;
|
|
38
|
+
lastCol?: boolean;
|
|
39
|
+
noHBand?: boolean;
|
|
40
|
+
noVBand?: boolean;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export declare const BUILTIN_TABLE_STYLES: TableStylePreset[];
|
|
44
|
+
/** Get a built-in table style preset by ID. */
|
|
45
|
+
export declare function getBuiltinTableStyle(styleId: string): TableStylePreset | undefined;
|
|
46
|
+
/** Map from built-in style ID to en.json translation key under `table.styles.*`. */
|
|
47
|
+
export declare const TABLE_STYLE_NAME_KEYS: Record<string, string>;
|
|
48
|
+
/**
|
|
49
|
+
* Build the per-cell inline styles for a small preview grid of the given
|
|
50
|
+
* preset. Shared by TableStyleGallery and InsertTableDialog so the preview
|
|
51
|
+
* rendering stays in one place.
|
|
52
|
+
*/
|
|
53
|
+
export declare function getPreviewCells(preset: TableStylePreset, rows?: number, cols?: number): CSSProperties[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { HIGHLIGHT_HEX_TO_NAME, mapHexToHighlightName, } from '@eigenpal/docx-editor-core/utils/highlightColors';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as MaterialSymbol } from './MaterialSymbol.vue';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared `HyperlinkPopupData` type — imported by `HyperlinkPopup.vue`
|
|
3
|
+
* (for `defineProps`) and `useHyperlinkManagement.ts` (for the
|
|
4
|
+
* composable's `hyperlinkPopupData` ref). Pulled out of the .vue SFC so
|
|
5
|
+
* a plain .ts module can reference it without going through the `*.vue`
|
|
6
|
+
* wildcard shim, which doesn't carry named type exports.
|
|
7
|
+
*/
|
|
8
|
+
export interface HyperlinkPopupData {
|
|
9
|
+
href: string;
|
|
10
|
+
displayText: string;
|
|
11
|
+
tooltip?: string;
|
|
12
|
+
/** Popup position in the editor's pages-viewport coordinate space (CSS
|
|
13
|
+
* pixels from its top-left). Computed once at click time. The popup
|
|
14
|
+
* renders inside that viewport with `position: absolute`, so the
|
|
15
|
+
* browser handles repositioning during scroll for free. */
|
|
16
|
+
position: {
|
|
17
|
+
top: number;
|
|
18
|
+
left: number;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @eigenpal/docx-editor-vue/composables
|
|
3
|
+
*
|
|
4
|
+
* Vue composables mirroring the React `hooks` subpath — history, table
|
|
5
|
+
* selection, find/replace, autosave, clipboard, zoom, and the high-level
|
|
6
|
+
* `useDocxEditor` host composable.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { useAutoSave, useFindReplace } from '@eigenpal/docx-editor-vue/composables';
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @packageDocumentation
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export * from './useAutoSave';
|
|
17
|
+
export * from './useClipboard';
|
|
18
|
+
export * from './useCommentSidebarItems';
|
|
19
|
+
export * from './useDocxEditor';
|
|
20
|
+
export * from './useDragAutoScroll';
|
|
21
|
+
export * from './useFindReplace';
|
|
22
|
+
export * from './useFixedDropdown';
|
|
23
|
+
export * from './useHistory';
|
|
24
|
+
export * from './useSelectionHighlight';
|
|
25
|
+
export * from './useTableResize';
|
|
26
|
+
export * from './useTableSelection';
|
|
27
|
+
export * from './useTrackedChanges';
|
|
28
|
+
export * from './useVisualLineNavigation';
|
|
29
|
+
export * from './useWheelZoom';
|
|
30
|
+
export * from './useZoom';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { MaybeRef, Ref } from 'vue';
|
|
2
|
+
import { formatLastSaveTime, getAutoSaveStatusLabel, getAutoSaveStorageSize, formatStorageSize, isAutoSaveSupported } from '@eigenpal/docx-editor-core';
|
|
3
|
+
import { AutoSaveStatus, SavedDocumentData } from '@eigenpal/docx-editor-core/managers/types';
|
|
4
|
+
import { Document } from '@eigenpal/docx-editor-core/types/document';
|
|
5
|
+
export type { AutoSaveStatus, SavedDocumentData };
|
|
6
|
+
export { formatLastSaveTime, getAutoSaveStatusLabel, getAutoSaveStorageSize, formatStorageSize, isAutoSaveSupported, };
|
|
7
|
+
export interface UseAutoSaveOptions {
|
|
8
|
+
/** localStorage key (default: 'docx-editor-autosave') */
|
|
9
|
+
storageKey?: string;
|
|
10
|
+
/** Auto-save interval in ms (default: 30000) */
|
|
11
|
+
interval?: number;
|
|
12
|
+
/** Whether auto-save starts enabled (default: true). */
|
|
13
|
+
enabled?: boolean;
|
|
14
|
+
/** Maximum age of auto-save before it is considered stale. */
|
|
15
|
+
maxAge?: number;
|
|
16
|
+
/** Callback when save succeeds. */
|
|
17
|
+
onSave?: (timestamp: Date) => void;
|
|
18
|
+
/** Callback when save fails. */
|
|
19
|
+
onError?: (error: Error) => void;
|
|
20
|
+
/** Callback when recovery data is found. */
|
|
21
|
+
onRecoveryAvailable?: (savedDocument: SavedDocumentData) => void;
|
|
22
|
+
/** Whether document changes trigger a debounced save. */
|
|
23
|
+
saveOnChange?: boolean;
|
|
24
|
+
/** Debounce delay for saveOnChange in milliseconds. */
|
|
25
|
+
debounceDelay?: number;
|
|
26
|
+
}
|
|
27
|
+
export interface UseAutoSaveReturn {
|
|
28
|
+
status: Ref<AutoSaveStatus>;
|
|
29
|
+
lastSaveTime: Ref<Date | null>;
|
|
30
|
+
save: () => Promise<boolean>;
|
|
31
|
+
clearAutoSave: () => void;
|
|
32
|
+
hasRecoveryData: Ref<boolean>;
|
|
33
|
+
getRecoveryData: () => SavedDocumentData | null;
|
|
34
|
+
acceptRecovery: () => Document | null;
|
|
35
|
+
dismissRecovery: () => void;
|
|
36
|
+
isEnabled: Ref<boolean>;
|
|
37
|
+
enable: () => void;
|
|
38
|
+
disable: () => void;
|
|
39
|
+
}
|
|
40
|
+
export declare function useAutoSave(document: MaybeRef<Document | null | undefined>, options?: UseAutoSaveOptions): UseAutoSaveReturn;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { runsToClipboardContent, ParsedClipboardContent } from '@eigenpal/docx-editor-core/utils';
|
|
3
|
+
import { getSelectionRuns, createSelectionFromDOM, ClipboardSelection, Theme } from '@eigenpal/docx-editor-core';
|
|
4
|
+
export { getSelectionRuns, createSelectionFromDOM, runsToClipboardContent };
|
|
5
|
+
export type { ClipboardSelection };
|
|
6
|
+
export interface UseClipboardOptions {
|
|
7
|
+
onCopy?: (selection: ClipboardSelection) => void;
|
|
8
|
+
onCut?: (selection: ClipboardSelection) => void;
|
|
9
|
+
onPaste?: (content: ParsedClipboardContent, asPlainText: boolean) => void;
|
|
10
|
+
cleanWordFormatting?: boolean;
|
|
11
|
+
editable?: boolean;
|
|
12
|
+
onError?: (error: Error) => void;
|
|
13
|
+
theme?: Theme | null;
|
|
14
|
+
}
|
|
15
|
+
export interface UseClipboardReturn {
|
|
16
|
+
copy: (selection: ClipboardSelection) => Promise<boolean>;
|
|
17
|
+
cut: (selection: ClipboardSelection) => Promise<boolean>;
|
|
18
|
+
paste: (asPlainText?: boolean) => Promise<ParsedClipboardContent | null>;
|
|
19
|
+
isProcessing: Ref<boolean>;
|
|
20
|
+
lastPastedContent: Ref<ParsedClipboardContent | null>;
|
|
21
|
+
}
|
|
22
|
+
export declare function useClipboard(options?: UseClipboardOptions): UseClipboardReturn;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
import { Document } from '@eigenpal/docx-editor-core/types/document';
|
|
4
|
+
import { Comment } from '@eigenpal/docx-editor-core/types/content';
|
|
5
|
+
import { TrackedChangeEntry } from '../components/sidebar/sidebarUtils';
|
|
6
|
+
export interface UseCommentLifecycleOptions {
|
|
7
|
+
editorView: Ref<EditorView | null>;
|
|
8
|
+
getDocument: () => Document | null;
|
|
9
|
+
comments: Ref<Comment[]>;
|
|
10
|
+
trackedChanges: Ref<TrackedChangeEntry[]>;
|
|
11
|
+
resolvedCommentIds: Ref<Set<number>>;
|
|
12
|
+
activeSidebarItem: Ref<string | null>;
|
|
13
|
+
showSidebar: Ref<boolean>;
|
|
14
|
+
isAddingComment: Ref<boolean>;
|
|
15
|
+
readOnly: Ref<boolean>;
|
|
16
|
+
zoom: Ref<number>;
|
|
17
|
+
stateTick: Ref<number>;
|
|
18
|
+
pagesRef: Ref<HTMLElement | null>;
|
|
19
|
+
pagesViewportRef: Ref<HTMLElement | null>;
|
|
20
|
+
emit: (event: string, ...args: unknown[]) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare function useCommentLifecycle(opts: UseCommentLifecycleOptions): {
|
|
23
|
+
floatingCommentBtn: Ref<{
|
|
24
|
+
top: number;
|
|
25
|
+
left: number;
|
|
26
|
+
} | null, {
|
|
27
|
+
top: number;
|
|
28
|
+
left: number;
|
|
29
|
+
} | {
|
|
30
|
+
top: number;
|
|
31
|
+
left: number;
|
|
32
|
+
} | null>;
|
|
33
|
+
pendingCommentRange: Ref<{
|
|
34
|
+
from: number;
|
|
35
|
+
to: number;
|
|
36
|
+
} | null, {
|
|
37
|
+
from: number;
|
|
38
|
+
to: number;
|
|
39
|
+
} | {
|
|
40
|
+
from: number;
|
|
41
|
+
to: number;
|
|
42
|
+
} | null>;
|
|
43
|
+
addCommentYPosition: Ref<number | null, number | null>;
|
|
44
|
+
sidebarAutoOpenedRef: Ref<boolean, boolean>;
|
|
45
|
+
extractCommentsAndChanges: () => void;
|
|
46
|
+
handleAddComment: (text: string) => void;
|
|
47
|
+
handleCancelAddComment: () => void;
|
|
48
|
+
handleStartAddComment: () => void;
|
|
49
|
+
handleMarkerClick: (_commentId: number) => void;
|
|
50
|
+
recomputeFloatingCommentBtn: () => void;
|
|
51
|
+
recomputeActiveSidebarItem: () => void;
|
|
52
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
import { Comment, Document } from '@eigenpal/docx-editor-core/types/document';
|
|
4
|
+
import { TrackedChangeEntry } from '../components/sidebar/sidebarUtils';
|
|
5
|
+
export interface UseCommentManagementOptions {
|
|
6
|
+
editorView: Ref<EditorView | null>;
|
|
7
|
+
getDocument: () => Document | null;
|
|
8
|
+
comments: Ref<Comment[]>;
|
|
9
|
+
trackedChanges: Ref<TrackedChangeEntry[]>;
|
|
10
|
+
showSidebar: Ref<boolean>;
|
|
11
|
+
isAddingComment: Ref<boolean>;
|
|
12
|
+
pendingCommentRange: Ref<{
|
|
13
|
+
from: number;
|
|
14
|
+
to: number;
|
|
15
|
+
} | null>;
|
|
16
|
+
contentChangeSubscribers: Set<(document: unknown) => void>;
|
|
17
|
+
extractCommentsAndChanges: () => void;
|
|
18
|
+
emit: (event: string, ...args: unknown[]) => void;
|
|
19
|
+
}
|
|
20
|
+
export declare function useCommentManagement(opts: UseCommentManagementOptions): {
|
|
21
|
+
addComment: (options: {
|
|
22
|
+
paraId: string;
|
|
23
|
+
text: string;
|
|
24
|
+
author: string;
|
|
25
|
+
search?: string;
|
|
26
|
+
}) => number | null;
|
|
27
|
+
replyToComment: (commentId: number, text: string, author: string) => number | null;
|
|
28
|
+
resolveComment: (commentId: number) => void;
|
|
29
|
+
proposeChange: (options: {
|
|
30
|
+
paraId: string;
|
|
31
|
+
search: string;
|
|
32
|
+
replaceWith: string;
|
|
33
|
+
author: string;
|
|
34
|
+
}) => boolean;
|
|
35
|
+
handleCommentReply: (commentId: number, text: string) => void;
|
|
36
|
+
handleCommentUnresolve: (commentId: number) => void;
|
|
37
|
+
handleCommentDelete: (commentId: number) => void;
|
|
38
|
+
handleAcceptChange: (from: number, to: number) => void;
|
|
39
|
+
handleRejectChange: (from: number, to: number) => void;
|
|
40
|
+
handleTrackedChangeReply: (revisionId: number, text: string) => void;
|
|
41
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { Comment } from '@eigenpal/docx-editor-core/types/content';
|
|
3
|
+
import { TrackedChangeEntry } from './useTrackedChanges';
|
|
4
|
+
export interface CommentSidebarItem {
|
|
5
|
+
id: string;
|
|
6
|
+
anchorPos: number;
|
|
7
|
+
anchorKey?: string;
|
|
8
|
+
priority?: number;
|
|
9
|
+
isTemporary?: boolean;
|
|
10
|
+
fixedY?: number;
|
|
11
|
+
estimatedHeight?: number;
|
|
12
|
+
kind: 'add-comment' | 'comment' | 'tracked-change';
|
|
13
|
+
comment?: Comment;
|
|
14
|
+
replies?: Comment[];
|
|
15
|
+
change?: TrackedChangeEntry;
|
|
16
|
+
}
|
|
17
|
+
export interface UseCommentSidebarItemsOptions {
|
|
18
|
+
comments: Ref<Comment[]>;
|
|
19
|
+
trackedChanges: Ref<TrackedChangeEntry[]>;
|
|
20
|
+
showResolved?: Ref<boolean>;
|
|
21
|
+
isAddingComment?: Ref<boolean>;
|
|
22
|
+
addCommentYPosition?: Ref<number | null>;
|
|
23
|
+
}
|
|
24
|
+
export declare function useCommentSidebarItems({ comments, trackedChanges, showResolved, isAddingComment, addCommentYPosition, }: UseCommentSidebarItemsOptions): import('vue').ComputedRef<CommentSidebarItem[]>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ComputedRef, Ref, ShallowRef } from 'vue';
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
import { ImageLayoutTarget } from '@eigenpal/docx-editor-core/prosemirror/commands';
|
|
4
|
+
import { ImageSelectionInfo } from '../components/imageSelectionTypes';
|
|
5
|
+
import { ImageContextMenuState, ImageContextMenuTextAction } from '../components/imageContextMenuTypes';
|
|
6
|
+
type Commands = Record<string, ((...args: unknown[]) => unknown) | undefined>;
|
|
7
|
+
export interface TextContextMenuState {
|
|
8
|
+
isOpen: boolean;
|
|
9
|
+
position: {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
};
|
|
13
|
+
hasSelection: boolean;
|
|
14
|
+
inTable: boolean;
|
|
15
|
+
onImage: boolean;
|
|
16
|
+
canMergeCells: boolean;
|
|
17
|
+
canSplitCell: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface UseContextMenusOptions {
|
|
20
|
+
editorView: Ref<EditorView | null>;
|
|
21
|
+
selectedImage: ShallowRef<ImageSelectionInfo | null>;
|
|
22
|
+
zoom: Ref<number>;
|
|
23
|
+
showImageProperties: Ref<boolean>;
|
|
24
|
+
getCommands: () => Commands;
|
|
25
|
+
clearOverlay: () => void;
|
|
26
|
+
setPmSelection: (anchor: number, head?: number) => void;
|
|
27
|
+
resolvePos: (clientX: number, clientY: number) => number | null;
|
|
28
|
+
}
|
|
29
|
+
export interface UseContextMenusReturn {
|
|
30
|
+
contextMenu: Ref<TextContextMenuState>;
|
|
31
|
+
imageContextMenu: Ref<ImageContextMenuState | null>;
|
|
32
|
+
imageContextMenuTextActions: ComputedRef<ImageContextMenuTextAction[]>;
|
|
33
|
+
handleContextMenu: (event: MouseEvent) => void;
|
|
34
|
+
handleSelectedImageContextMenu: (event: MouseEvent) => void;
|
|
35
|
+
handleImageWrapSelect: (target: ImageLayoutTarget) => void;
|
|
36
|
+
handleContextMenuAction: (action: string) => void;
|
|
37
|
+
}
|
|
38
|
+
export declare function useContextMenus(opts: UseContextMenusOptions): UseContextMenusReturn;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { Document } from '@eigenpal/docx-editor-core/types/document';
|
|
3
|
+
import { DocxInput } from '@eigenpal/docx-editor-core/utils';
|
|
4
|
+
export interface UseDocumentLifecycleOptions {
|
|
5
|
+
documentBuffer: () => DocxInput | null;
|
|
6
|
+
document: () => Document | null;
|
|
7
|
+
loadDocumentBuffer: (buffer: DocxInput) => Promise<void>;
|
|
8
|
+
loadDocument: (doc: Document) => void;
|
|
9
|
+
sidebarAutoOpenedRef: Ref<boolean>;
|
|
10
|
+
}
|
|
11
|
+
export declare function useDocumentLifecycle(opts: UseDocumentLifecycleOptions): void;
|