@editora/plugins 1.0.19 → 1.0.21
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 → CodePlugin.native-CKJo7IFG.js} +8 -8
- package/dist/{CodePlugin.native-Cpp4u3Jl.mjs → CodePlugin.native-D8gGxB8i.mjs} +59 -60
- 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/code.cjs.js +1 -1
- package/dist/code.esm.js +1 -1
- 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/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +1 -1
- package/dist/{documentManager-yjRBab4v.mjs → documentManager-BL98a7YZ.mjs} +402 -404
- package/dist/{documentManager-BDz6tovy.js → documentManager-r8t7yZEd.js} +9 -9
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +1 -1
- package/dist/font-family.cjs.js +1 -1
- package/dist/font-family.esm.js +26 -26
- package/dist/{index-Bm1eqYHh.mjs → index-B-VitI3v.mjs} +23 -22
- package/dist/{index-CoflqYuK.js → index-D5xugkYA.js} +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/preview.cjs.js +3 -3
- package/dist/preview.esm.js +48 -51
- package/dist/purify.es-B6PsRpEV.js +3 -0
- package/dist/purify.es-DmCsrgBd.mjs +1480 -0
- package/dist/sanitizeHtml-CDoBlNTk.js +1 -0
- package/dist/sanitizeHtml-CtLy8um-.mjs +16 -0
- package/dist/spell-check.cjs.js +2 -2
- package/dist/spell-check.esm.js +19 -19
- package/dist/table.cjs.js +14 -14
- package/dist/table.esm.js +158 -150
- package/dist/template.cjs.js +20 -21
- package/dist/template.esm.js +176 -724
- package/package.json +6 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const I=require("./dialogHelpers-zU6zpMIA.js"),
|
|
1
|
+
"use strict";const I=require("./dialogHelpers-zU6zpMIA.js"),s=require("@editora/light-code-editor"),P=require("./sanitizeHtml-CDoBlNTk.js"),S='[data-theme="dark"], .dark, .editora-theme-dark',U=`/* Source Editor Dialog Styles */
|
|
2
2
|
.rte-source-editor-overlay {
|
|
3
3
|
position: fixed !important;
|
|
4
4
|
top: 0 !important;
|
|
@@ -375,10 +375,10 @@
|
|
|
375
375
|
flex: 1;
|
|
376
376
|
text-align: center;
|
|
377
377
|
}
|
|
378
|
-
}`,
|
|
378
|
+
}`,_=()=>({name:"code",toolbar:[{label:"Source",command:"toggleSourceView",icon:'<svg width="24" height="24" focusable="false"><g fill-rule="nonzero"><path d="M9.8 15.7c.3.3.3.8 0 1-.3.4-.9.4-1.2 0l-4.4-4.1a.8.8 0 0 1 0-1.2l4.4-4.2c.3-.3.9-.3 1.2 0 .3.3.3.8 0 1.1L6 12l3.8 3.7ZM14.2 15.7c-.3.3-.3.8 0 1 .4.4.9.4 1.2 0l4.4-4.1c.3-.3.3-.9 0-1.2l-4.4-4.2a.8.8 0 0 0-1.2 0c-.3.3-.3.8 0 1.1L18 12l-3.8 3.7Z"></path></g></svg>',shortcut:"Mod-Shift-S"}],commands:{toggleSourceView:()=>{const l=(()=>{const c=window.getSelection();if(c&&c.anchorNode){let e=c.anchorNode instanceof HTMLElement?c.anchorNode:c.anchorNode.parentElement;for(;e;){if(e.classList?.contains("rte-content"))return e;e=e.parentElement}}if(document.activeElement){let e=document.activeElement;if(e.classList?.contains("rte-content"))return e;for(;e&&e!==document.body;){if(e.classList?.contains("rte-content"))return e;const n=e.querySelector(".rte-content");if(n)return n;e=e.parentElement}}const o=document.querySelector("[data-editora-editor]");if(o){const e=o.querySelector(".rte-content");if(e)return e}return document.querySelector(".rte-content")})();if(!l)return console.error("[CodePlugin] Editor content area not found"),alert("Editor content area not found. Please click inside the editor first."),!1;const N=l.innerHTML,D=c=>{let o="",e=0;const n=2,u=c.split(/(<\/?[a-zA-Z][^>]*>)/);for(const r of u)r.trim()&&(r.match(/^<\/[a-zA-Z]/)?(e=Math.max(0,e-1),o+=`
|
|
379
379
|
`+" ".repeat(e*n)+r):r.match(/^<[a-zA-Z]/)&&!r.match(/\/>$/)?(o+=`
|
|
380
380
|
`+" ".repeat(e*n)+r,e++):r.match(/^<[a-zA-Z].*\/>$/)?o+=`
|
|
381
|
-
`+" ".repeat(e*n)+r:o+=r.trim());return o.trim()};return(()=>{document.querySelectorAll(".rte-source-editor-overlay").forEach(t=>t.remove());const o=D(N);let e=null,n="dark",
|
|
381
|
+
`+" ".repeat(e*n)+r:o+=r.trim());return o.trim()};return(()=>{document.querySelectorAll(".rte-source-editor-overlay").forEach(t=>t.remove());const o=D(N);let e=null,n="dark",u=!1,r=!1,v=!1,w=!1;const O=!!l.closest(S)||document.body.matches(S)||document.documentElement.matches(S),i=document.createElement("div");I.initDialogOverlay(i),i.className="rte-source-editor-overlay",O&&i.classList.add("rte-theme-dark");const a=document.createElement("div");a.className="rte-source-editor-modal",a.setAttribute("role","dialog"),a.setAttribute("aria-modal","true"),a.setAttribute("aria-labelledby","source-editor-title");const h=document.createElement("div");h.className="rte-source-editor-header",h.innerHTML=`
|
|
382
382
|
<h2 id="source-editor-title">Source Editor</h2>
|
|
383
383
|
<div class="rte-source-editor-header-toolbar">
|
|
384
384
|
<button class="rte-source-editor-toolbar-btn theme-toggle-btn" title="Switch theme">
|
|
@@ -414,7 +414,7 @@
|
|
|
414
414
|
</svg>
|
|
415
415
|
</button>
|
|
416
416
|
</div>
|
|
417
|
-
`;const
|
|
417
|
+
`;const E=document.createElement("div");E.className="rte-source-editor-body";const x=document.createElement("div");x.className="rte-source-editor-content";const C=document.createElement("div");C.className="rte-source-editor-warning",C.textContent="⚠️ Advanced users only. Invalid HTML may break the editor.";const b=document.createElement("div");b.className="rte-source-editor-light-editor",b.style.height="400px",x.appendChild(C),x.appendChild(b),E.appendChild(x);const f=document.createElement("div");if(f.className="rte-source-editor-footer",f.innerHTML=`
|
|
418
418
|
<div class="rte-source-editor-footer-info">
|
|
419
419
|
<span class="unsaved-changes" style="display: none;">• Unsaved changes</span>
|
|
420
420
|
</div>
|
|
@@ -422,7 +422,7 @@
|
|
|
422
422
|
<button class="rte-source-editor-btn rte-source-editor-btn-cancel">Cancel</button>
|
|
423
423
|
<button class="rte-source-editor-btn rte-source-editor-btn-save">Save</button>
|
|
424
424
|
</div>
|
|
425
|
-
`,
|
|
425
|
+
`,a.appendChild(h),a.appendChild(E),a.appendChild(f),i.appendChild(a),!document.getElementById("rte-source-editor-styles")){const t=document.createElement("style");t.id="rte-source-editor-styles",t.textContent=U,document.head.appendChild(t)}const y=h.querySelector(".theme-toggle-btn"),g=h.querySelector(".readonly-toggle-btn"),k=h.querySelector(".rte-source-editor-fullscreen-btn"),L=h.querySelector(".rte-source-editor-close-btn"),H=f.querySelector(".rte-source-editor-btn-cancel"),T=f.querySelector(".rte-source-editor-btn-save"),z=f.querySelector(".unsaved-changes"),M=[],d=(t,m,q,A)=>{t.addEventListener(m,q,A),M.push(()=>t.removeEventListener(m,q,A))},B=t=>{v!==t&&(v=t,z&&(z.style.display=v?"inline":"none"))},p=()=>{if(!w){for(w=!0;M.length;)M.pop()?.();e&&(e.destroy(),e=null),i.isConnected&&i.remove()}},R=()=>{n=n==="dark"?"light":"dark",e?.setTheme(n),y&&(y.innerHTML=n==="light"?`
|
|
426
426
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
427
427
|
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>
|
|
428
428
|
</svg>
|
|
@@ -438,7 +438,7 @@
|
|
|
438
438
|
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/>
|
|
439
439
|
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>
|
|
440
440
|
</svg>
|
|
441
|
-
`)},
|
|
441
|
+
`)},F=()=>{u=!u,e?.setReadOnly(u),g&&(g.classList.toggle("active",u),g.innerHTML=u?`
|
|
442
442
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
443
443
|
<rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
|
|
444
444
|
<circle cx="12" cy="16" r="1"/>
|
|
@@ -449,7 +449,7 @@
|
|
|
449
449
|
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>
|
|
450
450
|
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
|
|
451
451
|
</svg>
|
|
452
|
-
`)},
|
|
452
|
+
`)},V=()=>{r=!r,i.classList.toggle("fullscreen",r),b.style.height=r?"calc(100vh - 200px)":"400px",k&&(k.innerHTML=r?`
|
|
453
453
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
454
454
|
<path d="M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 0 2-2h3M3 16h3a2 2 0 0 0 2 2v3"/>
|
|
455
455
|
</svg>
|
|
@@ -457,4 +457,4 @@
|
|
|
457
457
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
458
458
|
<path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/>
|
|
459
459
|
</svg>
|
|
460
|
-
`)},
|
|
460
|
+
`)},Z=()=>{v&&!confirm("You have unsaved changes. Are you sure you want to cancel?")||p()},j=()=>{try{const t=e?.getValue()||"";l.innerHTML=P.sanitizeHtml(t);try{l.dispatchEvent(new InputEvent("input",{bubbles:!0,cancelable:!1,inputType:"insertReplacementText"}))}catch{l.dispatchEvent(new Event("input",{bubbles:!0}))}l.dispatchEvent(new Event("change",{bubbles:!0})),B(!1),p()}catch(t){alert("Failed to update HTML. Please check your syntax."),console.error("HTML update error:",t)}};y&&d(y,"click",R),g&&d(g,"click",F),k&&d(k,"click",V),L&&d(L,"click",p),H&&d(H,"click",Z),T&&d(T,"click",j),d(i,"click",t=>{t.target===i&&p()}),d(document,"keydown",t=>{const m=t;m.key==="Escape"&&(m.preventDefault(),p())}),document.body.appendChild(i),requestAnimationFrame(()=>{if(!(w||!i.isConnected))try{e=s.createEditor(b,{value:o,theme:"dark",readOnly:!1,extensions:[new s.LineNumbersExtension,new s.ThemeExtension,new s.ReadOnlyExtension,new s.BracketMatchingExtension,new s.SearchExtension,new s.CodeFoldingExtension,new s.SyntaxHighlightingExtension]}),e.on("change",()=>{const t=e?.getValue()||"";B(t!==o)}),requestAnimationFrame(()=>e?.focus())}catch(t){console.error("Failed to initialize code editor:",t)}})})(),!0}},keymap:{"Mod-Shift-s":"toggleSourceView","Mod-Shift-S":"toggleSourceView"}});exports.CodePlugin=_;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { i as
|
|
1
|
+
import { i as j } from "./dialogHelpers-5d5BuOCW.mjs";
|
|
2
2
|
import { createEditor as I, LineNumbersExtension as U, ThemeExtension as P, ReadOnlyExtension as _, BracketMatchingExtension as $, SearchExtension as K, CodeFoldingExtension as Y, SyntaxHighlightingExtension as G } from "@editora/light-code-editor";
|
|
3
|
-
|
|
3
|
+
import { s as J } from "./sanitizeHtml-CtLy8um-.mjs";
|
|
4
|
+
const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Editor Dialog Styles */
|
|
4
5
|
.rte-source-editor-overlay {
|
|
5
6
|
position: fixed !important;
|
|
6
7
|
top: 0 !important;
|
|
@@ -377,7 +378,7 @@ const L = '[data-theme="dark"], .dark, .editora-theme-dark', J = `/* Source Edit
|
|
|
377
378
|
flex: 1;
|
|
378
379
|
text-align: center;
|
|
379
380
|
}
|
|
380
|
-
}`,
|
|
381
|
+
}`, oe = () => ({
|
|
381
382
|
name: "code",
|
|
382
383
|
// Toolbar button configuration
|
|
383
384
|
toolbar: [
|
|
@@ -396,7 +397,7 @@ const L = '[data-theme="dark"], .dark, .editora-theme-dark', J = `/* Source Edit
|
|
|
396
397
|
* Opens a dialog to edit raw HTML
|
|
397
398
|
*/
|
|
398
399
|
toggleSourceView: () => {
|
|
399
|
-
const
|
|
400
|
+
const s = (() => {
|
|
400
401
|
const a = window.getSelection();
|
|
401
402
|
if (a && a.anchorNode) {
|
|
402
403
|
let e = a.anchorNode instanceof HTMLElement ? a.anchorNode : a.anchorNode.parentElement;
|
|
@@ -429,14 +430,14 @@ const L = '[data-theme="dark"], .dark, .editora-theme-dark', J = `/* Source Edit
|
|
|
429
430
|
}
|
|
430
431
|
return document.querySelector(".rte-content");
|
|
431
432
|
})();
|
|
432
|
-
if (!
|
|
433
|
+
if (!s)
|
|
433
434
|
return console.error("[CodePlugin] Editor content area not found"), alert(
|
|
434
435
|
"Editor content area not found. Please click inside the editor first."
|
|
435
436
|
), !1;
|
|
436
|
-
const A =
|
|
437
|
+
const A = s.innerHTML, N = (a) => {
|
|
437
438
|
let o = "", e = 0;
|
|
438
|
-
const n = 2,
|
|
439
|
-
for (const r of
|
|
439
|
+
const n = 2, l = a.split(/(<\/?[a-zA-Z][^>]*>)/);
|
|
440
|
+
for (const r of l)
|
|
440
441
|
r.trim() && (r.match(/^<\/[a-zA-Z]/) ? (e = Math.max(0, e - 1), o += `
|
|
441
442
|
` + " ".repeat(e * n) + r) : r.match(/^<[a-zA-Z]/) && !r.match(/\/>$/) ? (o += `
|
|
442
443
|
` + " ".repeat(e * n) + r, e++) : r.match(/^<[a-zA-Z].*\/>$/) ? o += `
|
|
@@ -446,13 +447,13 @@ const L = '[data-theme="dark"], .dark, .editora-theme-dark', J = `/* Source Edit
|
|
|
446
447
|
return (() => {
|
|
447
448
|
document.querySelectorAll(".rte-source-editor-overlay").forEach((t) => t.remove());
|
|
448
449
|
const o = N(A);
|
|
449
|
-
let e = null, n = "dark",
|
|
450
|
-
const D = !!
|
|
451
|
-
|
|
452
|
-
const
|
|
453
|
-
|
|
454
|
-
const
|
|
455
|
-
|
|
450
|
+
let e = null, n = "dark", l = !1, r = !1, p = !1, k = !1;
|
|
451
|
+
const D = !!s.closest(M) || document.body.matches(M) || document.documentElement.matches(M), i = document.createElement("div");
|
|
452
|
+
j(i), i.className = "rte-source-editor-overlay", D && i.classList.add("rte-theme-dark");
|
|
453
|
+
const c = document.createElement("div");
|
|
454
|
+
c.className = "rte-source-editor-modal", c.setAttribute("role", "dialog"), c.setAttribute("aria-modal", "true"), c.setAttribute("aria-labelledby", "source-editor-title");
|
|
455
|
+
const u = document.createElement("div");
|
|
456
|
+
u.className = "rte-source-editor-header", u.innerHTML = `
|
|
456
457
|
<h2 id="source-editor-title">Source Editor</h2>
|
|
457
458
|
<div class="rte-source-editor-header-toolbar">
|
|
458
459
|
<button class="rte-source-editor-toolbar-btn theme-toggle-btn" title="Switch theme">
|
|
@@ -489,16 +490,16 @@ const L = '[data-theme="dark"], .dark, .editora-theme-dark', J = `/* Source Edit
|
|
|
489
490
|
</button>
|
|
490
491
|
</div>
|
|
491
492
|
`;
|
|
492
|
-
const
|
|
493
|
-
|
|
493
|
+
const w = document.createElement("div");
|
|
494
|
+
w.className = "rte-source-editor-body";
|
|
494
495
|
const v = document.createElement("div");
|
|
495
496
|
v.className = "rte-source-editor-content";
|
|
496
|
-
const
|
|
497
|
-
|
|
498
|
-
const b = document.createElement("div");
|
|
499
|
-
b.className = "rte-source-editor-light-editor", b.style.height = "400px", v.appendChild(C), v.appendChild(b), E.appendChild(v);
|
|
497
|
+
const E = document.createElement("div");
|
|
498
|
+
E.className = "rte-source-editor-warning", E.textContent = "⚠️ Advanced users only. Invalid HTML may break the editor.";
|
|
500
499
|
const f = document.createElement("div");
|
|
501
|
-
|
|
500
|
+
f.className = "rte-source-editor-light-editor", f.style.height = "400px", v.appendChild(E), v.appendChild(f), w.appendChild(v);
|
|
501
|
+
const h = document.createElement("div");
|
|
502
|
+
if (h.className = "rte-source-editor-footer", h.innerHTML = `
|
|
502
503
|
<div class="rte-source-editor-footer-info">
|
|
503
504
|
<span class="unsaved-changes" style="display: none;">• Unsaved changes</span>
|
|
504
505
|
</div>
|
|
@@ -506,34 +507,34 @@ const L = '[data-theme="dark"], .dark, .editora-theme-dark', J = `/* Source Edit
|
|
|
506
507
|
<button class="rte-source-editor-btn rte-source-editor-btn-cancel">Cancel</button>
|
|
507
508
|
<button class="rte-source-editor-btn rte-source-editor-btn-save">Save</button>
|
|
508
509
|
</div>
|
|
509
|
-
`,
|
|
510
|
+
`, c.appendChild(u), c.appendChild(w), c.appendChild(h), i.appendChild(c), !document.getElementById("rte-source-editor-styles")) {
|
|
510
511
|
const t = document.createElement("style");
|
|
511
|
-
t.id = "rte-source-editor-styles", t.textContent =
|
|
512
|
+
t.id = "rte-source-editor-styles", t.textContent = Q, document.head.appendChild(t);
|
|
512
513
|
}
|
|
513
|
-
const x =
|
|
514
|
+
const x = u.querySelector(
|
|
514
515
|
".theme-toggle-btn"
|
|
515
|
-
),
|
|
516
|
+
), b = u.querySelector(
|
|
516
517
|
".readonly-toggle-btn"
|
|
517
|
-
), y =
|
|
518
|
+
), y = u.querySelector(
|
|
518
519
|
".rte-source-editor-fullscreen-btn"
|
|
519
|
-
),
|
|
520
|
+
), S = u.querySelector(
|
|
520
521
|
".rte-source-editor-close-btn"
|
|
521
|
-
),
|
|
522
|
+
), L = h.querySelector(
|
|
522
523
|
".rte-source-editor-btn-cancel"
|
|
523
|
-
),
|
|
524
|
+
), H = h.querySelector(
|
|
524
525
|
".rte-source-editor-btn-save"
|
|
525
|
-
),
|
|
526
|
+
), T = h.querySelector(
|
|
526
527
|
".unsaved-changes"
|
|
527
|
-
),
|
|
528
|
-
t.addEventListener(
|
|
529
|
-
() => t.removeEventListener(
|
|
528
|
+
), C = [], d = (t, m, B, q) => {
|
|
529
|
+
t.addEventListener(m, B, q), C.push(
|
|
530
|
+
() => t.removeEventListener(m, B, q)
|
|
530
531
|
);
|
|
531
|
-
},
|
|
532
|
-
p !== t && (p = t,
|
|
532
|
+
}, z = (t) => {
|
|
533
|
+
p !== t && (p = t, T && (T.style.display = p ? "inline" : "none"));
|
|
533
534
|
}, g = () => {
|
|
534
|
-
if (!
|
|
535
|
-
for (
|
|
536
|
-
|
|
535
|
+
if (!k) {
|
|
536
|
+
for (k = !0; C.length; )
|
|
537
|
+
C.pop()?.();
|
|
537
538
|
e && (e.destroy(), e = null), i.isConnected && i.remove();
|
|
538
539
|
}
|
|
539
540
|
}, O = () => {
|
|
@@ -555,7 +556,7 @@ const L = '[data-theme="dark"], .dark, .editora-theme-dark', J = `/* Source Edit
|
|
|
555
556
|
</svg>
|
|
556
557
|
`);
|
|
557
558
|
}, R = () => {
|
|
558
|
-
|
|
559
|
+
l = !l, e?.setReadOnly(l), b && (b.classList.toggle("active", l), b.innerHTML = l ? `
|
|
559
560
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
560
561
|
<rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
|
|
561
562
|
<circle cx="12" cy="16" r="1"/>
|
|
@@ -567,8 +568,8 @@ const L = '[data-theme="dark"], .dark, .editora-theme-dark', J = `/* Source Edit
|
|
|
567
568
|
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
|
|
568
569
|
</svg>
|
|
569
570
|
`);
|
|
570
|
-
},
|
|
571
|
-
r = !r, i.classList.toggle("fullscreen", r),
|
|
571
|
+
}, F = () => {
|
|
572
|
+
r = !r, i.classList.toggle("fullscreen", r), f.style.height = r ? "calc(100vh - 200px)" : "400px", y && (y.innerHTML = r ? `
|
|
572
573
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
573
574
|
<path d="M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 0 2-2h3M3 16h3a2 2 0 0 0 2 2v3"/>
|
|
574
575
|
</svg>
|
|
@@ -577,16 +578,14 @@ const L = '[data-theme="dark"], .dark, .editora-theme-dark', J = `/* Source Edit
|
|
|
577
578
|
<path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/>
|
|
578
579
|
</svg>
|
|
579
580
|
`);
|
|
580
|
-
}, F = () => {
|
|
581
|
-
p && !confirm("You have unsaved changes. Are you sure you want to cancel?") || g();
|
|
582
581
|
}, V = () => {
|
|
582
|
+
p && !confirm("You have unsaved changes. Are you sure you want to cancel?") || g();
|
|
583
|
+
}, Z = () => {
|
|
583
584
|
try {
|
|
584
|
-
const t = e?.getValue() || ""
|
|
585
|
-
|
|
586
|
-
'script, iframe[src^="javascript:"], object, embed'
|
|
587
|
-
).forEach((k) => k.remove()), l.innerHTML = c.innerHTML;
|
|
585
|
+
const t = e?.getValue() || "";
|
|
586
|
+
s.innerHTML = J(t);
|
|
588
587
|
try {
|
|
589
|
-
|
|
588
|
+
s.dispatchEvent(
|
|
590
589
|
new InputEvent("input", {
|
|
591
590
|
bubbles: !0,
|
|
592
591
|
cancelable: !1,
|
|
@@ -594,26 +593,26 @@ const L = '[data-theme="dark"], .dark, .editora-theme-dark', J = `/* Source Edit
|
|
|
594
593
|
})
|
|
595
594
|
);
|
|
596
595
|
} catch {
|
|
597
|
-
|
|
596
|
+
s.dispatchEvent(
|
|
598
597
|
new Event("input", { bubbles: !0 })
|
|
599
598
|
);
|
|
600
599
|
}
|
|
601
|
-
|
|
600
|
+
s.dispatchEvent(
|
|
602
601
|
new Event("change", { bubbles: !0 })
|
|
603
|
-
),
|
|
602
|
+
), z(!1), g();
|
|
604
603
|
} catch (t) {
|
|
605
604
|
alert("Failed to update HTML. Please check your syntax."), console.error("HTML update error:", t);
|
|
606
605
|
}
|
|
607
606
|
};
|
|
608
|
-
x &&
|
|
607
|
+
x && d(x, "click", O), b && d(b, "click", R), y && d(y, "click", F), S && d(S, "click", g), L && d(L, "click", V), H && d(H, "click", Z), d(i, "click", (t) => {
|
|
609
608
|
t.target === i && g();
|
|
610
|
-
}),
|
|
611
|
-
const
|
|
612
|
-
|
|
609
|
+
}), d(document, "keydown", (t) => {
|
|
610
|
+
const m = t;
|
|
611
|
+
m.key === "Escape" && (m.preventDefault(), g());
|
|
613
612
|
}), document.body.appendChild(i), requestAnimationFrame(() => {
|
|
614
|
-
if (!(
|
|
613
|
+
if (!(k || !i.isConnected))
|
|
615
614
|
try {
|
|
616
|
-
e = I(
|
|
615
|
+
e = I(f, {
|
|
617
616
|
value: o,
|
|
618
617
|
theme: "dark",
|
|
619
618
|
readOnly: !1,
|
|
@@ -628,7 +627,7 @@ const L = '[data-theme="dark"], .dark, .editora-theme-dark', J = `/* Source Edit
|
|
|
628
627
|
]
|
|
629
628
|
}), e.on("change", () => {
|
|
630
629
|
const t = e?.getValue() || "";
|
|
631
|
-
|
|
630
|
+
z(t !== o);
|
|
632
631
|
}), requestAnimationFrame(() => e?.focus());
|
|
633
632
|
} catch (t) {
|
|
634
633
|
console.error("Failed to initialize code editor:", t);
|
|
@@ -644,5 +643,5 @@ const L = '[data-theme="dark"], .dark, .editora-theme-dark', J = `/* Source Edit
|
|
|
644
643
|
}
|
|
645
644
|
});
|
|
646
645
|
export {
|
|
647
|
-
|
|
646
|
+
oe as C
|
|
648
647
|
};
|
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;
|