@stll/folio-vue 0.28.1 → 0.29.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.
Files changed (58) hide show
  1. package/README.md +5 -0
  2. package/dist/{SplitCellDialog-Dge_CE-B.cjs → SplitCellDialog-Bc2TjxMb.cjs} +1 -1
  3. package/dist/{SplitCellDialog-Vl4gq22E.js → SplitCellDialog-DULmbU_P.js} +6 -6
  4. package/dist/StylePicker-CD28Jh8D.cjs +4 -0
  5. package/dist/{StylePicker-CfC5Ef1i.js → StylePicker-D8VHvoMT.js} +664 -591
  6. package/dist/components/AnonymizationRectsOverlay.vue.d.ts +7 -4
  7. package/dist/components/AutocompleteSuggestionOverlay.vue.d.ts +5 -0
  8. package/dist/components/ContentControlWidgetsOverlay.vue.d.ts +5 -1
  9. package/dist/components/DocumentOutline.vue.d.ts +2 -0
  10. package/dist/components/DocxEditor/DocxEditorDialogs.vue.d.ts +3 -2
  11. package/dist/components/DocxEditor/pagedEditorRef.d.ts +11 -9
  12. package/dist/components/DocxEditor/types.d.ts +81 -18
  13. package/dist/components/DocxEditor.vue.d.ts +1 -1
  14. package/dist/components/FormattingBar.types.d.ts +2 -1
  15. package/dist/components/ReviewControls.vue.d.ts +2 -2
  16. package/dist/components/Toolbar.vue.d.ts +6 -5
  17. package/dist/components/UnifiedSidebar.vue.d.ts +3 -0
  18. package/dist/components/dialogs/FootnotePropertiesDialog.vue.d.ts +2 -2
  19. package/dist/components/dialogs/ImagePositionDialog.vue.d.ts +2 -2
  20. package/dist/components/dialogs/PageSetupDialog.vue.d.ts +4 -3
  21. package/dist/components/dialogs/SetNumberingValueDialog.vue.d.ts +2 -2
  22. package/dist/components/dialogs/TablePropertiesDialog.vue.d.ts +2 -2
  23. package/dist/components/dialogs/WatermarkDialog.vue.d.ts +4 -3
  24. package/dist/components/sidebar/CommentCard.vue.d.ts +2 -2
  25. package/dist/components/ui/ColorPicker.vue.d.ts +2 -1
  26. package/dist/components/ui/HorizontalRuler.vue.d.ts +4 -3
  27. package/dist/components/ui/TableBorderColorPicker.vue.d.ts +2 -1
  28. package/dist/components/ui/TableCellFillPicker.vue.d.ts +2 -1
  29. package/dist/components/ui/TableToolbar.vue.d.ts +2 -1
  30. package/dist/components/ui/VerticalRuler.vue.d.ts +3 -2
  31. package/dist/composables/documentChrome.d.ts +14 -0
  32. package/dist/composables/useCommentManagement.d.ts +5 -0
  33. package/dist/composables/useDocxEditor.d.ts +59 -15
  34. package/dist/composables/useDocxEditorRefApi.d.ts +10 -12
  35. package/dist/composables/useFontLifecycle.d.ts +2 -3
  36. package/dist/composables/useOutlineDrawerFocus.d.ts +1 -1
  37. package/dist/composables/usePageSetupControls.d.ts +2 -2
  38. package/dist/composables/usePagesPointer.d.ts +3 -2
  39. package/dist/composables/useParagraphStyleOptions.d.ts +2 -1
  40. package/dist/composables.cjs +1 -1
  41. package/dist/composables.js +1 -1
  42. package/dist/dialogs.cjs +1 -1
  43. package/dist/dialogs.js +1 -1
  44. package/dist/folio-vue.css +1 -1
  45. package/dist/index.cjs +1 -1
  46. package/dist/index.d.ts +4 -4
  47. package/dist/index.js +2230 -2187
  48. package/dist/ui.cjs +1 -1
  49. package/dist/ui.js +28 -28
  50. package/dist/useZoom-BGTTHZwV.js +1119 -0
  51. package/dist/useZoom-u9lZMwJR.cjs +1 -0
  52. package/dist/utils/listItems.d.ts +7 -0
  53. package/dist/utils/rawDocument.d.ts +13 -0
  54. package/dist/utils/stylePreview.d.ts +2 -1
  55. package/package.json +8 -8
  56. package/dist/StylePicker-Bgu0Slqa.cjs +0 -4
  57. package/dist/useZoom-B4Q-QRRT.cjs +0 -1
  58. package/dist/useZoom-DoMlCL_b.js +0 -1021
@@ -1,6 +1,7 @@
1
1
  import { SectionProperties } from '@stll/folio-core/types/document';
