@editora/plugins 1.0.22 → 1.1.0
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 +1 -1
- package/dist/{CodePlugin.native-CKJo7IFG.js → CodePlugin.native-BwhZsI5v.js} +11 -11
- package/dist/{CodePlugin.native-D8gGxB8i.mjs → CodePlugin.native-CojLCp6C.mjs} +61 -53
- package/dist/MediaManagerPlugin.native-CycfjOi4.js +1841 -0
- package/dist/MediaManagerPlugin.native-DZrmcmnm.mjs +4688 -0
- 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-D3S8BhIM.js +42 -0
- package/dist/confirmDialog-DR4c8j6S.mjs +87 -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 +12 -12
- 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 +90 -83
- 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 +1 -619
- package/dist/media-manager.esm.js +30 -1017
- 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/index.d.ts +183 -2
- 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
package/dist/spell-check.esm.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { f as D, k as Q, p as ee } from "./dialogHelpers-BbwpIXD9.mjs";
|
|
2
|
+
const te = [
|
|
2
3
|
"a",
|
|
3
4
|
"aa",
|
|
4
5
|
"aaa",
|
|
@@ -9999,49 +10000,89 @@ const K = [
|
|
|
9999
10000
|
"zu",
|
|
10000
10001
|
"zum",
|
|
10001
10002
|
"zus"
|
|
10002
|
-
]
|
|
10003
|
-
|
|
10003
|
+
];
|
|
10004
|
+
function ie(e, t, a = 1 / 0) {
|
|
10005
|
+
if (e === t) return 0;
|
|
10006
|
+
if (Math.abs(e.length - t.length) > a) return a + 1;
|
|
10007
|
+
const s = [];
|
|
10008
|
+
for (let i = 0; i <= e.length; i++)
|
|
10009
|
+
s[i] = [i];
|
|
10010
|
+
for (let i = 1; i <= t.length; i++) s[0][i] = i;
|
|
10011
|
+
for (let i = 1; i <= e.length; i++) {
|
|
10012
|
+
let n = 1 / 0;
|
|
10013
|
+
for (let o = 1; o <= t.length; o++) {
|
|
10014
|
+
const l = e.charCodeAt(i - 1) === t.charCodeAt(o - 1) ? 0 : 1;
|
|
10015
|
+
let p = Math.min(s[i - 1][o] + 1, s[i][o - 1] + 1, s[i - 1][o - 1] + l);
|
|
10016
|
+
i > 1 && o > 1 && e.charCodeAt(i - 1) === t.charCodeAt(o - 2) && e.charCodeAt(i - 2) === t.charCodeAt(o - 1) && (p = Math.min(p, s[i - 2][o - 2] + 1)), s[i][o] = p, p < n && (n = p);
|
|
10017
|
+
}
|
|
10018
|
+
if (n > a) return a + 1;
|
|
10019
|
+
}
|
|
10020
|
+
return s[e.length][t.length];
|
|
10021
|
+
}
|
|
10022
|
+
function ae(e) {
|
|
10023
|
+
return e <= 4 ? 1 : e <= 7 ? 2 : 3;
|
|
10024
|
+
}
|
|
10025
|
+
function re(e, t, a = 5) {
|
|
10026
|
+
const r = e.toLowerCase(), s = ae(r.length), i = [], n = [...r].sort().join("");
|
|
10027
|
+
let o = 0;
|
|
10028
|
+
for (const l of t) {
|
|
10029
|
+
if (o += 1, Math.abs(l.length - r.length) > s) continue;
|
|
10030
|
+
const p = ie(r, l, s);
|
|
10031
|
+
p > s || i.push({
|
|
10032
|
+
word: l,
|
|
10033
|
+
distance: p,
|
|
10034
|
+
notAnagram: [...l].sort().join("") === n ? 0 : 1,
|
|
10035
|
+
sameInitial: l[0] === r[0] ? 0 : 1,
|
|
10036
|
+
rank: o
|
|
10037
|
+
});
|
|
10038
|
+
}
|
|
10039
|
+
return i.sort(
|
|
10040
|
+
(l, p) => l.distance - p.distance || l.notAnagram - p.notAnagram || l.sameInitial - p.sameInitial || l.rank - p.rank
|
|
10041
|
+
), i.slice(0, a).map((l) => l.word);
|
|
10042
|
+
}
|
|
10043
|
+
const P = /* @__PURE__ */ new Set([
|
|
10044
|
+
...te,
|
|
10004
10045
|
"hers",
|
|
10005
10046
|
"theirs",
|
|
10006
10047
|
"lorem",
|
|
10007
10048
|
"ipsum"
|
|
10008
|
-
]),
|
|
10009
|
-
let
|
|
10010
|
-
const
|
|
10049
|
+
]), q = /* @__PURE__ */ new Set(), E = /* @__PURE__ */ new Set();
|
|
10050
|
+
let h = !1, u = null, y = null, c = null, d = null, w = null, j = !1, g = null, F = !1, v = 0, k = null;
|
|
10051
|
+
const W = {
|
|
10011
10052
|
characterData: !0,
|
|
10012
10053
|
childList: !0,
|
|
10013
10054
|
subtree: !0
|
|
10014
|
-
},
|
|
10015
|
-
function
|
|
10055
|
+
}, I = "rte-spellcheck-styles", H = "__editoraCommandEditorRoot";
|
|
10056
|
+
function se(e) {
|
|
10016
10057
|
const t = e?.contentElement || e?.editorElement || null;
|
|
10017
10058
|
if (!(t instanceof HTMLElement)) return;
|
|
10018
|
-
const
|
|
10019
|
-
if (
|
|
10020
|
-
|
|
10059
|
+
const a = t.getAttribute("contenteditable") === "true" ? t : t.querySelector?.('[contenteditable="true"]');
|
|
10060
|
+
if (a instanceof HTMLElement) {
|
|
10061
|
+
d = a, g = a;
|
|
10021
10062
|
return;
|
|
10022
10063
|
}
|
|
10023
|
-
const
|
|
10024
|
-
|
|
10064
|
+
const r = t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || (t.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") ? t : null), s = A(r);
|
|
10065
|
+
s && (d = s, g = s);
|
|
10025
10066
|
}
|
|
10026
|
-
function
|
|
10067
|
+
function G() {
|
|
10027
10068
|
if (typeof window > "u") return null;
|
|
10028
|
-
const e = window[
|
|
10069
|
+
const e = window[H];
|
|
10029
10070
|
if (!(e instanceof HTMLElement)) return null;
|
|
10030
|
-
window[
|
|
10071
|
+
window[H] = null;
|
|
10031
10072
|
const t = e.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || (e.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") ? e : null);
|
|
10032
10073
|
if (t) {
|
|
10033
|
-
const
|
|
10034
|
-
if (
|
|
10074
|
+
const r = A(t);
|
|
10075
|
+
if (r) return r;
|
|
10035
10076
|
if (t.getAttribute("contenteditable") === "true") return t;
|
|
10036
10077
|
}
|
|
10037
10078
|
if (e.getAttribute("contenteditable") === "true")
|
|
10038
10079
|
return e;
|
|
10039
|
-
const
|
|
10040
|
-
return
|
|
10080
|
+
const a = e.closest('[contenteditable="true"]');
|
|
10081
|
+
return a instanceof HTMLElement ? a : null;
|
|
10041
10082
|
}
|
|
10042
|
-
function
|
|
10043
|
-
let e = document.getElementById(
|
|
10044
|
-
e || (e = document.createElement("style"), e.id =
|
|
10083
|
+
function S() {
|
|
10084
|
+
let e = document.getElementById(I);
|
|
10085
|
+
e || (e = document.createElement("style"), e.id = I, document.head.appendChild(e)), e.textContent = `
|
|
10045
10086
|
.rte-spell-check-panel {
|
|
10046
10087
|
position: absolute;
|
|
10047
10088
|
top: 12px;
|
|
@@ -10511,299 +10552,283 @@ function C() {
|
|
|
10511
10552
|
}
|
|
10512
10553
|
`;
|
|
10513
10554
|
}
|
|
10514
|
-
function
|
|
10515
|
-
if (
|
|
10516
|
-
return
|
|
10517
|
-
const e =
|
|
10518
|
-
return e && (
|
|
10555
|
+
function f() {
|
|
10556
|
+
if (d && document.contains(d))
|
|
10557
|
+
return d;
|
|
10558
|
+
const e = U();
|
|
10559
|
+
return e && (d = e), e;
|
|
10519
10560
|
}
|
|
10520
|
-
function
|
|
10561
|
+
function J(e) {
|
|
10521
10562
|
if (!e) return;
|
|
10522
|
-
const
|
|
10523
|
-
|
|
10563
|
+
const a = (e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement)?.closest('[contenteditable="true"]');
|
|
10564
|
+
a && (d = a);
|
|
10524
10565
|
}
|
|
10525
|
-
function
|
|
10566
|
+
function A(e) {
|
|
10526
10567
|
if (!e) return null;
|
|
10527
10568
|
const t = e.querySelector('[contenteditable="true"]');
|
|
10528
10569
|
return t instanceof HTMLElement ? t : null;
|
|
10529
10570
|
}
|
|
10530
|
-
function
|
|
10531
|
-
if (
|
|
10571
|
+
function ne() {
|
|
10572
|
+
if (F) return;
|
|
10532
10573
|
const e = (t) => {
|
|
10533
|
-
const
|
|
10534
|
-
if (!
|
|
10535
|
-
const
|
|
10574
|
+
const a = t.target;
|
|
10575
|
+
if (!a) return;
|
|
10576
|
+
const r = a.closest(
|
|
10536
10577
|
'.editora-toolbar-button[data-command="toggleSpellCheck"], .rte-toolbar-button[data-command="toggleSpellCheck"]'
|
|
10537
10578
|
);
|
|
10538
|
-
if (!
|
|
10539
|
-
const
|
|
10540
|
-
|
|
10579
|
+
if (!r) return;
|
|
10580
|
+
const s = r.closest("[data-editora-editor]"), i = A(s);
|
|
10581
|
+
i && (g = i, d = i);
|
|
10541
10582
|
};
|
|
10542
|
-
document.addEventListener("pointerdown", e, !0),
|
|
10583
|
+
document.addEventListener("pointerdown", e, !0), F = !0;
|
|
10543
10584
|
}
|
|
10544
|
-
function
|
|
10545
|
-
const e =
|
|
10585
|
+
function oe() {
|
|
10586
|
+
const e = G();
|
|
10546
10587
|
if (e && document.contains(e))
|
|
10547
|
-
return
|
|
10548
|
-
if (
|
|
10549
|
-
const t =
|
|
10550
|
-
return
|
|
10588
|
+
return d = e, g = null, e;
|
|
10589
|
+
if (g && document.contains(g)) {
|
|
10590
|
+
const t = g;
|
|
10591
|
+
return g = null, d = t, t;
|
|
10551
10592
|
}
|
|
10552
|
-
return
|
|
10593
|
+
return U();
|
|
10553
10594
|
}
|
|
10554
|
-
function
|
|
10555
|
-
|
|
10595
|
+
function le() {
|
|
10596
|
+
v += 1, v === 1 && u && u.disconnect();
|
|
10556
10597
|
}
|
|
10557
|
-
function
|
|
10558
|
-
if (
|
|
10559
|
-
const e =
|
|
10560
|
-
e &&
|
|
10598
|
+
function ce() {
|
|
10599
|
+
if (v === 0 || (v -= 1, v > 0) || !u) return;
|
|
10600
|
+
const e = f();
|
|
10601
|
+
e && u.observe(e, W);
|
|
10561
10602
|
}
|
|
10562
10603
|
function L(e) {
|
|
10563
|
-
|
|
10604
|
+
le();
|
|
10564
10605
|
try {
|
|
10565
10606
|
return e();
|
|
10566
10607
|
} finally {
|
|
10567
|
-
|
|
10608
|
+
ce();
|
|
10568
10609
|
}
|
|
10569
10610
|
}
|
|
10570
|
-
const
|
|
10611
|
+
const de = () => {
|
|
10571
10612
|
try {
|
|
10572
10613
|
const e = localStorage.getItem("rte-custom-dictionary");
|
|
10573
|
-
e && JSON.parse(e).forEach((
|
|
10614
|
+
e && JSON.parse(e).forEach((a) => q.add(a.toLowerCase()));
|
|
10574
10615
|
} catch (e) {
|
|
10575
10616
|
console.warn("Failed to load custom dictionary:", e);
|
|
10576
10617
|
}
|
|
10577
|
-
},
|
|
10618
|
+
}, pe = () => {
|
|
10578
10619
|
try {
|
|
10579
|
-
const e = Array.from(
|
|
10620
|
+
const e = Array.from(q);
|
|
10580
10621
|
localStorage.setItem("rte-custom-dictionary", JSON.stringify(e));
|
|
10581
10622
|
} catch (e) {
|
|
10582
10623
|
console.warn("Failed to save custom dictionary:", e);
|
|
10583
10624
|
}
|
|
10584
10625
|
};
|
|
10585
|
-
function
|
|
10586
|
-
const r = [];
|
|
10587
|
-
for (let a = 0; a <= t.length; a++) r[a] = [a];
|
|
10588
|
-
for (let a = 0; a <= e.length; a++) r[0][a] = a;
|
|
10589
|
-
for (let a = 1; a <= t.length; a++)
|
|
10590
|
-
for (let i = 1; i <= e.length; i++)
|
|
10591
|
-
t.charAt(a - 1) === e.charAt(i - 1) ? r[a][i] = r[a - 1][i - 1] : r[a][i] = Math.min(
|
|
10592
|
-
r[a - 1][i - 1] + 1,
|
|
10593
|
-
// substitution
|
|
10594
|
-
r[a][i - 1] + 1,
|
|
10595
|
-
// insertion
|
|
10596
|
-
r[a - 1][i] + 1
|
|
10597
|
-
// deletion
|
|
10598
|
-
);
|
|
10599
|
-
return r[t.length][e.length];
|
|
10600
|
-
}
|
|
10601
|
-
function oe(e) {
|
|
10626
|
+
function ue(e) {
|
|
10602
10627
|
const t = e.toLowerCase();
|
|
10603
|
-
return
|
|
10628
|
+
return P.has(t) || q.has(t) || E.has(t);
|
|
10604
10629
|
}
|
|
10605
|
-
function
|
|
10606
|
-
|
|
10607
|
-
return i.sort((s, n) => s.distance - n.distance), i.filter((s) => s.distance <= 3).slice(0, t).map((s) => s.word);
|
|
10630
|
+
function me(e, t = 5) {
|
|
10631
|
+
return re(e, P, t);
|
|
10608
10632
|
}
|
|
10609
|
-
function
|
|
10633
|
+
function ge(e) {
|
|
10610
10634
|
if (e.nodeType !== Node.ELEMENT_NODE) return !1;
|
|
10611
10635
|
const t = e;
|
|
10612
10636
|
return !!(t.closest('code, pre, [contenteditable="false"], .rte-widget, .rte-template, .rte-comment, .rte-merge-tag') || t.hasAttribute("data-comment-id") || t.hasAttribute("data-template") || t.hasAttribute("data-merge-tag"));
|
|
10613
10637
|
}
|
|
10614
|
-
function
|
|
10615
|
-
const t = [],
|
|
10616
|
-
let
|
|
10617
|
-
for (; (
|
|
10618
|
-
const
|
|
10619
|
-
/https?:\/\//.test(
|
|
10620
|
-
id: `${
|
|
10638
|
+
function he(e) {
|
|
10639
|
+
const t = [], a = /([\p{L}\p{M}\p{N}\p{Emoji_Presentation}\u200d'-]+|[\uD800-\uDBFF][\uDC00-\uDFFF])/gu;
|
|
10640
|
+
let r;
|
|
10641
|
+
for (; (r = a.exec(e.data)) !== null; ) {
|
|
10642
|
+
const s = r[0], i = r.index, n = i + s.length;
|
|
10643
|
+
/https?:\/\//.test(s) || /@/.test(s) || /\{\{.*\}\}/.test(s) || /^\d+$/.test(s) || ue(s) || /[a-z][A-Z]/.test(s) || /-/.test(s) || s[0] === s[0].toUpperCase() && s.length > 1 || t.push({
|
|
10644
|
+
id: `${s}-${i}`,
|
|
10621
10645
|
node: e,
|
|
10622
|
-
startOffset:
|
|
10646
|
+
startOffset: i,
|
|
10623
10647
|
endOffset: n,
|
|
10624
|
-
word:
|
|
10625
|
-
suggestions:
|
|
10648
|
+
word: s,
|
|
10649
|
+
suggestions: me(s),
|
|
10626
10650
|
ignored: !1
|
|
10627
10651
|
});
|
|
10628
10652
|
}
|
|
10629
10653
|
return t;
|
|
10630
10654
|
}
|
|
10631
|
-
const
|
|
10632
|
-
const e =
|
|
10655
|
+
const U = () => {
|
|
10656
|
+
const e = G();
|
|
10633
10657
|
if (e && document.contains(e))
|
|
10634
|
-
return
|
|
10658
|
+
return d = e, e;
|
|
10635
10659
|
const t = window.getSelection();
|
|
10636
10660
|
if (t && t.rangeCount > 0) {
|
|
10637
|
-
let
|
|
10638
|
-
for (;
|
|
10639
|
-
if (
|
|
10640
|
-
const
|
|
10641
|
-
if (
|
|
10642
|
-
return
|
|
10661
|
+
let r = t.getRangeAt(0).startContainer;
|
|
10662
|
+
for (; r && r !== document.body; ) {
|
|
10663
|
+
if (r.nodeType === Node.ELEMENT_NODE) {
|
|
10664
|
+
const s = r;
|
|
10665
|
+
if (s.getAttribute("contenteditable") === "true")
|
|
10666
|
+
return s;
|
|
10643
10667
|
}
|
|
10644
|
-
|
|
10668
|
+
r = r.parentNode;
|
|
10645
10669
|
}
|
|
10646
10670
|
}
|
|
10647
|
-
const
|
|
10648
|
-
if (
|
|
10649
|
-
if (
|
|
10650
|
-
return
|
|
10651
|
-
const
|
|
10652
|
-
if (
|
|
10653
|
-
const
|
|
10654
|
-
if (
|
|
10655
|
-
const
|
|
10656
|
-
if (
|
|
10671
|
+
const a = document.activeElement;
|
|
10672
|
+
if (a) {
|
|
10673
|
+
if (a.getAttribute("contenteditable") === "true")
|
|
10674
|
+
return a;
|
|
10675
|
+
const r = a.closest('[contenteditable="true"]');
|
|
10676
|
+
if (r) return r;
|
|
10677
|
+
const s = a.closest("[data-editora-editor]");
|
|
10678
|
+
if (s) {
|
|
10679
|
+
const i = s.querySelector('[contenteditable="true"]');
|
|
10680
|
+
if (i) return i;
|
|
10657
10681
|
}
|
|
10658
10682
|
}
|
|
10659
10683
|
return document.querySelector('[contenteditable="true"]');
|
|
10660
10684
|
};
|
|
10661
10685
|
function T() {
|
|
10662
|
-
const e =
|
|
10686
|
+
const e = f();
|
|
10663
10687
|
if (!e) return [];
|
|
10664
|
-
const t = [],
|
|
10688
|
+
const t = [], a = document.createTreeWalker(
|
|
10665
10689
|
e,
|
|
10666
10690
|
NodeFilter.SHOW_TEXT,
|
|
10667
10691
|
{
|
|
10668
|
-
acceptNode: (
|
|
10692
|
+
acceptNode: (s) => !s.textContent?.trim() || s.parentNode && ge(s.parentNode) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT
|
|
10669
10693
|
}
|
|
10670
10694
|
);
|
|
10671
|
-
let
|
|
10672
|
-
for (;
|
|
10673
|
-
t.push(...
|
|
10695
|
+
let r = a.nextNode();
|
|
10696
|
+
for (; r; )
|
|
10697
|
+
t.push(...he(r)), r = a.nextNode();
|
|
10674
10698
|
return t;
|
|
10675
10699
|
}
|
|
10676
|
-
function
|
|
10677
|
-
const t =
|
|
10700
|
+
function b(e) {
|
|
10701
|
+
const t = f();
|
|
10678
10702
|
t && (e || (e = T()), L(() => {
|
|
10679
|
-
t.querySelectorAll(".rte-misspelled").forEach((
|
|
10680
|
-
const
|
|
10681
|
-
if (
|
|
10682
|
-
for (;
|
|
10683
|
-
|
|
10684
|
-
|
|
10703
|
+
t.querySelectorAll(".rte-misspelled").forEach((r) => {
|
|
10704
|
+
const s = r.parentNode;
|
|
10705
|
+
if (s) {
|
|
10706
|
+
for (; r.firstChild; )
|
|
10707
|
+
s.insertBefore(r.firstChild, r);
|
|
10708
|
+
s.removeChild(r);
|
|
10685
10709
|
}
|
|
10686
|
-
}), [...e].sort((
|
|
10687
|
-
if (
|
|
10688
|
-
const
|
|
10689
|
-
if (!(
|
|
10710
|
+
}), [...e].sort((r, s) => s.startOffset - r.startOffset).forEach((r) => {
|
|
10711
|
+
if (E.has(r.word.toLowerCase())) return;
|
|
10712
|
+
const s = r.node.data.length;
|
|
10713
|
+
if (!(r.startOffset < 0 || r.endOffset > s || r.startOffset >= r.endOffset))
|
|
10690
10714
|
try {
|
|
10691
|
-
const
|
|
10692
|
-
|
|
10715
|
+
const i = document.createRange();
|
|
10716
|
+
i.setStart(r.node, r.startOffset), i.setEnd(r.node, r.endOffset);
|
|
10693
10717
|
const n = document.createElement("span");
|
|
10694
|
-
n.className = "rte-misspelled", n.setAttribute("data-word",
|
|
10718
|
+
n.className = "rte-misspelled", n.setAttribute("data-word", r.word), n.setAttribute("data-suggestions", r.suggestions.join(",")), n.setAttribute("title", `Suggestions: ${r.suggestions.join(", ")}`), n.style.borderBottom = "2px wavy red", n.style.cursor = "pointer", i.surroundContents(n);
|
|
10695
10719
|
} catch {
|
|
10696
10720
|
}
|
|
10697
10721
|
});
|
|
10698
|
-
}),
|
|
10722
|
+
}), z(e));
|
|
10699
10723
|
}
|
|
10700
|
-
function
|
|
10701
|
-
const e =
|
|
10724
|
+
function C() {
|
|
10725
|
+
const e = f();
|
|
10702
10726
|
e && L(() => {
|
|
10703
10727
|
e.querySelectorAll(".rte-misspelled").forEach((t) => {
|
|
10704
|
-
const
|
|
10705
|
-
if (
|
|
10728
|
+
const a = t.parentNode;
|
|
10729
|
+
if (a) {
|
|
10706
10730
|
for (; t.firstChild; )
|
|
10707
|
-
|
|
10708
|
-
|
|
10731
|
+
a.insertBefore(t.firstChild, t);
|
|
10732
|
+
a.removeChild(t);
|
|
10709
10733
|
}
|
|
10710
10734
|
});
|
|
10711
10735
|
});
|
|
10712
10736
|
}
|
|
10713
|
-
function
|
|
10737
|
+
function be(e, t) {
|
|
10714
10738
|
L(() => {
|
|
10715
|
-
const
|
|
10716
|
-
|
|
10717
|
-
const
|
|
10718
|
-
|
|
10739
|
+
const a = document.createRange();
|
|
10740
|
+
a.setStart(e.node, e.startOffset), a.setEnd(e.node, e.endOffset);
|
|
10741
|
+
const r = document.createTextNode(t);
|
|
10742
|
+
a.deleteContents(), a.insertNode(r);
|
|
10719
10743
|
});
|
|
10720
10744
|
}
|
|
10721
|
-
function U(e) {
|
|
10722
|
-
q.add(e.toLowerCase()), E(), g();
|
|
10723
|
-
}
|
|
10724
10745
|
function Y(e) {
|
|
10725
|
-
|
|
10746
|
+
E.add(e.toLowerCase()), C(), b();
|
|
10726
10747
|
}
|
|
10727
|
-
function
|
|
10728
|
-
|
|
10748
|
+
function V(e) {
|
|
10749
|
+
q.add(e.toLowerCase()), pe(), C(), b();
|
|
10750
|
+
}
|
|
10751
|
+
function fe(e) {
|
|
10752
|
+
const t = f();
|
|
10729
10753
|
if (!t) return { total: 0, misspelled: 0, accuracy: 100 };
|
|
10730
10754
|
e || (e = T());
|
|
10731
|
-
const
|
|
10755
|
+
const a = e.filter((n) => !E.has(n.word.toLowerCase())).length, i = ((t.textContent || "").match(/[\p{L}\p{M}\p{N}]+/gu) || []).length;
|
|
10732
10756
|
return {
|
|
10733
|
-
total:
|
|
10734
|
-
misspelled:
|
|
10735
|
-
accuracy:
|
|
10757
|
+
total: i,
|
|
10758
|
+
misspelled: a,
|
|
10759
|
+
accuracy: i > 0 ? (i - a) / i * 100 : 100
|
|
10736
10760
|
};
|
|
10737
10761
|
}
|
|
10738
|
-
function
|
|
10739
|
-
const
|
|
10740
|
-
e.replaceWith(
|
|
10762
|
+
function ye(e, t) {
|
|
10763
|
+
const a = document.createTextNode(t);
|
|
10764
|
+
e.replaceWith(a);
|
|
10741
10765
|
}
|
|
10742
|
-
function
|
|
10766
|
+
function ve(e) {
|
|
10743
10767
|
e.classList.remove("rte-misspelled"), e.removeAttribute("data-word"), e.removeAttribute("data-suggestions"), e.removeAttribute("title"), e.style.borderBottom = "", e.style.cursor = "";
|
|
10744
10768
|
}
|
|
10745
|
-
function
|
|
10746
|
-
|
|
10747
|
-
const
|
|
10748
|
-
if (
|
|
10749
|
-
const
|
|
10750
|
-
|
|
10751
|
-
|
|
10752
|
-
|
|
10753
|
-
}, 0),
|
|
10754
|
-
},
|
|
10755
|
-
}),
|
|
10756
|
-
const
|
|
10757
|
-
|
|
10769
|
+
function ke(e, t, a, r, s) {
|
|
10770
|
+
J(s), document.querySelectorAll(".rte-spellcheck-menu").forEach((m) => m.remove());
|
|
10771
|
+
const i = document.createElement("div");
|
|
10772
|
+
if (i.className = "rte-spellcheck-menu", r.slice(0, 5).forEach((m) => {
|
|
10773
|
+
const x = document.createElement("div");
|
|
10774
|
+
x.className = "rte-spellcheck-menu-item", x.textContent = m, x.onclick = () => {
|
|
10775
|
+
ye(s, m), window.setTimeout(() => {
|
|
10776
|
+
h && (b(), z());
|
|
10777
|
+
}, 0), i.remove();
|
|
10778
|
+
}, i.appendChild(x);
|
|
10779
|
+
}), r.length > 0) {
|
|
10780
|
+
const m = document.createElement("div");
|
|
10781
|
+
m.style.cssText = "height: 1px; background: #ddd; margin: 4px 0;", i.appendChild(m);
|
|
10758
10782
|
}
|
|
10759
10783
|
const n = document.createElement("div");
|
|
10760
10784
|
n.className = "rte-spellcheck-menu-item meta", n.textContent = "Ignore Once", n.onclick = () => {
|
|
10761
|
-
|
|
10762
|
-
},
|
|
10763
|
-
const
|
|
10764
|
-
|
|
10765
|
-
|
|
10766
|
-
},
|
|
10767
|
-
const
|
|
10768
|
-
|
|
10769
|
-
|
|
10770
|
-
},
|
|
10771
|
-
const
|
|
10772
|
-
|
|
10773
|
-
const
|
|
10774
|
-
|
|
10785
|
+
ve(s), i.remove();
|
|
10786
|
+
}, i.appendChild(n);
|
|
10787
|
+
const o = document.createElement("div");
|
|
10788
|
+
o.className = "rte-spellcheck-menu-item meta", o.textContent = "Ignore All", o.onclick = () => {
|
|
10789
|
+
Y(a), i.remove();
|
|
10790
|
+
}, i.appendChild(o);
|
|
10791
|
+
const l = document.createElement("div");
|
|
10792
|
+
l.className = "rte-spellcheck-menu-item positive", l.textContent = "Add to Dictionary", l.onclick = () => {
|
|
10793
|
+
V(a), i.remove();
|
|
10794
|
+
}, i.appendChild(l), document.body.appendChild(i);
|
|
10795
|
+
const p = i.getBoundingClientRect(), Z = window.innerWidth - p.width - 8, K = window.innerHeight - p.height - 8;
|
|
10796
|
+
i.style.left = `${Math.max(8, Math.min(e, Z))}px`, i.style.top = `${Math.max(8, Math.min(t, K))}px`;
|
|
10797
|
+
const O = (m) => {
|
|
10798
|
+
i.contains(m.target) || (i.remove(), document.removeEventListener("mousedown", O));
|
|
10775
10799
|
};
|
|
10776
|
-
setTimeout(() => document.addEventListener("mousedown",
|
|
10800
|
+
setTimeout(() => document.addEventListener("mousedown", O), 0);
|
|
10777
10801
|
}
|
|
10778
|
-
function
|
|
10779
|
-
|
|
10802
|
+
function _() {
|
|
10803
|
+
j || (w = (e) => {
|
|
10780
10804
|
const t = e.target;
|
|
10781
10805
|
if (t && t.classList.contains("rte-misspelled")) {
|
|
10782
|
-
e.preventDefault(),
|
|
10783
|
-
const
|
|
10784
|
-
|
|
10806
|
+
e.preventDefault(), J(t);
|
|
10807
|
+
const a = t.getAttribute("data-word"), r = (t.getAttribute("data-suggestions") || "").split(",").filter((s) => s);
|
|
10808
|
+
ke(e.clientX, e.clientY, a, r, t);
|
|
10785
10809
|
}
|
|
10786
|
-
}, document.addEventListener("contextmenu",
|
|
10810
|
+
}, document.addEventListener("contextmenu", w), j = !0);
|
|
10787
10811
|
}
|
|
10788
|
-
function
|
|
10789
|
-
!
|
|
10812
|
+
function we() {
|
|
10813
|
+
!j || !w || (document.removeEventListener("contextmenu", w), w = null, j = !1);
|
|
10790
10814
|
}
|
|
10791
|
-
function
|
|
10815
|
+
function xe(e) {
|
|
10792
10816
|
return e.closest("[data-editora-editor]") || e.parentElement || e;
|
|
10793
10817
|
}
|
|
10794
|
-
function
|
|
10795
|
-
const e =
|
|
10818
|
+
function R() {
|
|
10819
|
+
const e = f();
|
|
10796
10820
|
if (!e)
|
|
10797
10821
|
throw new Error("Spell check panel requested without active editor");
|
|
10798
|
-
const t =
|
|
10799
|
-
|
|
10800
|
-
const
|
|
10801
|
-
return
|
|
10822
|
+
const t = xe(e);
|
|
10823
|
+
S();
|
|
10824
|
+
const a = document.createElement("div");
|
|
10825
|
+
return a.className = "rte-spell-check-panel", a.setAttribute("role", "complementary"), a.setAttribute("aria-label", "Spell check"), window.getComputedStyle(t).position === "static" && (t.style.position = "relative"), t.appendChild(a), a;
|
|
10802
10826
|
}
|
|
10803
|
-
function
|
|
10804
|
-
if (!
|
|
10805
|
-
const t = e || T(),
|
|
10806
|
-
|
|
10827
|
+
function z(e) {
|
|
10828
|
+
if (!c) return;
|
|
10829
|
+
const t = e || T(), a = fe(t), r = c;
|
|
10830
|
+
Q(r, () => {
|
|
10831
|
+
r.innerHTML = `
|
|
10807
10832
|
<div class="rte-spellcheck-header">
|
|
10808
10833
|
<div>
|
|
10809
10834
|
<h3 class="rte-spellcheck-title">Spell Check</h3>
|
|
@@ -10815,28 +10840,28 @@ function j(e) {
|
|
|
10815
10840
|
<div class="rte-spellcheck-stats">
|
|
10816
10841
|
<div class="rte-spellcheck-stat">
|
|
10817
10842
|
<span class="rte-spellcheck-stat-label">Total</span>
|
|
10818
|
-
<strong class="rte-spellcheck-stat-value">${
|
|
10843
|
+
<strong class="rte-spellcheck-stat-value">${a.total}</strong>
|
|
10819
10844
|
</div>
|
|
10820
10845
|
<div class="rte-spellcheck-stat">
|
|
10821
10846
|
<span class="rte-spellcheck-stat-label">Misspelled</span>
|
|
10822
|
-
<strong class="rte-spellcheck-stat-value">${
|
|
10847
|
+
<strong class="rte-spellcheck-stat-value">${a.misspelled}</strong>
|
|
10823
10848
|
</div>
|
|
10824
10849
|
<div class="rte-spellcheck-stat">
|
|
10825
10850
|
<span class="rte-spellcheck-stat-label">Accuracy</span>
|
|
10826
|
-
<strong class="rte-spellcheck-stat-value">${
|
|
10851
|
+
<strong class="rte-spellcheck-stat-value">${a.accuracy.toFixed(1)}%</strong>
|
|
10827
10852
|
</div>
|
|
10828
10853
|
</div>
|
|
10829
10854
|
|
|
10830
10855
|
<div class="rte-spellcheck-list">
|
|
10831
|
-
${t.length === 0 ? '<div class="rte-spellcheck-empty">No spelling errors found in this editor.</div>' : t.map((i,
|
|
10832
|
-
<div class="rte-spellcheck-item" data-word="${i.word}" data-index="${
|
|
10856
|
+
${t.length === 0 ? '<div class="rte-spellcheck-empty">No spelling errors found in this editor.</div>' : t.map((i, n) => `
|
|
10857
|
+
<div class="rte-spellcheck-item" data-word="${i.word}" data-index="${n}">
|
|
10833
10858
|
<button class="rte-spellcheck-word-header" type="button">
|
|
10834
10859
|
<span class="rte-spellcheck-word">${i.word}</span>
|
|
10835
10860
|
<span class="rte-spellcheck-caret">▶</span>
|
|
10836
10861
|
</button>
|
|
10837
10862
|
<div class="rte-spellcheck-suggestions">
|
|
10838
10863
|
${i.suggestions.length > 0 ? `<div class="rte-spellcheck-actions">
|
|
10839
|
-
${i.suggestions.map((
|
|
10864
|
+
${i.suggestions.map((o) => `<button class="rte-spellcheck-btn primary suggestion-btn" data-suggestion="${o}" type="button">${o}</button>`).join("")}
|
|
10840
10865
|
</div>` : '<div class="rte-spellcheck-subtitle">No suggestions available</div>'}
|
|
10841
10866
|
<div class="rte-spellcheck-actions">
|
|
10842
10867
|
<button class="rte-spellcheck-btn ignore-btn" type="button">Ignore</button>
|
|
@@ -10846,65 +10871,77 @@ function j(e) {
|
|
|
10846
10871
|
</div>
|
|
10847
10872
|
`).join("")}
|
|
10848
10873
|
</div>
|
|
10849
|
-
|
|
10850
|
-
|
|
10851
|
-
|
|
10874
|
+
`;
|
|
10875
|
+
}), c.querySelector(".rte-spellcheck-close")?.addEventListener("click", (i) => {
|
|
10876
|
+
i.preventDefault(), i.stopPropagation(), M(!0);
|
|
10877
|
+
}), c.querySelectorAll(".rte-spellcheck-word-header").forEach((i) => {
|
|
10852
10878
|
i.addEventListener("click", () => {
|
|
10853
|
-
const
|
|
10854
|
-
|
|
10879
|
+
const o = i.closest(".rte-spellcheck-item")?.querySelector(".rte-spellcheck-suggestions"), l = i.querySelector(".rte-spellcheck-caret");
|
|
10880
|
+
o && l && (o.classList.contains("show") ? (o.classList.remove("show"), l.textContent = "▶") : (o.classList.add("show"), l.textContent = "▼"));
|
|
10855
10881
|
});
|
|
10856
|
-
}),
|
|
10882
|
+
}), c.querySelectorAll(".suggestion-btn").forEach((i) => {
|
|
10857
10883
|
i.addEventListener("click", () => {
|
|
10858
|
-
const
|
|
10859
|
-
|
|
10884
|
+
const n = i.getAttribute("data-suggestion"), o = i.closest(".rte-spellcheck-item"), l = parseInt(o?.getAttribute("data-index") || "0", 10);
|
|
10885
|
+
n !== null && t[l] && (be(t[l], n), b());
|
|
10860
10886
|
});
|
|
10861
|
-
}),
|
|
10887
|
+
}), c.querySelectorAll(".ignore-btn").forEach((i) => {
|
|
10862
10888
|
i.addEventListener("click", () => {
|
|
10863
|
-
const
|
|
10864
|
-
|
|
10889
|
+
const n = i.closest(".rte-spellcheck-item")?.getAttribute("data-word");
|
|
10890
|
+
n && Y(n);
|
|
10865
10891
|
});
|
|
10866
|
-
}),
|
|
10892
|
+
}), c.querySelectorAll(".add-btn").forEach((i) => {
|
|
10867
10893
|
i.addEventListener("click", () => {
|
|
10868
|
-
const
|
|
10869
|
-
|
|
10894
|
+
const n = i.closest(".rte-spellcheck-item")?.getAttribute("data-word");
|
|
10895
|
+
n && V(n);
|
|
10870
10896
|
});
|
|
10871
10897
|
});
|
|
10872
10898
|
}
|
|
10873
|
-
function
|
|
10874
|
-
const e =
|
|
10875
|
-
e && (
|
|
10876
|
-
|
|
10877
|
-
|
|
10899
|
+
function $() {
|
|
10900
|
+
const e = f();
|
|
10901
|
+
e && (u && u.disconnect(), u = new MutationObserver((t) => {
|
|
10902
|
+
v > 0 || t.some((a) => a.type === "characterData" || a.type === "childList") && (y && clearTimeout(y), y = window.setTimeout(() => {
|
|
10903
|
+
h && b();
|
|
10878
10904
|
}, 350));
|
|
10879
|
-
}),
|
|
10880
|
-
...
|
|
10905
|
+
}), u.observe(e, {
|
|
10906
|
+
...W
|
|
10881
10907
|
}));
|
|
10882
10908
|
}
|
|
10883
|
-
function V() {
|
|
10884
|
-
d && (d.disconnect(), d = null), b && (clearTimeout(b), b = null);
|
|
10885
|
-
}
|
|
10886
10909
|
function X() {
|
|
10910
|
+
u && (u.disconnect(), u = null), y && (clearTimeout(y), y = null);
|
|
10911
|
+
}
|
|
10912
|
+
function N() {
|
|
10887
10913
|
document.querySelectorAll(".rte-spellcheck-menu").forEach((e) => e.remove());
|
|
10888
10914
|
}
|
|
10889
|
-
function
|
|
10890
|
-
|
|
10891
|
-
e.key !== "Escape" || !
|
|
10892
|
-
|
|
10915
|
+
function B() {
|
|
10916
|
+
k || (k = (e) => {
|
|
10917
|
+
if (e.key !== "Escape" || !h) return;
|
|
10918
|
+
const t = e.target;
|
|
10919
|
+
if (t && (c?.contains(t) || d?.contains(t))) {
|
|
10920
|
+
if (e.preventDefault(), e.stopPropagation(), document.querySelector(".rte-spellcheck-menu")) {
|
|
10921
|
+
N();
|
|
10922
|
+
return;
|
|
10923
|
+
}
|
|
10924
|
+
M();
|
|
10925
|
+
}
|
|
10926
|
+
}, document.addEventListener("keydown", k, !0));
|
|
10893
10927
|
}
|
|
10894
|
-
function
|
|
10895
|
-
|
|
10928
|
+
function je() {
|
|
10929
|
+
k && (document.removeEventListener("keydown", k, !0), k = null);
|
|
10896
10930
|
}
|
|
10897
|
-
function
|
|
10898
|
-
|
|
10931
|
+
function M(e = !1) {
|
|
10932
|
+
if (!h) return !1;
|
|
10933
|
+
C(), X(), we(), N();
|
|
10934
|
+
const t = e || ee(c) ? d : null;
|
|
10935
|
+
return c && (c.remove(), c = null), d = null, g = null, h = !1, je(), t?.focus({ preventScroll: !0 }), !1;
|
|
10899
10936
|
}
|
|
10900
|
-
function
|
|
10901
|
-
const e =
|
|
10902
|
-
return e ?
|
|
10937
|
+
function ze() {
|
|
10938
|
+
const e = oe();
|
|
10939
|
+
return e ? h && d && d !== e ? (C(), X(), N(), c && (c.remove(), c = null), d = e, S(), _(), B(), b(), $(), c = R(), z(), D(c), !0) : h ? M() : (d = e, h = !0, S(), _(), B(), b(), $(), c && (c.remove(), c = null), c = R(), z(), D(c), !0) : !1;
|
|
10903
10940
|
}
|
|
10904
|
-
const
|
|
10941
|
+
const Ee = () => ({
|
|
10905
10942
|
name: "spellCheck",
|
|
10906
10943
|
init: () => {
|
|
10907
|
-
|
|
10944
|
+
de(), ne();
|
|
10908
10945
|
},
|
|
10909
10946
|
toolbar: [
|
|
10910
10947
|
{
|
|
@@ -10915,12 +10952,12 @@ const ke = () => ({
|
|
|
10915
10952
|
}
|
|
10916
10953
|
],
|
|
10917
10954
|
commands: {
|
|
10918
|
-
toggleSpellCheck: (e, t) => (
|
|
10955
|
+
toggleSpellCheck: (e, t) => (se(t), ze(), !0)
|
|
10919
10956
|
},
|
|
10920
10957
|
keymap: {
|
|
10921
10958
|
F7: "toggleSpellCheck"
|
|
10922
10959
|
}
|
|
10923
10960
|
});
|
|
10924
10961
|
export {
|
|
10925
|
-
|
|
10962
|
+
Ee as SpellCheckPlugin
|
|
10926
10963
|
};
|