@stll/folio-vue 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ListButtons-C1rU_Y1e.cjs +4 -0
- package/dist/{ListButtons-DXqMvba3.js → ListButtons-DMnOM2pN.js} +385 -410
- package/dist/{WatermarkDialog-r4wmldt4.js → WatermarkDialog-Cf9ISDvv.js} +1378 -1445
- package/dist/WatermarkDialog-ChJtT7Bs.cjs +15 -0
- package/dist/components/DocxEditor/pagedEditorRef.d.ts +2 -3
- package/dist/composables/index.d.ts +1 -2
- package/dist/composables/useDocxEditor.d.ts +26 -0
- package/dist/composables/useDocxEditorRefApi.d.ts +1 -0
- package/dist/composables/useFindReplace.d.ts +24 -22
- package/dist/composables/usePagesPointer.d.ts +9 -13
- package/dist/composables/useRemoteSelectionSync.d.ts +10 -0
- package/dist/composables/useSelectionSync.d.ts +17 -30
- package/dist/composables.cjs +2 -2
- package/dist/composables.js +80 -68
- package/dist/dialogs.cjs +1 -1
- package/dist/dialogs.js +1 -1
- package/dist/folio-vue.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1578 -1174
- package/dist/styles/zIndex.d.ts +1 -0
- package/dist/styles.cjs +1 -1
- package/dist/styles.js +1 -1
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +2 -2
- package/dist/useFindReplace-CL8Rbc3y.js +59 -0
- package/dist/useFindReplace-ZCrdvwEk.cjs +1 -0
- package/dist/useZoom-BYEcnpS0.cjs +1 -0
- package/dist/useZoom-C0p0o54p.js +656 -0
- package/dist/zIndex-CYoLNG_N.cjs +1 -0
- package/dist/{zIndex-BY0qa8Au.js → zIndex-Ei9BbHSW.js} +1 -0
- package/package.json +1 -1
- package/dist/ListButtons-BvsV1yti.cjs +0 -4
- package/dist/WatermarkDialog-DHfk8jrg.cjs +0 -15
- package/dist/components/sidebar/resolveItemPositions.d.ts +0 -22
- package/dist/useZoom-C7jhL696.cjs +0 -1
- package/dist/useZoom-zJvuJlUd.js +0 -615
- package/dist/zIndex-dFsQbASx.cjs +0 -1
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import { ComputedRef, Ref, ShallowRef } from 'vue';
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
import { ProseMirrorFindMatch } from '@stll/folio-core/prosemirror/findReplaceSelection';
|
|
4
|
+
import { FindOptions } from '@stll/folio-core/utils/findReplace';
|
|
5
|
+
export type UseFindReplaceOptions = {
|
|
6
|
+
editorView: Readonly<Ref<EditorView | null>>;
|
|
7
|
+
scrollVisiblePositionIntoView?: (pmPos: number) => void;
|
|
8
|
+
};
|
|
9
|
+
export type UseFindReplaceReturn = {
|
|
10
|
+
searchText: Ref<string>;
|
|
11
|
+
replaceText: Ref<string>;
|
|
12
|
+
options: FindOptions;
|
|
13
|
+
matches: ShallowRef<ProseMirrorFindMatch[]>;
|
|
14
|
+
currentIndex: Ref<number>;
|
|
15
|
+
currentMatch: ComputedRef<ProseMirrorFindMatch | null>;
|
|
16
|
+
performSearch: () => ProseMirrorFindMatch[];
|
|
17
|
+
goToMatch: (index: number) => boolean;
|
|
18
|
+
findNext: () => ProseMirrorFindMatch | null;
|
|
19
|
+
findPrevious: () => ProseMirrorFindMatch | null;
|
|
20
|
+
replaceCurrent: () => boolean;
|
|
21
|
+
replaceAll: () => number;
|
|
22
|
+
clear: () => void;
|
|
23
|
+
};
|
|
24
|
+
export declare function useFindReplace({ editorView, scrollVisiblePositionIntoView, }: UseFindReplaceOptions): UseFindReplaceReturn;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Ref, ShallowRef } from 'vue';
|
|
2
2
|
import { Command } from 'prosemirror-state';
|
|
3
3
|
import { EditorView } from 'prosemirror-view';
|
|
4
|
-
import { HeaderFooter, BlockContent } from '@stll/folio-core/types/content';
|
|
5
4
|
import { Document } from '@stll/folio-core/types/document';
|
|
6
5
|
import { Layout } from '@stll/folio-core/layout-engine';
|
|
7
6
|
import { ImageSelectionInfo } from '../components/imageSelectionTypes';
|
|
@@ -19,9 +18,10 @@ export type TableInsertButton = {
|
|
|
19
18
|
cellPmPos: number;
|
|
20
19
|
};
|
|
21
20
|
export type HfEditState = {
|
|
21
|
+
isFirstPage: boolean;
|
|
22
|
+
pageNumber: number;
|
|
22
23
|
position: "header" | "footer";
|
|
23
24
|
rId: string | null;
|
|
24
|
-
headerFooter: HeaderFooter | null;
|
|
25
25
|
targetRect: {
|
|
26
26
|
top: number;
|
|
27
27
|
left: number;
|
|
@@ -42,29 +42,25 @@ export type UsePagesPointerOptions = {
|
|
|
42
42
|
imageInteracting: Ref<boolean>;
|
|
43
43
|
hyperlinkPopupData: Ref<HyperlinkPopupData | null>;
|
|
44
44
|
readOnly: Ref<boolean>;
|
|
45
|
+
showHeaderFooterEditing: Ref<boolean>;
|
|
45
46
|
zoom: Ref<number>;
|
|
46
47
|
layout: Ref<Layout | null>;
|
|
47
48
|
tableResize: TableResizeApi;
|
|
48
49
|
getCommands: () => Commands;
|
|
49
50
|
getDocument: () => Document | null;
|
|
50
51
|
reLayout: () => void;
|
|
51
|
-
|
|
52
|
+
onDocumentChange: (document: Document) => void;
|
|
52
53
|
clearOverlay: () => void;
|
|
53
|
-
/**
|
|
54
|
-
|
|
55
|
-
* exposed by `useDocxEditor.syncHfPMs`. Called after every save so the
|
|
56
|
-
* persistent PM points at the new HeaderFooter object. Optional so existing
|
|
57
|
-
* consumers can no-op until they wire it through.
|
|
58
|
-
*/
|
|
59
|
-
syncHfPMs?: () => void;
|
|
54
|
+
/** Synchronize persistent header/footer views after document-model changes. */
|
|
55
|
+
syncHfPMs: () => void;
|
|
60
56
|
/** Resolve the persistent EditorView for an HF instance (for click routing). */
|
|
61
|
-
getHfPmView
|
|
57
|
+
getHfPmView: (rId: string) => EditorView | null;
|
|
62
58
|
/**
|
|
63
59
|
* Replace the loaded Document — used by HF materialisation to publish a
|
|
64
60
|
* fresh Document object instead of mutating in place. Optional; if absent,
|
|
65
61
|
* callers fall back to in-place mutation + `syncHfPMs()`.
|
|
66
62
|
*/
|
|
67
|
-
setDocument
|
|
63
|
+
setDocument: (doc: Document) => void;
|
|
68
64
|
};
|
|
69
65
|
export type UsePagesPointerReturn = {
|
|
70
66
|
tableInsertButton: Ref<TableInsertButton | null>;
|
|
@@ -80,7 +76,7 @@ export type UsePagesPointerReturn = {
|
|
|
80
76
|
handlePagesDoubleClick: (event: MouseEvent) => void;
|
|
81
77
|
handleTableInsertClick: (event: MouseEvent) => void;
|
|
82
78
|
clearTableInsertTimer: () => void;
|
|
83
|
-
handleHfSave: (
|
|
79
|
+
handleHfSave: () => void;
|
|
84
80
|
handleHfRemove: () => void;
|
|
85
81
|
};
|
|
86
82
|
export declare function usePagesPointer(opts: UsePagesPointerOptions): UsePagesPointerReturn;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { HiddenProseMirrorRemoteSelection } from '@stll/folio-core/controller/hiddenEditorManager';
|
|
3
|
+
import { LayoutSelectionGate } from '@stll/folio-core/paged-layout/LayoutSelectionGate';
|
|
4
|
+
export type UseRemoteSelectionSyncOptions = {
|
|
5
|
+
pagesRef: Ref<HTMLElement | null>;
|
|
6
|
+
remoteSelections: Ref<HiddenProseMirrorRemoteSelection[]>;
|
|
7
|
+
syncCoordinator: LayoutSelectionGate;
|
|
8
|
+
zoom: Ref<number>;
|
|
9
|
+
};
|
|
10
|
+
export declare const useRemoteSelectionSync: (options: UseRemoteSelectionSyncOptions) => void;
|
|
@@ -1,30 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*
|
|
19
|
-
* The DOM primitives it also uses DO resolve, but at drifted paths
|
|
20
|
-
* (`getSelectionRectsFromDom`/`getCaretPositionFromDom` →
|
|
21
|
-
* `@stll/folio-core/layout-bridge/dom/clickToPositionDom`; `findBodyPmAnchor` →
|
|
22
|
-
* `@stll/folio-core/layout-bridge/dom/findBodyPmSpans`). With the four blockers
|
|
23
|
-
* above there is no coherent working subset, so the whole composable is blocked.
|
|
24
|
-
*
|
|
25
|
-
* Unblock: PORT `applyCellSelectionHighlight` and `findImageElement` into core
|
|
26
|
-
* (or a core barrel), then port the `imageSelectionTypes` + `styles/zIndex`
|
|
27
|
-
* Vue-package modules, and re-point the DOM-primitive imports to the drifted
|
|
28
|
-
* paths above.
|
|
29
|
-
*/
|
|
30
|
-
export {};
|
|
1
|
+
import { Ref, ShallowRef } from 'vue';
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
import { LayoutSelectionGate } from '@stll/folio-core/paged-layout/LayoutSelectionGate';
|
|
4
|
+
import { ImageSelectionInfo } from '../components/imageSelectionTypes';
|
|
5
|
+
export type UseSelectionSyncOptions = {
|
|
6
|
+
editorView: Ref<EditorView | null>;
|
|
7
|
+
pagesRef: Ref<HTMLElement | null>;
|
|
8
|
+
zoom: Ref<number>;
|
|
9
|
+
selectedImage: ShallowRef<ImageSelectionInfo | null>;
|
|
10
|
+
syncCoordinator: LayoutSelectionGate;
|
|
11
|
+
imageInteracting?: Ref<boolean>;
|
|
12
|
+
};
|
|
13
|
+
export type UseSelectionSyncReturn = {
|
|
14
|
+
clearOverlay: () => void;
|
|
15
|
+
updateSelectionOverlay: () => void;
|
|
16
|
+
};
|
|
17
|
+
export declare const useSelectionSync: (opts: UseSelectionSyncOptions) => UseSelectionSyncReturn;
|
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("./useFindReplace-ZCrdvwEk.cjs"),t=require("./useZoom-BYEcnpS0.cjs");let n=require("vue"),r=require("prosemirror-history"),i=require("@stll/folio-core/utils/clipboard"),a=require("@stll/folio-core/managers/ClipboardManager"),o=require("@stll/folio-core/managers/TableSelectionManager"),s=require("@stll/folio-core/prosemirror/utils/visualLineNavigation"),c=require("@stll/folio-core/prosemirror/utils/extractTrackedChanges");function l(e={}){let{onCopy:t,onCut:r,onPaste:a,cleanWordFormatting:o=!0,editable:s=!0,onError:c}=e,l=(0,n.ref)(!1),u=(0,n.ref)(null),d=c?{onError:c}:{};async function f(e){if(l.value)return!1;l.value=!0;try{let n=await(0,i.copyRuns)(e.runs,d);return n&&t?.(e),n}finally{l.value=!1}}async function p(e){if(l.value||!s)return!1;l.value=!0;try{let t=await(0,i.copyRuns)(e.runs,d);return t&&r?.(e),t}finally{l.value=!1}}async function m(e=!1){if(l.value||!s)return null;l.value=!0;try{if(navigator.clipboard&&navigator.clipboard.read){let t=await navigator.clipboard.read(),n=``,r=``;for(let e of t)e.types.includes(`text/html`)&&(n=await(await e.getType(`text/html`)).text()),e.types.includes(`text/plain`)&&(r=await(await e.getType(`text/plain`)).text());e&&(n=``);let s=(0,i.parseClipboardHtml)(n,r,o);return u.value=s,a?.(s,e),s}return null}catch(e){return c?.(e instanceof Error?e:Error(String(e))),null}finally{l.value=!1}}return{copy:f,cut:p,paste:m,isProcessing:l,lastPastedContent:u}}function u({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;n instanceof Node&&i.value&&!i.value.contains(n)&&a.value&&!a.value.contains(n)&&t()}function l(e){e.key===`Escape`&&t()}function u(e){let n=e.target;n instanceof Node&&a.value&&a.value.contains(n)||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.onScopeDispose)(f);function p(e){e.preventDefault(),e.stopPropagation()}return{containerRef:i,dropdownRef:a,dropdownStyle:o,handleMouseDown:p}}function d(e,t){let i=(0,n.computed)(()=>{t.value;let n=e.value;return n?(0,r.undoDepth)(n.state)>0:!1}),a=(0,n.computed)(()=>{t.value;let n=e.value;return n?(0,r.redoDepth)(n.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 f={backgroundColor:`rgba(26, 115, 232, 0.3)`,borderRadius:0,zIndex:0,opacity:1,mixBlendMode:`multiply`};function p(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 m(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 h(e){return m(p(e))}function g(){let e=window.getSelection();return e!==null&&!e.isCollapsed&&e.rangeCount>0}function _(e){let t=window.getSelection();return!t||t.rangeCount===0?!1:e.contains(t.getRangeAt(0).commonAncestorContainer)}var v=`docx-selection-styles`,y=null;function b(){y&&=(y.remove(),null),document.getElementById(v)?.remove()}function x(e=f){b();let t=`
|
|
2
2
|
/* DOCX Editor Selection Highlighting */
|
|
3
3
|
|
|
4
4
|
.docx-editor [contenteditable="true"]::selection,
|
|
@@ -58,4 +58,4 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
58
58
|
background-color: rgba(156, 39, 176, 0.2);
|
|
59
59
|
border-bottom: 2px dashed rgba(156, 39, 176, 0.6);
|
|
60
60
|
}
|
|
61
|
-
`;
|
|
61
|
+
`;y=document.createElement(`style`),y.id=v,y.textContent=t,document.head.appendChild(y)}function S(){return y!==null||document.getElementById(v)!==null}function C(){return window.getSelection()?.toString()??``}function w(e){let{containerRef:t,enabled:r=!0,config:i=f,useOverlay:a=!1,debounceMs:o=16,onSelectionChange:s}=e,c=(0,n.ref)(!1),l=(0,n.ref)(``),u=(0,n.ref)([]),d=(0,n.ref)(!1),p=null,m=0;function v(){let e=t.value,n=g(),r=C(),i=e?_(e):!1;c.value=n,l.value=r,d.value=i,u.value=a&&i&&e?h(e):[],s?.(n&&i,r)}function y(){v()}function b(){let e=performance.now();if(e-m<o){p&&clearTimeout(p),p=setTimeout(()=>{m=performance.now(),v(),p=null},o);return}m=e,v()}function w(e){let t={position:`absolute`,left:`${e.left}px`,top:`${e.top}px`,width:`${e.width}px`,height:`${e.height}px`,backgroundColor:i.backgroundColor,zIndex:i.zIndex??0,pointerEvents:`none`};return i.borderRadius&&(t.borderRadius=`${i.borderRadius}px`),i.borderColor&&(t.border=`1px solid ${i.borderColor}`),t}return(0,n.onMounted)(()=>{r&&(S()||x(i),document.addEventListener(`selectionchange`,b))}),(0,n.onBeforeUnmount)(()=>{document.removeEventListener(`selectionchange`,b),p&&clearTimeout(p)}),(0,n.watch)(t,()=>v()),{hasSelection:(0,n.computed)(()=>c.value),selectedText:(0,n.computed)(()=>l.value),highlightRects:(0,n.computed)(()=>u.value),isSelectionInContainer:(0,n.computed)(()=>d.value),refresh:y,getOverlayStyle:w}}function T(){let e=new o.TableSelectionManager,t=(0,n.ref)(null),r=()=>{let n=e.getSnapshot();t.value=n.tableIndex!==null&&n.rowIndex!==null&&n.columnIndex!==null?{tableIndex:n.tableIndex,rowIndex:n.rowIndex,columnIndex:n.columnIndex}:null},i=e.subscribe(r);r(),(0,n.onScopeDispose)(i);function a(t,n,r){e.selectCellCoordinates({tableIndex:t,rowIndex:n,columnIndex:r})}function s(t,n){let r=(0,o.findTableFromClick)(t,n);if(!r){e.clearSelection();return}e.selectCellCoordinates(r)}function c(){e.clearSelection()}function l(t,n,r){return e.isCellSelected(t,n,r)}return{selectedCell:t,handleCellClick:a,handleClickTarget:s,clearSelection:c,isCellSelected:l}}function E(e){let t=(0,s.createVisualLineState)();function n(t){let n=e.value;return n?(0,s.getCaretClientX)(n,t):null}function r(t){let n=e.value;return n?(0,s.findLineElementAtPosition)(n,t):null}function i(e,t){return(0,s.findPositionOnLineAtClientX)(e,t)}function a(n,r){return(0,s.handleVisualLineKeyDown)(t,n,r,e.value)}return{state:t,getCaretClientX:n,findLineElementAtPosition:r,findPositionOnLineAtClientX:i,handlePMKeyDown:a}}exports.createSelectionFromDOM=a.createSelectionFromDOM,exports.extractTrackedChanges=c.extractTrackedChanges,exports.getSelectionRuns=a.getSelectionRuns,exports.runsToClipboardContent=i.runsToClipboardContent,exports.useClipboard=l,exports.useDocxEditor=t.a,exports.useDragAutoScroll=t.i,exports.useFindReplace=e.t,exports.useFixedDropdown=u,exports.useHistory=d,exports.useSelectionHighlight=w,exports.useTableResize=t.r,exports.useTableSelection=T,exports.useTrackedChanges=t.n,exports.useVisualLineNavigation=E,exports.useWheelZoom=t.t,exports.useZoom=t.t;
|
package/dist/composables.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { t as e } from "./useFindReplace-CL8Rbc3y.js";
|
|
2
|
+
import { a as t, i as n, n as r, o as i, r as a, t as o } from "./useZoom-C0p0o54p.js";
|
|
3
|
+
import { computed as s, onBeforeUnmount as c, onMounted as l, onScopeDispose as u, ref as d, watch as f } from "vue";
|
|
4
|
+
import { redo as p, redoDepth as m, undo as h, undoDepth as g } from "prosemirror-history";
|
|
5
|
+
import { copyRuns as _, parseClipboardHtml as v, runsToClipboardContent as y } from "@stll/folio-core/utils/clipboard";
|
|
6
|
+
import { createSelectionFromDOM as b, getSelectionRuns as x } from "@stll/folio-core/managers/ClipboardManager";
|
|
7
|
+
import { TableSelectionManager as S, findTableFromClick as C } from "@stll/folio-core/managers/TableSelectionManager";
|
|
8
|
+
import { createVisualLineState as w, findLineElementAtPosition as T, findPositionOnLineAtClientX as E, getCaretClientX as D, handleVisualLineKeyDown as O } from "@stll/folio-core/prosemirror/utils/visualLineNavigation";
|
|
8
9
|
//#region src/composables/useClipboard.ts
|
|
9
|
-
function
|
|
10
|
-
let { onCopy: t, onCut: n, onPaste: r, cleanWordFormatting: i = !0, editable: a = !0, onError: o } = e, s =
|
|
11
|
-
async function
|
|
10
|
+
function k(e = {}) {
|
|
11
|
+
let { onCopy: t, onCut: n, onPaste: r, cleanWordFormatting: i = !0, editable: a = !0, onError: o } = e, s = d(!1), c = d(null), l = o ? { onError: o } : {};
|
|
12
|
+
async function u(e) {
|
|
12
13
|
if (s.value) return !1;
|
|
13
14
|
s.value = !0;
|
|
14
15
|
try {
|
|
15
|
-
let n = await
|
|
16
|
+
let n = await _(e.runs, l);
|
|
16
17
|
return n && t?.(e), n;
|
|
17
18
|
} finally {
|
|
18
19
|
s.value = !1;
|
|
@@ -22,7 +23,7 @@ function O(e = {}) {
|
|
|
22
23
|
if (s.value || !a) return !1;
|
|
23
24
|
s.value = !0;
|
|
24
25
|
try {
|
|
25
|
-
let t = await
|
|
26
|
+
let t = await _(e.runs, l);
|
|
26
27
|
return t && n?.(e), t;
|
|
27
28
|
} finally {
|
|
28
29
|
s.value = !1;
|
|
@@ -36,7 +37,7 @@ function O(e = {}) {
|
|
|
36
37
|
let t = await navigator.clipboard.read(), n = "", a = "";
|
|
37
38
|
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());
|
|
38
39
|
e && (n = "");
|
|
39
|
-
let o =
|
|
40
|
+
let o = v(n, a, i);
|
|
40
41
|
return c.value = o, r?.(o, e), o;
|
|
41
42
|
}
|
|
42
43
|
return null;
|
|
@@ -47,7 +48,7 @@ function O(e = {}) {
|
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
return {
|
|
50
|
-
copy:
|
|
51
|
+
copy: u,
|
|
51
52
|
cut: f,
|
|
52
53
|
paste: p,
|
|
53
54
|
isProcessing: s,
|
|
@@ -56,8 +57,8 @@ function O(e = {}) {
|
|
|
56
57
|
}
|
|
57
58
|
//#endregion
|
|
58
59
|
//#region src/composables/useFixedDropdown.ts
|
|
59
|
-
function
|
|
60
|
-
let r =
|
|
60
|
+
function A({ isOpen: e, onClose: t, align: n = "left" }) {
|
|
61
|
+
let r = d(null), i = d(null), a = d({
|
|
61
62
|
position: "fixed",
|
|
62
63
|
top: "0px",
|
|
63
64
|
left: "0px",
|
|
@@ -78,17 +79,17 @@ function k({ isOpen: e, onClose: t, align: n = "left" }) {
|
|
|
78
79
|
function c(e) {
|
|
79
80
|
e.key === "Escape" && t();
|
|
80
81
|
}
|
|
81
|
-
function
|
|
82
|
+
function l(e) {
|
|
82
83
|
let n = e.target;
|
|
83
84
|
n instanceof Node && i.value && i.value.contains(n) || t();
|
|
84
85
|
}
|
|
85
86
|
function p() {
|
|
86
|
-
document.addEventListener("mousedown", s), document.addEventListener("keydown", c), window.addEventListener("scroll",
|
|
87
|
+
document.addEventListener("mousedown", s), document.addEventListener("keydown", c), window.addEventListener("scroll", l, !0);
|
|
87
88
|
}
|
|
88
89
|
function m() {
|
|
89
|
-
document.removeEventListener("mousedown", s), document.removeEventListener("keydown", c), window.removeEventListener("scroll",
|
|
90
|
+
document.removeEventListener("mousedown", s), document.removeEventListener("keydown", c), window.removeEventListener("scroll", l, !0);
|
|
90
91
|
}
|
|
91
|
-
|
|
92
|
+
f(e, (e) => {
|
|
92
93
|
if (!e) {
|
|
93
94
|
m();
|
|
94
95
|
return;
|
|
@@ -103,7 +104,7 @@ function k({ isOpen: e, onClose: t, align: n = "left" }) {
|
|
|
103
104
|
o(a.bottom + 4, a.right - t.width);
|
|
104
105
|
} else o(a.bottom + 4, a.left);
|
|
105
106
|
}) : o(a.bottom + 4, a.left), p();
|
|
106
|
-
}),
|
|
107
|
+
}), u(m);
|
|
107
108
|
function h(e) {
|
|
108
109
|
e.preventDefault(), e.stopPropagation();
|
|
109
110
|
}
|
|
@@ -116,23 +117,23 @@ function k({ isOpen: e, onClose: t, align: n = "left" }) {
|
|
|
116
117
|
}
|
|
117
118
|
//#endregion
|
|
118
119
|
//#region src/composables/useHistory.ts
|
|
119
|
-
function
|
|
120
|
-
let n =
|
|
120
|
+
function j(e, t) {
|
|
121
|
+
let n = s(() => {
|
|
121
122
|
t.value;
|
|
122
123
|
let n = e.value;
|
|
123
|
-
return n ?
|
|
124
|
-
}), r =
|
|
124
|
+
return n ? g(n.state) > 0 : !1;
|
|
125
|
+
}), r = s(() => {
|
|
125
126
|
t.value;
|
|
126
127
|
let n = e.value;
|
|
127
|
-
return n ?
|
|
128
|
+
return n ? m(n.state) > 0 : !1;
|
|
128
129
|
});
|
|
129
130
|
function i() {
|
|
130
131
|
let t = e.value;
|
|
131
|
-
return t ?
|
|
132
|
+
return t ? h(t.state, t.dispatch) : !1;
|
|
132
133
|
}
|
|
133
134
|
function a() {
|
|
134
135
|
let t = e.value;
|
|
135
|
-
return t ?
|
|
136
|
+
return t ? p(t.state, t.dispatch) : !1;
|
|
136
137
|
}
|
|
137
138
|
return {
|
|
138
139
|
canUndo: n,
|
|
@@ -143,14 +144,14 @@ function A(e, t) {
|
|
|
143
144
|
}
|
|
144
145
|
//#endregion
|
|
145
146
|
//#region src/utils/selectionHighlight.ts
|
|
146
|
-
var
|
|
147
|
+
var M = {
|
|
147
148
|
backgroundColor: "rgba(26, 115, 232, 0.3)",
|
|
148
149
|
borderRadius: 0,
|
|
149
150
|
zIndex: 0,
|
|
150
151
|
opacity: 1,
|
|
151
152
|
mixBlendMode: "multiply"
|
|
152
153
|
};
|
|
153
|
-
function
|
|
154
|
+
function N(e) {
|
|
154
155
|
let t = window.getSelection();
|
|
155
156
|
if (!t || t.rangeCount === 0 || t.isCollapsed) return [];
|
|
156
157
|
let n = t.getRangeAt(0);
|
|
@@ -169,7 +170,7 @@ function M(e) {
|
|
|
169
170
|
});
|
|
170
171
|
return a;
|
|
171
172
|
}
|
|
172
|
-
function
|
|
173
|
+
function P(e, t = 2) {
|
|
173
174
|
if (e.length <= 1) return e;
|
|
174
175
|
let n = [...e].sort((e, n) => Math.abs(e.top - n.top) < t ? e.left - n.left : e.top - n.top), r = n[0];
|
|
175
176
|
if (!r) return e;
|
|
@@ -185,23 +186,23 @@ function N(e, t = 2) {
|
|
|
185
186
|
}
|
|
186
187
|
return i.push(a), i;
|
|
187
188
|
}
|
|
188
|
-
function
|
|
189
|
-
return N(
|
|
189
|
+
function F(e) {
|
|
190
|
+
return P(N(e));
|
|
190
191
|
}
|
|
191
|
-
function
|
|
192
|
+
function I() {
|
|
192
193
|
let e = window.getSelection();
|
|
193
194
|
return e !== null && !e.isCollapsed && e.rangeCount > 0;
|
|
194
195
|
}
|
|
195
|
-
function
|
|
196
|
+
function L(e) {
|
|
196
197
|
let t = window.getSelection();
|
|
197
198
|
return !t || t.rangeCount === 0 ? !1 : e.contains(t.getRangeAt(0).commonAncestorContainer);
|
|
198
199
|
}
|
|
199
|
-
var
|
|
200
|
-
function
|
|
201
|
-
|
|
200
|
+
var R = "docx-selection-styles", z = null;
|
|
201
|
+
function B() {
|
|
202
|
+
z &&= (z.remove(), null), document.getElementById(R)?.remove();
|
|
202
203
|
}
|
|
203
|
-
function
|
|
204
|
-
|
|
204
|
+
function V(e = M) {
|
|
205
|
+
B();
|
|
205
206
|
let t = `
|
|
206
207
|
/* DOCX Editor Selection Highlighting */
|
|
207
208
|
|
|
@@ -263,21 +264,21 @@ function B(e = j) {
|
|
|
263
264
|
border-bottom: 2px dashed rgba(156, 39, 176, 0.6);
|
|
264
265
|
}
|
|
265
266
|
`;
|
|
266
|
-
|
|
267
|
+
z = document.createElement("style"), z.id = R, z.textContent = t, document.head.appendChild(z);
|
|
267
268
|
}
|
|
268
|
-
function
|
|
269
|
-
return
|
|
269
|
+
function H() {
|
|
270
|
+
return z !== null || document.getElementById(R) !== null;
|
|
270
271
|
}
|
|
271
272
|
//#endregion
|
|
272
273
|
//#region src/composables/useSelectionHighlight.ts
|
|
273
|
-
function
|
|
274
|
+
function U() {
|
|
274
275
|
return window.getSelection()?.toString() ?? "";
|
|
275
276
|
}
|
|
276
|
-
function
|
|
277
|
-
let { containerRef: t, enabled: n = !0, config: r =
|
|
277
|
+
function W(e) {
|
|
278
|
+
let { containerRef: t, enabled: n = !0, config: r = M, useOverlay: i = !1, debounceMs: a = 16, onSelectionChange: o } = e, u = d(!1), p = d(""), m = d([]), h = d(!1), g = null, _ = 0;
|
|
278
279
|
function v() {
|
|
279
|
-
let e = t.value, n =
|
|
280
|
-
|
|
280
|
+
let e = t.value, n = I(), r = U(), a = e ? L(e) : !1;
|
|
281
|
+
u.value = n, p.value = r, h.value = a, m.value = i && a && e ? F(e) : [], o?.(n && a, r);
|
|
281
282
|
}
|
|
282
283
|
function y() {
|
|
283
284
|
v();
|
|
@@ -305,23 +306,23 @@ function U(e) {
|
|
|
305
306
|
};
|
|
306
307
|
return r.borderRadius && (t.borderRadius = `${r.borderRadius}px`), r.borderColor && (t.border = `1px solid ${r.borderColor}`), t;
|
|
307
308
|
}
|
|
308
|
-
return
|
|
309
|
-
n && (
|
|
310
|
-
}),
|
|
309
|
+
return l(() => {
|
|
310
|
+
n && (H() || V(r), document.addEventListener("selectionchange", b));
|
|
311
|
+
}), c(() => {
|
|
311
312
|
document.removeEventListener("selectionchange", b), g && clearTimeout(g);
|
|
312
|
-
}),
|
|
313
|
-
hasSelection:
|
|
314
|
-
selectedText:
|
|
315
|
-
highlightRects:
|
|
316
|
-
isSelectionInContainer:
|
|
313
|
+
}), f(t, () => v()), {
|
|
314
|
+
hasSelection: s(() => u.value),
|
|
315
|
+
selectedText: s(() => p.value),
|
|
316
|
+
highlightRects: s(() => m.value),
|
|
317
|
+
isSelectionInContainer: s(() => h.value),
|
|
317
318
|
refresh: y,
|
|
318
319
|
getOverlayStyle: x
|
|
319
320
|
};
|
|
320
321
|
}
|
|
321
322
|
//#endregion
|
|
322
323
|
//#region src/composables/useTableSelection.ts
|
|
323
|
-
function
|
|
324
|
-
let e = new
|
|
324
|
+
function G() {
|
|
325
|
+
let e = new S(), t = d(null), n = () => {
|
|
325
326
|
let n = e.getSnapshot();
|
|
326
327
|
t.value = n.tableIndex !== null && n.rowIndex !== null && n.columnIndex !== null ? {
|
|
327
328
|
tableIndex: n.tableIndex,
|
|
@@ -329,10 +330,21 @@ function W() {
|
|
|
329
330
|
columnIndex: n.columnIndex
|
|
330
331
|
} : null;
|
|
331
332
|
}, r = e.subscribe(n);
|
|
332
|
-
n(),
|
|
333
|
-
function i(
|
|
333
|
+
n(), u(r);
|
|
334
|
+
function i(t, n, r) {
|
|
335
|
+
e.selectCellCoordinates({
|
|
336
|
+
tableIndex: t,
|
|
337
|
+
rowIndex: n,
|
|
338
|
+
columnIndex: r
|
|
339
|
+
});
|
|
340
|
+
}
|
|
334
341
|
function a(t, n) {
|
|
335
|
-
|
|
342
|
+
let r = C(t, n);
|
|
343
|
+
if (!r) {
|
|
344
|
+
e.clearSelection();
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
e.selectCellCoordinates(r);
|
|
336
348
|
}
|
|
337
349
|
function o() {
|
|
338
350
|
e.clearSelection();
|
|
@@ -350,21 +362,21 @@ function W() {
|
|
|
350
362
|
}
|
|
351
363
|
//#endregion
|
|
352
364
|
//#region src/composables/useVisualLineNavigation.ts
|
|
353
|
-
function
|
|
354
|
-
let t =
|
|
365
|
+
function K(e) {
|
|
366
|
+
let t = w();
|
|
355
367
|
function n(t) {
|
|
356
368
|
let n = e.value;
|
|
357
|
-
return n ?
|
|
369
|
+
return n ? D(n, t) : null;
|
|
358
370
|
}
|
|
359
371
|
function r(t) {
|
|
360
372
|
let n = e.value;
|
|
361
|
-
return n ?
|
|
373
|
+
return n ? T(n, t) : null;
|
|
362
374
|
}
|
|
363
375
|
function i(e, t) {
|
|
364
|
-
return
|
|
376
|
+
return E(e, t);
|
|
365
377
|
}
|
|
366
378
|
function a(n, r) {
|
|
367
|
-
return
|
|
379
|
+
return O(t, n, r, e.value);
|
|
368
380
|
}
|
|
369
381
|
return {
|
|
370
382
|
state: t,
|
|
@@ -375,4 +387,4 @@ function G(e) {
|
|
|
375
387
|
};
|
|
376
388
|
}
|
|
377
389
|
//#endregion
|
|
378
|
-
export {
|
|
390
|
+
export { b as createSelectionFromDOM, r as extractTrackedChanges, x as getSelectionRuns, y as runsToClipboardContent, k as useClipboard, i as useDocxEditor, t as useDragAutoScroll, e as useFindReplace, A as useFixedDropdown, j as useHistory, W as useSelectionHighlight, n as useTableResize, G as useTableSelection, a as useTrackedChanges, K as useVisualLineNavigation, o as useWheelZoom, o as useZoom };
|
package/dist/dialogs.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./WatermarkDialog-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./WatermarkDialog-ChJtT7Bs.cjs");var t=e.m,n=e.l,r=e.p,i=e.c,a=e.f,o=e.s,s=e.d,c=e.a,l=e.u,u=e.i,d=e.r,f=e.n,p=e.t;exports.FindReplaceDialog=t,exports.FootnotePropertiesDialog=n,exports.HyperlinkDialog=r,exports.ImagePositionDialog=i,exports.ImagePropertiesDialog=a,exports.InsertImageDialog=o,exports.InsertSymbolDialog=s,exports.InsertTableDialog=c,exports.PageSetupDialog=l,exports.PasteSpecialDialog=u,exports.SplitCellDialog=d,exports.TablePropertiesDialog=f,exports.WatermarkDialog=p;
|
package/dist/dialogs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, c as t, d as n, f as r, i, l as a, m as o, n as s, p as c, r as l, s as u, t as d, u as f } from "./WatermarkDialog-
|
|
1
|
+
import { a as e, c as t, d as n, f as r, i, l as a, m as o, n as s, p as c, r as l, s as u, t as d, u as f } from "./WatermarkDialog-Cf9ISDvv.js";
|
|
2
2
|
//#region src/components/dialogs/index.ts
|
|
3
3
|
var p = o, m = a, h = c, g = t, _ = r, v = u, y = n, b = e, x = f, S = i, C = l, w = s, T = d;
|
|
4
4
|
//#endregion
|