@eigenpal/docx-editor-vue 1.3.0 → 1.3.2
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/{KeyboardShortcutsDialog-00eb4Ova.js → KeyboardShortcutsDialog-BbuDgglK.js} +14 -4
- package/dist/KeyboardShortcutsDialog-Bct8AJ0i.cjs +1 -0
- package/dist/{MenuBar-DeogoqFP.js → MenuBar-CbONA9-a.js} +571 -522
- package/dist/MenuBar-m0JEaF1X.cjs +4 -0
- package/dist/{TablePropertiesDialog-CBTvM4Xy.js → TablePropertiesDialog-D5MIF3cj.js} +1 -1
- package/dist/{TablePropertiesDialog-BZLpFAkg.cjs → TablePropertiesDialog-JWT68zEO.cjs} +1 -1
- package/dist/components/DocxEditor/types.d.ts +23 -1
- package/dist/components/Toolbar/presets.d.ts +12 -33
- package/dist/composables/useCommentLifecycle.d.ts +9 -1
- package/dist/composables/useCommentManagement.d.ts +24 -1
- package/dist/composables/useFormattingActions.d.ts +2 -22
- package/dist/composables/useHostCallbacks.d.ts +7 -0
- package/dist/composables.cjs +1 -1
- package/dist/composables.js +85 -129
- package/dist/dialogs.cjs +1 -1
- package/dist/dialogs.js +2 -2
- package/dist/docx-editor-vue.css +1 -1
- package/dist/index.cjs +9 -10
- package/dist/index.js +1117 -1281
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +141 -141
- package/dist/useDragAutoScroll-DNMi0p5G.cjs +1 -0
- package/dist/useDragAutoScroll-DbxuTWI1.js +493 -0
- package/dist/utils/refApiQueries.d.ts +8 -44
- package/package.json +4 -4
- package/dist/KeyboardShortcutsDialog-EW9K4wuO.cjs +0 -1
- package/dist/MenuBar-bU4-4dnA.cjs +0 -4
- package/dist/useTableResize-DBpEiuGQ.cjs +0 -1
- package/dist/useTableResize-uq2ksRDf.js +0 -587
- package/dist/utils/commentFactories.d.ts +0 -7
- package/dist/utils/paraTextHelpers.d.ts +0 -29
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
import { Ref } from 'vue';
|
|
1
|
+
import { MaybeRef, Ref } from 'vue';
|
|
2
2
|
import { EditorView } from 'prosemirror-view';
|
|
3
3
|
import { Comment, Document } from '@eigenpal/docx-editor-core/types/document';
|
|
4
|
+
import { CommentIdAllocator } from '@eigenpal/docx-editor-core/prosemirror/commentIdAllocator';
|
|
4
5
|
import { TrackedChangeEntry } from '../components/sidebar/sidebarUtils';
|
|
6
|
+
/**
|
|
7
|
+
* Host-facing comment lifecycle callbacks (the `onComment*` props). Shared with
|
|
8
|
+
* `useCommentLifecycle`. The granular callbacks fire on the matching UI action;
|
|
9
|
+
* `onCommentsChange` fires with the full array on every comment mutation.
|
|
10
|
+
*/
|
|
11
|
+
export interface CommentCallbacks {
|
|
12
|
+
onCommentAdd?: (comment: Comment) => void;
|
|
13
|
+
onCommentResolve?: (comment: Comment) => void;
|
|
14
|
+
onCommentDelete?: (comment: Comment) => void;
|
|
15
|
+
onCommentReply?: (reply: Comment, parent: Comment) => void;
|
|
16
|
+
onCommentsChange?: (comments: Comment[]) => void;
|
|
17
|
+
}
|
|
5
18
|
export interface UseCommentManagementOptions {
|
|
6
19
|
editorView: Ref<EditorView | null>;
|
|
7
20
|
getDocument: () => Document | null;
|
|
@@ -16,6 +29,15 @@ export interface UseCommentManagementOptions {
|
|
|
16
29
|
contentChangeSubscribers: Set<(document: unknown) => void>;
|
|
17
30
|
extractCommentsAndChanges: () => void;
|
|
18
31
|
emit: (event: string, ...args: unknown[]) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Per-editor-instance monotonic ID allocator, shared with
|
|
34
|
+
* `useCommentLifecycle` so comment and tracked-change IDs never collide.
|
|
35
|
+
*/
|
|
36
|
+
commentIdAllocator: CommentIdAllocator;
|
|
37
|
+
/** Author name for UI-created replies/changes (the `author` prop). */
|
|
38
|
+
author?: MaybeRef<string>;
|
|
39
|
+
/** Host-facing comment lifecycle callbacks (the `onComment*` props). */
|
|
40
|
+
commentCallbacks?: CommentCallbacks;
|
|
19
41
|
}
|
|
20
42
|
export declare function useCommentManagement(opts: UseCommentManagementOptions): {
|
|
21
43
|
addComment: (options: {
|
|
@@ -33,6 +55,7 @@ export declare function useCommentManagement(opts: UseCommentManagementOptions):
|
|
|
33
55
|
author: string;
|
|
34
56
|
}) => boolean;
|
|
35
57
|
handleCommentReply: (commentId: number, text: string) => void;
|
|
58
|
+
handleCommentResolve: (commentId: number) => void;
|
|
36
59
|
handleCommentUnresolve: (commentId: number) => void;
|
|
37
60
|
handleCommentDelete: (commentId: number) => void;
|
|
38
61
|
handleAcceptChange: (from: number, to: number) => void;
|
|
@@ -1,32 +1,12 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
2
|
import { EditorView } from 'prosemirror-view';
|
|
3
3
|
import { Document } from '@eigenpal/docx-editor-core/types/document';
|
|
4
|
+
import { ApplyFormattingOptions } from '@eigenpal/docx-editor-core/prosemirror/applyFormatting';
|
|
4
5
|
export interface UseFormattingActionsOptions {
|
|
5
6
|
editorView: Ref<EditorView | null>;
|
|
6
7
|
getDocument: () => Document | null;
|
|
7
8
|
}
|
|
8
|
-
export
|
|
9
|
-
paraId: string;
|
|
10
|
-
search?: string;
|
|
11
|
-
marks: {
|
|
12
|
-
bold?: boolean;
|
|
13
|
-
italic?: boolean;
|
|
14
|
-
underline?: boolean | {
|
|
15
|
-
style?: string;
|
|
16
|
-
};
|
|
17
|
-
strike?: boolean;
|
|
18
|
-
color?: {
|
|
19
|
-
rgb?: string;
|
|
20
|
-
themeColor?: string;
|
|
21
|
-
};
|
|
22
|
-
highlight?: string;
|
|
23
|
-
fontSize?: number;
|
|
24
|
-
fontFamily?: {
|
|
25
|
-
ascii?: string;
|
|
26
|
-
hAnsi?: string;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
}
|
|
9
|
+
export type { ApplyFormattingOptions };
|
|
30
10
|
export declare function useFormattingActions(opts: UseFormattingActionsOptions): {
|
|
31
11
|
handleClearFormatting: () => void;
|
|
32
12
|
handleApplyStyle: (styleId: string) => void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
import { DocxEditorProps } from '../components/DocxEditor/types';
|
|
4
|
+
import { CommentCallbacks } from './useCommentManagement';
|
|
5
|
+
export declare function useHostCallbacks(props: DocxEditorProps, editorView: Ref<EditorView | null>): {
|
|
6
|
+
commentCallbacks: CommentCallbacks;
|
|
7
|
+
};
|
package/dist/composables.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./useCommentSidebarItems-CbNvNCd3.cjs`),t=require(`./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./useCommentSidebarItems-CbNvNCd3.cjs`),t=require(`./useDragAutoScroll-DNMi0p5G.cjs`);let n=require(`vue`),r=require(`@eigenpal/docx-editor-core/utils`),i=require(`prosemirror-history`),a=require(`@eigenpal/docx-editor-core/prosemirror/utils/extractTrackedChanges`),o=require(`@eigenpal/docx-editor-core`),s=require(`@eigenpal/docx-editor-core/utils/findReplace`),c=require(`@eigenpal/docx-editor-core/managers/TableSelectionManager`),l=require(`@eigenpal/docx-editor-core/prosemirror/utils/visualLineNavigation`);function u(e,t={}){let r=(0,n.ref)(`idle`),i=(0,n.ref)(null),a=(0,n.ref)(!1),s=(0,n.ref)(!0),{storageKey:c,interval:l,enabled:u=!0,maxAge:d,onSave:f,onError:p,onRecoveryAvailable:m,saveOnChange:h,debounceDelay:g}=t;if(!(0,o.isAutoSaveSupported)())return{status:r,lastSaveTime:i,hasRecoveryData:a,isEnabled:s,save:async()=>!1,clearAutoSave:()=>{},getRecoveryData:()=>null,acceptRecovery:()=>null,dismissRecovery:()=>{},enable:()=>{},disable:()=>{}};let _=new o.AutoSaveManager({storageKey:c,interval:l,maxAge:d,saveOnChange:h,debounceDelay:g,onSave:f,onError:p,onRecoveryAvailable:m}),v=()=>{let e=_.getSnapshot();r.value=e.status,i.value=e.lastSaveTime,a.value=e.hasRecoveryData,s.value=e.isEnabled},y=_.subscribe(v);u?_.enable():_.disable(),v(),(0,n.watch)(()=>(0,n.unref)(e),e=>_.onDocumentChanged(e??null),{immediate:!0});function b(){return _.save()}function x(){_.clear()}function S(){return _.getRecoveryData()}function C(){return _.acceptRecovery()}function w(){_.dismissRecovery()}function T(){_.enable()}function E(){_.disable()}return(0,n.onBeforeUnmount)(()=>{y(),_.destroy()}),{status:r,lastSaveTime:i,hasRecoveryData:a,isEnabled:s,save:b,clearAutoSave:x,getRecoveryData:S,acceptRecovery:C,dismissRecovery:w,enable:T,disable:E}}function d(e={}){let{onCopy:t,onCut:i,onPaste:a,cleanWordFormatting:o=!0,editable:s=!0,onError:c,theme:l}=e,u=(0,n.ref)(!1),d=(0,n.ref)(null);async function f(e){if(u.value)return!1;u.value=!0;try{let n=await(0,r.copyRuns)(e.runs,{onError:c,theme:l});return n&&t?.(e),n}finally{u.value=!1}}async function p(e){if(u.value||!s)return!1;u.value=!0;try{let t=await(0,r.copyRuns)(e.runs,{onError:c,theme:l});return t&&i?.(e),t}finally{u.value=!1}}async function m(e=!1){if(u.value||!s)return null;u.value=!0;try{if(navigator.clipboard&&navigator.clipboard.read){let t=await navigator.clipboard.read(),n=``,i=``;for(let e of t)e.types.includes(`text/html`)&&(n=await(await e.getType(`text/html`)).text()),e.types.includes(`text/plain`)&&(i=await(await e.getType(`text/plain`)).text());e&&(n=``);let s=(0,r.parseClipboardHtml)(n,i,o);return d.value=s,a?.(s,e),s}return null}catch(e){return c?.(e instanceof Error?e:Error(String(e))),null}finally{u.value=!1}}return{copy:f,cut:p,paste:m,isProcessing:u,lastPastedContent:d}}function f(e={}){let t=(0,n.reactive)({isOpen:!1,searchText:``,replaceText:``,options:(0,s.createDefaultFindOptions)(),matches:[],currentIndex:0,replaceMode:e.initialReplaceMode??!1});function r(e){t.isOpen=!0,t.replaceMode=!1,e&&(t.searchText=e),t.matches=[],t.currentIndex=0}function i(e){t.isOpen=!0,t.replaceMode=!0,e&&(t.searchText=e),t.matches=[],t.currentIndex=0}function a(){t.isOpen=!1}function o(){t.isOpen=!t.isOpen}function c(e){t.searchText=e}function l(e){t.replaceText=e}function u(e){t.options={...t.options,...e}}function d(n,r=0){let i=Math.max(0,Math.min(r,n.length-1));t.matches=n,t.currentIndex=n.length>0?i:0,e.onMatchesChange?.(n),n.length>0?e.onCurrentMatchChange?.(n[i],i):e.onCurrentMatchChange?.(null,-1)}function f(){return t.matches.length===0?0:(t.currentIndex=(t.currentIndex+1)%t.matches.length,t.currentIndex)}function p(){return t.matches.length===0?0:(t.currentIndex=t.currentIndex===0?t.matches.length-1:t.currentIndex-1,t.currentIndex)}function m(e){t.matches.length===0||e<0||e>=t.matches.length||(t.currentIndex=e)}return{state:t,currentMatch:(0,n.computed)(()=>t.matches.length===0?null:t.matches[t.currentIndex]??null),hasMatches:(0,n.computed)(()=>t.matches.length>0),openFind:r,openReplace:i,close:a,toggle:o,setSearchText:c,setReplaceText:l,setOptions:u,setMatches:d,goToNextMatch:f,goToPreviousMatch:p,goToMatch:m}}function p({isOpen:e,onClose:t,align:r=`left`}){let i=(0,n.ref)(null),a=(0,n.ref)(null),o=(0,n.ref)({position:`fixed`,top:`0px`,left:`0px`,zIndex:1e4});function s(e,t){o.value={position:`fixed`,top:e+`px`,left:t+`px`,zIndex:1e4}}function c(e){let n=e.target;i.value&&!i.value.contains(n)&&a.value&&!a.value.contains(n)&&t()}function l(e){e.key===`Escape`&&t()}function u(){t()}function d(){document.addEventListener(`mousedown`,c),document.addEventListener(`keydown`,l),window.addEventListener(`scroll`,u,!0)}function f(){document.removeEventListener(`mousedown`,c),document.removeEventListener(`keydown`,l),window.removeEventListener(`scroll`,u,!0)}(0,n.watch)(e,e=>{if(!e){f();return}let t=i.value;if(!t)return;let n=t.getBoundingClientRect();r===`right`?requestAnimationFrame(()=>{let e=a.value;if(e){let t=e.getBoundingClientRect();s(n.bottom+4,n.right-t.width)}else s(n.bottom+4,n.left)}):s(n.bottom+4,n.left),d()}),(0,n.onBeforeUnmount)(f);function p(e){e.preventDefault(),e.stopPropagation()}return{containerRef:i,dropdownRef:a,dropdownStyle:o,handleMouseDown:p}}function m(e,t){let r=(0,n.computed)(()=>{t.value;let n=e.value;return n?(0,i.undoDepth)(n.state)>0:!1}),a=(0,n.computed)(()=>{t.value;let n=e.value;return n?(0,i.redoDepth)(n.state)>0:!1});function o(){let t=e.value;return t?(0,i.undo)(t.state,t.dispatch):!1}function s(){let t=e.value;return t?(0,i.redo)(t.state,t.dispatch):!1}return{canUndo:r,canRedo:a,undo:o,redo:s}}function h(e){let{containerRef:t,enabled:i=!0,config:a=r.DEFAULT_SELECTION_STYLE,useOverlay:o=!1,debounceMs:s=16,onSelectionChange:c}=e,l=(0,n.ref)(!1),u=(0,n.ref)(``),d=(0,n.ref)([]),f=(0,n.ref)(!1),p=null,m=0;function h(){let e=t.value,n=(0,r.hasActiveSelection)(),i=(0,r.getSelectedText)(),a=e?(0,r.isSelectionWithin)(e):!1;l.value=n,u.value=i,f.value=a,d.value=o&&a&&e?(0,r.getMergedSelectionRects)(e):[],c?.(n&&a,i)}function g(){h()}function _(){let e=performance.now();if(e-m<s){p&&clearTimeout(p),p=setTimeout(()=>{m=performance.now(),h(),p=null},s);return}m=e,h()}function v(e){return{position:`absolute`,left:e.left+`px`,top:e.top+`px`,width:e.width+`px`,height:e.height+`px`,backgroundColor:a.backgroundColor,borderRadius:a.borderRadius?a.borderRadius+`px`:void 0,border:a.borderColor?`1px solid ${a.borderColor}`:void 0,zIndex:a.zIndex??0,pointerEvents:`none`}}return(0,n.onMounted)(()=>{i&&((0,r.areSelectionStylesInjected)()||(0,r.injectSelectionStyles)(a),document.addEventListener(`selectionchange`,_))}),(0,n.onBeforeUnmount)(()=>{document.removeEventListener(`selectionchange`,_),p&&clearTimeout(p)}),(0,n.watch)(t,()=>h()),{hasSelection:(0,n.computed)(()=>l.value),selectedText:(0,n.computed)(()=>u.value),highlightRects:(0,n.computed)(()=>d.value),isSelectionInContainer:(0,n.computed)(()=>f.value),refresh:g,getOverlayStyle:v}}function g(){let e=new c.TableSelectionManager,t=(0,n.ref)(null),r=()=>{t.value=e.getSnapshot().selectedCell},i=e.subscribe(r);r(),(0,n.onBeforeUnmount)(()=>{i()});function a(t,n,r){e.selectCell({tableIndex:t,rowIndex:n,columnIndex:r})}function o(t,n){let r=(0,c.findTableFromClick)(t,n);r?e.selectCell(r):e.clearSelection()}function s(){e.clearSelection()}function l(t,n,r){return e.isCellSelected(t,n,r)}return{selectedCell:t,handleCellClick:a,handleClickTarget:o,clearSelection:s,isCellSelected:l}}function _(e,t){return(0,n.computed)(()=>(t.value,(0,a.extractTrackedChanges)(e.value?.state??null)))}function v(e){let t=(0,l.createVisualLineState)();function n(t){let n=e.value;return n?(0,l.getCaretClientX)(n,t):null}function r(t){let n=e.value;return n?(0,l.findLineElementAtPosition)(n,t):null}function i(e,t){return(0,l.findPositionOnLineAtClientX)(e,t)}function a(n,r){return(0,l.handleVisualLineKeyDown)(t,n,r,e.value)}return{state:t,getCaretClientX:n,findLineElementAtPosition:r,findPositionOnLineAtClientX:i,handlePMKeyDown:a}}exports.createSelectionFromDOM=o.createSelectionFromDOM,exports.extractTrackedChanges=a.extractTrackedChanges,exports.formatLastSaveTime=o.formatLastSaveTime,exports.formatStorageSize=o.formatStorageSize,exports.getAutoSaveStatusLabel=o.getAutoSaveStatusLabel,exports.getAutoSaveStorageSize=o.getAutoSaveStorageSize,exports.getSelectionRuns=o.getSelectionRuns,exports.isAutoSaveSupported=o.isAutoSaveSupported,exports.runsToClipboardContent=r.runsToClipboardContent,exports.useAutoSave=u,exports.useClipboard=d,exports.useCommentSidebarItems=e.t,exports.useDocxEditor=t.i,exports.useDragAutoScroll=t.t,exports.useFindReplace=f,exports.useFixedDropdown=p,exports.useHistory=m,exports.useSelectionHighlight=h,exports.useTableResize=t.n,exports.useTableSelection=g,exports.useTrackedChanges=_,exports.useVisualLineNavigation=v,exports.useWheelZoom=t.r,exports.useZoom=t.r;
|
package/dist/composables.js
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import { t as e } from "./useCommentSidebarItems-BHomCzpj.js";
|
|
2
|
-
import {
|
|
3
|
-
import { computed as
|
|
4
|
-
import { DEFAULT_SELECTION_STYLE as
|
|
5
|
-
import { redo as
|
|
6
|
-
import { extractTrackedChanges as
|
|
7
|
-
import { AutoSaveManager as
|
|
8
|
-
import { findVerticalScrollParent as P } from "@eigenpal/docx-editor-core/utils/findVerticalScrollParent";
|
|
2
|
+
import { i as t, n, r, t as i } from "./useDragAutoScroll-DbxuTWI1.js";
|
|
3
|
+
import { computed as a, onBeforeUnmount as o, onMounted as s, reactive as c, ref as l, unref as u, watch as d } from "vue";
|
|
4
|
+
import { DEFAULT_SELECTION_STYLE as f, areSelectionStylesInjected as p, copyRuns as m, getMergedSelectionRects as h, getSelectedText as g, hasActiveSelection as _, injectSelectionStyles as v, isSelectionWithin as y, parseClipboardHtml as b, runsToClipboardContent as x } from "@eigenpal/docx-editor-core/utils";
|
|
5
|
+
import { redo as S, redoDepth as C, undo as w, undoDepth as T } from "prosemirror-history";
|
|
6
|
+
import { extractTrackedChanges as E } from "@eigenpal/docx-editor-core/prosemirror/utils/extractTrackedChanges";
|
|
7
|
+
import { AutoSaveManager as D, createSelectionFromDOM as O, formatLastSaveTime as k, formatStorageSize as A, getAutoSaveStatusLabel as j, getAutoSaveStorageSize as M, getSelectionRuns as N, isAutoSaveSupported as P } from "@eigenpal/docx-editor-core";
|
|
9
8
|
import { createDefaultFindOptions as F } from "@eigenpal/docx-editor-core/utils/findReplace";
|
|
10
9
|
import { TableSelectionManager as I, findTableFromClick as L } from "@eigenpal/docx-editor-core/managers/TableSelectionManager";
|
|
11
10
|
import { createVisualLineState as R, findLineElementAtPosition as z, findPositionOnLineAtClientX as B, getCaretClientX as V, handleVisualLineKeyDown as H } from "@eigenpal/docx-editor-core/prosemirror/utils/visualLineNavigation";
|
|
12
11
|
//#region src/composables/useAutoSave.ts
|
|
13
12
|
function U(e, t = {}) {
|
|
14
|
-
let n =
|
|
15
|
-
if (!
|
|
13
|
+
let n = l("idle"), r = l(null), i = l(!1), a = l(!0), { storageKey: s, interval: c, enabled: f = !0, maxAge: p, onSave: m, onError: h, onRecoveryAvailable: g, saveOnChange: _, debounceDelay: v } = t;
|
|
14
|
+
if (!P()) return {
|
|
16
15
|
status: n,
|
|
17
16
|
lastSaveTime: r,
|
|
18
17
|
hasRecoveryData: i,
|
|
19
|
-
isEnabled:
|
|
18
|
+
isEnabled: a,
|
|
20
19
|
save: async () => !1,
|
|
21
20
|
clearAutoSave: () => {},
|
|
22
21
|
getRecoveryData: () => null,
|
|
@@ -25,9 +24,9 @@ function U(e, t = {}) {
|
|
|
25
24
|
enable: () => {},
|
|
26
25
|
disable: () => {}
|
|
27
26
|
};
|
|
28
|
-
let y = new
|
|
27
|
+
let y = new D({
|
|
29
28
|
storageKey: s,
|
|
30
|
-
interval:
|
|
29
|
+
interval: c,
|
|
31
30
|
maxAge: p,
|
|
32
31
|
saveOnChange: _,
|
|
33
32
|
debounceDelay: v,
|
|
@@ -36,9 +35,9 @@ function U(e, t = {}) {
|
|
|
36
35
|
onRecoveryAvailable: g
|
|
37
36
|
}), b = () => {
|
|
38
37
|
let e = y.getSnapshot();
|
|
39
|
-
n.value = e.status, r.value = e.lastSaveTime, i.value = e.hasRecoveryData,
|
|
38
|
+
n.value = e.status, r.value = e.lastSaveTime, i.value = e.hasRecoveryData, a.value = e.isEnabled;
|
|
40
39
|
}, x = y.subscribe(b);
|
|
41
|
-
f ? y.enable() : y.disable(), b(),
|
|
40
|
+
f ? y.enable() : y.disable(), b(), d(() => u(e), (e) => y.onDocumentChanged(e ?? null), { immediate: !0 });
|
|
42
41
|
function S() {
|
|
43
42
|
return y.save();
|
|
44
43
|
}
|
|
@@ -51,7 +50,7 @@ function U(e, t = {}) {
|
|
|
51
50
|
function T() {
|
|
52
51
|
return y.acceptRecovery();
|
|
53
52
|
}
|
|
54
|
-
function
|
|
53
|
+
function E() {
|
|
55
54
|
y.dismissRecovery();
|
|
56
55
|
}
|
|
57
56
|
function O() {
|
|
@@ -60,18 +59,18 @@ function U(e, t = {}) {
|
|
|
60
59
|
function k() {
|
|
61
60
|
y.disable();
|
|
62
61
|
}
|
|
63
|
-
return
|
|
62
|
+
return o(() => {
|
|
64
63
|
x(), y.destroy();
|
|
65
64
|
}), {
|
|
66
65
|
status: n,
|
|
67
66
|
lastSaveTime: r,
|
|
68
67
|
hasRecoveryData: i,
|
|
69
|
-
isEnabled:
|
|
68
|
+
isEnabled: a,
|
|
70
69
|
save: S,
|
|
71
70
|
clearAutoSave: C,
|
|
72
71
|
getRecoveryData: w,
|
|
73
72
|
acceptRecovery: T,
|
|
74
|
-
dismissRecovery:
|
|
73
|
+
dismissRecovery: E,
|
|
75
74
|
enable: O,
|
|
76
75
|
disable: k
|
|
77
76
|
};
|
|
@@ -79,106 +78,63 @@ function U(e, t = {}) {
|
|
|
79
78
|
//#endregion
|
|
80
79
|
//#region src/composables/useClipboard.ts
|
|
81
80
|
function W(e = {}) {
|
|
82
|
-
let { onCopy: t, onCut: n, onPaste: r, cleanWordFormatting: i = !0, editable: a = !0, onError: o, theme: s } = e,
|
|
81
|
+
let { onCopy: t, onCut: n, onPaste: r, cleanWordFormatting: i = !0, editable: a = !0, onError: o, theme: s } = e, c = l(!1), u = l(null);
|
|
83
82
|
async function d(e) {
|
|
84
|
-
if (
|
|
85
|
-
|
|
83
|
+
if (c.value) return !1;
|
|
84
|
+
c.value = !0;
|
|
86
85
|
try {
|
|
87
|
-
let n = await
|
|
86
|
+
let n = await m(e.runs, {
|
|
88
87
|
onError: o,
|
|
89
88
|
theme: s
|
|
90
89
|
});
|
|
91
90
|
return n && t?.(e), n;
|
|
92
91
|
} finally {
|
|
93
|
-
|
|
92
|
+
c.value = !1;
|
|
94
93
|
}
|
|
95
94
|
}
|
|
96
95
|
async function f(e) {
|
|
97
|
-
if (
|
|
98
|
-
|
|
96
|
+
if (c.value || !a) return !1;
|
|
97
|
+
c.value = !0;
|
|
99
98
|
try {
|
|
100
|
-
let t = await
|
|
99
|
+
let t = await m(e.runs, {
|
|
101
100
|
onError: o,
|
|
102
101
|
theme: s
|
|
103
102
|
});
|
|
104
103
|
return t && n?.(e), t;
|
|
105
104
|
} finally {
|
|
106
|
-
|
|
105
|
+
c.value = !1;
|
|
107
106
|
}
|
|
108
107
|
}
|
|
109
|
-
async function
|
|
110
|
-
if (
|
|
111
|
-
|
|
108
|
+
async function p(e = !1) {
|
|
109
|
+
if (c.value || !a) return null;
|
|
110
|
+
c.value = !0;
|
|
112
111
|
try {
|
|
113
112
|
if (navigator.clipboard && navigator.clipboard.read) {
|
|
114
113
|
let t = await navigator.clipboard.read(), n = "", a = "";
|
|
115
114
|
for (let e of t) e.types.includes("text/html") && (n = await (await e.getType("text/html")).text()), e.types.includes("text/plain") && (a = await (await e.getType("text/plain")).text());
|
|
116
115
|
e && (n = "");
|
|
117
|
-
let o =
|
|
116
|
+
let o = b(n, a, i);
|
|
118
117
|
return u.value = o, r?.(o, e), o;
|
|
119
118
|
}
|
|
120
119
|
return null;
|
|
121
120
|
} catch (e) {
|
|
122
121
|
return o?.(e instanceof Error ? e : Error(String(e))), null;
|
|
123
122
|
} finally {
|
|
124
|
-
|
|
123
|
+
c.value = !1;
|
|
125
124
|
}
|
|
126
125
|
}
|
|
127
126
|
return {
|
|
128
127
|
copy: d,
|
|
129
128
|
cut: f,
|
|
130
|
-
paste:
|
|
131
|
-
isProcessing:
|
|
129
|
+
paste: p,
|
|
130
|
+
isProcessing: c,
|
|
132
131
|
lastPastedContent: u
|
|
133
132
|
};
|
|
134
133
|
}
|
|
135
134
|
//#endregion
|
|
136
|
-
//#region src/composables/useDragAutoScroll.ts
|
|
137
|
-
var G = 40, K = 12;
|
|
138
|
-
function q({ pagesContainer: e, onScrollExtendSelection: t }) {
|
|
139
|
-
let n = null, r = 0, i = 0, o = !1, s = null;
|
|
140
|
-
function c() {
|
|
141
|
-
if (s) return s;
|
|
142
|
-
let t = e.value;
|
|
143
|
-
return t ? (s = P(t), s) : null;
|
|
144
|
-
}
|
|
145
|
-
function l() {
|
|
146
|
-
o = !1, n !== null && (cancelAnimationFrame(n), n = null);
|
|
147
|
-
}
|
|
148
|
-
function u() {
|
|
149
|
-
if (!o) return;
|
|
150
|
-
let e = c();
|
|
151
|
-
if (!e) return;
|
|
152
|
-
let a = e.getBoundingClientRect(), s = 0;
|
|
153
|
-
if (i < a.top + G) {
|
|
154
|
-
let e = Math.max(0, a.top + G - i);
|
|
155
|
-
s = -Math.min(K, e / G * K);
|
|
156
|
-
} else if (i > a.bottom - G) {
|
|
157
|
-
let e = Math.max(0, i - (a.bottom - G));
|
|
158
|
-
s = Math.min(K, e / G * K);
|
|
159
|
-
}
|
|
160
|
-
s !== 0 && (e.scrollTop += s, t(r, i)), n = requestAnimationFrame(u);
|
|
161
|
-
}
|
|
162
|
-
function d() {
|
|
163
|
-
o || (o = !0, n = requestAnimationFrame(u));
|
|
164
|
-
}
|
|
165
|
-
function f(e, t) {
|
|
166
|
-
if (r = e, i = t, !o) {
|
|
167
|
-
let e = c();
|
|
168
|
-
if (!e) return;
|
|
169
|
-
let n = e.getBoundingClientRect();
|
|
170
|
-
(t < n.top + G || t > n.bottom - G) && d();
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
return a(() => l()), {
|
|
174
|
-
updateMousePosition: f,
|
|
175
|
-
stopAutoScroll: l
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
//#endregion
|
|
179
135
|
//#region src/composables/useFindReplace.ts
|
|
180
|
-
function
|
|
181
|
-
let t =
|
|
136
|
+
function G(e = {}) {
|
|
137
|
+
let t = c({
|
|
182
138
|
isOpen: !1,
|
|
183
139
|
searchText: "",
|
|
184
140
|
replaceText: "",
|
|
@@ -193,13 +149,13 @@ function J(e = {}) {
|
|
|
193
149
|
function r(e) {
|
|
194
150
|
t.isOpen = !0, t.replaceMode = !0, e && (t.searchText = e), t.matches = [], t.currentIndex = 0;
|
|
195
151
|
}
|
|
196
|
-
function
|
|
152
|
+
function i() {
|
|
197
153
|
t.isOpen = !1;
|
|
198
154
|
}
|
|
199
155
|
function o() {
|
|
200
156
|
t.isOpen = !t.isOpen;
|
|
201
157
|
}
|
|
202
|
-
function
|
|
158
|
+
function s(e) {
|
|
203
159
|
t.searchText = e;
|
|
204
160
|
}
|
|
205
161
|
function l(e) {
|
|
@@ -226,13 +182,13 @@ function J(e = {}) {
|
|
|
226
182
|
}
|
|
227
183
|
return {
|
|
228
184
|
state: t,
|
|
229
|
-
currentMatch:
|
|
230
|
-
hasMatches:
|
|
185
|
+
currentMatch: a(() => t.matches.length === 0 ? null : t.matches[t.currentIndex] ?? null),
|
|
186
|
+
hasMatches: a(() => t.matches.length > 0),
|
|
231
187
|
openFind: n,
|
|
232
188
|
openReplace: r,
|
|
233
|
-
close:
|
|
189
|
+
close: i,
|
|
234
190
|
toggle: o,
|
|
235
|
-
setSearchText:
|
|
191
|
+
setSearchText: s,
|
|
236
192
|
setReplaceText: l,
|
|
237
193
|
setOptions: u,
|
|
238
194
|
setMatches: d,
|
|
@@ -243,38 +199,38 @@ function J(e = {}) {
|
|
|
243
199
|
}
|
|
244
200
|
//#endregion
|
|
245
201
|
//#region src/composables/useFixedDropdown.ts
|
|
246
|
-
function
|
|
247
|
-
let r =
|
|
202
|
+
function K({ isOpen: e, onClose: t, align: n = "left" }) {
|
|
203
|
+
let r = l(null), i = l(null), a = l({
|
|
248
204
|
position: "fixed",
|
|
249
205
|
top: "0px",
|
|
250
206
|
left: "0px",
|
|
251
207
|
zIndex: 1e4
|
|
252
208
|
});
|
|
253
209
|
function s(e, t) {
|
|
254
|
-
|
|
210
|
+
a.value = {
|
|
255
211
|
position: "fixed",
|
|
256
212
|
top: e + "px",
|
|
257
213
|
left: t + "px",
|
|
258
214
|
zIndex: 1e4
|
|
259
215
|
};
|
|
260
216
|
}
|
|
261
|
-
function
|
|
217
|
+
function c(e) {
|
|
262
218
|
let n = e.target;
|
|
263
219
|
r.value && !r.value.contains(n) && i.value && !i.value.contains(n) && t();
|
|
264
220
|
}
|
|
265
|
-
function
|
|
221
|
+
function u(e) {
|
|
266
222
|
e.key === "Escape" && t();
|
|
267
223
|
}
|
|
268
224
|
function f() {
|
|
269
225
|
t();
|
|
270
226
|
}
|
|
271
227
|
function p() {
|
|
272
|
-
document.addEventListener("mousedown",
|
|
228
|
+
document.addEventListener("mousedown", c), document.addEventListener("keydown", u), window.addEventListener("scroll", f, !0);
|
|
273
229
|
}
|
|
274
230
|
function m() {
|
|
275
|
-
document.removeEventListener("mousedown",
|
|
231
|
+
document.removeEventListener("mousedown", c), document.removeEventListener("keydown", u), window.removeEventListener("scroll", f, !0);
|
|
276
232
|
}
|
|
277
|
-
|
|
233
|
+
d(e, (e) => {
|
|
278
234
|
if (!e) {
|
|
279
235
|
m();
|
|
280
236
|
return;
|
|
@@ -289,61 +245,61 @@ function Y({ isOpen: e, onClose: t, align: n = "left" }) {
|
|
|
289
245
|
s(a.bottom + 4, a.right - t.width);
|
|
290
246
|
} else s(a.bottom + 4, a.left);
|
|
291
247
|
}) : s(a.bottom + 4, a.left), p();
|
|
292
|
-
}),
|
|
248
|
+
}), o(m);
|
|
293
249
|
function h(e) {
|
|
294
250
|
e.preventDefault(), e.stopPropagation();
|
|
295
251
|
}
|
|
296
252
|
return {
|
|
297
253
|
containerRef: r,
|
|
298
254
|
dropdownRef: i,
|
|
299
|
-
dropdownStyle:
|
|
255
|
+
dropdownStyle: a,
|
|
300
256
|
handleMouseDown: h
|
|
301
257
|
};
|
|
302
258
|
}
|
|
303
259
|
//#endregion
|
|
304
260
|
//#region src/composables/useHistory.ts
|
|
305
|
-
function
|
|
306
|
-
let n =
|
|
261
|
+
function q(e, t) {
|
|
262
|
+
let n = a(() => {
|
|
307
263
|
t.value;
|
|
308
264
|
let n = e.value;
|
|
309
|
-
return n ?
|
|
310
|
-
}), r =
|
|
265
|
+
return n ? T(n.state) > 0 : !1;
|
|
266
|
+
}), r = a(() => {
|
|
311
267
|
t.value;
|
|
312
268
|
let n = e.value;
|
|
313
|
-
return n ?
|
|
269
|
+
return n ? C(n.state) > 0 : !1;
|
|
314
270
|
});
|
|
315
|
-
function
|
|
271
|
+
function i() {
|
|
316
272
|
let t = e.value;
|
|
317
|
-
return t ?
|
|
273
|
+
return t ? w(t.state, t.dispatch) : !1;
|
|
318
274
|
}
|
|
319
275
|
function o() {
|
|
320
276
|
let t = e.value;
|
|
321
|
-
return t ?
|
|
277
|
+
return t ? S(t.state, t.dispatch) : !1;
|
|
322
278
|
}
|
|
323
279
|
return {
|
|
324
280
|
canUndo: n,
|
|
325
281
|
canRedo: r,
|
|
326
|
-
undo:
|
|
282
|
+
undo: i,
|
|
327
283
|
redo: o
|
|
328
284
|
};
|
|
329
285
|
}
|
|
330
286
|
//#endregion
|
|
331
287
|
//#region src/composables/useSelectionHighlight.ts
|
|
332
|
-
function
|
|
333
|
-
let { containerRef: t, enabled: n = !0, config: r =
|
|
288
|
+
function J(e) {
|
|
289
|
+
let { containerRef: t, enabled: n = !0, config: r = f, useOverlay: i = !1, debounceMs: c = 16, onSelectionChange: u } = e, m = l(!1), b = l(""), x = l([]), S = l(!1), C = null, w = 0;
|
|
334
290
|
function T() {
|
|
335
|
-
let e = t.value, n =
|
|
336
|
-
|
|
291
|
+
let e = t.value, n = _(), r = g(), a = e ? y(e) : !1;
|
|
292
|
+
m.value = n, b.value = r, S.value = a, x.value = i && a && e ? h(e) : [], u?.(n && a, r);
|
|
337
293
|
}
|
|
338
294
|
function E() {
|
|
339
295
|
T();
|
|
340
296
|
}
|
|
341
297
|
function D() {
|
|
342
298
|
let e = performance.now();
|
|
343
|
-
if (e - w <
|
|
299
|
+
if (e - w < c) {
|
|
344
300
|
C && clearTimeout(C), C = setTimeout(() => {
|
|
345
301
|
w = performance.now(), T(), C = null;
|
|
346
|
-
},
|
|
302
|
+
}, c);
|
|
347
303
|
return;
|
|
348
304
|
}
|
|
349
305
|
w = e, T();
|
|
@@ -362,26 +318,26 @@ function Z(e) {
|
|
|
362
318
|
pointerEvents: "none"
|
|
363
319
|
};
|
|
364
320
|
}
|
|
365
|
-
return
|
|
366
|
-
n && (
|
|
367
|
-
}),
|
|
321
|
+
return s(() => {
|
|
322
|
+
n && (p() || v(r), document.addEventListener("selectionchange", D));
|
|
323
|
+
}), o(() => {
|
|
368
324
|
document.removeEventListener("selectionchange", D), C && clearTimeout(C);
|
|
369
|
-
}),
|
|
370
|
-
hasSelection:
|
|
371
|
-
selectedText:
|
|
372
|
-
highlightRects:
|
|
373
|
-
isSelectionInContainer:
|
|
325
|
+
}), d(t, () => T()), {
|
|
326
|
+
hasSelection: a(() => m.value),
|
|
327
|
+
selectedText: a(() => b.value),
|
|
328
|
+
highlightRects: a(() => x.value),
|
|
329
|
+
isSelectionInContainer: a(() => S.value),
|
|
374
330
|
refresh: E,
|
|
375
331
|
getOverlayStyle: O
|
|
376
332
|
};
|
|
377
333
|
}
|
|
378
334
|
//#endregion
|
|
379
335
|
//#region src/composables/useTableSelection.ts
|
|
380
|
-
function
|
|
381
|
-
let e = new I(), t =
|
|
336
|
+
function Y() {
|
|
337
|
+
let e = new I(), t = l(null), n = () => {
|
|
382
338
|
t.value = e.getSnapshot().selectedCell;
|
|
383
339
|
}, r = e.subscribe(n);
|
|
384
|
-
n(),
|
|
340
|
+
n(), o(() => {
|
|
385
341
|
r();
|
|
386
342
|
});
|
|
387
343
|
function i(t, n, r) {
|
|
@@ -391,32 +347,32 @@ function Q() {
|
|
|
391
347
|
columnIndex: r
|
|
392
348
|
});
|
|
393
349
|
}
|
|
394
|
-
function
|
|
350
|
+
function a(t, n) {
|
|
395
351
|
let r = L(t, n);
|
|
396
352
|
r ? e.selectCell(r) : e.clearSelection();
|
|
397
353
|
}
|
|
398
354
|
function s() {
|
|
399
355
|
e.clearSelection();
|
|
400
356
|
}
|
|
401
|
-
function
|
|
357
|
+
function c(t, n, r) {
|
|
402
358
|
return e.isCellSelected(t, n, r);
|
|
403
359
|
}
|
|
404
360
|
return {
|
|
405
361
|
selectedCell: t,
|
|
406
362
|
handleCellClick: i,
|
|
407
|
-
handleClickTarget:
|
|
363
|
+
handleClickTarget: a,
|
|
408
364
|
clearSelection: s,
|
|
409
|
-
isCellSelected:
|
|
365
|
+
isCellSelected: c
|
|
410
366
|
};
|
|
411
367
|
}
|
|
412
368
|
//#endregion
|
|
413
369
|
//#region src/composables/useTrackedChanges.ts
|
|
414
|
-
function
|
|
415
|
-
return
|
|
370
|
+
function X(e, t) {
|
|
371
|
+
return a(() => (t.value, E(e.value?.state ?? null)));
|
|
416
372
|
}
|
|
417
373
|
//#endregion
|
|
418
374
|
//#region src/composables/useVisualLineNavigation.ts
|
|
419
|
-
function
|
|
375
|
+
function Z(e) {
|
|
420
376
|
let t = R();
|
|
421
377
|
function n(t) {
|
|
422
378
|
let n = e.value;
|
|
@@ -441,4 +397,4 @@ function ee(e) {
|
|
|
441
397
|
};
|
|
442
398
|
}
|
|
443
399
|
//#endregion
|
|
444
|
-
export {
|
|
400
|
+
export { O as createSelectionFromDOM, E as extractTrackedChanges, k as formatLastSaveTime, A as formatStorageSize, j as getAutoSaveStatusLabel, M as getAutoSaveStorageSize, N as getSelectionRuns, P as isAutoSaveSupported, x as runsToClipboardContent, U as useAutoSave, W as useClipboard, e as useCommentSidebarItems, t as useDocxEditor, i as useDragAutoScroll, G as useFindReplace, K as useFixedDropdown, q as useHistory, J as useSelectionHighlight, n as useTableResize, Y as useTableSelection, X as useTrackedChanges, Z as useVisualLineNavigation, r as useWheelZoom, r as useZoom };
|
package/dist/dialogs.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./KeyboardShortcutsDialog-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./KeyboardShortcutsDialog-Bct8AJ0i.cjs`),t=require(`./TablePropertiesDialog-JWT68zEO.cjs`);exports.FindReplaceDialog=e.s,exports.FootnotePropertiesDialog=t.o,exports.HyperlinkDialog=e.a,exports.ImagePositionDialog=t.a,exports.ImagePropertiesDialog=e.r,exports.InsertImageDialog=e.o,exports.InsertSymbolDialog=e.i,exports.InsertTableDialog=t.i,exports.KeyboardShortcutsDialog=e.t,exports.PageSetupDialog=e.n,exports.PasteSpecialDialog=t.r,exports.SplitCellDialog=t.n,exports.TablePropertiesDialog=t.t;
|
package/dist/dialogs.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./KeyboardShortcutsDialog-
|
|
2
|
-
import { a as s, i as c, n as l, o as u, r as d, t as f } from "./TablePropertiesDialog-
|
|
1
|
+
import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./KeyboardShortcutsDialog-BbuDgglK.js";
|
|
2
|
+
import { a as s, i as c, n as l, o as u, r as d, t as f } from "./TablePropertiesDialog-D5MIF3cj.js";
|
|
3
3
|
export { a as FindReplaceDialog, u as FootnotePropertiesDialog, e as HyperlinkDialog, s as ImagePositionDialog, i as ImagePropertiesDialog, r as InsertImageDialog, t as InsertSymbolDialog, c as InsertTableDialog, o as KeyboardShortcutsDialog, n as PageSetupDialog, d as PasteSpecialDialog, l as SplitCellDialog, f as TablePropertiesDialog };
|