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