@editora/plugins 1.0.16 → 1.0.18

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.
Files changed (109) hide show
  1. package/dist/CodePlugin.native-Bwf25lLX.js +460 -0
  2. package/dist/CodePlugin.native-Cpp4u3Jl.mjs +648 -0
  3. package/dist/a11y-checker.cjs.js +16 -16
  4. package/dist/a11y-checker.esm.js +79 -75
  5. package/dist/anchor.cjs.js +9 -9
  6. package/dist/anchor.esm.js +61 -60
  7. package/dist/anchoredPopover-Bg-ey7Yo.js +1 -0
  8. package/dist/anchoredPopover-D_JbjvdA.mjs +111 -0
  9. package/dist/approval-workflow.cjs.js +5 -5
  10. package/dist/approval-workflow.esm.js +105 -104
  11. package/dist/background-color.cjs.js +1 -1
  12. package/dist/background-color.esm.js +1 -1
  13. package/dist/blocks-library.cjs.js +6 -6
  14. package/dist/blocks-library.esm.js +226 -202
  15. package/dist/capitalization.cjs.js +1 -1
  16. package/dist/capitalization.esm.js +9 -4
  17. package/dist/checklist.cjs.js +1 -1
  18. package/dist/checklist.esm.js +154 -116
  19. package/dist/citations.cjs.js +43 -18
  20. package/dist/citations.esm.js +465 -446
  21. package/dist/clear-formatting.cjs.js +1 -1
  22. package/dist/clear-formatting.esm.js +21 -20
  23. package/dist/code-sample.cjs.js +85 -66
  24. package/dist/code-sample.esm.js +301 -190
  25. package/dist/code.cjs.js +1 -669
  26. package/dist/code.esm.js +2 -4560
  27. package/dist/collaboration.cjs.js +68 -0
  28. package/dist/collaboration.esm.js +7428 -0
  29. package/dist/comments.cjs.js +11 -11
  30. package/dist/comments.esm.js +284 -237
  31. package/dist/conditional-content.cjs.js +67 -60
  32. package/dist/conditional-content.esm.js +270 -220
  33. package/dist/data-binding.cjs.js +3 -3
  34. package/dist/data-binding.esm.js +28 -27
  35. package/dist/dialogHelpers-5d5BuOCW.mjs +39 -0
  36. package/dist/dialogHelpers-zU6zpMIA.js +12 -0
  37. package/dist/document-manager.cjs.js +1 -1
  38. package/dist/document-manager.esm.js +1 -1
  39. package/dist/{documentManager-Jf0RbSks.js → documentManager-BDz6tovy.js} +2 -2
  40. package/dist/{documentManager-CTqRftU8.mjs → documentManager-yjRBab4v.mjs} +3 -3
  41. package/dist/embed-iframe.cjs.js +37 -17
  42. package/dist/embed-iframe.esm.js +188 -143
  43. package/dist/emojis.cjs.js +13 -10
  44. package/dist/emojis.esm.js +288 -76
  45. package/dist/enterprise.cjs.js +1 -1
  46. package/dist/enterprise.esm.js +9 -7
  47. package/dist/escapeHtml-D2Zh82pD.js +1 -0
  48. package/dist/escapeHtml-DyksyvcZ.mjs +6 -0
  49. package/dist/font-family.cjs.js +1 -1
  50. package/dist/font-family.esm.js +48 -41
  51. package/dist/font-size.cjs.js +1 -1
  52. package/dist/font-size.esm.js +67 -60
  53. package/dist/format-painter.cjs.js +1 -1
  54. package/dist/format-painter.esm.js +2 -1
  55. package/dist/history.cjs.js +1 -1
  56. package/dist/history.esm.js +40 -36
  57. package/dist/historyHelpers-BEKwNOtA.mjs +14 -0
  58. package/dist/historyHelpers-Cu8Pk7m1.js +1 -0
  59. package/dist/index-Bm1eqYHh.mjs +194 -0
  60. package/dist/index-CoflqYuK.js +30 -0
  61. package/dist/index-CxhJLMPS.js +221 -0
  62. package/dist/{index-D3CycEFU.mjs → index-Di1ZqIDs.mjs} +6420 -6232
  63. package/dist/index.cjs.js +1 -1
  64. package/dist/{index.es-DQ78mYYo.mjs → index.es-B7pVaNEV.mjs} +1558 -1542
  65. package/dist/{index.es-CE_A4QSm.js → index.es-I9N4o4Iq.js} +5 -5
  66. package/dist/index.esm.js +17 -15
  67. package/dist/{jspdf.es.min-BoS80556.js → jspdf.es.min-B5Idu0Wl.js} +2 -2
  68. package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-BCzHIwvz.mjs} +3 -2
  69. package/dist/link.cjs.js +17 -13
  70. package/dist/link.esm.js +138 -69
  71. package/dist/list.cjs.js +1 -1
  72. package/dist/list.esm.js +66 -33
  73. package/dist/math.cjs.js +22 -22
  74. package/dist/math.esm.js +221 -126
  75. package/dist/media-manager.cjs.js +12 -12
  76. package/dist/media-manager.esm.js +55 -50
  77. package/dist/mentions.cjs.js +2 -2
  78. package/dist/mentions.esm.js +17 -12
  79. package/dist/merge-tag.cjs.js +2 -2
  80. package/dist/merge-tag.esm.js +43 -42
  81. package/dist/plugins.css +1 -1
  82. package/dist/preview.cjs.js +3 -3
  83. package/dist/preview.esm.js +30 -27
  84. package/dist/{purify.es-T2a3nLiC.js → purify.es-DWpzYfqy.js} +1 -1
  85. package/dist/{purify.es-DHhaBdbu.mjs → purify.es-Dewe88eZ.mjs} +2 -2
  86. package/dist/slash-commands.cjs.js +13 -7
  87. package/dist/slash-commands.esm.js +90 -79
  88. package/dist/smart-paste.cjs.js +5 -5
  89. package/dist/smart-paste.esm.js +85 -81
  90. package/dist/special-characters.cjs.js +6 -3
  91. package/dist/special-characters.esm.js +72 -25
  92. package/dist/spell-check.cjs.js +8 -8
  93. package/dist/spell-check.esm.js +10189 -295
  94. package/dist/table.cjs.js +166 -13
  95. package/dist/table.esm.js +543 -266
  96. package/dist/template.cjs.js +11 -11
  97. package/dist/template.esm.js +290 -264
  98. package/dist/text-color.cjs.js +1 -1
  99. package/dist/text-color.esm.js +1 -1
  100. package/dist/translation-workflow.cjs.js +4 -4
  101. package/dist/translation-workflow.esm.js +33 -31
  102. package/dist/version-diff.cjs.js +6 -6
  103. package/dist/version-diff.esm.js +40 -40
  104. package/package.json +10 -4
  105. package/dist/anchoredPopover-BzqGPOAE.js +0 -1
  106. package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
  107. package/dist/index-BFsKNTTj.mjs +0 -145
  108. package/dist/index-CvJk4DKa.js +0 -221
  109. package/dist/index-tqLTHcO6.js +0 -1
