@stll/folio-vue 0.30.0 → 0.32.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.
@@ -1,7 +1,6 @@
1
1
  import { Plugin } from 'prosemirror-state';
2
2
  import { EditorView } from 'prosemirror-view';
3
3
  import { CSSProperties, VNodeChild } from 'vue';
4
- import { XmlFragment } from 'yjs';
5
4
  import { FolioAIEditApplyMode, FolioAIEditApplyResult, FolioAIEditOperation, FolioAIEditSnapshot, FolioCommentAnchor, FolioDocumentNavigationTarget, FolioDocumentOperationBatch, FolioDocumentOperationResult, FolioDocumentOperationUndoHandle, FolioDocumentOperationUndoResult, FolioPendingSuggestionLoadResult, FolioPendingSuggestionRecord, FolioReviewChange, FolioUndefinedReferencePolicy } from '@stll/folio-core/ai-edits';
6
5
  import { CanonicalHistoryDrop, CanonicalHistoryEffect } from '@stll/folio-core/canonical/canonicalSession';
7
6
  import { ContentControlFilter, SetContentControlContentInput, SetContentControlValueInput } from '@stll/folio-core/content-controls';
@@ -28,7 +27,6 @@ import { DocxInput } from '@stll/folio-core/utils/docxInput';
28
27
  import { FindMatch, FindOptions, FindResult } from '@stll/folio-core/utils/findReplace';
29
28
  import { OutlineDepth } from '@stll/folio-core/utils/outlineDepth';
30
29
  import { DocumentLoadState } from '@stll/folio-core/managers/DocumentLoaderManager';
31
- import { EditorSession } from '@stll/folio-core/types/canonicalCapabilities';
32
30
  import { DeepReadonly } from '@stll/folio-core/types/documentModel';
33
31
  import { FolioUIComponents } from '../../ui/folio-ui';
34
32
  import { FontOption } from '../../utils/fontOptions';
