@stll/folio-vue 0.25.0 → 0.26.1
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/SplitCellDialog-DfMw2Ev2.cjs +15 -0
- package/dist/{SplitCellDialog-CSqbtDum.js → SplitCellDialog-bNeugz_3.js} +1737 -1757
- package/dist/{ListButtons-BeELtp_-.js → StylePicker-DfIQUq6G.js} +1158 -1164
- package/dist/StylePicker-ynX3GzFu.cjs +4 -0
- package/dist/components/DocxEditor/DocxEditorDialogs.vue.d.ts +4 -10
- package/dist/components/DocxEditor/pagedEditorRef.d.ts +1 -1
- package/dist/components/DocxEditor/types.d.ts +18 -9
- package/dist/components/DocxEditor.vue.d.ts +7 -4
- package/dist/components/InlineHeaderFooterEditor.vue.d.ts +2 -2
- package/dist/components/OutlineToggleButton.vue.d.ts +21 -0
- package/dist/components/ReviewControls.vue.d.ts +2 -2
- package/dist/components/Toolbar.vue.d.ts +9 -9
- package/dist/components/UnifiedSidebar.vue.d.ts +2 -2
- package/dist/components/dialogs/FindReplaceDialog.vue.d.ts +3 -11
- package/dist/components/dialogs/FootnotePropertiesDialog.vue.d.ts +2 -2
- package/dist/components/dialogs/HyperlinkDialog.vue.d.ts +2 -2
- package/dist/components/dialogs/ImagePositionDialog.vue.d.ts +2 -2
- package/dist/components/dialogs/PageSetupDialog.vue.d.ts +2 -2
- package/dist/components/dialogs/SetNumberingValueDialog.vue.d.ts +2 -2
- package/dist/components/dialogs/TablePropertiesDialog.vue.d.ts +2 -2
- package/dist/components/dialogs/WatermarkDialog.vue.d.ts +2 -2
- package/dist/components/sidebar/CommentCard.vue.d.ts +2 -2
- package/dist/components/sidebar/TrackedChangeCard.vue.d.ts +2 -2
- package/dist/components/sidebar/cardStyles.d.ts +1 -1
- package/dist/components/tableStylePresets.d.ts +1 -1
- package/dist/components/ui/Button.vue.d.ts +1 -1
- package/dist/components/ui/FontSizePicker.vue.d.ts +1 -1
- package/dist/components/ui/HorizontalRuler.vue.d.ts +2 -2
- package/dist/components/ui/HyperlinkPopup.vue.d.ts +4 -4
- package/dist/components/ui/Input.vue.d.ts +1 -1
- package/dist/components/ui/ListButtons.vue.d.ts +1 -1
- package/dist/components/ui/OutlineRail.vue.d.ts +1 -1
- package/dist/components/ui/TableMoreDropdown.vue.d.ts +1 -1
- package/dist/components/ui/TableToolbar.vue.d.ts +1 -1
- package/dist/components/ui/VerticalRuler.vue.d.ts +2 -2
- package/dist/components/ui/icon-paths.json.d.ts +18 -6
- package/dist/composables/useAutoSave.d.ts +1 -1
- package/dist/composables/useClipboard.d.ts +2 -2
- package/dist/composables/useCommentLifecycle.d.ts +1 -1
- package/dist/composables/useCommentManagement.d.ts +1 -1
- package/dist/composables/useContextMenus.d.ts +2 -2
- package/dist/composables/useDocxEditor.d.ts +4 -4
- package/dist/composables/useDocxEditorRefApi.d.ts +6 -4
- package/dist/composables/useFindReplace.d.ts +36 -18
- package/dist/composables/useFixedDropdown.d.ts +1 -1
- package/dist/composables/useFormattingActions.d.ts +1 -1
- package/dist/composables/useHistory.d.ts +1 -1
- package/dist/composables/useHyperlinkManagement.d.ts +1 -1
- package/dist/composables/useImageActions.d.ts +1 -1
- package/dist/composables/useOutlineSidebar.d.ts +1 -1
- package/dist/composables/usePageSetupControls.d.ts +1 -1
- package/dist/composables/usePagesPointer.d.ts +3 -3
- package/dist/composables/useParagraphStyleOptions.d.ts +1 -1
- package/dist/composables/useSelectionHighlight.d.ts +1 -1
- package/dist/composables/useSelectionSync.d.ts +1 -1
- package/dist/composables/useToolbarDropdowns.d.ts +1 -1
- package/dist/composables/useToolbarFontSize.d.ts +1 -1
- package/dist/composables/useTrackedChanges.d.ts +1 -1
- package/dist/composables/useVisualLineNavigation.d.ts +1 -1
- package/dist/composables/useZoom.d.ts +1 -1
- package/dist/composables.cjs +2 -2
- package/dist/composables.js +65 -72
- package/dist/dialogs.cjs +1 -1
- package/dist/dialogs.js +1 -2
- package/dist/folio-vue.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +4816 -4831
- package/dist/messages/ar.cjs +1 -1
- package/dist/messages/ar.js +1 -2
- package/dist/messages/cs.cjs +1 -1
- package/dist/messages/cs.js +1 -2
- package/dist/messages/de.cjs +1 -1
- package/dist/messages/de.js +1 -2
- package/dist/messages/en.cjs +1 -1
- package/dist/messages/en.js +1 -2
- package/dist/messages/es.cjs +1 -1
- package/dist/messages/es.js +1 -2
- package/dist/messages/et.cjs +1 -1
- package/dist/messages/et.js +1 -2
- package/dist/messages/fr.cjs +1 -1
- package/dist/messages/fr.js +1 -2
- package/dist/messages/he.cjs +1 -1
- package/dist/messages/he.js +1 -2
- package/dist/messages/hi.cjs +1 -1
- package/dist/messages/hi.js +1 -2
- package/dist/messages/hu.cjs +1 -1
- package/dist/messages/hu.js +1 -2
- package/dist/messages/locales.js +1 -2
- package/dist/messages/lt.cjs +1 -1
- package/dist/messages/lt.js +1 -2
- package/dist/messages/lv.cjs +1 -1
- package/dist/messages/lv.js +1 -2
- package/dist/messages/pl.cjs +1 -1
- package/dist/messages/pl.js +1 -2
- package/dist/messages/pt-BR.cjs +1 -1
- package/dist/messages/pt-BR.js +1 -2
- package/dist/messages/sk.cjs +1 -1
- package/dist/messages/sk.js +1 -2
- package/dist/messages/tr.cjs +1 -1
- package/dist/messages/tr.js +1 -2
- package/dist/messages/zh-CN.cjs +1 -1
- package/dist/messages/zh-CN.js +1 -2
- package/dist/{rolldown-runtime-C6qsp3rV.cjs → rolldown-runtime-CYJQrBu7.cjs} +1 -1
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +21 -27
- package/dist/useZoom-Bwnae1jX.cjs +1 -0
- package/dist/useZoom-CX0mrPQY.js +996 -0
- package/dist/utils/viewportPosition.d.ts +1 -1
- package/package.json +13 -13
- package/dist/ListButtons-B8HxA64I.cjs +0 -4
- package/dist/SplitCellDialog-DzKBu09z.cjs +0 -15
- package/dist/useFindReplace-BbW0xWo7.js +0 -74
- package/dist/useFindReplace-neQmDh2i.cjs +0 -1
- package/dist/useZoom-B1miNAf_.cjs +0 -1
- package/dist/useZoom-Bw5gp69V.js +0 -887
package/dist/composables.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./useZoom-Bwnae1jX.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,
|
|
@@ -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
|
-
`;b=document.createElement(`style`),b.id=y,b.textContent=t,document.head.appendChild(b)}function C(){return b!==null||document.getElementById(y)!==null}function w(){return window.getSelection()?.toString()??``}function T(e){let{containerRef:
|
|
61
|
+
`;b=document.createElement(`style`),b.id=y,b.textContent=t,document.head.appendChild(b)}function C(){return b!==null||document.getElementById(y)!==null}function w(){return window.getSelection()?.toString()??``}function T(e){let{containerRef:n,enabled:r=!0,config:i=p,useOverlay:a=!1,debounceMs:o=16,onSelectionChange:s}=e,c=(0,t.ref)(!1),l=(0,t.ref)(``),u=(0,t.ref)([]),d=(0,t.ref)(!1),f=null,m=0;function h(){let e=n.value,t=_(),r=w(),i=e?v(e):!1;c.value=t,l.value=r,d.value=i,u.value=a&&i&&e?g(e):[],s?.(t&&i,r)}function y(){h()}function b(){let e=performance.now();e-m<o?(f&&clearTimeout(f),f=setTimeout(()=>{m=performance.now(),h(),f=null},o)):(m=e,h())}function x(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,t.onMounted)(()=>{r&&(C()||S(i),document.addEventListener(`selectionchange`,b))}),(0,t.onBeforeUnmount)(()=>{document.removeEventListener(`selectionchange`,b),f&&clearTimeout(f)}),(0,t.watch)(n,()=>h()),{hasSelection:(0,t.computed)(()=>c.value),selectedText:(0,t.computed)(()=>l.value),highlightRects:(0,t.computed)(()=>u.value),isSelectionInContainer:(0,t.computed)(()=>d.value),refresh:y,getOverlayStyle:x}}function E(){let e=new s.TableSelectionManager,n=(0,t.ref)(null),r=()=>{let t=e.getSnapshot();n.value=t.tableIndex!==null&&t.rowIndex!==null&&t.columnIndex!==null?{tableIndex:t.tableIndex,rowIndex:t.rowIndex,columnIndex:t.columnIndex}:null},i=e.subscribe(r);r(),(0,t.onScopeDispose)(i);function a(t,n,r){e.selectCellCoordinates({tableIndex:t,rowIndex:n,columnIndex:r})}function o(t,n){let r=(0,s.findTableFromClick)(t,n);r?e.selectCellCoordinates(r):e.clearSelection()}function c(){e.clearSelection()}function l(t,n,r){return e.isCellSelected(t,n,r)}return{selectedCell:n,handleCellClick:a,handleClickTarget:o,clearSelection:c,isCellSelected:l}}function D(e){let t=(0,c.createVisualLineState)();function n(t){let n=e.value;return n?(0,c.getCaretClientX)(n,t):null}function r(t){let n=e.value;return n?(0,c.findLineElementAtPosition)(n,t):null}function i(e,t){return(0,c.findPositionOnLineAtClientX)(e,t)}function a(n,r){return(0,c.handleVisualLineKeyDown)(t,n,r,e.value)}return{state:t,getCaretClientX:n,findLineElementAtPosition:r,findPositionOnLineAtClientX:i,handlePMKeyDown:a}}exports.colorModePlugin=e.s,Object.defineProperty(exports,"createSelectionFromDOM",{enumerable:!0,get:function(){return a.createSelectionFromDOM}}),exports.defaultColorMode=e.c,Object.defineProperty(exports,"extractTrackedChanges",{enumerable:!0,get:function(){return l.extractTrackedChanges}}),Object.defineProperty(exports,"getSelectionRuns",{enumerable:!0,get:function(){return a.getSelectionRuns}}),exports.provideColorMode=e.l,Object.defineProperty(exports,"runsToClipboardContent",{enumerable:!0,get:function(){return o.runsToClipboardContent}}),exports.useClipboard=u,exports.useColorMode=e.u,exports.useDocxEditor=e.o,exports.useDragAutoScroll=e.i,exports.useFindReplace=e.a,exports.useFixedDropdown=d,exports.useHistory=f,exports.useSelectionHighlight=T,exports.useTableResize=e.r,exports.useTableSelection=E,exports.useTrackedChanges=e.n,exports.useVisualLineNavigation=D,exports.useWheelZoom=e.t,exports.useZoom=e.t;
|
package/dist/composables.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as t, c as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "./useZoom-Bw5gp69V.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-CX0mrPQY.js";
|
|
3
2
|
import { computed as d, onBeforeUnmount as f, onMounted as p, onScopeDispose as m, ref as h, watch as g } from "vue";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { createSelectionFromDOM as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
3
|
+
import { readBlobText as _ } from "@stll/folio-core/utils/textEncoding";
|
|
4
|
+
import { redo as v, redoDepth as y, undo as b, undoDepth as x } from "prosemirror-history";
|
|
5
|
+
import { onDocumentPointerDown as S } from "@stll/folio-core/utils/documentPointerDown";
|
|
6
|
+
import { createSelectionFromDOM as C, getSelectionRuns as w } from "@stll/folio-core/managers/ClipboardManager";
|
|
7
|
+
import { copyRuns as T, parseClipboardHtml as E, runsToClipboardContent as D } from "@stll/folio-core/utils/clipboard";
|
|
8
|
+
import { TableSelectionManager as O, findTableFromClick as k } from "@stll/folio-core/managers/TableSelectionManager";
|
|
9
|
+
import { createVisualLineState as A, findLineElementAtPosition as j, findPositionOnLineAtClientX as M, getCaretClientX as N, handleVisualLineKeyDown as P } from "@stll/folio-core/prosemirror/utils/visualLineNavigation";
|
|
10
10
|
//#region src/composables/useClipboard.ts
|
|
11
|
-
function
|
|
11
|
+
function F(e = {}) {
|
|
12
12
|
let { onCopy: t, onCut: n, onPaste: r, cleanWordFormatting: i = !0, editable: a = !0, onError: o } = e, s = h(!1), c = h(null), l = o ? { onError: o } : {};
|
|
13
13
|
async function u(e) {
|
|
14
14
|
if (s.value) return !1;
|
|
15
15
|
s.value = !0;
|
|
16
16
|
try {
|
|
17
|
-
let n = await
|
|
17
|
+
let n = await T(e.runs, l);
|
|
18
18
|
return n && t?.(e), n;
|
|
19
19
|
} finally {
|
|
20
20
|
s.value = !1;
|
|
@@ -24,7 +24,7 @@ function P(e = {}) {
|
|
|
24
24
|
if (s.value || !a) return !1;
|
|
25
25
|
s.value = !0;
|
|
26
26
|
try {
|
|
27
|
-
let t = await
|
|
27
|
+
let t = await T(e.runs, l);
|
|
28
28
|
return t && n?.(e), t;
|
|
29
29
|
} finally {
|
|
30
30
|
s.value = !1;
|
|
@@ -36,9 +36,9 @@ function P(e = {}) {
|
|
|
36
36
|
try {
|
|
37
37
|
if (navigator.clipboard && navigator.clipboard.read) {
|
|
38
38
|
let t = await navigator.clipboard.read(), n = "", a = "";
|
|
39
|
-
for (let e of t) e.types.includes("text/html") && (n = await
|
|
39
|
+
for (let e of t) e.types.includes("text/html") && (n = await _(await e.getType("text/html"))), e.types.includes("text/plain") && (a = await _(await e.getType("text/plain")));
|
|
40
40
|
e && (n = "");
|
|
41
|
-
let o =
|
|
41
|
+
let o = E(n, a, i);
|
|
42
42
|
return c.value = o, r?.(o, e), o;
|
|
43
43
|
}
|
|
44
44
|
return null;
|
|
@@ -58,7 +58,7 @@ function P(e = {}) {
|
|
|
58
58
|
}
|
|
59
59
|
//#endregion
|
|
60
60
|
//#region src/composables/useFixedDropdown.ts
|
|
61
|
-
function
|
|
61
|
+
function I({ isOpen: e, onClose: t, align: n = "left" }) {
|
|
62
62
|
let r = h(null), i = h(null), a = h({
|
|
63
63
|
position: "fixed",
|
|
64
64
|
top: "0px",
|
|
@@ -84,15 +84,16 @@ function F({ isOpen: e, onClose: t, align: n = "left" }) {
|
|
|
84
84
|
let n = e.target;
|
|
85
85
|
n instanceof Node && i.value && i.value.contains(n) || t();
|
|
86
86
|
}
|
|
87
|
-
|
|
88
|
-
document.addEventListener("mousedown", s), document.addEventListener("keydown", c), window.addEventListener("scroll", l, !0);
|
|
89
|
-
}
|
|
87
|
+
let u;
|
|
90
88
|
function d() {
|
|
91
|
-
document
|
|
89
|
+
u = S(document, s), document.addEventListener("keydown", c), window.addEventListener("scroll", l, !0);
|
|
90
|
+
}
|
|
91
|
+
function f() {
|
|
92
|
+
u?.(), u = void 0, document.removeEventListener("keydown", c), window.removeEventListener("scroll", l, !0);
|
|
92
93
|
}
|
|
93
94
|
g(e, (e) => {
|
|
94
95
|
if (!e) {
|
|
95
|
-
|
|
96
|
+
f();
|
|
96
97
|
return;
|
|
97
98
|
}
|
|
98
99
|
let t = r.value;
|
|
@@ -104,37 +105,37 @@ function F({ isOpen: e, onClose: t, align: n = "left" }) {
|
|
|
104
105
|
let t = e.getBoundingClientRect();
|
|
105
106
|
o(a.bottom + 4, a.right - t.width);
|
|
106
107
|
} else o(a.bottom + 4, a.left);
|
|
107
|
-
}) : o(a.bottom + 4, a.left),
|
|
108
|
-
}), m(
|
|
109
|
-
function
|
|
108
|
+
}) : o(a.bottom + 4, a.left), d();
|
|
109
|
+
}), m(f);
|
|
110
|
+
function p(e) {
|
|
110
111
|
e.preventDefault(), e.stopPropagation();
|
|
111
112
|
}
|
|
112
113
|
return {
|
|
113
114
|
containerRef: r,
|
|
114
115
|
dropdownRef: i,
|
|
115
116
|
dropdownStyle: a,
|
|
116
|
-
handleMouseDown:
|
|
117
|
+
handleMouseDown: p
|
|
117
118
|
};
|
|
118
119
|
}
|
|
119
120
|
//#endregion
|
|
120
121
|
//#region src/composables/useHistory.ts
|
|
121
|
-
function
|
|
122
|
+
function L(e, t) {
|
|
122
123
|
let n = d(() => {
|
|
123
124
|
t.value;
|
|
124
125
|
let n = e.value;
|
|
125
|
-
return n ?
|
|
126
|
+
return n ? x(n.state) > 0 : !1;
|
|
126
127
|
}), r = d(() => {
|
|
127
128
|
t.value;
|
|
128
129
|
let n = e.value;
|
|
129
|
-
return n ?
|
|
130
|
+
return n ? y(n.state) > 0 : !1;
|
|
130
131
|
});
|
|
131
132
|
function i() {
|
|
132
133
|
let t = e.value;
|
|
133
|
-
return t ?
|
|
134
|
+
return t ? b(t.state, t.dispatch) : !1;
|
|
134
135
|
}
|
|
135
136
|
function a() {
|
|
136
137
|
let t = e.value;
|
|
137
|
-
return t ?
|
|
138
|
+
return t ? v(t.state, t.dispatch) : !1;
|
|
138
139
|
}
|
|
139
140
|
return {
|
|
140
141
|
canUndo: n,
|
|
@@ -145,14 +146,14 @@ function I(e, t) {
|
|
|
145
146
|
}
|
|
146
147
|
//#endregion
|
|
147
148
|
//#region src/utils/selectionHighlight.ts
|
|
148
|
-
var
|
|
149
|
+
var R = {
|
|
149
150
|
backgroundColor: "rgba(26, 115, 232, 0.3)",
|
|
150
151
|
borderRadius: 0,
|
|
151
152
|
zIndex: 0,
|
|
152
153
|
opacity: 1,
|
|
153
154
|
mixBlendMode: "multiply"
|
|
154
155
|
};
|
|
155
|
-
function
|
|
156
|
+
function z(e) {
|
|
156
157
|
let t = window.getSelection();
|
|
157
158
|
if (!t || t.rangeCount === 0 || t.isCollapsed) return [];
|
|
158
159
|
let n = t.getRangeAt(0);
|
|
@@ -163,7 +164,7 @@ function R(e) {
|
|
|
163
164
|
r = t.left + e.scrollLeft, i = t.top + e.scrollTop;
|
|
164
165
|
}
|
|
165
166
|
let a = [];
|
|
166
|
-
for (let e of n.getClientRects()) e.width
|
|
167
|
+
for (let e of n.getClientRects()) (e.width !== 0 || e.height !== 0) && a.push({
|
|
167
168
|
left: e.left - r,
|
|
168
169
|
top: e.top - i,
|
|
169
170
|
width: e.width,
|
|
@@ -171,7 +172,7 @@ function R(e) {
|
|
|
171
172
|
});
|
|
172
173
|
return a;
|
|
173
174
|
}
|
|
174
|
-
function
|
|
175
|
+
function B(e, t = 2) {
|
|
175
176
|
if (e.length <= 1) return e;
|
|
176
177
|
let n = [...e].sort((e, n) => Math.abs(e.top - n.top) < t ? e.left - n.left : e.top - n.top), r = n[0];
|
|
177
178
|
if (!r) return e;
|
|
@@ -187,23 +188,23 @@ function z(e, t = 2) {
|
|
|
187
188
|
}
|
|
188
189
|
return i.push(a), i;
|
|
189
190
|
}
|
|
190
|
-
function
|
|
191
|
-
return z(
|
|
191
|
+
function V(e) {
|
|
192
|
+
return B(z(e));
|
|
192
193
|
}
|
|
193
|
-
function
|
|
194
|
+
function H() {
|
|
194
195
|
let e = window.getSelection();
|
|
195
196
|
return e !== null && !e.isCollapsed && e.rangeCount > 0;
|
|
196
197
|
}
|
|
197
|
-
function
|
|
198
|
+
function U(e) {
|
|
198
199
|
let t = window.getSelection();
|
|
199
200
|
return !t || t.rangeCount === 0 ? !1 : e.contains(t.getRangeAt(0).commonAncestorContainer);
|
|
200
201
|
}
|
|
201
|
-
var
|
|
202
|
-
function
|
|
203
|
-
|
|
202
|
+
var W = "docx-selection-styles", G = null;
|
|
203
|
+
function K() {
|
|
204
|
+
G &&= (G.remove(), null), document.getElementById(W)?.remove();
|
|
204
205
|
}
|
|
205
|
-
function
|
|
206
|
-
|
|
206
|
+
function q(e = R) {
|
|
207
|
+
K();
|
|
207
208
|
let t = `
|
|
208
209
|
/* DOCX Editor Selection Highlighting */
|
|
209
210
|
|
|
@@ -265,34 +266,30 @@ function K(e = L) {
|
|
|
265
266
|
border-bottom: 2px dashed rgba(156, 39, 176, 0.6);
|
|
266
267
|
}
|
|
267
268
|
`;
|
|
268
|
-
|
|
269
|
+
G = document.createElement("style"), G.id = W, G.textContent = t, document.head.appendChild(G);
|
|
269
270
|
}
|
|
270
|
-
function
|
|
271
|
-
return
|
|
271
|
+
function J() {
|
|
272
|
+
return G !== null || document.getElementById(W) !== null;
|
|
272
273
|
}
|
|
273
274
|
//#endregion
|
|
274
275
|
//#region src/composables/useSelectionHighlight.ts
|
|
275
|
-
function
|
|
276
|
+
function Y() {
|
|
276
277
|
return window.getSelection()?.toString() ?? "";
|
|
277
278
|
}
|
|
278
|
-
function
|
|
279
|
-
let { containerRef: t, enabled: n = !0, config: r =
|
|
279
|
+
function X(e) {
|
|
280
|
+
let { containerRef: t, enabled: n = !0, config: r = R, useOverlay: i = !1, debounceMs: a = 16, onSelectionChange: o } = e, s = h(!1), c = h(""), l = h([]), u = h(!1), m = null, _ = 0;
|
|
280
281
|
function v() {
|
|
281
|
-
let e = t.value, n =
|
|
282
|
-
s.value = n, c.value = r, u.value = a, l.value = i && a && e ?
|
|
282
|
+
let e = t.value, n = H(), r = Y(), a = e ? U(e) : !1;
|
|
283
|
+
s.value = n, c.value = r, u.value = a, l.value = i && a && e ? V(e) : [], o?.(n && a, r);
|
|
283
284
|
}
|
|
284
285
|
function y() {
|
|
285
286
|
v();
|
|
286
287
|
}
|
|
287
288
|
function b() {
|
|
288
289
|
let e = performance.now();
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}, a);
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
_ = e, v();
|
|
290
|
+
e - _ < a ? (m && clearTimeout(m), m = setTimeout(() => {
|
|
291
|
+
_ = performance.now(), v(), m = null;
|
|
292
|
+
}, a)) : (_ = e, v());
|
|
296
293
|
}
|
|
297
294
|
function x(e) {
|
|
298
295
|
let t = {
|
|
@@ -308,7 +305,7 @@ function Y(e) {
|
|
|
308
305
|
return r.borderRadius && (t.borderRadius = `${r.borderRadius}px`), r.borderColor && (t.border = `1px solid ${r.borderColor}`), t;
|
|
309
306
|
}
|
|
310
307
|
return p(() => {
|
|
311
|
-
n && (
|
|
308
|
+
n && (J() || q(r), document.addEventListener("selectionchange", b));
|
|
312
309
|
}), f(() => {
|
|
313
310
|
document.removeEventListener("selectionchange", b), m && clearTimeout(m);
|
|
314
311
|
}), g(t, () => v()), {
|
|
@@ -322,8 +319,8 @@ function Y(e) {
|
|
|
322
319
|
}
|
|
323
320
|
//#endregion
|
|
324
321
|
//#region src/composables/useTableSelection.ts
|
|
325
|
-
function
|
|
326
|
-
let e = new
|
|
322
|
+
function Z() {
|
|
323
|
+
let e = new O(), t = h(null), n = () => {
|
|
327
324
|
let n = e.getSnapshot();
|
|
328
325
|
t.value = n.tableIndex !== null && n.rowIndex !== null && n.columnIndex !== null ? {
|
|
329
326
|
tableIndex: n.tableIndex,
|
|
@@ -340,12 +337,8 @@ function X() {
|
|
|
340
337
|
});
|
|
341
338
|
}
|
|
342
339
|
function a(t, n) {
|
|
343
|
-
let r =
|
|
344
|
-
|
|
345
|
-
e.clearSelection();
|
|
346
|
-
return;
|
|
347
|
-
}
|
|
348
|
-
e.selectCellCoordinates(r);
|
|
340
|
+
let r = k(t, n);
|
|
341
|
+
r ? e.selectCellCoordinates(r) : e.clearSelection();
|
|
349
342
|
}
|
|
350
343
|
function o() {
|
|
351
344
|
e.clearSelection();
|
|
@@ -363,21 +356,21 @@ function X() {
|
|
|
363
356
|
}
|
|
364
357
|
//#endregion
|
|
365
358
|
//#region src/composables/useVisualLineNavigation.ts
|
|
366
|
-
function
|
|
367
|
-
let t =
|
|
359
|
+
function Q(e) {
|
|
360
|
+
let t = A();
|
|
368
361
|
function n(t) {
|
|
369
362
|
let n = e.value;
|
|
370
|
-
return n ?
|
|
363
|
+
return n ? N(n, t) : null;
|
|
371
364
|
}
|
|
372
365
|
function r(t) {
|
|
373
366
|
let n = e.value;
|
|
374
|
-
return n ?
|
|
367
|
+
return n ? j(n, t) : null;
|
|
375
368
|
}
|
|
376
369
|
function i(e, t) {
|
|
377
|
-
return
|
|
370
|
+
return M(e, t);
|
|
378
371
|
}
|
|
379
372
|
function a(n, r) {
|
|
380
|
-
return
|
|
373
|
+
return P(t, n, r, e.value);
|
|
381
374
|
}
|
|
382
375
|
return {
|
|
383
376
|
state: t,
|
|
@@ -388,4 +381,4 @@ function Z(e) {
|
|
|
388
381
|
};
|
|
389
382
|
}
|
|
390
383
|
//#endregion
|
|
391
|
-
export {
|
|
384
|
+
export { t as colorModePlugin, C as createSelectionFromDOM, i as defaultColorMode, a as extractTrackedChanges, w as getSelectionRuns, u as provideColorMode, D as runsToClipboardContent, F as useClipboard, n as useColorMode, c as useDocxEditor, e as useDragAutoScroll, o as useFindReplace, I as useFixedDropdown, L as useHistory, X as useSelectionHighlight, r as useTableResize, Z as useTableSelection, s as useTrackedChanges, Q as useVisualLineNavigation, l as useWheelZoom, l as useZoom };
|
package/dist/dialogs.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./SplitCellDialog-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./SplitCellDialog-DfMw2Ev2.cjs");exports.FindReplaceDialog=e.m,exports.FootnotePropertiesDialog=e.s,exports.HyperlinkDialog=e.p,exports.ImagePositionDialog=e.o,exports.ImagePropertiesDialog=e.f,exports.InsertImageDialog=e.a,exports.InsertSymbolDialog=e.d,exports.InsertTableDialog=e.r,exports.PageSetupDialog=e.u,exports.PasteSpecialDialog=e.n,exports.SplitCellDialog=e.t,exports.TablePropertiesDialog=e.l,exports.WatermarkDialog=e.c;
|
package/dist/dialogs.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { a as FindReplaceDialog, u as FootnotePropertiesDialog, c as HyperlinkDialog, s as ImagePositionDialog, r as ImagePropertiesDialog, e as InsertImageDialog, n as InsertSymbolDialog, l as InsertTableDialog, f as PageSetupDialog, o as PasteSpecialDialog, d as SplitCellDialog, i as TablePropertiesDialog, t as WatermarkDialog };
|
|
1
|
+
export { m as FindReplaceDialog, s as FootnotePropertiesDialog, p as HyperlinkDialog, o as ImagePositionDialog, f as ImagePropertiesDialog, a as InsertImageDialog, d as InsertSymbolDialog, r as InsertTableDialog, u as PageSetupDialog, n as PasteSpecialDialog, t as SplitCellDialog, l as TablePropertiesDialog, c as WatermarkDialog } from "./SplitCellDialog-bNeugz_3.js";
|