@editora/plugins 1.0.16 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CodePlugin.native-Bwf25lLX.js +460 -0
- package/dist/CodePlugin.native-Cpp4u3Jl.mjs +648 -0
- package/dist/a11y-checker.cjs.js +16 -16
- package/dist/a11y-checker.esm.js +79 -75
- package/dist/anchor.cjs.js +9 -9
- package/dist/anchor.esm.js +61 -60
- package/dist/anchoredPopover-Bg-ey7Yo.js +1 -0
- package/dist/anchoredPopover-D_JbjvdA.mjs +111 -0
- package/dist/approval-workflow.cjs.js +5 -5
- package/dist/approval-workflow.esm.js +105 -104
- package/dist/background-color.cjs.js +1 -1
- package/dist/background-color.esm.js +1 -1
- package/dist/blocks-library.cjs.js +6 -6
- package/dist/blocks-library.esm.js +226 -202
- package/dist/capitalization.cjs.js +1 -1
- package/dist/capitalization.esm.js +9 -4
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +154 -116
- package/dist/citations.cjs.js +43 -18
- package/dist/citations.esm.js +465 -446
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/clear-formatting.esm.js +21 -20
- package/dist/code-sample.cjs.js +85 -66
- package/dist/code-sample.esm.js +301 -190
- package/dist/code.cjs.js +1 -669
- package/dist/code.esm.js +2 -4560
- package/dist/collaboration.cjs.js +68 -0
- package/dist/collaboration.esm.js +7428 -0
- package/dist/comments.cjs.js +11 -11
- package/dist/comments.esm.js +284 -237
- package/dist/conditional-content.cjs.js +67 -60
- package/dist/conditional-content.esm.js +270 -220
- package/dist/data-binding.cjs.js +3 -3
- package/dist/data-binding.esm.js +28 -27
- package/dist/dialogHelpers-5d5BuOCW.mjs +39 -0
- package/dist/dialogHelpers-zU6zpMIA.js +12 -0
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +1 -1
- package/dist/{documentManager-Jf0RbSks.js → documentManager-BDz6tovy.js} +2 -2
- package/dist/{documentManager-CTqRftU8.mjs → documentManager-yjRBab4v.mjs} +3 -3
- package/dist/embed-iframe.cjs.js +37 -17
- package/dist/embed-iframe.esm.js +188 -143
- package/dist/emojis.cjs.js +13 -10
- package/dist/emojis.esm.js +288 -76
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +9 -7
- package/dist/escapeHtml-D2Zh82pD.js +1 -0
- package/dist/escapeHtml-DyksyvcZ.mjs +6 -0
- package/dist/font-family.cjs.js +1 -1
- package/dist/font-family.esm.js +48 -41
- package/dist/font-size.cjs.js +1 -1
- package/dist/font-size.esm.js +67 -60
- package/dist/format-painter.cjs.js +1 -1
- package/dist/format-painter.esm.js +2 -1
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +40 -36
- package/dist/historyHelpers-BEKwNOtA.mjs +14 -0
- package/dist/historyHelpers-Cu8Pk7m1.js +1 -0
- package/dist/index-Bm1eqYHh.mjs +194 -0
- package/dist/index-CoflqYuK.js +30 -0
- package/dist/index-CxhJLMPS.js +221 -0
- package/dist/{index-D3CycEFU.mjs → index-Di1ZqIDs.mjs} +6420 -6232
- package/dist/index.cjs.js +1 -1
- package/dist/{index.es-DQ78mYYo.mjs → index.es-B7pVaNEV.mjs} +1558 -1542
- package/dist/{index.es-CE_A4QSm.js → index.es-I9N4o4Iq.js} +5 -5
- package/dist/index.esm.js +17 -15
- package/dist/{jspdf.es.min-BoS80556.js → jspdf.es.min-B5Idu0Wl.js} +2 -2
- package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-BCzHIwvz.mjs} +3 -2
- package/dist/link.cjs.js +17 -13
- package/dist/link.esm.js +138 -69
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +66 -33
- package/dist/math.cjs.js +22 -22
- package/dist/math.esm.js +221 -126
- package/dist/media-manager.cjs.js +12 -12
- package/dist/media-manager.esm.js +55 -50
- package/dist/mentions.cjs.js +2 -2
- package/dist/mentions.esm.js +17 -12
- package/dist/merge-tag.cjs.js +2 -2
- package/dist/merge-tag.esm.js +43 -42
- package/dist/plugins.css +1 -1
- package/dist/preview.cjs.js +3 -3
- package/dist/preview.esm.js +30 -27
- package/dist/{purify.es-T2a3nLiC.js → purify.es-DWpzYfqy.js} +1 -1
- package/dist/{purify.es-DHhaBdbu.mjs → purify.es-Dewe88eZ.mjs} +2 -2
- package/dist/slash-commands.cjs.js +13 -7
- package/dist/slash-commands.esm.js +90 -79
- package/dist/smart-paste.cjs.js +5 -5
- package/dist/smart-paste.esm.js +85 -81
- package/dist/special-characters.cjs.js +6 -3
- package/dist/special-characters.esm.js +72 -25
- package/dist/spell-check.cjs.js +8 -8
- package/dist/spell-check.esm.js +10189 -295
- package/dist/table.cjs.js +166 -13
- package/dist/table.esm.js +543 -266
- package/dist/template.cjs.js +11 -11
- package/dist/template.esm.js +290 -264
- package/dist/text-color.cjs.js +1 -1
- package/dist/text-color.esm.js +1 -1
- package/dist/translation-workflow.cjs.js +4 -4
- package/dist/translation-workflow.esm.js +33 -31
- package/dist/version-diff.cjs.js +6 -6
- package/dist/version-diff.esm.js +40 -40
- package/package.json +10 -4
- package/dist/anchoredPopover-BzqGPOAE.js +0 -1
- package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
- package/dist/index-BFsKNTTj.mjs +0 -145
- package/dist/index-CvJk4DKa.js +0 -221
- package/dist/index-tqLTHcO6.js +0 -1
package/dist/table.cjs.js
CHANGED
|
@@ -1,8 +1,161 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const L=require("./editorContainerHelpers-CFbfiOJI.js");let c=null,u=null,V=null,A=null,B=null,N=null,D=null;const H='[data-theme="dark"], .dark, .editora-theme-dark';let y=!1,k=null,q=0,O=0,T=!1,P=0,_=0,W=0,X=0;const J=new Set(["DIV","P","BLOCKQUOTE","PRE","H1","H2","H3","H4","H5","H6","LI","TD","TH"]);function K(e,t){let n=e;for(;n&&n!==t;){if(n.nodeType===Node.ELEMENT_NODE&&J.has(n.tagName))return n;n=n.parentNode}return null}function U(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 Z=()=>{const e=L.findEditorContainerFromSelection(),t=L.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"),S=document.createElement("p");S.appendChild(document.createElement("br")),x.appendChild(S),g.appendChild(x)}i.appendChild(g)}l.appendChild(r),l.appendChild(i);const h=U(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),b=d(o.startContainer,o.startOffset,!1),C=s&&K(s,t)||b&&K(b,t);C&&C.parentNode?C.parentNode.insertBefore(h,C.nextSibling):(o.collapse(!1),o.insertNode(h));const I=l.querySelector("th p");if(I){const m=document.createRange();m.setStart(I,0),m.collapse(!0),n.removeAllRanges(),n.addRange(m)}t.focus()},$=()=>{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"),h=document.createElement("p");h.innerHTML="<br>",i.appendChild(h),o.appendChild(i)}const r=t.rows[n];r&&r.parentElement?r.parentElement.insertBefore(o,r):t.appendChild(o),p()},ee=()=>{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()},te=()=>{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()},ne=()=>{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()},oe=()=>{const e=f();if(!e||e.rowCount<=1)return;const{table:t,rowIndex:n,colIndex:o}=e;t.deleteRow(n),G(t,n,o),p()},re=()=>{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)}G(t,n,o),p()},le=()=>{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 F(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 F(o,"th");p()};function F(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 ae=()=>{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 h=l.attributes[i];a.setAttribute(h.name,h.value)}l.parentNode?.replaceChild(a,l)}}p()},ie=()=>{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 j(e){if(!e)return!1;const t=e.closest("[contenteditable]");return!t||t.getAttribute("contenteditable")==="false"?!1:!t.closest('[data-readonly="true"]')}function de(){const e=window.getSelection(),t=e&&e.rangeCount>0?e.getRangeAt(0).startContainer:null;return v(t,".rte-content")||(u?u.closest(".rte-content"):null)}function se(e,t,n){const o=window.execEditorCommand||window.executeEditorCommand;if(typeof o=="function")try{o("recordDomTransaction",e,t,n)}catch{}}function Y(e){const t=de();if(t&&!j(t))return;const n=t?t.innerHTML:"";if(e(),!t)return;const o=t.innerHTML;o!==n&&(se(t,n,o),t.dispatchEvent(new Event("input",{bubbles:!0})))}function G(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 ce=()=>{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 b=parseInt(d.getAttribute(s)||"1",10);return Number.isFinite(b)&&b>0?b: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 h=i;if(h){for(let d=0;d<h.cells.length;d++)if(h.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(!c||!u)return;const e=f();if(!e)return;const t=e.rowCount>1,n=e.cellCount>1;Q(t,n)}function ue(){V=()=>{const e=f();e&&j(e.table)?he(e.table):z()},A=e=>{const t=v(e.target,"table"),n=v(e.target,".table-toolbar");!t&&!n&&z()},B=()=>{z()},N=()=>{u&&c&&c.style.display!=="none"&&M(u)},D=()=>{u&&c&&c.style.display!=="none"&&M(u)},document.addEventListener("selectionchange",V),document.addEventListener("mousedown",A),document.addEventListener("tableDeleted",B),window.addEventListener("scroll",N,!0),window.addEventListener("resize",D)}function M(e){if(!c)return;const t=e.getBoundingClientRect(),n=c.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 h=window.innerWidth;i+l>h-r&&(i=h-l-r);const d=window.innerHeight;a+o>d-r&&(a=d-o-r),c.style.top=a+"px",c.style.left=i+"px"}function he(e){u=e,c||(c=me(),document.body.appendChild(c));const t=!!e.closest(H)||document.body.matches(H)||document.documentElement.matches(H);c.classList.toggle("rte-theme-dark",t),c.style.display="flex",c.style.visibility="hidden",requestAnimationFrame(()=>{M(e),c&&(c.style.visibility="visible")});const n=f();n&&Q(n.rowCount>1,n.cellCount>1),fe(e)}function z(){if(c&&(c.style.display="none"),u){u.querySelectorAll(".resize-handle").forEach(o=>o.remove());const t=u.parentElement,n=t?.classList.contains("rte-table-wrapper")?t.querySelector(".table-resize-handle"):u.querySelector(".table-resize-handle");n&&n.remove()}u=null}function Q(e,t){if(!c)return;const n=c.querySelector('[data-action="deleteRow"]'),o=c.querySelector('[data-action="deleteColumn"]');n&&(n.disabled=!e),o&&(o.disabled=!t)}let R=!1;function be(){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=`
|
|
2
|
+
.table-toolbar {
|
|
3
|
+
background: white;
|
|
4
|
+
border: 1px solid #d0d0d0;
|
|
5
|
+
border-radius: 4px;
|
|
6
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
7
|
+
padding: 4px;
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
gap: 0;
|
|
11
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
12
|
+
min-width: max-content;
|
|
13
|
+
}
|
|
14
|
+
.toolbar-section {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
gap: 2px;
|
|
18
|
+
}
|
|
19
|
+
.toolbar-divider {
|
|
20
|
+
width: 1px;
|
|
21
|
+
height: 20px;
|
|
22
|
+
background: #e0e0e0;
|
|
23
|
+
margin: 0 4px;
|
|
24
|
+
}
|
|
25
|
+
.toolbar-icon-btn {
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
width: 28px;
|
|
30
|
+
height: 28px;
|
|
31
|
+
padding: 0;
|
|
32
|
+
border: 1px solid transparent;
|
|
33
|
+
background: transparent;
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
color: #333;
|
|
36
|
+
border-radius: 3px;
|
|
37
|
+
transition: all 0.2s ease;
|
|
38
|
+
flex-shrink: 0;
|
|
39
|
+
font-size: 14px;
|
|
40
|
+
line-height: 1;
|
|
41
|
+
}
|
|
42
|
+
.toolbar-icon-btn svg {
|
|
43
|
+
width: 16px;
|
|
44
|
+
height: 16px;
|
|
45
|
+
}
|
|
46
|
+
.toolbar-icon-btn:hover:not(:disabled) {
|
|
47
|
+
background: #f0f0f0;
|
|
48
|
+
border-color: #d0d0d0;
|
|
49
|
+
color: #0066cc;
|
|
50
|
+
}
|
|
51
|
+
.toolbar-icon-btn:active:not(:disabled) {
|
|
52
|
+
background: #e8f0ff;
|
|
53
|
+
border-color: #0066cc;
|
|
54
|
+
transform: scale(0.95);
|
|
55
|
+
}
|
|
56
|
+
.toolbar-icon-btn:disabled {
|
|
57
|
+
opacity: 0.4;
|
|
58
|
+
cursor: not-allowed;
|
|
59
|
+
color: #ccc;
|
|
60
|
+
}
|
|
61
|
+
.toolbar-icon-btn-danger {
|
|
62
|
+
color: #d32f2f;
|
|
63
|
+
}
|
|
64
|
+
.toolbar-icon-btn-danger:hover:not(:disabled) {
|
|
65
|
+
background: #fff3f3;
|
|
66
|
+
border-color: #ffcccc;
|
|
67
|
+
color: #d32f2f;
|
|
68
|
+
}
|
|
69
|
+
.toolbar-icon-btn-danger:active:not(:disabled) {
|
|
70
|
+
background: #ffebee;
|
|
71
|
+
}
|
|
72
|
+
.toolbar-icon-btn-delete {
|
|
73
|
+
color: #d32f2f;
|
|
74
|
+
}
|
|
75
|
+
.toolbar-icon-btn-delete:hover:not(:disabled) {
|
|
76
|
+
background: #fff3f3;
|
|
77
|
+
border-color: #ffcccc;
|
|
78
|
+
color: #d32f2f;
|
|
79
|
+
}
|
|
80
|
+
.toolbar-icon-btn-delete:active:not(:disabled) {
|
|
81
|
+
background: #ffebee;
|
|
82
|
+
}
|
|
83
|
+
:is([data-theme="dark"], .dark, .editora-theme-dark) .table-toolbar,
|
|
84
|
+
.table-toolbar.rte-theme-dark {
|
|
85
|
+
background: linear-gradient(180deg, #2f3844 0%, #2a323c 100%);
|
|
86
|
+
border-color: #4d596b;
|
|
87
|
+
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
|
|
88
|
+
}
|
|
89
|
+
:is([data-theme="dark"], .dark, .editora-theme-dark) .toolbar-divider,
|
|
90
|
+
.table-toolbar.rte-theme-dark .toolbar-divider {
|
|
91
|
+
background: #4d596b;
|
|
92
|
+
}
|
|
93
|
+
:is([data-theme="dark"], .dark, .editora-theme-dark) .toolbar-icon-btn,
|
|
94
|
+
.table-toolbar.rte-theme-dark .toolbar-icon-btn {
|
|
95
|
+
color: #d7deea;
|
|
96
|
+
border-color: transparent;
|
|
97
|
+
}
|
|
98
|
+
:is([data-theme="dark"], .dark, .editora-theme-dark) .toolbar-icon-btn svg,
|
|
99
|
+
.table-toolbar.rte-theme-dark .toolbar-icon-btn svg {
|
|
100
|
+
color: currentColor;
|
|
101
|
+
}
|
|
102
|
+
:is([data-theme="dark"], .dark, .editora-theme-dark) .toolbar-icon-btn svg [stroke="#000" i],
|
|
103
|
+
:is([data-theme="dark"], .dark, .editora-theme-dark) .toolbar-icon-btn svg [stroke="#000000" i],
|
|
104
|
+
:is([data-theme="dark"], .dark, .editora-theme-dark) .toolbar-icon-btn svg [stroke="black" i],
|
|
105
|
+
.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [stroke="#000" i],
|
|
106
|
+
.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [stroke="#000000" i],
|
|
107
|
+
.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [stroke="black" i] {
|
|
108
|
+
stroke: currentColor !important;
|
|
109
|
+
}
|
|
110
|
+
:is([data-theme="dark"], .dark, .editora-theme-dark) .toolbar-icon-btn svg [fill="#000" i],
|
|
111
|
+
:is([data-theme="dark"], .dark, .editora-theme-dark) .toolbar-icon-btn svg [fill="#000000" i],
|
|
112
|
+
:is([data-theme="dark"], .dark, .editora-theme-dark) .toolbar-icon-btn svg [fill="black" i],
|
|
113
|
+
.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [fill="#000" i],
|
|
114
|
+
.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [fill="#000000" i],
|
|
115
|
+
.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [fill="black" i] {
|
|
116
|
+
fill: currentColor !important;
|
|
117
|
+
}
|
|
118
|
+
:is([data-theme="dark"], .dark, .editora-theme-dark) .toolbar-icon-btn:hover:not(:disabled),
|
|
119
|
+
.table-toolbar.rte-theme-dark .toolbar-icon-btn:hover:not(:disabled) {
|
|
120
|
+
background: #3a4554;
|
|
121
|
+
border-color: #607088;
|
|
122
|
+
color: #f3f8ff;
|
|
123
|
+
}
|
|
124
|
+
:is([data-theme="dark"], .dark, .editora-theme-dark) .toolbar-icon-btn:active:not(:disabled),
|
|
125
|
+
.table-toolbar.rte-theme-dark .toolbar-icon-btn:active:not(:disabled) {
|
|
126
|
+
background: #4a95de;
|
|
127
|
+
border-color: #67adf4;
|
|
128
|
+
color: #0f1b2a;
|
|
129
|
+
}
|
|
130
|
+
:is([data-theme="dark"], .dark, .editora-theme-dark) .toolbar-icon-btn:disabled,
|
|
131
|
+
.table-toolbar.rte-theme-dark .toolbar-icon-btn:disabled {
|
|
132
|
+
color: #7f8ca1;
|
|
133
|
+
}
|
|
134
|
+
@media (max-width: 768px) {
|
|
135
|
+
.table-toolbar {
|
|
136
|
+
padding: 3px;
|
|
137
|
+
gap: 0;
|
|
138
|
+
max-width: 90vw;
|
|
139
|
+
overflow-x: auto;
|
|
140
|
+
}
|
|
141
|
+
.toolbar-icon-btn {
|
|
142
|
+
width: 26px;
|
|
143
|
+
height: 26px;
|
|
144
|
+
}
|
|
145
|
+
.toolbar-divider {
|
|
146
|
+
height: 18px;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
@media print {
|
|
150
|
+
.table-toolbar {
|
|
151
|
+
display: none;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
`,document.head.appendChild(e)}function me(){be();const e=document.createElement("div");e.className="table-toolbar",e.style.cssText=`
|
|
2
155
|
position: fixed;
|
|
3
156
|
z-index: 1000;
|
|
4
157
|
display: none;
|
|
5
|
-
`,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 b=document.createElement("button");return b.className="toolbar-icon-btn",s.danger&&b.classList.add("toolbar-icon-btn-danger"),s.delete&&b.classList.add("toolbar-icon-btn-delete"),b.innerHTML=s.icon,b.title=s.title,b.setAttribute("aria-label",s.title),b.setAttribute("type","button"),b.setAttribute("data-action",s.action),b.onclick=()=>E(s.action),b},n=()=>{const s=document.createElement("div");return s.className="toolbar-divider",s},o=(...s)=>{const b=document.createElement("div");return b.className="toolbar-section",s.forEach(C=>b.appendChild(C)),b},l=o(t({icon:we(),title:"Add row above (Ctrl+Shift+R)",action:"addRowAbove"}),t({icon:ve(),title:"Add row below",action:"addRowBelow"}),t({icon:Ce(),title:"Delete row",action:"deleteRow",danger:!0})),r=o(t({icon:ke(),title:"Add column left",action:"addColumnLeft"}),t({icon:ye(),title:"Add column right (Ctrl+Shift+C)",action:"addColumnRight"}),t({icon:Ee(),title:"Delete column",action:"deleteColumn",danger:!0})),a=o(t({icon:xe(),title:"Toggle header row",action:"toggleHeaderRow"}),t({icon:He(),title:"Toggle header column",action:"toggleHeaderColumn"})),i=o(t({icon:ze(),title:"Merge cells (horizontally)",action:"mergeCells"})),h=o(t({icon:Te(),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(h);const d=s=>{!c||c.style.display==="none"||(s.ctrlKey||s.metaKey)&&s.shiftKey&&(s.key==="r"||s.key==="R"?(s.preventDefault(),E("addRowBelow")):(s.key==="c"||s.key==="C")&&(s.preventDefault(),E("addColumnRight")))};return window.addEventListener("keydown",d),e}function E(e){Y(()=>{switch(e){case"addRowAbove":$();break;case"addRowBelow":ee();break;case"addColumnLeft":te();break;case"addColumnRight":ne();break;case"deleteRow":oe();break;case"deleteColumn":re();break;case"toggleHeaderRow":le();break;case"toggleHeaderColumn":ae();break;case"deleteTable":ie();break;case"mergeCells":ce();break}})}function fe(e){const t=U(e);e.querySelectorAll(".resize-handle").forEach(i=>i.remove());const o=t.querySelector(".table-resize-handle");o&&o.remove();const l=e.querySelector("thead tr, tbody tr:first-child");if(!l)return;const r=l.querySelectorAll("td, th");r.forEach((i,h)=>{if(h===r.length-1)return;const d=document.createElement("div");d.className="resize-handle",d.style.cssText=`
|
|
6
159
|
position: absolute;
|
|
7
160
|
right: -4px;
|
|
8
161
|
top: 0;
|
|
@@ -12,24 +165,24 @@
|
|
|
12
165
|
cursor: col-resize;
|
|
13
166
|
z-index: 10;
|
|
14
167
|
transition: background 0.15s ease;
|
|
15
|
-
`,d.addEventListener("mouseenter",()=>{
|
|
168
|
+
`,d.addEventListener("mouseenter",()=>{y||(d.style.background="rgba(0, 102, 204, 0.3)")}),d.addEventListener("mouseleave",()=>{y||(d.style.background="transparent")}),d.addEventListener("mousedown",s=>{s.preventDefault(),s.stopPropagation(),pe(s,h)}),i.style.position="relative",i.appendChild(d)});const a=document.createElement("div");a.className="table-resize-handle",a.addEventListener("mousedown",i=>{i.preventDefault(),i.stopPropagation(),ge(i)}),t.appendChild(a)}function pe(e,t){if(y=!0,k=t,q=e.clientX,!u)return;const n=u.querySelector("thead tr, tbody tr:first-child");n&&n.cells[t]&&(O=n.cells[t].offsetWidth),document.body.style.cursor="col-resize",document.body.style.userSelect="none";const o=r=>{if(!y||k===null||!u)return;const a=r.clientX-q,i=Math.max(50,O+a);u.querySelectorAll("tr").forEach(d=>{d.cells[k]&&(d.cells[k].style.width=i+"px")})},l=()=>{y=!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 ge(e){if(!u)return;T=!0,P=e.clientX,_=e.clientY,W=u.offsetWidth,X=u.offsetHeight,document.body.style.cursor="nwse-resize",document.body.style.userSelect="none";const t=o=>{if(!T||!u)return;const l=o.clientX-P,r=o.clientY-_,a=Math.max(200,W+l),i=Math.max(100,X+r);u.style.width=a+"px",u.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 we(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
16
169
|
<path d="M2 7h12V5H2v2zm0 4h12V9H2v2zM8 1v3H5v2h3v3h2V6h3V4h-3V1H8z"/>
|
|
17
|
-
</svg>`}function
|
|
170
|
+
</svg>`}function ve(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
18
171
|
<path d="M2 3h12V1H2v2zm0 4h12V5H2v2zm6 4v3h3v-2h2v-2h-2v-3h-2v3H5v2h3z"/>
|
|
19
|
-
</svg>`}function
|
|
172
|
+
</svg>`}function Ce(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
20
173
|
<path d="M2 5h12v2H2V5zm0 4h12v2H2V9zm4-6v2H4v2h2v2h2V7h2V5H8V3H6z"/>
|
|
21
|
-
</svg>`}function
|
|
174
|
+
</svg>`}function ke(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
22
175
|
<path d="M7 2v12h2V2H7zm4 0v12h2V2h-2zM1 8h3v-3H1v3zm3 2H1v3h3v-3z"/>
|
|
23
|
-
</svg>`}function
|
|
176
|
+
</svg>`}function ye(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
24
177
|
<path d="M2 2v12h2V2H2zm4 0v12h2V2H6zM12 8h3v-3h-3v3zm0 2h3v3h-3v-3z"/>
|
|
25
|
-
</svg>`}function
|
|
178
|
+
</svg>`}function Ee(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
26
179
|
<path d="M5 2v12h2V2H5zm4 0v12h2V2H9zm3 2h3V1h-3v3zm3 2h-3v3h3V6zm0 4h-3v3h3v-3z"/>
|
|
27
|
-
</svg>`}function
|
|
180
|
+
</svg>`}function xe(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
28
181
|
<path d="M2 2h12v3H2V2zm0 5h12v8H2V7zm2 2v4h2V9H4zm4 0v4h2V9H8zm4 0v4h2V9h-2z"/>
|
|
29
|
-
</svg>`}function
|
|
182
|
+
</svg>`}function He(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
30
183
|
<path d="M2 2v12h3V2H2zm5 0v12h8V2H7zm2 2h4v2H9V4zm0 4h4v2H9V8zm0 4h4v2H9v-2z"/>
|
|
31
|
-
</svg>`}function
|
|
184
|
+
</svg>`}function Te(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
32
185
|
<path d="M3 1h10v1H3V1zm1 2v11h8V3H4zM6 5h1v6H6V5zm3 0h1v6H9V5z"/>
|
|
33
|
-
</svg>`}function
|
|
186
|
+
</svg>`}function ze(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
34
187
|
<path d="M2 2h4v3H2V2zm5 0h4v3H7V2zm5 0h2v3h-2V2zm-10 4h4v3H2V6zm5 0h4v3H7V6zm5 0h2v3h-2V6zm-10 4h4v3H2v-3zm5 0h4v3H7v-3zm5 0h2v3h-2v-3z"/>
|
|
35
|
-
</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=()=>{ue()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):setTimeout(e,100)}const Re=()=>({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:()=>(Y(()=>{Z()}),!0)},keymap:{"Mod-Shift-r":()=>(E("addRowBelow"),!0),"Mod-Shift-c":()=>(E("addColumnRight"),!0)}});exports.TablePlugin=Re;
|