@@ -76,16 +74,6 @@ export type DocxEditorProps = {
76
74
  password?: string | undefined;
77
75
  /** Pre-parsed document (alternative to documentBuffer) */
78
76
  document?: Document | null;
79
- /**
80
- * The editing engine. Unset, the editor runs the canonical session, which
81
- * refuses unsupported edits with a notice, or the legacy session when
82
- * `collaboration` is a Yjs fragment. `"legacy"` selects the
83
- * ProseMirror-owned engine.
84
- * A host plugin's transaction or a direct dispatch that changes the
85
- * document is refused too, its refusal naming the transaction's meta keys:
86
- * express such an edit as document operations (`applyDocumentOperations`).
87
- */
88
- experimentalSession?: EditorSession;
89
77
  /** Callback when document is saved */
90
78
  onSave?: (buffer: ArrayBuffer) => void;
91
79
  /** Author name used for comments and track changes */
@@ -396,22 +384,8 @@ export type DocxEditorProps = {
396
384
  onSelectiveSaveTripwire?: (result: TripwireResult) => void;
397
385
  };
398
386
  export type { FolioSelectiveSaveFlags, TripwireResult };
399
- export type DocxEditorCollaboration = CanonicalRoomCollaboration | DocxEditorYjsCollaboration;
400
- /** A Yjs fragment the legacy session edits, and the plugins that bind it. */
401
- export type DocxEditorYjsCollaboration = {
402
- awareness?: {
403
- clientID: number;
404
- getStates: () => Map<number, unknown>;
405
- off: (event: "change" | "update", handler: () => void) => void;
406
- on: (event: "change" | "update", handler: () => void) => void;
407
- } | undefined;
408
- onSeeded?: (() => void) | undefined;
409
- plugins?: Plugin[] | undefined;
410
- shouldSeed?: boolean | undefined;
411
- yXmlFragment: XmlFragment;
412
- /** A canonical room is reached through `connect`; a Yjs fragment has none. */
413
- connect?: never;
414
- };
387
+ /** The room an editor joins. */
388
+ export type DocxEditorCollaboration = CanonicalRoomCollaboration;
415
389
  export type DocxEditorApplyDocumentOperationsOptions = {
416
390
  undefinedReferences: FolioUndefinedReferencePolicy;
417
391
  snapshot: FolioAIEditSnapshot;
@@ -1,6 +1,5 @@
1
1
  import { EditorView } from 'prosemirror-view';
2
2
  import { Ref } from 'vue';
3
- import { Comment } from '@stll/folio-core/types/content';
4
3
  import { CommentMarkRange } from './commentMarks';
5
4
  export type FloatingCommentButton = {
6
5
  top: number;
@@ -15,11 +14,7 @@ export type UseCommentLifecycleOptions = {
15
14
  /** The painted `.paged-editor__pages` container (anchor coordinate space). */
16
15
  pagesContainer: Ref<HTMLElement | null>;
17
16
  readOnly: Ref<boolean>;
18
- /** Build a comment with a freshly-allocated id (from useCommentManagement). */
19
- createComment: (text: string, parentId?: number) => Comment;
20
- /** The session kind controls whether draft highlights belong in ProseMirror. */
21
- sessionKind: () => "canonical" | "prosemirror";
22
- /** Null selects the legacy comment-mark route; false means canonical refusal. */
17
+ /** The new comment's id; false when the session refuses, null without one. */
23
18
  createCanonicalComment: (text: string, range: CommentMarkRange) => number | false | null;
24
19
  reLayout: () => void;
25
20
  showSidebar: Ref<boolean>;
@@ -6,7 +6,7 @@ import { FolioAnonymizationTerm } from '@stll/folio-core/controller/anonymizatio
6
6
  import { CanonicalRoomCollaboration } from '@stll/folio-core/controller/canonicalRoomEditor';
7
7
  import { FolioEditor, FolioSaveOptions } from '@stll/folio-core/controller/folioEditor';
8
8
  import { HeaderFooterPartKind } from '@stll/folio-core/controller/headerFooterEditorManager';
9
- import { HiddenProseMirrorCollaboration, HiddenProseMirrorRemoteSelection } from '@stll/folio-core/controller/hiddenEditorManager';
9
+ import { HiddenProseMirrorRemoteSelection } from '@stll/folio-core/controller/hiddenEditorManager';
10
10
  import { NoteStoryKey } from '@stll/folio-core/controller/noteEditorManager';
11
11
  import { PageRendererName } from '@stll/folio-core/display-list/editor/pageRenderer';
12
12
  import { FolioSelectiveSaveFlags } from '@stll/folio-core/docx/selectiveSaveFlags';
@@ -14,23 +14,15 @@ import { TripwireResult } from '@stll/folio-core/docx/selectiveSaveTripwire';
14
14
  import { FlowBlock, Layout, Measure } from '@stll/folio-core/layout-engine/types';
15
15
  import { DisplayMode } from '@stll/folio-core/managers/EditorModeManager';
16
16
  import { LayoutSelectionGate } from '@stll/folio-core/paged-layout/LayoutSelectionGate';
17
- import { HistoryShortcutOwner } from '@stll/folio-core/prosemirror/extensions/core/HistoryExtension';
17
+ import { HistoryShortcutOwner } from '@stll/folio-core/prosemirror/extensions/core/historyCommands';
18
18
  import { CommandMap } from '@stll/folio-core/prosemirror/extensions/types';
19
19
  import { TemplateSlashMenuKeyAction, TemplateSlashMenuState } from '@stll/folio-core/prosemirror/plugins/templateSlashMenu';
20
20
  import { FolioAutocompleteState } from '@stll/folio-core/types/autocomplete';
21
- import { EditorSession } from '@stll/folio-core/types/canonicalCapabilities';
22
- import { Comment } from '@stll/folio-core/types/content';
23
21
  import { Document } from '@stll/folio-core/types/document';
24
22
  import { ReadonlyDocument } from '@stll/folio-core/types/documentModel';
25
23
  import { FolioDerivedFields } from '@stll/folio-core/types/fields';
26
24
  import { DocxInput } from '@stll/folio-core/utils/docxInput';
27
25
  export type UseDocxEditorOptions = {
28
- /**
29
- * The comment threads the host keeps beside the editor. Saving writes them
30
- * into the document; without it the saved document keeps the threads it was
31
- * loaded with.
32
- */
33
- comments?: () => readonly Comment[];
34
26
  /** Container element that hosts the off-screen ProseMirror editor. */
35
27
  hiddenContainer: Ref<HTMLElement | null>;
36
28
  /** Optional separate host for persistent header/footer ProseMirror views. */
@@ -41,13 +33,6 @@ export type UseDocxEditorOptions = {
41
33
  pagesContainer: Ref<HTMLElement | null>;
42
34
  /** Whether the editor is read-only. Reactive. */
43
35
  readOnly?: MaybeRefOrGetter<boolean>;
44
- /**
45
- * The editing engine. Unset, the editor runs the canonical session, which
46
- * refuses an edit it cannot make yet with a notice, or the legacy session
47
- * when `collaboration` is a Yjs fragment. `"legacy"` selects the
48
- * ProseMirror-owned engine.
49
- */
50
- experimentalSession?: MaybeRefOrGetter<EditorSession | undefined>;
51
36
  /** Gap between pages in pixels. */
52
37
  pageGap?: number;
53
38
  /** Whether to paint each page's effective body-content boundary. Reactive. */
@@ -67,8 +52,8 @@ export type UseDocxEditorOptions = {
67
52
  /** Password for Agile-encrypted .docx files (Office 2010+). Reactive. */
68
53
  password?: MaybeRefOrGetter<string | undefined>;
69
54
  /**
70
- * Editor mode. `'suggesting'` activates the mounted suggestion-mode plugin so
71
- * typed text becomes tracked changes. Reactive — flip at runtime.
55
+ * Editor mode. `'suggesting'` sets the canonical session's mode so typed
56
+ * text becomes tracked changes. Reactive — flip at runtime.
72
57
  */
73
58
  editorMode?: MaybeRefOrGetter<"editing" | "suggesting" | "viewing">;
74
59
  /** Author name attached to tracked changes minted in suggesting mode. */
@@ -81,11 +66,8 @@ export type UseDocxEditorOptions = {
81
66
  onCanonicalHistory?: (effect: CanonicalHistoryEffect) => void;
82
67
  /** A peer's edit dropped local history steps, counted from the bottom. */
83
68
  onCanonicalHistoryDrop?: (drop: CanonicalHistoryDrop) => void;
84
- /**
85
- * Reactive collaboration: the canonical room the canonical session joins,
86
- * or the Yjs fragment a legacy session edits with its binding plugins.
87
- */
88
- collaboration?: MaybeRefOrGetter<UseDocxEditorCollaboration | CanonicalRoomCollaboration | undefined>;
69
+ /** Reactive collaboration: the room the session joins. */
70
+ collaboration?: MaybeRefOrGetter<CanonicalRoomCollaboration | undefined>;
89
71
  /** The terms the editor highlights in the shown text; none when unset. */
90
72
  getAnonymizationTerms?: () => readonly FolioAnonymizationTerm[] | undefined;
91
73
  /** The fields whose display text the host derives; none when unset. */
@@ -134,9 +116,6 @@ export type UseDocxEditorOptions = {
134
116
  */
135
117
  onSelectiveSaveTripwire?: ((result: TripwireResult) => void) | undefined;
136
118
  };
137
- export type UseDocxEditorCollaboration = HiddenProseMirrorCollaboration & {
138
- plugins?: Plugin[] | undefined;
139
- };
140
119
  export type HeaderFooterSelectionState = {
141
120
  from: number;
142
121
  kind: HeaderFooterPartKind;
@@ -4,7 +4,6 @@ import { OpStory } from '@stll/folio-core/canonical/canonicalOperations';
4
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';
8
7
  import { Comment } from '@stll/folio-core/types/content';
9
8
  import { Document } from '@stll/folio-core/types/document';
10
9
  import { ReadonlyDocument } from '@stll/folio-core/types/documentModel';
@@ -41,7 +40,7 @@ export type UseDocxEditorRefApiOptions = {
41
40
  /**
42
41
  * Doc-dirty flag from useDocxEditor: live PM edits not yet committed by a
43
42
  * host-facing save. Backs the doc side of `hasPendingChanges` (React's
44
- * ParagraphChangeTracker signals).
43
+ * `hasCanonicalPendingChanges` read).
45
44
  */
46
45
  isDirty: Readonly<Ref<boolean>>;
47
46
  /**
@@ -99,7 +98,6 @@ export type UseDocxEditorRefApiOptions = {
99
98
  /** The session's own document in a canonical session, without a copy; otherwise null. */
100
99
  readDocumentModel: () => ReadonlyDocument | null;
101
100
  getActiveView: () => EditorView | null;
102
- getExperimentalSession?: () => EditorSession | undefined;
103
101
  getActiveCanonicalStory?: () => OpStory;
104
102
  closeNoteStory: () => void;
105
103
  getHeaderFooterView: (rId: string) => EditorView | null;
@@ -1,11 +1,9 @@
1
- import { Node as PMNode } from 'prosemirror-model';
2
1
  import { Command } from 'prosemirror-state';
3
2
  import { EditorView } from 'prosemirror-view';
4
3
  import { Ref, ShallowRef } from 'vue';
5
4
  import { DocumentOp } from '@stll/folio-core/canonical/canonicalOperations';
6
5
  import { NoteStoryKey } from '@stll/folio-core/controller/noteEditorManager';
7
6
  import { Layout } from '@stll/folio-core/layout-engine';
8
- import { EditorSession } from '@stll/folio-core/types/canonicalCapabilities';
9
7
  import { Document } from '@stll/folio-core/types/document';
10
8
  import { ImageSelectionInfo } from '../components/imageSelectionTypes';
11
9
  import { HyperlinkPopupData } from '../components/ui/hyperlinkPopupTypes';
@@ -48,7 +46,6 @@ export type UsePagesPointerOptions = {
48
46
  hyperlinkPopupData: Ref<HyperlinkPopupData | null>;
49
47
  readOnly: Ref<boolean>;
50
48
  showHeaderFooterEditing: Ref<boolean>;
51
- getExperimentalSession?: () => EditorSession | undefined;
52
49
  applyCanonicalOperations?: (operations: readonly DocumentOp[]) => boolean;
53
50
  zoom: Ref<number>;
54
51
  layout: Ref<Layout | null>;
@@ -56,18 +53,11 @@ export type UsePagesPointerOptions = {
56
53
  getCommands: () => Commands;
57
54
  getDocument: () => Document | null;
58
55
  reLayout: () => void;
59
- onDocumentChange: (document: Document) => void;
60
56
  clearOverlay: () => void;
61
57
  /** Synchronize persistent header/footer views after document-model changes. */
62
58
  syncHfPMs: () => void;
63
59
  /** Resolve the persistent EditorView for an HF instance (for click routing). */
64
60
  getHfPmView: (rId: string) => EditorView | null;
65
- /**
66
- * Replace the loaded Document — used by HF materialisation to publish a
67
- * fresh Document object instead of mutating in place. Optional; if absent,
68
- * callers fall back to in-place mutation + `syncHfPMs()`.
69
- */
70
- setDocument: (doc: Document) => void;
71
61
  /** Open a footnote or endnote story from a painted reference/body. */
72
62
  openNoteStory: (story: NoteStoryKey) => void;
73
63
  closeNoteStory: () => void;
@@ -90,19 +80,5 @@ export type UsePagesPointerReturn = {
90
80
  handleHfSave: () => void;
91
81
  handleHfRemove: () => void;
92
82
  };
93
- type SaveAndCloseHeaderFooterEditOptions = {
94
- editState: ShallowRef<HfEditState | null>;
95
- getDocument: () => Document | null;
96
- getHfPmView: (rId: string) => {
97
- readonly state: {
98
- readonly doc: PMNode;
99
- };
100
- } | null;
101
- onDocumentChange: (document: Document) => void;
102
- reLayout: () => void;
103
- setDocument: (document: Document) => void;
104
- syncHfPMs: () => void;
105
- };
106
- export declare const saveAndCloseHeaderFooterEdit: ({ editState, getDocument, getHfPmView, onDocumentChange, reLayout, setDocument, syncHfPMs, }: SaveAndCloseHeaderFooterEditOptions) => void;
107
83
  export declare function usePagesPointer(opts: UsePagesPointerOptions): UsePagesPointerReturn;
108
84
  export {};
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./useZoom-7jho8rWN.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-vZRWHzC-.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-hVxyaoZn.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-HGLyQ-Y0.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";