@editora/plugins 1.0.10 → 1.0.11
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/_commonjsHelpers-BH3jXuIh.js +1 -0
- package/dist/_commonjsHelpers-ByX85dGu.mjs +33 -0
- package/dist/a11y-checker.cjs.js +12 -12
- package/dist/a11y-checker.esm.js +80 -98
- package/dist/anchor.cjs.js +12 -12
- package/dist/anchor.esm.js +115 -128
- package/dist/anchoredPopover-BzqGPOAE.js +1 -0
- package/dist/anchoredPopover-Dts0IrgU.mjs +106 -0
- package/dist/approval-workflow.cjs.js +40 -40
- package/dist/approval-workflow.esm.js +208 -249
- package/dist/background-color.cjs.js +2 -2
- package/dist/background-color.esm.js +55 -68
- package/dist/blockquote.esm.js +1 -2
- package/dist/blocks-library.cjs.js +45 -45
- package/dist/blocks-library.esm.js +178 -245
- package/dist/capitalization.esm.js +1 -2
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +58 -82
- package/dist/citations.cjs.js +37 -37
- package/dist/citations.esm.js +439 -512
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/clear-formatting.esm.js +27 -33
- package/dist/code-sample.cjs.js +14 -14
- package/dist/code-sample.esm.js +82 -93
- package/dist/code.cjs.js +32 -32
- package/dist/code.esm.js +501 -506
- package/dist/comments.cjs.js +6 -6
- package/dist/comments.esm.js +116 -158
- package/dist/conditional-content.cjs.js +90 -90
- package/dist/conditional-content.esm.js +371 -432
- package/dist/content-rules.cjs.js +7 -7
- package/dist/content-rules.esm.js +105 -159
- package/dist/data-binding.cjs.js +46 -46
- package/dist/data-binding.esm.js +328 -368
- package/dist/direction.esm.js +9 -18
- package/dist/doc-schema.cjs.js +29 -29
- package/dist/doc-schema.esm.js +240 -308
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +4 -5
- package/dist/documentManager-CTqRftU8.mjs +8369 -0
- package/dist/documentManager-Jf0RbSks.js +17 -0
- package/dist/{editorContainerHelpers-69585c07.mjs → editorContainerHelpers-C7kdWnS0.mjs} +1 -2
- package/dist/embed-iframe.cjs.js +4 -4
- package/dist/embed-iframe.esm.js +73 -81
- package/dist/emojis.cjs.js +8 -8
- package/dist/emojis.esm.js +65 -77
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +54 -56
- package/dist/font-family.cjs.js +1 -1
- package/dist/font-family.esm.js +39 -47
- package/dist/font-size.cjs.js +1 -1
- package/dist/font-size.esm.js +37 -53
- package/dist/footnote.cjs.js +2 -2
- package/dist/footnote.esm.js +76 -117
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +70 -92
- package/dist/html2canvas.esm-B5qzocYs.js +5 -0
- package/dist/{html2canvas.esm-1a1724a1.mjs → html2canvas.esm-BWVIUcAF.mjs} +141 -225
- package/dist/indent.cjs.js +1 -1
- package/dist/indent.esm.js +12 -24
- package/dist/{index-f04538f2.mjs → index-BFsKNTTj.mjs} +70 -71
- package/dist/index-CvJk4DKa.js +221 -0
- package/dist/index-D3CycEFU.mjs +16543 -0
- package/dist/index-tqLTHcO6.js +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es-CE_A4QSm.js +5 -0
- package/dist/index.es-DQ78mYYo.mjs +6665 -0
- package/dist/index.esm.js +125 -128
- package/dist/italic.cjs.js +1 -1
- package/dist/italic.esm.js +8 -9
- package/dist/jspdf.es.min-BoS80556.js +77 -0
- package/dist/{jspdf.es.min-c36a4fd8.mjs → jspdf.es.min-DQCoX5yh.mjs} +3658 -4682
- package/dist/line-height.cjs.js +1 -1
- package/dist/line-height.esm.js +11 -24
- package/dist/link.cjs.js +5 -5
- package/dist/link.esm.js +24 -30
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +20 -25
- package/dist/lite.cjs.js +1 -1
- package/dist/lite.esm.js +59 -61
- package/dist/math.cjs.js +21 -21
- package/dist/math.esm.js +139 -146
- package/dist/media-manager.cjs.js +31 -31
- package/dist/media-manager.esm.js +285 -300
- package/dist/mentions.cjs.js +9 -9
- package/dist/mentions.esm.js +238 -286
- package/dist/merge-tag.cjs.js +2 -2
- package/dist/merge-tag.esm.js +177 -216
- package/dist/page-break.cjs.js +2 -2
- package/dist/page-break.esm.js +33 -49
- package/dist/pii-redaction.cjs.js +19 -19
- package/dist/pii-redaction.esm.js +393 -463
- package/dist/plugins.css +1 -0
- package/dist/preview.esm.js +5 -10
- package/dist/print.cjs.js +4 -4
- package/dist/print.esm.js +17 -20
- package/dist/{purify.es-35a15df8.mjs → purify.es-DHhaBdbu.mjs} +9 -19
- package/dist/{purify.es-a8d731c6.js → purify.es-T2a3nLiC.js} +1 -1
- package/dist/slash-commands.cjs.js +2 -2
- package/dist/slash-commands.esm.js +39 -75
- package/dist/smart-paste.cjs.js +27 -27
- package/dist/smart-paste.esm.js +280 -336
- package/dist/special-characters.cjs.js +7 -7
- package/dist/special-characters.esm.js +61 -69
- package/dist/spell-check.cjs.js +5 -5
- package/dist/spell-check.esm.js +97 -123
- package/dist/strikethrough.cjs.js +1 -1
- package/dist/strikethrough.esm.js +14 -19
- package/dist/table.cjs.js +4 -4
- package/dist/table.esm.js +191 -225
- package/dist/template.cjs.js +21 -20
- package/dist/template.esm.js +715 -196
- package/dist/text-alignment.cjs.js +1 -1
- package/dist/text-alignment.esm.js +21 -27
- package/dist/text-color.cjs.js +3 -3
- package/dist/text-color.esm.js +70 -87
- package/dist/track-changes.cjs.js +2 -2
- package/dist/track-changes.esm.js +100 -162
- package/dist/translation-workflow.cjs.js +74 -74
- package/dist/translation-workflow.esm.js +602 -678
- package/dist/version-diff.cjs.js +14 -14
- package/dist/version-diff.esm.js +128 -157
- package/package.json +1 -1
- package/dist/_commonjsHelpers-6763f629.js +0 -1
- package/dist/_commonjsHelpers-c5d32002.mjs +0 -30
- package/dist/anchoredPopover-33f1358d.mjs +0 -109
- package/dist/anchoredPopover-8151d535.js +0 -1
- package/dist/documentManager-25b6203c.mjs +0 -9122
- package/dist/documentManager-b69e7054.js +0 -17
- package/dist/html2canvas.esm-09133e29.js +0 -22
- package/dist/index-656d224b.js +0 -231
- package/dist/index-6a8c48bb.js +0 -1
- package/dist/index-d027b7e2.mjs +0 -16859
- package/dist/index.es-730f2d98.mjs +0 -5775
- package/dist/index.es-dd40173b.js +0 -18
- package/dist/jspdf.es.min-90db2c97.js +0 -243
- package/dist/style.css +0 -1
- /package/dist/{editorContainerHelpers-36b8ddf3.js → editorContainerHelpers-CFbfiOJI.js} +0 -0
package/dist/checklist.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const N="__editoraCommandEditorRoot",w=
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const N="__editoraCommandEditorRoot",w=e=>{if(!e)return null;const t=e.querySelector('[contenteditable="true"]');return t instanceof HTMLElement?t:null},A=()=>{if(typeof window>"u")return null;const e=window[N];if(!(e instanceof HTMLElement))return null;window[N]=null;const t=e.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")||(e.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")?e:null);if(t){const r=w(t);if(r)return r;if(t.getAttribute("contenteditable")==="true")return t}if(e.getAttribute("contenteditable")==="true")return e;const n=e.closest('[contenteditable="true"]');return n instanceof HTMLElement?n:null},_=()=>{const e=A();if(e&&document.contains(e))return e;const t=window.getSelection();if(t&&t.rangeCount>0){let r=t.getRangeAt(0).startContainer;for(;r&&r!==document.body;){if(r.nodeType===Node.ELEMENT_NODE){const o=r;if(o.getAttribute("contenteditable")==="true")return o}r=r.parentNode}}const n=document.activeElement;if(n){if(n.getAttribute("contenteditable")==="true")return n;const r=n.closest('[contenteditable="true"]');if(r)return r}return document.querySelector('[contenteditable="true"]')},S=e=>e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null,H=e=>{const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return e.contains(n.commonAncestorContainer)?n:null},y=e=>{e.dispatchEvent(new Event("input",{bubbles:!0}))},M=(e,t)=>{if(t===e.innerHTML)return;const n=window.execEditorCommand||window.executeEditorCommand;if(typeof n=="function")try{n("recordDomTransaction",e,t,e.innerHTML)}catch{}},k=(e,t)=>{if(!e.isConnected){t.focus({preventScroll:!0});return}const n=window.getSelection();if(!n)return;const r=document.createRange();r.selectNodeContents(e),r.collapse(!1),n.removeAllRanges();try{n.addRange(r)}catch{t.focus({preventScroll:!0});return}t.focus({preventScroll:!0})},v=e=>{let t=e.querySelector(":scope > p");if(!t){t=document.createElement("p");const n=[];e.childNodes.forEach(r=>{r.nodeType===Node.ELEMENT_NODE&&["UL","OL"].includes(r.tagName)||n.push(r)}),n.forEach(r=>t.appendChild(r)),e.insertBefore(t,e.firstChild)}return t.innerHTML.trim()||(t.innerHTML="<br>"),t},C=e=>{const t=document.createElement("li");t.setAttribute("data-type","checklist-item"),t.setAttribute("data-checked","false");const n=document.createElement("p");return n.innerHTML=e.trim()||"<br>",t.appendChild(n),t},T=e=>Array.from(e.children).filter(t=>t instanceof HTMLLIElement),I=new Set(["P","DIV","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","PRE","LI"]),b=e=>I.has(e.tagName)&&e.getAttribute("contenteditable")!=="true",R=(e,t)=>{const n=[],r=new Set,o=i=>{!i||r.has(i)||t.contains(i)&&b(i)&&(i.closest("ul, ol")||(r.add(i),n.push(i)))},u=i=>{let a=i;for(;a&&a!==document.body;){if(a.nodeType===Node.ELEMENT_NODE){const h=a;if(b(h))return h;if(h.getAttribute("contenteditable")==="true")break}a=a.parentNode}return null};if(e.collapsed)return o(u(e.startContainer)),n;const d=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const a=i;if(!b(a)||a.closest("ul, ol"))return NodeFilter.FILTER_SKIP;if(typeof e.intersectsNode=="function")return e.intersectsNode(a)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP;const h=document.createRange();return h.selectNodeContents(a),e.compareBoundaryPoints(Range.END_TO_START,h)>0&&e.compareBoundaryPoints(Range.START_TO_END,h)<0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let l=d.nextNode();for(;l;)o(l),l=d.nextNode();if(n.length===0&&o(u(e.commonAncestorContainer)),n.length<=1)return n;const m=n.filter(i=>!n.some(a=>a!==i&&i.contains(a)));return m.length>0?m:n},O=e=>{const t=[],n=document.createElement("div"),r=()=>{const o=n.innerHTML.trim();if(!o)return;const u=document.createElement("p");u.innerHTML=o,t.push(u),n.innerHTML=""};if(e.childNodes.forEach(o=>{if(o.nodeType===Node.ELEMENT_NODE&&["UL","OL"].includes(o.tagName)){r();return}if(o.nodeType===Node.ELEMENT_NODE&&o.tagName==="P"){r();const u=o.innerHTML.trim(),d=document.createElement("p");d.innerHTML=u||"<br>",t.push(d);return}o.nodeType===Node.TEXT_NODE&&!(o.textContent||"").trim()||n.appendChild(o.cloneNode(!0))}),r(),t.length===0){const o=document.createElement("p");o.innerHTML="<br>",t.push(o)}return t},P=()=>({name:"checklist",init:()=>{if(typeof document>"u"||typeof window>"u"||window.__checklistPluginClickInitialized)return;window.__checklistPluginClickInitialized=!0;const e=t=>{const r=t.target.closest('li[data-type="checklist-item"]');if(!r)return;const o=r.getBoundingClientRect();if(!(t.clientX-o.left<32))return;t.preventDefault(),t.stopPropagation();const l=r.closest("[contenteditable], .rte-content, .editora-content");if(l?.getAttribute("contenteditable")==="false"||!!l?.closest('[data-readonly="true"], .editora-editor[readonly], editora-editor[readonly]'))return;const i=l?.innerHTML||"",a=r.getAttribute("data-checked")==="true";r.setAttribute("data-checked",(!a).toString()),l&&(M(l,i),y(l))};document.addEventListener("click",e)},nodes:{checklist:{content:"checklistItem+",group:"block",parseDOM:[{tag:'ul[data-type="checklist"]'}],toDOM:()=>["ul",{"data-type":"checklist"},0]},checklistItem:{content:"paragraph",attrs:{checked:{default:!1}},parseDOM:[{tag:'li[data-type="checklist-item"]',getAttrs:e=>({checked:e.getAttribute("data-checked")==="true"})}],toDOM:e=>["li",{"data-type":"checklist-item","data-checked":e?.attrs?.checked?"true":"false"},0]}},toolbar:[{label:"Checklist",command:"toggleChecklist",icon:'<svg width="24px" height="24px" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="#000000"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.75 4.48h-.71L2 3.43l.71-.7.69.68L4.81 2l.71.71-1.77 1.77zM6.99 3h8v1h-8V3zm0 3h8v1h-8V6zm8 3h-8v1h8V9zm-8 3h8v1h-8v-1zM3.04 7.48h.71l1.77-1.77-.71-.7L3.4 6.42l-.69-.69-.71.71 1.04 1.04zm.71 3.01h-.71L2 9.45l.71-.71.69.69 1.41-1.42.71.71-1.77 1.77zm-.71 3.01h.71l1.77-1.77-.71-.71-1.41 1.42-.69-.69-.71.7 1.04 1.05z"></path></g></svg>',shortcut:"Mod-Shift-9"}],commands:{toggleChecklist:()=>{try{const e=_();if(!e)return!1;const t=e.innerHTML,n=()=>(M(e,t),y(e),!0),r=H(e);if(!r)return!1;const o=S(r.startContainer);if(!o)return!1;const u=o.closest('ul[data-type="checklist"]');if(u&&e.contains(u)){const c=T(u);if(c.length===0)return!1;const p=document.createDocumentFragment();let s=null;return c.forEach((f,g)=>{const E=O(f);E.forEach(L=>{p.appendChild(L),!s&&(f.contains(r.startContainer)||g===0)&&(s=L)}),!s&&g===0&&E[0]&&(s=E[0])}),u.replaceWith(p),s&&k(s,e),n()}const d=o.closest("ul, ol");if(d&&e.contains(d)){let c;if(d.tagName.toLowerCase()==="ul")c=d;else{for(c=document.createElement("ul");d.firstChild;)c.appendChild(d.firstChild);d.replaceWith(c)}c.setAttribute("data-type","checklist");let p=T(c);p.length===0&&(c.appendChild(C("")),p=T(c));let s=null;p.forEach(g=>{g.setAttribute("data-type","checklist-item"),g.hasAttribute("data-checked")||g.setAttribute("data-checked","false");const E=v(g);g.contains(r.startContainer)&&(s=E)});const f=c.querySelector(':scope > li[data-type="checklist-item"] > p');return k(s||f||c,e),n()}const l=R(r,e);if(l.length>1){const c=document.createElement("ul");c.setAttribute("data-type","checklist"),l.forEach(f=>{c.appendChild(C(f.innerHTML))}),l[0].replaceWith(c),l.slice(1).forEach(f=>{f.isConnected&&f.remove()});const s=c.querySelector(':scope > li[data-type="checklist-item"] > p');return s&&k(s,e),n()}const m=l[0]||o.closest("p, h1, h2, h3, h4, h5, h6, blockquote, pre");if(m&&m!==e){const c=document.createElement("ul");c.setAttribute("data-type","checklist");const p=C(m.innerHTML);c.appendChild(p),m.replaceWith(c);const s=p.querySelector(":scope > p");return s&&k(s,e),n()}const i=document.createElement("ul");i.setAttribute("data-type","checklist");const a=C("");i.appendChild(a),r.deleteContents(),r.insertNode(i);const h=a.querySelector(":scope > p");return h&&k(h,e),n()}catch(e){return console.error("Failed to toggle checklist:",e),!1}}},keymap:{"Mod-Shift-9":"toggleChecklist"}});exports.ChecklistPlugin=P;
|
package/dist/checklist.esm.js
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
const N = "__editoraCommandEditorRoot", w = (t) => {
|
|
2
|
-
if (!t)
|
|
3
|
-
return null;
|
|
2
|
+
if (!t) return null;
|
|
4
3
|
const e = t.querySelector('[contenteditable="true"]');
|
|
5
4
|
return e instanceof HTMLElement ? e : null;
|
|
6
5
|
}, A = () => {
|
|
7
|
-
if (typeof window > "u")
|
|
8
|
-
return null;
|
|
6
|
+
if (typeof window > "u") return null;
|
|
9
7
|
const t = window[N];
|
|
10
|
-
if (!(t instanceof HTMLElement))
|
|
11
|
-
return null;
|
|
8
|
+
if (!(t instanceof HTMLElement)) return null;
|
|
12
9
|
window[N] = null;
|
|
13
10
|
const e = t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || (t.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") ? t : null);
|
|
14
11
|
if (e) {
|
|
15
12
|
const r = w(e);
|
|
16
|
-
if (r)
|
|
17
|
-
|
|
18
|
-
if (e.getAttribute("contenteditable") === "true")
|
|
19
|
-
return e;
|
|
13
|
+
if (r) return r;
|
|
14
|
+
if (e.getAttribute("contenteditable") === "true") return e;
|
|
20
15
|
}
|
|
21
16
|
if (t.getAttribute("contenteditable") === "true")
|
|
22
17
|
return t;
|
|
@@ -43,21 +38,18 @@ const N = "__editoraCommandEditorRoot", w = (t) => {
|
|
|
43
38
|
if (n.getAttribute("contenteditable") === "true")
|
|
44
39
|
return n;
|
|
45
40
|
const r = n.closest('[contenteditable="true"]');
|
|
46
|
-
if (r)
|
|
47
|
-
return r;
|
|
41
|
+
if (r) return r;
|
|
48
42
|
}
|
|
49
43
|
return document.querySelector('[contenteditable="true"]');
|
|
50
44
|
}, H = (t) => t ? t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement : null, S = (t) => {
|
|
51
45
|
const e = window.getSelection();
|
|
52
|
-
if (!e || e.rangeCount === 0)
|
|
53
|
-
return null;
|
|
46
|
+
if (!e || e.rangeCount === 0) return null;
|
|
54
47
|
const n = e.getRangeAt(0);
|
|
55
48
|
return t.contains(n.commonAncestorContainer) ? n : null;
|
|
56
49
|
}, y = (t) => {
|
|
57
50
|
t.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
58
51
|
}, M = (t, e) => {
|
|
59
|
-
if (e === t.innerHTML)
|
|
60
|
-
return;
|
|
52
|
+
if (e === t.innerHTML) return;
|
|
61
53
|
const n = window.execEditorCommand || window.executeEditorCommand;
|
|
62
54
|
if (typeof n == "function")
|
|
63
55
|
try {
|
|
@@ -70,8 +62,7 @@ const N = "__editoraCommandEditorRoot", w = (t) => {
|
|
|
70
62
|
return;
|
|
71
63
|
}
|
|
72
64
|
const n = window.getSelection();
|
|
73
|
-
if (!n)
|
|
74
|
-
return;
|
|
65
|
+
if (!n) return;
|
|
75
66
|
const r = document.createRange();
|
|
76
67
|
r.selectNodeContents(t), r.collapse(!1), n.removeAllRanges();
|
|
77
68
|
try {
|
|
@@ -111,19 +102,17 @@ const N = "__editoraCommandEditorRoot", w = (t) => {
|
|
|
111
102
|
"PRE",
|
|
112
103
|
"LI"
|
|
113
104
|
]), b = (t) => R.has(t.tagName) && t.getAttribute("contenteditable") !== "true", v = (t, e) => {
|
|
114
|
-
const n = [], r = /* @__PURE__ */ new Set(), o = (
|
|
115
|
-
!
|
|
116
|
-
}, u = (
|
|
117
|
-
let
|
|
118
|
-
for (;
|
|
119
|
-
if (
|
|
120
|
-
const h =
|
|
121
|
-
if (b(h))
|
|
122
|
-
|
|
123
|
-
if (h.getAttribute("contenteditable") === "true")
|
|
124
|
-
break;
|
|
105
|
+
const n = [], r = /* @__PURE__ */ new Set(), o = (i) => {
|
|
106
|
+
!i || r.has(i) || e.contains(i) && b(i) && (i.closest("ul, ol") || (r.add(i), n.push(i)));
|
|
107
|
+
}, u = (i) => {
|
|
108
|
+
let a = i;
|
|
109
|
+
for (; a && a !== document.body; ) {
|
|
110
|
+
if (a.nodeType === Node.ELEMENT_NODE) {
|
|
111
|
+
const h = a;
|
|
112
|
+
if (b(h)) return h;
|
|
113
|
+
if (h.getAttribute("contenteditable") === "true") break;
|
|
125
114
|
}
|
|
126
|
-
|
|
115
|
+
a = a.parentNode;
|
|
127
116
|
}
|
|
128
117
|
return null;
|
|
129
118
|
};
|
|
@@ -133,29 +122,27 @@ const N = "__editoraCommandEditorRoot", w = (t) => {
|
|
|
133
122
|
e,
|
|
134
123
|
NodeFilter.SHOW_ELEMENT,
|
|
135
124
|
{
|
|
136
|
-
acceptNode: (
|
|
137
|
-
const
|
|
138
|
-
if (!b(
|
|
139
|
-
return NodeFilter.FILTER_SKIP;
|
|
125
|
+
acceptNode: (i) => {
|
|
126
|
+
const a = i;
|
|
127
|
+
if (!b(a) || a.closest("ul, ol")) return NodeFilter.FILTER_SKIP;
|
|
140
128
|
if (typeof t.intersectsNode == "function")
|
|
141
|
-
return t.intersectsNode(
|
|
129
|
+
return t.intersectsNode(a) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
142
130
|
const h = document.createRange();
|
|
143
|
-
return h.selectNodeContents(
|
|
131
|
+
return h.selectNodeContents(a), t.compareBoundaryPoints(Range.END_TO_START, h) > 0 && t.compareBoundaryPoints(Range.START_TO_END, h) < 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
144
132
|
}
|
|
145
133
|
}
|
|
146
134
|
);
|
|
147
|
-
let
|
|
148
|
-
for (;
|
|
149
|
-
o(
|
|
135
|
+
let l = d.nextNode();
|
|
136
|
+
for (; l; )
|
|
137
|
+
o(l), l = d.nextNode();
|
|
150
138
|
if (n.length === 0 && o(u(t.commonAncestorContainer)), n.length <= 1)
|
|
151
139
|
return n;
|
|
152
|
-
const m = n.filter((
|
|
140
|
+
const m = n.filter((i) => !n.some((a) => a !== i && i.contains(a)));
|
|
153
141
|
return m.length > 0 ? m : n;
|
|
154
142
|
}, O = (t) => {
|
|
155
143
|
const e = [], n = document.createElement("div"), r = () => {
|
|
156
144
|
const o = n.innerHTML.trim();
|
|
157
|
-
if (!o)
|
|
158
|
-
return;
|
|
145
|
+
if (!o) return;
|
|
159
146
|
const u = document.createElement("p");
|
|
160
147
|
u.innerHTML = o, e.push(u), n.innerHTML = "";
|
|
161
148
|
};
|
|
@@ -180,22 +167,18 @@ const N = "__editoraCommandEditorRoot", w = (t) => {
|
|
|
180
167
|
name: "checklist",
|
|
181
168
|
// Initialize click handler when plugin is loaded
|
|
182
169
|
init: () => {
|
|
183
|
-
if (typeof document > "u" || typeof window > "u" || window.__checklistPluginClickInitialized)
|
|
184
|
-
return;
|
|
170
|
+
if (typeof document > "u" || typeof window > "u" || window.__checklistPluginClickInitialized) return;
|
|
185
171
|
window.__checklistPluginClickInitialized = !0;
|
|
186
172
|
const t = (e) => {
|
|
187
173
|
const r = e.target.closest('li[data-type="checklist-item"]');
|
|
188
|
-
if (!r)
|
|
189
|
-
return;
|
|
174
|
+
if (!r) return;
|
|
190
175
|
const o = r.getBoundingClientRect();
|
|
191
|
-
if (!(e.clientX - o.left < 32))
|
|
192
|
-
return;
|
|
176
|
+
if (!(e.clientX - o.left < 32)) return;
|
|
193
177
|
e.preventDefault(), e.stopPropagation();
|
|
194
|
-
const
|
|
195
|
-
if (
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
r.setAttribute("data-checked", (!l).toString()), i && (M(i, a), y(i));
|
|
178
|
+
const l = r.closest("[contenteditable], .rte-content, .editora-content");
|
|
179
|
+
if (l?.getAttribute("contenteditable") === "false" || !!l?.closest('[data-readonly="true"], .editora-editor[readonly], editora-editor[readonly]')) return;
|
|
180
|
+
const i = l?.innerHTML || "", a = r.getAttribute("data-checked") === "true";
|
|
181
|
+
r.setAttribute("data-checked", (!a).toString()), l && (M(l, i), y(l));
|
|
199
182
|
};
|
|
200
183
|
document.addEventListener("click", t);
|
|
201
184
|
},
|
|
@@ -220,17 +203,14 @@ const N = "__editoraCommandEditorRoot", w = (t) => {
|
|
|
220
203
|
})
|
|
221
204
|
}
|
|
222
205
|
],
|
|
223
|
-
toDOM: (t) =>
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
"
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
0
|
|
232
|
-
];
|
|
233
|
-
}
|
|
206
|
+
toDOM: (t) => [
|
|
207
|
+
"li",
|
|
208
|
+
{
|
|
209
|
+
"data-type": "checklist-item",
|
|
210
|
+
"data-checked": t?.attrs?.checked ? "true" : "false"
|
|
211
|
+
},
|
|
212
|
+
0
|
|
213
|
+
]
|
|
234
214
|
}
|
|
235
215
|
},
|
|
236
216
|
toolbar: [
|
|
@@ -245,19 +225,15 @@ const N = "__editoraCommandEditorRoot", w = (t) => {
|
|
|
245
225
|
toggleChecklist: () => {
|
|
246
226
|
try {
|
|
247
227
|
const t = _();
|
|
248
|
-
if (!t)
|
|
249
|
-
return !1;
|
|
228
|
+
if (!t) return !1;
|
|
250
229
|
const e = t.innerHTML, n = () => (M(t, e), y(t), !0), r = S(t);
|
|
251
|
-
if (!r)
|
|
252
|
-
return !1;
|
|
230
|
+
if (!r) return !1;
|
|
253
231
|
const o = H(r.startContainer);
|
|
254
|
-
if (!o)
|
|
255
|
-
return !1;
|
|
232
|
+
if (!o) return !1;
|
|
256
233
|
const u = o.closest('ul[data-type="checklist"]');
|
|
257
234
|
if (u && t.contains(u)) {
|
|
258
235
|
const c = T(u);
|
|
259
|
-
if (c.length === 0)
|
|
260
|
-
return !1;
|
|
236
|
+
if (c.length === 0) return !1;
|
|
261
237
|
const p = document.createDocumentFragment();
|
|
262
238
|
let s = null;
|
|
263
239
|
return c.forEach((f, g) => {
|
|
@@ -289,18 +265,18 @@ const N = "__editoraCommandEditorRoot", w = (t) => {
|
|
|
289
265
|
const f = c.querySelector(':scope > li[data-type="checklist-item"] > p');
|
|
290
266
|
return k(s || f || c, t), n();
|
|
291
267
|
}
|
|
292
|
-
const
|
|
293
|
-
if (
|
|
268
|
+
const l = v(r, t);
|
|
269
|
+
if (l.length > 1) {
|
|
294
270
|
const c = document.createElement("ul");
|
|
295
|
-
c.setAttribute("data-type", "checklist"),
|
|
271
|
+
c.setAttribute("data-type", "checklist"), l.forEach((f) => {
|
|
296
272
|
c.appendChild(C(f.innerHTML));
|
|
297
|
-
}),
|
|
273
|
+
}), l[0].replaceWith(c), l.slice(1).forEach((f) => {
|
|
298
274
|
f.isConnected && f.remove();
|
|
299
275
|
});
|
|
300
276
|
const s = c.querySelector(':scope > li[data-type="checklist-item"] > p');
|
|
301
277
|
return s && k(s, t), n();
|
|
302
278
|
}
|
|
303
|
-
const m =
|
|
279
|
+
const m = l[0] || o.closest("p, h1, h2, h3, h4, h5, h6, blockquote, pre");
|
|
304
280
|
if (m && m !== t) {
|
|
305
281
|
const c = document.createElement("ul");
|
|
306
282
|
c.setAttribute("data-type", "checklist");
|
|
@@ -309,11 +285,11 @@ const N = "__editoraCommandEditorRoot", w = (t) => {
|
|
|
309
285
|
const s = p.querySelector(":scope > p");
|
|
310
286
|
return s && k(s, t), n();
|
|
311
287
|
}
|
|
312
|
-
const
|
|
313
|
-
|
|
314
|
-
const
|
|
315
|
-
|
|
316
|
-
const h =
|
|
288
|
+
const i = document.createElement("ul");
|
|
289
|
+
i.setAttribute("data-type", "checklist");
|
|
290
|
+
const a = C("");
|
|
291
|
+
i.appendChild(a), r.deleteContents(), r.insertNode(i);
|
|
292
|
+
const h = a.querySelector(":scope > p");
|
|
317
293
|
return h && k(h, t), n();
|
|
318
294
|
} catch (t) {
|
|
319
295
|
return console.error("Failed to toggle checklist:", t), !1;
|