@editora/plugins 1.0.20 → 1.0.22
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 +259 -645
- package/dist/a11y-checker.cjs.js +1 -1
- package/dist/a11y-checker.esm.js +18 -18
- package/dist/anchor.cjs.js +6 -6
- package/dist/anchor.esm.js +57 -57
- package/dist/blockquote.cjs.js +1 -1
- package/dist/blockquote.esm.js +31 -31
- package/dist/capitalization.cjs.js +1 -1
- package/dist/capitalization.esm.js +25 -25
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +30 -30
- package/dist/collaboration.cjs.js +8 -8
- package/dist/collaboration.esm.js +1279 -1169
- package/dist/comments.cjs.js +1 -1
- package/dist/comments.esm.js +1 -1
- package/dist/direction.cjs.js +1 -1
- package/dist/direction.esm.js +26 -26
- package/dist/font-family.cjs.js +1 -1
- package/dist/font-family.esm.js +26 -26
- package/dist/preview.cjs.js +1 -1
- package/dist/preview.esm.js +3 -3
- package/dist/spell-check.cjs.js +2 -2
- package/dist/spell-check.esm.js +19 -19
- package/dist/template.cjs.js +5 -5
- package/dist/template.esm.js +23 -23
- package/package.json +6 -5
package/dist/a11y-checker.cjs.js
CHANGED
|
@@ -106,4 +106,4 @@
|
|
|
106
106
|
cursor: pointer;
|
|
107
107
|
font-size: 13px;
|
|
108
108
|
margin-left: 68px;
|
|
109
|
-
`,c.onmouseover=()=>c.style.background=r.fixBtnHover,c.onmouseout=()=>c.style.background=r.fixBtn,c.onclick=()=>{N(l),c.textContent="✓ Fixed",c.style.background="#4caf50",c.disabled=!0,c.style.cursor="not-allowed",b(l,!1),setTimeout(()=>{a.remove(),$()},1e3)},u.appendChild(c)}m.appendChild(u)})}i.appendChild(s),i.appendChild(m),a.appendChild(i),document.body.appendChild(a),a.onclick=d=>{d.target===a&&(t.forEach(y=>b(y,!1)),a.remove())};const A=d=>{d.key==="Escape"&&(t.forEach(y=>b(y,!1)),a.remove(),document.removeEventListener("keydown",A))};document.addEventListener("keydown",A)},M=()=>({name:"a11yChecker",toolbar:[{label:"Accessibility",command:"toggleA11yChecker",icon:'<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g
|
|
109
|
+
`,c.onmouseover=()=>c.style.background=r.fixBtnHover,c.onmouseout=()=>c.style.background=r.fixBtn,c.onclick=()=>{N(l),c.textContent="✓ Fixed",c.style.background="#4caf50",c.disabled=!0,c.style.cursor="not-allowed",b(l,!1),setTimeout(()=>{a.remove(),$()},1e3)},u.appendChild(c)}m.appendChild(u)})}i.appendChild(s),i.appendChild(m),a.appendChild(i),document.body.appendChild(a),a.onclick=d=>{d.target===a&&(t.forEach(y=>b(y,!1)),a.remove())};const A=d=>{d.key==="Escape"&&(t.forEach(y=>b(y,!1)),a.remove(),document.removeEventListener("keydown",A))};document.addEventListener("keydown",A)},M=()=>({name:"a11yChecker",toolbar:[{label:"Accessibility",command:"toggleA11yChecker",icon:'<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g> <path fill-rule="evenodd" clip-rule="evenodd" d="M9 6.82954C10.1652 6.4177 11 5.30646 11 4.00024C11 2.34339 9.65686 1.00024 8 1.00024C6.34315 1.00024 5 2.34339 5 4.00024C5 5.30646 5.83481 6.4177 7 6.82954V12.0002C7 13.6571 8.34315 15.0002 10 15.0002H14.9296C15.264 15.0002 15.5762 15.1673 15.7617 15.4455L18.4913 19.54C19.1914 20.5901 20.6772 20.7373 21.5696 19.8448L22.7071 18.7074C23.0976 18.3168 23.0976 17.6837 22.7071 17.2931C22.3166 16.9026 21.6834 16.9026 21.2929 17.2931L20.1554 18.4306L17.4258 14.3361C16.8694 13.5015 15.9327 13.0002 14.9296 13.0002H10C9.44772 13.0002 9 12.5525 9 12.0002V11.0002H15C15.5523 11.0002 16 10.5525 16 10.0002C16 9.44796 15.5523 9.00025 15 9.00025H9V6.82954ZM8 5.10758C7.38844 5.10758 6.89267 4.61181 6.89267 4.00024C6.89267 3.38868 7.38844 2.89291 8 2.89291C8.61157 2.89291 9.10734 3.38868 9.10734 4.00024C9.10734 4.61181 8.61157 5.10758 8 5.10758Z" fill="#0F0F0F"></path> <path d="M4.6328 9.07414C5.10517 8.78987 5.69738 9.0279 5.91645 9.53381C6.13552 10.0397 5.89604 10.6205 5.43795 10.9272C4.92993 11.2673 4.48018 11.6911 4.10882 12.1826C3.53598 12.9408 3.16922 13.8345 3.04425 14.7765C2.91928 15.7185 3.04036 16.6768 3.3957 17.5582C3.75103 18.4395 4.32852 19.2138 5.07194 19.8058C5.81535 20.3977 6.69937 20.787 7.63791 20.9359C8.57646 21.0847 9.53756 20.988 10.4276 20.6552C11.3177 20.3223 12.1065 19.7647 12.7171 19.0366C13.1129 18.5645 13.4251 18.0313 13.6428 17.46C13.8391 16.9448 14.3514 16.5813 14.8936 16.6815C15.4357 16.7816 15.8004 17.3054 15.6291 17.8295C15.3326 18.7372 14.8644 19.583 14.2468 20.3194C13.4147 21.3117 12.3399 22.0716 11.1269 22.5252C9.91394 22.9787 8.6042 23.1105 7.32518 22.9077C6.04617 22.7048 4.84148 22.1742 3.82838 21.3676C2.81528 20.561 2.02831 19.5058 1.54407 18.3047C1.05983 17.1037 0.894836 15.7977 1.06514 14.5139C1.23545 13.2302 1.73525 12.0124 2.51589 10.9791C3.09523 10.2123 3.81459 9.56654 4.6328 9.07414Z" fill="#0F0F0F"></path> </g></svg>',shortcut:"Mod-Shift-Alt-a"}],commands:{toggleA11yChecker:()=>{try{return $(),!0}catch(t){return console.error("Failed to open accessibility checker:",t),!1}}},keymap:{"Mod-Shift-Alt-a":"toggleA11yChecker"}});exports.A11yCheckerPlugin=M;
|
package/dist/a11y-checker.esm.js
CHANGED
|
@@ -293,7 +293,7 @@ const w = () => {
|
|
|
293
293
|
const n = C.find((e) => e.id === t.rule);
|
|
294
294
|
n && n.fix && n.fix(t);
|
|
295
295
|
}, $ = () => {
|
|
296
|
-
document.querySelectorAll(".a11y-dialog-overlay").forEach((
|
|
296
|
+
document.querySelectorAll(".a11y-dialog-overlay").forEach((d) => d.remove());
|
|
297
297
|
const t = k(), n = P(t), r = I() ? {
|
|
298
298
|
overlay: "rgba(0, 0, 0, 0.62)",
|
|
299
299
|
dialogBg: "#1f2937",
|
|
@@ -389,7 +389,7 @@ const w = () => {
|
|
|
389
389
|
}, o.onmouseout = () => {
|
|
390
390
|
o.style.background = "none", o.style.color = r.muted;
|
|
391
391
|
}, o.onclick = () => {
|
|
392
|
-
t.forEach((
|
|
392
|
+
t.forEach((d) => b(d, !1)), a.remove();
|
|
393
393
|
};
|
|
394
394
|
const g = document.createElement("div");
|
|
395
395
|
g.style.cssText = "display: flex; align-items: center; gap: 16px;", g.appendChild(p), g.appendChild(h), s.appendChild(g), s.appendChild(o);
|
|
@@ -408,8 +408,8 @@ const w = () => {
|
|
|
408
408
|
</div>
|
|
409
409
|
`;
|
|
410
410
|
else {
|
|
411
|
-
const
|
|
412
|
-
|
|
411
|
+
const d = document.createElement("div");
|
|
412
|
+
d.style.cssText = `
|
|
413
413
|
background: ${r.summaryBg};
|
|
414
414
|
border: 1px solid ${r.border};
|
|
415
415
|
padding: 12px 16px;
|
|
@@ -419,11 +419,11 @@ const w = () => {
|
|
|
419
419
|
gap: 20px;
|
|
420
420
|
`;
|
|
421
421
|
const y = t.filter((l) => l.severity === "error").length, E = t.filter((l) => l.severity === "warning").length, L = t.filter((l) => l.severity === "info").length;
|
|
422
|
-
|
|
422
|
+
d.innerHTML = `
|
|
423
423
|
<div><strong style="color: #f44336;">${y}</strong> <span style="color: ${r.muted};">Errors</span></div>
|
|
424
424
|
<div><strong style="color: #ff9800;">${E}</strong> <span style="color: ${r.muted};">Warnings</span></div>
|
|
425
425
|
<div><strong style="color: #2196f3;">${L}</strong> <span style="color: ${r.muted};">Info</span></div>
|
|
426
|
-
`, m.appendChild(
|
|
426
|
+
`, m.appendChild(d), t.forEach((l) => {
|
|
427
427
|
const u = document.createElement("div");
|
|
428
428
|
u.style.cssText = `
|
|
429
429
|
border: 1px solid ${r.issueBorder};
|
|
@@ -459,8 +459,8 @@ const w = () => {
|
|
|
459
459
|
${v(l.suggestion || "")}
|
|
460
460
|
</div>
|
|
461
461
|
`, l.fixable) {
|
|
462
|
-
const
|
|
463
|
-
|
|
462
|
+
const c = document.createElement("button");
|
|
463
|
+
c.textContent = `🔧 ${l.fixLabel || "Auto-fix"}`, c.style.cssText = `
|
|
464
464
|
background: ${r.fixBtn};
|
|
465
465
|
color: white;
|
|
466
466
|
border: none;
|
|
@@ -469,29 +469,29 @@ const w = () => {
|
|
|
469
469
|
cursor: pointer;
|
|
470
470
|
font-size: 13px;
|
|
471
471
|
margin-left: 68px;
|
|
472
|
-
`,
|
|
473
|
-
N(l),
|
|
472
|
+
`, c.onmouseover = () => c.style.background = r.fixBtnHover, c.onmouseout = () => c.style.background = r.fixBtn, c.onclick = () => {
|
|
473
|
+
N(l), c.textContent = "✓ Fixed", c.style.background = "#4caf50", c.disabled = !0, c.style.cursor = "not-allowed", b(l, !1), setTimeout(() => {
|
|
474
474
|
a.remove(), $();
|
|
475
475
|
}, 1e3);
|
|
476
|
-
}, u.appendChild(
|
|
476
|
+
}, u.appendChild(c);
|
|
477
477
|
}
|
|
478
478
|
m.appendChild(u);
|
|
479
479
|
});
|
|
480
480
|
}
|
|
481
|
-
i.appendChild(s), i.appendChild(m), a.appendChild(i), document.body.appendChild(a), a.onclick = (
|
|
482
|
-
|
|
481
|
+
i.appendChild(s), i.appendChild(m), a.appendChild(i), document.body.appendChild(a), a.onclick = (d) => {
|
|
482
|
+
d.target === a && (t.forEach((y) => b(y, !1)), a.remove());
|
|
483
483
|
};
|
|
484
|
-
const A = (
|
|
485
|
-
|
|
484
|
+
const A = (d) => {
|
|
485
|
+
d.key === "Escape" && (t.forEach((y) => b(y, !1)), a.remove(), document.removeEventListener("keydown", A));
|
|
486
486
|
};
|
|
487
487
|
document.addEventListener("keydown", A);
|
|
488
|
-
},
|
|
488
|
+
}, F = () => ({
|
|
489
489
|
name: "a11yChecker",
|
|
490
490
|
toolbar: [
|
|
491
491
|
{
|
|
492
492
|
label: "Accessibility",
|
|
493
493
|
command: "toggleA11yChecker",
|
|
494
|
-
icon: '<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g
|
|
494
|
+
icon: '<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g> <path fill-rule="evenodd" clip-rule="evenodd" d="M9 6.82954C10.1652 6.4177 11 5.30646 11 4.00024C11 2.34339 9.65686 1.00024 8 1.00024C6.34315 1.00024 5 2.34339 5 4.00024C5 5.30646 5.83481 6.4177 7 6.82954V12.0002C7 13.6571 8.34315 15.0002 10 15.0002H14.9296C15.264 15.0002 15.5762 15.1673 15.7617 15.4455L18.4913 19.54C19.1914 20.5901 20.6772 20.7373 21.5696 19.8448L22.7071 18.7074C23.0976 18.3168 23.0976 17.6837 22.7071 17.2931C22.3166 16.9026 21.6834 16.9026 21.2929 17.2931L20.1554 18.4306L17.4258 14.3361C16.8694 13.5015 15.9327 13.0002 14.9296 13.0002H10C9.44772 13.0002 9 12.5525 9 12.0002V11.0002H15C15.5523 11.0002 16 10.5525 16 10.0002C16 9.44796 15.5523 9.00025 15 9.00025H9V6.82954ZM8 5.10758C7.38844 5.10758 6.89267 4.61181 6.89267 4.00024C6.89267 3.38868 7.38844 2.89291 8 2.89291C8.61157 2.89291 9.10734 3.38868 9.10734 4.00024C9.10734 4.61181 8.61157 5.10758 8 5.10758Z" fill="#0F0F0F"></path> <path d="M4.6328 9.07414C5.10517 8.78987 5.69738 9.0279 5.91645 9.53381C6.13552 10.0397 5.89604 10.6205 5.43795 10.9272C4.92993 11.2673 4.48018 11.6911 4.10882 12.1826C3.53598 12.9408 3.16922 13.8345 3.04425 14.7765C2.91928 15.7185 3.04036 16.6768 3.3957 17.5582C3.75103 18.4395 4.32852 19.2138 5.07194 19.8058C5.81535 20.3977 6.69937 20.787 7.63791 20.9359C8.57646 21.0847 9.53756 20.988 10.4276 20.6552C11.3177 20.3223 12.1065 19.7647 12.7171 19.0366C13.1129 18.5645 13.4251 18.0313 13.6428 17.46C13.8391 16.9448 14.3514 16.5813 14.8936 16.6815C15.4357 16.7816 15.8004 17.3054 15.6291 17.8295C15.3326 18.7372 14.8644 19.583 14.2468 20.3194C13.4147 21.3117 12.3399 22.0716 11.1269 22.5252C9.91394 22.9787 8.6042 23.1105 7.32518 22.9077C6.04617 22.7048 4.84148 22.1742 3.82838 21.3676C2.81528 20.561 2.02831 19.5058 1.54407 18.3047C1.05983 17.1037 0.894836 15.7977 1.06514 14.5139C1.23545 13.2302 1.73525 12.0124 2.51589 10.9791C3.09523 10.2123 3.81459 9.56654 4.6328 9.07414Z" fill="#0F0F0F"></path> </g></svg>',
|
|
495
495
|
shortcut: "Mod-Shift-Alt-a"
|
|
496
496
|
}
|
|
497
497
|
],
|
|
@@ -509,5 +509,5 @@ const w = () => {
|
|
|
509
509
|
}
|
|
510
510
|
});
|
|
511
511
|
export {
|
|
512
|
-
|
|
512
|
+
F as A11yCheckerPlugin
|
|
513
513
|
};
|
package/dist/anchor.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const $=require("./dialogHelpers-zU6zpMIA.js"),w=require("./editorContainerHelpers-CFbfiOJI.js"),b=new Set,y='[data-theme="dark"], .dark, .editora-theme-dark';function z(t,c){if(c===t.innerHTML)return;const s=window.execEditorCommand||window.executeEditorCommand;if(typeof s=="function")try{s("recordDomTransaction",t,c,t.innerHTML)}catch{}}function M(){if(typeof window>"u"||window.__anchorObserverInitialized)return;window.__anchorObserverInitialized=!0,new MutationObserver(c=>{c.forEach(s=>{s.removedNodes.forEach(a=>{if(a.nodeType===Node.ELEMENT_NODE){const l=a;if(l.classList?.contains("rte-anchor")){const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const $=require("./dialogHelpers-zU6zpMIA.js"),w=require("./editorContainerHelpers-CFbfiOJI.js"),b=new Set,y='[data-theme="dark"], .dark, .editora-theme-dark';function z(t,c){if(c===t.innerHTML)return;const s=window.execEditorCommand||window.executeEditorCommand;if(typeof s=="function")try{s("recordDomTransaction",t,c,t.innerHTML)}catch{}}function M(){if(typeof window>"u"||window.__anchorObserverInitialized)return;window.__anchorObserverInitialized=!0,new MutationObserver(c=>{c.forEach(s=>{s.removedNodes.forEach(a=>{if(a.nodeType===Node.ELEMENT_NODE){const l=a;if(l.classList?.contains("rte-anchor")){const n=l.id;n&&b.delete(n)}l.querySelectorAll?.(".rte-anchor")?.forEach(n=>{const u=n.id;u&&b.delete(u)})}})})}).observe(document.body,{childList:!0,subtree:!0})}function D(t){return!t||t.trim().length===0?{valid:!1,error:"Anchor ID cannot be empty"}:t.length>256?{valid:!1,error:"Anchor ID must be less than 256 characters"}:/^[A-Za-z_]/.test(t)?/^[A-Za-z0-9\-_]+$/.test(t)?{valid:!0,error:""}:{valid:!1,error:"Anchor ID can only contain letters, numbers, hyphens, and underscores"}:{valid:!1,error:"Anchor ID must start with a letter or underscore"}}function H(){const t=w.findEditorContainerFromSelection();if(!t)return;const c=w.getContentElement(t);if(!c)return;const s=c.querySelectorAll(".rte-anchor"),a=new Set;s.forEach(l=>{const e=l.id;e&&a.add(e)}),b.clear(),a.forEach(l=>b.add(l))}function R(t){if(t){const a=t.startContainer;if((a.nodeType===Node.ELEMENT_NODE?a:a.parentElement)?.closest(y))return!0}const c=window.getSelection();if(c&&c.rangeCount>0){const a=c.getRangeAt(0).startContainer;if((a.nodeType===Node.ELEMENT_NODE?a:a.parentElement)?.closest(y))return!0}return document.activeElement?.closest(y)?!0:document.body.matches(y)||document.documentElement.matches(y)}function _(t,c,s,a){document.querySelectorAll(".rte-anchor-dialog-overlay").forEach(r=>r.remove()),H();const l=R(a),e=l?{overlay:"rgba(0, 0, 0, 0.62)",dialogBg:"#1f2937",panelBg:"#222d3a",border:"#3b4657",text:"#e2e8f0",muted:"#94a3b8",closeHoverBg:"#334155",fieldBg:"#111827",fieldFocusBg:"#111827",fieldBorder:"#4b5563",fieldText:"#e2e8f0",fieldErrorBg:"#3f2124",fieldErrorBorder:"#ef4444",cancelBg:"#334155",cancelHover:"#475569",cancelText:"#e2e8f0",saveBg:"#3b82f6",saveHover:"#2563eb",saveDisabledBg:"#374151",saveDisabledText:"#7f8ca1",help:"#9fb0c6",focusRing:"rgba(88, 166, 255, 0.25)",errorRing:"rgba(239, 68, 68, 0.25)"}:{overlay:"rgba(0, 0, 0, 0.5)",dialogBg:"#ffffff",panelBg:"#f9f9f9",border:"#e0e0e0",text:"#333333",muted:"#999999",closeHoverBg:"#e0e0e0",fieldBg:"#ffffff",fieldFocusBg:"#f9f9ff",fieldBorder:"#d0d0d0",fieldText:"#333333",fieldErrorBg:"#ffebee",fieldErrorBorder:"#d32f2f",cancelBg:"#f0f0f0",cancelHover:"#e0e0e0",cancelText:"#333333",saveBg:"#0066cc",saveHover:"#0052a3",saveDisabledBg:"#d0d0d0",saveDisabledText:"#999999",help:"#999999",focusRing:"rgba(0, 102, 204, 0.1)",errorRing:"rgba(211, 47, 47, 0.1)"},n=document.createElement("div");$.initDialogOverlay(n),n.className="rte-anchor-dialog-overlay",n.style.cssText=`
|
|
2
2
|
position: fixed;
|
|
3
3
|
top: 0;
|
|
4
4
|
left: 0;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
max-width: 450px;
|
|
20
20
|
overflow: hidden;
|
|
21
21
|
animation: rte-anchor-dialog-appear 0.2s ease;
|
|
22
|
-
`,!document.getElementById("rte-anchor-dialog-styles")){const
|
|
22
|
+
`,!document.getElementById("rte-anchor-dialog-styles")){const r=document.createElement("style");r.id="rte-anchor-dialog-styles",r.textContent=`
|
|
23
23
|
@keyframes rte-anchor-dialog-appear {
|
|
24
24
|
from { opacity: 0; transform: scale(0.95); }
|
|
25
25
|
to { opacity: 1; transform: scale(1); }
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
.rte-anchor-dialog input:focus {
|
|
28
28
|
outline: none !important;
|
|
29
29
|
}
|
|
30
|
-
`,document.head.appendChild(
|
|
30
|
+
`,document.head.appendChild(r)}let d="";const h=document.createElement("div");h.style.cssText=`
|
|
31
31
|
display: flex;
|
|
32
32
|
align-items: center;
|
|
33
33
|
justify-content: space-between;
|
|
@@ -91,11 +91,11 @@
|
|
|
91
91
|
transition: all 0.2s ease;
|
|
92
92
|
background: ${e.saveBg};
|
|
93
93
|
color: white;
|
|
94
|
-
`,i.disabled=!o.value.trim();const N=()=>{o.value.trim()?(i.disabled=!1,i.style.background=e.saveBg,i.style.color="white",i.style.cursor="pointer"):(i.disabled=!0,i.style.background=e.saveDisabledBg,i.style.color=e.saveDisabledText,i.style.cursor="not-allowed")};i.onmouseover=()=>{i.disabled||(i.style.background=e.saveHover,i.style.boxShadow=l?"0 2px 8px rgba(59, 130, 246, 0.35)":"0 2px 8px rgba(0, 102, 204, 0.3)")},i.onmouseout=()=>{i.disabled||(i.style.background=e.saveBg,i.style.boxShadow="none")},v.appendChild(g),v.appendChild(i),o.oninput=()=>{const
|
|
94
|
+
`,i.disabled=!o.value.trim();const N=()=>{o.value.trim()?(i.disabled=!1,i.style.background=e.saveBg,i.style.color="white",i.style.cursor="pointer"):(i.disabled=!0,i.style.background=e.saveDisabledBg,i.style.color=e.saveDisabledText,i.style.cursor="not-allowed")};i.onmouseover=()=>{i.disabled||(i.style.background=e.saveHover,i.style.boxShadow=l?"0 2px 8px rgba(59, 130, 246, 0.35)":"0 2px 8px rgba(0, 102, 204, 0.3)")},i.onmouseout=()=>{i.disabled||(i.style.background=e.saveBg,i.style.boxShadow="none")},v.appendChild(g),v.appendChild(i),o.oninput=()=>{const r=o.value;if(N(),r.trim()){const T=D(r);T.valid?b.has(r)?(d=`Anchor ID already exists: ${r}`,p.textContent="⚠ "+d,p.style.display="block",o.style.borderColor=e.fieldErrorBorder,o.style.background=e.fieldErrorBg):(d="",p.style.display="none",o.style.borderColor=e.fieldBorder,o.style.background=e.fieldBg):(d=T.error,p.textContent="⚠ "+d,p.style.display="block",o.style.borderColor=e.fieldErrorBorder,o.style.background=e.fieldErrorBg)}else p.style.display="none",o.style.borderColor=e.fieldBorder,o.style.background=e.fieldBg},o.onfocus=()=>{o.style.borderColor=d?e.fieldErrorBorder:e.saveBg,o.style.boxShadow=d?`0 0 0 3px ${e.errorRing}`:`0 0 0 3px ${e.focusRing}`,o.style.background=d?e.fieldErrorBg:e.fieldFocusBg},o.onblur=()=>{o.style.boxShadow="none",d||(o.style.background=e.fieldBg)};const A=()=>{const r=o.value.trim();!r||!D(r).valid||b.has(r)||(s&&s(r),n.remove())},E=()=>{n.remove()};i.onclick=A,g.onclick=E,f.onclick=E,o.onkeydown=r=>{r.key==="Enter"?(r.preventDefault(),A()):r.key==="Escape"&&(r.preventDefault(),E())},n.onclick=r=>{r.target===n&&E()},u.appendChild(h),u.appendChild(B),u.appendChild(v),n.appendChild(u),document.body.appendChild(n),setTimeout(()=>o.focus(),100)}function I(t,c){let s;if(c)s=c;else{const d=window.getSelection();if(!d||d.rangeCount===0)return;s=d.getRangeAt(0)}let a=null,l=s.startContainer;for(;l&&l!==document.body;){if(l.nodeType===Node.ELEMENT_NODE){const d=l;if(d.getAttribute("contenteditable")==="true"){a=d;break}}l=l.parentNode}const e=a?.innerHTML??"",n=document.createElement("span");n.id=t,n.className="rte-anchor",n.setAttribute("data-type","anchor"),n.setAttribute("data-anchor-id",t),n.setAttribute("title",`Anchor: ${t}`),n.style.cssText=`
|
|
95
95
|
display: inline;
|
|
96
96
|
position: relative;
|
|
97
97
|
cursor: pointer;
|
|
98
|
-
`,s.insertNode(
|
|
98
|
+
`,s.insertNode(n),b.add(t),s.setStart(n.nextSibling||n.parentNode,0),s.collapse(!0);const u=window.getSelection();if(u&&(u.removeAllRanges(),u.addRange(s)),a)z(a,e),a.dispatchEvent(new Event("input",{bubbles:!0}));else{const d=w.findEditorContainerFromSelection();if(d){const h=w.getContentElement(d);h&&h.dispatchEvent(new Event("input",{bubbles:!0}))}}S()}function S(){if(document.getElementById("rte-anchor-styles"))return;const t=document.createElement("style");t.id="rte-anchor-styles",t.textContent=`
|
|
99
99
|
.rte-anchor {
|
|
100
100
|
display: inline;
|
|
101
101
|
position: relative;
|
|
@@ -173,4 +173,4 @@
|
|
|
173
173
|
outline: 2px solid #0066cc;
|
|
174
174
|
outline-offset: 2px;
|
|
175
175
|
}
|
|
176
|
-
`,document.head.appendChild(t)}const O=()=>(typeof window<"u"&&(M(),
|
|
176
|
+
`,document.head.appendChild(t)}const O=()=>(typeof window<"u"&&(M(),S()),{name:"anchor",toolbar:[{label:"Anchor",command:"insertAnchor",icon:'<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g> <path d="M12 8.4C13.4912 8.4 14.7 7.19117 14.7 5.7C14.7 4.20883 13.4912 3 12 3C10.5088 3 9.3 4.20883 9.3 5.7C9.3 7.19117 10.5088 8.4 12 8.4ZM12 8.4V20.9999M12 20.9999C9.61305 20.9999 7.32387 20.0518 5.63604 18.364C3.94821 16.6761 3 14.3869 3 12H5M12 20.9999C14.3869 20.9999 16.6761 20.0518 18.364 18.364C20.0518 16.6761 21 14.3869 21 12H19" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>',shortcut:"Mod-Shift-k"}],commands:{insertAnchor:()=>{try{const t=window.getSelection();if(!t||t.rangeCount===0)return alert("Please place your cursor where you want to insert the anchor."),!1;const c=t.getRangeAt(0).cloneRange();return _("add","",s=>{I(s,c)},c),!0}catch(t){return console.error("Failed to insert anchor:",t),!1}}},keymap:{"Mod-Shift-k":"insertAnchor"}});exports.AnchorPlugin=O;
|
package/dist/anchor.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as z } from "./dialogHelpers-5d5BuOCW.mjs";
|
|
2
2
|
import { f as D, g as S } from "./editorContainerHelpers-C7kdWnS0.mjs";
|
|
3
3
|
const b = /* @__PURE__ */ new Set(), x = '[data-theme="dark"], .dark, .editora-theme-dark';
|
|
4
|
-
function
|
|
4
|
+
function M(t, c) {
|
|
5
5
|
if (c === t.innerHTML) return;
|
|
6
6
|
const s = window.execEditorCommand || window.executeEditorCommand;
|
|
7
7
|
if (typeof s == "function")
|
|
@@ -10,19 +10,19 @@ function R(t, c) {
|
|
|
10
10
|
} catch {
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function H() {
|
|
14
14
|
if (typeof window > "u" || window.__anchorObserverInitialized) return;
|
|
15
15
|
window.__anchorObserverInitialized = !0, new MutationObserver((c) => {
|
|
16
16
|
c.forEach((s) => {
|
|
17
17
|
s.removedNodes.forEach((a) => {
|
|
18
18
|
if (a.nodeType === Node.ELEMENT_NODE) {
|
|
19
|
-
const
|
|
20
|
-
if (
|
|
21
|
-
const
|
|
22
|
-
|
|
19
|
+
const l = a;
|
|
20
|
+
if (l.classList?.contains("rte-anchor")) {
|
|
21
|
+
const n = l.id;
|
|
22
|
+
n && b.delete(n);
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
const u =
|
|
24
|
+
l.querySelectorAll?.(".rte-anchor")?.forEach((n) => {
|
|
25
|
+
const u = n.id;
|
|
26
26
|
u && b.delete(u);
|
|
27
27
|
});
|
|
28
28
|
}
|
|
@@ -36,18 +36,18 @@ function M() {
|
|
|
36
36
|
function A(t) {
|
|
37
37
|
return !t || t.trim().length === 0 ? { valid: !1, error: "Anchor ID cannot be empty" } : t.length > 256 ? { valid: !1, error: "Anchor ID must be less than 256 characters" } : /^[A-Za-z_]/.test(t) ? /^[A-Za-z0-9\-_]+$/.test(t) ? { valid: !0, error: "" } : { valid: !1, error: "Anchor ID can only contain letters, numbers, hyphens, and underscores" } : { valid: !1, error: "Anchor ID must start with a letter or underscore" };
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function R() {
|
|
40
40
|
const t = D();
|
|
41
41
|
if (!t) return;
|
|
42
42
|
const c = S(t);
|
|
43
43
|
if (!c) return;
|
|
44
44
|
const s = c.querySelectorAll(".rte-anchor"), a = /* @__PURE__ */ new Set();
|
|
45
|
-
s.forEach((
|
|
46
|
-
const e =
|
|
45
|
+
s.forEach((l) => {
|
|
46
|
+
const e = l.id;
|
|
47
47
|
e && a.add(e);
|
|
48
|
-
}), b.clear(), a.forEach((
|
|
48
|
+
}), b.clear(), a.forEach((l) => b.add(l));
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function I(t) {
|
|
51
51
|
if (t) {
|
|
52
52
|
const a = t.startContainer;
|
|
53
53
|
if ((a.nodeType === Node.ELEMENT_NODE ? a : a.parentElement)?.closest(x)) return !0;
|
|
@@ -59,9 +59,9 @@ function _(t) {
|
|
|
59
59
|
}
|
|
60
60
|
return document.activeElement?.closest(x) ? !0 : document.body.matches(x) || document.documentElement.matches(x);
|
|
61
61
|
}
|
|
62
|
-
function
|
|
63
|
-
document.querySelectorAll(".rte-anchor-dialog-overlay").forEach((
|
|
64
|
-
const
|
|
62
|
+
function _(t, c, s, a) {
|
|
63
|
+
document.querySelectorAll(".rte-anchor-dialog-overlay").forEach((r) => r.remove()), R();
|
|
64
|
+
const l = I(a), e = l ? {
|
|
65
65
|
overlay: "rgba(0, 0, 0, 0.62)",
|
|
66
66
|
dialogBg: "#1f2937",
|
|
67
67
|
panelBg: "#222d3a",
|
|
@@ -109,8 +109,8 @@ function I(t, c, s, a) {
|
|
|
109
109
|
help: "#999999",
|
|
110
110
|
focusRing: "rgba(0, 102, 204, 0.1)",
|
|
111
111
|
errorRing: "rgba(211, 47, 47, 0.1)"
|
|
112
|
-
},
|
|
113
|
-
z(
|
|
112
|
+
}, n = document.createElement("div");
|
|
113
|
+
z(n), n.className = "rte-anchor-dialog-overlay", n.style.cssText = `
|
|
114
114
|
position: fixed;
|
|
115
115
|
top: 0;
|
|
116
116
|
left: 0;
|
|
@@ -134,8 +134,8 @@ function I(t, c, s, a) {
|
|
|
134
134
|
overflow: hidden;
|
|
135
135
|
animation: rte-anchor-dialog-appear 0.2s ease;
|
|
136
136
|
`, !document.getElementById("rte-anchor-dialog-styles")) {
|
|
137
|
-
const
|
|
138
|
-
|
|
137
|
+
const r = document.createElement("style");
|
|
138
|
+
r.id = "rte-anchor-dialog-styles", r.textContent = `
|
|
139
139
|
@keyframes rte-anchor-dialog-appear {
|
|
140
140
|
from { opacity: 0; transform: scale(0.95); }
|
|
141
141
|
to { opacity: 1; transform: scale(1); }
|
|
@@ -143,9 +143,9 @@ function I(t, c, s, a) {
|
|
|
143
143
|
.rte-anchor-dialog input:focus {
|
|
144
144
|
outline: none !important;
|
|
145
145
|
}
|
|
146
|
-
`, document.head.appendChild(
|
|
146
|
+
`, document.head.appendChild(r);
|
|
147
147
|
}
|
|
148
|
-
let
|
|
148
|
+
let d = "";
|
|
149
149
|
const h = document.createElement("div");
|
|
150
150
|
h.style.cssText = `
|
|
151
151
|
display: flex;
|
|
@@ -242,66 +242,66 @@ function I(t, c, s, a) {
|
|
|
242
242
|
o.value.trim() ? (i.disabled = !1, i.style.background = e.saveBg, i.style.color = "white", i.style.cursor = "pointer") : (i.disabled = !0, i.style.background = e.saveDisabledBg, i.style.color = e.saveDisabledText, i.style.cursor = "not-allowed");
|
|
243
243
|
};
|
|
244
244
|
i.onmouseover = () => {
|
|
245
|
-
i.disabled || (i.style.background = e.saveHover, i.style.boxShadow =
|
|
245
|
+
i.disabled || (i.style.background = e.saveHover, i.style.boxShadow = l ? "0 2px 8px rgba(59, 130, 246, 0.35)" : "0 2px 8px rgba(0, 102, 204, 0.3)");
|
|
246
246
|
}, i.onmouseout = () => {
|
|
247
247
|
i.disabled || (i.style.background = e.saveBg, i.style.boxShadow = "none");
|
|
248
248
|
}, v.appendChild(g), v.appendChild(i), o.oninput = () => {
|
|
249
|
-
const
|
|
250
|
-
if ($(),
|
|
251
|
-
const k = A(
|
|
252
|
-
k.valid ? b.has(
|
|
249
|
+
const r = o.value;
|
|
250
|
+
if ($(), r.trim()) {
|
|
251
|
+
const k = A(r);
|
|
252
|
+
k.valid ? b.has(r) ? (d = `Anchor ID already exists: ${r}`, p.textContent = "⚠ " + d, p.style.display = "block", o.style.borderColor = e.fieldErrorBorder, o.style.background = e.fieldErrorBg) : (d = "", p.style.display = "none", o.style.borderColor = e.fieldBorder, o.style.background = e.fieldBg) : (d = k.error, p.textContent = "⚠ " + d, p.style.display = "block", o.style.borderColor = e.fieldErrorBorder, o.style.background = e.fieldErrorBg);
|
|
253
253
|
} else
|
|
254
254
|
p.style.display = "none", o.style.borderColor = e.fieldBorder, o.style.background = e.fieldBg;
|
|
255
255
|
}, o.onfocus = () => {
|
|
256
|
-
o.style.borderColor =
|
|
256
|
+
o.style.borderColor = d ? e.fieldErrorBorder : e.saveBg, o.style.boxShadow = d ? `0 0 0 3px ${e.errorRing}` : `0 0 0 3px ${e.focusRing}`, o.style.background = d ? e.fieldErrorBg : e.fieldFocusBg;
|
|
257
257
|
}, o.onblur = () => {
|
|
258
|
-
o.style.boxShadow = "none",
|
|
258
|
+
o.style.boxShadow = "none", d || (o.style.background = e.fieldBg);
|
|
259
259
|
};
|
|
260
260
|
const T = () => {
|
|
261
|
-
const
|
|
262
|
-
!
|
|
261
|
+
const r = o.value.trim();
|
|
262
|
+
!r || !A(r).valid || b.has(r) || (s && s(r), n.remove());
|
|
263
263
|
}, E = () => {
|
|
264
|
-
|
|
264
|
+
n.remove();
|
|
265
265
|
};
|
|
266
|
-
i.onclick = T, g.onclick = E, f.onclick = E, o.onkeydown = (
|
|
267
|
-
|
|
268
|
-
},
|
|
269
|
-
|
|
270
|
-
}, u.appendChild(h), u.appendChild(C), u.appendChild(v),
|
|
266
|
+
i.onclick = T, g.onclick = E, f.onclick = E, o.onkeydown = (r) => {
|
|
267
|
+
r.key === "Enter" ? (r.preventDefault(), T()) : r.key === "Escape" && (r.preventDefault(), E());
|
|
268
|
+
}, n.onclick = (r) => {
|
|
269
|
+
r.target === n && E();
|
|
270
|
+
}, u.appendChild(h), u.appendChild(C), u.appendChild(v), n.appendChild(u), document.body.appendChild(n), setTimeout(() => o.focus(), 100);
|
|
271
271
|
}
|
|
272
272
|
function L(t, c) {
|
|
273
273
|
let s;
|
|
274
274
|
if (c)
|
|
275
275
|
s = c;
|
|
276
276
|
else {
|
|
277
|
-
const
|
|
278
|
-
if (!
|
|
279
|
-
s =
|
|
277
|
+
const d = window.getSelection();
|
|
278
|
+
if (!d || d.rangeCount === 0) return;
|
|
279
|
+
s = d.getRangeAt(0);
|
|
280
280
|
}
|
|
281
|
-
let a = null,
|
|
282
|
-
for (;
|
|
283
|
-
if (
|
|
284
|
-
const
|
|
285
|
-
if (
|
|
286
|
-
a =
|
|
281
|
+
let a = null, l = s.startContainer;
|
|
282
|
+
for (; l && l !== document.body; ) {
|
|
283
|
+
if (l.nodeType === Node.ELEMENT_NODE) {
|
|
284
|
+
const d = l;
|
|
285
|
+
if (d.getAttribute("contenteditable") === "true") {
|
|
286
|
+
a = d;
|
|
287
287
|
break;
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
|
-
|
|
290
|
+
l = l.parentNode;
|
|
291
291
|
}
|
|
292
|
-
const e = a?.innerHTML ?? "",
|
|
293
|
-
|
|
292
|
+
const e = a?.innerHTML ?? "", n = document.createElement("span");
|
|
293
|
+
n.id = t, n.className = "rte-anchor", n.setAttribute("data-type", "anchor"), n.setAttribute("data-anchor-id", t), n.setAttribute("title", `Anchor: ${t}`), n.style.cssText = `
|
|
294
294
|
display: inline;
|
|
295
295
|
position: relative;
|
|
296
296
|
cursor: pointer;
|
|
297
|
-
`, s.insertNode(
|
|
297
|
+
`, s.insertNode(n), b.add(t), s.setStart(n.nextSibling || n.parentNode, 0), s.collapse(!0);
|
|
298
298
|
const u = window.getSelection();
|
|
299
299
|
if (u && (u.removeAllRanges(), u.addRange(s)), a)
|
|
300
|
-
|
|
300
|
+
M(a, e), a.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
301
301
|
else {
|
|
302
|
-
const
|
|
303
|
-
if (
|
|
304
|
-
const h = S(
|
|
302
|
+
const d = D();
|
|
303
|
+
if (d) {
|
|
304
|
+
const h = S(d);
|
|
305
305
|
h && h.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
306
306
|
}
|
|
307
307
|
}
|
|
@@ -390,13 +390,13 @@ function N() {
|
|
|
390
390
|
}
|
|
391
391
|
`, document.head.appendChild(t);
|
|
392
392
|
}
|
|
393
|
-
const j = () => (typeof window < "u" && (
|
|
393
|
+
const j = () => (typeof window < "u" && (H(), N()), {
|
|
394
394
|
name: "anchor",
|
|
395
395
|
toolbar: [
|
|
396
396
|
{
|
|
397
397
|
label: "Anchor",
|
|
398
398
|
command: "insertAnchor",
|
|
399
|
-
icon: '<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g
|
|
399
|
+
icon: '<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g> <path d="M12 8.4C13.4912 8.4 14.7 7.19117 14.7 5.7C14.7 4.20883 13.4912 3 12 3C10.5088 3 9.3 4.20883 9.3 5.7C9.3 7.19117 10.5088 8.4 12 8.4ZM12 8.4V20.9999M12 20.9999C9.61305 20.9999 7.32387 20.0518 5.63604 18.364C3.94821 16.6761 3 14.3869 3 12H5M12 20.9999C14.3869 20.9999 16.6761 20.0518 18.364 18.364C20.0518 16.6761 21 14.3869 21 12H19" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>',
|
|
400
400
|
shortcut: "Mod-Shift-k"
|
|
401
401
|
}
|
|
402
402
|
],
|
|
@@ -407,7 +407,7 @@ const j = () => (typeof window < "u" && (M(), N()), {
|
|
|
407
407
|
if (!t || t.rangeCount === 0)
|
|
408
408
|
return alert("Please place your cursor where you want to insert the anchor."), !1;
|
|
409
409
|
const c = t.getRangeAt(0).cloneRange();
|
|
410
|
-
return
|
|
410
|
+
return _("add", "", (s) => {
|
|
411
411
|
L(s, c);
|
|
412
412
|
}, c), !0;
|
|
413
413
|
} catch (t) {
|
package/dist/blockquote.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d='.rte-content, .editora-content, [contenteditable="true"]',
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d='.rte-content, .editora-content, [contenteditable="true"]',S="[data-editora-editor], .rte-editor, .editora-editor, editora-editor",T=["p","div","h1","h2","h3","h4","h5","h6","ul","ol","blockquote","pre","table"].join(",");function p(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function w(e){const t=e?.contentElement;if(t instanceof HTMLElement)return t;const n=e?.editorElement;if(n instanceof HTMLElement){const c=n.querySelector(d);if(c instanceof HTMLElement)return c;if(n.getAttribute("contenteditable")==="true")return n}const o=window.getSelection();if(o&&o.rangeCount>0){const c=p(o.getRangeAt(0).startContainer),i=c?.closest(d);if(i instanceof HTMLElement)return i;const f=c?.closest(S)?.querySelector(d);if(f instanceof HTMLElement)return f}const s=document.activeElement?.closest(d);return s instanceof HTMLElement?s:document.querySelector(d)}function B(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return!e.contains(n.startContainer)||!e.contains(n.endContainer)?null:n}function C(e,t){let n=p(t);if(!n||n===e||!e.contains(n))return null;for(;n.parentElement&&n.parentElement!==e;)n=n.parentElement;if(n.parentElement!==e)return null;if(n.matches(T))return n;const o=n.closest(T);return o instanceof HTMLElement&&o.parentElement===e?o:n}function y(e,t){if(typeof e.intersectsNode=="function")try{return e.intersectsNode(t)}catch{return!1}const n=document.createRange();return n.selectNode(t),e.compareBoundaryPoints(Range.END_TO_START,n)<0&&e.compareBoundaryPoints(Range.START_TO_END,n)>0}function v(e,t){const n=C(e,t.startContainer),o=C(e,t.endContainer);if(!n)return[];if(!o||n===o)return[n];const s=Array.from(e.children).filter(c=>c instanceof HTMLElement).filter(c=>y(t,c));return s.length>0?s:[n]}function k(e,t){const o=p(t)?.closest("blockquote");return o instanceof HTMLQuoteElement&&e.contains(o)?o:null}function b(e){return e.tagName!=="P"||e.attributes.length>0||(e.textContent||"").trim()!==""?!1:!e.querySelector("img, video, table, iframe, hr, pre, ul, ol")}function M(e){Array.from(e.children).forEach(t=>{b(t)&&t.remove()})}function E(e){M(e);const t=e.parentNode;if(!t)return;Array.from(e.childNodes).forEach(o=>{t.insertBefore(o,e)}),t.removeChild(e)}function L(e){return e.nodeType===Node.TEXT_NODE&&(e.textContent||"").trim()===""}function N(e){const t=Array.from(e.childNodes).filter(o=>!L(o));if(t.length!==1)return null;const n=t[0];return n instanceof HTMLQuoteElement?n:null}function q(e){const t=document.createElement("blockquote");return Array.from(e.childNodes).filter(o=>!L(o)).forEach(o=>{t.appendChild(o)}),t.childNodes.length||(t.innerHTML="<br>"),e.appendChild(t),t}function O(e,t){const n=Array.from(e.querySelectorAll("li")).filter(r=>r instanceof HTMLLIElement&&y(t,r)),o=new Set(n);return n.filter(r=>{let s=r.parentElement?.closest("li");for(;s;){if(o.has(s))return!1;s=s.parentElement?.closest("li")}return!0})}function m(e){const t=window.getSelection();if(!t)return;const n=document.createRange(),o=e instanceof HTMLElement&&e.querySelector("p,li,h1,h2,h3,h4,h5,h6")||e;n.selectNodeContents(o),n.collapse(!0),t.removeAllRanges(),t.addRange(n)}function x(e){e.dispatchEvent(new Event("input",{bubbles:!0}))}function R(e,t,n){const o=window.execEditorCommand;if(typeof o=="function"){o("recordDomTransaction",e,t,n);return}const r=window.executeEditorCommand;typeof r=="function"&&r("recordDomTransaction",{editor:e,beforeHTML:t,afterHTML:n})}function A(e){const t=w(e);if(!t)return!1;const n=B(t);if(!n)return!1;const o=t.innerHTML,r=k(t,n.startContainer),s=k(t,n.endContainer),c=O(t,n),i=v(t,n),h=i.length>0&&i.every(l=>l.tagName==="BLOCKQUOTE");if(r&&r===s){const l=r.firstChild||r;E(r),m(l)}else if(c.length>0){const l=c.map(N);if(l.every(Boolean)){const u=l[0]?.firstChild||c[0];l.forEach(a=>{a&&E(a)}),m(u)}else{const u=c[0];c.forEach(a=>{N(a)||q(a)}),m(u)}}else if(h){const l=i[0].firstChild||i[0];i.forEach(E),m(l)}else{const l=i.filter(a=>a.tagName!=="BLOCKQUOTE");if(l.length===0)return!1;const g=document.createElement("blockquote"),u=l[0];u.parentNode?.insertBefore(g,u),l.forEach(a=>{g.appendChild(a)}),m(g)}const f=t.innerHTML;return o===f?!1:(R(t,o,f),x(t),!0)}const H=()=>({name:"blockquote",nodes:{blockquote:{content:"block+",group:"block",parseDOM:[{tag:"blockquote"}],toDOM:()=>["blockquote",0]}},toolbar:[{label:"Quote",command:"toggleBlockquote",icon:'<svg fill="#000000" height="24px" width="24px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 32 32" xml:space="preserve"><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g> <g> <path d="M13,11c0.6,0,1-0.4,1-1s-0.4-1-1-1c-5,0-9,4-9,9c0,2.8,2.2,5,5,5s5-2.2,5-5s-2.2-5-5-5c-0.3,0-0.7,0-1,0.1 C9.3,11.8,11,11,13,11z"></path> <path d="M23,13c-0.3,0-0.7,0-1,0.1c1.3-1.3,3-2.1,5-2.1c0.6,0,1-0.4,1-1s-0.4-1-1-1c-5,0-9,4-9,9c0,2.8,2.2,5,5,5s5-2.2,5-5 S25.8,13,23,13z"></path> </g> </g></svg>',shortcut:"Mod-Shift-9"}],commands:{toggleBlockquote:(e,t)=>A(t)},keymap:{"Mod-Shift-9":"toggleBlockquote"}});exports.BlockquotePlugin=H;
|