@@ -377,7 +377,8 @@ function It(t, e) {
377
377
  return o < i.data.length && i.splitText(o), r > 0 && (i = i.splitText(r)), i;
378
378
  }
379
379
  function xt(t, e) {
380
- let n = t, r = n.parentElement;
380
+ const n = t;
381
+ let r = n.parentElement;
381
382
  for (; r && r.matches(y) && !x(r, e) && tt(r, e); )
382
383
  Bt(r, n), r = n.parentElement;
383
384
  return n;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const H=".rte-content, .editora-content",M=100,T="__editoraCommandEditorRoot",d=new Map,l={};let g=!1,c=null;function N(t){if(!t)return null;const e=t.querySelector('[contenteditable="true"]');return e instanceof HTMLElement?e:null}function R(){if(typeof window>"u")return null;const t=window[T];if(!(t instanceof HTMLElement))return null;window[T]=null;const e=t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")||(t.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")?t:null);if(e){const o=N(e);if(o)return o;if(e.getAttribute("contenteditable")==="true")return e}if(t.getAttribute("contenteditable")==="true")return t;const n=t.closest('[contenteditable="true"]');return n instanceof HTMLElement?n:null}function I(t){return t?t.nodeType===Node.ELEMENT_NODE?t:t.parentElement:null}function s(t){const e=I(t);if(!e)return null;const n=e.closest(H);if(n)return n;const o=e.closest('[contenteditable="true"]');if(!o)return null;let r=o,i=r.parentElement;for(;i;)i.getAttribute("contenteditable")==="true"&&(r=i),i=i.parentElement;return r}function E(){const t=R();if(t&&document.contains(t))return t;const e=window.getSelection();if(e&&e.rangeCount>0){const i=s(e.getRangeAt(0).startContainer);if(i)return i}const n=document.activeElement;if(n){const i=s(n);if(i)return i}if(c?.isConnected)return c;const o=Array.from(d.keys()).find(i=>i.isConnected);if(o)return o;const r=document.querySelector(H);return r||document.querySelector('[contenteditable="true"]')}function S(){for(const t of d.keys())t.isConnected||(d.delete(t),c===t&&(c=null))}function b(t){S();let e=d.get(t);return e||(e={undoStack:[],redoStack:[]},d.set(t,e)),e}function a(t){t&&t.dispatchEvent(new Event("input",{bubbles:!0}))}function f(t,e){if(!t)return;const n=b(t);n.undoStack.push(e),n.redoStack.length=0,n.undoStack.length>M&&n.undoStack.splice(0,n.undoStack.length-M),c=t}function A(t,e="undo"){if(S(),t?.isConnected)return t;const n=E();if(n?.isConnected)return n;if(c?.isConnected)return c;const o=r=>e==="undo"?r.undoStack.length>0:r.redoStack.length>0;for(const[r,i]of d.entries())if(r.isConnected&&o(i))return r;return null}function y(t){const e={};for(const r of t.getAttributeNames()){const i=t.getAttribute(r);i!==null&&(e[r]=i)}const n=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement,o=t instanceof HTMLInputElement;return{attributes:e,innerHTML:t.innerHTML,value:n?t.value:null,checked:o?t.checked:null}}function w(t,e){const n=new Set(t.getAttributeNames());Object.keys(e.attributes).forEach(o=>n.delete(o)),n.forEach(o=>t.removeAttribute(o)),Object.entries(e.attributes).forEach(([o,r])=>{t.setAttribute(o,r)}),t.innerHTML!==e.innerHTML&&(t.innerHTML=e.innerHTML),e.value!==null&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)&&(t.value=e.value),e.checked!==null&&t instanceof HTMLInputElement&&(t.checked=e.checked)}function u(t,e){if(l[t]=e,typeof window>"u")return;const n=window.registerEditorCommand;typeof n=="function"?n(t,e):(window.registerEditorCommand=(o,r)=>{l[o]=r},window.registerEditorCommand(t,e))}const h=(t,...e)=>{const n=l[t];return n?n(...e):!1};function m(){g||typeof window>"u"||(g=!0,window.execEditorCommand||(window.execEditorCommand=h),window.executeEditorCommand||(window.executeEditorCommand=h),u("undo",L),u("redo",v),u("setAttribute",k),u("setText",x),u("autoFixA11y",D),u("recordDomTransaction",O),u("undoDom",p),u("redoDom",C))}const L=()=>{const t=E();return p(t??void 0)},v=()=>{const t=E();return C(t??void 0)},k=(t,e,n)=>{if(!(t instanceof HTMLElement))return;const o=s(t),r=t.hasAttribute(e),i=t.getAttribute(e);t.setAttribute(e,n),f(o,{undo:()=>{t.isConnected&&(r&&i!==null?t.setAttribute(e,i):t.removeAttribute(e))},redo:()=>{t.isConnected&&t.setAttribute(e,n)}}),a(o)},x=(t,e)=>{if(!(t instanceof HTMLElement))return;const n=s(t),o=t.textContent??"";t.textContent=e,f(n,{undo:()=>{t.isConnected&&(t.textContent=o)},redo:()=>{t.isConnected&&(t.textContent=e)}}),a(n)},D=t=>{const e=t?.element;if(!(e instanceof HTMLElement))return;const n=s(e),o=window.a11yRuleRegistry?.find(_=>_.id===t.rule);if(!o||typeof o.fix!="function")return;const r=y(e);o.fix(t);const i=y(e);f(n,{undo:()=>{e.isConnected&&w(e,r)},redo:()=>{e.isConnected&&w(e,i)}}),a(n)},O=(t,e,n)=>{if(!(t instanceof HTMLElement))return!1;const o=typeof n=="string"?n:t.innerHTML;return e===o?!1:(f(t,{undo:()=>{t.isConnected&&(t.innerHTML=e)},redo:()=>{t.isConnected&&(t.innerHTML=o)}}),!0)},p=t=>{const e=A(t,"undo");if(!e)return!1;const n=b(e),o=n.undoStack.pop();return o?(o.undo(),n.redoStack.push(o),c=e,a(e),!0):!1},C=t=>{const e=A(t,"redo");if(!e)return!1;const n=b(e),o=n.redoStack.pop();return o?(o.redo(),n.undoStack.push(o),c=e,a(e),!0):!1};typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",m,{once:!0}):m());const z=()=>(m(),{name:"history",toolbar:[{label:"Undo",command:"undo",type:"button",icon:'<svg width="24" height="24" focusable="false"><path d="M6.4 8H12c3.7 0 6.2 2 6.8 5.1.6 2.7-.4 5.6-2.3 6.8a1 1 0 0 1-1-1.8c1.1-.6 1.8-2.7 1.4-4.6-.5-2.1-2.1-3.5-4.9-3.5H6.4l3.3 3.3a1 1 0 1 1-1.4 1.4l-5-5a1 1 0 0 1 0-1.4l5-5a1 1 0 0 1 1.4 1.4L6.4 8Z" fill-rule="nonzero"></path></svg>',shortcut:"Mod-z"},{label:"Redo",command:"redo",type:"button",icon:'<svg width="24" height="24" focusable="false"><path d="M17.6 10H12c-2.8 0-4.4 1.4-4.9 3.5-.4 2 .3 4 1.4 4.6a1 1 0 1 1-1 1.8c-2-1.2-2.9-4.1-2.3-6.8.6-3 3-5.1 6.8-5.1h5.6l-3.3-3.3a1 1 0 1 1 1.4-1.4l5 5a1 1 0 0 1 0 1.4l-5 5a1 1 0 0 1-1.4-1.4l3.3-3.3Z" fill-rule="nonzero"></path></svg>',shortcut:"Mod-y"}],commands:{undo:L,redo:v,setAttribute:k,setText:x,autoFixA11y:D,recordDomTransaction:O,undoDom:p,redoDom:C},keymap:{"Mod-z":"undo","Mod-Z":"undo","Mod-y":"redo","Mod-Y":"redo","Mod-Shift-z":"redo","Mod-Shift-Z":"redo"}});exports.HistoryPlugin=z;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=".rte-content, .editora-content",M=100,T="__editoraCommandEditorRoot",d=new Map,m={};let y=!1,c=null;function N(t){if(!t)return null;const e=t.querySelector('[contenteditable="true"]');return e instanceof HTMLElement?e:null}function R(){if(typeof window>"u")return null;const t=window[T];if(!(t instanceof HTMLElement))return null;window[T]=null;const e=t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")||(t.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")?t:null);if(e){const o=N(e);if(o)return o;if(e.getAttribute("contenteditable")==="true")return e}if(t.getAttribute("contenteditable")==="true")return t;const n=t.closest('[contenteditable="true"]');return n instanceof HTMLElement?n:null}function I(t){return t?t.nodeType===Node.ELEMENT_NODE?t:t.parentElement:null}function s(t){const e=I(t);if(!e)return null;const n=e.closest(h);if(n)return n;const o=e.closest('[contenteditable="true"]');if(!o)return null;let r=o,i=r.parentElement;for(;i;)i.getAttribute("contenteditable")==="true"&&(r=i),i=i.parentElement;return r}function p(){const t=R();if(t&&document.contains(t))return t;const e=window.getSelection();if(e&&e.rangeCount>0){const i=s(e.getRangeAt(0).startContainer);if(i)return i}const n=document.activeElement;if(n){const i=s(n);if(i)return i}if(c?.isConnected)return c;const o=Array.from(d.keys()).find(i=>i.isConnected);if(o)return o;const r=document.querySelector(h);return r||document.querySelector('[contenteditable="true"]')}function S(){for(const t of d.keys())t.isConnected||(d.delete(t),c===t&&(c=null))}function f(t){S();let e=d.get(t);return e||(e={undoStack:[],redoStack:[]},d.set(t,e)),e}function a(t){t&&t.dispatchEvent(new Event("input",{bubbles:!0}))}function l(t,e){if(!t)return;const n=f(t);n.undoStack.push(e),n.redoStack.length=0,n.undoStack.length>M&&n.undoStack.splice(0,n.undoStack.length-M),c=t}function A(t,e="undo"){if(S(),t?.isConnected)return t;const n=p();if(n?.isConnected)return n;if(c?.isConnected)return c;const o=r=>e==="undo"?r.undoStack.length>0:r.redoStack.length>0;for(const[r,i]of d.entries())if(r.isConnected&&o(i))return r;return null}function g(t){const e={};for(const r of t.getAttributeNames()){const i=t.getAttribute(r);i!==null&&(e[r]=i)}const n=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement,o=t instanceof HTMLInputElement;return{attributes:e,innerHTML:t.innerHTML,value:n?t.value:null,checked:o?t.checked:null}}function w(t,e){const n=new Set(t.getAttributeNames());Object.keys(e.attributes).forEach(o=>n.delete(o)),n.forEach(o=>t.removeAttribute(o)),Object.entries(e.attributes).forEach(([o,r])=>{t.setAttribute(o,r)}),t.innerHTML!==e.innerHTML&&(t.innerHTML=e.innerHTML),e.value!==null&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)&&(t.value=e.value),e.checked!==null&&t instanceof HTMLInputElement&&(t.checked=e.checked)}function u(t,e){if(m[t]=e,typeof window>"u")return;const n=window.registerEditorCommand;typeof n=="function"?n(t,e):(window.registerEditorCommand=(o,r)=>{m[o]=r},window.registerEditorCommand(t,e))}const H=(t,...e)=>{const n=m[t];return n?n(...e):!1};function E(){y||typeof window>"u"||(y=!0,window.execEditorCommand||(window.execEditorCommand=H),window.executeEditorCommand||(window.executeEditorCommand=H),u("undo",L),u("redo",v),u("setAttribute",k),u("setText",x),u("autoFixA11y",D),u("recordDomTransaction",O),u("undoDom",b),u("redoDom",C))}const L=()=>{const t=p();return b(t??void 0)},v=()=>{const t=p();return C(t??void 0)},k=(t,e,n)=>{if(!(t instanceof HTMLElement))return;const o=s(t),r=t.hasAttribute(e),i=t.getAttribute(e);t.setAttribute(e,n),l(o,{undo:()=>{t.isConnected&&(r&&i!==null?t.setAttribute(e,i):t.removeAttribute(e))},redo:()=>{t.isConnected&&t.setAttribute(e,n)}}),a(o)},x=(t,e)=>{if(!(t instanceof HTMLElement))return;const n=s(t),o=t.textContent??"";t.textContent=e,l(n,{undo:()=>{t.isConnected&&(t.textContent=o)},redo:()=>{t.isConnected&&(t.textContent=e)}}),a(n)},D=t=>{const e=t?.element;if(!(e instanceof HTMLElement))return;const n=s(e),o=window.a11yRuleRegistry?.find(_=>_.id===t.rule);if(!o||typeof o.fix!="function")return;const r=g(e);o.fix(t);const i=g(e);l(n,{undo:()=>{e.isConnected&&w(e,r)},redo:()=>{e.isConnected&&w(e,i)}}),a(n)},O=(t,e,n)=>{if(!(t instanceof HTMLElement))return!1;const o=typeof n=="string"?n:t.innerHTML;if(e===o)return!1;const r=f(t).undoStack.slice(-1)[0];return r&&r.beforeHTML===e&&r.afterHTML===o?!1:(l(t,{beforeHTML:e,afterHTML:o,undo:()=>{t.isConnected&&(t.innerHTML=e)},redo:()=>{t.isConnected&&(t.innerHTML=o)}}),!0)},b=t=>{const e=A(t,"undo");if(!e)return!1;const n=f(e),o=n.undoStack.pop();return o?(o.undo(),n.redoStack.push(o),c=e,a(e),!0):!1},C=t=>{const e=A(t,"redo");if(!e)return!1;const n=f(e),o=n.redoStack.pop();return o?(o.redo(),n.undoStack.push(o),c=e,a(e),!0):!1};typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",E,{once:!0}):E());const z=()=>(E(),{name:"history",toolbar:[{label:"Undo",command:"undo",type:"button",icon:'<svg width="24" height="24" focusable="false"><path d="M6.4 8H12c3.7 0 6.2 2 6.8 5.1.6 2.7-.4 5.6-2.3 6.8a1 1 0 0 1-1-1.8c1.1-.6 1.8-2.7 1.4-4.6-.5-2.1-2.1-3.5-4.9-3.5H6.4l3.3 3.3a1 1 0 1 1-1.4 1.4l-5-5a1 1 0 0 1 0-1.4l5-5a1 1 0 0 1 1.4 1.4L6.4 8Z" fill-rule="nonzero"></path></svg>',shortcut:"Mod-z"},{label:"Redo",command:"redo",type:"button",icon:'<svg width="24" height="24" focusable="false"><path d="M17.6 10H12c-2.8 0-4.4 1.4-4.9 3.5-.4 2 .3 4 1.4 4.6a1 1 0 1 1-1 1.8c-2-1.2-2.9-4.1-2.3-6.8.6-3 3-5.1 6.8-5.1h5.6l-3.3-3.3a1 1 0 1 1 1.4-1.4l5 5a1 1 0 0 1 0 1.4l-5 5a1 1 0 0 1-1.4-1.4l3.3-3.3Z" fill-rule="nonzero"></path></svg>',shortcut:"Mod-y"}],commands:{undo:L,redo:v,setAttribute:k,setText:x,autoFixA11y:D,recordDomTransaction:O,undoDom:b,redoDom:C},keymap:{"Mod-z":"undo","Mod-Z":"undo","Mod-y":"redo","Mod-Y":"redo","Mod-Shift-z":"redo","Mod-Shift-Z":"redo"}});exports.HistoryPlugin=z;
