@editora/core 1.0.9 → 1.0.11
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/{A11yCheckerPlugin.native-58d12bed.mjs → A11yCheckerPlugin.native-BRdGYMju.mjs} +12 -23
- package/dist/{AnchorPlugin.native-289a112a.mjs → AnchorPlugin.native-BcYGEtd9.mjs} +102 -112
- package/dist/{ApprovalWorkflowPlugin.native-449ce66c.mjs → ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs} +173 -209
- package/dist/{BackgroundColorPlugin.native-8aceb5cc.mjs → BackgroundColorPlugin.native-50iAT9xU.mjs} +9 -16
- package/dist/BlockquotePlugin.native-57_Xcjl1.mjs +212 -0
- package/dist/{BlocksLibraryPlugin.native-1cc51e63.mjs → BlocksLibraryPlugin.native-5sdsXsiE.mjs} +149 -205
- package/dist/{BoldPlugin.native-f9d7f8e4.mjs → BoldPlugin.native-CSh_LiIJ.mjs} +11 -7
- package/dist/CapitalizationPlugin.native-DLV4oPmB.mjs +159 -0
- package/dist/ChecklistPlugin.native-BS-kMz9O.mjs +371 -0
- package/dist/{CitationsPlugin.native-169fb1e8.mjs → CitationsPlugin.native-DQgoCd1B.mjs} +196 -261
- package/dist/ClearFormattingPlugin.native-DIS6AN2t.mjs +172 -0
- package/dist/CodePlugin.native-veDC_kx5.mjs +4600 -0
- package/dist/{CodeSamplePlugin.native-6cc0148e.mjs → CodeSamplePlugin.native-CgGoH-X4.mjs} +10 -19
- package/dist/{CommentsPlugin.native-03659874.mjs → CommentsPlugin.native-DPSqTkiv.mjs} +28 -55
- package/dist/{ConditionalContentPlugin.native-4983143a.mjs → ConditionalContentPlugin.native-CfhY46rU.mjs} +51 -108
- package/dist/{ContentRulesPlugin.native-63ed405b.mjs → ContentRulesPlugin.native-vPx5nC73.mjs} +153 -200
- package/dist/{DataBindingPlugin.native-427e9d75.mjs → DataBindingPlugin.native-BoXwghTz.mjs} +88 -124
- package/dist/DirectionPlugin.native-Bl-QLFzO.mjs +153 -0
- package/dist/{DocSchemaPlugin.native-8e41eda0.mjs → DocSchemaPlugin.native-DUSVRHqT.mjs} +112 -166
- package/dist/{DocumentManagerPlugin.native-e69895ad.mjs → DocumentManagerPlugin.native-C2cs_1w4.mjs} +4 -4
- package/dist/EmbedIframePlugin.native-BF_-LjTq.mjs +740 -0
- package/dist/{EmojisPlugin.native-65c5ac47.mjs → EmojisPlugin.native-CitxxlWX.mjs} +6 -11
- package/dist/{FontFamilyPlugin.native-f9bc255a.mjs → FontFamilyPlugin.native-j8hMTbg4.mjs} +4 -7
- package/dist/{FontSizePlugin.native-f5647872.mjs → FontSizePlugin.native-B_jCh7dY.mjs} +10 -19
- package/dist/{FootnotePlugin.native-494657b3.mjs → FootnotePlugin.native-D730OGRm.mjs} +39 -77
- package/dist/{FullscreenPlugin.native-87ce92e9.mjs → FullscreenPlugin.native-ChXyxeNw.mjs} +1 -1
- package/dist/HeadingPlugin.native-DZdvubrQ.mjs +249 -0
- package/dist/{HistoryPlugin.native-92ed4be4.mjs → HistoryPlugin.native-D2wl32jV.mjs} +107 -143
- package/dist/{IndentPlugin.native-e4ee902b.mjs → IndentPlugin.native-BHixp8sP.mjs} +12 -23
- package/dist/{ItalicPlugin.native-7c95cfbc.mjs → ItalicPlugin.native-CmnlwFHB.mjs} +15 -11
- package/dist/{LineHeightPlugin.native-5668f78c.mjs → LineHeightPlugin.native-CM7iXdQj.mjs} +10 -19
- package/dist/{LinkPlugin.native-6df29111.mjs → LinkPlugin.native-DYCIcdTm.mjs} +5 -9
- package/dist/{ListPlugin.native-fe2e115a.mjs → ListPlugin.native-V7EZC1lM.mjs} +5 -9
- package/dist/MathPlugin.native-NwWPHVmj.mjs +369 -0
- package/dist/{MediaManagerPlugin.native-3cf48a00.mjs → MediaManagerPlugin.native-eOsTJFpw.mjs} +11 -21
- package/dist/{MentionPlugin.native-3b1e8c05.mjs → MentionPlugin.native-BMDlOqur.mjs} +45 -89
- package/dist/MergeTagPlugin.native-BzRVoD9-.mjs +580 -0
- package/dist/{PIIRedactionPlugin.native-7ab10b9f.mjs → PIIRedactionPlugin.native-g7j4jOmm.mjs} +210 -260
- package/dist/{PageBreakPlugin.native-1794c5fb.mjs → PageBreakPlugin.native-DijGuHJZ.mjs} +16 -31
- package/dist/{PreviewPlugin.native-f7b67cc0.mjs → PreviewPlugin.native-WuIwOAOR.mjs} +6 -11
- package/dist/{PrintPlugin.native-f6a168c2.mjs → PrintPlugin.native-7qt5v7L5.mjs} +3 -5
- package/dist/{SlashCommandsPlugin.native-8d45e511.mjs → SlashCommandsPlugin.native-BiN6ODw5.mjs} +36 -71
- package/dist/{SmartPastePlugin.native-a6c5efec.mjs → SmartPastePlugin.native-CZAEHkyt.mjs} +173 -219
- package/dist/{SpecialCharactersPlugin.native-7f06d4ba.mjs → SpecialCharactersPlugin.native-DaG4b19I.mjs} +101 -85
- package/dist/{SpellCheckPlugin.native-04e20834.mjs → SpellCheckPlugin.native-BZB9AewP.mjs} +21 -41
- package/dist/{StrikethroughPlugin.native-905e9501.mjs → StrikethroughPlugin.native-V0TL4F48.mjs} +12 -30
- package/dist/{TablePlugin.native-7d5458c1.mjs → TablePlugin.native-DrHX-efe.mjs} +30 -58
- package/dist/TemplatePlugin.native-DLjFUaPW.mjs +1150 -0
- package/dist/{TextAlignmentPlugin.native-9357b3ed.mjs → TextAlignmentPlugin.native-sM_1s00t.mjs} +6 -11
- package/dist/{TextColorPlugin.native-d53ed459.mjs → TextColorPlugin.native-Bwl_bSmc.mjs} +14 -26
- package/dist/{TrackChangesPlugin.native-e96da509.mjs → TrackChangesPlugin.native-Bghu2q4a.mjs} +58 -115
- package/dist/{TranslationWorkflowPlugin.native-4e711b1e.mjs → TranslationWorkflowPlugin.native-DdF16tgT.mjs} +191 -257
- package/dist/{UnderlinePlugin.native-8080c998.mjs → UnderlinePlugin.native-DZzg23rv.mjs} +8 -4
- package/dist/{VersionDiffPlugin.native-5bbeff85.mjs → VersionDiffPlugin.native-Bvxgy--t.mjs} +26 -51
- package/dist/_commonjsHelpers-DOllISpa.mjs +32 -0
- package/dist/{anchoredPopover-5cca53ba.mjs → anchoredPopover-Bxds0VoB.mjs} +1 -1
- package/dist/core.css +1 -0
- package/dist/documentManager-vQ1VkbUY.mjs +8418 -0
- package/dist/{editorContainerHelpers-69585c07.mjs → editorContainerHelpers-C7kdWnS0.mjs} +2 -3
- package/dist/editora.min.js +13 -14
- package/dist/editora.umd.js +13 -14
- package/dist/{html2canvas.esm-c51cb3b9.mjs → html2canvas.esm-AYkPY5LS.mjs} +894 -978
- package/dist/index-BslAFzmv.mjs +16544 -0
- package/dist/index-CPMGUZfB.js +10 -0
- package/dist/{index-7da30697.mjs → index-DBoj6QfW.mjs} +127 -164
- package/dist/index.cjs.js +1 -1
- package/dist/index.es-BYD2KEo6.mjs +6666 -0
- package/dist/index.esm.js +7 -12
- package/dist/inlineFormatting-DJ0-NZtx.mjs +97 -0
- package/dist/{jspdf.es.min-780c82db.mjs → jspdf.es.min-BJGtOnRT.mjs} +3784 -4808
- package/dist/plugin-loader.js +67 -67
- package/dist/{purify.es-3bdbcfc5.mjs → purify.es-CKpwg8Tk.mjs} +10 -20
- package/dist/webcomponent-core.js +131 -168
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +147 -65
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +191 -228
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +1248 -1346
- package/package.json +1 -1
- package/dist/BlockquotePlugin.native-3541c714.mjs +0 -49
- package/dist/CapitalizationPlugin.native-42c135dc.mjs +0 -80
- package/dist/ChecklistPlugin.native-3b397ee9.mjs +0 -330
- package/dist/ClearFormattingPlugin.native-77baa514.mjs +0 -145
- package/dist/CodePlugin.native-989cf0aa.mjs +0 -2740
- package/dist/DirectionPlugin.native-4e742f42.mjs +0 -139
- package/dist/EmbedIframePlugin.native-55209c87.mjs +0 -568
- package/dist/HeadingPlugin.native-e38c4a16.mjs +0 -64
- package/dist/MathPlugin.native-735bbac2.mjs +0 -296
- package/dist/MergeTagPlugin.native-31cf7d48.mjs +0 -584
- package/dist/TemplatePlugin.native-580f0f63.mjs +0 -617
- package/dist/_commonjsHelpers-69d58be2.mjs +0 -31
- package/dist/documentManager-8327fb6e.mjs +0 -9166
- package/dist/index-072ef022.js +0 -11
- package/dist/index-49d31221.mjs +0 -16860
- package/dist/index.es-b47a189f.mjs +0 -5782
- package/dist/style.css +0 -1
package/dist/{ContentRulesPlugin.native-63ed405b.mjs → ContentRulesPlugin.native-vPx5nC73.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const R = ".rte-content, .editora-content", ee = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor",
|
|
1
|
+
const R = ".rte-content, .editora-content", ee = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", se = "__editoraCommandEditorRoot", le = "rte-content-rules-styles", f = "rte-content-rules-panel", q = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', pe = {
|
|
2
2
|
panelTitle: "Content Rules",
|
|
3
3
|
panelAriaLabel: "Content rules panel",
|
|
4
4
|
runAuditText: "Run Audit",
|
|
@@ -12,23 +12,22 @@ const R = ".rte-content, .editora-content", ee = "[data-editora-editor], .rte-ed
|
|
|
12
12
|
requiredHeadingMessage: "Missing required heading",
|
|
13
13
|
sentenceLengthMessage: "Sentence is too long",
|
|
14
14
|
readabilityMessage: "Readability score is below threshold"
|
|
15
|
-
}, d = /* @__PURE__ */ new WeakMap(),
|
|
16
|
-
let N = 0,
|
|
15
|
+
}, d = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap(), fe = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), ae = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new Set();
|
|
16
|
+
let N = 0, xe = 0, E = null, m = null, L = null, I = null, H = null, S = null;
|
|
17
17
|
function k(e) {
|
|
18
18
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function ye(e) {
|
|
21
21
|
return {
|
|
22
|
-
...
|
|
22
|
+
...pe,
|
|
23
23
|
...e || {}
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function we(e) {
|
|
27
27
|
return e.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
if (!e)
|
|
31
|
-
return [];
|
|
29
|
+
function ie(e) {
|
|
30
|
+
if (!e) return [];
|
|
32
31
|
const t = /* @__PURE__ */ new Set();
|
|
33
32
|
return e.forEach((n) => {
|
|
34
33
|
const o = n.trim();
|
|
@@ -38,15 +37,15 @@ function ae(e) {
|
|
|
38
37
|
function j(e = {}) {
|
|
39
38
|
var t, n, o, r;
|
|
40
39
|
return {
|
|
41
|
-
bannedWords:
|
|
42
|
-
requiredHeadings:
|
|
40
|
+
bannedWords: ie(e.bannedWords),
|
|
41
|
+
requiredHeadings: ie(e.requiredHeadings),
|
|
43
42
|
maxSentenceWords: Math.max(8, Number((t = e.maxSentenceWords) != null ? t : 32)),
|
|
44
43
|
minReadabilityScore: Math.max(0, Math.min(120, Number((n = e.minReadabilityScore) != null ? n : 55))),
|
|
45
44
|
maxIssues: Math.max(1, Number((o = e.maxIssues) != null ? o : 100)),
|
|
46
45
|
debounceMs: Math.max(50, Number((r = e.debounceMs) != null ? r : 220)),
|
|
47
46
|
enableRealtime: e.enableRealtime !== !1,
|
|
48
|
-
labels:
|
|
49
|
-
normalizeText: e.normalizeText ||
|
|
47
|
+
labels: ye(e.labels),
|
|
48
|
+
normalizeText: e.normalizeText || we,
|
|
50
49
|
customRules: Array.isArray(e.customRules) ? e.customRules : []
|
|
51
50
|
};
|
|
52
51
|
}
|
|
@@ -54,32 +53,26 @@ function X(e) {
|
|
|
54
53
|
return e.closest(ee) || e;
|
|
55
54
|
}
|
|
56
55
|
function F(e) {
|
|
57
|
-
if (!e)
|
|
58
|
-
|
|
59
|
-
if (e.matches(R))
|
|
60
|
-
return e;
|
|
56
|
+
if (!e) return null;
|
|
57
|
+
if (e.matches(R)) return e;
|
|
61
58
|
const t = e.querySelector(R);
|
|
62
59
|
return t instanceof HTMLElement ? t : null;
|
|
63
60
|
}
|
|
64
|
-
function
|
|
65
|
-
if (typeof window == "undefined")
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
return null;
|
|
70
|
-
window[oe] = null;
|
|
61
|
+
function ke() {
|
|
62
|
+
if (typeof window == "undefined") return null;
|
|
63
|
+
const e = window[se];
|
|
64
|
+
if (!(e instanceof HTMLElement)) return null;
|
|
65
|
+
window[se] = null;
|
|
71
66
|
const t = F(e);
|
|
72
|
-
if (t)
|
|
73
|
-
return t;
|
|
67
|
+
if (t) return t;
|
|
74
68
|
const n = e.closest(ee);
|
|
75
69
|
if (n) {
|
|
76
70
|
const o = F(n);
|
|
77
|
-
if (o)
|
|
78
|
-
return o;
|
|
71
|
+
if (o) return o;
|
|
79
72
|
}
|
|
80
73
|
return null;
|
|
81
74
|
}
|
|
82
|
-
function
|
|
75
|
+
function Re(e) {
|
|
83
76
|
const t = e.closest("[data-editora-editor]");
|
|
84
77
|
if (t && F(t) === e)
|
|
85
78
|
return t;
|
|
@@ -94,46 +87,38 @@ function ke(e) {
|
|
|
94
87
|
function K(e) {
|
|
95
88
|
return e ? (e.getAttribute("data-theme") || e.getAttribute("theme") || "").toLowerCase() === "dark" ? !0 : e.classList.contains("dark") || e.classList.contains("editora-theme-dark") || e.classList.contains("rte-theme-dark") : !1;
|
|
96
89
|
}
|
|
97
|
-
function
|
|
90
|
+
function Ee(e) {
|
|
98
91
|
const t = X(e);
|
|
99
|
-
if (K(t))
|
|
100
|
-
return !0;
|
|
92
|
+
if (K(t)) return !0;
|
|
101
93
|
const n = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
102
94
|
return K(n) ? !0 : K(document.documentElement) || K(document.body);
|
|
103
95
|
}
|
|
104
96
|
function G(e, t) {
|
|
105
|
-
e.classList.remove("rte-content-rules-theme-dark"),
|
|
97
|
+
e.classList.remove("rte-content-rules-theme-dark"), Ee(t) && e.classList.add("rte-content-rules-theme-dark");
|
|
106
98
|
}
|
|
107
|
-
function
|
|
99
|
+
function ve(e) {
|
|
108
100
|
return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
|
|
109
101
|
}
|
|
110
102
|
function M(e, t = !0) {
|
|
111
|
-
if ((e == null ? void 0 : e.contentElement) instanceof HTMLElement)
|
|
112
|
-
return e.contentElement;
|
|
103
|
+
if ((e == null ? void 0 : e.contentElement) instanceof HTMLElement) return e.contentElement;
|
|
113
104
|
if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
|
|
114
105
|
const s = e.editorElement;
|
|
115
|
-
if (s.matches(R))
|
|
116
|
-
return s;
|
|
106
|
+
if (s.matches(R)) return s;
|
|
117
107
|
const a = s.querySelector(R);
|
|
118
|
-
if (a instanceof HTMLElement)
|
|
119
|
-
return a;
|
|
108
|
+
if (a instanceof HTMLElement) return a;
|
|
120
109
|
}
|
|
121
|
-
const n =
|
|
122
|
-
if (n)
|
|
123
|
-
return n;
|
|
110
|
+
const n = ke();
|
|
111
|
+
if (n) return n;
|
|
124
112
|
const o = window.getSelection();
|
|
125
113
|
if (o && o.rangeCount > 0) {
|
|
126
|
-
const s = o.getRangeAt(0).startContainer, a =
|
|
127
|
-
if (l)
|
|
128
|
-
return l;
|
|
114
|
+
const s = o.getRangeAt(0).startContainer, a = ve(s), l = a == null ? void 0 : a.closest(R);
|
|
115
|
+
if (l) return l;
|
|
129
116
|
}
|
|
130
117
|
const r = document.activeElement;
|
|
131
118
|
if (r) {
|
|
132
|
-
if (r.matches(R))
|
|
133
|
-
return r;
|
|
119
|
+
if (r.matches(R)) return r;
|
|
134
120
|
const s = r.closest(R);
|
|
135
|
-
if (s)
|
|
136
|
-
return s;
|
|
121
|
+
if (s) return s;
|
|
137
122
|
}
|
|
138
123
|
return m && m.isConnected ? m : (m && !m.isConnected && (m = null), t ? document.querySelector(R) : null);
|
|
139
124
|
}
|
|
@@ -144,38 +129,35 @@ function Ce(e, t) {
|
|
|
144
129
|
const n = e.innerText || e.textContent || "";
|
|
145
130
|
return t(n);
|
|
146
131
|
}
|
|
147
|
-
function
|
|
132
|
+
function $e(e) {
|
|
148
133
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
149
134
|
}
|
|
150
|
-
function
|
|
135
|
+
function ce(e) {
|
|
151
136
|
let t = 2166136261;
|
|
152
137
|
for (let n = 0; n < e.length; n += 1)
|
|
153
138
|
t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
|
|
154
139
|
return t >>> 0;
|
|
155
140
|
}
|
|
156
|
-
function
|
|
141
|
+
function ue(e) {
|
|
157
142
|
const t = e.match(/\b[\w'-]+\b/g);
|
|
158
143
|
return t ? t.length : 0;
|
|
159
144
|
}
|
|
160
|
-
function
|
|
145
|
+
function ge(e) {
|
|
161
146
|
const t = e.match(/[^.!?]+[.!?]*/g);
|
|
162
147
|
return t ? t.map((n) => n.trim()).filter(Boolean).length : 0;
|
|
163
148
|
}
|
|
164
|
-
function
|
|
149
|
+
function Me(e) {
|
|
165
150
|
const t = e.toLowerCase().replace(/[^a-z]/g, "");
|
|
166
|
-
if (!t)
|
|
167
|
-
|
|
168
|
-
if (t.length <= 3)
|
|
169
|
-
return 1;
|
|
151
|
+
if (!t) return 0;
|
|
152
|
+
if (t.length <= 3) return 1;
|
|
170
153
|
const n = t.match(/[aeiouy]+/g);
|
|
171
154
|
let o = n ? n.length : 1;
|
|
172
155
|
return t.endsWith("e") && (o -= 1), Math.max(1, o);
|
|
173
156
|
}
|
|
174
|
-
function
|
|
157
|
+
function Se(e) {
|
|
175
158
|
const t = e.match(/\b[\w'-]+\b/g) || [], n = t.length;
|
|
176
|
-
if (n === 0)
|
|
177
|
-
|
|
178
|
-
const o = Math.max(1, fe(e)), r = t.reduce((a, l) => a + $e(l), 0), s = 206.835 - 1.015 * (n / o) - 84.6 * (r / Math.max(1, n));
|
|
159
|
+
if (n === 0) return 100;
|
|
160
|
+
const o = Math.max(1, ge(e)), r = t.reduce((a, l) => a + Me(l), 0), s = 206.835 - 1.015 * (n / o) - 84.6 * (r / Math.max(1, n));
|
|
179
161
|
return Number.isFinite(s) ? Math.max(0, Math.min(120, s)) : 0;
|
|
180
162
|
}
|
|
181
163
|
function z(e, t) {
|
|
@@ -187,69 +169,67 @@ function x(e, t) {
|
|
|
187
169
|
function P(e, t, n) {
|
|
188
170
|
x(e, n) || e.push(t);
|
|
189
171
|
}
|
|
190
|
-
function
|
|
172
|
+
function me(e, t = 140) {
|
|
191
173
|
return e.length <= t ? e : `${e.slice(0, t - 1).trimEnd()}...`;
|
|
192
174
|
}
|
|
193
|
-
function
|
|
175
|
+
function Te(e, t, n, o) {
|
|
194
176
|
return {
|
|
195
177
|
id: e.id || z(t, o),
|
|
196
178
|
ruleId: e.ruleId || t,
|
|
197
179
|
severity: e.severity || n,
|
|
198
180
|
message: e.message || t,
|
|
199
|
-
excerpt: e.excerpt ?
|
|
181
|
+
excerpt: e.excerpt ? me(e.excerpt, 220) : void 0,
|
|
200
182
|
suggestion: e.suggestion,
|
|
201
183
|
locateText: e.locateText,
|
|
202
184
|
selector: e.selector
|
|
203
185
|
};
|
|
204
186
|
}
|
|
205
|
-
function
|
|
187
|
+
function Ae(e, t) {
|
|
206
188
|
const n = Array.from(e.querySelectorAll("h1, h2, h3, h4, h5, h6")), o = /* @__PURE__ */ new Set();
|
|
207
189
|
return n.forEach((r) => {
|
|
208
190
|
const s = t(r.textContent || "").toLowerCase();
|
|
209
191
|
s && o.add(s);
|
|
210
192
|
}), o;
|
|
211
193
|
}
|
|
212
|
-
function
|
|
194
|
+
function Le(e) {
|
|
213
195
|
const t = e.match(/[^.!?\n]+[.!?]?/g);
|
|
214
196
|
return t ? t.map((n) => n.trim()).filter(Boolean) : [];
|
|
215
197
|
}
|
|
216
|
-
async function
|
|
217
|
-
const o = Ce(e, t.normalizeText), r = e.innerHTML, s = `${o.length}:${
|
|
218
|
-
if (!n &&
|
|
219
|
-
return
|
|
198
|
+
async function v(e, t, n = !1) {
|
|
199
|
+
const o = Ce(e, t.normalizeText), r = e.innerHTML, s = `${o.length}:${ce(o)}:${r.length}:${ce(r)}`;
|
|
200
|
+
if (!n && ae.get(e) === s)
|
|
201
|
+
return C.get(e) || [];
|
|
220
202
|
const a = (Y.get(e) || 0) + 1;
|
|
221
203
|
Y.set(e, a);
|
|
222
|
-
const l =
|
|
204
|
+
const l = ue(o), c = ge(o), u = Se(o), i = [], y = t.labels;
|
|
223
205
|
if (t.bannedWords.length > 0) {
|
|
224
206
|
let w = 0;
|
|
225
207
|
for (const p of t.bannedWords) {
|
|
226
|
-
const g = new RegExp(`\\b${
|
|
208
|
+
const g = new RegExp(`\\b${$e(p)}\\b`, "gi");
|
|
227
209
|
let b = g.exec(o);
|
|
228
210
|
for (; b && !x(i, t.maxIssues); ) {
|
|
229
|
-
const
|
|
211
|
+
const oe = b[0];
|
|
230
212
|
P(
|
|
231
213
|
i,
|
|
232
214
|
{
|
|
233
215
|
id: z("banned-word", w),
|
|
234
216
|
ruleId: "banned-word",
|
|
235
217
|
severity: "error",
|
|
236
|
-
message: `${y.bannedWordMessage}: "${
|
|
237
|
-
locateText:
|
|
218
|
+
message: `${y.bannedWordMessage}: "${oe}"`,
|
|
219
|
+
locateText: oe,
|
|
238
220
|
suggestion: "Replace or remove banned terms."
|
|
239
221
|
},
|
|
240
222
|
t.maxIssues
|
|
241
223
|
), w += 1, b = g.exec(o);
|
|
242
224
|
}
|
|
243
|
-
if (x(i, t.maxIssues))
|
|
244
|
-
break;
|
|
225
|
+
if (x(i, t.maxIssues)) break;
|
|
245
226
|
}
|
|
246
227
|
}
|
|
247
228
|
if (!x(i, t.maxIssues) && t.requiredHeadings.length > 0) {
|
|
248
|
-
const w =
|
|
229
|
+
const w = Ae(e, t.normalizeText);
|
|
249
230
|
let p = 0;
|
|
250
231
|
t.requiredHeadings.forEach((g) => {
|
|
251
|
-
if (x(i, t.maxIssues))
|
|
252
|
-
return;
|
|
232
|
+
if (x(i, t.maxIssues)) return;
|
|
253
233
|
const b = t.normalizeText(g).toLowerCase();
|
|
254
234
|
!b || w.has(b) || (P(
|
|
255
235
|
i,
|
|
@@ -265,12 +245,11 @@ async function C(e, t, n = !1) {
|
|
|
265
245
|
});
|
|
266
246
|
}
|
|
267
247
|
if (!x(i, t.maxIssues)) {
|
|
268
|
-
const w =
|
|
248
|
+
const w = Le(o);
|
|
269
249
|
let p = 0;
|
|
270
250
|
for (const g of w) {
|
|
271
|
-
if (x(i, t.maxIssues))
|
|
272
|
-
|
|
273
|
-
const b = ce(g);
|
|
251
|
+
if (x(i, t.maxIssues)) break;
|
|
252
|
+
const b = ue(g);
|
|
274
253
|
b <= t.maxSentenceWords || (P(
|
|
275
254
|
i,
|
|
276
255
|
{
|
|
@@ -278,7 +257,7 @@ async function C(e, t, n = !1) {
|
|
|
278
257
|
ruleId: "sentence-length",
|
|
279
258
|
severity: "warning",
|
|
280
259
|
message: `${y.sentenceLengthMessage} (${b}/${t.maxSentenceWords} words)`,
|
|
281
|
-
excerpt:
|
|
260
|
+
excerpt: me(g, 200),
|
|
282
261
|
locateText: g.slice(0, 64),
|
|
283
262
|
suggestion: "Split into shorter sentences for readability."
|
|
284
263
|
},
|
|
@@ -307,16 +286,14 @@ async function C(e, t, n = !1) {
|
|
|
307
286
|
readabilityScore: u
|
|
308
287
|
};
|
|
309
288
|
for (const p of t.customRules) {
|
|
310
|
-
if (x(i, t.maxIssues))
|
|
311
|
-
break;
|
|
289
|
+
if (x(i, t.maxIssues)) break;
|
|
312
290
|
try {
|
|
313
291
|
const g = await p.evaluate(w);
|
|
314
|
-
if (!Array.isArray(g))
|
|
315
|
-
continue;
|
|
292
|
+
if (!Array.isArray(g)) continue;
|
|
316
293
|
for (let b = 0; b < g.length && !x(i, t.maxIssues); b += 1)
|
|
317
294
|
P(
|
|
318
295
|
i,
|
|
319
|
-
|
|
296
|
+
Te(g[b], p.id, p.severity || "warning", b),
|
|
320
297
|
t.maxIssues
|
|
321
298
|
);
|
|
322
299
|
} catch (g) {
|
|
@@ -324,13 +301,13 @@ async function C(e, t, n = !1) {
|
|
|
324
301
|
}
|
|
325
302
|
}
|
|
326
303
|
if (Y.get(e) !== a)
|
|
327
|
-
return
|
|
304
|
+
return C.get(e) || [];
|
|
328
305
|
const D = {
|
|
329
306
|
readabilityScore: u,
|
|
330
307
|
wordCount: l,
|
|
331
308
|
sentenceCount: c
|
|
332
309
|
};
|
|
333
|
-
return
|
|
310
|
+
return ae.set(e, s), C.set(e, i), fe.set(e, D), te(e), e.dispatchEvent(
|
|
334
311
|
new CustomEvent("editora:content-rules-audit", {
|
|
335
312
|
bubbles: !0,
|
|
336
313
|
detail: {
|
|
@@ -340,17 +317,17 @@ async function C(e, t, n = !1) {
|
|
|
340
317
|
})
|
|
341
318
|
), i;
|
|
342
319
|
}
|
|
343
|
-
function
|
|
320
|
+
function Ie(e) {
|
|
344
321
|
return e.reduce(
|
|
345
322
|
(t, n) => (t[n.severity] += 1, t),
|
|
346
323
|
{ error: 0, warning: 0, info: 0 }
|
|
347
324
|
);
|
|
348
325
|
}
|
|
349
|
-
function
|
|
326
|
+
function He(e) {
|
|
350
327
|
return e === "error" ? "Error" : e === "warning" ? "Warning" : "Info";
|
|
351
328
|
}
|
|
352
329
|
function $(e, t, n) {
|
|
353
|
-
const o =
|
|
330
|
+
const o = Re(e);
|
|
354
331
|
Array.from(
|
|
355
332
|
o.querySelectorAll(
|
|
356
333
|
`.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`
|
|
@@ -363,20 +340,17 @@ function U(e) {
|
|
|
363
340
|
return B.get(e) === !0;
|
|
364
341
|
}
|
|
365
342
|
function J(e, t) {
|
|
366
|
-
if (!t.classList.contains("show"))
|
|
367
|
-
return;
|
|
343
|
+
if (!t.classList.contains("show")) return;
|
|
368
344
|
const o = X(e).getBoundingClientRect(), r = Math.min(window.innerWidth - 20, 360);
|
|
369
345
|
t.style.width = `${r}px`, t.style.maxHeight = `${Math.max(220, window.innerHeight - 24)}px`;
|
|
370
346
|
const s = Math.max(10, o.right - r), a = Math.max(10, window.innerWidth - r - 10), l = Math.min(s, a), c = Math.max(10, Math.min(window.innerHeight - 10 - 240, o.top + 10));
|
|
371
347
|
t.style.left = `${l}px`, t.style.top = `${c}px`;
|
|
372
348
|
}
|
|
373
|
-
function
|
|
349
|
+
function de(e, t) {
|
|
374
350
|
const n = t.trim().toLowerCase();
|
|
375
|
-
if (!n)
|
|
376
|
-
return !1;
|
|
351
|
+
if (!n) return !1;
|
|
377
352
|
const o = window.getSelection();
|
|
378
|
-
if (!o)
|
|
379
|
-
return !1;
|
|
353
|
+
if (!o) return !1;
|
|
380
354
|
const r = document.createTreeWalker(e, NodeFilter.SHOW_TEXT, null);
|
|
381
355
|
let s = r.nextNode();
|
|
382
356
|
for (; s; ) {
|
|
@@ -391,16 +365,16 @@ function ue(e, t) {
|
|
|
391
365
|
}
|
|
392
366
|
return !1;
|
|
393
367
|
}
|
|
394
|
-
function
|
|
368
|
+
function We(e, t) {
|
|
395
369
|
if (t.selector) {
|
|
396
370
|
const n = e.querySelector(t.selector);
|
|
397
371
|
if (n)
|
|
398
372
|
return n.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), n.focus({ preventScroll: !0 }), !0;
|
|
399
373
|
}
|
|
400
|
-
return !!(t.locateText &&
|
|
374
|
+
return !!(t.locateText && de(e, t.locateText) || t.excerpt && de(e, t.excerpt.slice(0, 64)));
|
|
401
375
|
}
|
|
402
|
-
function
|
|
403
|
-
return (
|
|
376
|
+
function Oe(e, t) {
|
|
377
|
+
return (C.get(e) || []).find((o) => o.id === t);
|
|
404
378
|
}
|
|
405
379
|
function A(e, t) {
|
|
406
380
|
const n = T.get(e);
|
|
@@ -408,26 +382,20 @@ function A(e, t) {
|
|
|
408
382
|
}
|
|
409
383
|
function O(e, t, n) {
|
|
410
384
|
const o = t.querySelector('[data-action="toggle-realtime"]');
|
|
411
|
-
if (!o)
|
|
412
|
-
return;
|
|
385
|
+
if (!o) return;
|
|
413
386
|
const r = A(e, n);
|
|
414
387
|
o.textContent = r ? n.labels.realtimeOnText : n.labels.realtimeOffText, o.setAttribute("aria-pressed", r ? "true" : "false"), $(e, "toggleContentRulesRealtime", r);
|
|
415
388
|
}
|
|
416
389
|
function te(e) {
|
|
417
390
|
const t = h.get(e);
|
|
418
|
-
if (!t)
|
|
419
|
-
return;
|
|
391
|
+
if (!t) return;
|
|
420
392
|
const n = d.get(e) || E;
|
|
421
|
-
if (!n)
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
readabilityScore: 100,
|
|
425
|
-
wordCount: 0,
|
|
426
|
-
sentenceCount: 0
|
|
393
|
+
if (!n) return;
|
|
394
|
+
const o = C.get(e) || [], r = fe.get(e) || {
|
|
395
|
+
readabilityScore: 100
|
|
427
396
|
}, s = t.querySelector(".rte-content-rules-count"), a = t.querySelector(".rte-content-rules-summary"), l = t.querySelector(".rte-content-rules-list"), c = t.querySelector(".rte-content-rules-live");
|
|
428
|
-
if (!s || !a || !l || !c)
|
|
429
|
-
|
|
430
|
-
const u = Le(o);
|
|
397
|
+
if (!s || !a || !l || !c) return;
|
|
398
|
+
const u = Ie(o);
|
|
431
399
|
if (s.textContent = String(o.length), a.textContent = `${n.labels.summaryPrefix}: ${o.length} | Error ${u.error} | Warning ${u.warning} | Info ${u.info} | Readability ${r.readabilityScore.toFixed(1)}`, c.textContent = `${o.length} issues. ${u.error} errors, ${u.warning} warnings, ${u.info} info.`, o.length === 0) {
|
|
432
400
|
l.innerHTML = `<li class="rte-content-rules-empty">${k(n.labels.noIssuesText)}</li>`;
|
|
433
401
|
return;
|
|
@@ -444,7 +412,7 @@ function te(e) {
|
|
|
444
412
|
data-role="issue-button"
|
|
445
413
|
aria-label="${k(w)}"
|
|
446
414
|
>
|
|
447
|
-
<span class="rte-content-rules-badge">${k(
|
|
415
|
+
<span class="rte-content-rules-badge">${k(He(i.severity))}</span>
|
|
448
416
|
<span class="rte-content-rules-message">${k(i.message)}</span>
|
|
449
417
|
</button>
|
|
450
418
|
${y}
|
|
@@ -457,16 +425,15 @@ function W(e, t = !1) {
|
|
|
457
425
|
const n = h.get(e);
|
|
458
426
|
n && (n.classList.remove("show"), B.set(e, !1), $(e, "toggleContentRulesPanel", !1), t && e.focus({ preventScroll: !0 }));
|
|
459
427
|
}
|
|
460
|
-
function
|
|
428
|
+
function qe(e) {
|
|
461
429
|
h.forEach((t, n) => {
|
|
462
430
|
n !== e && W(n, !1);
|
|
463
431
|
});
|
|
464
432
|
}
|
|
465
|
-
function
|
|
433
|
+
function Pe(e) {
|
|
466
434
|
const t = h.get(e);
|
|
467
|
-
if (t)
|
|
468
|
-
|
|
469
|
-
const n = d.get(e) || E || j(), o = `rte-content-rules-panel-${pe++}`, r = document.createElement("section");
|
|
435
|
+
if (t) return t;
|
|
436
|
+
const n = d.get(e) || E || j(), o = `rte-content-rules-panel-${xe++}`, r = document.createElement("section");
|
|
470
437
|
return r.className = f, r.id = o, r.setAttribute("role", "dialog"), r.setAttribute("aria-modal", "false"), r.setAttribute("aria-label", n.labels.panelAriaLabel), r.innerHTML = `
|
|
471
438
|
<header class="rte-content-rules-header">
|
|
472
439
|
<h2 class="rte-content-rules-title">${k(n.labels.panelTitle)}</h2>
|
|
@@ -487,8 +454,7 @@ function qe(e) {
|
|
|
487
454
|
</div>
|
|
488
455
|
`, r.addEventListener("click", (s) => {
|
|
489
456
|
const a = s.target, l = a == null ? void 0 : a.closest("[data-action]");
|
|
490
|
-
if (!l)
|
|
491
|
-
return;
|
|
457
|
+
if (!l) return;
|
|
492
458
|
const c = l.getAttribute("data-action");
|
|
493
459
|
if (c) {
|
|
494
460
|
if (c === "close") {
|
|
@@ -497,22 +463,21 @@ function qe(e) {
|
|
|
497
463
|
}
|
|
498
464
|
if (c === "run-audit") {
|
|
499
465
|
const u = d.get(e) || E || n;
|
|
500
|
-
|
|
466
|
+
v(e, u, !0);
|
|
501
467
|
return;
|
|
502
468
|
}
|
|
503
469
|
if (c === "toggle-realtime") {
|
|
504
470
|
const i = !A(e, d.get(e) || E || n);
|
|
505
471
|
if (T.set(e, i), O(e, r, d.get(e) || E || n), i) {
|
|
506
472
|
const y = d.get(e) || E || n;
|
|
507
|
-
|
|
473
|
+
v(e, y, !0);
|
|
508
474
|
}
|
|
509
475
|
return;
|
|
510
476
|
}
|
|
511
477
|
if (c === "focus-issue") {
|
|
512
|
-
const u = l.getAttribute("data-issue-id") || "", i =
|
|
513
|
-
if (!i)
|
|
514
|
-
|
|
515
|
-
He(e, i), W(e, !1);
|
|
478
|
+
const u = l.getAttribute("data-issue-id") || "", i = Oe(e, u);
|
|
479
|
+
if (!i) return;
|
|
480
|
+
We(e, i), W(e, !1);
|
|
516
481
|
}
|
|
517
482
|
}
|
|
518
483
|
}), r.addEventListener("keydown", (s) => {
|
|
@@ -520,22 +485,19 @@ function qe(e) {
|
|
|
520
485
|
s.preventDefault(), W(e, !0);
|
|
521
486
|
return;
|
|
522
487
|
}
|
|
523
|
-
if (s.key !== "ArrowDown" && s.key !== "ArrowUp")
|
|
524
|
-
return;
|
|
488
|
+
if (s.key !== "ArrowDown" && s.key !== "ArrowUp") return;
|
|
525
489
|
const a = Array.from(r.querySelectorAll('[data-role="issue-button"]'));
|
|
526
|
-
if (a.length === 0)
|
|
527
|
-
return;
|
|
490
|
+
if (a.length === 0) return;
|
|
528
491
|
const l = document.activeElement, c = a.findIndex((y) => y === l);
|
|
529
|
-
if (c === -1)
|
|
530
|
-
return;
|
|
492
|
+
if (c === -1) return;
|
|
531
493
|
s.preventDefault();
|
|
532
494
|
const u = s.key === "ArrowDown" ? 1 : -1, i = (c + u + a.length) % a.length;
|
|
533
495
|
a[i].focus();
|
|
534
496
|
}), G(r, e), document.body.appendChild(r), h.set(e, r), B.set(e, !1), O(e, r, n), r;
|
|
535
497
|
}
|
|
536
498
|
function ne(e) {
|
|
537
|
-
const t =
|
|
538
|
-
|
|
499
|
+
const t = Pe(e);
|
|
500
|
+
qe(e), t.classList.add("show"), B.set(e, !0), G(t, e), J(e, t), te(e), $(e, "toggleContentRulesPanel", !0);
|
|
539
501
|
const n = t.querySelector('[data-action="run-audit"]');
|
|
540
502
|
n == null || n.focus();
|
|
541
503
|
}
|
|
@@ -543,37 +505,38 @@ function Q(e, t) {
|
|
|
543
505
|
const n = U(e);
|
|
544
506
|
return (typeof t == "boolean" ? t : !n) ? ne(e) : W(e, !1), !0;
|
|
545
507
|
}
|
|
546
|
-
function
|
|
508
|
+
function be(e) {
|
|
547
509
|
const t = V.get(e);
|
|
548
510
|
typeof t == "number" && (window.clearTimeout(t), _.delete(t), V.delete(e));
|
|
549
511
|
}
|
|
550
|
-
function
|
|
512
|
+
function he(e) {
|
|
551
513
|
const t = d.get(e) || E;
|
|
552
|
-
if (!t || !A(e, t))
|
|
553
|
-
|
|
554
|
-
me(e);
|
|
514
|
+
if (!t || !A(e, t)) return;
|
|
515
|
+
be(e);
|
|
555
516
|
const n = window.setTimeout(() => {
|
|
556
|
-
_.delete(n), V.delete(e),
|
|
517
|
+
_.delete(n), V.delete(e), v(e, t, !1);
|
|
557
518
|
}, t.debounceMs);
|
|
558
519
|
_.add(n), V.set(e, n);
|
|
559
520
|
}
|
|
560
|
-
function
|
|
561
|
-
|
|
562
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "r";
|
|
521
|
+
function re(e) {
|
|
522
|
+
return typeof e.key == "string" ? e.key.toLowerCase() : "";
|
|
563
523
|
}
|
|
564
524
|
function ze(e) {
|
|
565
|
-
const t = e
|
|
566
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "
|
|
525
|
+
const t = re(e);
|
|
526
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "r";
|
|
567
527
|
}
|
|
568
528
|
function _e(e) {
|
|
569
|
-
const t = e
|
|
529
|
+
const t = re(e);
|
|
530
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "l";
|
|
531
|
+
}
|
|
532
|
+
function Be(e) {
|
|
533
|
+
const t = re(e);
|
|
570
534
|
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "t";
|
|
571
535
|
}
|
|
572
|
-
function
|
|
573
|
-
if (typeof document == "undefined" || document.getElementById(
|
|
574
|
-
return;
|
|
536
|
+
function De() {
|
|
537
|
+
if (typeof document == "undefined" || document.getElementById(le)) return;
|
|
575
538
|
const e = document.createElement("style");
|
|
576
|
-
e.id =
|
|
539
|
+
e.id = le, e.textContent = `
|
|
577
540
|
.rte-toolbar-group-items.content-rules,
|
|
578
541
|
.editora-toolbar-group-items.content-rules {
|
|
579
542
|
display: flex;
|
|
@@ -948,29 +911,25 @@ function Be() {
|
|
|
948
911
|
}
|
|
949
912
|
`, document.head.appendChild(e);
|
|
950
913
|
}
|
|
951
|
-
function
|
|
914
|
+
function Ne(e) {
|
|
952
915
|
E = e, L || (L = (t) => {
|
|
953
916
|
const n = t.target, o = n == null ? void 0 : n.closest(R);
|
|
954
|
-
if (!o)
|
|
955
|
-
|
|
956
|
-
m = o, d.has(o) || d.set(o, e), v.has(o) || v.set(o, []), T.has(o) || T.set(o, e.enableRealtime);
|
|
917
|
+
if (!o) return;
|
|
918
|
+
m = o, d.has(o) || d.set(o, e), C.has(o) || C.set(o, []), T.has(o) || T.set(o, e.enableRealtime);
|
|
957
919
|
const r = h.get(o);
|
|
958
920
|
r && (G(r, o), J(o, r), O(o, r, d.get(o) || e)), $(o, "toggleContentRulesPanel", U(o)), $(o, "toggleContentRulesRealtime", A(o, e));
|
|
959
921
|
}, document.addEventListener("focusin", L, !0)), I || (I = (t) => {
|
|
960
922
|
const n = t.target, o = n == null ? void 0 : n.closest(R);
|
|
961
|
-
o && (m = o,
|
|
923
|
+
o && (m = o, he(o));
|
|
962
924
|
}, document.addEventListener("input", I, !0)), H || (H = (t) => {
|
|
963
|
-
if (t.defaultPrevented)
|
|
964
|
-
return;
|
|
925
|
+
if (t.defaultPrevented) return;
|
|
965
926
|
const n = t.target;
|
|
966
|
-
if (n != null && n.closest("input, textarea, select"))
|
|
967
|
-
|
|
968
|
-
const o = t.key === "Escape", r = Pe(t), s = ze(t), a = _e(t);
|
|
927
|
+
if (n != null && n.closest("input, textarea, select")) return;
|
|
928
|
+
const o = t.key === "Escape", r = ze(t), s = _e(t), a = Be(t);
|
|
969
929
|
if (!o && !r && !s && !a)
|
|
970
930
|
return;
|
|
971
931
|
const l = M(void 0, !1);
|
|
972
|
-
if (!l || Z(l))
|
|
973
|
-
return;
|
|
932
|
+
if (!l || Z(l)) return;
|
|
974
933
|
const c = d.get(l) || E || e;
|
|
975
934
|
if (d.set(l, c), m = l, o && U(l)) {
|
|
976
935
|
t.preventDefault(), W(l, !0);
|
|
@@ -981,7 +940,7 @@ function De(e) {
|
|
|
981
940
|
return;
|
|
982
941
|
}
|
|
983
942
|
if (s) {
|
|
984
|
-
t.preventDefault(), t.stopPropagation(),
|
|
943
|
+
t.preventDefault(), t.stopPropagation(), v(l, c, !0), ne(l);
|
|
985
944
|
return;
|
|
986
945
|
}
|
|
987
946
|
if (a) {
|
|
@@ -989,26 +948,26 @@ function De(e) {
|
|
|
989
948
|
const u = !A(l, c);
|
|
990
949
|
T.set(l, u);
|
|
991
950
|
const i = h.get(l);
|
|
992
|
-
i && O(l, i, c), $(l, "toggleContentRulesRealtime", u), u &&
|
|
951
|
+
i && O(l, i, c), $(l, "toggleContentRulesRealtime", u), u && v(l, c, !0);
|
|
993
952
|
}
|
|
994
953
|
}, document.addEventListener("keydown", H, !0)), S || (S = () => {
|
|
995
954
|
h.forEach((t, n) => {
|
|
996
955
|
if (!n.isConnected || !t.isConnected) {
|
|
997
|
-
|
|
956
|
+
be(n), t.remove(), h.delete(n), B.delete(n);
|
|
998
957
|
return;
|
|
999
958
|
}
|
|
1000
959
|
G(t, n), J(n, t);
|
|
1001
960
|
});
|
|
1002
961
|
}, window.addEventListener("scroll", S, !0), window.addEventListener("resize", S));
|
|
1003
962
|
}
|
|
1004
|
-
function
|
|
963
|
+
function Ke() {
|
|
1005
964
|
L && (document.removeEventListener("focusin", L, !0), L = null), I && (document.removeEventListener("input", I, !0), I = null), H && (document.removeEventListener("keydown", H, !0), H = null), S && (window.removeEventListener("scroll", S, !0), window.removeEventListener("resize", S), S = null), h.forEach((e) => {
|
|
1006
965
|
e.remove();
|
|
1007
966
|
}), h.clear(), E = null, m = null;
|
|
1008
967
|
}
|
|
1009
|
-
const
|
|
968
|
+
const je = (e = {}) => {
|
|
1010
969
|
const t = j(e);
|
|
1011
|
-
return
|
|
970
|
+
return De(), {
|
|
1012
971
|
name: "contentRules",
|
|
1013
972
|
toolbar: [
|
|
1014
973
|
{
|
|
@@ -1044,46 +1003,41 @@ const Ke = (e = {}) => {
|
|
|
1044
1003
|
commands: {
|
|
1045
1004
|
contentRules: (n, o) => {
|
|
1046
1005
|
const r = M(o);
|
|
1047
|
-
if (!r || Z(r))
|
|
1048
|
-
return !1;
|
|
1006
|
+
if (!r || Z(r)) return !1;
|
|
1049
1007
|
const s = d.get(r) || t;
|
|
1050
|
-
return d.set(r, s), m = r, Q(r, !0),
|
|
1008
|
+
return d.set(r, s), m = r, Q(r, !0), v(r, s, !1), !0;
|
|
1051
1009
|
},
|
|
1052
1010
|
toggleContentRulesPanel: (n, o) => {
|
|
1053
1011
|
const r = M(o);
|
|
1054
|
-
if (!r || Z(r))
|
|
1055
|
-
return !1;
|
|
1012
|
+
if (!r || Z(r)) return !1;
|
|
1056
1013
|
m = r;
|
|
1057
1014
|
const s = d.get(r) || t;
|
|
1058
1015
|
d.set(r, s);
|
|
1059
1016
|
const a = Q(r, typeof n == "boolean" ? n : void 0);
|
|
1060
|
-
return U(r) &&
|
|
1017
|
+
return U(r) && v(r, s, !1), a;
|
|
1061
1018
|
},
|
|
1062
1019
|
runContentRulesAudit: async (n, o) => {
|
|
1063
1020
|
const r = M(o);
|
|
1064
|
-
if (!r)
|
|
1065
|
-
return !1;
|
|
1021
|
+
if (!r) return !1;
|
|
1066
1022
|
m = r;
|
|
1067
1023
|
const s = d.get(r) || t;
|
|
1068
|
-
return d.set(r, s), await
|
|
1024
|
+
return d.set(r, s), await v(r, s, !0), ne(r), !0;
|
|
1069
1025
|
},
|
|
1070
1026
|
toggleContentRulesRealtime: (n, o) => {
|
|
1071
1027
|
const r = M(o);
|
|
1072
|
-
if (!r)
|
|
1073
|
-
return !1;
|
|
1028
|
+
if (!r) return !1;
|
|
1074
1029
|
m = r;
|
|
1075
1030
|
const s = d.get(r) || t;
|
|
1076
1031
|
d.set(r, s);
|
|
1077
1032
|
const a = typeof n == "boolean" ? n : !A(r, s);
|
|
1078
1033
|
T.set(r, a);
|
|
1079
1034
|
const l = h.get(r);
|
|
1080
|
-
return l && O(r, l, s), $(r, "toggleContentRulesRealtime", a), a &&
|
|
1035
|
+
return l && O(r, l, s), $(r, "toggleContentRulesRealtime", a), a && v(r, s, !0), !0;
|
|
1081
1036
|
},
|
|
1082
1037
|
getContentRulesIssues: (n, o) => {
|
|
1083
1038
|
const r = M(o);
|
|
1084
|
-
if (!r)
|
|
1085
|
-
|
|
1086
|
-
const s = v.get(r) || [];
|
|
1039
|
+
if (!r) return !1;
|
|
1040
|
+
const s = C.get(r) || [];
|
|
1087
1041
|
if (typeof n == "function")
|
|
1088
1042
|
try {
|
|
1089
1043
|
n(s);
|
|
@@ -1098,8 +1052,7 @@ const Ke = (e = {}) => {
|
|
|
1098
1052
|
},
|
|
1099
1053
|
setContentRulesOptions: (n, o) => {
|
|
1100
1054
|
const r = M(o);
|
|
1101
|
-
if (!r || !n || typeof n != "object")
|
|
1102
|
-
return !1;
|
|
1055
|
+
if (!r || !n || typeof n != "object") return !1;
|
|
1103
1056
|
const s = d.get(r) || t, a = j({
|
|
1104
1057
|
...s,
|
|
1105
1058
|
...n,
|
|
@@ -1108,7 +1061,7 @@ const Ke = (e = {}) => {
|
|
|
1108
1061
|
...n.labels || {}
|
|
1109
1062
|
}
|
|
1110
1063
|
});
|
|
1111
|
-
d.set(r, a), typeof n.enableRealtime == "boolean" && T.set(r, n.enableRealtime), A(r, a) &&
|
|
1064
|
+
d.set(r, a), typeof n.enableRealtime == "boolean" && T.set(r, n.enableRealtime), A(r, a) && v(r, a, !0);
|
|
1112
1065
|
const l = h.get(r);
|
|
1113
1066
|
if (l) {
|
|
1114
1067
|
l.setAttribute("aria-label", a.labels.panelAriaLabel);
|
|
@@ -1129,21 +1082,21 @@ const Ke = (e = {}) => {
|
|
|
1129
1082
|
init: function(o) {
|
|
1130
1083
|
N += 1;
|
|
1131
1084
|
const r = this && typeof this.__pluginConfig == "object" ? j({ ...t, ...this.__pluginConfig }) : t;
|
|
1132
|
-
|
|
1085
|
+
Ne(r);
|
|
1133
1086
|
const s = M(
|
|
1134
1087
|
o && o.editorElement ? { editorElement: o.editorElement } : void 0,
|
|
1135
1088
|
!1
|
|
1136
1089
|
);
|
|
1137
|
-
s && (m = s, d.set(s, r), T.set(s, r.enableRealtime),
|
|
1090
|
+
s && (m = s, d.set(s, r), T.set(s, r.enableRealtime), C.set(s, []), $(s, "toggleContentRulesPanel", !1), $(s, "toggleContentRulesRealtime", r.enableRealtime), r.enableRealtime && he(s));
|
|
1138
1091
|
},
|
|
1139
1092
|
destroy: () => {
|
|
1140
1093
|
N = Math.max(0, N - 1), !(N > 0) && (_.forEach((n) => {
|
|
1141
1094
|
window.clearTimeout(n);
|
|
1142
|
-
}), _.clear(),
|
|
1095
|
+
}), _.clear(), Ke());
|
|
1143
1096
|
}
|
|
1144
1097
|
};
|
|
1145
1098
|
};
|
|
1146
1099
|
export {
|
|
1147
|
-
|
|
1100
|
+
je as ContentRulesPlugin
|
|
1148
1101
|
};
|
|
1149
|
-
//# sourceMappingURL=ContentRulesPlugin.native-
|
|
1102
|
+
//# sourceMappingURL=ContentRulesPlugin.native-vPx5nC73.mjs.map
|