2
+ import { DeepReadonly } from '@stll/folio-core/types/documentModel';
2
3
  type __VLS_Props = {
3
- sectionProps?: SectionProperties | null;
4
+ sectionProps?: DeepReadonly<SectionProperties> | null;
4
5
  zoom?: number;
5
6
  editable?: boolean;
6
7
  unit?: "inch" | "cm";
@@ -13,8 +14,8 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {
13
14
  "onBottom-margin-change"?: (twips: number) => any;
14
15
  }>, {
15
16
  unit: "cm" | "inch";
16
- editable: boolean;
17
17
  zoom: number;
18
+ editable: boolean;
18
19
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
19
20
  declare const _default: typeof __VLS_export;
20
21
  export default _default;
@@ -0,0 +1,14 @@
1
+ import { SectionProperties, Style } from '@stll/folio-core/types/document';
2
+ import { DeepReadonly, ReadonlyDocument } from '@stll/folio-core/types/documentModel';
3
+ import { Watermark } from '@stll/folio-core/watermark';
4
+ /**
5
+ * The document-wide values the toolbar, the rulers and the page setup controls
6
+ * show. Derived from the document model by reading it, never from a document
7
+ * built for the purpose, so deriving them costs nothing per keystroke.
8
+ */
9
+ export type DocumentChrome = {
10
+ sectionProperties: DeepReadonly<SectionProperties> | null;
11
+ watermark: DeepReadonly<Watermark> | undefined;
12
+ styles: DeepReadonly<Style[]> | undefined;
13
+ };
14
+ export declare const documentChrome: (document: ReadonlyDocument | null) => DocumentChrome;
@@ -12,6 +12,11 @@ export type UseCommentManagementOptions = {
12
12
  commentsProp: () => Comment[] | undefined;
13
13
  /** Fires on every comment-list mutation (controlled and uncontrolled). */
14
14
  onCommentsChange: (comments: Comment[]) => void;
15
+ /**
16
+ * Whether the comments are a canonical room's: the controlled prop then
17
+ * only reports them and is never read back into the session.
18
+ */
19
+ commentsFromRoom?: () => boolean;
15
20
  /** Reactive invalidation for the canonical document reader. */
16
21
  canonicalTick?: Ref<number>;
17
22
  /** Re-run layout after a mutation that changed marks in the document. */
@@ -1,7 +1,10 @@
1
1
  import { EditorState, Plugin } from 'prosemirror-state';
2
2
  import { EditorView } from 'prosemirror-view';
3
3
  import { MaybeRefOrGetter, Ref } from 'vue';
4
- import { FolioEditor } from '@stll/folio-core/controller/folioEditor';
4
+ import { CanonicalHistoryDrop, CanonicalHistoryEffect } from '@stll/folio-core/canonical/canonicalSession';
5
+ import { FolioAnonymizationTerm } from '@stll/folio-core/controller/anonymizationHighlights';
6
+ import { CanonicalRoomCollaboration } from '@stll/folio-core/controller/canonicalRoomEditor';
7
+ import { FolioEditor, FolioSaveOptions } from '@stll/folio-core/controller/folioEditor';
5
8
  import { HeaderFooterPartKind } from '@stll/folio-core/controller/headerFooterEditorManager';
6
9
  import { HiddenProseMirrorCollaboration, HiddenProseMirrorRemoteSelection } from '@stll/folio-core/controller/hiddenEditorManager';
7
10
  import { NoteStoryKey } from '@stll/folio-core/controller/noteEditorManager';
@@ -13,10 +16,12 @@ import { DisplayMode } from '@stll/folio-core/managers/EditorModeManager';
13
16
  import { LayoutSelectionGate } from '@stll/folio-core/paged-layout/LayoutSelectionGate';
14
17
  import { HistoryShortcutOwner } from '@stll/folio-core/prosemirror/extensions/core/HistoryExtension';
15
18
  import { CommandMap } from '@stll/folio-core/prosemirror/extensions/types';
16
- import { AnonymizationMatch } from '@stll/folio-core/prosemirror/plugins/anonymizationDecorations';
17
19
  import { TemplateSlashMenuKeyAction, TemplateSlashMenuState } from '@stll/folio-core/prosemirror/plugins/templateSlashMenu';
20
+ import { FolioAutocompleteState } from '@stll/folio-core/types/autocomplete';
21
+ import { EditorSession } from '@stll/folio-core/types/canonicalCapabilities';
18
22
  import { Comment } from '@stll/folio-core/types/content';
19
23
  import { Document } from '@stll/folio-core/types/document';
24
+ import { ReadonlyDocument } from '@stll/folio-core/types/documentModel';
20
25
  import { DocxInput } from '@stll/folio-core/utils/docxInput';
21
26
  export type UseDocxEditorOptions = {
22
27
  /**
@@ -35,8 +40,13 @@ export type UseDocxEditorOptions = {
35
40
  pagesContainer: Ref<HTMLElement | null>;
36
41
  /** Whether the editor is read-only. Reactive. */
37
42
  readOnly?: MaybeRefOrGetter<boolean>;
38
- /** Experimental plain-text canonical session; unsupported edits are refused. */
39
- experimentalSession?: MaybeRefOrGetter<"canonical" | undefined>;
43
+ /**
44
+ * The editing engine. Unset, the editor runs the canonical session, which
45
+ * refuses an edit it cannot make yet with a notice, or the legacy session
46
+ * when `collaboration` is a Yjs fragment. `"legacy"` selects the
47
+ * ProseMirror-owned engine.
48
+ */
49
+ experimentalSession?: MaybeRefOrGetter<EditorSession | undefined>;
40
50
  /** Gap between pages in pixels. */
41
51
  pageGap?: number;
42
52
  /** Whether to paint each page's effective body-content boundary. Reactive. */
@@ -66,15 +76,17 @@ export type UseDocxEditorOptions = {
66
76
  externalPlugins?: readonly Plugin[];
67
77
  /** Who answers the undo and redo keys. Read once, when the editor is created. */
68
78
  historyShortcuts?: HistoryShortcutOwner;
69
- /** Reactive Yjs collaboration owner and the ProseMirror binding plugins. */
70
- collaboration?: MaybeRefOrGetter<UseDocxEditorCollaboration | undefined>;
79
+ /** A canonical commit was published, with what it did to the undo history. */
80
+ onCanonicalHistory?: (effect: CanonicalHistoryEffect) => void;
81
+ /** A peer's edit dropped local history steps, counted from the bottom. */
82
+ onCanonicalHistoryDrop?: (drop: CanonicalHistoryDrop) => void;
71
83
  /**
72
- * Fires with the anonymization decoration plugin's current match list on
73
- * mount, term push, and every doc edit. The anonymization plugin is always
74
- * installed (inert until terms are pushed via `setAnonymizationTermsMeta`),
75
- * mirroring the React adapter.
84
+ * Reactive collaboration: the canonical room the canonical session joins,
85
+ * or the Yjs fragment a legacy session edits with its binding plugins.
76
86
  */
77
- onAnonymizationMatchesChange?: (matches: readonly AnonymizationMatch[]) => void;
87
+ collaboration?: MaybeRefOrGetter<UseDocxEditorCollaboration | CanonicalRoomCollaboration | undefined>;
88
+ /** The terms the editor highlights in the shown text; none when unset. */
89
+ getAnonymizationTerms?: () => readonly FolioAnonymizationTerm[] | undefined;
78
90
  /**
79
91
  * Install the template-directive + slash-menu plugins so `{{...}}` markers are
80
92
  * scanned and the `/` trigger is active. Reactive: toggling reconfigures the
@@ -86,6 +98,8 @@ export type UseDocxEditorOptions = {
86
98
  onSlashMenuChange?: (state: TemplateSlashMenuState) => void;
87
99
  /** Resolves a navigation/commit key while the slash menu is open. */
88
100
  onSlashMenuKeyAction?: (action: TemplateSlashMenuKeyAction) => boolean;
101
+ /** Called after each change of the inline suggestion, including view teardown. */
102
+ onAutocompleteChange?: (state: FolioAutocompleteState) => void;
89
103
  /** Callback on document change (debounced PM → Document model conversion). */
90
104
  onChange?: (doc: Document) => void;
91
105
  /** Callback on parse / layout / lifecycle error. */
@@ -154,6 +168,28 @@ export type UseDocxEditorReturn = {
154
168
  parseError: Ref<string | null>;
155
169
  /** Computed page layout, or null before first paint. */
156
170
  layout: Ref<Layout | null>;
171
+ /**
172
+ * The document model the editor holds, to derive toolbar and overlay state
173
+ * from: in a canonical session the session's own document, replaced on each
174
+ * edit (read it, never hand it out); otherwise the document the last change
175
+ * notification wrote back. Reading it never builds a document.
176
+ */
177
+ modelDocument: Readonly<Ref<ReadonlyDocument | null>>;
178
+ /**
179
+ * The session's own document in a canonical session, read without a copy
180
+ * (read it, never write it); otherwise null.
181
+ */
182
+ readDocumentModel: () => ReadonlyDocument | null;
183
+ /**
184
+ * The bytes the current document was loaded from: replaced when a document
185
+ * is loaded or set, never by an edit.
186
+ */
187
+ sourceBuffer: Readonly<Ref<ArrayBuffer | null>>;
188
+ /**
189
+ * Width in pixels of the first section's text column, for the hidden editor
190
+ * to lay out its content at; 0 before the first layout pass.
191
+ */
192
+ hiddenEditorWidth: Ref<number>;
157
193
  /** Flow blocks from the latest layout pass — the range-projection fallback. */
158
194
  blocks: Ref<FlowBlock[]>;
159
195
  /** Measures from the latest layout pass — the range-projection fallback. */
@@ -165,11 +201,19 @@ export type UseDocxEditorReturn = {
165
201
  /** Load an already-parsed `Document` directly. */
166
202
  loadDocument: (doc: Document) => void;
167
203
  /** Serialize the current document to a DOCX blob. */
168
- save: (options?: {
169
- selective?: boolean;
170
- }) => Promise<Blob | null>;
171
- /** Snapshot the current document model. */
204
+ save: (options?: FolioSaveOptions) => Promise<Blob | null>;
205
+ /**
206
+ * Build a copy of the current document, in time proportional to its size.
207
+ * For a host that owns the result; derived state reads `modelDocument`.
208
+ */
172
209
  getDocument: () => Document | null;
210
+ /**
211
+ * The current document for a reader, never copied: what `getDocument`
212
+ * copies. In a canonical session it is `readDocumentModel`'s, the session's
213
+ * own document; otherwise the document built from the editor state. Read
214
+ * it, never write it or hand it on.
215
+ */
216
+ readDocument: () => ReadonlyDocument | null;
173
217
  /** Publish a fresh Document object (e.g. after HF materialisation). */
174
218
  setDocument: (doc: Document) => void;
175
219
  /** Resolve a persistent header/footer EditorView by relationship id. */
@@ -1,11 +1,13 @@
1
1
  import { EditorView } from 'prosemirror-view';
2
2
  import { Ref } from 'vue';
3
- import { OpStory } from '@stll/folio-core/controller/canonicalOperations';
4
- import { FolioEditor } from '@stll/folio-core/controller/folioEditor';
3
+ import { OpStory } from '@stll/folio-core/canonical/canonicalOperations';
4
+ import { FolioEditor, FolioSaveOptions } from '@stll/folio-core/controller/folioEditor';
5
5
  import { Layout } from '@stll/folio-core/layout-engine';
6
6
  import { DisplayMode, EditorReadOnlyReason } from '@stll/folio-core/managers/EditorModeManager';
7
+ import { EditorSession } from '@stll/folio-core/types/canonicalCapabilities';
7
8
  import { Comment } from '@stll/folio-core/types/content';
8
9
  import { Document } from '@stll/folio-core/types/document';
10
+ import { ReadonlyDocument } from '@stll/folio-core/types/documentModel';
9
11
  import { DocxEditorRef } from '../components/DocxEditor/types';
10
12
  import { UseFindReplaceReturn } from './useFindReplace';
11
13
  type OperationView = Pick<EditorView, "state" | "dispatch">;
@@ -94,16 +96,16 @@ export type UseDocxEditorRefApiOptions = {
94
96
  setComments: (comments: Comment[]) => void;
95
97
  focus: () => void;
96
98
  getDocument: () => Document | null;
99
+ /** The session's own document in a canonical session, without a copy; otherwise null. */
100
+ readDocumentModel: () => ReadonlyDocument | null;
97
101
  getActiveView: () => EditorView | null;
98
- getExperimentalSession?: () => "canonical" | undefined;
102
+ getExperimentalSession?: () => EditorSession | undefined;
99
103
  getActiveCanonicalStory?: () => OpStory;
100
104
  closeNoteStory: () => void;
101
105
  getHeaderFooterView: (rId: string) => EditorView | null;
102
106
  setZoom: (zoom: number) => void;
103
107
  /** Serialize and commit a host-facing save through useDocxEditor. */
104
- saveDocument: (options?: {
105
- selective?: boolean;
106
- }) => Promise<Blob | null>;
108
+ saveDocument: (options?: FolioSaveOptions) => Promise<Blob | null>;
107
109
  /**
108
110
  * Open the find/replace panel. Backs `openFind` and `openReplace`: the Vue
109
111
  * panel has a single open state, so both land here.
@@ -118,13 +120,9 @@ export type UseDocxEditorRefApiOptions = {
118
120
  type SaveDocumentForHostOptions = {
119
121
  clearCommentsDirty: () => void;
120
122
  onSave: ((buffer: ArrayBuffer) => void) | undefined;
121
- saveDocument: (options?: {
122
- selective?: boolean;
123
- }) => Promise<Blob | null>;
123
+ saveDocument: (options?: FolioSaveOptions) => Promise<Blob | null>;
124
124
  };
125
- export declare const saveDocumentForHost: (host: SaveDocumentForHostOptions, options?: {
126
- selective?: boolean;
127
- }) => Promise<ArrayBuffer | null>;
125
+ export declare const saveDocumentForHost: (host: SaveDocumentForHostOptions, options?: FolioSaveOptions) => Promise<ArrayBuffer | null>;
128
126
  export declare function useDocxEditorRefApi(opts: UseDocxEditorRefApiOptions): {
129
127
  exposed: DocxEditorRef;
130
128
  };
@@ -3,9 +3,8 @@ import { FontDefinition } from '../components/DocxEditor/types';
3
3
  import { LoadedEmbeddedFonts } from '../utils/embeddedFonts';
4
4
  export type UseFontLifecycleOptions = {
5
5
  isReady: Ref<boolean>;
6
- getDocument: () => {
7
- originalBuffer?: ArrayBuffer | null;
8
- } | null;
6
+ /** The bytes the current document was loaded from, if any. */
7
+ sourceBuffer: () => ArrayBuffer | null;
9
8
  fonts: () => ReadonlyArray<FontDefinition> | undefined;
10
9
  remeasure: () => void;
11
10
  setEmbeddedFontFamilies: (families: ReadonlyMap<string, string> | null) => void;
@@ -1,5 +1,5 @@
1
1
  import { MaybeRefOrGetter, Ref } from 'vue';
2
- export type OutlineSurface = "column" | "rail" | "drawer";
2
+ export type OutlineSurface = "column" | "rail" | "expanded";
3
3
  type UseOutlineDrawerFocusOptions = {
4
4
  surface: MaybeRefOrGetter<OutlineSurface>;
5
5
  available: MaybeRefOrGetter<boolean>;
@@ -11,7 +11,7 @@ export type UsePageSetupControlsOptions = {
11
11
  * Notified after a direct section-properties write (margins, page size,
12
12
  * orientation) so the host's `onChange` fires. These writes bypass the PM
13
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.
14
+ * tab-stop edits run through the view's command owner and notify via the pipeline instead.
15
15
  */
16
16
  onChange: (doc: Document) => void;
17
17
  /** Canonical sessions publish section properties through the Document journal. */
@@ -26,5 +26,5 @@ export declare function usePageSetupControls(opts: UsePageSetupControlsOptions):
26
26
  handleIndentLeftChange: (twips: number) => void;
27
27
  handleIndentRightChange: (twips: number) => void;
28
28
  handleFirstLineIndentChange: (twips: number) => void;
29
- handleTabStopRemove: (positionTwips: number) => void;
29
+ handleTabStopRemove: (position: number) => void;
30
30
  };
@@ -2,9 +2,10 @@ import { Node as PMNode } from 'prosemirror-model';
2
2
  import { Command } from 'prosemirror-state';
3
3
  import { EditorView } from 'prosemirror-view';
4
4
  import { Ref, ShallowRef } from 'vue';
5
- import { DocumentOp } from '@stll/folio-core/controller/canonicalOperations';
5
+ import { DocumentOp } from '@stll/folio-core/canonical/canonicalOperations';
6
6
  import { NoteStoryKey } from '@stll/folio-core/controller/noteEditorManager';
7
7
  import { Layout } from '@stll/folio-core/layout-engine';
8
+ import { EditorSession } from '@stll/folio-core/types/canonicalCapabilities';
8
9
  import { Document } from '@stll/folio-core/types/document';
9
10
  import { ImageSelectionInfo } from '../components/imageSelectionTypes';
10
11
  import { HyperlinkPopupData } from '../components/ui/hyperlinkPopupTypes';
@@ -47,7 +48,7 @@ export type UsePagesPointerOptions = {
47
48
  hyperlinkPopupData: Ref<HyperlinkPopupData | null>;
48
49
  readOnly: Ref<boolean>;
49
50
  showHeaderFooterEditing: Ref<boolean>;
50
- getExperimentalSession?: () => "canonical" | undefined;
51
+ getExperimentalSession?: () => EditorSession | undefined;
51
52
  applyCanonicalOperations?: (operations: readonly DocumentOp[]) => boolean;
52
53
  zoom: Ref<number>;
53
54
  layout: Ref<Layout | null>;
@@ -1,5 +1,6 @@
1
1
  import { ComputedRef } from 'vue';
2
2
  import { Style } from '@stll/folio-core/types/document';
3
+ import { DeepReadonly } from '@stll/folio-core/types/documentModel';
3
4
  import { TranslationKey } from '../components/Toolbar/presets';
4
5
  import { StylePreviewProps } from '../utils/stylePreview';
5
6
  export type ResolvedStyle = {
@@ -12,7 +13,7 @@ export type UseParagraphStyleOptionsReturn = {
12
13
  currentStyleLabel: ComputedRef<string>;
13
14
  };
14
15
  export declare function useParagraphStyleOptions(opts: {
15
- documentStyles: () => Style[] | undefined;
16
+ documentStyles: () => DeepReadonly<Style[]> | undefined;
16
17
  currentStyleId: () => string;
17
18
  t: (key: TranslationKey) => string;
18
19
  }): UseParagraphStyleOptionsReturn;
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./useZoom-B4Q-QRRT.cjs");let t=require("vue"),n=require("@stll/folio-core/utils/textEncoding"),r=require("prosemirror-history"),i=require("@stll/folio-core/utils/documentPointerDown"),a=require("@stll/folio-core/managers/ClipboardManager"),o=require("@stll/folio-core/utils/clipboard"),s=require("@stll/folio-core/managers/TableSelectionManager"),c=require("@stll/folio-core/prosemirror/utils/visualLineNavigation"),l=require("@stll/folio-core/prosemirror/utils/extractTrackedChanges");function u(e={}){let{onCopy:r,onCut:i,onPaste:a,cleanWordFormatting:s=!0,editable:c=!0,onError:l}=e,u=(0,t.ref)(!1),d=(0,t.ref)(null),f=l?{onError:l}:{};async function p(e){if(u.value)return!1;u.value=!0;try{let t=await(0,o.copyRuns)(e.runs,f);return t&&r?.(e),t}finally{u.value=!1}}async function m(e){if(u.value||!c)return!1;u.value=!0;try{let t=await(0,o.copyRuns)(e.runs,f);return t&&i?.(e),t}finally{u.value=!1}}async function h(e=!1){if(u.value||!c)return null;u.value=!0;try{if(navigator.clipboard&&navigator.clipboard.read){let t=await navigator.clipboard.read(),r=``,i=``;for(let e of t)e.types.includes(`text/html`)&&(r=await(0,n.readBlobText)(await e.getType(`text/html`))),e.types.includes(`text/plain`)&&(i=await(0,n.readBlobText)(await e.getType(`text/plain`)));e&&(r=``);let c=(0,o.parseClipboardHtml)(r,i,s);return d.value=c,a?.(c,e),c}return null}catch(e){return l?.(e instanceof Error?e:Error(String(e))),null}finally{u.value=!1}}return{copy:p,cut:m,paste:h,isProcessing:u,lastPastedContent:d}}function d({isOpen:e,onClose:n,align:r=`left`}){let a=(0,t.ref)(null),o=(0,t.ref)(null),s=(0,t.ref)({position:`fixed`,top:`0px`,left:`0px`,zIndex:1e4});function c(e,t){s.value={position:`fixed`,top:e+`px`,left:t+`px`,zIndex:1e4}}function l(e){let t=e.target;t instanceof Node&&a.value&&!a.value.contains(t)&&o.value&&!o.value.contains(t)&&n()}function u(e){e.key===`Escape`&&n()}function d(e){let t=e.target;t instanceof Node&&o.value&&o.value.contains(t)||n()}let f;function p(){f=(0,i.onDocumentPointerDown)(document,l),document.addEventListener(`keydown`,u),window.addEventListener(`scroll`,d,!0)}function m(){f?.(),f=void 0,document.removeEventListener(`keydown`,u),window.removeEventListener(`scroll`,d,!0)}(0,t.watch)(e,e=>{if(!e){m();return}let t=a.value;if(!t)return;let n=t.getBoundingClientRect();r===`right`?requestAnimationFrame(()=>{let e=o.value;if(e){let t=e.getBoundingClientRect();c(n.bottom+4,n.right-t.width)}else c(n.bottom+4,n.left)}):c(n.bottom+4,n.left),p()}),(0,t.onScopeDispose)(m);function h(e){e.preventDefault(),e.stopPropagation()}return{containerRef:a,dropdownRef:o,dropdownStyle:s,handleMouseDown:h}}function f(e,n){let i=(0,t.computed)(()=>{n.value;let t=e.value;return t?(0,r.undoDepth)(t.state)>0:!1}),a=(0,t.computed)(()=>{n.value;let t=e.value;return t?(0,r.redoDepth)(t.state)>0:!1});function o(){let t=e.value;return t?(0,r.undo)(t.state,t.dispatch):!1}function s(){let t=e.value;return t?(0,r.redo)(t.state,t.dispatch):!1}return{canUndo:i,canRedo:a,undo:o,redo:s}}var p={backgroundColor:`rgba(26, 115, 232, 0.3)`,borderRadius:0,zIndex:0,opacity:1,mixBlendMode:`multiply`};function m(e){let t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return[];let n=t.getRangeAt(0);if(e&&!e.contains(n.commonAncestorContainer))return[];let r=0,i=0;if(e){let t=e.getBoundingClientRect();r=t.left+e.scrollLeft,i=t.top+e.scrollTop}let a=[];for(let e of n.getClientRects())(e.width!==0||e.height!==0)&&a.push({left:e.left-r,top:e.top-i,width:e.width,height:e.height});return a}function h(e,t=2){if(e.length<=1)return e;let n=[...e].sort((e,n)=>Math.abs(e.top-n.top)<t?e.left-n.left:e.top-n.top),r=n[0];if(!r)return e;let i=[],a={...r};for(let e=1;e<n.length;e++){let r=n[e];if(!r)continue;let o=Math.abs(r.top-a.top)<t,s=r.left<=a.left+a.width+t;if(o&&s){let e=Math.max(a.left+a.width,r.left+r.width);a.width=e-a.left,a.height=Math.max(a.height,r.height)}else i.push(a),a={...r}}return i.push(a),i}function g(e){return h(m(e))}function _(){let e=window.getSelection();return e!==null&&!e.isCollapsed&&e.rangeCount>0}function v(e){let t=window.getSelection();return!t||t.rangeCount===0?!1:e.contains(t.getRangeAt(0).commonAncestorContainer)}var y=`docx-selection-styles`,b=null;function x(){b&&=(b.remove(),null),document.getElementById(y)?.remove()}function S(e=p){x();let t=`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./useZoom-u9lZMwJR.cjs");let t=require("vue"),n=require("@stll/folio-core/utils/textEncoding"),r=require("prosemirror-history"),i=require("@stll/folio-core/utils/documentPointerDown"),a=require("@stll/folio-core/managers/ClipboardManager"),o=require("@stll/folio-core/utils/clipboard"),s=require("@stll/folio-core/managers/TableSelectionManager"),c=require("@stll/folio-core/prosemirror/utils/visualLineNavigation"),l=require("@stll/folio-core/prosemirror/utils/extractTrackedChanges");function u(e={}){let{onCopy:r,onCut:i,onPaste:a,cleanWordFormatting:s=!0,editable:c=!0,onError:l}=e,u=(0,t.ref)(!1),d=(0,t.ref)(null),f=l?{onError:l}:{};async function p(e){if(u.value)return!1;u.value=!0;try{let t=await(0,o.copyRuns)(e.runs,f);return t&&r?.(e),t}finally{u.value=!1}}async function m(e){if(u.value||!c)return!1;u.value=!0;try{let t=await(0,o.copyRuns)(e.runs,f);return t&&i?.(e),t}finally{u.value=!1}}async function h(e=!1){if(u.value||!c)return null;u.value=!0;try{if(navigator.clipboard&&navigator.clipboard.read){let t=await navigator.clipboard.read(),r=``,i=``;for(let e of t)e.types.includes(`text/html`)&&(r=await(0,n.readBlobText)(await e.getType(`text/html`))),e.types.includes(`text/plain`)&&(i=await(0,n.readBlobText)(await e.getType(`text/plain`)));e&&(r=``);let c=(0,o.parseClipboardHtml)(r,i,s);return d.value=c,a?.(c,e),c}return null}catch(e){return l?.(e instanceof Error?e:Error(String(e))),null}finally{u.value=!1}}return{copy:p,cut:m,paste:h,isProcessing:u,lastPastedContent:d}}function d({isOpen:e,onClose:n,align:r=`left`}){let a=(0,t.ref)(null),o=(0,t.ref)(null),s=(0,t.ref)({position:`fixed`,top:`0px`,left:`0px`,zIndex:1e4});function c(e,t){s.value={position:`fixed`,top:e+`px`,left:t+`px`,zIndex:1e4}}function l(e){let t=e.target;t instanceof Node&&a.value&&!a.value.contains(t)&&o.value&&!o.value.contains(t)&&n()}function u(e){e.key===`Escape`&&n()}function d(e){let t=e.target;t instanceof Node&&o.value&&o.value.contains(t)||n()}let f;function p(){f=(0,i.onDocumentPointerDown)(document,l),document.addEventListener(`keydown`,u),window.addEventListener(`scroll`,d,!0)}function m(){f?.(),f=void 0,document.removeEventListener(`keydown`,u),window.removeEventListener(`scroll`,d,!0)}(0,t.watch)(e,e=>{if(!e){m();return}let t=a.value;if(!t)return;let n=t.getBoundingClientRect();r===`right`?requestAnimationFrame(()=>{let e=o.value;if(e){let t=e.getBoundingClientRect();c(n.bottom+4,n.right-t.width)}else c(n.bottom+4,n.left)}):c(n.bottom+4,n.left),p()}),(0,t.onScopeDispose)(m);function h(e){e.preventDefault(),e.stopPropagation()}return{containerRef:a,dropdownRef:o,dropdownStyle:s,handleMouseDown:h}}function f(e,n){let i=(0,t.computed)(()=>{n.value;let t=e.value;return t?(0,r.undoDepth)(t.state)>0:!1}),a=(0,t.computed)(()=>{n.value;let t=e.value;return t?(0,r.redoDepth)(t.state)>0:!1});function o(){let t=e.value;return t?(0,r.undo)(t.state,t.dispatch):!1}function s(){let t=e.value;return t?(0,r.redo)(t.state,t.dispatch):!1}return{canUndo:i,canRedo:a,undo:o,redo:s}}var p={backgroundColor:`rgba(26, 115, 232, 0.3)`,borderRadius:0,zIndex:0,opacity:1,mixBlendMode:`multiply`};function m(e){let t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return[];let n=t.getRangeAt(0);if(e&&!e.contains(n.commonAncestorContainer))return[];let r=0,i=0;if(e){let t=e.getBoundingClientRect();r=t.left+e.scrollLeft,i=t.top+e.scrollTop}let a=[];for(let e of n.getClientRects())(e.width!==0||e.height!==0)&&a.push({left:e.left-r,top:e.top-i,width:e.width,height:e.height});return a}function h(e,t=2){if(e.length<=1)return e;let n=[...e].sort((e,n)=>Math.abs(e.top-n.top)<t?e.left-n.left:e.top-n.top),r=n[0];if(!r)return e;let i=[],a={...r};for(let e=1;e<n.length;e++){let r=n[e];if(!r)continue;let o=Math.abs(r.top-a.top)<t,s=r.left<=a.left+a.width+t;if(o&&s){let e=Math.max(a.left+a.width,r.left+r.width);a.width=e-a.left,a.height=Math.max(a.height,r.height)}else i.push(a),a={...r}}return i.push(a),i}function g(e){return h(m(e))}function _(){let e=window.getSelection();return e!==null&&!e.isCollapsed&&e.rangeCount>0}function v(e){let t=window.getSelection();return!t||t.rangeCount===0?!1:e.contains(t.getRangeAt(0).commonAncestorContainer)}var y=`docx-selection-styles`,b=null;function x(){b&&=(b.remove(),null),document.getElementById(y)?.remove()}function S(e=p){x();let t=`
2
2
  /* DOCX Editor Selection Highlighting */
3
3
 
4
4
  .docx-editor [contenteditable="true"]::selection,
@@ -1,4 +1,4 @@
1
- import { a as e, c as t, d as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "./useZoom-DoMlCL_b.js";
1
+ import { a as e, c as t, d as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "./useZoom-BGTTHZwV.js";
2
2
  import { computed as d, onBeforeUnmount as f, onMounted as p, onScopeDispose as m, ref as h, watch as g } from "vue";
3
3
  import { readBlobText as _ } from "@stll/folio-core/utils/textEncoding";
4
4
  import { redo as v, redoDepth as y, undo as b, undoDepth as x } from "prosemirror-history";
package/dist/dialogs.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./SplitCellDialog-Dge_CE-B.cjs");exports.FindReplaceDialog=e.m,exports.FootnotePropertiesDialog=e.s,exports.HyperlinkDialog=e.p,exports.ImagePositionDialog=e.o,exports.ImagePropertiesDialog=e.f,exports.InsertImageDialog=e.a,exports.InsertSymbolDialog=e.d,exports.InsertTableDialog=e.r,exports.PageSetupDialog=e.u,exports.PasteSpecialDialog=e.n,exports.SplitCellDialog=e.t,exports.TablePropertiesDialog=e.l,exports.WatermarkDialog=e.c;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./SplitCellDialog-Bc2TjxMb.cjs");exports.FindReplaceDialog=e.m,exports.FootnotePropertiesDialog=e.s,exports.HyperlinkDialog=e.p,exports.ImagePositionDialog=e.o,exports.ImagePropertiesDialog=e.f,exports.InsertImageDialog=e.a,exports.InsertSymbolDialog=e.d,exports.InsertTableDialog=e.r,exports.PageSetupDialog=e.u,exports.PasteSpecialDialog=e.n,exports.SplitCellDialog=e.t,exports.TablePropertiesDialog=e.l,exports.WatermarkDialog=e.c;
package/dist/dialogs.js CHANGED
@@ -1 +1 @@
1
- export { m as FindReplaceDialog, s as FootnotePropertiesDialog, p as HyperlinkDialog, o as ImagePositionDialog, f as ImagePropertiesDialog, a as InsertImageDialog, d as InsertSymbolDialog, r as InsertTableDialog, u as PageSetupDialog, n as PasteSpecialDialog, t as SplitCellDialog, l as TablePropertiesDialog, c as WatermarkDialog } from "./SplitCellDialog-Vl4gq22E.js";
1
+ export { m as FindReplaceDialog, s as FootnotePropertiesDialog, p as HyperlinkDialog, o as ImagePositionDialog, f as ImagePropertiesDialog, a as InsertImageDialog, d as InsertSymbolDialog, r as InsertTableDialog, u as PageSetupDialog, n as PasteSpecialDialog, t as SplitCellDialog, l as TablePropertiesDialog, c as WatermarkDialog } from "./SplitCellDialog-DULmbU_P.js";