@editora/plugins 1.0.9 → 1.0.10
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 +5 -0
- package/dist/_commonjsHelpers-6763f629.js +1 -0
- package/dist/_commonjsHelpers-c5d32002.mjs +30 -0
- package/dist/a11y-checker.cjs.js +12 -12
- package/dist/a11y-checker.esm.js +98 -80
- package/dist/anchor.cjs.js +12 -12
- package/dist/anchor.esm.js +128 -115
- package/dist/anchoredPopover-33f1358d.mjs +109 -0
- package/dist/anchoredPopover-8151d535.js +1 -0
- package/dist/approval-workflow.cjs.js +40 -40
- package/dist/approval-workflow.esm.js +249 -208
- package/dist/background-color.cjs.js +2 -2
- package/dist/background-color.esm.js +68 -55
- package/dist/blockquote.esm.js +2 -1
- package/dist/blocks-library.cjs.js +45 -45
- package/dist/blocks-library.esm.js +245 -178
- package/dist/capitalization.esm.js +2 -1
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +82 -58
- package/dist/citations.cjs.js +37 -37
- package/dist/citations.esm.js +512 -439
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/clear-formatting.esm.js +33 -27
- package/dist/code-sample.cjs.js +14 -14
- package/dist/code-sample.esm.js +93 -82
- package/dist/code.cjs.js +32 -32
- package/dist/code.esm.js +653 -594
- package/dist/comments.cjs.js +6 -6
- package/dist/comments.esm.js +158 -116
- package/dist/conditional-content.cjs.js +90 -90
- package/dist/conditional-content.esm.js +432 -371
- package/dist/content-rules.cjs.js +7 -7
- package/dist/content-rules.esm.js +159 -105
- package/dist/data-binding.cjs.js +46 -46
- package/dist/data-binding.esm.js +368 -328
- package/dist/direction.esm.js +18 -9
- package/dist/doc-schema.cjs.js +29 -29
- package/dist/doc-schema.esm.js +308 -240
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +5 -4
- package/dist/documentManager-25b6203c.mjs +9122 -0
- package/dist/documentManager-b69e7054.js +17 -0
- package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +2 -1
- package/dist/embed-iframe.cjs.js +4 -4
- package/dist/embed-iframe.esm.js +81 -73
- package/dist/emojis.cjs.js +8 -8
- package/dist/emojis.esm.js +77 -65
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +56 -54
- package/dist/font-family.cjs.js +1 -1
- package/dist/font-family.esm.js +47 -39
- package/dist/font-size.cjs.js +1 -1
- package/dist/font-size.esm.js +53 -37
- package/dist/footnote.cjs.js +2 -2
- package/dist/footnote.esm.js +117 -76
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +92 -70
- package/dist/html2canvas.esm-09133e29.js +22 -0
- package/dist/{html2canvas.esm-BWVIUcAF.mjs → html2canvas.esm-1a1724a1.mjs} +225 -141
- package/dist/indent.cjs.js +1 -1
- package/dist/indent.esm.js +24 -12
- package/dist/index-656d224b.js +231 -0
- package/dist/index-6a8c48bb.js +1 -0
- package/dist/index-d027b7e2.mjs +16859 -0
- package/dist/{index-BFsKNTTj.mjs → index-f04538f2.mjs} +71 -70
- package/dist/index.cjs.js +1 -1
- package/dist/index.es-730f2d98.mjs +5775 -0
- package/dist/index.es-dd40173b.js +18 -0
- package/dist/index.esm.js +128 -125
- package/dist/italic.cjs.js +1 -1
- package/dist/italic.esm.js +9 -8
- package/dist/jspdf.es.min-90db2c97.js +243 -0
- package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-c36a4fd8.mjs} +4682 -3658
- package/dist/line-height.cjs.js +1 -1
- package/dist/line-height.esm.js +24 -11
- package/dist/link.cjs.js +5 -5
- package/dist/link.esm.js +30 -24
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +25 -20
- package/dist/lite.cjs.js +1 -1
- package/dist/lite.esm.js +61 -59
- package/dist/math.cjs.js +21 -21
- package/dist/math.esm.js +146 -139
- package/dist/media-manager.cjs.js +38 -38
- package/dist/media-manager.esm.js +325 -308
- package/dist/mentions.cjs.js +9 -9
- package/dist/mentions.esm.js +286 -238
- package/dist/merge-tag.cjs.js +2 -2
- package/dist/merge-tag.esm.js +216 -177
- package/dist/page-break.cjs.js +2 -2
- package/dist/page-break.esm.js +49 -33
- package/dist/pii-redaction.cjs.js +19 -19
- package/dist/pii-redaction.esm.js +463 -393
- package/dist/preview.esm.js +10 -5
- package/dist/print.cjs.js +4 -4
- package/dist/print.esm.js +20 -17
- package/dist/{purify.es-DHhaBdbu.mjs → purify.es-35a15df8.mjs} +19 -9
- package/dist/{purify.es-T2a3nLiC.js → purify.es-a8d731c6.js} +1 -1
- package/dist/slash-commands.cjs.js +3 -3
- package/dist/slash-commands.esm.js +212 -176
- package/dist/smart-paste.cjs.js +27 -27
- package/dist/smart-paste.esm.js +336 -280
- package/dist/special-characters.cjs.js +7 -7
- package/dist/special-characters.esm.js +69 -61
- package/dist/spell-check.cjs.js +5 -5
- package/dist/spell-check.esm.js +123 -97
- package/dist/strikethrough.cjs.js +1 -1
- package/dist/strikethrough.esm.js +19 -14
- package/dist/style.css +1 -0
- package/dist/table.cjs.js +4 -4
- package/dist/table.esm.js +225 -191
- package/dist/template.cjs.js +11 -11
- package/dist/template.esm.js +153 -124
- package/dist/text-alignment.cjs.js +1 -1
- package/dist/text-alignment.esm.js +27 -21
- package/dist/text-color.cjs.js +3 -3
- package/dist/text-color.esm.js +87 -70
- package/dist/track-changes.cjs.js +2 -2
- package/dist/track-changes.esm.js +162 -100
- package/dist/translation-workflow.cjs.js +74 -74
- package/dist/translation-workflow.esm.js +678 -602
- package/dist/version-diff.cjs.js +14 -14
- package/dist/version-diff.esm.js +157 -128
- package/package.json +13 -7
- package/LICENSE +0 -21
- package/dist/_commonjsHelpers-BH3jXuIh.js +0 -1
- package/dist/_commonjsHelpers-ByX85dGu.mjs +0 -33
- package/dist/anchoredPopover-BzqGPOAE.js +0 -1
- package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
- package/dist/documentManager-CTqRftU8.mjs +0 -8369
- package/dist/documentManager-Jf0RbSks.js +0 -17
- package/dist/html2canvas.esm-B5qzocYs.js +0 -5
- package/dist/index-CvJk4DKa.js +0 -221
- package/dist/index-D3CycEFU.mjs +0 -16543
- package/dist/index-tqLTHcO6.js +0 -1
- package/dist/index.es-CE_A4QSm.js +0 -5
- package/dist/index.es-DQ78mYYo.mjs +0 -6665
- package/dist/jspdf.es.min-BoS80556.js +0 -77
- package/dist/plugins.css +0 -1
- /package/dist/{editorContainerHelpers-CFbfiOJI.js → editorContainerHelpers-36b8ddf3.js} +0 -0
|
@@ -27,7 +27,8 @@ function ye(e) {
|
|
|
27
27
|
return e.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
|
|
28
28
|
}
|
|
29
29
|
function ae(e) {
|
|
30
|
-
if (!e)
|
|
30
|
+
if (!e)
|
|
31
|
+
return [];
|
|
31
32
|
const t = /* @__PURE__ */ new Set();
|
|
32
33
|
return e.forEach((n) => {
|
|
33
34
|
const o = n.trim();
|
|
@@ -52,22 +53,28 @@ function X(e) {
|
|
|
52
53
|
return e.closest(ee) || e;
|
|
53
54
|
}
|
|
54
55
|
function F(e) {
|
|
55
|
-
if (!e)
|
|
56
|
-
|
|
56
|
+
if (!e)
|
|
57
|
+
return null;
|
|
58
|
+
if (e.matches(R))
|
|
59
|
+
return e;
|
|
57
60
|
const t = e.querySelector(R);
|
|
58
61
|
return t instanceof HTMLElement ? t : null;
|
|
59
62
|
}
|
|
60
63
|
function we() {
|
|
61
|
-
if (typeof window > "u")
|
|
64
|
+
if (typeof window > "u")
|
|
65
|
+
return null;
|
|
62
66
|
const e = window[oe];
|
|
63
|
-
if (!(e instanceof HTMLElement))
|
|
67
|
+
if (!(e instanceof HTMLElement))
|
|
68
|
+
return null;
|
|
64
69
|
window[oe] = null;
|
|
65
70
|
const t = F(e);
|
|
66
|
-
if (t)
|
|
71
|
+
if (t)
|
|
72
|
+
return t;
|
|
67
73
|
const n = e.closest(ee);
|
|
68
74
|
if (n) {
|
|
69
75
|
const o = F(n);
|
|
70
|
-
if (o)
|
|
76
|
+
if (o)
|
|
77
|
+
return o;
|
|
71
78
|
}
|
|
72
79
|
return null;
|
|
73
80
|
}
|
|
@@ -88,7 +95,8 @@ function K(e) {
|
|
|
88
95
|
}
|
|
89
96
|
function Re(e) {
|
|
90
97
|
const t = X(e);
|
|
91
|
-
if (K(t))
|
|
98
|
+
if (K(t))
|
|
99
|
+
return !0;
|
|
92
100
|
const n = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
93
101
|
return K(n) ? !0 : K(document.documentElement) || K(document.body);
|
|
94
102
|
}
|
|
@@ -99,25 +107,32 @@ function Ee(e) {
|
|
|
99
107
|
return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
|
|
100
108
|
}
|
|
101
109
|
function M(e, t = !0) {
|
|
102
|
-
if (e
|
|
103
|
-
|
|
110
|
+
if ((e == null ? void 0 : e.contentElement) instanceof HTMLElement)
|
|
111
|
+
return e.contentElement;
|
|
112
|
+
if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
|
|
104
113
|
const s = e.editorElement;
|
|
105
|
-
if (s.matches(R))
|
|
106
|
-
|
|
107
|
-
|
|
114
|
+
if (s.matches(R))
|
|
115
|
+
return s;
|
|
116
|
+
const a = s.querySelector(R);
|
|
117
|
+
if (a instanceof HTMLElement)
|
|
118
|
+
return a;
|
|
108
119
|
}
|
|
109
120
|
const n = we();
|
|
110
|
-
if (n)
|
|
121
|
+
if (n)
|
|
122
|
+
return n;
|
|
111
123
|
const o = window.getSelection();
|
|
112
124
|
if (o && o.rangeCount > 0) {
|
|
113
|
-
const s = o.getRangeAt(0).startContainer,
|
|
114
|
-
if (l)
|
|
125
|
+
const s = o.getRangeAt(0).startContainer, a = Ee(s), l = a == null ? void 0 : a.closest(R);
|
|
126
|
+
if (l)
|
|
127
|
+
return l;
|
|
115
128
|
}
|
|
116
129
|
const r = document.activeElement;
|
|
117
130
|
if (r) {
|
|
118
|
-
if (r.matches(R))
|
|
131
|
+
if (r.matches(R))
|
|
132
|
+
return r;
|
|
119
133
|
const s = r.closest(R);
|
|
120
|
-
if (s)
|
|
134
|
+
if (s)
|
|
135
|
+
return s;
|
|
121
136
|
}
|
|
122
137
|
return g && g.isConnected ? g : (g && !g.isConnected && (g = null), t ? document.querySelector(R) : null);
|
|
123
138
|
}
|
|
@@ -147,16 +162,19 @@ function fe(e) {
|
|
|
147
162
|
}
|
|
148
163
|
function $e(e) {
|
|
149
164
|
const t = e.toLowerCase().replace(/[^a-z]/g, "");
|
|
150
|
-
if (!t)
|
|
151
|
-
|
|
165
|
+
if (!t)
|
|
166
|
+
return 0;
|
|
167
|
+
if (t.length <= 3)
|
|
168
|
+
return 1;
|
|
152
169
|
const n = t.match(/[aeiouy]+/g);
|
|
153
170
|
let o = n ? n.length : 1;
|
|
154
171
|
return t.endsWith("e") && (o -= 1), Math.max(1, o);
|
|
155
172
|
}
|
|
156
173
|
function Me(e) {
|
|
157
174
|
const t = e.match(/\b[\w'-]+\b/g) || [], n = t.length;
|
|
158
|
-
if (n === 0)
|
|
159
|
-
|
|
175
|
+
if (n === 0)
|
|
176
|
+
return 100;
|
|
177
|
+
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));
|
|
160
178
|
return Number.isFinite(s) ? Math.max(0, Math.min(120, s)) : 0;
|
|
161
179
|
}
|
|
162
180
|
function z(e, t) {
|
|
@@ -198,18 +216,18 @@ async function C(e, t, n = !1) {
|
|
|
198
216
|
const o = Ce(e, t.normalizeText), r = e.innerHTML, s = `${o.length}:${ie(o)}:${r.length}:${ie(r)}`;
|
|
199
217
|
if (!n && le.get(e) === s)
|
|
200
218
|
return v.get(e) || [];
|
|
201
|
-
const
|
|
202
|
-
Y.set(e,
|
|
203
|
-
const l = ce(o), c = fe(o), u = Me(o),
|
|
219
|
+
const a = (Y.get(e) || 0) + 1;
|
|
220
|
+
Y.set(e, a);
|
|
221
|
+
const l = ce(o), c = fe(o), u = Me(o), i = [], y = t.labels;
|
|
204
222
|
if (t.bannedWords.length > 0) {
|
|
205
223
|
let w = 0;
|
|
206
224
|
for (const p of t.bannedWords) {
|
|
207
225
|
const m = new RegExp(`\\b${ve(p)}\\b`, "gi");
|
|
208
226
|
let b = m.exec(o);
|
|
209
|
-
for (; b && !x(
|
|
227
|
+
for (; b && !x(i, t.maxIssues); ) {
|
|
210
228
|
const re = b[0];
|
|
211
229
|
P(
|
|
212
|
-
|
|
230
|
+
i,
|
|
213
231
|
{
|
|
214
232
|
id: z("banned-word", w),
|
|
215
233
|
ruleId: "banned-word",
|
|
@@ -221,17 +239,19 @@ async function C(e, t, n = !1) {
|
|
|
221
239
|
t.maxIssues
|
|
222
240
|
), w += 1, b = m.exec(o);
|
|
223
241
|
}
|
|
224
|
-
if (x(
|
|
242
|
+
if (x(i, t.maxIssues))
|
|
243
|
+
break;
|
|
225
244
|
}
|
|
226
245
|
}
|
|
227
|
-
if (!x(
|
|
246
|
+
if (!x(i, t.maxIssues) && t.requiredHeadings.length > 0) {
|
|
228
247
|
const w = Te(e, t.normalizeText);
|
|
229
248
|
let p = 0;
|
|
230
249
|
t.requiredHeadings.forEach((m) => {
|
|
231
|
-
if (x(
|
|
250
|
+
if (x(i, t.maxIssues))
|
|
251
|
+
return;
|
|
232
252
|
const b = t.normalizeText(m).toLowerCase();
|
|
233
253
|
!b || w.has(b) || (P(
|
|
234
|
-
|
|
254
|
+
i,
|
|
235
255
|
{
|
|
236
256
|
id: z("required-heading", p),
|
|
237
257
|
ruleId: "required-heading",
|
|
@@ -243,14 +263,15 @@ async function C(e, t, n = !1) {
|
|
|
243
263
|
), p += 1);
|
|
244
264
|
});
|
|
245
265
|
}
|
|
246
|
-
if (!x(
|
|
266
|
+
if (!x(i, t.maxIssues)) {
|
|
247
267
|
const w = Ae(o);
|
|
248
268
|
let p = 0;
|
|
249
269
|
for (const m of w) {
|
|
250
|
-
if (x(
|
|
270
|
+
if (x(i, t.maxIssues))
|
|
271
|
+
break;
|
|
251
272
|
const b = ce(m);
|
|
252
273
|
b <= t.maxSentenceWords || (P(
|
|
253
|
-
|
|
274
|
+
i,
|
|
254
275
|
{
|
|
255
276
|
id: z("sentence-length", p),
|
|
256
277
|
ruleId: "sentence-length",
|
|
@@ -264,8 +285,8 @@ async function C(e, t, n = !1) {
|
|
|
264
285
|
), p += 1);
|
|
265
286
|
}
|
|
266
287
|
}
|
|
267
|
-
if (!x(
|
|
268
|
-
|
|
288
|
+
if (!x(i, t.maxIssues) && l > 0 && u < t.minReadabilityScore && P(
|
|
289
|
+
i,
|
|
269
290
|
{
|
|
270
291
|
id: z("readability", 0),
|
|
271
292
|
ruleId: "readability",
|
|
@@ -274,7 +295,7 @@ async function C(e, t, n = !1) {
|
|
|
274
295
|
suggestion: "Use shorter sentences and simpler wording."
|
|
275
296
|
},
|
|
276
297
|
t.maxIssues
|
|
277
|
-
), !x(
|
|
298
|
+
), !x(i, t.maxIssues) && t.customRules.length > 0) {
|
|
278
299
|
const w = {
|
|
279
300
|
editor: e,
|
|
280
301
|
editorRoot: X(e),
|
|
@@ -285,13 +306,15 @@ async function C(e, t, n = !1) {
|
|
|
285
306
|
readabilityScore: u
|
|
286
307
|
};
|
|
287
308
|
for (const p of t.customRules) {
|
|
288
|
-
if (x(
|
|
309
|
+
if (x(i, t.maxIssues))
|
|
310
|
+
break;
|
|
289
311
|
try {
|
|
290
312
|
const m = await p.evaluate(w);
|
|
291
|
-
if (!Array.isArray(m))
|
|
292
|
-
|
|
313
|
+
if (!Array.isArray(m))
|
|
314
|
+
continue;
|
|
315
|
+
for (let b = 0; b < m.length && !x(i, t.maxIssues); b += 1)
|
|
293
316
|
P(
|
|
294
|
-
|
|
317
|
+
i,
|
|
295
318
|
Se(m[b], p.id, p.severity || "warning", b),
|
|
296
319
|
t.maxIssues
|
|
297
320
|
);
|
|
@@ -299,22 +322,22 @@ async function C(e, t, n = !1) {
|
|
|
299
322
|
}
|
|
300
323
|
}
|
|
301
324
|
}
|
|
302
|
-
if (Y.get(e) !==
|
|
325
|
+
if (Y.get(e) !== a)
|
|
303
326
|
return v.get(e) || [];
|
|
304
327
|
const D = {
|
|
305
328
|
readabilityScore: u,
|
|
306
329
|
wordCount: l,
|
|
307
330
|
sentenceCount: c
|
|
308
331
|
};
|
|
309
|
-
return le.set(e, s), v.set(e,
|
|
332
|
+
return le.set(e, s), v.set(e, i), de.set(e, D), te(e), e.dispatchEvent(
|
|
310
333
|
new CustomEvent("editora:content-rules-audit", {
|
|
311
334
|
bubbles: !0,
|
|
312
335
|
detail: {
|
|
313
|
-
issues:
|
|
336
|
+
issues: i,
|
|
314
337
|
metrics: D
|
|
315
338
|
}
|
|
316
339
|
})
|
|
317
|
-
),
|
|
340
|
+
), i;
|
|
318
341
|
}
|
|
319
342
|
function Le(e) {
|
|
320
343
|
return e.reduce(
|
|
@@ -339,17 +362,20 @@ function U(e) {
|
|
|
339
362
|
return B.get(e) === !0;
|
|
340
363
|
}
|
|
341
364
|
function J(e, t) {
|
|
342
|
-
if (!t.classList.contains("show"))
|
|
365
|
+
if (!t.classList.contains("show"))
|
|
366
|
+
return;
|
|
343
367
|
const o = X(e).getBoundingClientRect(), r = Math.min(window.innerWidth - 20, 360);
|
|
344
368
|
t.style.width = `${r}px`, t.style.maxHeight = `${Math.max(220, window.innerHeight - 24)}px`;
|
|
345
|
-
const s = Math.max(10, o.right - r),
|
|
369
|
+
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));
|
|
346
370
|
t.style.left = `${l}px`, t.style.top = `${c}px`;
|
|
347
371
|
}
|
|
348
372
|
function ue(e, t) {
|
|
349
373
|
const n = t.trim().toLowerCase();
|
|
350
|
-
if (!n)
|
|
374
|
+
if (!n)
|
|
375
|
+
return !1;
|
|
351
376
|
const o = window.getSelection();
|
|
352
|
-
if (!o)
|
|
377
|
+
if (!o)
|
|
378
|
+
return !1;
|
|
353
379
|
const r = document.createTreeWalker(e, NodeFilter.SHOW_TEXT, null);
|
|
354
380
|
let s = r.nextNode();
|
|
355
381
|
for (; s; ) {
|
|
@@ -381,38 +407,44 @@ function A(e, t) {
|
|
|
381
407
|
}
|
|
382
408
|
function O(e, t, n) {
|
|
383
409
|
const o = t.querySelector('[data-action="toggle-realtime"]');
|
|
384
|
-
if (!o)
|
|
410
|
+
if (!o)
|
|
411
|
+
return;
|
|
385
412
|
const r = A(e, n);
|
|
386
413
|
o.textContent = r ? n.labels.realtimeOnText : n.labels.realtimeOffText, o.setAttribute("aria-pressed", r ? "true" : "false"), $(e, "toggleContentRulesRealtime", r);
|
|
387
414
|
}
|
|
388
415
|
function te(e) {
|
|
389
416
|
const t = h.get(e);
|
|
390
|
-
if (!t)
|
|
417
|
+
if (!t)
|
|
418
|
+
return;
|
|
391
419
|
const n = d.get(e) || E;
|
|
392
|
-
if (!n)
|
|
420
|
+
if (!n)
|
|
421
|
+
return;
|
|
393
422
|
const o = v.get(e) || [], r = de.get(e) || {
|
|
394
|
-
readabilityScore: 100
|
|
395
|
-
|
|
396
|
-
|
|
423
|
+
readabilityScore: 100,
|
|
424
|
+
wordCount: 0,
|
|
425
|
+
sentenceCount: 0
|
|
426
|
+
}, 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");
|
|
427
|
+
if (!s || !a || !l || !c)
|
|
428
|
+
return;
|
|
397
429
|
const u = Le(o);
|
|
398
|
-
if (s.textContent = String(o.length),
|
|
430
|
+
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) {
|
|
399
431
|
l.innerHTML = `<li class="rte-content-rules-empty">${k(n.labels.noIssuesText)}</li>`;
|
|
400
432
|
return;
|
|
401
433
|
}
|
|
402
|
-
l.innerHTML = o.map((
|
|
403
|
-
const y =
|
|
434
|
+
l.innerHTML = o.map((i) => {
|
|
435
|
+
const y = i.excerpt ? `<p class="rte-content-rules-excerpt">${k(i.excerpt)}</p>` : "", D = i.suggestion ? `<p class="rte-content-rules-suggestion">${k(i.suggestion)}</p>` : "", w = `${n.labels.locateText}: ${i.message}`;
|
|
404
436
|
return `
|
|
405
|
-
<li class="rte-content-rules-item rte-content-rules-item-${
|
|
437
|
+
<li class="rte-content-rules-item rte-content-rules-item-${i.severity}">
|
|
406
438
|
<button
|
|
407
439
|
type="button"
|
|
408
440
|
class="rte-content-rules-item-btn"
|
|
409
441
|
data-action="focus-issue"
|
|
410
|
-
data-issue-id="${k(
|
|
442
|
+
data-issue-id="${k(i.id)}"
|
|
411
443
|
data-role="issue-button"
|
|
412
444
|
aria-label="${k(w)}"
|
|
413
445
|
>
|
|
414
|
-
<span class="rte-content-rules-badge">${k(Ie(
|
|
415
|
-
<span class="rte-content-rules-message">${k(
|
|
446
|
+
<span class="rte-content-rules-badge">${k(Ie(i.severity))}</span>
|
|
447
|
+
<span class="rte-content-rules-message">${k(i.message)}</span>
|
|
416
448
|
</button>
|
|
417
449
|
${y}
|
|
418
450
|
${D}
|
|
@@ -431,7 +463,8 @@ function Oe(e) {
|
|
|
431
463
|
}
|
|
432
464
|
function qe(e) {
|
|
433
465
|
const t = h.get(e);
|
|
434
|
-
if (t)
|
|
466
|
+
if (t)
|
|
467
|
+
return t;
|
|
435
468
|
const n = d.get(e) || E || j(), o = `rte-content-rules-panel-${pe++}`, r = document.createElement("section");
|
|
436
469
|
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 = `
|
|
437
470
|
<header class="rte-content-rules-header">
|
|
@@ -452,8 +485,9 @@ function qe(e) {
|
|
|
452
485
|
<span class="rte-content-rules-live" aria-live="polite"></span>
|
|
453
486
|
</div>
|
|
454
487
|
`, r.addEventListener("click", (s) => {
|
|
455
|
-
const
|
|
456
|
-
if (!l)
|
|
488
|
+
const a = s.target, l = a == null ? void 0 : a.closest("[data-action]");
|
|
489
|
+
if (!l)
|
|
490
|
+
return;
|
|
457
491
|
const c = l.getAttribute("data-action");
|
|
458
492
|
if (c) {
|
|
459
493
|
if (c === "close") {
|
|
@@ -466,17 +500,18 @@ function qe(e) {
|
|
|
466
500
|
return;
|
|
467
501
|
}
|
|
468
502
|
if (c === "toggle-realtime") {
|
|
469
|
-
const
|
|
470
|
-
if (T.set(e,
|
|
503
|
+
const i = !A(e, d.get(e) || E || n);
|
|
504
|
+
if (T.set(e, i), O(e, r, d.get(e) || E || n), i) {
|
|
471
505
|
const y = d.get(e) || E || n;
|
|
472
506
|
C(e, y, !0);
|
|
473
507
|
}
|
|
474
508
|
return;
|
|
475
509
|
}
|
|
476
510
|
if (c === "focus-issue") {
|
|
477
|
-
const u = l.getAttribute("data-issue-id") || "",
|
|
478
|
-
if (!
|
|
479
|
-
|
|
511
|
+
const u = l.getAttribute("data-issue-id") || "", i = We(e, u);
|
|
512
|
+
if (!i)
|
|
513
|
+
return;
|
|
514
|
+
He(e, i), W(e, !1);
|
|
480
515
|
}
|
|
481
516
|
}
|
|
482
517
|
}), r.addEventListener("keydown", (s) => {
|
|
@@ -484,19 +519,24 @@ function qe(e) {
|
|
|
484
519
|
s.preventDefault(), W(e, !0);
|
|
485
520
|
return;
|
|
486
521
|
}
|
|
487
|
-
if (s.key !== "ArrowDown" && s.key !== "ArrowUp")
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
522
|
+
if (s.key !== "ArrowDown" && s.key !== "ArrowUp")
|
|
523
|
+
return;
|
|
524
|
+
const a = Array.from(r.querySelectorAll('[data-role="issue-button"]'));
|
|
525
|
+
if (a.length === 0)
|
|
526
|
+
return;
|
|
527
|
+
const l = document.activeElement, c = a.findIndex((y) => y === l);
|
|
528
|
+
if (c === -1)
|
|
529
|
+
return;
|
|
492
530
|
s.preventDefault();
|
|
493
|
-
const u = s.key === "ArrowDown" ? 1 : -1,
|
|
494
|
-
i
|
|
531
|
+
const u = s.key === "ArrowDown" ? 1 : -1, i = (c + u + a.length) % a.length;
|
|
532
|
+
a[i].focus();
|
|
495
533
|
}), G(r, e), document.body.appendChild(r), h.set(e, r), B.set(e, !1), O(e, r, n), r;
|
|
496
534
|
}
|
|
497
535
|
function ne(e) {
|
|
498
536
|
const t = qe(e);
|
|
499
|
-
Oe(e), t.classList.add("show"), B.set(e, !0), G(t, e), J(e, t), te(e), $(e, "toggleContentRulesPanel", !0)
|
|
537
|
+
Oe(e), t.classList.add("show"), B.set(e, !0), G(t, e), J(e, t), te(e), $(e, "toggleContentRulesPanel", !0);
|
|
538
|
+
const n = t.querySelector('[data-action="run-audit"]');
|
|
539
|
+
n == null || n.focus();
|
|
500
540
|
}
|
|
501
541
|
function Q(e, t) {
|
|
502
542
|
const n = U(e);
|
|
@@ -508,7 +548,8 @@ function me(e) {
|
|
|
508
548
|
}
|
|
509
549
|
function be(e) {
|
|
510
550
|
const t = d.get(e) || E;
|
|
511
|
-
if (!t || !A(e, t))
|
|
551
|
+
if (!t || !A(e, t))
|
|
552
|
+
return;
|
|
512
553
|
me(e);
|
|
513
554
|
const n = window.setTimeout(() => {
|
|
514
555
|
_.delete(n), V.delete(e), C(e, t, !1);
|
|
@@ -528,7 +569,8 @@ function _e(e) {
|
|
|
528
569
|
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "t";
|
|
529
570
|
}
|
|
530
571
|
function Be() {
|
|
531
|
-
if (typeof document > "u" || document.getElementById(se))
|
|
572
|
+
if (typeof document > "u" || document.getElementById(se))
|
|
573
|
+
return;
|
|
532
574
|
const e = document.createElement("style");
|
|
533
575
|
e.id = se, e.textContent = `
|
|
534
576
|
.rte-toolbar-group-items.content-rules,
|
|
@@ -907,21 +949,27 @@ function Be() {
|
|
|
907
949
|
}
|
|
908
950
|
function De(e) {
|
|
909
951
|
E = e, L || (L = (t) => {
|
|
910
|
-
const
|
|
911
|
-
if (!o)
|
|
952
|
+
const n = t.target, o = n == null ? void 0 : n.closest(R);
|
|
953
|
+
if (!o)
|
|
954
|
+
return;
|
|
912
955
|
g = o, d.has(o) || d.set(o, e), v.has(o) || v.set(o, []), T.has(o) || T.set(o, e.enableRealtime);
|
|
913
956
|
const r = h.get(o);
|
|
914
957
|
r && (G(r, o), J(o, r), O(o, r, d.get(o) || e)), $(o, "toggleContentRulesPanel", U(o)), $(o, "toggleContentRulesRealtime", A(o, e));
|
|
915
958
|
}, document.addEventListener("focusin", L, !0)), I || (I = (t) => {
|
|
916
|
-
const
|
|
959
|
+
const n = t.target, o = n == null ? void 0 : n.closest(R);
|
|
917
960
|
o && (g = o, be(o));
|
|
918
961
|
}, document.addEventListener("input", I, !0)), H || (H = (t) => {
|
|
919
|
-
if (t.defaultPrevented
|
|
920
|
-
|
|
921
|
-
|
|
962
|
+
if (t.defaultPrevented)
|
|
963
|
+
return;
|
|
964
|
+
const n = t.target;
|
|
965
|
+
if (n != null && n.closest("input, textarea, select"))
|
|
966
|
+
return;
|
|
967
|
+
const o = t.key === "Escape", r = Pe(t), s = ze(t), a = _e(t);
|
|
968
|
+
if (!o && !r && !s && !a)
|
|
922
969
|
return;
|
|
923
970
|
const l = M(void 0, !1);
|
|
924
|
-
if (!l || Z(l))
|
|
971
|
+
if (!l || Z(l))
|
|
972
|
+
return;
|
|
925
973
|
const c = d.get(l) || E || e;
|
|
926
974
|
if (d.set(l, c), g = l, o && U(l)) {
|
|
927
975
|
t.preventDefault(), W(l, !0);
|
|
@@ -935,12 +983,12 @@ function De(e) {
|
|
|
935
983
|
t.preventDefault(), t.stopPropagation(), C(l, c, !0), ne(l);
|
|
936
984
|
return;
|
|
937
985
|
}
|
|
938
|
-
if (
|
|
986
|
+
if (a) {
|
|
939
987
|
t.preventDefault(), t.stopPropagation();
|
|
940
988
|
const u = !A(l, c);
|
|
941
989
|
T.set(l, u);
|
|
942
|
-
const
|
|
943
|
-
|
|
990
|
+
const i = h.get(l);
|
|
991
|
+
i && O(l, i, c), $(l, "toggleContentRulesRealtime", u), u && C(l, c, !0);
|
|
944
992
|
}
|
|
945
993
|
}, document.addEventListener("keydown", H, !0)), S || (S = () => {
|
|
946
994
|
h.forEach((t, n) => {
|
|
@@ -995,40 +1043,45 @@ const Ke = (e = {}) => {
|
|
|
995
1043
|
commands: {
|
|
996
1044
|
contentRules: (n, o) => {
|
|
997
1045
|
const r = M(o);
|
|
998
|
-
if (!r || Z(r))
|
|
1046
|
+
if (!r || Z(r))
|
|
1047
|
+
return !1;
|
|
999
1048
|
const s = d.get(r) || t;
|
|
1000
1049
|
return d.set(r, s), g = r, Q(r, !0), C(r, s, !1), !0;
|
|
1001
1050
|
},
|
|
1002
1051
|
toggleContentRulesPanel: (n, o) => {
|
|
1003
1052
|
const r = M(o);
|
|
1004
|
-
if (!r || Z(r))
|
|
1053
|
+
if (!r || Z(r))
|
|
1054
|
+
return !1;
|
|
1005
1055
|
g = r;
|
|
1006
1056
|
const s = d.get(r) || t;
|
|
1007
1057
|
d.set(r, s);
|
|
1008
|
-
const
|
|
1009
|
-
return U(r) && C(r, s, !1),
|
|
1058
|
+
const a = Q(r, typeof n == "boolean" ? n : void 0);
|
|
1059
|
+
return U(r) && C(r, s, !1), a;
|
|
1010
1060
|
},
|
|
1011
1061
|
runContentRulesAudit: async (n, o) => {
|
|
1012
1062
|
const r = M(o);
|
|
1013
|
-
if (!r)
|
|
1063
|
+
if (!r)
|
|
1064
|
+
return !1;
|
|
1014
1065
|
g = r;
|
|
1015
1066
|
const s = d.get(r) || t;
|
|
1016
1067
|
return d.set(r, s), await C(r, s, !0), ne(r), !0;
|
|
1017
1068
|
},
|
|
1018
1069
|
toggleContentRulesRealtime: (n, o) => {
|
|
1019
1070
|
const r = M(o);
|
|
1020
|
-
if (!r)
|
|
1071
|
+
if (!r)
|
|
1072
|
+
return !1;
|
|
1021
1073
|
g = r;
|
|
1022
1074
|
const s = d.get(r) || t;
|
|
1023
1075
|
d.set(r, s);
|
|
1024
|
-
const
|
|
1025
|
-
T.set(r,
|
|
1076
|
+
const a = typeof n == "boolean" ? n : !A(r, s);
|
|
1077
|
+
T.set(r, a);
|
|
1026
1078
|
const l = h.get(r);
|
|
1027
|
-
return l && O(r, l, s), $(r, "toggleContentRulesRealtime",
|
|
1079
|
+
return l && O(r, l, s), $(r, "toggleContentRulesRealtime", a), a && C(r, s, !0), !0;
|
|
1028
1080
|
},
|
|
1029
1081
|
getContentRulesIssues: (n, o) => {
|
|
1030
1082
|
const r = M(o);
|
|
1031
|
-
if (!r)
|
|
1083
|
+
if (!r)
|
|
1084
|
+
return !1;
|
|
1032
1085
|
const s = v.get(r) || [];
|
|
1033
1086
|
if (typeof n == "function")
|
|
1034
1087
|
try {
|
|
@@ -1044,8 +1097,9 @@ const Ke = (e = {}) => {
|
|
|
1044
1097
|
},
|
|
1045
1098
|
setContentRulesOptions: (n, o) => {
|
|
1046
1099
|
const r = M(o);
|
|
1047
|
-
if (!r || !n || typeof n != "object")
|
|
1048
|
-
|
|
1100
|
+
if (!r || !n || typeof n != "object")
|
|
1101
|
+
return !1;
|
|
1102
|
+
const s = d.get(r) || t, a = j({
|
|
1049
1103
|
...s,
|
|
1050
1104
|
...n,
|
|
1051
1105
|
labels: {
|
|
@@ -1053,12 +1107,12 @@ const Ke = (e = {}) => {
|
|
|
1053
1107
|
...n.labels || {}
|
|
1054
1108
|
}
|
|
1055
1109
|
});
|
|
1056
|
-
d.set(r,
|
|
1110
|
+
d.set(r, a), typeof n.enableRealtime == "boolean" && T.set(r, n.enableRealtime), A(r, a) && C(r, a, !0);
|
|
1057
1111
|
const l = h.get(r);
|
|
1058
1112
|
if (l) {
|
|
1059
|
-
l.setAttribute("aria-label",
|
|
1113
|
+
l.setAttribute("aria-label", a.labels.panelAriaLabel);
|
|
1060
1114
|
const c = l.querySelector(".rte-content-rules-title");
|
|
1061
|
-
c && (c.textContent =
|
|
1115
|
+
c && (c.textContent = a.labels.panelTitle), O(r, l, a), te(r);
|
|
1062
1116
|
}
|
|
1063
1117
|
return !0;
|
|
1064
1118
|
}
|