@editora/plugins 1.0.22 → 1.0.23
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/{CodePlugin.native-D8gGxB8i.mjs → CodePlugin.native-DESvGCrJ.mjs} +61 -53
- package/dist/{CodePlugin.native-CKJo7IFG.js → CodePlugin.native-DJqwsRPZ.js} +11 -11
- package/dist/a11y-checker.cjs.js +3 -3
- package/dist/a11y-checker.esm.js +6 -4
- package/dist/anchor.cjs.js +4 -4
- package/dist/anchor.esm.js +19 -18
- package/dist/anchoredPopover-BNJ8e7j-.mjs +128 -0
- package/dist/anchoredPopover-Cygmit_o.js +1 -0
- package/dist/approval-workflow.cjs.js +7 -7
- package/dist/approval-workflow.esm.js +55 -54
- package/dist/background-color.cjs.js +2 -2
- package/dist/background-color.esm.js +72 -67
- package/dist/blocks-library.cjs.js +18 -19
- package/dist/blocks-library.esm.js +41 -42
- package/dist/citations.cjs.js +4 -4
- package/dist/citations.esm.js +50 -50
- package/dist/code-sample.cjs.js +10 -10
- package/dist/code-sample.esm.js +4 -4
- package/dist/code.cjs.js +1 -1
- package/dist/code.esm.js +1 -1
- package/dist/comments.cjs.js +23 -11
- package/dist/comments.esm.js +167 -149
- package/dist/conditional-content.cjs.js +2 -2
- package/dist/conditional-content.esm.js +2 -2
- package/dist/confirmDialog-6BPaNPis.mjs +106 -0
- package/dist/confirmDialog-C4UWENes.js +46 -0
- package/dist/content-rules.cjs.js +6 -6
- package/dist/content-rules.esm.js +51 -51
- package/dist/data-binding.cjs.js +2 -2
- package/dist/data-binding.esm.js +2 -2
- package/dist/dialogHelpers-BbwpIXD9.mjs +183 -0
- package/dist/dialogHelpers-BxSQ7A6M.js +12 -0
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +1 -1
- package/dist/{documentManager-BL98a7YZ.mjs → documentManager-BFjGIeI8.mjs} +793 -781
- package/dist/{documentManager-r8t7yZEd.js → documentManager-C9d17K5W.js} +10 -10
- package/dist/embed-iframe.cjs.js +6 -6
- package/dist/embed-iframe.esm.js +6 -6
- package/dist/emojis.cjs.js +5 -5
- package/dist/emojis.esm.js +3 -3
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +1 -1
- package/dist/format-painter.cjs.js +1 -1
- package/dist/format-painter.esm.js +172 -151
- package/dist/heading.cjs.js +1 -1
- package/dist/heading.esm.js +96 -83
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +176 -97
- package/dist/{index-D5xugkYA.js → index-CtR8olYy.js} +2 -2
- package/dist/{index-B-VitI3v.mjs → index-Du_Ljqfz.mjs} +36 -35
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/katex-Cc3-mvOY.js +257 -0
- package/dist/katex-DoRnZ_sp.mjs +11682 -0
- package/dist/katex.min--Ws3c9be.mjs +5 -0
- package/dist/katex.min-Dk2VscxB.js +2 -0
- package/dist/link.cjs.js +3 -3
- package/dist/link.esm.js +3 -3
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +140 -52
- package/dist/math.cjs.js +14 -14
- package/dist/math.esm.js +149 -136
- package/dist/media-manager.cjs.js +46 -46
- package/dist/media-manager.esm.js +320 -264
- package/dist/mentions.cjs.js +12 -12
- package/dist/mentions.esm.js +149 -143
- package/dist/merge-tag.cjs.js +5 -3
- package/dist/merge-tag.esm.js +5 -3
- package/dist/notify-BkbzMopb.js +32 -0
- package/dist/notify-zOp-mUOJ.mjs +59 -0
- package/dist/pii-redaction.cjs.js +1 -1
- package/dist/pii-redaction.esm.js +1 -1
- package/dist/preview.cjs.js +1 -1
- package/dist/preview.esm.js +1 -1
- package/dist/shared-config.cjs.js +1 -1
- package/dist/shared-config.esm.js +14 -14
- package/dist/slash-commands.cjs.js +5 -5
- package/dist/slash-commands.esm.js +259 -236
- package/dist/smart-paste.cjs.js +1 -1
- package/dist/smart-paste.esm.js +1 -1
- package/dist/special-characters.cjs.js +3 -3
- package/dist/special-characters.esm.js +3 -3
- package/dist/spell-check.cjs.js +9 -9
- package/dist/spell-check.esm.js +288 -251
- package/dist/table.cjs.js +14 -14
- package/dist/table.esm.js +175 -154
- package/dist/template.cjs.js +5 -3
- package/dist/template.esm.js +15 -13
- package/dist/text-color.cjs.js +4 -4
- package/dist/text-color.esm.js +38 -34
- package/dist/translation-workflow.cjs.js +9 -9
- package/dist/translation-workflow.esm.js +98 -95
- package/dist/version-diff.cjs.js +4 -4
- package/dist/version-diff.esm.js +36 -36
- package/package.json +6 -5
- package/dist/anchoredPopover-Bg-ey7Yo.js +0 -1
- package/dist/anchoredPopover-D_JbjvdA.mjs +0 -111
- package/dist/dialogHelpers-5d5BuOCW.mjs +0 -39
- package/dist/dialogHelpers-zU6zpMIA.js +0 -12
package/dist/table.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const A=require("./editorContainerHelpers-CFbfiOJI.js");let u=null,h=null,V=null,B=null,N=null,D=null,q=null;const H='[data-theme="dark"], .dark, .editora-theme-dark';let k=!1,y=null,P=0,O=0,T=!1,_=0,W=0,X=0,K=0;const $=new Set(["DIV","P","BLOCKQUOTE","PRE","H1","H2","H3","H4","H5","H6","LI","TD","TH"]);function F(e,t){let n=e;for(;n&&n!==t;){if(n.nodeType===Node.ELEMENT_NODE&&$.has(n.tagName))return n;n=n.parentNode}return null}function j(e){const t=e.parentElement;if(t&&t.classList.contains("rte-table-wrapper"))return t;const n=document.createElement("div");return n.className="rte-table-wrapper",t?.insertBefore(n,e),n.appendChild(e),n}const ee=()=>{const e=A.findEditorContainerFromSelection(),t=A.getContentElement(e);if(!t)return alert("Please place your cursor in the editor before inserting a table"),!1;const n=window.getSelection();if(!n||n.rangeCount===0)return;const o=n.getRangeAt(0),l=document.createElement("table");l.className="rte-table";const r=document.createElement("thead"),a=document.createElement("tr");for(let m=0;m<3;m++){const g=document.createElement("th"),w=document.createElement("p");w.appendChild(document.createElement("br")),g.appendChild(w),a.appendChild(g)}r.appendChild(a);const i=document.createElement("tbody");for(let m=0;m<2;m++){const g=document.createElement("tr");for(let w=0;w<3;w++){const x=document.createElement("td"),L=document.createElement("p");L.appendChild(document.createElement("br")),x.appendChild(L),g.appendChild(x)}i.appendChild(g)}l.appendChild(r),l.appendChild(i);const b=j(l),d=(m,g,w)=>{if(m!==t)return m;const x=w?g-1:g;return t.childNodes[Math.min(Math.max(x,0),t.childNodes.length-1)]||null},s=d(o.endContainer,o.endOffset,!0),c=d(o.startContainer,o.startOffset,!1),C=s&&F(s,t)||c&&F(c,t);C&&C.parentNode?C.parentNode.insertBefore(b,C.nextSibling):(o.collapse(!1),o.insertNode(b));const S=l.querySelector("th p");if(S){const m=document.createRange();m.setStart(S,0),m.collapse(!0),n.removeAllRanges(),n.addRange(m)}t.focus()},te=()=>{const e=f();if(!e)return;const{table:t,rowIndex:n}=e,o=document.createElement("tr"),l=t.rows[0]?.cells.length||0;for(let a=0;a<l;a++){const i=document.createElement("td"),b=document.createElement("p");b.innerHTML="<br>",i.appendChild(b),o.appendChild(i)}const r=t.rows[n];r&&r.parentElement?r.parentElement.insertBefore(o,r):t.appendChild(o),p()},ne=()=>{const e=f();if(!e)return;const{table:t,rowIndex:n}=e,o=document.createElement("tr"),l=t.rows[0]?.cells.length||0;for(let r=0;r<l;r++){const a=document.createElement("td"),i=document.createElement("p");i.innerHTML="<br>",a.appendChild(i),o.appendChild(a)}if(n>=t.rows.length-1){const r=t.rows[t.rows.length-1];r&&r.parentElement?r.parentElement.appendChild(o):t.appendChild(o)}else{const r=t.rows[n+1];r.parentElement?.insertBefore(o,r)}p()},oe=()=>{const e=f();if(!e)return;const{table:t,colIndex:n}=e;for(let o=0;o<t.rows.length;o++){const l=t.rows[o],r=document.createElement("td"),a=document.createElement("p");a.innerHTML="<br>",r.appendChild(a),n===0?l.insertBefore(r,l.cells[0]):l.insertBefore(r,l.cells[n])}p()},re=()=>{const e=f();if(!e)return;const{table:t,colIndex:n}=e;for(let o=0;o<t.rows.length;o++){const l=t.rows[o],r=document.createElement("td"),a=document.createElement("p");a.innerHTML="<br>",r.appendChild(a),n>=l.cells.length-1?l.appendChild(r):l.insertBefore(r,l.cells[n+1])}p()},le=()=>{const e=f();if(!e||e.rowCount<=1)return;const{table:t,rowIndex:n,colIndex:o}=e;t.deleteRow(n),Q(t,n,o),p()},ae=()=>{const e=f();if(!e||e.cellCount<=1)return;const{table:t,rowIndex:n,colIndex:o}=e;for(let l=0;l<t.rows.length;l++){const r=t.rows[l];r.cells[o]&&r.deleteCell(o)}Q(t,n,o),p()},ie=()=>{const e=f();if(!e)return;const{table:t,rowIndex:n}=e,o=t.rows[n];if(!o)return;const l=o.parentElement?.tagName.toLowerCase()==="thead",r=t.querySelector("thead");if(l){const a=o.parentElement;if(o===a.rows[a.rows.length-1]){const i=t.querySelector("tbody")||t.appendChild(document.createElement("tbody"));i.insertBefore(o,i.firstChild),a.rows.length===0&&a.remove()}else U(o,"td")}else if(!r||o===t.tBodies[0]?.rows[0]){let a=r;a||(a=document.createElement("thead"),t.insertBefore(a,t.firstChild)),a.appendChild(o)}else U(o,"th");p()};function U(e,t){Array.from(e.cells).forEach(n=>{if(n.tagName.toLowerCase()===t)return;const o=document.createElement(t);o.innerHTML=n.innerHTML;for(let l=0;l<n.attributes.length;l++){const r=n.attributes[l];o.setAttribute(r.name,r.value)}n.parentNode?.replaceChild(o,n)})}const de=()=>{const e=f();if(!e)return;const{table:t,colIndex:n}=e;for(let o=0;o<t.rows.length;o++){const l=t.rows[o].cells[n];if(l){const r=l.tagName.toLowerCase()==="th"?"td":"th",a=document.createElement(r);a.innerHTML=l.innerHTML;for(let i=0;i<l.attributes.length;i++){const b=l.attributes[i];a.setAttribute(b.name,b.value)}l.parentNode?.replaceChild(a,l)}}p()},se=()=>{const e=f();if(!e)return;const t=e.table,n=t.parentElement;n&&n.classList.contains("rte-table-wrapper")?n.remove():t.remove(),document.dispatchEvent(new CustomEvent("tableDeleted"))};function v(e,t){if(!e||!(e instanceof Node))return null;const n=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement;return n?n.closest(t):null}function Y(e){if(!e)return!1;const t=e.closest("[contenteditable]");return!t||t.getAttribute("contenteditable")==="false"?!1:!t.closest('[data-readonly="true"]')}function ce(){const e=window.getSelection(),t=e&&e.rangeCount>0?e.getRangeAt(0).startContainer:null;return v(t,".rte-content")||(h?h.closest(".rte-content"):null)}function ue(e,t,n){const o=window.execEditorCommand||window.executeEditorCommand;if(typeof o=="function")try{o("recordDomTransaction",e,t,n)}catch{}}function G(e){const t=ce();if(t&&!Y(t))return;const n=t?t.innerHTML:"";if(e(),!t)return;const o=t.innerHTML;o!==n&&(ue(t,n,o),t.dispatchEvent(new Event("input",{bubbles:!0})))}function Q(e,t,n){if(!e.isConnected||e.rows.length===0)return;const o=e.rows[Math.min(t,e.rows.length-1)],l=o.cells[Math.min(n,o.cells.length-1)];if(!l)return;const r=document.createRange(),a=l.querySelector("p, div, li")||l;r.selectNodeContents(a),r.collapse(!0);const i=window.getSelection();i?.removeAllRanges(),i?.addRange(r)}const he=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return;const n=e.getRangeAt(0).startContainer;if(!v(n,"table"))return;const o=v(n,"td, th");if(!o)return;const l=o.parentElement;if(!l)return;let r=-1;for(let d=0;d<l.cells.length;d++)if(l.cells[d]===o){r=d;break}if(r===-1||r===l.cells.length-1)return;const a=l.cells[r+1];if(!a)return;const i=(d,s)=>{const c=parseInt(d.getAttribute(s)||"1",10);return Number.isFinite(c)&&c>0?c:1};if(i(o,"rowspan")!==i(a,"rowspan"))return;o.setAttribute("colspan",String(i(o,"colspan")+i(a,"colspan"))),Array.from(a.childNodes).forEach(d=>{o.appendChild(d)}),a.remove(),p()};function f(){const e=window.getSelection();if(!e||e.rangeCount===0)return null;const n=e.getRangeAt(0).startContainer,o=v(n,"table");if(!o)return null;let l=0,r=0;const a=v(n,"td, th");if(a){const i=a.parentElement;for(;i&&i!==o.rows[l]&&(l++,!(l>=o.rows.length)););const b=i;if(b){for(let d=0;d<b.cells.length;d++)if(b.cells[d]===a){r=d;break}}}return{table:o,rowIndex:l,colIndex:r,rowCount:o.rows.length,cellCount:o.rows[0]?.cells.length||0}}function p(){if(!u||!h)return;const e=f();if(!e)return;const t=e.rowCount>1,n=e.cellCount>1;Z(t,n)}function be(){V=()=>{const e=f();e&&Y(e.table)?me(e.table):z()},B=e=>{const t=v(e.target,"table"),n=v(e.target,".table-toolbar");!t&&!n&&z()},N=()=>{z()},D=()=>{h&&u&&u.style.display!=="none"&&M(h)},q=()=>{h&&u&&u.style.display!=="none"&&M(h)},document.addEventListener("selectionchange",V),document.addEventListener("mousedown",B),document.addEventListener("tableDeleted",N),window.addEventListener("scroll",D,!0),window.addEventListener("resize",q)}function M(e){if(!u)return;const t=e.getBoundingClientRect(),n=u.getBoundingClientRect(),o=n.height||40,l=n.width||280,r=10;let a=t.top-o-r,i=t.left+t.width/2-l/2;a<r&&(a=t.bottom+r),i<r&&(i=r);const b=window.innerWidth;i+l>b-r&&(i=b-l-r);const d=window.innerHeight;a+o>d-r&&(a=d-o-r),u.style.top=a+"px",u.style.left=i+"px"}function me(e){h=e,u||(u=pe(),document.body.appendChild(u));const t=!!e.closest(H)||document.body.matches(H)||document.documentElement.matches(H);u.classList.toggle("rte-theme-dark",t),u.style.display="flex",u.style.visibility="hidden",requestAnimationFrame(()=>{M(e),u&&(u.style.visibility="visible")});const n=f();n&&Z(n.rowCount>1,n.cellCount>1),ge(e)}const I=new Set;function J(){I.forEach(e=>{e.style.position==="relative"&&(e.style.removeProperty("position"),e.getAttribute("style")?.trim()||e.removeAttribute("style"))}),I.clear()}function z(){if(u&&(u.style.display="none"),h){h.querySelectorAll(".resize-handle").forEach(o=>o.remove());const t=h.parentElement,n=t?.classList.contains("rte-table-wrapper")?t.querySelector(".table-resize-handle"):h.querySelector(".table-resize-handle");n&&n.remove()}J(),h=null}function Z(e,t){if(!u)return;const n=u.querySelector('[data-action="deleteRow"]'),o=u.querySelector('[data-action="deleteColumn"]');n&&(n.disabled=!e),o&&(o.disabled=!t)}let R=!1;function fe(){if(R||typeof document>"u")return;if(document.getElementById("rte-table-toolbar-styles")){R=!0;return}R=!0;const e=document.createElement("style");e.id="rte-table-toolbar-styles",e.textContent=`
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const $=require("./notify-BkbzMopb.js"),V=require("./editorContainerHelpers-CFbfiOJI.js");let h=null,b=null,B=null,N=null,D=null,q=null,P=null;const H='[data-theme="dark"], .dark, .editora-theme-dark';let E=!1,k=null,O=0,K=0,R=!1,_=0,W=0,X=0,F=0;const ee=new Set(["DIV","P","BLOCKQUOTE","PRE","H1","H2","H3","H4","H5","H6","LI","TD","TH"]);function U(e,t){let n=e;for(;n&&n!==t;){if(n.nodeType===Node.ELEMENT_NODE&&ee.has(n.tagName))return n;n=n.parentNode}return null}function Y(e){const t=e.parentElement;if(t&&t.classList.contains("rte-table-wrapper"))return t;const n=document.createElement("div");return n.className="rte-table-wrapper",t?.insertBefore(n,e),n.appendChild(e),n}const te=()=>{const e=V.findEditorContainerFromSelection(),t=V.getContentElement(e);if(!t)return $.notify("Please place your cursor in the editor before inserting a table"),!1;const n=window.getSelection();if(!n||n.rangeCount===0)return;const o=n.getRangeAt(0),l=document.createElement("table");l.className="rte-table";const r=document.createElement("thead"),a=document.createElement("tr");for(let m=0;m<3;m++){const g=document.createElement("th"),v=document.createElement("p");v.appendChild(document.createElement("br")),g.appendChild(v),a.appendChild(g)}r.appendChild(a);const i=document.createElement("tbody");for(let m=0;m<2;m++){const g=document.createElement("tr");for(let v=0;v<3;v++){const x=document.createElement("td"),A=document.createElement("p");A.appendChild(document.createElement("br")),x.appendChild(A),g.appendChild(x)}i.appendChild(g)}l.appendChild(r),l.appendChild(i);const u=Y(l),d=(m,g,v)=>{if(m!==t)return m;const x=v?g-1:g;return t.childNodes[Math.min(Math.max(x,0),t.childNodes.length-1)]||null},s=d(o.endContainer,o.endOffset,!0),c=d(o.startContainer,o.startOffset,!1),C=s&&U(s,t)||c&&U(c,t);C&&C.parentNode?C.parentNode.insertBefore(u,C.nextSibling):(o.collapse(!1),o.insertNode(u));const L=l.querySelector("th p");if(L){const m=document.createRange();m.setStart(L,0),m.collapse(!0),n.removeAllRanges(),n.addRange(m)}t.focus()},ne=()=>{const e=f();if(!e)return;const{table:t,rowIndex:n}=e,o=document.createElement("tr"),l=t.rows[0]?.cells.length||0;for(let a=0;a<l;a++){const i=document.createElement("td"),u=document.createElement("p");u.innerHTML="<br>",i.appendChild(u),o.appendChild(i)}const r=t.rows[n];r&&r.parentElement?r.parentElement.insertBefore(o,r):t.appendChild(o),p()},oe=()=>{const e=f();if(!e)return;const{table:t,rowIndex:n}=e,o=document.createElement("tr"),l=t.rows[0]?.cells.length||0;for(let r=0;r<l;r++){const a=document.createElement("td"),i=document.createElement("p");i.innerHTML="<br>",a.appendChild(i),o.appendChild(a)}if(n>=t.rows.length-1){const r=t.rows[t.rows.length-1];r&&r.parentElement?r.parentElement.appendChild(o):t.appendChild(o)}else{const r=t.rows[n+1];r.parentElement?.insertBefore(o,r)}p()},re=()=>{const e=f();if(!e)return;const{table:t,colIndex:n}=e;for(let o=0;o<t.rows.length;o++){const l=t.rows[o],r=document.createElement("td"),a=document.createElement("p");a.innerHTML="<br>",r.appendChild(a),n===0?l.insertBefore(r,l.cells[0]):l.insertBefore(r,l.cells[n])}p()},le=()=>{const e=f();if(!e)return;const{table:t,colIndex:n}=e;for(let o=0;o<t.rows.length;o++){const l=t.rows[o],r=document.createElement("td"),a=document.createElement("p");a.innerHTML="<br>",r.appendChild(a),n>=l.cells.length-1?l.appendChild(r):l.insertBefore(r,l.cells[n+1])}p()},ae=()=>{const e=f();if(!e||e.rowCount<=1)return;const{table:t,rowIndex:n,colIndex:o}=e;t.deleteRow(n),Q(t,n,o),p()},ie=()=>{const e=f();if(!e||e.cellCount<=1)return;const{table:t,rowIndex:n,colIndex:o}=e;for(let l=0;l<t.rows.length;l++){const r=t.rows[l];r.cells[o]&&r.deleteCell(o)}Q(t,n,o),p()},de=()=>{const e=f();if(!e)return;const{table:t,rowIndex:n}=e,o=t.rows[n];if(!o)return;const l=o.parentElement?.tagName.toLowerCase()==="thead",r=t.querySelector("thead");if(l){const a=o.parentElement;if(o===a.rows[a.rows.length-1]){const i=t.querySelector("tbody")||t.appendChild(document.createElement("tbody"));i.insertBefore(o,i.firstChild),a.rows.length===0&&a.remove()}else j(o,"td")}else if(!r||o===t.tBodies[0]?.rows[0]){let a=r;a||(a=document.createElement("thead"),t.insertBefore(a,t.firstChild)),a.appendChild(o)}else j(o,"th");p()};function j(e,t){Array.from(e.cells).forEach(n=>{if(n.tagName.toLowerCase()===t)return;const o=document.createElement(t);o.innerHTML=n.innerHTML;for(let l=0;l<n.attributes.length;l++){const r=n.attributes[l];o.setAttribute(r.name,r.value)}n.parentNode?.replaceChild(o,n)})}const se=()=>{const e=f();if(!e)return;const{table:t,colIndex:n}=e;for(let o=0;o<t.rows.length;o++){const l=t.rows[o].cells[n];if(l){const r=l.tagName.toLowerCase()==="th"?"td":"th",a=document.createElement(r);a.innerHTML=l.innerHTML;for(let i=0;i<l.attributes.length;i++){const u=l.attributes[i];a.setAttribute(u.name,u.value)}l.parentNode?.replaceChild(a,l)}}p()},ce=()=>{const e=f();if(!e)return;const t=e.table,n=t.parentElement;n&&n.classList.contains("rte-table-wrapper")?n.remove():t.remove(),document.dispatchEvent(new CustomEvent("tableDeleted"))};function w(e,t){if(!e||!(e instanceof Node))return null;const n=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement;return n?n.closest(t):null}function I(e){if(!e)return!1;const t=e.closest("[contenteditable]");return!t||t.getAttribute("contenteditable")==="false"?!1:!t.closest('[data-readonly="true"]')}function ue(){const e=window.getSelection(),t=e&&e.rangeCount>0?e.getRangeAt(0).startContainer:null;return w(t,".rte-content")||(b?b.closest(".rte-content"):null)}function he(e,t,n){const o=window.execEditorCommand||window.executeEditorCommand;if(typeof o=="function")try{o("recordDomTransaction",e,t,n)}catch{}}function G(e){const t=ue();if(t&&!I(t))return;const n=t?t.innerHTML:"";if(e(),!t)return;const o=t.innerHTML;o!==n&&(he(t,n,o),t.dispatchEvent(new Event("input",{bubbles:!0})))}function Q(e,t,n){if(!e.isConnected||e.rows.length===0)return;const o=e.rows[Math.min(t,e.rows.length-1)],l=o.cells[Math.min(n,o.cells.length-1)];if(!l)return;const r=document.createRange(),a=l.querySelector("p, div, li")||l;r.selectNodeContents(a),r.collapse(!0);const i=window.getSelection();i?.removeAllRanges(),i?.addRange(r)}const be=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return;const n=e.getRangeAt(0).startContainer;if(!w(n,"table"))return;const o=w(n,"td, th");if(!o)return;const l=o.parentElement;if(!l)return;let r=-1;for(let d=0;d<l.cells.length;d++)if(l.cells[d]===o){r=d;break}if(r===-1||r===l.cells.length-1)return;const a=l.cells[r+1];if(!a)return;const i=(d,s)=>{const c=parseInt(d.getAttribute(s)||"1",10);return Number.isFinite(c)&&c>0?c:1};if(i(o,"rowspan")!==i(a,"rowspan"))return;o.setAttribute("colspan",String(i(o,"colspan")+i(a,"colspan"))),Array.from(a.childNodes).forEach(d=>{o.appendChild(d)}),a.remove(),p()};function f(){const e=window.getSelection();if(!e||e.rangeCount===0)return null;const n=e.getRangeAt(0).startContainer,o=w(n,"table");if(!o)return null;let l=0,r=0;const a=w(n,"td, th");if(a){const i=a.parentElement;for(;i&&i!==o.rows[l]&&(l++,!(l>=o.rows.length)););const u=i;if(u){for(let d=0;d<u.cells.length;d++)if(u.cells[d]===a){r=d;break}}}return{table:o,rowIndex:l,colIndex:r,rowCount:o.rows.length,cellCount:o.rows[0]?.cells.length||0}}function p(){if(!h||!b)return;const e=f();if(!e)return;const t=e.rowCount>1,n=e.cellCount>1;Z(t,n)}function me(e){const t=window.getSelection();if(!t)return;const n=document.createRange();(e.textContent??"").trim()===""?(n.selectNodeContents(e.querySelector("p, div")||e),n.collapse(!0)):n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}function fe(e){if(e.key!=="Tab"||e.defaultPrevented||e.ctrlKey||e.metaKey||e.altKey)return;const t=window.getSelection();if(!t||t.rangeCount===0)return;const n=w(t.getRangeAt(0).startContainer,"td, th"),o=n?.closest("table");if(!n||!o||!I(o))return;const l=o.closest("[contenteditable]");if(!l||!(e.target instanceof Node)||!l.contains(e.target))return;const r=Array.from(o.querySelectorAll("th, td")).filter(u=>u.closest("table")===o),a=r.indexOf(n);let i;e.shiftKey?i=r[a-1]:a<r.length-1?i=r[a+1]:(y("addRowBelow"),i=n.parentElement?.nextElementSibling?.querySelector("th, td")),i&&(e.preventDefault(),me(i))}function pe(){B=()=>{const e=f();e&&I(e.table)?ge(e.table):T()},N=e=>{const t=w(e.target,"table"),n=w(e.target,".table-toolbar");!t&&!n&&T()},D=()=>{T()},q=()=>{b&&h&&h.style.display!=="none"&&S(b)},P=()=>{b&&h&&h.style.display!=="none"&&S(b)},document.addEventListener("selectionchange",B),document.addEventListener("keydown",fe),document.addEventListener("mousedown",N),document.addEventListener("tableDeleted",D),window.addEventListener("scroll",q,!0),window.addEventListener("resize",P)}function S(e){if(!h)return;const t=e.getBoundingClientRect(),n=h.getBoundingClientRect(),o=n.height||40,l=n.width||280,r=10;let a=t.top-o-r,i=t.left+t.width/2-l/2;a<r&&(a=t.bottom+r),i<r&&(i=r);const u=window.innerWidth;i+l>u-r&&(i=u-l-r);const d=window.innerHeight;a+o>d-r&&(a=d-o-r),h.style.top=a+"px",h.style.left=i+"px"}function ge(e){b=e,h||(h=ve(),document.body.appendChild(h));const t=!!e.closest(H)||document.body.matches(H)||document.documentElement.matches(H);h.classList.toggle("rte-theme-dark",t),h.style.display="flex",h.style.visibility="hidden",requestAnimationFrame(()=>{S(e),h&&(h.style.visibility="visible")});const n=f();n&&Z(n.rowCount>1,n.cellCount>1),Ce(e)}const M=new Set;function J(){M.forEach(e=>{e.style.position==="relative"&&(e.style.removeProperty("position"),e.getAttribute("style")?.trim()||e.removeAttribute("style"))}),M.clear()}function T(){if(h&&(h.style.display="none"),b){b.querySelectorAll(".resize-handle").forEach(o=>o.remove());const t=b.parentElement,n=t?.classList.contains("rte-table-wrapper")?t.querySelector(".table-resize-handle"):b.querySelector(".table-resize-handle");n&&n.remove()}J(),b=null}function Z(e,t){if(!h)return;const n=h.querySelector('[data-action="deleteRow"]'),o=h.querySelector('[data-action="deleteColumn"]');n&&(n.disabled=!e),o&&(o.disabled=!t)}let z=!1;function we(){if(z||typeof document>"u")return;if(document.getElementById("rte-table-toolbar-styles")){z=!0;return}z=!0;const e=document.createElement("style");e.id="rte-table-toolbar-styles",e.textContent=`
|
|
2
2
|
.table-toolbar {
|
|
3
3
|
background: white;
|
|
4
4
|
border: 1px solid #d0d0d0;
|
|
@@ -151,11 +151,11 @@
|
|
|
151
151
|
display: none;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
-
`,document.head.appendChild(e)}function
|
|
154
|
+
`,document.head.appendChild(e)}function ve(){we();const e=document.createElement("div");e.className="table-toolbar",e.style.cssText=`
|
|
155
155
|
position: fixed;
|
|
156
156
|
z-index: 1000;
|
|
157
157
|
display: none;
|
|
158
|
-
`,e.setAttribute("role","toolbar"),e.setAttribute("aria-label","Table editing toolbar");const t=s=>{const c=document.createElement("button");return c.className="toolbar-icon-btn",s.danger&&c.classList.add("toolbar-icon-btn-danger"),s.delete&&c.classList.add("toolbar-icon-btn-delete"),c.innerHTML=s.icon,c.title=s.title,c.setAttribute("aria-label",s.title),c.setAttribute("type","button"),c.setAttribute("data-action",s.action),c.onclick=()=>
|
|
158
|
+
`,e.setAttribute("role","toolbar"),e.setAttribute("aria-label","Table editing toolbar");const t=s=>{const c=document.createElement("button");return c.className="toolbar-icon-btn",s.danger&&c.classList.add("toolbar-icon-btn-danger"),s.delete&&c.classList.add("toolbar-icon-btn-delete"),c.innerHTML=s.icon,c.title=s.title,c.setAttribute("aria-label",s.title),c.setAttribute("type","button"),c.setAttribute("data-action",s.action),c.onclick=()=>y(s.action),c},n=()=>{const s=document.createElement("div");return s.className="toolbar-divider",s},o=(...s)=>{const c=document.createElement("div");return c.className="toolbar-section",s.forEach(C=>c.appendChild(C)),c},l=o(t({icon:Ee(),title:"Add row above (Ctrl+Shift+R)",action:"addRowAbove"}),t({icon:xe(),title:"Add row below",action:"addRowBelow"}),t({icon:He(),title:"Delete row",action:"deleteRow",danger:!0})),r=o(t({icon:Re(),title:"Add column left",action:"addColumnLeft"}),t({icon:Te(),title:"Add column right (Ctrl+Shift+C)",action:"addColumnRight"}),t({icon:ze(),title:"Delete column",action:"deleteColumn",danger:!0})),a=o(t({icon:Se(),title:"Toggle header row",action:"toggleHeaderRow"}),t({icon:Me(),title:"Toggle header column",action:"toggleHeaderColumn"})),i=o(t({icon:Le(),title:"Merge cells (horizontally)",action:"mergeCells"})),u=o(t({icon:Ie(),title:"Delete table",action:"deleteTable",delete:!0}));e.appendChild(l),e.appendChild(n()),e.appendChild(r),e.appendChild(n()),e.appendChild(a),e.appendChild(n()),e.appendChild(i),e.appendChild(n()),e.appendChild(u);const d=s=>{!h||h.style.display==="none"||(s.ctrlKey||s.metaKey)&&s.shiftKey&&(s.key==="r"||s.key==="R"?(s.preventDefault(),y("addRowBelow")):(s.key==="c"||s.key==="C")&&(s.preventDefault(),y("addColumnRight")))};return window.addEventListener("keydown",d),e}function y(e){G(()=>{switch(e){case"addRowAbove":ne();break;case"addRowBelow":oe();break;case"addColumnLeft":re();break;case"addColumnRight":le();break;case"deleteRow":ae();break;case"deleteColumn":ie();break;case"toggleHeaderRow":de();break;case"toggleHeaderColumn":se();break;case"deleteTable":ce();break;case"mergeCells":be();break}})}function Ce(e){const t=Y(e);e.querySelectorAll(".resize-handle").forEach(i=>i.remove());const o=t.querySelector(".table-resize-handle");o&&o.remove(),J();const l=e.querySelector("thead tr, tbody tr:first-child");if(!l)return;const r=l.querySelectorAll("td, th");r.forEach((i,u)=>{if(u===r.length-1)return;const d=document.createElement("div");d.className="resize-handle",d.style.cssText=`
|
|
159
159
|
position: absolute;
|
|
160
160
|
right: -4px;
|
|
161
161
|
top: 0;
|
|
@@ -165,24 +165,24 @@
|
|
|
165
165
|
cursor: col-resize;
|
|
166
166
|
z-index: 10;
|
|
167
167
|
transition: background 0.15s ease;
|
|
168
|
-
`,d.addEventListener("mouseenter",()=>{
|
|
168
|
+
`,d.addEventListener("mouseenter",()=>{E||(d.style.background="rgba(0, 102, 204, 0.3)")}),d.addEventListener("mouseleave",()=>{E||(d.style.background="transparent")}),d.addEventListener("mousedown",c=>{c.preventDefault(),c.stopPropagation(),ye(c,u)});const s=i;s.style.position||(s.style.position="relative",M.add(s)),i.appendChild(d)});const a=document.createElement("div");a.className="table-resize-handle",a.addEventListener("mousedown",i=>{i.preventDefault(),i.stopPropagation(),ke(i)}),t.appendChild(a)}function ye(e,t){if(E=!0,k=t,O=e.clientX,!b)return;const n=b.querySelector("thead tr, tbody tr:first-child");n&&n.cells[t]&&(K=n.cells[t].offsetWidth),document.body.style.cursor="col-resize",document.body.style.userSelect="none";const o=r=>{if(!E||k===null||!b)return;const a=r.clientX-O,i=Math.max(50,K+a);b.querySelectorAll("tr").forEach(d=>{d.cells[k]&&(d.cells[k].style.width=i+"px")})},l=()=>{E=!1,k=null,document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",l)};document.addEventListener("mousemove",o),document.addEventListener("mouseup",l)}function ke(e){if(!b)return;R=!0,_=e.clientX,W=e.clientY,X=b.offsetWidth,F=b.offsetHeight,document.body.style.cursor="nwse-resize",document.body.style.userSelect="none";const t=o=>{if(!R||!b)return;const l=o.clientX-_,r=o.clientY-W,a=Math.max(200,X+l),i=Math.max(100,F+r);b.style.width=a+"px",b.style.height=i+"px"},n=()=>{R=!1,document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",n)};document.addEventListener("mousemove",t),document.addEventListener("mouseup",n)}function Ee(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
169
169
|
<path d="M2 7h12V5H2v2zm0 4h12V9H2v2zM8 1v3H5v2h3v3h2V6h3V4h-3V1H8z"/>
|
|
170
|
-
</svg>`}function
|
|
170
|
+
</svg>`}function xe(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
171
171
|
<path d="M2 3h12V1H2v2zm0 4h12V5H2v2zm6 4v3h3v-2h2v-2h-2v-3h-2v3H5v2h3z"/>
|
|
172
|
-
</svg>`}function
|
|
172
|
+
</svg>`}function He(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
173
173
|
<path d="M2 5h12v2H2V5zm0 4h12v2H2V9zm4-6v2H4v2h2v2h2V7h2V5H8V3H6z"/>
|
|
174
|
-
</svg>`}function
|
|
174
|
+
</svg>`}function Re(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
175
175
|
<path d="M7 2v12h2V2H7zm4 0v12h2V2h-2zM1 8h3v-3H1v3zm3 2H1v3h3v-3z"/>
|
|
176
|
-
</svg>`}function
|
|
176
|
+
</svg>`}function Te(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
177
177
|
<path d="M2 2v12h2V2H2zm4 0v12h2V2H6zM12 8h3v-3h-3v3zm0 2h3v3h-3v-3z"/>
|
|
178
|
-
</svg>`}function
|
|
178
|
+
</svg>`}function ze(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
179
179
|
<path d="M5 2v12h2V2H5zm4 0v12h2V2H9zm3 2h3V1h-3v3zm3 2h-3v3h3V6zm0 4h-3v3h3v-3z"/>
|
|
180
|
-
</svg>`}function
|
|
180
|
+
</svg>`}function Se(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
181
181
|
<path d="M2 2h12v3H2V2zm0 5h12v8H2V7zm2 2v4h2V9H4zm4 0v4h2V9H8zm4 0v4h2V9h-2z"/>
|
|
182
|
-
</svg>`}function
|
|
182
|
+
</svg>`}function Me(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
183
183
|
<path d="M2 2v12h3V2H2zm5 0v12h8V2H7zm2 2h4v2H9V4zm0 4h4v2H9V8zm0 4h4v2H9v-2z"/>
|
|
184
|
-
</svg>`}function
|
|
184
|
+
</svg>`}function Ie(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
185
185
|
<path d="M3 1h10v1H3V1zm1 2v11h8V3H4zM6 5h1v6H6V5zm3 0h1v6H9V5z"/>
|
|
186
|
-
</svg>`}function
|
|
186
|
+
</svg>`}function Le(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
187
187
|
<path d="M2 2h4v3H2V2zm5 0h4v3H7V2zm5 0h2v3h-2V2zm-10 4h4v3H2V6zm5 0h4v3H7V6zm5 0h2v3h-2V6zm-10 4h4v3H2v-3zm5 0h4v3H7v-3zm5 0h2v3h-2v-3z"/>
|
|
188
|
-
</svg>`}if(typeof window<"u"&&!window.__tablePluginInitialized){window.__tablePluginInitialized=!0;const e=()=>{
|
|
188
|
+
</svg>`}if(typeof window<"u"&&!window.__tablePluginInitialized){window.__tablePluginInitialized=!0;const e=()=>{pe()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):setTimeout(e,100)}const Ae=()=>({name:"table",toolbar:[{label:"Insert Table",command:"insertTable",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><rect x="3" y="4" width="18" height="16" rx="2" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M3 10h18M3 15h18M9 4v16M15 4v16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg>'}],commands:{insertTable:()=>(G(()=>{te()}),!0)},keymap:{"Mod-Shift-r":()=>(y("addRowBelow"),!0),"Mod-Shift-c":()=>(y("addColumnRight"),!0)}});exports.TablePlugin=Ae;
|