@stll/folio-vue 0.29.0 → 0.31.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/README.md +2 -2
- package/dist/components/DocxEditor/types.d.ts +16 -28
- package/dist/composables/useDocxEditor.d.ts +6 -24
- package/dist/composables/useDocxEditorRefApi.d.ts +0 -2
- package/dist/composables/usePagesPointer.d.ts +0 -24
- package/dist/composables.cjs +1 -1
- package/dist/composables.js +1 -1
- package/dist/folio-vue.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1616 -1688
- package/dist/useZoom-U1MxlyKU.cjs +1 -0
- package/dist/useZoom-q9Ae53FM.js +1019 -0
- package/package.json +2 -3
- package/dist/useZoom-BGTTHZwV.js +0 -1119
- package/dist/useZoom-u9lZMwJR.cjs +0 -1
package/README.md
CHANGED
|
@@ -8,12 +8,12 @@ Vue 3 adapter for the folio document editor.
|
|
|
8
8
|
bun add @stll/folio-vue vue@^3.3.0 \
|
|
9
9
|
prosemirror-commands@^1.7.1 prosemirror-dropcursor@^1.8.2 prosemirror-gapcursor@^1.4.1 prosemirror-history@^1.5.0 \
|
|
10
10
|
prosemirror-inputrules@^1.5.0 prosemirror-keymap@^1.2.3 prosemirror-model@^1.25.9 prosemirror-state@^1.4.4 \
|
|
11
|
-
prosemirror-tables@^1.8.5 prosemirror-transform@^1.12.0 prosemirror-view@^1.42.6
|
|
11
|
+
prosemirror-tables@^1.8.5 prosemirror-transform@^1.12.0 prosemirror-view@^1.42.6 \
|
|
12
12
|
y-protocols@^1.0.6 yjs@^13.6.31
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
ProseMirror and Yjs packages are required peers, including the collaboration
|
|
16
|
-
|
|
16
|
+
package `y-protocols`. Install one compatible copy of each in the host
|
|
17
17
|
application so schemas, plugins, editor states, and collaborative documents share
|
|
18
18
|
the same runtime. The command above includes the complete editor peer closure.
|
|
19
19
|
|
|
@@ -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';
|
|
@@ -23,11 +22,11 @@ import { FolioSuggestion, SuggestionAppliedAs } from '@stll/folio-core/prosemirr
|
|
|
23
22
|
import { TemplateSlashMenuKeyAction, TemplateSlashMenuState } from '@stll/folio-core/prosemirror/plugins/templateSlashMenu';
|
|
24
23
|
import { Comment } from '@stll/folio-core/types/content';
|
|
25
24
|
import { Document, ParagraphAlignment, SdtProperties, TabStop, Theme } from '@stll/folio-core/types/document';
|
|
25
|
+
import { FolioDerivedFields, FolioFieldInsertion } from '@stll/folio-core/types/fields';
|
|
26
26
|
import { DocxInput } from '@stll/folio-core/utils/docxInput';
|
|
27
27
|
import { FindMatch, FindOptions, FindResult } from '@stll/folio-core/utils/findReplace';
|
|
28
28
|
import { OutlineDepth } from '@stll/folio-core/utils/outlineDepth';
|
|
29
29
|
import { DocumentLoadState } from '@stll/folio-core/managers/DocumentLoaderManager';
|
|
30
|
-
import { EditorSession } from '@stll/folio-core/types/canonicalCapabilities';
|
|
31
30
|
import { DeepReadonly } from '@stll/folio-core/types/documentModel';
|
|
32
31
|
import { FolioUIComponents } from '../../ui/folio-ui';
|
|
33
32
|
import { FontOption } from '../../utils/fontOptions';
|
|
@@ -75,16 +74,6 @@ export type DocxEditorProps = {
|
|
|
75
74
|
password?: string | undefined;
|
|
76
75
|
/** Pre-parsed document (alternative to documentBuffer) */
|
|
77
76
|
document?: Document | null;
|
|
78
|
-
/**
|
|
79
|
-
* The editing engine. Unset, the editor runs the canonical session, which
|
|
80
|
-
* refuses unsupported edits with a notice, or the legacy session when
|
|
81
|
-
* `collaboration` is a Yjs fragment. `"legacy"` selects the
|
|
82
|
-
* ProseMirror-owned engine.
|
|
83
|
-
* A host plugin's transaction or a direct dispatch that changes the
|
|
84
|
-
* document is refused too, its refusal naming the transaction's meta keys:
|
|
85
|
-
* express such an edit as document operations (`applyDocumentOperations`).
|
|
86
|
-
*/
|
|
87
|
-
experimentalSession?: EditorSession;
|
|
88
77
|
/** Callback when document is saved */
|
|
89
78
|
onSave?: (buffer: ArrayBuffer) => void;
|
|
90
79
|
/** Author name used for comments and track changes */
|
|
@@ -315,6 +304,13 @@ export type DocxEditorProps = {
|
|
|
315
304
|
* included. Pass a new array to change the terms.
|
|
316
305
|
*/
|
|
317
306
|
anonymizationTerms?: readonly FolioAnonymizationTerm[] | undefined;
|
|
307
|
+
/**
|
|
308
|
+
* Fields whose display text the host derives from the document (numbered
|
|
309
|
+
* references, for one). After each local edit the owned fields show what
|
|
310
|
+
* `displayTexts` gives them, in the same undo step as the edit; a peer in a
|
|
311
|
+
* shared room receives the update with it.
|
|
312
|
+
*/
|
|
313
|
+
derivedFields?: FolioDerivedFields | undefined;
|
|
318
314
|
/** Called with the inline autocomplete suggestion each time it changes. */
|
|
319
315
|
onAutocompleteChange?: ((state: FolioAutocompleteState) => void) | undefined;
|
|
320
316
|
/**
|
|
@@ -388,22 +384,8 @@ export type DocxEditorProps = {
|
|
|
388
384
|
onSelectiveSaveTripwire?: (result: TripwireResult) => void;
|
|
389
385
|
};
|
|
390
386
|
export type { FolioSelectiveSaveFlags, TripwireResult };
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
export type DocxEditorYjsCollaboration = {
|
|
394
|
-
awareness?: {
|
|
395
|
-
clientID: number;
|
|
396
|
-
getStates: () => Map<number, unknown>;
|
|
397
|
-
off: (event: "change" | "update", handler: () => void) => void;
|
|
398
|
-
on: (event: "change" | "update", handler: () => void) => void;
|
|
399
|
-
} | undefined;
|
|
400
|
-
onSeeded?: (() => void) | undefined;
|
|
401
|
-
plugins?: Plugin[] | undefined;
|
|
402
|
-
shouldSeed?: boolean | undefined;
|
|
403
|
-
yXmlFragment: XmlFragment;
|
|
404
|
-
/** A canonical room is reached through `connect`; a Yjs fragment has none. */
|
|
405
|
-
connect?: never;
|
|
406
|
-
};
|
|
387
|
+
/** The room an editor joins. */
|
|
388
|
+
export type DocxEditorCollaboration = CanonicalRoomCollaboration;
|
|
407
389
|
export type DocxEditorApplyDocumentOperationsOptions = {
|
|
408
390
|
undefinedReferences: FolioUndefinedReferencePolicy;
|
|
409
391
|
snapshot: FolioAIEditSnapshot;
|
|
@@ -638,6 +620,12 @@ export type DocxEditorRef = {
|
|
|
638
620
|
autocomplete: FolioAutocompleteApi;
|
|
639
621
|
/** Every occurrence of the `anonymizationTerms`, as text positions. */
|
|
640
622
|
getAnonymizationMatches: () => readonly FolioAnonymizationMatch[];
|
|
623
|
+
/**
|
|
624
|
+
* Insert a field in place of the body selection: one undo step, a tracked
|
|
625
|
+
* insertion when suggesting. False when nothing was inserted, as while a
|
|
626
|
+
* header, footer or note is being edited.
|
|
627
|
+
*/
|
|
628
|
+
insertField: (field: FolioFieldInsertion) => boolean;
|
|
641
629
|
/** Painted geometry for one block, relative to this editor's scroll root. */
|
|
642
630
|
getBlockRect: (blockId: string) => BlockRect | null;
|
|
643
631
|
/** Painted geometry for many blocks in one layout read; missing ids are omitted. */
|
|
@@ -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 {
|
|
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';
|
|
@@ -18,18 +18,11 @@ import { HistoryShortcutOwner } from '@stll/folio-core/prosemirror/extensions/co
|
|
|
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';
|
|
23
|
+
import { FolioDerivedFields } from '@stll/folio-core/types/fields';
|
|
25
24
|
import { DocxInput } from '@stll/folio-core/utils/docxInput';
|
|
26
25
|
export type UseDocxEditorOptions = {
|
|
27
|
-
/**
|
|
28
|
-
* The comment threads the host keeps beside the editor. Saving writes them
|
|
29
|
-
* into the document; without it the saved document keeps the threads it was
|
|
30
|
-
* loaded with.
|
|
31
|
-
*/
|
|
32
|
-
comments?: () => readonly Comment[];
|
|
33
26
|
/** Container element that hosts the off-screen ProseMirror editor. */
|
|
34
27
|
hiddenContainer: Ref<HTMLElement | null>;
|
|
35
28
|
/** Optional separate host for persistent header/footer ProseMirror views. */
|
|
@@ -40,13 +33,6 @@ export type UseDocxEditorOptions = {
|
|
|
40
33
|
pagesContainer: Ref<HTMLElement | null>;
|
|
41
34
|
/** Whether the editor is read-only. Reactive. */
|
|
42
35
|
readOnly?: MaybeRefOrGetter<boolean>;
|
|
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>;
|
|
50
36
|
/** Gap between pages in pixels. */
|
|
51
37
|
pageGap?: number;
|
|
52
38
|
/** Whether to paint each page's effective body-content boundary. Reactive. */
|
|
@@ -80,13 +66,12 @@ export type UseDocxEditorOptions = {
|
|
|
80
66
|
onCanonicalHistory?: (effect: CanonicalHistoryEffect) => void;
|
|
81
67
|
/** A peer's edit dropped local history steps, counted from the bottom. */
|
|
82
68
|
onCanonicalHistoryDrop?: (drop: CanonicalHistoryDrop) => void;
|
|
83
|
-
/**
|
|
84
|
-
|
|
85
|
-
* or the Yjs fragment a legacy session edits with its binding plugins.
|
|
86
|
-
*/
|
|
87
|
-
collaboration?: MaybeRefOrGetter<UseDocxEditorCollaboration | CanonicalRoomCollaboration | undefined>;
|
|
69
|
+
/** Reactive collaboration: the room the session joins. */
|
|
70
|
+
collaboration?: MaybeRefOrGetter<CanonicalRoomCollaboration | undefined>;
|
|
88
71
|
/** The terms the editor highlights in the shown text; none when unset. */
|
|
89
72
|
getAnonymizationTerms?: () => readonly FolioAnonymizationTerm[] | undefined;
|
|
73
|
+
/** The fields whose display text the host derives; none when unset. */
|
|
74
|
+
getDerivedFields?: () => FolioDerivedFields | undefined;
|
|
90
75
|
/**
|
|
91
76
|
* Install the template-directive + slash-menu plugins so `{{...}}` markers are
|
|
92
77
|
* scanned and the `/` trigger is active. Reactive: toggling reconfigures the
|
|
@@ -131,9 +116,6 @@ export type UseDocxEditorOptions = {
|
|
|
131
116
|
*/
|
|
132
117
|
onSelectiveSaveTripwire?: ((result: TripwireResult) => void) | undefined;
|
|
133
118
|
};
|
|
134
|
-
export type UseDocxEditorCollaboration = HiddenProseMirrorCollaboration & {
|
|
135
|
-
plugins?: Plugin[] | undefined;
|
|
136
|
-
};
|
|
137
119
|
export type HeaderFooterSelectionState = {
|
|
138
120
|
from: number;
|
|
139
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';
|
|
@@ -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 {};
|
package/dist/composables.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./useZoom-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./useZoom-U1MxlyKU.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,
|
package/dist/composables.js
CHANGED
|
@@ -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-
|
|
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-q9Ae53FM.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";
|