@stll/folio-vue 0.2.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/dist/ListButtons-B498PX1d.js +4256 -0
- package/dist/ListButtons-D-zMJ7rl.cjs +4 -0
- package/dist/PageSetupDialog-CGBaBVzo.cjs +15 -0
- package/dist/PageSetupDialog-DsjAfJy0.js +4873 -0
- package/dist/TablePropertiesDialog-A-1Pm1f9.cjs +1 -0
- package/dist/TablePropertiesDialog-PyXEJC_o.js +887 -0
- package/dist/components/DocxEditor/pagedEditorRef.d.ts +75 -0
- package/dist/components/DocxEditor/types.d.ts +528 -0
- package/dist/components/EditorToolbarContext.d.ts +9 -0
- package/dist/components/FormattingBar.types.d.ts +67 -0
- package/dist/components/Toolbar/presets.d.ts +25 -0
- package/dist/components/dialogs/index.d.ts +24 -0
- package/dist/components/imageContextMenuTypes.d.ts +30 -0
- package/dist/components/imageSelectionTypes.d.ts +13 -0
- package/dist/components/insertTableState.d.ts +9 -0
- package/dist/components/sidebar/cardStyles.d.ts +1 -0
- package/dist/components/sidebar/cardUtils.d.ts +1 -0
- package/dist/components/sidebar/resolveItemPositions.d.ts +22 -0
- package/dist/components/sidebar/sidebarUtils.d.ts +4 -0
- package/dist/components/tableStylePresets.d.ts +60 -0
- package/dist/components/toolbarUtils.d.ts +3 -0
- package/dist/components/ui/AlignmentButtons.types.d.ts +13 -0
- package/dist/components/ui/StylePicker.types.d.ts +16 -0
- package/dist/components/ui/ZoomControl.types.d.ts +21 -0
- package/dist/components/ui/fontPickerValue.d.ts +1 -0
- package/dist/components/ui/hyperlinkPopupTypes.d.ts +20 -0
- package/dist/composables/commentMarks.d.ts +32 -0
- package/dist/composables/imageOverlayRect.d.ts +44 -0
- package/dist/composables/index.d.ts +30 -0
- package/dist/composables/useAutoSave.d.ts +39 -0
- package/dist/composables/useClipboard.d.ts +21 -0
- package/dist/composables/useColorMode.d.ts +8 -0
- package/dist/composables/useCommentLifecycle.d.ts +39 -0
- package/dist/composables/useCommentManagement.d.ts +47 -0
- package/dist/composables/useCommentSidebarItems.d.ts +24 -0
- package/dist/composables/useContextMenus.d.ts +64 -0
- package/dist/composables/useControllableBoolean.d.ts +16 -0
- package/dist/composables/useDocumentLifecycle.d.ts +11 -0
- package/dist/composables/useDocxEditor.d.ts +123 -0
- package/dist/composables/useDocxEditorRefApi.d.ts +68 -0
- package/dist/composables/useDragAutoScroll.d.ts +11 -0
- package/dist/composables/useFileIO.d.ts +43 -0
- package/dist/composables/useFindReplace.d.ts +22 -0
- package/dist/composables/useFixedDropdown.d.ts +14 -0
- package/dist/composables/useFormattingActions.d.ts +21 -0
- package/dist/composables/useHistory.d.ts +9 -0
- package/dist/composables/useHostCallbacks.d.ts +24 -0
- package/dist/composables/useHyperlinkManagement.d.ts +40 -0
- package/dist/composables/useImageActions.d.ts +25 -0
- package/dist/composables/useKeyboardShortcuts.d.ts +25 -0
- package/dist/composables/useMenuActions.d.ts +36 -0
- package/dist/composables/useOutlineSidebar.d.ts +24 -0
- package/dist/composables/usePageSetupControls.d.ts +28 -0
- package/dist/composables/usePagesPointer.d.ts +87 -0
- package/dist/composables/useParagraphStyleOptions.d.ts +18 -0
- package/dist/composables/usePortalClass.d.ts +8 -0
- package/dist/composables/useSelectionHighlight.d.ts +19 -0
- package/dist/composables/useSelectionSync.d.ts +30 -0
- package/dist/composables/useTableResize.d.ts +7 -0
- package/dist/composables/useTableSelection.d.ts +10 -0
- package/dist/composables/useToolbarDropdowns.d.ts +15 -0
- package/dist/composables/useToolbarFontSize.d.ts +15 -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 +61 -0
- package/dist/composables.js +378 -0
- package/dist/dialogs.cjs +1 -0
- package/dist/dialogs.js +3 -0
- package/dist/folio-vue.css +2 -0
- package/dist/i18n/index.d.ts +36 -0
- package/dist/i18n/messages.d.ts +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +4088 -0
- package/dist/messages.cjs +1 -0
- package/dist/messages.js +1 -0
- package/dist/renderAsync.d.ts +35 -0
- package/dist/styles/index.d.ts +12 -0
- package/dist/styles/zIndex.d.ts +18 -0
- package/dist/styles.cjs +1 -0
- package/dist/styles.js +5 -0
- package/dist/ui/folio-ui.d.ts +139 -0
- package/dist/ui.cjs +1 -0
- package/dist/ui.d.ts +67 -0
- package/dist/ui.js +446 -0
- package/dist/useZoom-BryUw3Cu.cjs +1 -0
- package/dist/useZoom-CIIRid8U.js +626 -0
- package/dist/utils/aiEditRange.d.ts +26 -0
- package/dist/utils/autoScroll.d.ts +22 -0
- package/dist/utils/cardStyles.d.ts +3 -0
- package/dist/utils/colorMode.d.ts +32 -0
- package/dist/utils/comments.d.ts +20 -0
- package/dist/utils/cssTypes.d.ts +7 -0
- package/dist/utils/domQueries.d.ts +39 -0
- package/dist/utils/fontOptions.d.ts +26 -0
- package/dist/utils/hostFonts.d.ts +25 -0
- package/dist/utils/imageClipboard.d.ts +9 -0
- package/dist/utils/index.d.ts +13 -0
- package/dist/utils/listState.d.ts +22 -0
- package/dist/utils/reportIssue.d.ts +18 -0
- package/dist/utils/selectionHighlight.d.ts +44 -0
- package/dist/utils/sidebarConstants.d.ts +8 -0
- package/dist/utils/stylePreview.d.ts +53 -0
- package/dist/utils/textSelection.d.ts +40 -0
- package/dist/zIndex-BY0qa8Au.js +12 -0
- package/dist/zIndex-dFsQbASx.cjs +1 -0
- package/package.json +99 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { WritableComputedRef } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* A boolean that can run either controlled or uncontrolled, exposed as a
|
|
4
|
+
* writable ref so existing call sites can keep mutating `.value` directly.
|
|
5
|
+
*
|
|
6
|
+
* - Controlled (`controlled()` returns a boolean): the prop is the source of
|
|
7
|
+
* truth. Internal state is bypassed; writes only call `onChange` (if provided)
|
|
8
|
+
* and the consumer decides whether to honor them.
|
|
9
|
+
* - Uncontrolled (`controlled()` returns `undefined`): the composable owns the
|
|
10
|
+
* value, and writes update internal state and call `onChange` so consumers can
|
|
11
|
+
* observe without owning state.
|
|
12
|
+
*
|
|
13
|
+
* `onChange` is optional and does not fire when the value would be unchanged.
|
|
14
|
+
* Mirrors the React adapter's `useControllableBoolean` hook.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useControllableBoolean(controlled: () => boolean | undefined, onChange?: (value: boolean) => void, defaultValue?: boolean): WritableComputedRef<boolean>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { Document } from '@stll/folio-core/types/document';
|
|
3
|
+
import { DocxInput } from '@stll/folio-core/utils/docxInput';
|
|
4
|
+
export type 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;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { MaybeRefOrGetter, Ref } from 'vue';
|
|
2
|
+
import { EditorState, Plugin } from 'prosemirror-state';
|
|
3
|
+
import { EditorView } from 'prosemirror-view';
|
|
4
|
+
import { FolioEditor } from '@stll/folio-core/controller/folioEditor';
|
|
5
|
+
import { FolioSelectiveSaveFlags } from '@stll/folio-core/docx/selectiveSaveFlags';
|
|
6
|
+
import { TripwireResult } from '@stll/folio-core/docx/selectiveSaveTripwire';
|
|
7
|
+
import { FlowBlock, Layout, Measure } from '@stll/folio-core/layout-engine/types';
|
|
8
|
+
import { CommandMap } from '@stll/folio-core/prosemirror/extensions/types';
|
|
9
|
+
import { AnonymizationMatch } from '@stll/folio-core/prosemirror/plugins/anonymizationDecorations';
|
|
10
|
+
import { TemplateSlashMenuKeyAction, TemplateSlashMenuState } from '@stll/folio-core/prosemirror/plugins/templateSlashMenu';
|
|
11
|
+
import { Document } from '@stll/folio-core/types/document';
|
|
12
|
+
import { DocxInput } from '@stll/folio-core/utils/docxInput';
|
|
13
|
+
export type UseDocxEditorOptions = {
|
|
14
|
+
/** Container element that hosts the off-screen ProseMirror editor. */
|
|
15
|
+
hiddenContainer: Ref<HTMLElement | null>;
|
|
16
|
+
/** Container element the paginated pages are painted into. */
|
|
17
|
+
pagesContainer: Ref<HTMLElement | null>;
|
|
18
|
+
/** Whether the editor is read-only. Reactive. */
|
|
19
|
+
readOnly?: MaybeRefOrGetter<boolean>;
|
|
20
|
+
/** Gap between pages in pixels. */
|
|
21
|
+
pageGap?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Stable identity of the loaded document (same across internal edits, distinct
|
|
24
|
+
* per loaded file). Threaded to the hidden-editor manager's external-load
|
|
25
|
+
* detection. Reactive.
|
|
26
|
+
*/
|
|
27
|
+
documentKey?: MaybeRefOrGetter<string | undefined>;
|
|
28
|
+
/**
|
|
29
|
+
* Editor mode. `'suggesting'` activates the mounted suggestion-mode plugin so
|
|
30
|
+
* typed text becomes tracked changes. Reactive — flip at runtime.
|
|
31
|
+
*/
|
|
32
|
+
editorMode?: MaybeRefOrGetter<"editing" | "suggesting" | "viewing">;
|
|
33
|
+
/** Author name attached to tracked changes minted in suggesting mode. */
|
|
34
|
+
author?: MaybeRefOrGetter<string>;
|
|
35
|
+
/** External ProseMirror plugins supplied by the host app. */
|
|
36
|
+
externalPlugins?: Plugin[];
|
|
37
|
+
/**
|
|
38
|
+
* Fires with the anonymization decoration plugin's current match list on
|
|
39
|
+
* mount, term push, and every doc edit. The anonymization plugin is always
|
|
40
|
+
* installed (inert until terms are pushed via `setAnonymizationTermsMeta`),
|
|
41
|
+
* mirroring the React adapter.
|
|
42
|
+
*/
|
|
43
|
+
onAnonymizationMatchesChange?: (matches: readonly AnonymizationMatch[]) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Install the template-directive + slash-menu plugins so `{{...}}` markers are
|
|
46
|
+
* scanned and the `/` trigger is active. Reactive: toggling reconfigures the
|
|
47
|
+
* live view's plugin set. Off for ordinary documents; on for the template
|
|
48
|
+
* editor. Mirrors React's `showTemplateDirectives` plugin gate.
|
|
49
|
+
*/
|
|
50
|
+
showTemplateDirectives?: MaybeRefOrGetter<boolean | undefined>;
|
|
51
|
+
/** Fires when the slash-menu trigger opens, its query changes, or it closes. */
|
|
52
|
+
onSlashMenuChange?: (state: TemplateSlashMenuState) => void;
|
|
53
|
+
/** Resolves a navigation/commit key while the slash menu is open. */
|
|
54
|
+
onSlashMenuKeyAction?: (action: TemplateSlashMenuKeyAction) => boolean;
|
|
55
|
+
/** Callback on document change (debounced PM → Document model conversion). */
|
|
56
|
+
onChange?: (doc: Document) => void;
|
|
57
|
+
/** Callback on parse / layout / lifecycle error. */
|
|
58
|
+
onError?: (error: Error) => void;
|
|
59
|
+
/** Callback on every selection-bearing transaction. */
|
|
60
|
+
onSelectionUpdate?: (state: EditorState) => void;
|
|
61
|
+
/** Callback when the hidden EditorView is created or torn down. */
|
|
62
|
+
onEditorViewReady?: (view: EditorView | null) => void;
|
|
63
|
+
/** Callback when a read-only user action would mutate the document. */
|
|
64
|
+
onReadOnlyEditAttempt?: () => void;
|
|
65
|
+
/**
|
|
66
|
+
* Operational flags for the save path. Selective save and its tripwire mode
|
|
67
|
+
* are off by default; hosts opt in once their rollout pipeline is ready.
|
|
68
|
+
* Reactive — read fresh on each `save()`. Mirrors React's `featureFlags`.
|
|
69
|
+
*/
|
|
70
|
+
featureFlags?: MaybeRefOrGetter<FolioSelectiveSaveFlags | undefined>;
|
|
71
|
+
/**
|
|
72
|
+
* Fired with the structured selective-vs-full comparison after a save when
|
|
73
|
+
* {@link FolioSelectiveSaveFlags.selectiveSaveTripwire} is on. Observability
|
|
74
|
+
* only — never blocks or poisons the save. Mirrors React's callback.
|
|
75
|
+
*/
|
|
76
|
+
onSelectiveSaveTripwire?: ((result: TripwireResult) => void) | undefined;
|
|
77
|
+
};
|
|
78
|
+
export type UseDocxEditorReturn = {
|
|
79
|
+
/** The headless controller (imperative API + layout access + events). */
|
|
80
|
+
editor: FolioEditor;
|
|
81
|
+
/** Off-screen ProseMirror EditorView, or null before mount. */
|
|
82
|
+
editorView: Ref<EditorView | null>;
|
|
83
|
+
/** Latest editor state, updated on each transaction. */
|
|
84
|
+
editorState: Ref<EditorState | null>;
|
|
85
|
+
/** True once the hidden view is mounted and a document is loaded. */
|
|
86
|
+
isReady: Ref<boolean>;
|
|
87
|
+
/**
|
|
88
|
+
* True when the live PM state has doc edits not yet serialized by `save()`.
|
|
89
|
+
* Set on every doc-changing transaction, cleared on a successful save and on
|
|
90
|
+
* document load/swap. Backs the ref API's `hasPendingChanges` (OR-ed with the
|
|
91
|
+
* comment-list dirty flag).
|
|
92
|
+
*/
|
|
93
|
+
isDirty: Ref<boolean>;
|
|
94
|
+
/** Last parse error message, or null if the most recent load succeeded. */
|
|
95
|
+
parseError: Ref<string | null>;
|
|
96
|
+
/** Computed page layout, or null before first paint. */
|
|
97
|
+
layout: Ref<Layout | null>;
|
|
98
|
+
/** Flow blocks from the latest layout pass — the range-projection fallback. */
|
|
99
|
+
blocks: Ref<FlowBlock[]>;
|
|
100
|
+
/** Measures from the latest layout pass — the range-projection fallback. */
|
|
101
|
+
measures: Ref<Measure[]>;
|
|
102
|
+
/** Load a DOCX from a binary buffer / Blob / File. */
|
|
103
|
+
loadBuffer: (buffer: DocxInput) => Promise<void>;
|
|
104
|
+
/** Load an already-parsed `Document` directly. */
|
|
105
|
+
loadDocument: (doc: Document) => void;
|
|
106
|
+
/** Serialize the current document to a DOCX blob. */
|
|
107
|
+
save: (options?: {
|
|
108
|
+
selective?: boolean;
|
|
109
|
+
}) => Promise<Blob | null>;
|
|
110
|
+
/** Snapshot the current document model. */
|
|
111
|
+
getDocument: () => Document | null;
|
|
112
|
+
/** Publish a fresh Document object (e.g. after HF materialisation). */
|
|
113
|
+
setDocument: (doc: Document) => void;
|
|
114
|
+
/** Access the extension command map for invoking marks / nodes / features. */
|
|
115
|
+
getCommands: () => CommandMap;
|
|
116
|
+
/** Focus the hidden ProseMirror view. */
|
|
117
|
+
focus: () => void;
|
|
118
|
+
/** Force a re-layout without a doc change (e.g. after page-setup edits). */
|
|
119
|
+
reLayout: () => void;
|
|
120
|
+
/** Destroy the editor view and clean up listeners. */
|
|
121
|
+
destroy: () => void;
|
|
122
|
+
};
|
|
123
|
+
export declare function useDocxEditor(options: UseDocxEditorOptions): UseDocxEditorReturn;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
import { FolioEditor } from '@stll/folio-core/controller/folioEditor';
|
|
4
|
+
import { Layout } from '@stll/folio-core/layout-engine';
|
|
5
|
+
import { Document } from '@stll/folio-core/types/document';
|
|
6
|
+
import { DocxInput } from '@stll/folio-core/utils/docxInput';
|
|
7
|
+
import { DocxEditorRef } from '../components/DocxEditor/types';
|
|
8
|
+
export type UseDocxEditorRefApiOptions = {
|
|
9
|
+
/** Headless controller handle (imperative API + events; Seam 6). */
|
|
10
|
+
editor: FolioEditor;
|
|
11
|
+
/** Off-screen ProseMirror EditorView, or null before mount. */
|
|
12
|
+
editorView: Ref<EditorView | null>;
|
|
13
|
+
/**
|
|
14
|
+
* Doc-dirty flag from useDocxEditor: live PM edits not yet serialized. Backs
|
|
15
|
+
* the doc side of `hasPendingChanges` (React's ParagraphChangeTracker signals).
|
|
16
|
+
*/
|
|
17
|
+
isDirty: Readonly<Ref<boolean>>;
|
|
18
|
+
/**
|
|
19
|
+
* Comment-list dirty flag from useCommentManagement: comment mutations not yet
|
|
20
|
+
* serialized. Backs the comment side of `hasPendingChanges` (React's
|
|
21
|
+
* `commentsDirtyRef`).
|
|
22
|
+
*/
|
|
23
|
+
commentsDirty: Readonly<Ref<boolean>>;
|
|
24
|
+
/**
|
|
25
|
+
* Clear {@link commentsDirty} after a successful save. Called from the `save`
|
|
26
|
+
* wrapper below — the single public save entry point — so the comment flag is
|
|
27
|
+
* reset alongside useDocxEditor's doc-dirty flag, mirroring React's handleSave.
|
|
28
|
+
*/
|
|
29
|
+
clearCommentsDirty: () => void;
|
|
30
|
+
/** Computed page layout, or null before first paint. */
|
|
31
|
+
layout: Ref<Layout | null>;
|
|
32
|
+
/** Painted pages container (the `HTMLDivElement` the painter writes into). */
|
|
33
|
+
pagesRef: Ref<HTMLElement | null>;
|
|
34
|
+
/** Scrolling viewport wrapping the pages container. */
|
|
35
|
+
pagesViewportRef: Ref<HTMLElement | null>;
|
|
36
|
+
/** Current zoom factor (1 = 100%). */
|
|
37
|
+
zoom: Ref<number>;
|
|
38
|
+
/**
|
|
39
|
+
* Scroll the pages viewport so a PM document position is visible (from
|
|
40
|
+
* usePagesPointer). Backs the AI-edit / content-control scroll methods, the
|
|
41
|
+
* Vue analogue of React's `PagedEditorRef.scrollToPosition`.
|
|
42
|
+
*/
|
|
43
|
+
scrollVisiblePositionIntoView: (pmPos: number) => void;
|
|
44
|
+
/** Editor author, used as the default operation author for AI edits. */
|
|
45
|
+
author: () => string;
|
|
46
|
+
/**
|
|
47
|
+
* Mint a comment for an AI-edit operation that carries comment text, append
|
|
48
|
+
* it to the thread list, and return its id (mirrors React's `createCommentId`
|
|
49
|
+
* closure over the comment manager). Wired from useCommentManagement.
|
|
50
|
+
*/
|
|
51
|
+
createAIEditComment: (text: string) => number;
|
|
52
|
+
focus: () => void;
|
|
53
|
+
getDocument: () => Document | null;
|
|
54
|
+
setZoom: (zoom: number) => void;
|
|
55
|
+
/** useDocxEditor.save returns a Blob; the ref surface exposes an ArrayBuffer. */
|
|
56
|
+
save: (options?: {
|
|
57
|
+
selective?: boolean;
|
|
58
|
+
}) => Promise<Blob | null>;
|
|
59
|
+
loadDocument: (doc: Document) => void;
|
|
60
|
+
loadDocumentBuffer: (buffer: DocxInput) => Promise<void>;
|
|
61
|
+
/** Optional host hook for print. */
|
|
62
|
+
onPrint?: (() => void) | undefined;
|
|
63
|
+
/** Optional host hook fired with the serialized `.docx` bytes after `save()`. */
|
|
64
|
+
onSave?: ((buffer: ArrayBuffer) => void) | undefined;
|
|
65
|
+
};
|
|
66
|
+
export declare function useDocxEditorRefApi(opts: UseDocxEditorRefApiOptions): {
|
|
67
|
+
exposed: DocxEditorRef;
|
|
68
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
export type DragAutoScrollOptions = {
|
|
3
|
+
pagesContainer: Ref<HTMLElement | null>;
|
|
4
|
+
/** Called during auto-scroll to extend the selection at the current mouse position. */
|
|
5
|
+
onScrollExtendSelection: (clientX: number, clientY: number) => void;
|
|
6
|
+
};
|
|
7
|
+
export type UseDragAutoScrollReturn = {
|
|
8
|
+
updateMousePosition: (clientX: number, clientY: number) => void;
|
|
9
|
+
stopAutoScroll: () => void;
|
|
10
|
+
};
|
|
11
|
+
export declare function useDragAutoScroll({ pagesContainer, onScrollExtendSelection, }: DragAutoScrollOptions): UseDragAutoScrollReturn;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { EditorView } from 'prosemirror-view';
|
|
2
|
+
import { Document } from '@stll/folio-core/types/document';
|
|
3
|
+
type DocxBufferInput = ArrayBuffer | Uint8Array | Blob | File;
|
|
4
|
+
export type UseFileIOOptions = {
|
|
5
|
+
/** From useDocxEditor — loads a .docx buffer into the editor. */
|
|
6
|
+
loadBuffer: (buffer: DocxBufferInput) => Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Host override for File > Open / Cmd+O. When provided, the picked file is
|
|
9
|
+
* passed here instead of running the built-in local load — lets consumers
|
|
10
|
+
* route Open through their own import pipeline (e.g. a CRDT backend).
|
|
11
|
+
*/
|
|
12
|
+
onOpen?: (file: File) => void | Promise<void>;
|
|
13
|
+
/** From useDocxEditor — loads an already-parsed Document model. */
|
|
14
|
+
loadParsedDocument: (doc: Document) => void;
|
|
15
|
+
/** From useDocxEditor — returns the current Document, or null. */
|
|
16
|
+
getDocument: () => Document | null;
|
|
17
|
+
/** From useDocxEditor — serializes the current state to a .docx Blob. */
|
|
18
|
+
saveBlob: () => Promise<Blob | null>;
|
|
19
|
+
/** Fired after load+extract so the next tick sees comments/tracked-changes. */
|
|
20
|
+
extractCommentsAndChanges: () => void;
|
|
21
|
+
/** SFC's emit function — re-emits ready / rename / update:document / error. */
|
|
22
|
+
emit: (event: string, ...args: unknown[]) => void;
|
|
23
|
+
/** Accessor — read freshly inside the handler so prop updates are honored. */
|
|
24
|
+
documentName: () => string | undefined;
|
|
25
|
+
onDocumentNameChange?: (name: string) => void;
|
|
26
|
+
/** Active editor view to insert images into — the header/footer being edited, else the body. */
|
|
27
|
+
getActiveView: () => EditorView | null;
|
|
28
|
+
/** Vue's `nextTick` — passed in so the composable doesn't require its own import wiring. */
|
|
29
|
+
nextTick: () => Promise<void>;
|
|
30
|
+
};
|
|
31
|
+
export declare function useFileIO(opts: UseFileIOOptions): {
|
|
32
|
+
docxInputRef: import('vue').Ref<HTMLInputElement | null, HTMLInputElement | null>;
|
|
33
|
+
imageInputRef: import('vue').Ref<HTMLInputElement | null, HTMLInputElement | null>;
|
|
34
|
+
handleImageFileChange: (event: Event) => void;
|
|
35
|
+
handleDocxFileChange: (event: Event) => Promise<void>;
|
|
36
|
+
handleDocumentNameChange: (name: string) => void;
|
|
37
|
+
downloadCurrentDocument: () => Promise<void>;
|
|
38
|
+
emitReadyAfterSidebarStateRefresh: () => Promise<void>;
|
|
39
|
+
loadDocumentBuffer: (buffer: DocxBufferInput) => Promise<void>;
|
|
40
|
+
loadDocument: (doc: Document) => void;
|
|
41
|
+
save: () => Promise<ArrayBuffer | null>;
|
|
42
|
+
};
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue port of the find/replace UI-state container.
|
|
3
|
+
*
|
|
4
|
+
* PORT-BLOCKED (missing `utils/findReplace` UI-util): upstream builds this
|
|
5
|
+
* composable's entire state on three symbols from
|
|
6
|
+
* `@eigenpal/docx-editor-core/utils/findReplace` — the `FindMatch` and
|
|
7
|
+
* `FindOptions` data contracts and the `createDefaultFindOptions()` factory.
|
|
8
|
+
* That util is absent from our fork: it is neither in `@stll/folio-core`
|
|
9
|
+
* (whose search surface is the lower-level `prosemirror/findReplaceSelection`
|
|
10
|
+
* `FindMatchPosition` + `managers/FindReplaceManager`, a different shape) nor
|
|
11
|
+
* in our ported Vue `../utils/*`. Every field of the reactive state
|
|
12
|
+
* (`options: createDefaultFindOptions()`, `matches: FindMatch[]`, the
|
|
13
|
+
* `currentMatch`/`setMatches`/`goToMatch` surface) depends on those types, so
|
|
14
|
+
* there is no working subset to port without fabricating the data contract.
|
|
15
|
+
*
|
|
16
|
+
* Unblock: port upstream `packages/core/src/utils/findReplace.ts` (pure, no
|
|
17
|
+
* runtime deps) into the Vue package as `../utils/findReplace.ts`, reconciling
|
|
18
|
+
* its `FindMatch`/`FindOptions` with core's `FindMatchPosition` /
|
|
19
|
+
* `FindReplaceManager`, then restore the full composable — its body is a direct
|
|
20
|
+
* `reactive()` translation of the React hook with no other blockers.
|
|
21
|
+
*/
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Ref, CSSProperties } from 'vue';
|
|
2
|
+
export type UseFixedDropdownOptions = {
|
|
3
|
+
isOpen: Ref<boolean>;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
/** 'left' aligns dropdown left edge to trigger, 'right' aligns right edge. */
|
|
6
|
+
align?: "left" | "right";
|
|
7
|
+
};
|
|
8
|
+
export type UseFixedDropdownReturn = {
|
|
9
|
+
containerRef: Ref<HTMLElement | null>;
|
|
10
|
+
dropdownRef: Ref<HTMLElement | null>;
|
|
11
|
+
dropdownStyle: Ref<CSSProperties>;
|
|
12
|
+
handleMouseDown: (e: MouseEvent) => void;
|
|
13
|
+
};
|
|
14
|
+
export declare function useFixedDropdown({ isOpen, onClose, align, }: UseFixedDropdownOptions): UseFixedDropdownReturn;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
import { Document } from '@stll/folio-core/types/document';
|
|
4
|
+
export type UseFormattingActionsOptions = {
|
|
5
|
+
editorView: Ref<EditorView | null>;
|
|
6
|
+
/**
|
|
7
|
+
* The view interactive toolbar formatting should target. While a header or
|
|
8
|
+
* footer is being edited this is its EditorView, so toolbar actions land in
|
|
9
|
+
* the HF and not the body (#749). Falls back to the body `editorView`.
|
|
10
|
+
*/
|
|
11
|
+
activeView?: Ref<EditorView | null>;
|
|
12
|
+
getDocument: () => Document | null;
|
|
13
|
+
};
|
|
14
|
+
export declare function useFormattingActions(opts: UseFormattingActionsOptions): {
|
|
15
|
+
handleClearFormatting: () => void;
|
|
16
|
+
handleApplyStyle: (styleId: string) => void;
|
|
17
|
+
handleInsertPageBreak: () => void;
|
|
18
|
+
handleInsertSectionBreakNextPage: () => void;
|
|
19
|
+
handleInsertSectionBreakContinuous: () => void;
|
|
20
|
+
handleInsertSymbol: (symbol: string) => void;
|
|
21
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
export type UseHistoryReturn = {
|
|
4
|
+
canUndo: ComputedRef<boolean>;
|
|
5
|
+
canRedo: ComputedRef<boolean>;
|
|
6
|
+
undo: () => boolean;
|
|
7
|
+
redo: () => boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function useHistory(view: Ref<EditorView | null>, stateTick: Ref<number>): UseHistoryReturn;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bridges the host-facing `onComment*` and `onEditorViewReady` props into the
|
|
3
|
+
* editor internals, keeping the host SFC lean.
|
|
4
|
+
*
|
|
5
|
+
* PORT-BLOCKED (missing `useCommentManagement` + comment props): upstream's
|
|
6
|
+
* primary output is a `CommentCallbacks` bundle
|
|
7
|
+
* (`onCommentAdd`/`onCommentResolve`/`onCommentDelete`/`onCommentReply`/
|
|
8
|
+
* `onCommentsChange`) whose type is exported by the sibling
|
|
9
|
+
* `./useCommentManagement` composable — not yet ported to our fork. It also
|
|
10
|
+
* reads four host props (`onCommentAdd`, `onCommentResolve`, `onCommentDelete`,
|
|
11
|
+
* `onCommentReply`) that do not exist on our `DocxEditorProps` (which currently
|
|
12
|
+
* exposes only `onCommentsChange` and `onEditorViewReady`). Both the
|
|
13
|
+
* `CommentCallbacks` contract and the props it wires are absent, so the
|
|
14
|
+
* comment-bridge cannot be built without fabricating an API.
|
|
15
|
+
*
|
|
16
|
+
* The `onEditorViewReady` watch is portable on its own, but it is a bare side
|
|
17
|
+
* effect (no return value) and not the composable's contract, so this is left
|
|
18
|
+
* as a full block rather than a degenerate stub.
|
|
19
|
+
*
|
|
20
|
+
* Unblock: port `useCommentManagement` (exporting `CommentCallbacks`) and add
|
|
21
|
+
* the four `onComment*` callbacks to `DocxEditorProps`, then restore the
|
|
22
|
+
* upstream body verbatim.
|
|
23
|
+
*/
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { Command } from 'prosemirror-state';
|
|
3
|
+
import { EditorView } from 'prosemirror-view';
|
|
4
|
+
import { HyperlinkPopupData } from '../components/ui/hyperlinkPopupTypes';
|
|
5
|
+
export type { HyperlinkPopupData };
|
|
6
|
+
type CommandFactory = (...args: readonly unknown[]) => Command;
|
|
7
|
+
export type UseHyperlinkManagementOptions = {
|
|
8
|
+
editorView: Ref<EditorView | null>;
|
|
9
|
+
getCommands: () => Record<string, CommandFactory>;
|
|
10
|
+
};
|
|
11
|
+
export type HyperlinkSubmitData = {
|
|
12
|
+
url?: string;
|
|
13
|
+
bookmark?: string;
|
|
14
|
+
displayText: string;
|
|
15
|
+
tooltip: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function useHyperlinkManagement(opts: UseHyperlinkManagementOptions): {
|
|
18
|
+
hyperlinkPopupData: Ref<{
|
|
19
|
+
href: string;
|
|
20
|
+
displayText: string;
|
|
21
|
+
tooltip?: string;
|
|
22
|
+
position: {
|
|
23
|
+
top: number;
|
|
24
|
+
left: number;
|
|
25
|
+
};
|
|
26
|
+
} | null, HyperlinkPopupData | {
|
|
27
|
+
href: string;
|
|
28
|
+
displayText: string;
|
|
29
|
+
tooltip?: string;
|
|
30
|
+
position: {
|
|
31
|
+
top: number;
|
|
32
|
+
left: number;
|
|
33
|
+
};
|
|
34
|
+
} | null>;
|
|
35
|
+
handleHyperlinkSubmit: (data: HyperlinkSubmitData) => void;
|
|
36
|
+
handleHyperlinkRemove: () => void;
|
|
37
|
+
handleHyperlinkPopupNavigate: (href: string) => void;
|
|
38
|
+
handleHyperlinkPopupEdit: (displayText: string, href: string) => void;
|
|
39
|
+
handleHyperlinkPopupRemove: () => void;
|
|
40
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ComputedRef, Ref, ShallowRef } from 'vue';
|
|
2
|
+
import { Command } from 'prosemirror-state';
|
|
3
|
+
import { EditorView } from 'prosemirror-view';
|
|
4
|
+
import { ImageSelectionInfo } from '../components/imageSelectionTypes';
|
|
5
|
+
type CommandFactory = (...args: readonly unknown[]) => Command;
|
|
6
|
+
export type UseImageActionsOptions = {
|
|
7
|
+
editorView: Ref<EditorView | null>;
|
|
8
|
+
zoom: Ref<number>;
|
|
9
|
+
stateTick: Ref<number>;
|
|
10
|
+
getCommands: () => Record<string, CommandFactory>;
|
|
11
|
+
};
|
|
12
|
+
export type ImageToolbarContext = {
|
|
13
|
+
wrapType: string;
|
|
14
|
+
displayMode: string;
|
|
15
|
+
cssFloat: string | null;
|
|
16
|
+
};
|
|
17
|
+
export type UseImageActionsReturn = {
|
|
18
|
+
selectedImage: ShallowRef<ImageSelectionInfo | null>;
|
|
19
|
+
imageInteracting: Ref<boolean>;
|
|
20
|
+
imageToolbarContext: ComputedRef<ImageToolbarContext | null>;
|
|
21
|
+
handleToolbarImageWrap: (value: string) => void;
|
|
22
|
+
handleImageTransform: (action: "rotateCW" | "rotateCCW" | "flipH" | "flipV") => void;
|
|
23
|
+
};
|
|
24
|
+
export declare function useImageActions(opts: UseImageActionsOptions): UseImageActionsReturn;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
export type UseKeyboardShortcutsOptions = {
|
|
3
|
+
showKeyboardShortcuts: Ref<boolean>;
|
|
4
|
+
showFindReplace: Ref<boolean>;
|
|
5
|
+
showHyperlink: Ref<boolean>;
|
|
6
|
+
/** From useZoom — handles Ctrl+= / Ctrl+- / Ctrl+0. */
|
|
7
|
+
handleZoomKeyDown: (e: KeyboardEvent) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Host prop accessor — read freshly inside the handler so a host
|
|
10
|
+
* toggle at runtime is honored. (Capturing the prop value at setup
|
|
11
|
+
* time would freeze it.)
|
|
12
|
+
*/
|
|
13
|
+
disableFindReplaceShortcuts?: () => boolean | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Whether `File > Open` / Cmd+O is enabled. Read freshly so a runtime host
|
|
16
|
+
* toggle is honored. When false (or `onOpenDocument` is absent), Cmd+O is
|
|
17
|
+
* left unhandled so the browser default stands.
|
|
18
|
+
*/
|
|
19
|
+
showFileOpen?: () => boolean | undefined;
|
|
20
|
+
/** Opens the DOCX picker — wired to the same hidden input as File > Open. */
|
|
21
|
+
onOpenDocument?: () => void;
|
|
22
|
+
};
|
|
23
|
+
export declare function useKeyboardShortcuts(opts: UseKeyboardShortcutsOptions): {
|
|
24
|
+
handleKeyDown: (e: KeyboardEvent) => void;
|
|
25
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
import { Command } from 'prosemirror-state';
|
|
4
|
+
/**
|
|
5
|
+
* A toolbar/menu command factory: called with whatever arguments the
|
|
6
|
+
* specific command needs, it returns a ProseMirror `Command`. The
|
|
7
|
+
* argument list is heterogeneous across commands (some take none,
|
|
8
|
+
* `insertTable` takes rows/cols), so it is typed structurally rather
|
|
9
|
+
* than per-command.
|
|
10
|
+
*/
|
|
11
|
+
type CommandFactory = (...args: readonly unknown[]) => Command;
|
|
12
|
+
export type UseMenuActionsOptions = {
|
|
13
|
+
editorView: Ref<EditorView | null>;
|
|
14
|
+
getCommands: () => Record<string, CommandFactory>;
|
|
15
|
+
docxInputRef: Ref<HTMLInputElement | null>;
|
|
16
|
+
imageInputRef: Ref<HTMLInputElement | null>;
|
|
17
|
+
showPageSetup: Ref<boolean>;
|
|
18
|
+
showWatermark: Ref<boolean>;
|
|
19
|
+
showHyperlink: Ref<boolean>;
|
|
20
|
+
showInsertSymbol: Ref<boolean>;
|
|
21
|
+
showKeyboardShortcuts: Ref<boolean>;
|
|
22
|
+
handleClearFormatting: () => void;
|
|
23
|
+
handleInsertPageBreak: () => void;
|
|
24
|
+
handleInsertSectionBreakNextPage: () => void;
|
|
25
|
+
handleInsertSectionBreakContinuous: () => void;
|
|
26
|
+
handleToggleOutline: () => void;
|
|
27
|
+
handleToggleSidebar: () => void;
|
|
28
|
+
downloadCurrentDocument: () => Promise<void>;
|
|
29
|
+
emit: (event: string, ...args: unknown[]) => void;
|
|
30
|
+
};
|
|
31
|
+
export declare function useMenuActions(opts: UseMenuActionsOptions): {
|
|
32
|
+
handleMenuAction: (action: string) => void;
|
|
33
|
+
handleMenuTableInsert: (rows: number, cols: number) => void;
|
|
34
|
+
execSimpleCommand: (name: string) => void;
|
|
35
|
+
};
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
import { HeadingInfo } from '@stll/folio-core/utils/headingCollector';
|
|
4
|
+
export type UseOutlineSidebarOptions = {
|
|
5
|
+
editorView: Ref<EditorView | null>;
|
|
6
|
+
showOutline: Ref<boolean>;
|
|
7
|
+
showSidebar: Ref<boolean>;
|
|
8
|
+
outlineHeadings: Ref<HeadingInfo[]>;
|
|
9
|
+
activeSidebarItem: Ref<string | null>;
|
|
10
|
+
extractCommentsAndChanges: () => void;
|
|
11
|
+
/**
|
|
12
|
+
* Scroll the VISIBLE paged viewport to a PM position. The hidden PM
|
|
13
|
+
* (`left: -9999px`) is never what the user sees, so `tr.scrollIntoView()`
|
|
14
|
+
* on it does nothing; the outline must drive the painter viewport instead
|
|
15
|
+
* (mirrors React's `scrollToPosition`; #930).
|
|
16
|
+
*/
|
|
17
|
+
scrollToVisiblePosition: (pmPos: number) => void;
|
|
18
|
+
};
|
|
19
|
+
export declare function useOutlineSidebar(opts: UseOutlineSidebarOptions): {
|
|
20
|
+
handleToggleOutline: () => void;
|
|
21
|
+
handleOutlineNavigate: (pmPos: number) => void;
|
|
22
|
+
handleToggleSidebar: () => void;
|
|
23
|
+
handleEditorScrollMouseDown: (event: MouseEvent) => void;
|
|
24
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
import { Document, SectionProperties } from '@stll/folio-core/types/document';
|
|
4
|
+
export type UsePageSetupControlsOptions = {
|
|
5
|
+
editorView: Ref<EditorView | null>;
|
|
6
|
+
getDocument: () => Document | null;
|
|
7
|
+
readOnly: Ref<boolean>;
|
|
8
|
+
stateTick: Ref<number>;
|
|
9
|
+
reLayout: () => void;
|
|
10
|
+
/**
|
|
11
|
+
* Notified after a direct section-properties write (margins, page size,
|
|
12
|
+
* orientation) so the host's `onChange` fires. These writes bypass the PM
|
|
13
|
+
* transaction pipeline, so this is their only change signal; ruler indent /
|
|
14
|
+
* tab-stop edits dispatch PM commands and notify via the pipeline instead.
|
|
15
|
+
*/
|
|
16
|
+
onChange: (doc: Document) => void;
|
|
17
|
+
};
|
|
18
|
+
export declare function usePageSetupControls(opts: UsePageSetupControlsOptions): {
|
|
19
|
+
handlePageSetupApply: (sp: Partial<SectionProperties>) => void;
|
|
20
|
+
handleLeftMarginChange: (twips: number) => void;
|
|
21
|
+
handleRightMarginChange: (twips: number) => void;
|
|
22
|
+
handleTopMarginChange: (twips: number) => void;
|
|
23
|
+
handleBottomMarginChange: (twips: number) => void;
|
|
24
|
+
handleIndentLeftChange: (twips: number) => void;
|
|
25
|
+
handleIndentRightChange: (twips: number) => void;
|
|
26
|
+
handleFirstLineIndentChange: (twips: number) => void;
|
|
27
|
+
handleTabStopRemove: (positionTwips: number) => void;
|
|
28
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Ref, ShallowRef } from 'vue';
|
|
2
|
+
import { Command } from 'prosemirror-state';
|
|
3
|
+
import { EditorView } from 'prosemirror-view';
|
|
4
|
+
import { HeaderFooter, BlockContent } from '@stll/folio-core/types/content';
|
|
5
|
+
import { Document } from '@stll/folio-core/types/document';
|
|
6
|
+
import { Layout } from '@stll/folio-core/layout-engine';
|
|
7
|
+
import { ImageSelectionInfo } from '../components/imageSelectionTypes';
|
|
8
|
+
import { HyperlinkPopupData } from '../components/ui/hyperlinkPopupTypes';
|
|
9
|
+
type CommandFactory = (...args: readonly unknown[]) => Command;
|
|
10
|
+
type Commands = Record<string, CommandFactory>;
|
|
11
|
+
type TableResizeApi = {
|
|
12
|
+
tryStartResize: (e: MouseEvent, view: EditorView) => boolean;
|
|
13
|
+
isResizing: Ref<boolean>;
|
|
14
|
+
};
|
|
15
|
+
export type TableInsertButton = {
|
|
16
|
+
type: "row" | "column";
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
cellPmPos: number;
|
|
20
|
+
};
|
|
21
|
+
export type HfEditState = {
|
|
22
|
+
position: "header" | "footer";
|
|
23
|
+
rId: string | null;
|
|
24
|
+
headerFooter: HeaderFooter | null;
|
|
25
|
+
targetRect: {
|
|
26
|
+
top: number;
|
|
27
|
+
left: number;
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
} | null;
|
|
31
|
+
};
|
|
32
|
+
export type ScrollPageInfo = {
|
|
33
|
+
currentPage: number;
|
|
34
|
+
totalPages: number;
|
|
35
|
+
visible: boolean;
|
|
36
|
+
};
|
|
37
|
+
export type UsePagesPointerOptions = {
|
|
38
|
+
editorView: Ref<EditorView | null>;
|
|
39
|
+
pagesRef: Ref<HTMLElement | null>;
|
|
40
|
+
pagesViewportRef: Ref<HTMLElement | null>;
|
|
41
|
+
selectedImage: ShallowRef<ImageSelectionInfo | null>;
|
|
42
|
+
imageInteracting: Ref<boolean>;
|
|
43
|
+
hyperlinkPopupData: Ref<HyperlinkPopupData | null>;
|
|
44
|
+
readOnly: Ref<boolean>;
|
|
45
|
+
zoom: Ref<number>;
|
|
46
|
+
layout: Ref<Layout | null>;
|
|
47
|
+
tableResize: TableResizeApi;
|
|
48
|
+
getCommands: () => Commands;
|
|
49
|
+
getDocument: () => Document | null;
|
|
50
|
+
reLayout: () => void;
|
|
51
|
+
emit: (event: string, ...args: unknown[]) => void;
|
|
52
|
+
clearOverlay: () => void;
|
|
53
|
+
/**
|
|
54
|
+
* Re-mount HF EditorViews when `package.headers/footers` content changes —
|
|
55
|
+
* exposed by `useDocxEditor.syncHfPMs`. Called after every save so the
|
|
56
|
+
* persistent PM points at the new HeaderFooter object. Optional so existing
|
|
57
|
+
* consumers can no-op until they wire it through.
|
|
58
|
+
*/
|
|
59
|
+
syncHfPMs?: () => void;
|
|
60
|
+
/** Resolve the persistent EditorView for an HF instance (for click routing). */
|
|
61
|
+
getHfPmView?: (hf: HeaderFooter) => EditorView | null;
|
|
62
|
+
/**
|
|
63
|
+
* Replace the loaded Document — used by HF materialisation to publish a
|
|
64
|
+
* fresh Document object instead of mutating in place. Optional; if absent,
|
|
65
|
+
* callers fall back to in-place mutation + `syncHfPMs()`.
|
|
66
|
+
*/
|
|
67
|
+
setDocument?: (doc: Document) => void;
|
|
68
|
+
};
|
|
69
|
+
export type UsePagesPointerReturn = {
|
|
70
|
+
tableInsertButton: Ref<TableInsertButton | null>;
|
|
71
|
+
hfEdit: ShallowRef<HfEditState | null>;
|
|
72
|
+
scrollPageInfo: Ref<ScrollPageInfo>;
|
|
73
|
+
resolvePos: (clientX: number, clientY: number) => number | null;
|
|
74
|
+
setPmSelection: (anchor: number, head?: number) => void;
|
|
75
|
+
scrollVisiblePositionIntoView: (pmPos: number) => void;
|
|
76
|
+
navigateToBookmark: (bookmarkName: string) => void;
|
|
77
|
+
handlePagesMouseDown: (event: MouseEvent) => void;
|
|
78
|
+
handlePagesMouseMove: (event: MouseEvent) => void;
|
|
79
|
+
handlePagesClick: (event: MouseEvent) => void;
|
|
80
|
+
handlePagesDoubleClick: (event: MouseEvent) => void;
|
|
81
|
+
handleTableInsertClick: (event: MouseEvent) => void;
|
|
82
|
+
clearTableInsertTimer: () => void;
|
|
83
|
+
handleHfSave: (content: BlockContent[]) => void;
|
|
84
|
+
handleHfRemove: () => void;
|
|
85
|
+
};
|
|
86
|
+
export declare function usePagesPointer(opts: UsePagesPointerOptions): UsePagesPointerReturn;
|
|
87
|
+
export {};
|