@editora/plugins 1.2.0 → 1.2.2
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/plugins.css +1 -1
- package/dist/table.cjs.js +13 -13
- package/dist/table.esm.js +82 -81
- package/package.json +3 -3
package/dist/plugins.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.rte-table-wrapper{position:relative}.rte-table,table{border-collapse:collapse;width:100%;margin:1rem 0;border:1px solid #ddd;font-size:14px;line-height:1.4;position:relative}.rte-table td,.rte-table th,table td,table th{border:1px solid #ddd;padding:8px 12px;min-width:80px;vertical-align:top;position:relative
|
|
1
|
+
.rte-table-wrapper{position:relative}.rte-table,table{border-collapse:collapse;width:100%;margin:1rem 0;border:1px solid #ddd;font-size:14px;line-height:1.4;position:relative}.rte-table td,.rte-table th,table td,table th{border:1px solid #ddd;padding:8px 12px;min-width:80px;vertical-align:top;position:relative}.rte-table td:focus,.rte-table th:focus,table td:focus,table th:focus{outline:2px solid #007acc;outline-offset:-2px}.rte-table th,table th{background-color:#f8f9fa;font-weight:600;text-align:left}.rte-table td p,table td p{margin:0;padding:0}.rte-table td p:empty:before,table td p:empty:before{content:"";display:inline-block}.rte-table td[contenteditable]:empty:before,table td[contenteditable]:empty:before{content:"Type here...";color:#999;font-style:italic;pointer-events:none}.rte-table tr:hover,table tr:hover{background-color:#f8f9fa}.rte-table td.selected,table td.selected{background-color:#e3f2fd;border-color:#2196f3}.table-toolbar{background:#fff;border:1px solid #d0d0d0;border-radius:4px;box-shadow:0 2px 8px #0000001a;padding:4px;display:flex;align-items:center;gap:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;min-width:max-content}.toolbar-section{display:flex;align-items:center;gap:2px}.toolbar-divider{width:1px;height:20px;background:#e0e0e0;margin:0 4px}.toolbar-icon-btn{display:flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:1px solid transparent;background:transparent;cursor:pointer;color:#333;border-radius:3px;transition:all .2s ease;flex-shrink:0;font-size:14px;line-height:1}.toolbar-icon-btn svg{width:16px;height:16px}.toolbar-icon-btn:hover:not(:disabled){background:#f0f0f0;border-color:#d0d0d0;color:#06c}.toolbar-icon-btn:active:not(:disabled){background:#e8f0ff;border-color:#06c;transform:scale(.95)}.toolbar-icon-btn:disabled{opacity:.4;cursor:not-allowed;color:#ccc}.toolbar-icon-btn-danger{color:#d32f2f}.toolbar-icon-btn-danger:hover:not(:disabled){background:#fff3f3;border-color:#fcc;color:#d32f2f}.toolbar-icon-btn-danger:active:not(:disabled){background:#ffebee}.toolbar-icon-btn-delete{color:#d32f2f}.toolbar-icon-btn-delete:hover:not(:disabled){background:#fff3f3;border-color:#fcc;color:#d32f2f}.toolbar-icon-btn-delete:active:not(:disabled){background:#ffebee}.resize-handle{opacity:0;transition:all .15s ease}.resize-handle:hover{opacity:1}td:hover>.resize-handle,th:hover>.resize-handle{opacity:1}.table-resize-handle{position:absolute;bottom:-4px;right:-4px;width:12px;height:12px;background:transparent;cursor:nwse-resize;z-index:10;transition:background .15s ease}.table-resize-handle:after{content:"";position:absolute;bottom:0;right:0;width:8px;height:8px;background:#0066cc4d;border-bottom:2px solid #0066cc;border-right:2px solid #0066cc;border-radius:0 0 2px;opacity:0;transition:opacity .15s ease}.table-resize-handle:hover:after{opacity:1}.rte-table:hover .table-resize-handle:after,table:hover .table-resize-handle:after{opacity:1}:is([data-theme=dark],.dark,.editora-theme-dark) :is(.rte-table,table){border-color:#607088;background:#24303c;color:#e6eefb}:is([data-theme=dark],.dark,.editora-theme-dark) :is(.rte-table td,.rte-table th,table td,table th){border-color:#607088;color:#e6eefb}:is([data-theme=dark],.dark,.editora-theme-dark) :is(.rte-table th,table th){background:linear-gradient(180deg,#3b4553,#333d4a);color:#f3f8ff}:is([data-theme=dark],.dark,.editora-theme-dark) :is(.rte-table tr:hover,table tr:hover){background-color:#58a6ff1f}:is([data-theme=dark],.dark,.editora-theme-dark) :is(.rte-table td.selected,table td.selected){background-color:#58a6ff47;border-color:#79beff}:is([data-theme=dark],.dark,.editora-theme-dark) :is(.rte-table td[contenteditable]:empty:before,table td[contenteditable]:empty:before){color:#94a3b8}:is([data-theme=dark],.dark,.editora-theme-dark) .table-toolbar{background:linear-gradient(180deg,#2f3844,#2a323c);border-color:#4d596b;box-shadow:0 8px 20px #00000073}.table-toolbar.rte-theme-dark{background:linear-gradient(180deg,#2f3844,#2a323c);border-color:#4d596b;box-shadow:0 8px 20px #00000073}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-divider{background:#4d596b}.table-toolbar.rte-theme-dark .toolbar-divider{background:#4d596b}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn{color:#d7deea;border-color:transparent}.table-toolbar.rte-theme-dark .toolbar-icon-btn{color:#d7deea;border-color:transparent}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg{color:currentColor}.table-toolbar.rte-theme-dark .toolbar-icon-btn svg{color:currentColor}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg [stroke="#000" i],:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg [stroke="#000000" i],:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg [stroke=black i]{stroke:currentColor!important}.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [stroke="#000" i],.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [stroke="#000000" i],.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [stroke=black i]{stroke:currentColor!important}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg [fill="#000" i],:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg [fill="#000000" i],:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg [fill=black i]{fill:currentColor!important}.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [fill="#000" i],.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [fill="#000000" i],.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [fill=black i]{fill:currentColor!important}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn:hover:not(:disabled){background:#3a4554;border-color:#607088;color:#f3f8ff}.table-toolbar.rte-theme-dark .toolbar-icon-btn:hover:not(:disabled){background:#3a4554;border-color:#607088;color:#f3f8ff}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn:active:not(:disabled){background:#4a95de;border-color:#67adf4;color:#0f1b2a}.table-toolbar.rte-theme-dark .toolbar-icon-btn:active:not(:disabled){background:#4a95de;border-color:#67adf4;color:#0f1b2a}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn:disabled{color:#7f8ca1}.table-toolbar.rte-theme-dark .toolbar-icon-btn:disabled{color:#7f8ca1}@media(max-width:768px){.rte-table,table{font-size:12px}.rte-table td,.rte-table th,table td,table th{padding:4px 6px;min-width:60px}.table-toolbar{padding:3px;gap:0;max-width:90vw;overflow-x:auto}.toolbar-icon-btn{width:26px;height:26px}.toolbar-divider{height:18px}}@media print{.rte-table,table{border:1px solid #000}.rte-table td,.rte-table th,table td,table th{border:1px solid #000;padding:4px}.table-toolbar{display:none}}
|
package/dist/table.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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=`
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const $=require("./notify-BkbzMopb.js"),N=require("./editorContainerHelpers-CFbfiOJI.js");let h=null,b=null,B=null,V=null,D=null,q=null,O=null;const H='[data-theme="dark"], .dark, .editora-theme-dark';let E=!1,k=null,P=0,_=0,T=!1,K=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=window.getSelection(),{anchorNode:o,anchorOffset:l,focusNode:r,focusOffset:a}=n??{},i=!!n&&!!o&&!!r&&(e.contains(o)||e.contains(r)),c=document.createElement("div");return c.className="rte-table-wrapper",t?.insertBefore(c,e),c.appendChild(e),i&&n&&o&&r&&o.isConnected&&r.isConnected&&n.setBaseAndExtent(o,l??0,r,a??0),c}const te=()=>{const e=N.findEditorContainerFromSelection(),t=N.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 c=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),u=d(o.startContainer,o.startOffset,!1),C=s&&U(s,t)||u&&U(u,t);C&&C.parentNode?C.parentNode.insertBefore(c,C.nextSibling):(o.collapse(!1),o.insertNode(c));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"),c=document.createElement("p");c.innerHTML="<br>",i.appendChild(c),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 c=l.attributes[i];a.setAttribute(c.name,c.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}const ue=".rte-content, .editora-content";function I(e){if(!e)return!1;const t=e.closest(ue),n=e.closest("[contenteditable]");return!t||!n||!t.contains(n)||n.getAttribute("contenteditable")==="false"?!1:!n.closest('[data-readonly="true"]')}function he(){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 be(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=he();if(t&&!I(t))return;const n=t?t.innerHTML:"";if(e(),!t)return;const o=t.innerHTML;o!==n&&(be(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 me=()=>{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 u=parseInt(d.getAttribute(s)||"1",10);return Number.isFinite(u)&&u>0?u: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 c=i;if(c){for(let d=0;d<c.cells.length;d++)if(c.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 fe(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 pe(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(c=>c.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(),fe(i))}function ge(){B=()=>{const e=f();e&&I(e.table)?we(e.table):R()},V=e=>{const t=w(e.target,"table"),n=w(e.target,".table-toolbar");!t&&!n&&R()},D=()=>{R()},q=()=>{b&&h&&h.style.display!=="none"&&S(b)},O=()=>{b&&h&&h.style.display!=="none"&&S(b)},document.addEventListener("selectionchange",B),document.addEventListener("keydown",pe),document.addEventListener("mousedown",V),document.addEventListener("tableDeleted",D),window.addEventListener("scroll",q,!0),window.addEventListener("resize",O)}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 c=window.innerWidth;i+l>c-r&&(i=c-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 we(e){b=e,h||(h=Ce(),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),ye(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 R(){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 ve(){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 Ce(){ve();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
|
|
158
|
+
`,e.setAttribute("role","toolbar"),e.setAttribute("aria-label","Table editing toolbar");const t=s=>{const u=document.createElement("button");return u.className="toolbar-icon-btn",s.danger&&u.classList.add("toolbar-icon-btn-danger"),s.delete&&u.classList.add("toolbar-icon-btn-delete"),u.innerHTML=s.icon,u.title=s.title,u.setAttribute("aria-label",s.title),u.setAttribute("type","button"),u.setAttribute("data-action",s.action),u.onclick=()=>y(s.action),u},n=()=>{const s=document.createElement("div");return s.className="toolbar-divider",s},o=(...s)=>{const u=document.createElement("div");return u.className="toolbar-section",s.forEach(C=>u.appendChild(C)),u},l=o(t({icon:xe(),title:"Add row above (Ctrl+Shift+R)",action:"addRowAbove"}),t({icon:He(),title:"Add row below",action:"addRowBelow"}),t({icon:Te(),title:"Delete row",action:"deleteRow",danger:!0})),r=o(t({icon:Re(),title:"Add column left",action:"addColumnLeft"}),t({icon:ze(),title:"Add column right (Ctrl+Shift+C)",action:"addColumnRight"}),t({icon:Se(),title:"Delete column",action:"deleteColumn",danger:!0})),a=o(t({icon:Me(),title:"Toggle header row",action:"toggleHeaderRow"}),t({icon:Ie(),title:"Toggle header column",action:"toggleHeaderColumn"})),i=o(t({icon:Ae(),title:"Merge cells (horizontally)",action:"mergeCells"})),c=o(t({icon:Le(),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(c);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":me();break}})}function ye(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,c)=>{if(c===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",()=>{E||(d.style.background="rgba(0, 102, 204, 0.3)")}),d.addEventListener("mouseleave",()=>{E||(d.style.background="transparent")}),d.addEventListener("mousedown",
|
|
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",u=>{u.preventDefault(),u.stopPropagation(),ke(u,c)});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(),Ee(i)}),t.appendChild(a)}function ke(e,t){if(E=!0,k=t,P=e.clientX,!b)return;const n=b.querySelector("thead tr, tbody tr:first-child");n&&n.cells[t]&&(_=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-P,i=Math.max(50,_+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 Ee(e){if(!b)return;T=!0,K=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(!T||!b)return;const l=o.clientX-K,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=()=>{T=!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 xe(){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 xe(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
171
|
-
<path d="M2 3h12V1H2v2zm0 4h12V5H2v2zm6 4v3h3v-2h2v-2h-2v-3h-2v3H5v2h3z"/>
|
|
172
170
|
</svg>`}function He(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
171
|
+
<path d="M2 3h12V1H2v2zm0 4h12V5H2v2zm6 4v3h3v-2h2v-2h-2v-3h-2v3H5v2h3z"/>
|
|
172
|
+
</svg>`}function Te(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
173
173
|
<path d="M2 5h12v2H2V5zm0 4h12v2H2V9zm4-6v2H4v2h2v2h2V7h2V5H8V3H6z"/>
|
|
174
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 Te(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
177
|
-
<path d="M2 2v12h2V2H2zm4 0v12h2V2H6zM12 8h3v-3h-3v3zm0 2h3v3h-3v-3z"/>
|
|
178
176
|
</svg>`}function ze(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
179
|
-
<path d="
|
|
177
|
+
<path d="M2 2v12h2V2H2zm4 0v12h2V2H6zM12 8h3v-3h-3v3zm0 2h3v3h-3v-3z"/>
|
|
180
178
|
</svg>`}function Se(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
181
|
-
<path d="
|
|
179
|
+
<path d="M5 2v12h2V2H5zm4 0v12h2V2H9zm3 2h3V1h-3v3zm3 2h-3v3h3V6zm0 4h-3v3h3v-3z"/>
|
|
182
180
|
</svg>`}function Me(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
183
|
-
<path d="M2
|
|
181
|
+
<path d="M2 2h12v3H2V2zm0 5h12v8H2V7zm2 2v4h2V9H4zm4 0v4h2V9H8zm4 0v4h2V9h-2z"/>
|
|
184
182
|
</svg>`}function Ie(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
185
|
-
<path d="
|
|
183
|
+
<path d="M2 2v12h3V2H2zm5 0v12h8V2H7zm2 2h4v2H9V4zm0 4h4v2H9V8zm0 4h4v2H9v-2z"/>
|
|
186
184
|
</svg>`}function Le(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
185
|
+
<path d="M3 1h10v1H3V1zm1 2v11h8V3H4zM6 5h1v6H6V5zm3 0h1v6H9V5z"/>
|
|
186
|
+
</svg>`}function Ae(){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=()=>{ge()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):setTimeout(e,100)}const Ne=()=>({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=Ne;
|
package/dist/table.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as Z } from "./notify-zOp-mUOJ.mjs";
|
|
2
2
|
import { f as $, g as ee } from "./editorContainerHelpers-C7kdWnS0.mjs";
|
|
3
|
-
let h = null, b = null,
|
|
3
|
+
let h = null, b = null, N = null, B = null, V = null, D = null, q = null;
|
|
4
4
|
const H = '[data-theme="dark"], .dark, .editora-theme-dark';
|
|
5
|
-
let E = !1, k = null, O = 0, P = 0, R = !1, K = 0,
|
|
5
|
+
let E = !1, k = null, O = 0, P = 0, R = !1, K = 0, _ = 0, W = 0, X = 0;
|
|
6
6
|
const te = /* @__PURE__ */ new Set([
|
|
7
7
|
"DIV",
|
|
8
8
|
"P",
|
|
@@ -31,8 +31,8 @@ function Y(e) {
|
|
|
31
31
|
const t = e.parentElement;
|
|
32
32
|
if (t && t.classList.contains("rte-table-wrapper"))
|
|
33
33
|
return t;
|
|
34
|
-
const n = document.createElement("div");
|
|
35
|
-
return
|
|
34
|
+
const n = window.getSelection(), { anchorNode: o, anchorOffset: l, focusNode: r, focusOffset: a } = n ?? {}, i = !!n && !!o && !!r && (e.contains(o) || e.contains(r)), c = document.createElement("div");
|
|
35
|
+
return c.className = "rte-table-wrapper", t?.insertBefore(c, e), c.appendChild(e), i && n && o && r && o.isConnected && r.isConnected && n.setBaseAndExtent(o, l ?? 0, r, a ?? 0), c;
|
|
36
36
|
}
|
|
37
37
|
const ne = () => {
|
|
38
38
|
const e = $(), t = ee(e);
|
|
@@ -58,12 +58,12 @@ const ne = () => {
|
|
|
58
58
|
i.appendChild(g);
|
|
59
59
|
}
|
|
60
60
|
l.appendChild(r), l.appendChild(i);
|
|
61
|
-
const
|
|
61
|
+
const c = Y(l), d = (m, g, v) => {
|
|
62
62
|
if (m !== t) return m;
|
|
63
63
|
const x = v ? g - 1 : g;
|
|
64
64
|
return t.childNodes[Math.min(Math.max(x, 0), t.childNodes.length - 1)] || null;
|
|
65
|
-
}, s = d(o.endContainer, o.endOffset, !0),
|
|
66
|
-
C && C.parentNode ? C.parentNode.insertBefore(
|
|
65
|
+
}, s = d(o.endContainer, o.endOffset, !0), u = d(o.startContainer, o.startOffset, !1), C = s && F(s, t) || u && F(u, t);
|
|
66
|
+
C && C.parentNode ? C.parentNode.insertBefore(c, C.nextSibling) : (o.collapse(!1), o.insertNode(c));
|
|
67
67
|
const L = l.querySelector("th p");
|
|
68
68
|
if (L) {
|
|
69
69
|
const m = document.createRange();
|
|
@@ -75,8 +75,8 @@ const ne = () => {
|
|
|
75
75
|
if (!e) return;
|
|
76
76
|
const { table: t, rowIndex: n } = e, o = document.createElement("tr"), l = t.rows[0]?.cells.length || 0;
|
|
77
77
|
for (let a = 0; a < l; a++) {
|
|
78
|
-
const i = document.createElement("td"),
|
|
79
|
-
|
|
78
|
+
const i = document.createElement("td"), c = document.createElement("p");
|
|
79
|
+
c.innerHTML = "<br>", i.appendChild(c), o.appendChild(i);
|
|
80
80
|
}
|
|
81
81
|
const r = t.rows[n];
|
|
82
82
|
r && r.parentElement ? r.parentElement.insertBefore(o, r) : t.appendChild(o), p();
|
|
@@ -170,8 +170,8 @@ const ce = () => {
|
|
|
170
170
|
const r = l.tagName.toLowerCase() === "th" ? "td" : "th", a = document.createElement(r);
|
|
171
171
|
a.innerHTML = l.innerHTML;
|
|
172
172
|
for (let i = 0; i < l.attributes.length; i++) {
|
|
173
|
-
const
|
|
174
|
-
a.setAttribute(
|
|
173
|
+
const c = l.attributes[i];
|
|
174
|
+
a.setAttribute(c.name, c.value);
|
|
175
175
|
}
|
|
176
176
|
l.parentNode?.replaceChild(a, l);
|
|
177
177
|
}
|
|
@@ -188,16 +188,17 @@ function w(e, t) {
|
|
|
188
188
|
const n = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement;
|
|
189
189
|
return n ? n.closest(t) : null;
|
|
190
190
|
}
|
|
191
|
+
const he = ".rte-content, .editora-content";
|
|
191
192
|
function M(e) {
|
|
192
193
|
if (!e) return !1;
|
|
193
|
-
const t = e.closest("[contenteditable]");
|
|
194
|
-
return !t || t.getAttribute("contenteditable") === "false" ? !1 : !
|
|
194
|
+
const t = e.closest(he), n = e.closest("[contenteditable]");
|
|
195
|
+
return !t || !n || !t.contains(n) || n.getAttribute("contenteditable") === "false" ? !1 : !n.closest('[data-readonly="true"]');
|
|
195
196
|
}
|
|
196
|
-
function
|
|
197
|
+
function be() {
|
|
197
198
|
const e = window.getSelection(), t = e && e.rangeCount > 0 ? e.getRangeAt(0).startContainer : null;
|
|
198
199
|
return w(t, ".rte-content") || (b ? b.closest(".rte-content") : null);
|
|
199
200
|
}
|
|
200
|
-
function
|
|
201
|
+
function me(e, t, n) {
|
|
201
202
|
const o = window.execEditorCommand || window.executeEditorCommand;
|
|
202
203
|
if (typeof o == "function")
|
|
203
204
|
try {
|
|
@@ -206,12 +207,12 @@ function be(e, t, n) {
|
|
|
206
207
|
}
|
|
207
208
|
}
|
|
208
209
|
function j(e) {
|
|
209
|
-
const t =
|
|
210
|
+
const t = be();
|
|
210
211
|
if (t && !M(t)) return;
|
|
211
212
|
const n = t ? t.innerHTML : "";
|
|
212
213
|
if (e(), !t) return;
|
|
213
214
|
const o = t.innerHTML;
|
|
214
|
-
o !== n && (
|
|
215
|
+
o !== n && (me(t, n, o), t.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
215
216
|
}
|
|
216
217
|
function G(e, t, n) {
|
|
217
218
|
if (!e.isConnected || e.rows.length === 0) return;
|
|
@@ -222,7 +223,7 @@ function G(e, t, n) {
|
|
|
222
223
|
const i = window.getSelection();
|
|
223
224
|
i?.removeAllRanges(), i?.addRange(r);
|
|
224
225
|
}
|
|
225
|
-
const
|
|
226
|
+
const fe = () => {
|
|
226
227
|
const e = window.getSelection();
|
|
227
228
|
if (!e || e.rangeCount === 0) return;
|
|
228
229
|
const n = e.getRangeAt(0).startContainer;
|
|
@@ -241,8 +242,8 @@ const me = () => {
|
|
|
241
242
|
const a = l.cells[r + 1];
|
|
242
243
|
if (!a) return;
|
|
243
244
|
const i = (d, s) => {
|
|
244
|
-
const
|
|
245
|
-
return Number.isFinite(
|
|
245
|
+
const u = parseInt(d.getAttribute(s) || "1", 10);
|
|
246
|
+
return Number.isFinite(u) && u > 0 ? u : 1;
|
|
246
247
|
};
|
|
247
248
|
if (i(o, "rowspan") !== i(a, "rowspan")) return;
|
|
248
249
|
o.setAttribute("colspan", String(i(o, "colspan") + i(a, "colspan"))), Array.from(a.childNodes).forEach((d) => {
|
|
@@ -260,10 +261,10 @@ function f() {
|
|
|
260
261
|
const i = a.parentElement;
|
|
261
262
|
for (; i && i !== o.rows[l] && (l++, !(l >= o.rows.length)); )
|
|
262
263
|
;
|
|
263
|
-
const
|
|
264
|
-
if (
|
|
265
|
-
for (let d = 0; d <
|
|
266
|
-
if (
|
|
264
|
+
const c = i;
|
|
265
|
+
if (c) {
|
|
266
|
+
for (let d = 0; d < c.cells.length; d++)
|
|
267
|
+
if (c.cells[d] === a) {
|
|
267
268
|
r = d;
|
|
268
269
|
break;
|
|
269
270
|
}
|
|
@@ -284,13 +285,13 @@ function p() {
|
|
|
284
285
|
const t = e.rowCount > 1, n = e.cellCount > 1;
|
|
285
286
|
J(t, n);
|
|
286
287
|
}
|
|
287
|
-
function
|
|
288
|
+
function pe(e) {
|
|
288
289
|
const t = window.getSelection();
|
|
289
290
|
if (!t) return;
|
|
290
291
|
const n = document.createRange();
|
|
291
292
|
(e.textContent ?? "").trim() === "" ? (n.selectNodeContents(e.querySelector("p, div") || e), n.collapse(!0)) : n.selectNodeContents(e), t.removeAllRanges(), t.addRange(n);
|
|
292
293
|
}
|
|
293
|
-
function
|
|
294
|
+
function ge(e) {
|
|
294
295
|
if (e.key !== "Tab" || e.defaultPrevented || e.ctrlKey || e.metaKey || e.altKey) return;
|
|
295
296
|
const t = window.getSelection();
|
|
296
297
|
if (!t || t.rangeCount === 0) return;
|
|
@@ -299,44 +300,44 @@ function pe(e) {
|
|
|
299
300
|
const l = o.closest("[contenteditable]");
|
|
300
301
|
if (!l || !(e.target instanceof Node) || !l.contains(e.target)) return;
|
|
301
302
|
const r = Array.from(o.querySelectorAll("th, td")).filter(
|
|
302
|
-
(
|
|
303
|
+
(c) => c.closest("table") === o
|
|
303
304
|
), a = r.indexOf(n);
|
|
304
305
|
let i;
|
|
305
|
-
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(),
|
|
306
|
+
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(), pe(i));
|
|
306
307
|
}
|
|
307
|
-
function
|
|
308
|
-
|
|
308
|
+
function we() {
|
|
309
|
+
N = () => {
|
|
309
310
|
const e = f();
|
|
310
|
-
e && M(e.table) ?
|
|
311
|
+
e && M(e.table) ? ve(e.table) : T();
|
|
311
312
|
}, B = (e) => {
|
|
312
313
|
const t = w(e.target, "table"), n = w(e.target, ".table-toolbar");
|
|
313
314
|
!t && !n && T();
|
|
314
|
-
},
|
|
315
|
+
}, V = () => {
|
|
315
316
|
T();
|
|
316
317
|
}, D = () => {
|
|
317
318
|
b && h && h.style.display !== "none" && S(b);
|
|
318
319
|
}, q = () => {
|
|
319
320
|
b && h && h.style.display !== "none" && S(b);
|
|
320
|
-
}, document.addEventListener("selectionchange",
|
|
321
|
+
}, document.addEventListener("selectionchange", N), document.addEventListener("keydown", ge), document.addEventListener("mousedown", B), document.addEventListener("tableDeleted", V), window.addEventListener("scroll", D, !0), window.addEventListener("resize", q);
|
|
321
322
|
}
|
|
322
323
|
function S(e) {
|
|
323
324
|
if (!h) return;
|
|
324
325
|
const t = e.getBoundingClientRect(), n = h.getBoundingClientRect(), o = n.height || 40, l = n.width || 280, r = 10;
|
|
325
326
|
let a = t.top - o - r, i = t.left + t.width / 2 - l / 2;
|
|
326
327
|
a < r && (a = t.bottom + r), i < r && (i = r);
|
|
327
|
-
const
|
|
328
|
-
i + l >
|
|
328
|
+
const c = window.innerWidth;
|
|
329
|
+
i + l > c - r && (i = c - l - r);
|
|
329
330
|
const d = window.innerHeight;
|
|
330
331
|
a + o > d - r && (a = d - o - r), h.style.top = a + "px", h.style.left = i + "px";
|
|
331
332
|
}
|
|
332
|
-
function
|
|
333
|
-
b = e, h || (h =
|
|
333
|
+
function ve(e) {
|
|
334
|
+
b = e, h || (h = ye(), document.body.appendChild(h));
|
|
334
335
|
const t = !!e.closest(H) || document.body.matches(H) || document.documentElement.matches(H);
|
|
335
336
|
h.classList.toggle("rte-theme-dark", t), h.style.display = "flex", h.style.visibility = "hidden", requestAnimationFrame(() => {
|
|
336
337
|
S(e), h && (h.style.visibility = "visible");
|
|
337
338
|
});
|
|
338
339
|
const n = f();
|
|
339
|
-
n && J(n.rowCount > 1, n.cellCount > 1),
|
|
340
|
+
n && J(n.rowCount > 1, n.cellCount > 1), ke(e);
|
|
340
341
|
}
|
|
341
342
|
const I = /* @__PURE__ */ new Set();
|
|
342
343
|
function Q() {
|
|
@@ -358,7 +359,7 @@ function J(e, t) {
|
|
|
358
359
|
n && (n.disabled = !e), o && (o.disabled = !t);
|
|
359
360
|
}
|
|
360
361
|
let z = !1;
|
|
361
|
-
function
|
|
362
|
+
function Ce() {
|
|
362
363
|
if (z || typeof document > "u") return;
|
|
363
364
|
if (document.getElementById("rte-table-toolbar-styles")) {
|
|
364
365
|
z = !0;
|
|
@@ -521,8 +522,8 @@ function ve() {
|
|
|
521
522
|
}
|
|
522
523
|
`, document.head.appendChild(e);
|
|
523
524
|
}
|
|
524
|
-
function
|
|
525
|
-
|
|
525
|
+
function ye() {
|
|
526
|
+
Ce();
|
|
526
527
|
const e = document.createElement("div");
|
|
527
528
|
e.className = "table-toolbar", e.style.cssText = `
|
|
528
529
|
position: fixed;
|
|
@@ -530,74 +531,74 @@ function Ce() {
|
|
|
530
531
|
display: none;
|
|
531
532
|
`, e.setAttribute("role", "toolbar"), e.setAttribute("aria-label", "Table editing toolbar");
|
|
532
533
|
const t = (s) => {
|
|
533
|
-
const
|
|
534
|
-
return
|
|
534
|
+
const u = document.createElement("button");
|
|
535
|
+
return u.className = "toolbar-icon-btn", s.danger && u.classList.add("toolbar-icon-btn-danger"), s.delete && u.classList.add("toolbar-icon-btn-delete"), u.innerHTML = s.icon, u.title = s.title, u.setAttribute("aria-label", s.title), u.setAttribute("type", "button"), u.setAttribute("data-action", s.action), u.onclick = () => y(s.action), u;
|
|
535
536
|
}, n = () => {
|
|
536
537
|
const s = document.createElement("div");
|
|
537
538
|
return s.className = "toolbar-divider", s;
|
|
538
539
|
}, o = (...s) => {
|
|
539
|
-
const
|
|
540
|
-
return
|
|
540
|
+
const u = document.createElement("div");
|
|
541
|
+
return u.className = "toolbar-section", s.forEach((C) => u.appendChild(C)), u;
|
|
541
542
|
}, l = o(
|
|
542
543
|
t({
|
|
543
|
-
icon:
|
|
544
|
+
icon: He(),
|
|
544
545
|
title: "Add row above (Ctrl+Shift+R)",
|
|
545
546
|
action: "addRowAbove"
|
|
546
547
|
}),
|
|
547
548
|
t({
|
|
548
|
-
icon:
|
|
549
|
+
icon: Re(),
|
|
549
550
|
title: "Add row below",
|
|
550
551
|
action: "addRowBelow"
|
|
551
552
|
}),
|
|
552
553
|
t({
|
|
553
|
-
icon:
|
|
554
|
+
icon: Te(),
|
|
554
555
|
title: "Delete row",
|
|
555
556
|
action: "deleteRow",
|
|
556
557
|
danger: !0
|
|
557
558
|
})
|
|
558
559
|
), r = o(
|
|
559
560
|
t({
|
|
560
|
-
icon:
|
|
561
|
+
icon: ze(),
|
|
561
562
|
title: "Add column left",
|
|
562
563
|
action: "addColumnLeft"
|
|
563
564
|
}),
|
|
564
565
|
t({
|
|
565
|
-
icon:
|
|
566
|
+
icon: Se(),
|
|
566
567
|
title: "Add column right (Ctrl+Shift+C)",
|
|
567
568
|
action: "addColumnRight"
|
|
568
569
|
}),
|
|
569
570
|
t({
|
|
570
|
-
icon:
|
|
571
|
+
icon: Ie(),
|
|
571
572
|
title: "Delete column",
|
|
572
573
|
action: "deleteColumn",
|
|
573
574
|
danger: !0
|
|
574
575
|
})
|
|
575
576
|
), a = o(
|
|
576
577
|
t({
|
|
577
|
-
icon:
|
|
578
|
+
icon: Me(),
|
|
578
579
|
title: "Toggle header row",
|
|
579
580
|
action: "toggleHeaderRow"
|
|
580
581
|
}),
|
|
581
582
|
t({
|
|
582
|
-
icon:
|
|
583
|
+
icon: Le(),
|
|
583
584
|
title: "Toggle header column",
|
|
584
585
|
action: "toggleHeaderColumn"
|
|
585
586
|
})
|
|
586
587
|
), i = o(
|
|
587
588
|
t({
|
|
588
|
-
icon:
|
|
589
|
+
icon: Ne(),
|
|
589
590
|
title: "Merge cells (horizontally)",
|
|
590
591
|
action: "mergeCells"
|
|
591
592
|
})
|
|
592
|
-
),
|
|
593
|
+
), c = o(
|
|
593
594
|
t({
|
|
594
|
-
icon:
|
|
595
|
+
icon: Ae(),
|
|
595
596
|
title: "Delete table",
|
|
596
597
|
action: "deleteTable",
|
|
597
598
|
delete: !0
|
|
598
599
|
})
|
|
599
600
|
);
|
|
600
|
-
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(
|
|
601
|
+
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(c);
|
|
601
602
|
const d = (s) => {
|
|
602
603
|
!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")));
|
|
603
604
|
};
|
|
@@ -634,12 +635,12 @@ function y(e) {
|
|
|
634
635
|
ue();
|
|
635
636
|
break;
|
|
636
637
|
case "mergeCells":
|
|
637
|
-
|
|
638
|
+
fe();
|
|
638
639
|
break;
|
|
639
640
|
}
|
|
640
641
|
});
|
|
641
642
|
}
|
|
642
|
-
function
|
|
643
|
+
function ke(e) {
|
|
643
644
|
const t = Y(e);
|
|
644
645
|
e.querySelectorAll(".resize-handle").forEach((i) => i.remove());
|
|
645
646
|
const o = t.querySelector(".table-resize-handle");
|
|
@@ -647,8 +648,8 @@ function ye(e) {
|
|
|
647
648
|
const l = e.querySelector("thead tr, tbody tr:first-child");
|
|
648
649
|
if (!l) return;
|
|
649
650
|
const r = l.querySelectorAll("td, th");
|
|
650
|
-
r.forEach((i,
|
|
651
|
-
if (
|
|
651
|
+
r.forEach((i, c) => {
|
|
652
|
+
if (c === r.length - 1) return;
|
|
652
653
|
const d = document.createElement("div");
|
|
653
654
|
d.className = "resize-handle", d.style.cssText = `
|
|
654
655
|
position: absolute;
|
|
@@ -664,18 +665,18 @@ function ye(e) {
|
|
|
664
665
|
E || (d.style.background = "rgba(0, 102, 204, 0.3)");
|
|
665
666
|
}), d.addEventListener("mouseleave", () => {
|
|
666
667
|
E || (d.style.background = "transparent");
|
|
667
|
-
}), d.addEventListener("mousedown", (
|
|
668
|
-
|
|
668
|
+
}), d.addEventListener("mousedown", (u) => {
|
|
669
|
+
u.preventDefault(), u.stopPropagation(), Ee(u, c);
|
|
669
670
|
});
|
|
670
671
|
const s = i;
|
|
671
672
|
s.style.position || (s.style.position = "relative", I.add(s)), i.appendChild(d);
|
|
672
673
|
});
|
|
673
674
|
const a = document.createElement("div");
|
|
674
675
|
a.className = "table-resize-handle", a.addEventListener("mousedown", (i) => {
|
|
675
|
-
i.preventDefault(), i.stopPropagation(),
|
|
676
|
+
i.preventDefault(), i.stopPropagation(), xe(i);
|
|
676
677
|
}), t.appendChild(a);
|
|
677
678
|
}
|
|
678
|
-
function
|
|
679
|
+
function Ee(e, t) {
|
|
679
680
|
if (E = !0, k = t, O = e.clientX, !b) return;
|
|
680
681
|
const n = b.querySelector("thead tr, tbody tr:first-child");
|
|
681
682
|
n && n.cells[t] && (P = n.cells[t].offsetWidth), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
|
|
@@ -690,64 +691,64 @@ function ke(e, t) {
|
|
|
690
691
|
};
|
|
691
692
|
document.addEventListener("mousemove", o), document.addEventListener("mouseup", l);
|
|
692
693
|
}
|
|
693
|
-
function
|
|
694
|
+
function xe(e) {
|
|
694
695
|
if (!b) return;
|
|
695
|
-
R = !0, K = e.clientX,
|
|
696
|
+
R = !0, K = e.clientX, _ = e.clientY, W = b.offsetWidth, X = b.offsetHeight, document.body.style.cursor = "nwse-resize", document.body.style.userSelect = "none";
|
|
696
697
|
const t = (o) => {
|
|
697
698
|
if (!R || !b) return;
|
|
698
|
-
const l = o.clientX - K, r = o.clientY -
|
|
699
|
+
const l = o.clientX - K, r = o.clientY - _, a = Math.max(200, W + l), i = Math.max(100, X + r);
|
|
699
700
|
b.style.width = a + "px", b.style.height = i + "px";
|
|
700
701
|
}, n = () => {
|
|
701
702
|
R = !1, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
|
|
702
703
|
};
|
|
703
704
|
document.addEventListener("mousemove", t), document.addEventListener("mouseup", n);
|
|
704
705
|
}
|
|
705
|
-
function
|
|
706
|
+
function He() {
|
|
706
707
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
707
708
|
<path d="M2 7h12V5H2v2zm0 4h12V9H2v2zM8 1v3H5v2h3v3h2V6h3V4h-3V1H8z"/>
|
|
708
709
|
</svg>`;
|
|
709
710
|
}
|
|
710
|
-
function
|
|
711
|
+
function Re() {
|
|
711
712
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
712
713
|
<path d="M2 3h12V1H2v2zm0 4h12V5H2v2zm6 4v3h3v-2h2v-2h-2v-3h-2v3H5v2h3z"/>
|
|
713
714
|
</svg>`;
|
|
714
715
|
}
|
|
715
|
-
function
|
|
716
|
+
function Te() {
|
|
716
717
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
717
718
|
<path d="M2 5h12v2H2V5zm0 4h12v2H2V9zm4-6v2H4v2h2v2h2V7h2V5H8V3H6z"/>
|
|
718
719
|
</svg>`;
|
|
719
720
|
}
|
|
720
|
-
function
|
|
721
|
+
function ze() {
|
|
721
722
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
722
723
|
<path d="M7 2v12h2V2H7zm4 0v12h2V2h-2zM1 8h3v-3H1v3zm3 2H1v3h3v-3z"/>
|
|
723
724
|
</svg>`;
|
|
724
725
|
}
|
|
725
|
-
function
|
|
726
|
+
function Se() {
|
|
726
727
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
727
728
|
<path d="M2 2v12h2V2H2zm4 0v12h2V2H6zM12 8h3v-3h-3v3zm0 2h3v3h-3v-3z"/>
|
|
728
729
|
</svg>`;
|
|
729
730
|
}
|
|
730
|
-
function
|
|
731
|
+
function Ie() {
|
|
731
732
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
732
733
|
<path d="M5 2v12h2V2H5zm4 0v12h2V2H9zm3 2h3V1h-3v3zm3 2h-3v3h3V6zm0 4h-3v3h3v-3z"/>
|
|
733
734
|
</svg>`;
|
|
734
735
|
}
|
|
735
|
-
function
|
|
736
|
+
function Me() {
|
|
736
737
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
737
738
|
<path d="M2 2h12v3H2V2zm0 5h12v8H2V7zm2 2v4h2V9H4zm4 0v4h2V9H8zm4 0v4h2V9h-2z"/>
|
|
738
739
|
</svg>`;
|
|
739
740
|
}
|
|
740
|
-
function
|
|
741
|
+
function Le() {
|
|
741
742
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
742
743
|
<path d="M2 2v12h3V2H2zm5 0v12h8V2H7zm2 2h4v2H9V4zm0 4h4v2H9V8zm0 4h4v2H9v-2z"/>
|
|
743
744
|
</svg>`;
|
|
744
745
|
}
|
|
745
|
-
function
|
|
746
|
+
function Ae() {
|
|
746
747
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
747
748
|
<path d="M3 1h10v1H3V1zm1 2v11h8V3H4zM6 5h1v6H6V5zm3 0h1v6H9V5z"/>
|
|
748
749
|
</svg>`;
|
|
749
750
|
}
|
|
750
|
-
function
|
|
751
|
+
function Ne() {
|
|
751
752
|
return `<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
752
753
|
<path d="M2 2h4v3H2V2zm5 0h4v3H7V2zm5 0h2v3h-2V2zm-10 4h4v3H2V6zm5 0h4v3H7V6zm5 0h2v3h-2V6zm-10 4h4v3H2v-3zm5 0h4v3H7v-3zm5 0h2v3h-2v-3z"/>
|
|
753
754
|
</svg>`;
|
|
@@ -755,11 +756,11 @@ function Ae() {
|
|
|
755
756
|
if (typeof window < "u" && !window.__tablePluginInitialized) {
|
|
756
757
|
window.__tablePluginInitialized = !0;
|
|
757
758
|
const e = () => {
|
|
758
|
-
|
|
759
|
+
we();
|
|
759
760
|
};
|
|
760
761
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", e) : setTimeout(e, 100);
|
|
761
762
|
}
|
|
762
|
-
const
|
|
763
|
+
const De = () => ({
|
|
763
764
|
name: "table",
|
|
764
765
|
toolbar: [
|
|
765
766
|
{
|
|
@@ -779,5 +780,5 @@ const Ne = () => ({
|
|
|
779
780
|
}
|
|
780
781
|
});
|
|
781
782
|
export {
|
|
782
|
-
|
|
783
|
+
De as TablePlugin
|
|
783
784
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@editora/plugins",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "Enterprise plugin suite for Editora rich text editor in React and web apps, including tables, media, workflow, and compliance tooling.",
|
|
5
5
|
"author": "Ajay Kumar <ajaykr089@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -437,7 +437,7 @@
|
|
|
437
437
|
"verify:citations": "npm run typecheck:build && npm run test:citations && npm run test:content-rules && npm run test:approval-workflow && npm run test:pii-redaction && npm run test:smart-paste && npm run test:blocks-library && npm run test:doc-schema && npm run test:translation-workflow && npm run test:format-painter && npm run test:toolbar-icons && npm run test:dom && npm run build"
|
|
438
438
|
},
|
|
439
439
|
"peerDependencies": {
|
|
440
|
-
"@editora/core": "^1.0.
|
|
440
|
+
"@editora/core": "^1.0.27"
|
|
441
441
|
},
|
|
442
442
|
"dependencies": {
|
|
443
443
|
"@editora/light-code-editor": "^1.0.19",
|
|
@@ -445,7 +445,7 @@
|
|
|
445
445
|
"mathjax": "^3.2.2"
|
|
446
446
|
},
|
|
447
447
|
"devDependencies": {
|
|
448
|
-
"@editora/core": "^1.0.
|
|
448
|
+
"@editora/core": "^1.0.27",
|
|
449
449
|
"@types/katex": "^0.16.8",
|
|
450
450
|
"dompurify": "^3.4.16",
|
|
451
451
|
"typescript": "^5.0.0",
|