@eigenpal/docx-editor-vue 1.2.1 → 1.3.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/{KeyboardShortcutsDialog-5ZsgieYf.js → KeyboardShortcutsDialog-00eb4Ova.js} +23 -0
- package/dist/KeyboardShortcutsDialog-EW9K4wuO.cjs +1 -0
- package/dist/MenuBar-DeogoqFP.js +3330 -0
- package/dist/MenuBar-bU4-4dnA.cjs +4 -0
- package/dist/{TablePropertiesDialog-DTCcLpPC.cjs → TablePropertiesDialog-BZLpFAkg.cjs} +1 -1
- package/dist/{TablePropertiesDialog-PR4ftalH.js → TablePropertiesDialog-CBTvM4Xy.js} +1 -1
- package/dist/composables/useCommentLifecycle.d.ts +3 -0
- package/dist/composables/useCommentManagement.d.ts +6 -0
- package/dist/composables/useFormattingActions.d.ts +2 -22
- package/dist/composables/useMenuActions.d.ts +1 -0
- package/dist/composables/useSelectionSync.d.ts +16 -0
- package/dist/composables/useWatermarkControls.d.ts +15 -0
- package/dist/composables.cjs +1 -1
- package/dist/composables.js +124 -209
- 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 +1373 -1210
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +3 -3
- package/dist/useCommentSidebarItems-BHomCzpj.js +44 -0
- package/dist/useCommentSidebarItems-CbNvNCd3.cjs +1 -0
- package/dist/useDragAutoScroll-BT6oPYBj.cjs +1 -0
- package/dist/useDragAutoScroll-C56F_WS_.js +493 -0
- package/dist/utils/domQueries.d.ts +17 -6
- package/dist/utils/refApiQueries.d.ts +8 -44
- package/package.json +4 -4
- package/dist/KeyboardShortcutsDialog-DiG-tfJT.cjs +0 -1
- package/dist/MenuBar-DLXxthZk.js +0 -3365
- package/dist/MenuBar-De3YJFpj.cjs +0 -4
- package/dist/useTableResize-BcBdSaOE.js +0 -583
- package/dist/useTableResize-DTag4SY0.cjs +0 -1
- package/dist/utils/commentFactories.d.ts +0 -7
- package/dist/utils/paraTextHelpers.d.ts +0 -29
package/dist/composables.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./useTableResize-DTag4SY0.cjs`);let t=require(`vue`),n=require(`prosemirror-history`),r=require(`@eigenpal/docx-editor-core/utils`),i=require(`@eigenpal/docx-editor-core/prosemirror/utils/extractTrackedChanges`),a=require(`@eigenpal/docx-editor-core`),o=require(`@eigenpal/docx-editor-core/utils/findVerticalScrollParent`),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,n={}){let r=(0,t.ref)(`idle`),i=(0,t.ref)(null),o=(0,t.ref)(!1),s=(0,t.ref)(!0),{storageKey:c,interval:l,enabled:u=!0,maxAge:d,onSave:f,onError:p,onRecoveryAvailable:m,saveOnChange:h,debounceDelay:g}=n;if(!(0,a.isAutoSaveSupported)())return{status:r,lastSaveTime:i,hasRecoveryData:o,isEnabled:s,save:async()=>!1,clearAutoSave:()=>{},getRecoveryData:()=>null,acceptRecovery:()=>null,dismissRecovery:()=>{},enable:()=>{},disable:()=>{}};let _=new a.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,o.value=e.hasRecoveryData,s.value=e.isEnabled},y=_.subscribe(v);u?_.enable():_.disable(),v(),(0,t.watch)(()=>(0,t.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,t.onBeforeUnmount)(()=>{y(),_.destroy()}),{status:r,lastSaveTime:i,hasRecoveryData:o,isEnabled:s,save:b,clearAutoSave:x,getRecoveryData:S,acceptRecovery:C,dismissRecovery:w,enable:T,disable:E}}function d(e={}){let{onCopy:n,onCut:i,onPaste:a,cleanWordFormatting:o=!0,editable:s=!0,onError:c,theme:l}=e,u=(0,t.ref)(!1),d=(0,t.ref)(null);async function f(e){if(u.value)return!1;u.value=!0;try{let t=await(0,r.copyRuns)(e.runs,{onError:c,theme:l});return t&&n?.(e),t}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({comments:e,trackedChanges:n,showResolved:r,isAddingComment:i,addCommentYPosition:a}){return(0,t.computed)(()=>{let t=[];i?.value&&a?.value!=null&&t.push({id:`new-comment-input`,anchorPos:0,fixedY:a.value,priority:-1e3,isTemporary:!0,estimatedHeight:120,kind:`add-comment`});let o=new Map;for(let t of e.value)if(t.parentId!=null){let e=o.get(t.parentId);e?e.push(t):o.set(t.parentId,[t])}for(let n of e.value)n.parentId??(n.done&&!r?.value||t.push({id:`comment-${n.id}`,anchorPos:0,anchorKey:`comment-${n.id}`,priority:0,estimatedHeight:n.done?28:80,kind:`comment`,comment:n,replies:o.get(n.id)??[]}));return n.value.forEach((e,n)=>{t.push({id:`tc-${e.revisionId}-${n}`,anchorPos:e.from,anchorKey:`revision-${e.revisionId}`,priority:1,estimatedHeight:80,kind:`tracked-change`,change:e})}),t})}var p=40,m=12;function h({pagesContainer:e,onScrollExtendSelection:n}){let r=null,i=0,a=0,s=!1,c=null;function l(){if(c)return c;let t=e.value;return t?(c=(0,o.findVerticalScrollParent)(t),c):null}function u(){s=!1,r!==null&&(cancelAnimationFrame(r),r=null)}function d(){if(!s)return;let e=l();if(!e)return;let t=e.getBoundingClientRect(),o=0;if(a<t.top+p){let e=Math.max(0,t.top+p-a);o=-Math.min(m,e/p*m)}else if(a>t.bottom-p){let e=Math.max(0,a-(t.bottom-p));o=Math.min(m,e/p*m)}o!==0&&(e.scrollTop+=o,n(i,a)),r=requestAnimationFrame(d)}function f(){s||(s=!0,r=requestAnimationFrame(d))}function h(e,t){if(i=e,a=t,!s){let e=l();if(!e)return;let n=e.getBoundingClientRect();(t<n.top+p||t>n.bottom-p)&&f()}}return(0,t.onBeforeUnmount)(()=>u()),{updateMousePosition:h,stopAutoScroll:u}}function g(e={}){let n=(0,t.reactive)({isOpen:!1,searchText:``,replaceText:``,options:(0,s.createDefaultFindOptions)(),matches:[],currentIndex:0,replaceMode:e.initialReplaceMode??!1});function r(e){n.isOpen=!0,n.replaceMode=!1,e&&(n.searchText=e),n.matches=[],n.currentIndex=0}function i(e){n.isOpen=!0,n.replaceMode=!0,e&&(n.searchText=e),n.matches=[],n.currentIndex=0}function a(){n.isOpen=!1}function o(){n.isOpen=!n.isOpen}function c(e){n.searchText=e}function l(e){n.replaceText=e}function u(e){n.options={...n.options,...e}}function d(t,r=0){let i=Math.max(0,Math.min(r,t.length-1));n.matches=t,n.currentIndex=t.length>0?i:0,e.onMatchesChange?.(t),t.length>0?e.onCurrentMatchChange?.(t[i],i):e.onCurrentMatchChange?.(null,-1)}function f(){return n.matches.length===0?0:(n.currentIndex=(n.currentIndex+1)%n.matches.length,n.currentIndex)}function p(){return n.matches.length===0?0:(n.currentIndex=n.currentIndex===0?n.matches.length-1:n.currentIndex-1,n.currentIndex)}function m(e){n.matches.length===0||e<0||e>=n.matches.length||(n.currentIndex=e)}return{state:n,currentMatch:(0,t.computed)(()=>n.matches.length===0?null:n.matches[n.currentIndex]??null),hasMatches:(0,t.computed)(()=>n.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 _({isOpen:e,onClose:n,align:r=`left`}){let i=(0,t.ref)(null),a=(0,t.ref)(null),o=(0,t.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 t=e.target;i.value&&!i.value.contains(t)&&a.value&&!a.value.contains(t)&&n()}function l(e){e.key===`Escape`&&n()}function u(){n()}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,t.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,t.onBeforeUnmount)(f);function p(e){e.preventDefault(),e.stopPropagation()}return{containerRef:i,dropdownRef:a,dropdownStyle:o,handleMouseDown:p}}function v(e,r){let i=(0,t.computed)(()=>{r.value;let t=e.value;return t?(0,n.undoDepth)(t.state)>0:!1}),a=(0,t.computed)(()=>{r.value;let t=e.value;return t?(0,n.redoDepth)(t.state)>0:!1});function o(){let t=e.value;return t?(0,n.undo)(t.state,t.dispatch):!1}function s(){let t=e.value;return t?(0,n.redo)(t.state,t.dispatch):!1}return{canUndo:i,canRedo:a,undo:o,redo:s}}function y(e){let{containerRef:n,enabled:i=!0,config:a=r.DEFAULT_SELECTION_STYLE,useOverlay:o=!1,debounceMs:s=16,onSelectionChange:c}=e,l=(0,t.ref)(!1),u=(0,t.ref)(``),d=(0,t.ref)([]),f=(0,t.ref)(!1),p=null,m=0;function h(){let e=n.value,t=(0,r.hasActiveSelection)(),i=(0,r.getSelectedText)(),a=e?(0,r.isSelectionWithin)(e):!1;l.value=t,u.value=i,f.value=a,d.value=o&&a&&e?(0,r.getMergedSelectionRects)(e):[],c?.(t&&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,t.onMounted)(()=>{i&&((0,r.areSelectionStylesInjected)()||(0,r.injectSelectionStyles)(a),document.addEventListener(`selectionchange`,_))}),(0,t.onBeforeUnmount)(()=>{document.removeEventListener(`selectionchange`,_),p&&clearTimeout(p)}),(0,t.watch)(n,()=>h()),{hasSelection:(0,t.computed)(()=>l.value),selectedText:(0,t.computed)(()=>u.value),highlightRects:(0,t.computed)(()=>d.value),isSelectionInContainer:(0,t.computed)(()=>f.value),refresh:g,getOverlayStyle:v}}function b(){let e=new c.TableSelectionManager,n=(0,t.ref)(null),r=()=>{n.value=e.getSnapshot().selectedCell},i=e.subscribe(r);r(),(0,t.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:n,handleCellClick:a,handleClickTarget:o,clearSelection:s,isCellSelected:l}}function x(e,n){return(0,t.computed)(()=>(n.value,(0,i.extractTrackedChanges)(e.value?.state??null)))}function S(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=a.createSelectionFromDOM,exports.extractTrackedChanges=i.extractTrackedChanges,exports.formatLastSaveTime=a.formatLastSaveTime,exports.formatStorageSize=a.formatStorageSize,exports.getAutoSaveStatusLabel=a.getAutoSaveStatusLabel,exports.getAutoSaveStorageSize=a.getAutoSaveStorageSize,exports.getSelectionRuns=a.getSelectionRuns,exports.isAutoSaveSupported=a.isAutoSaveSupported,exports.runsToClipboardContent=r.runsToClipboardContent,exports.useAutoSave=u,exports.useClipboard=d,exports.useCommentSidebarItems=f,exports.useDocxEditor=e.r,exports.useDragAutoScroll=h,exports.useFindReplace=g,exports.useFixedDropdown=_,exports.useHistory=v,exports.useSelectionHighlight=y,exports.useTableResize=e.t,exports.useTableSelection=b,exports.useTrackedChanges=x,exports.useVisualLineNavigation=S,exports.useWheelZoom=e.n,exports.useZoom=e.n;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./useCommentSidebarItems-CbNvNCd3.cjs`),t=require(`./useDragAutoScroll-BT6oPYBj.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,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { DEFAULT_SELECTION_STYLE as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { createDefaultFindOptions as
|
|
9
|
-
import { TableSelectionManager as
|
|
10
|
-
import { createVisualLineState as
|
|
1
|
+
import { t as e } from "./useCommentSidebarItems-BHomCzpj.js";
|
|
2
|
+
import { i as t, n, r, t as i } from "./useDragAutoScroll-C56F_WS_.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";
|
|
8
|
+
import { createDefaultFindOptions as F } from "@eigenpal/docx-editor-core/utils/findReplace";
|
|
9
|
+
import { TableSelectionManager as I, findTableFromClick as L } from "@eigenpal/docx-editor-core/managers/TableSelectionManager";
|
|
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";
|
|
11
11
|
//#region src/composables/useAutoSave.ts
|
|
12
|
-
function
|
|
13
|
-
let n =
|
|
14
|
-
if (!
|
|
12
|
+
function U(e, t = {}) {
|
|
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 {
|
|
15
15
|
status: n,
|
|
16
16
|
lastSaveTime: r,
|
|
17
|
-
hasRecoveryData:
|
|
18
|
-
isEnabled:
|
|
17
|
+
hasRecoveryData: i,
|
|
18
|
+
isEnabled: a,
|
|
19
19
|
save: async () => !1,
|
|
20
20
|
clearAutoSave: () => {},
|
|
21
21
|
getRecoveryData: () => null,
|
|
@@ -24,9 +24,9 @@ function H(e, t = {}) {
|
|
|
24
24
|
enable: () => {},
|
|
25
25
|
disable: () => {}
|
|
26
26
|
};
|
|
27
|
-
let y = new
|
|
28
|
-
storageKey:
|
|
29
|
-
interval:
|
|
27
|
+
let y = new D({
|
|
28
|
+
storageKey: s,
|
|
29
|
+
interval: c,
|
|
30
30
|
maxAge: p,
|
|
31
31
|
saveOnChange: _,
|
|
32
32
|
debounceDelay: v,
|
|
@@ -35,9 +35,9 @@ function H(e, t = {}) {
|
|
|
35
35
|
onRecoveryAvailable: g
|
|
36
36
|
}), b = () => {
|
|
37
37
|
let e = y.getSnapshot();
|
|
38
|
-
n.value = e.status, r.value = e.lastSaveTime,
|
|
38
|
+
n.value = e.status, r.value = e.lastSaveTime, i.value = e.hasRecoveryData, a.value = e.isEnabled;
|
|
39
39
|
}, x = y.subscribe(b);
|
|
40
|
-
f ? y.enable() : y.disable(), b(),
|
|
40
|
+
f ? y.enable() : y.disable(), b(), d(() => u(e), (e) => y.onDocumentChanged(e ?? null), { immediate: !0 });
|
|
41
41
|
function S() {
|
|
42
42
|
return y.save();
|
|
43
43
|
}
|
|
@@ -47,10 +47,10 @@ function H(e, t = {}) {
|
|
|
47
47
|
function w() {
|
|
48
48
|
return y.getRecoveryData();
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function T() {
|
|
51
51
|
return y.acceptRecovery();
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function E() {
|
|
54
54
|
y.dismissRecovery();
|
|
55
55
|
}
|
|
56
56
|
function O() {
|
|
@@ -59,171 +59,86 @@ function H(e, t = {}) {
|
|
|
59
59
|
function k() {
|
|
60
60
|
y.disable();
|
|
61
61
|
}
|
|
62
|
-
return
|
|
62
|
+
return o(() => {
|
|
63
63
|
x(), y.destroy();
|
|
64
64
|
}), {
|
|
65
65
|
status: n,
|
|
66
66
|
lastSaveTime: r,
|
|
67
|
-
hasRecoveryData:
|
|
68
|
-
isEnabled:
|
|
67
|
+
hasRecoveryData: i,
|
|
68
|
+
isEnabled: a,
|
|
69
69
|
save: S,
|
|
70
70
|
clearAutoSave: C,
|
|
71
71
|
getRecoveryData: w,
|
|
72
|
-
acceptRecovery:
|
|
73
|
-
dismissRecovery:
|
|
72
|
+
acceptRecovery: T,
|
|
73
|
+
dismissRecovery: E,
|
|
74
74
|
enable: O,
|
|
75
75
|
disable: k
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
//#endregion
|
|
79
79
|
//#region src/composables/useClipboard.ts
|
|
80
|
-
function
|
|
81
|
-
let { onCopy: t, onCut: n, onPaste: r, cleanWordFormatting: i = !0, editable: a = !0, onError: o, theme:
|
|
80
|
+
function W(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);
|
|
82
82
|
async function d(e) {
|
|
83
|
-
if (
|
|
84
|
-
|
|
83
|
+
if (c.value) return !1;
|
|
84
|
+
c.value = !0;
|
|
85
85
|
try {
|
|
86
|
-
let n = await
|
|
86
|
+
let n = await m(e.runs, {
|
|
87
87
|
onError: o,
|
|
88
|
-
theme:
|
|
88
|
+
theme: s
|
|
89
89
|
});
|
|
90
90
|
return n && t?.(e), n;
|
|
91
91
|
} finally {
|
|
92
|
-
|
|
92
|
+
c.value = !1;
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
async function f(e) {
|
|
96
|
-
if (
|
|
97
|
-
|
|
96
|
+
if (c.value || !a) return !1;
|
|
97
|
+
c.value = !0;
|
|
98
98
|
try {
|
|
99
|
-
let t = await
|
|
99
|
+
let t = await m(e.runs, {
|
|
100
100
|
onError: o,
|
|
101
|
-
theme:
|
|
101
|
+
theme: s
|
|
102
102
|
});
|
|
103
103
|
return t && n?.(e), t;
|
|
104
104
|
} finally {
|
|
105
|
-
|
|
105
|
+
c.value = !1;
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
async function p(e = !1) {
|
|
109
|
-
if (
|
|
110
|
-
|
|
109
|
+
if (c.value || !a) return null;
|
|
110
|
+
c.value = !0;
|
|
111
111
|
try {
|
|
112
112
|
if (navigator.clipboard && navigator.clipboard.read) {
|
|
113
113
|
let t = await navigator.clipboard.read(), n = "", a = "";
|
|
114
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());
|
|
115
115
|
e && (n = "");
|
|
116
|
-
let o =
|
|
116
|
+
let o = b(n, a, i);
|
|
117
117
|
return u.value = o, r?.(o, e), o;
|
|
118
118
|
}
|
|
119
119
|
return null;
|
|
120
120
|
} catch (e) {
|
|
121
121
|
return o?.(e instanceof Error ? e : Error(String(e))), null;
|
|
122
122
|
} finally {
|
|
123
|
-
|
|
123
|
+
c.value = !1;
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
return {
|
|
127
127
|
copy: d,
|
|
128
128
|
cut: f,
|
|
129
129
|
paste: p,
|
|
130
|
-
isProcessing:
|
|
130
|
+
isProcessing: c,
|
|
131
131
|
lastPastedContent: u
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
134
|
//#endregion
|
|
135
|
-
//#region src/composables/useCommentSidebarItems.ts
|
|
136
|
-
function W({ comments: e, trackedChanges: t, showResolved: n, isAddingComment: i, addCommentYPosition: a }) {
|
|
137
|
-
return r(() => {
|
|
138
|
-
let r = [];
|
|
139
|
-
i?.value && a?.value != null && r.push({
|
|
140
|
-
id: "new-comment-input",
|
|
141
|
-
anchorPos: 0,
|
|
142
|
-
fixedY: a.value,
|
|
143
|
-
priority: -1e3,
|
|
144
|
-
isTemporary: !0,
|
|
145
|
-
estimatedHeight: 120,
|
|
146
|
-
kind: "add-comment"
|
|
147
|
-
});
|
|
148
|
-
let o = /* @__PURE__ */ new Map();
|
|
149
|
-
for (let t of e.value) if (t.parentId != null) {
|
|
150
|
-
let e = o.get(t.parentId);
|
|
151
|
-
e ? e.push(t) : o.set(t.parentId, [t]);
|
|
152
|
-
}
|
|
153
|
-
for (let t of e.value) t.parentId ?? (t.done && !n?.value || r.push({
|
|
154
|
-
id: `comment-${t.id}`,
|
|
155
|
-
anchorPos: 0,
|
|
156
|
-
anchorKey: `comment-${t.id}`,
|
|
157
|
-
priority: 0,
|
|
158
|
-
estimatedHeight: t.done ? 28 : 80,
|
|
159
|
-
kind: "comment",
|
|
160
|
-
comment: t,
|
|
161
|
-
replies: o.get(t.id) ?? []
|
|
162
|
-
}));
|
|
163
|
-
return t.value.forEach((e, t) => {
|
|
164
|
-
r.push({
|
|
165
|
-
id: `tc-${e.revisionId}-${t}`,
|
|
166
|
-
anchorPos: e.from,
|
|
167
|
-
anchorKey: `revision-${e.revisionId}`,
|
|
168
|
-
priority: 1,
|
|
169
|
-
estimatedHeight: 80,
|
|
170
|
-
kind: "tracked-change",
|
|
171
|
-
change: e
|
|
172
|
-
});
|
|
173
|
-
}), r;
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
//#endregion
|
|
177
|
-
//#region src/composables/useDragAutoScroll.ts
|
|
178
|
-
var G = 40, K = 12;
|
|
179
|
-
function q({ pagesContainer: e, onScrollExtendSelection: t }) {
|
|
180
|
-
let n = null, r = 0, a = 0, o = !1, s = null;
|
|
181
|
-
function c() {
|
|
182
|
-
if (s) return s;
|
|
183
|
-
let t = e.value;
|
|
184
|
-
return t ? (s = N(t), s) : null;
|
|
185
|
-
}
|
|
186
|
-
function l() {
|
|
187
|
-
o = !1, n !== null && (cancelAnimationFrame(n), n = null);
|
|
188
|
-
}
|
|
189
|
-
function u() {
|
|
190
|
-
if (!o) return;
|
|
191
|
-
let e = c();
|
|
192
|
-
if (!e) return;
|
|
193
|
-
let i = e.getBoundingClientRect(), s = 0;
|
|
194
|
-
if (a < i.top + G) {
|
|
195
|
-
let e = Math.max(0, i.top + G - a);
|
|
196
|
-
s = -Math.min(K, e / G * K);
|
|
197
|
-
} else if (a > i.bottom - G) {
|
|
198
|
-
let e = Math.max(0, a - (i.bottom - G));
|
|
199
|
-
s = Math.min(K, e / G * K);
|
|
200
|
-
}
|
|
201
|
-
s !== 0 && (e.scrollTop += s, t(r, a)), n = requestAnimationFrame(u);
|
|
202
|
-
}
|
|
203
|
-
function d() {
|
|
204
|
-
o || (o = !0, n = requestAnimationFrame(u));
|
|
205
|
-
}
|
|
206
|
-
function f(e, t) {
|
|
207
|
-
if (r = e, a = t, !o) {
|
|
208
|
-
let e = c();
|
|
209
|
-
if (!e) return;
|
|
210
|
-
let n = e.getBoundingClientRect();
|
|
211
|
-
(t < n.top + G || t > n.bottom - G) && d();
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
return i(() => l()), {
|
|
215
|
-
updateMousePosition: f,
|
|
216
|
-
stopAutoScroll: l
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
//#endregion
|
|
220
135
|
//#region src/composables/useFindReplace.ts
|
|
221
|
-
function
|
|
222
|
-
let t =
|
|
136
|
+
function G(e = {}) {
|
|
137
|
+
let t = c({
|
|
223
138
|
isOpen: !1,
|
|
224
139
|
searchText: "",
|
|
225
140
|
replaceText: "",
|
|
226
|
-
options:
|
|
141
|
+
options: F(),
|
|
227
142
|
matches: [],
|
|
228
143
|
currentIndex: 0,
|
|
229
144
|
replaceMode: e.initialReplaceMode ?? !1
|
|
@@ -231,16 +146,16 @@ function J(e = {}) {
|
|
|
231
146
|
function n(e) {
|
|
232
147
|
t.isOpen = !0, t.replaceMode = !1, e && (t.searchText = e), t.matches = [], t.currentIndex = 0;
|
|
233
148
|
}
|
|
234
|
-
function
|
|
149
|
+
function r(e) {
|
|
235
150
|
t.isOpen = !0, t.replaceMode = !0, e && (t.searchText = e), t.matches = [], t.currentIndex = 0;
|
|
236
151
|
}
|
|
237
|
-
function
|
|
152
|
+
function i() {
|
|
238
153
|
t.isOpen = !1;
|
|
239
154
|
}
|
|
240
|
-
function
|
|
155
|
+
function o() {
|
|
241
156
|
t.isOpen = !t.isOpen;
|
|
242
157
|
}
|
|
243
|
-
function
|
|
158
|
+
function s(e) {
|
|
244
159
|
t.searchText = e;
|
|
245
160
|
}
|
|
246
161
|
function l(e) {
|
|
@@ -267,13 +182,13 @@ function J(e = {}) {
|
|
|
267
182
|
}
|
|
268
183
|
return {
|
|
269
184
|
state: t,
|
|
270
|
-
currentMatch:
|
|
271
|
-
hasMatches:
|
|
185
|
+
currentMatch: a(() => t.matches.length === 0 ? null : t.matches[t.currentIndex] ?? null),
|
|
186
|
+
hasMatches: a(() => t.matches.length > 0),
|
|
272
187
|
openFind: n,
|
|
273
|
-
openReplace:
|
|
274
|
-
close:
|
|
275
|
-
toggle:
|
|
276
|
-
setSearchText:
|
|
188
|
+
openReplace: r,
|
|
189
|
+
close: i,
|
|
190
|
+
toggle: o,
|
|
191
|
+
setSearchText: s,
|
|
277
192
|
setReplaceText: l,
|
|
278
193
|
setOptions: u,
|
|
279
194
|
setMatches: d,
|
|
@@ -284,107 +199,107 @@ function J(e = {}) {
|
|
|
284
199
|
}
|
|
285
200
|
//#endregion
|
|
286
201
|
//#region src/composables/useFixedDropdown.ts
|
|
287
|
-
function
|
|
288
|
-
let r =
|
|
202
|
+
function K({ isOpen: e, onClose: t, align: n = "left" }) {
|
|
203
|
+
let r = l(null), i = l(null), a = l({
|
|
289
204
|
position: "fixed",
|
|
290
205
|
top: "0px",
|
|
291
206
|
left: "0px",
|
|
292
207
|
zIndex: 1e4
|
|
293
208
|
});
|
|
294
|
-
function
|
|
295
|
-
|
|
209
|
+
function s(e, t) {
|
|
210
|
+
a.value = {
|
|
296
211
|
position: "fixed",
|
|
297
212
|
top: e + "px",
|
|
298
213
|
left: t + "px",
|
|
299
214
|
zIndex: 1e4
|
|
300
215
|
};
|
|
301
216
|
}
|
|
302
|
-
function
|
|
217
|
+
function c(e) {
|
|
303
218
|
let n = e.target;
|
|
304
|
-
r.value && !r.value.contains(n) &&
|
|
219
|
+
r.value && !r.value.contains(n) && i.value && !i.value.contains(n) && t();
|
|
305
220
|
}
|
|
306
|
-
function
|
|
221
|
+
function u(e) {
|
|
307
222
|
e.key === "Escape" && t();
|
|
308
223
|
}
|
|
309
224
|
function f() {
|
|
310
225
|
t();
|
|
311
226
|
}
|
|
312
227
|
function p() {
|
|
313
|
-
document.addEventListener("mousedown",
|
|
228
|
+
document.addEventListener("mousedown", c), document.addEventListener("keydown", u), window.addEventListener("scroll", f, !0);
|
|
314
229
|
}
|
|
315
230
|
function m() {
|
|
316
|
-
document.removeEventListener("mousedown",
|
|
231
|
+
document.removeEventListener("mousedown", c), document.removeEventListener("keydown", u), window.removeEventListener("scroll", f, !0);
|
|
317
232
|
}
|
|
318
|
-
|
|
233
|
+
d(e, (e) => {
|
|
319
234
|
if (!e) {
|
|
320
235
|
m();
|
|
321
236
|
return;
|
|
322
237
|
}
|
|
323
238
|
let t = r.value;
|
|
324
239
|
if (!t) return;
|
|
325
|
-
let
|
|
240
|
+
let a = t.getBoundingClientRect();
|
|
326
241
|
n === "right" ? requestAnimationFrame(() => {
|
|
327
|
-
let e =
|
|
242
|
+
let e = i.value;
|
|
328
243
|
if (e) {
|
|
329
244
|
let t = e.getBoundingClientRect();
|
|
330
|
-
|
|
331
|
-
} else
|
|
332
|
-
}) :
|
|
333
|
-
}),
|
|
245
|
+
s(a.bottom + 4, a.right - t.width);
|
|
246
|
+
} else s(a.bottom + 4, a.left);
|
|
247
|
+
}) : s(a.bottom + 4, a.left), p();
|
|
248
|
+
}), o(m);
|
|
334
249
|
function h(e) {
|
|
335
250
|
e.preventDefault(), e.stopPropagation();
|
|
336
251
|
}
|
|
337
252
|
return {
|
|
338
253
|
containerRef: r,
|
|
339
|
-
dropdownRef:
|
|
340
|
-
dropdownStyle:
|
|
254
|
+
dropdownRef: i,
|
|
255
|
+
dropdownStyle: a,
|
|
341
256
|
handleMouseDown: h
|
|
342
257
|
};
|
|
343
258
|
}
|
|
344
259
|
//#endregion
|
|
345
260
|
//#region src/composables/useHistory.ts
|
|
346
|
-
function
|
|
347
|
-
let n =
|
|
261
|
+
function q(e, t) {
|
|
262
|
+
let n = a(() => {
|
|
348
263
|
t.value;
|
|
349
264
|
let n = e.value;
|
|
350
|
-
return n ?
|
|
351
|
-
}),
|
|
265
|
+
return n ? T(n.state) > 0 : !1;
|
|
266
|
+
}), r = a(() => {
|
|
352
267
|
t.value;
|
|
353
268
|
let n = e.value;
|
|
354
|
-
return n ?
|
|
269
|
+
return n ? C(n.state) > 0 : !1;
|
|
355
270
|
});
|
|
356
|
-
function
|
|
271
|
+
function i() {
|
|
357
272
|
let t = e.value;
|
|
358
|
-
return t ?
|
|
273
|
+
return t ? w(t.state, t.dispatch) : !1;
|
|
359
274
|
}
|
|
360
275
|
function o() {
|
|
361
276
|
let t = e.value;
|
|
362
|
-
return t ?
|
|
277
|
+
return t ? S(t.state, t.dispatch) : !1;
|
|
363
278
|
}
|
|
364
279
|
return {
|
|
365
280
|
canUndo: n,
|
|
366
|
-
canRedo:
|
|
367
|
-
undo:
|
|
281
|
+
canRedo: r,
|
|
282
|
+
undo: i,
|
|
368
283
|
redo: o
|
|
369
284
|
};
|
|
370
285
|
}
|
|
371
286
|
//#endregion
|
|
372
287
|
//#region src/composables/useSelectionHighlight.ts
|
|
373
|
-
function
|
|
374
|
-
let { containerRef: t, enabled: n = !0, config:
|
|
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;
|
|
375
290
|
function T() {
|
|
376
|
-
let e = t.value, n =
|
|
377
|
-
|
|
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);
|
|
378
293
|
}
|
|
379
294
|
function E() {
|
|
380
295
|
T();
|
|
381
296
|
}
|
|
382
297
|
function D() {
|
|
383
298
|
let e = performance.now();
|
|
384
|
-
if (e - w <
|
|
299
|
+
if (e - w < c) {
|
|
385
300
|
C && clearTimeout(C), C = setTimeout(() => {
|
|
386
301
|
w = performance.now(), T(), C = null;
|
|
387
|
-
},
|
|
302
|
+
}, c);
|
|
388
303
|
return;
|
|
389
304
|
}
|
|
390
305
|
w = e, T();
|
|
@@ -396,82 +311,82 @@ function Z(e) {
|
|
|
396
311
|
top: e.top + "px",
|
|
397
312
|
width: e.width + "px",
|
|
398
313
|
height: e.height + "px",
|
|
399
|
-
backgroundColor:
|
|
400
|
-
borderRadius:
|
|
401
|
-
border:
|
|
402
|
-
zIndex:
|
|
314
|
+
backgroundColor: r.backgroundColor,
|
|
315
|
+
borderRadius: r.borderRadius ? r.borderRadius + "px" : void 0,
|
|
316
|
+
border: r.borderColor ? `1px solid ${r.borderColor}` : void 0,
|
|
317
|
+
zIndex: r.zIndex ?? 0,
|
|
403
318
|
pointerEvents: "none"
|
|
404
319
|
};
|
|
405
320
|
}
|
|
406
|
-
return
|
|
407
|
-
n && (
|
|
408
|
-
}),
|
|
321
|
+
return s(() => {
|
|
322
|
+
n && (p() || v(r), document.addEventListener("selectionchange", D));
|
|
323
|
+
}), o(() => {
|
|
409
324
|
document.removeEventListener("selectionchange", D), C && clearTimeout(C);
|
|
410
|
-
}),
|
|
411
|
-
hasSelection:
|
|
412
|
-
selectedText:
|
|
413
|
-
highlightRects:
|
|
414
|
-
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),
|
|
415
330
|
refresh: E,
|
|
416
331
|
getOverlayStyle: O
|
|
417
332
|
};
|
|
418
333
|
}
|
|
419
334
|
//#endregion
|
|
420
335
|
//#region src/composables/useTableSelection.ts
|
|
421
|
-
function
|
|
422
|
-
let e = new
|
|
336
|
+
function Y() {
|
|
337
|
+
let e = new I(), t = l(null), n = () => {
|
|
423
338
|
t.value = e.getSnapshot().selectedCell;
|
|
424
339
|
}, r = e.subscribe(n);
|
|
425
|
-
n(),
|
|
340
|
+
n(), o(() => {
|
|
426
341
|
r();
|
|
427
342
|
});
|
|
428
|
-
function
|
|
343
|
+
function i(t, n, r) {
|
|
429
344
|
e.selectCell({
|
|
430
345
|
tableIndex: t,
|
|
431
346
|
rowIndex: n,
|
|
432
347
|
columnIndex: r
|
|
433
348
|
});
|
|
434
349
|
}
|
|
435
|
-
function
|
|
436
|
-
let r =
|
|
350
|
+
function a(t, n) {
|
|
351
|
+
let r = L(t, n);
|
|
437
352
|
r ? e.selectCell(r) : e.clearSelection();
|
|
438
353
|
}
|
|
439
|
-
function
|
|
354
|
+
function s() {
|
|
440
355
|
e.clearSelection();
|
|
441
356
|
}
|
|
442
|
-
function
|
|
357
|
+
function c(t, n, r) {
|
|
443
358
|
return e.isCellSelected(t, n, r);
|
|
444
359
|
}
|
|
445
360
|
return {
|
|
446
361
|
selectedCell: t,
|
|
447
|
-
handleCellClick:
|
|
448
|
-
handleClickTarget:
|
|
449
|
-
clearSelection:
|
|
450
|
-
isCellSelected:
|
|
362
|
+
handleCellClick: i,
|
|
363
|
+
handleClickTarget: a,
|
|
364
|
+
clearSelection: s,
|
|
365
|
+
isCellSelected: c
|
|
451
366
|
};
|
|
452
367
|
}
|
|
453
368
|
//#endregion
|
|
454
369
|
//#region src/composables/useTrackedChanges.ts
|
|
455
|
-
function
|
|
456
|
-
return
|
|
370
|
+
function X(e, t) {
|
|
371
|
+
return a(() => (t.value, E(e.value?.state ?? null)));
|
|
457
372
|
}
|
|
458
373
|
//#endregion
|
|
459
374
|
//#region src/composables/useVisualLineNavigation.ts
|
|
460
|
-
function
|
|
461
|
-
let t =
|
|
375
|
+
function Z(e) {
|
|
376
|
+
let t = R();
|
|
462
377
|
function n(t) {
|
|
463
378
|
let n = e.value;
|
|
464
|
-
return n ?
|
|
379
|
+
return n ? V(n, t) : null;
|
|
465
380
|
}
|
|
466
381
|
function r(t) {
|
|
467
382
|
let n = e.value;
|
|
468
|
-
return n ?
|
|
383
|
+
return n ? z(n, t) : null;
|
|
469
384
|
}
|
|
470
385
|
function i(e, t) {
|
|
471
|
-
return
|
|
386
|
+
return B(e, t);
|
|
472
387
|
}
|
|
473
388
|
function a(n, r) {
|
|
474
|
-
return
|
|
389
|
+
return H(t, n, r, e.value);
|
|
475
390
|
}
|
|
476
391
|
return {
|
|
477
392
|
state: t,
|
|
@@ -482,4 +397,4 @@ function ee(e) {
|
|
|
482
397
|
};
|
|
483
398
|
}
|
|
484
399
|
//#endregion
|
|
485
|
-
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-EW9K4wuO.cjs`),t=require(`./TablePropertiesDialog-BZLpFAkg.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-00eb4Ova.js";
|
|
2
|
+
import { a as s, i as c, n as l, o as u, r as d, t as f } from "./TablePropertiesDialog-CBTvM4Xy.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 };
|