@@ -1,6 +1,6 @@
1
1
  const H = ".rte-content, .editora-content";
2
- const b = "__editoraCommandEditorRoot", d = /* @__PURE__ */ new Map(), l = {};
3
- let T = !1, c = null;
2
+ const T = "__editoraCommandEditorRoot", d = /* @__PURE__ */ new Map(), m = {};
3
+ let b = !1, c = null;
4
4
  function _(t) {
5
5
  if (!t) return null;
6
6
  const e = t.querySelector('[contenteditable="true"]');
@@ -8,9 +8,9 @@ function _(t) {
8
8
  }
9
9
  function R() {
10
10
  if (typeof window > "u") return null;
11
- const t = window[b];
11
+ const t = window[T];
12
12
  if (!(t instanceof HTMLElement)) return null;
13
- window[b] = null;
13
+ window[T] = null;
14
14
  const e = t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || (t.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") ? t : null);
15
15
  if (e) {
16
16
  const o = _(e);
@@ -37,7 +37,7 @@ function s(t) {
37
37
  i.getAttribute("contenteditable") === "true" && (r = i), i = i.parentElement;
38
38
  return r;
39
39
  }
40
- function E() {
40
+ function p() {
41
41
  const t = R();
42
42
  if (t && document.contains(t))
43
43
  return t;
@@ -61,7 +61,7 @@ function h() {
61
61
  for (const t of d.keys())
62
62
  t.isConnected || (d.delete(t), c === t && (c = null));
63
63
  }
64
- function p(t) {
64
+ function f(t) {
65
65
  h();
66
66
  let e = d.get(t);
67
67
  return e || (e = { undoStack: [], redoStack: [] }, d.set(t, e)), e;
@@ -69,15 +69,15 @@ function p(t) {
69
69
  function a(t) {
70
70
  t && t.dispatchEvent(new Event("input", { bubbles: !0 }));
71
71
  }
72
- function f(t, e) {
72
+ function l(t, e) {
73
73
  if (!t) return;
74
- const n = p(t);
74
+ const n = f(t);
75
75
  n.undoStack.push(e), n.redoStack.length = 0, n.undoStack.length > 100 && n.undoStack.splice(0, n.undoStack.length - 100), c = t;
76
76
  }
77
77
  function S(t, e = "undo") {
78
78
  if (h(), t?.isConnected)
79
79
  return t;
80
- const n = E();
80
+ const n = p();
81
81
  if (n?.isConnected)
82
82
  return n;
83
83
  if (c?.isConnected)
@@ -109,29 +109,29 @@ function g(t, e) {
109
109
  }), t.innerHTML !== e.innerHTML && (t.innerHTML = e.innerHTML), e.value !== null && (t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement || t instanceof HTMLSelectElement) && (t.value = e.value), e.checked !== null && t instanceof HTMLInputElement && (t.checked = e.checked);
110
110
  }
111
111
  function u(t, e) {
112
- if (l[t] = e, typeof window > "u") return;
112
+ if (m[t] = e, typeof window > "u") return;
113
113
  const n = window.registerEditorCommand;
114
114
  typeof n == "function" ? n(t, e) : (window.registerEditorCommand = (o, r) => {
115
- l[o] = r;
115
+ m[o] = r;
116
116
  }, window.registerEditorCommand(t, e));
117
117
  }
118
118
  const w = (t, ...e) => {
119
- const n = l[t];
119
+ const n = m[t];
120
120
  return n ? n(...e) : !1;
121
121
  };
122
- function m() {
123
- T || typeof window > "u" || (T = !0, window.execEditorCommand || (window.execEditorCommand = w), window.executeEditorCommand || (window.executeEditorCommand = w), u("undo", A), u("redo", L), u("setAttribute", v), u("setText", x), u("autoFixA11y", k), u("recordDomTransaction", O), u("undoDom", C), u("redoDom", M));
122
+ function E() {
123
+ b || typeof window > "u" || (b = !0, window.execEditorCommand || (window.execEditorCommand = w), window.executeEditorCommand || (window.executeEditorCommand = w), u("undo", A), u("redo", L), u("setAttribute", k), u("setText", v), u("autoFixA11y", x), u("recordDomTransaction", O), u("undoDom", M), u("redoDom", C));
124
124
  }
125
125
  const A = () => {
126
- const t = E();
127
- return C(t ?? void 0);
128
- }, L = () => {
129
- const t = E();
126
+ const t = p();
130
127
  return M(t ?? void 0);
131
- }, v = (t, e, n) => {
128
+ }, L = () => {
129
+ const t = p();
130
+ return C(t ?? void 0);
131
+ }, k = (t, e, n) => {
132
132
  if (!(t instanceof HTMLElement)) return;
133
133
  const o = s(t), r = t.hasAttribute(e), i = t.getAttribute(e);
134
- t.setAttribute(e, n), f(o, {
134
+ t.setAttribute(e, n), l(o, {
135
135
  undo: () => {
136
136
  t.isConnected && (r && i !== null ? t.setAttribute(e, i) : t.removeAttribute(e));
137
137
  },
@@ -139,10 +139,10 @@ const A = () => {
139
139
  t.isConnected && t.setAttribute(e, n);
140
140
  }
141
141
  }), a(o);
142
- }, x = (t, e) => {
142
+ }, v = (t, e) => {
143
143
  if (!(t instanceof HTMLElement)) return;
144
144
  const n = s(t), o = t.textContent ?? "";
145
- t.textContent = e, f(n, {
145
+ t.textContent = e, l(n, {
146
146
  undo: () => {
147
147
  t.isConnected && (t.textContent = o);
148
148
  },
@@ -150,7 +150,7 @@ const A = () => {
150
150
  t.isConnected && (t.textContent = e);
151
151
  }
152
152
  }), a(n);
153
- }, k = (t) => {
153
+ }, x = (t) => {
154
154
  const e = t?.element;
155
155
  if (!(e instanceof HTMLElement)) return;
156
156
  const n = s(e), o = window.a11yRuleRegistry?.find((D) => D.id === t.rule);
@@ -158,7 +158,7 @@ const A = () => {
158
158
  const r = y(e);
159
159
  o.fix(t);
160
160
  const i = y(e);
161
- f(n, {
161
+ l(n, {
162
162
  undo: () => {
163
163
  e.isConnected && g(e, r);
164
164
  },
@@ -169,7 +169,11 @@ const A = () => {
169
169
  }, O = (t, e, n) => {
170
170
  if (!(t instanceof HTMLElement)) return !1;
171
171
  const o = typeof n == "string" ? n : t.innerHTML;
172
- return e === o ? !1 : (f(t, {
172
+ if (e === o) return !1;
173
+ const r = f(t).undoStack.slice(-1)[0];
174
+ return r && r.beforeHTML === e && r.afterHTML === o ? !1 : (l(t, {
175
+ beforeHTML: e,
176
+ afterHTML: o,
173
177
  undo: () => {
174
178
  t.isConnected && (t.innerHTML = e);
175
179
  },
@@ -177,19 +181,19 @@ const A = () => {
177
181
  t.isConnected && (t.innerHTML = o);
178
182
  }
179
183
  }), !0);
180
- }, C = (t) => {
184
+ }, M = (t) => {
181
185
  const e = S(t, "undo");
182
186
  if (!e) return !1;
183
- const n = p(e), o = n.undoStack.pop();
187
+ const n = f(e), o = n.undoStack.pop();
184
188
  return o ? (o.undo(), n.redoStack.push(o), c = e, a(e), !0) : !1;
185
- }, M = (t) => {
189
+ }, C = (t) => {
186
190
  const e = S(t, "redo");
187
191
  if (!e) return !1;
188
- const n = p(e), o = n.redoStack.pop();
192
+ const n = f(e), o = n.redoStack.pop();
189
193
  return o ? (o.redo(), n.undoStack.push(o), c = e, a(e), !0) : !1;
190
194
  };
191
- typeof window < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", m, { once: !0 }) : m());
192
- const N = () => (m(), {
195
+ typeof window < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", E, { once: !0 }) : E());
196
+ const N = () => (E(), {
193
197
  name: "history",
194
198
  toolbar: [
195
199
  {
@@ -210,12 +214,12 @@ const N = () => (m(), {
210
214
  commands: {
211
215
  undo: A,
212
216
  redo: L,
213
- setAttribute: v,
214
- setText: x,
215
- autoFixA11y: k,
217
+ setAttribute: k,
218
+ setText: v,
219
+ autoFixA11y: x,
216
220
  recordDomTransaction: O,
217
- undoDom: C,
218
- redoDom: M
221
+ undoDom: M,
222
+ redoDom: C
219
223
  },
220
224
  keymap: {
221
225
  "Mod-z": "undo",
@@ -0,0 +1,14 @@
1
+ function t(n, r, o = n?.innerHTML) {
2
+ if (!n || typeof o != "string" || r === o) return !1;
3
+ try {
4
+ if (typeof window.execEditorCommand == "function")
5
+ return window.execEditorCommand("recordDomTransaction", n, r, o) !== !1;
6
+ if (typeof window.executeEditorCommand == "function")
7
+ return window.executeEditorCommand("recordDomTransaction", { editor: n, beforeHTML: r, afterHTML: o }) !== !1;
8
+ } catch {
9
+ }
10
+ return !1;
11
+ }
12
+ export {
13
+ t as r
14
+ };
@@ -0,0 +1 @@
1
+ "use strict";function t(n,r,o=n?.innerHTML){if(!n||typeof o!="string"||r===o)return!1;try{if(typeof window.execEditorCommand=="function")return window.execEditorCommand("recordDomTransaction",n,r,o)!==!1;if(typeof window.executeEditorCommand=="function")return window.executeEditorCommand("recordDomTransaction",{editor:n,beforeHTML:r,afterHTML:o})!==!1}catch{}return!1}exports.recordDomHistory=t;
@@ -0,0 +1,194 @@
1
+ import { getGlobalApiConfig as s, buildApiUrl as p, getGlobalApiHeaders as m } from "./shared-config.esm.js";
2
+ const d = "rte-document-manager-styles", f = `
3
+ .rte-toolbar-button[data-busy="true"],
4
+ .rte-docmgr-toolbar-button[data-busy="true"] {
5
+ position: relative;
6
+ pointer-events: none;
7
+ cursor: wait;
8
+ }
9
+ .rte-toolbar-button[data-busy="true"] > *,
10
+ .rte-docmgr-toolbar-button[data-busy="true"] > * {
11
+ visibility: hidden;
12
+ }
13
+ .rte-toolbar-button[data-busy="true"]::after,
14
+ .rte-docmgr-toolbar-button[data-busy="true"]::after {
15
+ content: "";
16
+ position: absolute;
17
+ top: 50%;
18
+ left: 50%;
19
+ width: 14px;
20
+ height: 14px;
21
+ margin: -7px 0 0 -7px;
22
+ border: 2px solid currentColor;
23
+ border-right-color: transparent;
24
+ border-radius: 50%;
25
+ opacity: 0.7;
26
+ animation: rte-docmgr-spin 0.7s linear infinite;
27
+ }
28
+ @keyframes rte-docmgr-spin {
29
+ to { transform: rotate(360deg); }
30
+ }
31
+ `;
32
+ function b() {
33
+ if (typeof document > "u" || document.getElementById(d)) return;
34
+ const n = document.createElement("style");
35
+ n.id = d, n.textContent = f, document.head.appendChild(n);
36
+ }
37
+ async function c(n) {
38
+ b();
39
+ const t = typeof window < "u" ? window.__editoraLastCommandButton : null;
40
+ t && (t.disabled = !0, t.setAttribute("data-busy", "true"), t.setAttribute("aria-busy", "true"));
41
+ try {
42
+ return await n();
43
+ } finally {
44
+ t && (t.disabled = !1, t.removeAttribute("data-busy"), t.removeAttribute("aria-busy"));
45
+ }
46
+ }
47
+ const v = () => ({
48
+ name: "document-manager",
49
+ toolbar: [
50
+ {
51
+ label: "Import Word",
52
+ command: "importWord",
53
+ icon: '<svg width="24" height="24" focusable="false"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3h7.4L19 7.6V15h-2V9h-4V5H5c0-1.1.9-2 2-2Z"></path><path d="M9.5 7A1.5 1.5 0 0 1 11 8.4v7.1A1.5 1.5 0 0 1 9.6 17H2.5A1.5 1.5 0 0 1 1 15.6V8.5A1.5 1.5 0 0 1 2.4 7h7.1Zm-1 2.8-1 2.6-1-2.5v-.1a.6.6 0 0 0-1 0l-.1.1-.9 2.5-1-2.5v-.1a.6.6 0 0 0-1 .4v.1l1.5 4v.1a.6.6 0 0 0 1 0v-.1l1-2.5.9 2.5v.1a.6.6 0 0 0 1 0H8l1.6-4v-.2a.6.6 0 0 0-1.1-.4Z"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M11.4 18.2a1 1 0 0 0 1.2 1.6l1.4-1V22a1 1 0 1 0 2 0v-3.1l1.4 1a1 1 0 0 0 1.2-1.7L15 15.8l-3.6 2.4Z"></path></svg>',
54
+ type: "button"
55
+ },
56
+ {
57
+ label: "Export Word",
58
+ command: "exportWord",
59
+ icon: '<svg width="24" height="24" focusable="false"><path d="M9.5 7A1.5 1.5 0 0 1 11 8.4v7.1A1.5 1.5 0 0 1 9.6 17H2.5A1.5 1.5 0 0 1 1 15.6V8.5A1.5 1.5 0 0 1 2.4 7h7.1Zm-1 2.8-1 2.6-1-2.5v-.1a.6.6 0 0 0-1 0l-.1.1-.9 2.5-1-2.5v-.1a.6.6 0 0 0-1 .4v.1l1.5 4v.1a.6.6 0 0 0 1 0v-.1l1-2.5.9 2.5v.1a.6.6 0 0 0 1 0H8l1.6-4v-.2a.6.6 0 0 0-1.1-.4Z"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3h7.4L19 7.6V17h-2V9h-4V5H7v3H5V5c0-1.1.9-2 2-2ZM15 17a1 1 0 1 0-2 0v3.1l-1.4-1a1 1 0 1 0-1.2 1.7l3.6 2.4 3.6-2.4a1 1 0 0 0-1.2-1.6l-1.4 1V17Z"></path></svg>',
60
+ type: "button"
61
+ },
62
+ {
63
+ label: "Export PDF",
64
+ command: "exportPdf",
65
+ icon: '<svg width="24" height="24" focusable="false"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3h7.4L19 7.6V17h-2V9h-4V5H7v3H5V5c0-1.1.9-2 2-2Z"></path><path d="M2.6 15.2v-1.9h1c.6 0 1-.2 1.4-.5.3-.3.5-.7.5-1.2s-.2-.9-.5-1.2a2 2 0 0 0-1.3-.4H1v5.2h1.6Zm.4-3h-.4v-1.1h.5l.6.1.2.5c0 .1 0 .3-.2.4l-.7.1Zm5.7 3 1-.1c.3 0 .5-.2.7-.4l.5-.8c.2-.3.2-.7.2-1.3v-1l-.5-.8c-.2-.3-.4-.5-.7-.6L8.7 10H6.3v5.2h2.4Zm-.4-1.1H8v-3h.4c.5 0 .8.2 1 .4l.2 1.1-.1 1-.3.3-.8.2Zm5.3 1.2V13h2v-1h-2v-1H16V10h-4v5.2h1.6Z"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M15 17a1 1 0 1 0-2 0v3.1l-1.4-1a1 1 0 1 0-1.2 1.7l3.6 2.4 3.6-2.4a1 1 0 0 0-1.2-1.6l-1.4 1V17Z"></path></svg>',
66
+ type: "button"
67
+ }
68
+ ],
69
+ commands: {
70
+ importWord: () => {
71
+ const n = () => {
72
+ const o = window.getSelection();
73
+ if (o && o.rangeCount > 0) {
74
+ let a = o.getRangeAt(0).startContainer;
75
+ for (; a && a !== document.body; ) {
76
+ if (a.nodeType === Node.ELEMENT_NODE) {
77
+ const i = a;
78
+ if (i.getAttribute("contenteditable") === "true")
79
+ return i;
80
+ }
81
+ a = a.parentNode;
82
+ }
83
+ }
84
+ const r = document.activeElement;
85
+ if (r?.getAttribute("contenteditable") === "true")
86
+ return r;
87
+ const e = r?.closest('[contenteditable="true"]');
88
+ return e || document.querySelector('[contenteditable="true"]');
89
+ }, t = document.createElement("input");
90
+ return t.type = "file", t.accept = ".docx", t.onchange = async (o) => {
91
+ const r = o.target.files?.[0];
92
+ if (r)
93
+ try {
94
+ const e = n();
95
+ if (e) {
96
+ const { importFromWord: a } = await import("./documentManager-yjRBab4v.mjs"), i = await a(r);
97
+ e.innerHTML = i, e.dispatchEvent(new Event("input", { bubbles: !0 }));
98
+ }
99
+ } catch (e) {
100
+ console.error("Import failed:", e), alert("Failed to import Word document. Please check the console for details.");
101
+ }
102
+ }, t.click(), !0;
103
+ },
104
+ exportWord: async () => {
105
+ const n = () => {
106
+ const t = window.getSelection();
107
+ if (t && t.rangeCount > 0) {
108
+ let e = t.getRangeAt(0).startContainer;
109
+ for (; e && e !== document.body; ) {
110
+ if (e.nodeType === Node.ELEMENT_NODE && e.getAttribute("contenteditable") === "true")
111
+ return e;
112
+ e = e.parentNode;
113
+ }
114
+ }
115
+ const o = document.activeElement;
116
+ return o?.getAttribute("contenteditable") === "true" ? o : o?.closest('[contenteditable="true"]') || document.querySelector('[contenteditable="true"]');
117
+ };
118
+ return c(async () => {
119
+ try {
120
+ const t = n();
121
+ if (t) {
122
+ const o = t.innerHTML, { exportToWord: r } = await import("./documentManager-yjRBab4v.mjs");
123
+ await r(o, "document.docx");
124
+ }
125
+ return !0;
126
+ } catch (t) {
127
+ return console.error("Export failed:", t), alert("Failed to export to Word. Please check the console for details."), !1;
128
+ }
129
+ });
130
+ },
131
+ exportPdf: async () => {
132
+ const n = () => {
133
+ const t = window.getSelection();
134
+ if (t && t.rangeCount > 0) {
135
+ let e = t.getRangeAt(0).startContainer;
136
+ for (; e && e !== document.body; ) {
137
+ if (e.nodeType === Node.ELEMENT_NODE && e.getAttribute("contenteditable") === "true")
138
+ return e;
139
+ e = e.parentNode;
140
+ }
141
+ }
142
+ const o = document.activeElement;
143
+ return o?.getAttribute("contenteditable") === "true" ? o : o?.closest('[contenteditable="true"]') || document.querySelector('[contenteditable="true"]');
144
+ };
145
+ return c(async () => {
146
+ try {
147
+ const t = n();
148
+ if (t) {
149
+ const o = t.innerHTML, { exportToPdf: r } = await import("./documentManager-yjRBab4v.mjs");
150
+ await r(o, "document.pdf", t);
151
+ } else
152
+ console.error("PDF Export: No editor element found"), alert("No active editor found. Please click in the editor area first.");
153
+ return !0;
154
+ } catch (t) {
155
+ return console.error("PDF Export: Export failed:", t), alert("Failed to export to PDF. Please check the console for details."), !1;
156
+ }
157
+ });
158
+ }
159
+ },
160
+ keymap: {}
161
+ }), h = {
162
+ apiEndpoints: {
163
+ exportWord: "/documents/export-word"
164
+ },
165
+ headers: {
166
+ // Add default headers if needed (e.g., API key)
167
+ // 'Authorization': 'Bearer YOUR_API_KEY',
168
+ // 'X-API-Key': 'YOUR_API_KEY'
169
+ },
170
+ useClientSideFallback: !0
171
+ // Enable fallback by default
172
+ };
173
+ let l = { ...h };
174
+ function y(n) {
175
+ l = { ...l, ...n };
176
+ }
177
+ function u() {
178
+ return { ...l };
179
+ }
180
+ function E(n) {
181
+ const t = u(), o = s(), r = t.apiUrl || o.apiUrl;
182
+ return p(r, t.apiEndpoints[n]);
183
+ }
184
+ function A() {
185
+ const n = m(), o = u().headers || {};
186
+ return { ...n, ...o };
187
+ }
188
+ export {
189
+ v as D,
190
+ E as a,
191
+ A as b,
192
+ u as g,
193
+ y as s
194
+ };
@@ -0,0 +1,30 @@
1
+ "use strict";const l=require("./shared-config.cjs.js"),u="rte-document-manager-styles",p=`
2
+ .rte-toolbar-button[data-busy="true"],
3
+ .rte-docmgr-toolbar-button[data-busy="true"] {
4
+ position: relative;
5
+ pointer-events: none;
6
+ cursor: wait;
7
+ }
8
+ .rte-toolbar-button[data-busy="true"] > *,
9
+ .rte-docmgr-toolbar-button[data-busy="true"] > * {
10
+ visibility: hidden;
11
+ }
12
+ .rte-toolbar-button[data-busy="true"]::after,
13
+ .rte-docmgr-toolbar-button[data-busy="true"]::after {
14
+ content: "";
15
+ position: absolute;
16
+ top: 50%;
17
+ left: 50%;
18
+ width: 14px;
19
+ height: 14px;
20
+ margin: -7px 0 0 -7px;
21
+ border: 2px solid currentColor;
22
+ border-right-color: transparent;
23
+ border-radius: 50%;
24
+ opacity: 0.7;
25
+ animation: rte-docmgr-spin 0.7s linear infinite;
26
+ }
27
+ @keyframes rte-docmgr-spin {
28
+ to { transform: rotate(360deg); }
29
+ }
30
+ `;function m(){if(typeof document>"u"||document.getElementById(u))return;const n=document.createElement("style");n.id=u,n.textContent=p,document.head.appendChild(n)}async function s(n){m();const e=typeof window<"u"?window.__editoraLastCommandButton:null;e&&(e.disabled=!0,e.setAttribute("data-busy","true"),e.setAttribute("aria-busy","true"));try{return await n()}finally{e&&(e.disabled=!1,e.removeAttribute("data-busy"),e.removeAttribute("aria-busy"))}}const f=()=>({name:"document-manager",toolbar:[{label:"Import Word",command:"importWord",icon:'<svg width="24" height="24" focusable="false"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3h7.4L19 7.6V15h-2V9h-4V5H5c0-1.1.9-2 2-2Z"></path><path d="M9.5 7A1.5 1.5 0 0 1 11 8.4v7.1A1.5 1.5 0 0 1 9.6 17H2.5A1.5 1.5 0 0 1 1 15.6V8.5A1.5 1.5 0 0 1 2.4 7h7.1Zm-1 2.8-1 2.6-1-2.5v-.1a.6.6 0 0 0-1 0l-.1.1-.9 2.5-1-2.5v-.1a.6.6 0 0 0-1 .4v.1l1.5 4v.1a.6.6 0 0 0 1 0v-.1l1-2.5.9 2.5v.1a.6.6 0 0 0 1 0H8l1.6-4v-.2a.6.6 0 0 0-1.1-.4Z"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M11.4 18.2a1 1 0 0 0 1.2 1.6l1.4-1V22a1 1 0 1 0 2 0v-3.1l1.4 1a1 1 0 0 0 1.2-1.7L15 15.8l-3.6 2.4Z"></path></svg>',type:"button"},{label:"Export Word",command:"exportWord",icon:'<svg width="24" height="24" focusable="false"><path d="M9.5 7A1.5 1.5 0 0 1 11 8.4v7.1A1.5 1.5 0 0 1 9.6 17H2.5A1.5 1.5 0 0 1 1 15.6V8.5A1.5 1.5 0 0 1 2.4 7h7.1Zm-1 2.8-1 2.6-1-2.5v-.1a.6.6 0 0 0-1 0l-.1.1-.9 2.5-1-2.5v-.1a.6.6 0 0 0-1 .4v.1l1.5 4v.1a.6.6 0 0 0 1 0v-.1l1-2.5.9 2.5v.1a.6.6 0 0 0 1 0H8l1.6-4v-.2a.6.6 0 0 0-1.1-.4Z"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3h7.4L19 7.6V17h-2V9h-4V5H7v3H5V5c0-1.1.9-2 2-2ZM15 17a1 1 0 1 0-2 0v3.1l-1.4-1a1 1 0 1 0-1.2 1.7l3.6 2.4 3.6-2.4a1 1 0 0 0-1.2-1.6l-1.4 1V17Z"></path></svg>',type:"button"},{label:"Export PDF",command:"exportPdf",icon:'<svg width="24" height="24" focusable="false"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3h7.4L19 7.6V17h-2V9h-4V5H7v3H5V5c0-1.1.9-2 2-2Z"></path><path d="M2.6 15.2v-1.9h1c.6 0 1-.2 1.4-.5.3-.3.5-.7.5-1.2s-.2-.9-.5-1.2a2 2 0 0 0-1.3-.4H1v5.2h1.6Zm.4-3h-.4v-1.1h.5l.6.1.2.5c0 .1 0 .3-.2.4l-.7.1Zm5.7 3 1-.1c.3 0 .5-.2.7-.4l.5-.8c.2-.3.2-.7.2-1.3v-1l-.5-.8c-.2-.3-.4-.5-.7-.6L8.7 10H6.3v5.2h2.4Zm-.4-1.1H8v-3h.4c.5 0 .8.2 1 .4l.2 1.1-.1 1-.3.3-.8.2Zm5.3 1.2V13h2v-1h-2v-1H16V10h-4v5.2h1.6Z"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M15 17a1 1 0 1 0-2 0v3.1l-1.4-1a1 1 0 1 0-1.2 1.7l3.6 2.4 3.6-2.4a1 1 0 0 0-1.2-1.6l-1.4 1V17Z"></path></svg>',type:"button"}],commands:{importWord:()=>{const n=()=>{const o=window.getSelection();if(o&&o.rangeCount>0){let a=o.getRangeAt(0).startContainer;for(;a&&a!==document.body;){if(a.nodeType===Node.ELEMENT_NODE){const i=a;if(i.getAttribute("contenteditable")==="true")return i}a=a.parentNode}}const r=document.activeElement;if(r?.getAttribute("contenteditable")==="true")return r;const t=r?.closest('[contenteditable="true"]');return t||document.querySelector('[contenteditable="true"]')},e=document.createElement("input");return e.type="file",e.accept=".docx",e.onchange=async o=>{const r=o.target.files?.[0];if(r)try{const t=n();if(t){const{importFromWord:a}=await Promise.resolve().then(()=>require("./documentManager-BDz6tovy.js")),i=await a(r);t.innerHTML=i,t.dispatchEvent(new Event("input",{bubbles:!0}))}}catch(t){console.error("Import failed:",t),alert("Failed to import Word document. Please check the console for details.")}},e.click(),!0},exportWord:async()=>{const n=()=>{const e=window.getSelection();if(e&&e.rangeCount>0){let t=e.getRangeAt(0).startContainer;for(;t&&t!==document.body;){if(t.nodeType===Node.ELEMENT_NODE&&t.getAttribute("contenteditable")==="true")return t;t=t.parentNode}}const o=document.activeElement;return o?.getAttribute("contenteditable")==="true"?o:o?.closest('[contenteditable="true"]')||document.querySelector('[contenteditable="true"]')};return s(async()=>{try{const e=n();if(e){const o=e.innerHTML,{exportToWord:r}=await Promise.resolve().then(()=>require("./documentManager-BDz6tovy.js"));await r(o,"document.docx")}return!0}catch(e){return console.error("Export failed:",e),alert("Failed to export to Word. Please check the console for details."),!1}})},exportPdf:async()=>{const n=()=>{const e=window.getSelection();if(e&&e.rangeCount>0){let t=e.getRangeAt(0).startContainer;for(;t&&t!==document.body;){if(t.nodeType===Node.ELEMENT_NODE&&t.getAttribute("contenteditable")==="true")return t;t=t.parentNode}}const o=document.activeElement;return o?.getAttribute("contenteditable")==="true"?o:o?.closest('[contenteditable="true"]')||document.querySelector('[contenteditable="true"]')};return s(async()=>{try{const e=n();if(e){const o=e.innerHTML,{exportToPdf:r}=await Promise.resolve().then(()=>require("./documentManager-BDz6tovy.js"));await r(o,"document.pdf",e)}else console.error("PDF Export: No editor element found"),alert("No active editor found. Please click in the editor area first.");return!0}catch(e){return console.error("PDF Export: Export failed:",e),alert("Failed to export to PDF. Please check the console for details."),!1}})}},keymap:{}}),h={apiEndpoints:{exportWord:"/documents/export-word"},headers:{},useClientSideFallback:!0};let d={...h};function b(n){d={...d,...n}}function c(){return{...d}}function g(n){const e=c(),o=l.getGlobalApiConfig(),r=e.apiUrl||o.apiUrl;return l.buildApiUrl(r,e.apiEndpoints[n])}function v(){const n=l.getGlobalApiHeaders(),o=c().headers||{};return{...n,...o}}exports.DocumentManagerPlugin=f;exports.getApiHeaders=v;exports.getApiUrl=g;exports.getDocumentManagerConfig=c;exports.setDocumentManagerConfig=b;