@editora/plugins 1.0.21 → 1.0.23
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/{CodePlugin.native-D8gGxB8i.mjs → CodePlugin.native-DESvGCrJ.mjs} +61 -53
- package/dist/{CodePlugin.native-CKJo7IFG.js → CodePlugin.native-DJqwsRPZ.js} +11 -11
- package/dist/a11y-checker.cjs.js +3 -3
- package/dist/a11y-checker.esm.js +6 -4
- package/dist/anchor.cjs.js +4 -4
- package/dist/anchor.esm.js +19 -18
- package/dist/anchoredPopover-BNJ8e7j-.mjs +128 -0
- package/dist/anchoredPopover-Cygmit_o.js +1 -0
- package/dist/approval-workflow.cjs.js +7 -7
- package/dist/approval-workflow.esm.js +55 -54
- package/dist/background-color.cjs.js +2 -2
- package/dist/background-color.esm.js +72 -67
- package/dist/blocks-library.cjs.js +18 -19
- package/dist/blocks-library.esm.js +41 -42
- package/dist/citations.cjs.js +4 -4
- package/dist/citations.esm.js +50 -50
- package/dist/code-sample.cjs.js +10 -10
- package/dist/code-sample.esm.js +4 -4
- package/dist/code.cjs.js +1 -1
- package/dist/code.esm.js +1 -1
- package/dist/comments.cjs.js +23 -11
- package/dist/comments.esm.js +167 -149
- package/dist/conditional-content.cjs.js +2 -2
- package/dist/conditional-content.esm.js +2 -2
- package/dist/confirmDialog-6BPaNPis.mjs +106 -0
- package/dist/confirmDialog-C4UWENes.js +46 -0
- package/dist/content-rules.cjs.js +6 -6
- package/dist/content-rules.esm.js +51 -51
- package/dist/data-binding.cjs.js +2 -2
- package/dist/data-binding.esm.js +2 -2
- package/dist/dialogHelpers-BbwpIXD9.mjs +183 -0
- package/dist/dialogHelpers-BxSQ7A6M.js +12 -0
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +1 -1
- package/dist/{documentManager-BL98a7YZ.mjs → documentManager-BFjGIeI8.mjs} +793 -781
- package/dist/{documentManager-r8t7yZEd.js → documentManager-C9d17K5W.js} +10 -10
- package/dist/embed-iframe.cjs.js +6 -6
- package/dist/embed-iframe.esm.js +6 -6
- package/dist/emojis.cjs.js +5 -5
- package/dist/emojis.esm.js +3 -3
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +1 -1
- package/dist/format-painter.cjs.js +1 -1
- package/dist/format-painter.esm.js +172 -151
- package/dist/heading.cjs.js +1 -1
- package/dist/heading.esm.js +96 -83
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +176 -97
- package/dist/{index-D5xugkYA.js → index-CtR8olYy.js} +2 -2
- package/dist/{index-B-VitI3v.mjs → index-Du_Ljqfz.mjs} +36 -35
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/katex-Cc3-mvOY.js +257 -0
- package/dist/katex-DoRnZ_sp.mjs +11682 -0
- package/dist/katex.min--Ws3c9be.mjs +5 -0
- package/dist/katex.min-Dk2VscxB.js +2 -0
- package/dist/link.cjs.js +3 -3
- package/dist/link.esm.js +3 -3
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +140 -52
- package/dist/math.cjs.js +14 -14
- package/dist/math.esm.js +149 -136
- package/dist/media-manager.cjs.js +46 -46
- package/dist/media-manager.esm.js +320 -264
- package/dist/mentions.cjs.js +12 -12
- package/dist/mentions.esm.js +149 -143
- package/dist/merge-tag.cjs.js +5 -3
- package/dist/merge-tag.esm.js +5 -3
- package/dist/notify-BkbzMopb.js +32 -0
- package/dist/notify-zOp-mUOJ.mjs +59 -0
- package/dist/pii-redaction.cjs.js +1 -1
- package/dist/pii-redaction.esm.js +1 -1
- package/dist/preview.cjs.js +1 -1
- package/dist/preview.esm.js +1 -1
- package/dist/shared-config.cjs.js +1 -1
- package/dist/shared-config.esm.js +14 -14
- package/dist/slash-commands.cjs.js +5 -5
- package/dist/slash-commands.esm.js +259 -236
- package/dist/smart-paste.cjs.js +1 -1
- package/dist/smart-paste.esm.js +1 -1
- package/dist/special-characters.cjs.js +3 -3
- package/dist/special-characters.esm.js +3 -3
- package/dist/spell-check.cjs.js +9 -9
- package/dist/spell-check.esm.js +288 -251
- package/dist/table.cjs.js +14 -14
- package/dist/table.esm.js +175 -154
- package/dist/template.cjs.js +5 -3
- package/dist/template.esm.js +15 -13
- package/dist/text-color.cjs.js +4 -4
- package/dist/text-color.esm.js +38 -34
- package/dist/translation-workflow.cjs.js +9 -9
- package/dist/translation-workflow.esm.js +98 -95
- package/dist/version-diff.cjs.js +4 -4
- package/dist/version-diff.esm.js +36 -36
- package/package.json +6 -5
- package/dist/anchoredPopover-Bg-ey7Yo.js +0 -1
- package/dist/anchoredPopover-D_JbjvdA.mjs +0 -111
- package/dist/dialogHelpers-5d5BuOCW.mjs +0 -39
- package/dist/dialogHelpers-zU6zpMIA.js +0 -12
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { i as I } from "./dialogHelpers-BbwpIXD9.mjs";
|
|
2
|
+
import { n as q } from "./notify-zOp-mUOJ.mjs";
|
|
3
|
+
import { c as U } from "./confirmDialog-6BPaNPis.mjs";
|
|
4
|
+
import { createEditor as P, LineNumbersExtension as _, ThemeExtension as K, ReadOnlyExtension as $, BracketMatchingExtension as Y, SearchExtension as G, CodeFoldingExtension as J, SyntaxHighlightingExtension as Q } from "@editora/light-code-editor";
|
|
5
|
+
import { s as W } from "./sanitizeHtml-CtLy8um-.mjs";
|
|
6
|
+
const M = '[data-theme="dark"], .dark, .editora-theme-dark', X = `/* Source Editor Dialog Styles */
|
|
5
7
|
.rte-source-editor-overlay {
|
|
6
8
|
position: fixed !important;
|
|
7
9
|
top: 0 !important;
|
|
@@ -300,7 +302,7 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
300
302
|
}
|
|
301
303
|
|
|
302
304
|
.rte-source-editor-overlay.rte-theme-dark .rte-source-editor-toolbar-btn.active {
|
|
303
|
-
background: #
|
|
305
|
+
background: #2563eb;
|
|
304
306
|
color: #ffffff;
|
|
305
307
|
}
|
|
306
308
|
|
|
@@ -342,11 +344,11 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
342
344
|
}
|
|
343
345
|
|
|
344
346
|
.rte-source-editor-overlay.rte-theme-dark .rte-source-editor-btn-save {
|
|
345
|
-
background: #
|
|
347
|
+
background: #2563eb;
|
|
346
348
|
}
|
|
347
349
|
|
|
348
350
|
.rte-source-editor-overlay.rte-theme-dark .rte-source-editor-btn-save:hover:not(:disabled) {
|
|
349
|
-
background: #
|
|
351
|
+
background: #1d4ed8;
|
|
350
352
|
}
|
|
351
353
|
|
|
352
354
|
/* Responsive design */
|
|
@@ -378,7 +380,7 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
378
380
|
flex: 1;
|
|
379
381
|
text-align: center;
|
|
380
382
|
}
|
|
381
|
-
}`,
|
|
383
|
+
}`, ae = () => ({
|
|
382
384
|
name: "code",
|
|
383
385
|
// Toolbar button configuration
|
|
384
386
|
toolbar: [
|
|
@@ -397,7 +399,7 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
397
399
|
* Opens a dialog to edit raw HTML
|
|
398
400
|
*/
|
|
399
401
|
toggleSourceView: () => {
|
|
400
|
-
const
|
|
402
|
+
const c = (() => {
|
|
401
403
|
const a = window.getSelection();
|
|
402
404
|
if (a && a.anchorNode) {
|
|
403
405
|
let e = a.anchorNode instanceof HTMLElement ? a.anchorNode : a.anchorNode.parentElement;
|
|
@@ -430,11 +432,11 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
430
432
|
}
|
|
431
433
|
return document.querySelector(".rte-content");
|
|
432
434
|
})();
|
|
433
|
-
if (!
|
|
434
|
-
return console.error("[CodePlugin] Editor content area not found"),
|
|
435
|
+
if (!c)
|
|
436
|
+
return console.error("[CodePlugin] Editor content area not found"), q(
|
|
435
437
|
"Editor content area not found. Please click inside the editor first."
|
|
436
438
|
), !1;
|
|
437
|
-
const
|
|
439
|
+
const N = c.innerHTML, D = (a) => {
|
|
438
440
|
let o = "", e = 0;
|
|
439
441
|
const n = 2, l = a.split(/(<\/?[a-zA-Z][^>]*>)/);
|
|
440
442
|
for (const r of l)
|
|
@@ -446,12 +448,12 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
446
448
|
};
|
|
447
449
|
return (() => {
|
|
448
450
|
document.querySelectorAll(".rte-source-editor-overlay").forEach((t) => t.remove());
|
|
449
|
-
const o = N
|
|
451
|
+
const o = D(N);
|
|
450
452
|
let e = null, n = "dark", l = !1, r = !1, p = !1, k = !1;
|
|
451
|
-
const
|
|
452
|
-
|
|
453
|
-
const
|
|
454
|
-
|
|
453
|
+
const O = !!c.closest(M) || document.body.matches(M) || document.documentElement.matches(M), i = document.createElement("div");
|
|
454
|
+
I(i), i.className = "rte-source-editor-overlay", O && i.classList.add("rte-theme-dark");
|
|
455
|
+
const d = document.createElement("div");
|
|
456
|
+
d.className = "rte-source-editor-modal", d.setAttribute("role", "dialog"), d.setAttribute("aria-modal", "true"), d.setAttribute("aria-labelledby", "source-editor-title");
|
|
455
457
|
const u = document.createElement("div");
|
|
456
458
|
u.className = "rte-source-editor-header", u.innerHTML = `
|
|
457
459
|
<h2 id="source-editor-title">Source Editor</h2>
|
|
@@ -492,12 +494,12 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
492
494
|
`;
|
|
493
495
|
const w = document.createElement("div");
|
|
494
496
|
w.className = "rte-source-editor-body";
|
|
495
|
-
const
|
|
496
|
-
|
|
497
|
+
const x = document.createElement("div");
|
|
498
|
+
x.className = "rte-source-editor-content";
|
|
497
499
|
const E = document.createElement("div");
|
|
498
500
|
E.className = "rte-source-editor-warning", E.textContent = "⚠️ Advanced users only. Invalid HTML may break the editor.";
|
|
499
501
|
const f = document.createElement("div");
|
|
500
|
-
f.className = "rte-source-editor-light-editor", f.style.height = "400px",
|
|
502
|
+
f.className = "rte-source-editor-light-editor", f.style.height = "400px", x.appendChild(E), x.appendChild(f), w.appendChild(x);
|
|
501
503
|
const h = document.createElement("div");
|
|
502
504
|
if (h.className = "rte-source-editor-footer", h.innerHTML = `
|
|
503
505
|
<div class="rte-source-editor-footer-info">
|
|
@@ -507,13 +509,13 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
507
509
|
<button class="rte-source-editor-btn rte-source-editor-btn-cancel">Cancel</button>
|
|
508
510
|
<button class="rte-source-editor-btn rte-source-editor-btn-save">Save</button>
|
|
509
511
|
</div>
|
|
510
|
-
`,
|
|
512
|
+
`, d.appendChild(u), d.appendChild(w), d.appendChild(h), i.appendChild(d), !document.getElementById("rte-source-editor-styles")) {
|
|
511
513
|
const t = document.createElement("style");
|
|
512
|
-
t.id = "rte-source-editor-styles", t.textContent =
|
|
514
|
+
t.id = "rte-source-editor-styles", t.textContent = X, document.head.appendChild(t);
|
|
513
515
|
}
|
|
514
|
-
const
|
|
516
|
+
const v = u.querySelector(
|
|
515
517
|
".theme-toggle-btn"
|
|
516
|
-
),
|
|
518
|
+
), m = u.querySelector(
|
|
517
519
|
".readonly-toggle-btn"
|
|
518
520
|
), y = u.querySelector(
|
|
519
521
|
".rte-source-editor-fullscreen-btn"
|
|
@@ -521,24 +523,24 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
521
523
|
".rte-source-editor-close-btn"
|
|
522
524
|
), L = h.querySelector(
|
|
523
525
|
".rte-source-editor-btn-cancel"
|
|
524
|
-
), H = h.querySelector(
|
|
525
|
-
".rte-source-editor-btn-save"
|
|
526
526
|
), T = h.querySelector(
|
|
527
|
+
".rte-source-editor-btn-save"
|
|
528
|
+
), H = h.querySelector(
|
|
527
529
|
".unsaved-changes"
|
|
528
|
-
), C = [],
|
|
529
|
-
t.addEventListener(
|
|
530
|
-
() => t.removeEventListener(
|
|
530
|
+
), C = [], s = (t, b, B, A) => {
|
|
531
|
+
t.addEventListener(b, B, A), C.push(
|
|
532
|
+
() => t.removeEventListener(b, B, A)
|
|
531
533
|
);
|
|
532
534
|
}, z = (t) => {
|
|
533
|
-
p !== t && (p = t,
|
|
535
|
+
p !== t && (p = t, H && (H.style.display = p ? "inline" : "none"));
|
|
534
536
|
}, g = () => {
|
|
535
537
|
if (!k) {
|
|
536
538
|
for (k = !0; C.length; )
|
|
537
539
|
C.pop()?.();
|
|
538
540
|
e && (e.destroy(), e = null), i.isConnected && i.remove();
|
|
539
541
|
}
|
|
540
|
-
},
|
|
541
|
-
n = n === "dark" ? "light" : "dark", e?.setTheme(n),
|
|
542
|
+
}, R = () => {
|
|
543
|
+
n = n === "dark" ? "light" : "dark", e?.setTheme(n), v && (v.innerHTML = n === "light" ? `
|
|
542
544
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
543
545
|
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>
|
|
544
546
|
</svg>
|
|
@@ -555,8 +557,8 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
555
557
|
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>
|
|
556
558
|
</svg>
|
|
557
559
|
`);
|
|
558
|
-
},
|
|
559
|
-
l = !l, e?.setReadOnly(l),
|
|
560
|
+
}, F = () => {
|
|
561
|
+
l = !l, e?.setReadOnly(l), m && (m.classList.toggle("active", l), m.innerHTML = l ? `
|
|
560
562
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
561
563
|
<rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
|
|
562
564
|
<circle cx="12" cy="16" r="1"/>
|
|
@@ -568,7 +570,7 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
568
570
|
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
|
|
569
571
|
</svg>
|
|
570
572
|
`);
|
|
571
|
-
},
|
|
573
|
+
}, V = () => {
|
|
572
574
|
r = !r, i.classList.toggle("fullscreen", r), f.style.height = r ? "calc(100vh - 200px)" : "400px", y && (y.innerHTML = r ? `
|
|
573
575
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
574
576
|
<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"/>
|
|
@@ -578,14 +580,20 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
578
580
|
<path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/>
|
|
579
581
|
</svg>
|
|
580
582
|
`);
|
|
581
|
-
},
|
|
582
|
-
p && !
|
|
583
|
-
|
|
583
|
+
}, Z = async () => {
|
|
584
|
+
p && !await U("You have unsaved changes. Are you sure you want to cancel?", {
|
|
585
|
+
title: "Discard changes?",
|
|
586
|
+
confirmText: "Discard changes",
|
|
587
|
+
cancelText: "Keep editing",
|
|
588
|
+
danger: !0,
|
|
589
|
+
context: c
|
|
590
|
+
}) || g();
|
|
591
|
+
}, j = () => {
|
|
584
592
|
try {
|
|
585
593
|
const t = e?.getValue() || "";
|
|
586
|
-
|
|
594
|
+
c.innerHTML = W(t);
|
|
587
595
|
try {
|
|
588
|
-
|
|
596
|
+
c.dispatchEvent(
|
|
589
597
|
new InputEvent("input", {
|
|
590
598
|
bubbles: !0,
|
|
591
599
|
cancelable: !1,
|
|
@@ -593,37 +601,37 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
593
601
|
})
|
|
594
602
|
);
|
|
595
603
|
} catch {
|
|
596
|
-
|
|
604
|
+
c.dispatchEvent(
|
|
597
605
|
new Event("input", { bubbles: !0 })
|
|
598
606
|
);
|
|
599
607
|
}
|
|
600
|
-
|
|
608
|
+
c.dispatchEvent(
|
|
601
609
|
new Event("change", { bubbles: !0 })
|
|
602
610
|
), z(!1), g();
|
|
603
611
|
} catch (t) {
|
|
604
|
-
|
|
612
|
+
q("Failed to update HTML. Please check your syntax.", "error"), console.error("HTML update error:", t);
|
|
605
613
|
}
|
|
606
614
|
};
|
|
607
|
-
|
|
615
|
+
v && s(v, "click", R), m && s(m, "click", F), y && s(y, "click", V), S && s(S, "click", g), L && s(L, "click", Z), T && s(T, "click", j), s(i, "click", (t) => {
|
|
608
616
|
t.target === i && g();
|
|
609
|
-
}),
|
|
610
|
-
const
|
|
611
|
-
|
|
617
|
+
}), s(document, "keydown", (t) => {
|
|
618
|
+
const b = t;
|
|
619
|
+
b.key === "Escape" && (b.preventDefault(), g());
|
|
612
620
|
}), document.body.appendChild(i), requestAnimationFrame(() => {
|
|
613
621
|
if (!(k || !i.isConnected))
|
|
614
622
|
try {
|
|
615
|
-
e =
|
|
623
|
+
e = P(f, {
|
|
616
624
|
value: o,
|
|
617
625
|
theme: "dark",
|
|
618
626
|
readOnly: !1,
|
|
619
627
|
extensions: [
|
|
620
|
-
new U(),
|
|
621
|
-
new P(),
|
|
622
628
|
new _(),
|
|
623
|
-
new $(),
|
|
624
629
|
new K(),
|
|
630
|
+
new $(),
|
|
625
631
|
new Y(),
|
|
626
|
-
new G()
|
|
632
|
+
new G(),
|
|
633
|
+
new J(),
|
|
634
|
+
new Q()
|
|
627
635
|
]
|
|
628
636
|
}), e.on("change", () => {
|
|
629
637
|
const t = e?.getValue() || "";
|
|
@@ -643,5 +651,5 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
643
651
|
}
|
|
644
652
|
});
|
|
645
653
|
export {
|
|
646
|
-
|
|
654
|
+
ae as C
|
|
647
655
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const P=require("./dialogHelpers-BxSQ7A6M.js"),D=require("./notify-BkbzMopb.js"),U=require("./confirmDialog-C4UWENes.js"),l=require("@editora/light-code-editor"),_=require("./sanitizeHtml-CDoBlNTk.js"),S='[data-theme="dark"], .dark, .editora-theme-dark',K=`/* Source Editor Dialog Styles */
|
|
2
2
|
.rte-source-editor-overlay {
|
|
3
3
|
position: fixed !important;
|
|
4
4
|
top: 0 !important;
|
|
@@ -297,7 +297,7 @@
|
|
|
297
297
|
}
|
|
298
298
|
|
|
299
299
|
.rte-source-editor-overlay.rte-theme-dark .rte-source-editor-toolbar-btn.active {
|
|
300
|
-
background: #
|
|
300
|
+
background: #2563eb;
|
|
301
301
|
color: #ffffff;
|
|
302
302
|
}
|
|
303
303
|
|
|
@@ -339,11 +339,11 @@
|
|
|
339
339
|
}
|
|
340
340
|
|
|
341
341
|
.rte-source-editor-overlay.rte-theme-dark .rte-source-editor-btn-save {
|
|
342
|
-
background: #
|
|
342
|
+
background: #2563eb;
|
|
343
343
|
}
|
|
344
344
|
|
|
345
345
|
.rte-source-editor-overlay.rte-theme-dark .rte-source-editor-btn-save:hover:not(:disabled) {
|
|
346
|
-
background: #
|
|
346
|
+
background: #1d4ed8;
|
|
347
347
|
}
|
|
348
348
|
|
|
349
349
|
/* Responsive design */
|
|
@@ -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 c=(()=>{const a=window.getSelection();if(a&&a.anchorNode){let e=a.anchorNode instanceof HTMLElement?a.anchorNode:a.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(!c)return console.error("[CodePlugin] Editor content area not found"),D.notify("Editor content area not found. Please click inside the editor first."),!1;const N=c.innerHTML,O=a=>{let o="",e=0;const n=2,u=a.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=
|
|
381
|
+
`+" ".repeat(e*n)+r:o+=r.trim());return o.trim()};return(()=>{document.querySelectorAll(".rte-source-editor-overlay").forEach(t=>t.remove());const o=O(N);let e=null,n="dark",u=!1,r=!1,x=!1,w=!1;const R=!!c.closest(S)||document.body.matches(S)||document.documentElement.matches(S),i=document.createElement("div");P.initDialogOverlay(i),i.className="rte-source-editor-overlay",R&&i.classList.add("rte-theme-dark");const d=document.createElement("div");d.className="rte-source-editor-modal",d.setAttribute("role","dialog"),d.setAttribute("aria-modal","true"),d.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 E=document.createElement("div");E.className="rte-source-editor-body";const
|
|
417
|
+
`;const E=document.createElement("div");E.className="rte-source-editor-body";const v=document.createElement("div");v.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 g=document.createElement("div");g.className="rte-source-editor-light-editor",g.style.height="400px",v.appendChild(C),v.appendChild(g),E.appendChild(v);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
|
+
`,d.appendChild(h),d.appendChild(E),d.appendChild(f),i.appendChild(d),!document.getElementById("rte-source-editor-styles")){const t=document.createElement("style");t.id="rte-source-editor-styles",t.textContent=K,document.head.appendChild(t)}const y=h.querySelector(".theme-toggle-btn"),b=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=[],s=(t,p,B,A)=>{t.addEventListener(p,B,A),M.push(()=>t.removeEventListener(p,B,A))},q=t=>{x!==t&&(x=t,z&&(z.style.display=x?"inline":"none"))},m=()=>{if(!w){for(w=!0;M.length;)M.pop()?.();e&&(e.destroy(),e=null),i.isConnected&&i.remove()}},F=()=>{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
|
+
`)},V=()=>{u=!u,e?.setReadOnly(u),b&&(b.classList.toggle("active",u),b.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
|
+
`)},Z=()=>{r=!r,i.classList.toggle("fullscreen",r),g.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
|
+
`)},j=async()=>{x&&!await U.confirmAction("You have unsaved changes. Are you sure you want to cancel?",{title:"Discard changes?",confirmText:"Discard changes",cancelText:"Keep editing",danger:!0,context:c})||m()},I=()=>{try{const t=e?.getValue()||"";c.innerHTML=_.sanitizeHtml(t);try{c.dispatchEvent(new InputEvent("input",{bubbles:!0,cancelable:!1,inputType:"insertReplacementText"}))}catch{c.dispatchEvent(new Event("input",{bubbles:!0}))}c.dispatchEvent(new Event("change",{bubbles:!0})),q(!1),m()}catch(t){D.notify("Failed to update HTML. Please check your syntax.","error"),console.error("HTML update error:",t)}};y&&s(y,"click",F),b&&s(b,"click",V),k&&s(k,"click",Z),L&&s(L,"click",m),H&&s(H,"click",j),T&&s(T,"click",I),s(i,"click",t=>{t.target===i&&m()}),s(document,"keydown",t=>{const p=t;p.key==="Escape"&&(p.preventDefault(),m())}),document.body.appendChild(i),requestAnimationFrame(()=>{if(!(w||!i.isConnected))try{e=l.createEditor(g,{value:o,theme:"dark",readOnly:!1,extensions:[new l.LineNumbersExtension,new l.ThemeExtension,new l.ReadOnlyExtension,new l.BracketMatchingExtension,new l.SearchExtension,new l.CodeFoldingExtension,new l.SyntaxHighlightingExtension]}),e.on("change",()=>{const t=e?.getValue()||"";q(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=$;
|
package/dist/a11y-checker.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=require("./escapeHtml-D2Zh82pD.js"),H=require("./dialogHelpers-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=require("./escapeHtml-D2Zh82pD.js"),H=require("./dialogHelpers-BxSQ7A6M.js"),T=new Set,C=[],f=t=>{C.push(t)},x='[data-theme="dark"], .dark, .editora-theme-dark';f({id:"image-alt-text",wcag:"1.1.1",description:"Images must have alt text",severity:"error",selector:"img",evaluate(t,n){const e=t;return e.hasAttribute("role")&&e.getAttribute("role")==="presentation"||e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="image-alt-text"||e.hasAttribute("alt")?null:{id:`img-alt-${n.cache.get("imgIdx")}`,rule:"image-alt-text",wcag:"1.1.1",severity:"error",message:"Image missing alt text",nodePath:n.cache.get("imgPath"),element:e,suggestion:"Add descriptive alt text to all images",fixable:!0,fixLabel:"Add empty alt"}},fix(t){t.element&&t.element.setAttribute("alt","")}});f({id:"empty-interactive",wcag:"4.1.2",description:"Interactive elements must have accessible names",severity:"error",selector:'button, a, [role="button"]',evaluate(t,n){const e=t;if(e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="empty-interactive")return null;const r=e.textContent?.trim(),a=e.hasAttribute("aria-label"),i=e.hasAttribute("aria-labelledby"),s=e.hasAttribute("title");return!r&&!a&&!i&&!s?{id:`interactive-empty-${n.cache.get("buttonIdx")}`,rule:"empty-interactive",wcag:"4.1.2",severity:"error",message:"Interactive element has no accessible name",nodePath:n.cache.get("buttonPath"),element:e,suggestion:"Add text, aria-label, aria-labelledby, or title",fixable:!0,fixLabel:"Add aria-label"}:null},fix(t){t.element&&t.element.setAttribute("aria-label","Button")}});f({id:"form-label",wcag:"1.3.1",description:"Form controls must have labels",severity:"error",selector:"input, textarea, select",evaluate(t,n){const e=t;if(e.hasAttribute("type")&&e.getAttribute("type")==="hidden"||e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="form-label")return null;const r=n.doc.querySelector(`label[for="${e.getAttribute("id")}"]`),a=e.hasAttribute("aria-label"),i=e.hasAttribute("aria-labelledby");return!r&&!a&&!i?{id:`form-label-${n.cache.get("inputIdx")}`,rule:"form-label",wcag:"1.3.1",severity:"error",message:"Form control missing label",nodePath:n.cache.get("inputPath"),element:e,suggestion:"Add <label>, aria-label, or aria-labelledby",fixable:!0,fixLabel:"Add aria-label"}:null},fix(t){t.element&&t.element.setAttribute("aria-label","Input")}});f({id:"table-headers",wcag:"1.3.1",description:"Tables must have header rows",severity:"error",selector:"table",evaluate(t,n){const e=t;if(e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="table-headers")return null;const r=e.querySelectorAll("th"),a=e.querySelectorAll("tr");return r.length===0&&a.length>0?{id:`table-no-headers-${n.cache.get("tableIdx")}`,rule:"table-headers",wcag:"1.3.1",severity:"error",message:"Table missing header row (<th> elements)",nodePath:n.cache.get("tablePath"),element:e,suggestion:"Add <th> elements to first row",fixable:!0,fixLabel:"Convert first row to headers"}:null},fix(t){if(t.element){const e=t.element.querySelector("tr");e&&Array.from(e.children).forEach(r=>{if(r.tagName==="TD"){const a=document.createElement("th");a.innerHTML=r.innerHTML,e.replaceChild(a,r)}})}}});f({id:"heading-empty",wcag:"1.3.1",description:"Headings must not be empty",severity:"error",selector:"h1, h2, h3, h4, h5, h6",evaluate(t,n){const e=t;if(e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="heading-empty")return null;const r=e.textContent?.replace(/\s+/g,"")||"",a=e.childNodes.length===1&&e.childNodes[0].nodeName==="BR";return!r&&!a?{id:`heading-empty-${n.cache.get("headingIdx")}`,rule:"heading-empty",wcag:"1.3.1",severity:"error",message:`Empty ${e.tagName.toLowerCase()} heading`,nodePath:n.cache.get("headingPath"),element:e,suggestion:"All headings must contain text",fixable:!1}:null}});f({id:"heading-order",wcag:"1.3.1",description:"Headings should not skip levels",severity:"warning",selector:"h1, h2, h3, h4, h5, h6",evaluate(t,n){const e=t,r=parseInt(e.tagName[1]),a=n.cache.get("previousHeadingLevel")||r;return n.cache.set("previousHeadingLevel",r),r-a>1?{id:`heading-order-${n.cache.get("headingIdx")}`,rule:"heading-order",wcag:"1.3.1",severity:"warning",message:`Heading skips level (${a} → ${r})`,nodePath:n.cache.get("headingPath"),element:e,suggestion:`Use heading level ${a+1} instead`,fixable:!1}:null}});f({id:"link-text",wcag:"2.4.4",description:"Links must have descriptive text",severity:"error",selector:"a",evaluate(t,n){const e=t;if(e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="link-text")return null;const r=e.textContent?.replace(/\s+/g,"").toLowerCase()||"",a=e.childNodes.length===1&&e.childNodes[0].nodeName==="BR",i=["clickhere","readmore","link","here","this","page"];return!r&&!a?{id:`link-empty-${n.cache.get("aIdx")}`,rule:"link-text",wcag:"2.4.4",severity:"error",message:"Link has no text content",nodePath:n.cache.get("aPath"),element:e,suggestion:"All links must have descriptive text",fixable:!0,fixLabel:"Insert placeholder"}:i.some(s=>r.includes(s))?{id:`link-vague-${n.cache.get("aIdx")}`,rule:"link-text",wcag:"2.4.4",severity:"warning",message:`Vague link text: "${e.textContent?.trim()}"`,nodePath:n.cache.get("aPath"),element:e,suggestion:"Use descriptive link text",fixable:!1}:null},fix(t){t.element&&(t.element.textContent="Link")}});f({id:"list-structure",wcag:"1.3.1",description:"Lists must only contain <li> children",severity:"error",selector:"ul, ol",evaluate(t,n){const e=t;if(e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="list-structure")return null;const r=e.querySelectorAll(":scope > li");return Array.from(e.children).filter(i=>i.tagName!=="LI").length>0?{id:`list-structure-${n.cache.get("ulIdx")}`,rule:"list-structure",wcag:"1.3.1",severity:"error",message:"List contains non-li elements",nodePath:n.cache.get("ulPath"),element:e,suggestion:"All direct children of ul/ol must be li elements",fixable:!1}:r.length===0?{id:`list-empty-${n.cache.get("ulIdx")}`,rule:"list-structure",wcag:"1.3.1",severity:"warning",message:"Empty list element",nodePath:n.cache.get("ulPath"),element:e,suggestion:"Remove empty lists or add list items",fixable:!1}:null}});const w=()=>{const t=window.getSelection();if(t&&t.rangeCount>0){let e=t.getRangeAt(0).startContainer;for(;e&&e!==document.body;){if(e.nodeType===Node.ELEMENT_NODE){const r=e;if(r.getAttribute("contenteditable")==="true")return r}e=e.parentNode}}const n=document.activeElement;if(n){if(n.getAttribute("contenteditable")==="true")return n;const e=n.closest('[contenteditable="true"]');if(e)return e}return document.querySelector('[contenteditable="true"]')},I=()=>{if(w()?.closest(x))return!0;const n=window.getSelection();if(n&&n.rangeCount>0){const r=n.getRangeAt(0).startContainer;if((r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.closest(x))return!0}return document.activeElement?.closest(x)?!0:document.body.matches(x)||document.documentElement.matches(x)},k=()=>{const t=w();if(!t)return[];const n=[],e={doc:t.ownerDocument||document,cache:new Map},r=e.doc.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null);let a=r.currentNode;const i={},s={};let p=0;for(;a&&p<5e3;){const h=a,o=h.tagName?.toLowerCase?.()||"";if(h.hidden||h.style.display==="none"||h.style.visibility==="hidden"){a=r.nextNode(),p++;continue}i[o]=(i[o]||0)+1,s[o]=`${o}[${i[o]-1}]`;for(const g of C){if(T.has(g.id)||g.selector&&!a.matches?.(g.selector))continue;e.cache.set(`${o}Idx`,i[o]-1),e.cache.set(`${o}Path`,s[o]),/^h[1-6]$/.test(o)&&(e.cache.set("headingIdx",i[o]-1),e.cache.set("headingPath",s[o])),o==="a"&&(e.cache.set("aIdx",i[o]-1),e.cache.set("aPath",s[o])),o==="table"&&(e.cache.set("tableIdx",i[o]-1),e.cache.set("tablePath",s[o])),o==="button"&&(e.cache.set("buttonIdx",i[o]-1),e.cache.set("buttonPath",s[o])),o==="input"&&(e.cache.set("inputIdx",i[o]-1),e.cache.set("inputPath",s[o])),(o==="ul"||o==="ol")&&(e.cache.set("ulIdx",i[o]-1),e.cache.set("ulPath",s[o]));const m=g.evaluate(a,e);m&&n.push(m)}a=r.nextNode(),p++}return n},b=(t,n=!0)=>{t.element&&(n?(t.element.classList.add("a11y-highlighted"),t.element.style.outline="2px solid #ff9800",t.element.style.backgroundColor="#fff3cd"):(t.element.classList.remove("a11y-highlighted"),t.element.style.outline="",t.element.style.backgroundColor=""))},P=t=>{t||(t=k());const n=t.filter(a=>a.severity==="error").length,e=t.filter(a=>a.severity==="warning").length,r=100-n*20-e*5;return Math.max(0,r)},N=t=>{const n=C.find(e=>e.id===t.rule);n&&n.fix&&n.fix(t)},$=()=>{document.querySelectorAll(".a11y-dialog-overlay").forEach(d=>d.remove());const t=k(),n=P(t),r=I()?{overlay:"rgba(0, 0, 0, 0.62)",dialogBg:"#1f2937",panelBg:"#222d3a",border:"#3b4657",text:"#e2e8f0",muted:"#9fb0c6",success:"#4ade80",closeHover:"#334155",summaryBg:"#111827",issueBg:"#1f2937",issueHoverBg:"#273244",issueBorder:"#4b5563",issueHoverBorder:"#58a6ff",fixBtn:"#2563eb",fixBtnHover:"#2563eb"}:{overlay:"rgba(0, 0, 0, 0.5)",dialogBg:"#ffffff",panelBg:"#ffffff",border:"#e0e0e0",text:"#1f2937",muted:"#666666",success:"#2e7d32",closeHover:"#f0f0f0",summaryBg:"#f5f5f5",issueBg:"#ffffff",issueHoverBg:"#f5f9ff",issueBorder:"#e0e0e0",issueHoverBorder:"#2196f3",fixBtn:"#2196f3",fixBtnHover:"#1976d2"},a=document.createElement("div");H.initDialogOverlay(a),a.className="a11y-dialog-overlay",a.style.cssText=`
|
|
2
2
|
position: fixed;
|
|
3
3
|
top: 0;
|
|
4
4
|
left: 0;
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
font-weight: bold;
|
|
33
33
|
padding: 8px 16px;
|
|
34
34
|
border-radius: 4px;
|
|
35
|
-
background: ${n>=80?"#
|
|
35
|
+
background: ${n>=80?"#2e7d32":n>=60?"#b45309":"#c62828"};
|
|
36
36
|
color: white;
|
|
37
37
|
`,h.textContent=`${n}/100`;const o=document.createElement("button");o.textContent="✕",o.style.cssText=`
|
|
38
38
|
background: none;
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
`,t.length===0)m.innerHTML=`
|
|
56
56
|
<div style="text-align: center; padding: 40px 20px;">
|
|
57
57
|
<div style="font-size: 48px; margin-bottom: 16px;">✅</div>
|
|
58
|
-
<h3 style="margin: 0 0 8px 0; color:
|
|
58
|
+
<h3 style="margin: 0 0 8px 0; color: ${r.success};">No issues found!</h3>
|
|
59
59
|
<p style="margin: 0; color: ${r.muted};">Your content meets WCAG 2.1 AA standards.</p>
|
|
60
60
|
</div>
|
|
61
61
|
`;else{const d=document.createElement("div");d.style.cssText=`
|
package/dist/a11y-checker.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { e as v } from "./escapeHtml-DyksyvcZ.mjs";
|
|
2
|
-
import { i as T } from "./dialogHelpers-
|
|
2
|
+
import { i as T } from "./dialogHelpers-BbwpIXD9.mjs";
|
|
3
3
|
const H = /* @__PURE__ */ new Set(), C = [], f = (t) => {
|
|
4
4
|
C.push(t);
|
|
5
5
|
}, x = '[data-theme="dark"], .dark, .editora-theme-dark';
|
|
@@ -301,13 +301,14 @@ const w = () => {
|
|
|
301
301
|
border: "#3b4657",
|
|
302
302
|
text: "#e2e8f0",
|
|
303
303
|
muted: "#9fb0c6",
|
|
304
|
+
success: "#4ade80",
|
|
304
305
|
closeHover: "#334155",
|
|
305
306
|
summaryBg: "#111827",
|
|
306
307
|
issueBg: "#1f2937",
|
|
307
308
|
issueHoverBg: "#273244",
|
|
308
309
|
issueBorder: "#4b5563",
|
|
309
310
|
issueHoverBorder: "#58a6ff",
|
|
310
|
-
fixBtn: "#
|
|
311
|
+
fixBtn: "#2563eb",
|
|
311
312
|
fixBtnHover: "#2563eb"
|
|
312
313
|
} : {
|
|
313
314
|
overlay: "rgba(0, 0, 0, 0.5)",
|
|
@@ -316,6 +317,7 @@ const w = () => {
|
|
|
316
317
|
border: "#e0e0e0",
|
|
317
318
|
text: "#1f2937",
|
|
318
319
|
muted: "#666666",
|
|
320
|
+
success: "#2e7d32",
|
|
319
321
|
closeHover: "#f0f0f0",
|
|
320
322
|
summaryBg: "#f5f5f5",
|
|
321
323
|
issueBg: "#ffffff",
|
|
@@ -367,7 +369,7 @@ const w = () => {
|
|
|
367
369
|
font-weight: bold;
|
|
368
370
|
padding: 8px 16px;
|
|
369
371
|
border-radius: 4px;
|
|
370
|
-
background: ${n >= 80 ? "#
|
|
372
|
+
background: ${n >= 80 ? "#2e7d32" : n >= 60 ? "#b45309" : "#c62828"};
|
|
371
373
|
color: white;
|
|
372
374
|
`, h.textContent = `${n}/100`;
|
|
373
375
|
const o = document.createElement("button");
|
|
@@ -403,7 +405,7 @@ const w = () => {
|
|
|
403
405
|
m.innerHTML = `
|
|
404
406
|
<div style="text-align: center; padding: 40px 20px;">
|
|
405
407
|
<div style="font-size: 48px; margin-bottom: 16px;">✅</div>
|
|
406
|
-
<h3 style="margin: 0 0 8px 0; color:
|
|
408
|
+
<h3 style="margin: 0 0 8px 0; color: ${r.success};">No issues found!</h3>
|
|
407
409
|
<p style="margin: 0; color: ${r.muted};">Your content meets WCAG 2.1 AA standards.</p>
|
|
408
410
|
</div>
|
|
409
411
|
`;
|
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-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const $=require("./dialogHelpers-BxSQ7A6M.js"),z=require("./notify-BkbzMopb.js"),w=require("./editorContainerHelpers-CFbfiOJI.js"),b=new Set,y='[data-theme="dark"], .dark, .editora-theme-dark';function M(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 H(){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 R(){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 _(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 I(t,c,s,a){document.querySelectorAll(".rte-anchor-dialog-overlay").forEach(r=>r.remove()),R();const l=_(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:"#2563eb",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:"#6b6b6b",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:"#6b6b6b",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;
|
|
@@ -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 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
|
|
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 O(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(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)
|
|
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)M(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
|
|
176
|
+
`,document.head.appendChild(t)}const L=()=>(typeof window<"u"&&(H(),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 z.notify("Please place your cursor where you want to insert the anchor."),!1;const c=t.getRangeAt(0).cloneRange();return I("add","",s=>{O(s,c)},c),!0}catch(t){return console.error("Failed to insert anchor:",t),!1}}},keymap:{"Mod-Shift-k":"insertAnchor"}});exports.AnchorPlugin=L;
|