@editora/plugins 1.0.17 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CodePlugin.native-Cqi46sxh.js → CodePlugin.native-Bwf25lLX.js} +6 -6
- package/dist/{CodePlugin.native-CmnEFfJi.mjs → CodePlugin.native-Cpp4u3Jl.mjs} +23 -21
- package/dist/a11y-checker.cjs.js +16 -16
- package/dist/a11y-checker.esm.js +79 -75
- package/dist/anchor.cjs.js +9 -9
- package/dist/anchor.esm.js +61 -60
- package/dist/anchoredPopover-Bg-ey7Yo.js +1 -0
- package/dist/anchoredPopover-D_JbjvdA.mjs +111 -0
- package/dist/approval-workflow.cjs.js +5 -5
- package/dist/approval-workflow.esm.js +105 -104
- package/dist/background-color.cjs.js +1 -1
- package/dist/background-color.esm.js +1 -1
- package/dist/blocks-library.cjs.js +6 -6
- package/dist/blocks-library.esm.js +226 -202
- package/dist/capitalization.cjs.js +1 -1
- package/dist/capitalization.esm.js +9 -4
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +154 -116
- package/dist/citations.cjs.js +43 -18
- package/dist/citations.esm.js +465 -446
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/clear-formatting.esm.js +21 -20
- package/dist/code-sample.cjs.js +85 -66
- package/dist/code-sample.esm.js +301 -190
- package/dist/code.cjs.js +1 -1
- package/dist/code.esm.js +1 -1
- package/dist/collaboration.cjs.js +68 -0
- package/dist/collaboration.esm.js +7428 -0
- package/dist/comments.cjs.js +11 -11
- package/dist/comments.esm.js +284 -237
- package/dist/conditional-content.cjs.js +67 -60
- package/dist/conditional-content.esm.js +270 -220
- package/dist/data-binding.cjs.js +3 -3
- package/dist/data-binding.esm.js +28 -27
- package/dist/dialogHelpers-5d5BuOCW.mjs +39 -0
- package/dist/dialogHelpers-zU6zpMIA.js +12 -0
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +1 -1
- package/dist/{documentManager-3nPkITwx.js → documentManager-BDz6tovy.js} +1 -1
- package/dist/{documentManager-CRumGpCT.mjs → documentManager-yjRBab4v.mjs} +1 -1
- package/dist/embed-iframe.cjs.js +37 -17
- package/dist/embed-iframe.esm.js +188 -143
- package/dist/emojis.cjs.js +13 -10
- package/dist/emojis.esm.js +288 -76
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +9 -7
- package/dist/escapeHtml-D2Zh82pD.js +1 -0
- package/dist/escapeHtml-DyksyvcZ.mjs +6 -0
- package/dist/font-family.cjs.js +1 -1
- package/dist/font-family.esm.js +48 -41
- package/dist/font-size.cjs.js +1 -1
- package/dist/font-size.esm.js +67 -60
- package/dist/format-painter.cjs.js +1 -1
- package/dist/format-painter.esm.js +2 -1
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +40 -36
- package/dist/historyHelpers-BEKwNOtA.mjs +14 -0
- package/dist/historyHelpers-Cu8Pk7m1.js +1 -0
- package/dist/index-Bm1eqYHh.mjs +194 -0
- package/dist/index-CoflqYuK.js +30 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +17 -15
- package/dist/link.cjs.js +17 -13
- package/dist/link.esm.js +138 -69
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +66 -33
- package/dist/math.cjs.js +22 -22
- package/dist/math.esm.js +221 -126
- package/dist/media-manager.cjs.js +12 -12
- package/dist/media-manager.esm.js +55 -50
- package/dist/mentions.cjs.js +2 -2
- package/dist/mentions.esm.js +17 -12
- package/dist/merge-tag.cjs.js +2 -2
- package/dist/merge-tag.esm.js +43 -42
- package/dist/plugins.css +1 -1
- package/dist/preview.cjs.js +3 -3
- package/dist/preview.esm.js +30 -27
- package/dist/slash-commands.cjs.js +13 -7
- package/dist/slash-commands.esm.js +90 -79
- package/dist/smart-paste.cjs.js +5 -5
- package/dist/smart-paste.esm.js +85 -81
- package/dist/special-characters.cjs.js +6 -3
- package/dist/special-characters.esm.js +72 -25
- package/dist/spell-check.cjs.js +8 -8
- package/dist/spell-check.esm.js +10189 -295
- package/dist/table.cjs.js +166 -13
- package/dist/table.esm.js +543 -266
- package/dist/template.cjs.js +11 -11
- package/dist/template.esm.js +290 -264
- package/dist/text-color.cjs.js +1 -1
- package/dist/text-color.esm.js +1 -1
- package/dist/translation-workflow.cjs.js +4 -4
- package/dist/translation-workflow.esm.js +33 -31
- package/dist/version-diff.cjs.js +6 -6
- package/dist/version-diff.esm.js +40 -40
- package/package.json +11 -5
- package/dist/anchoredPopover-BzqGPOAE.js +0 -1
- package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
- package/dist/index-CJ90EVWy.mjs +0 -145
- package/dist/index-DTkvH8gX.js +0 -1
package/dist/a11y-checker.esm.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { e as v } from "./escapeHtml-DyksyvcZ.mjs";
|
|
2
|
+
import { i as T } from "./dialogHelpers-5d5BuOCW.mjs";
|
|
3
|
+
const H = /* @__PURE__ */ new Set(), C = [], f = (t) => {
|
|
4
|
+
C.push(t);
|
|
3
5
|
}, x = '[data-theme="dark"], .dark, .editora-theme-dark';
|
|
4
6
|
f({
|
|
5
7
|
id: "image-alt-text",
|
|
@@ -9,7 +11,7 @@ f({
|
|
|
9
11
|
selector: "img",
|
|
10
12
|
evaluate(t, n) {
|
|
11
13
|
const e = t;
|
|
12
|
-
return e.hasAttribute("role") && e.getAttribute("role") === "presentation" || e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "image-alt-text"
|
|
14
|
+
return e.hasAttribute("role") && e.getAttribute("role") === "presentation" || e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "image-alt-text" || e.hasAttribute("alt") ? null : {
|
|
13
15
|
id: `img-alt-${n.cache.get("imgIdx")}`,
|
|
14
16
|
rule: "image-alt-text",
|
|
15
17
|
wcag: "1.1.1",
|
|
@@ -20,7 +22,7 @@ f({
|
|
|
20
22
|
suggestion: "Add descriptive alt text to all images",
|
|
21
23
|
fixable: !0,
|
|
22
24
|
fixLabel: "Add empty alt"
|
|
23
|
-
}
|
|
25
|
+
};
|
|
24
26
|
},
|
|
25
27
|
fix(t) {
|
|
26
28
|
t.element && t.element.setAttribute("alt", "");
|
|
@@ -35,8 +37,8 @@ f({
|
|
|
35
37
|
evaluate(t, n) {
|
|
36
38
|
const e = t;
|
|
37
39
|
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "empty-interactive") return null;
|
|
38
|
-
const r = e.textContent?.trim(), a = e.hasAttribute("aria-label"),
|
|
39
|
-
return !r && !a && !
|
|
40
|
+
const r = e.textContent?.trim(), a = e.hasAttribute("aria-label"), i = e.hasAttribute("aria-labelledby"), s = e.hasAttribute("title");
|
|
41
|
+
return !r && !a && !i && !s ? {
|
|
40
42
|
id: `interactive-empty-${n.cache.get("buttonIdx")}`,
|
|
41
43
|
rule: "empty-interactive",
|
|
42
44
|
wcag: "4.1.2",
|
|
@@ -62,8 +64,8 @@ f({
|
|
|
62
64
|
evaluate(t, n) {
|
|
63
65
|
const e = t;
|
|
64
66
|
if (e.hasAttribute("type") && e.getAttribute("type") === "hidden" || e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "form-label") return null;
|
|
65
|
-
const r = n.doc.querySelector(`label[for="${e.getAttribute("id")}"]`), a = e.hasAttribute("aria-label"),
|
|
66
|
-
return !r && !a && !
|
|
67
|
+
const r = n.doc.querySelector(`label[for="${e.getAttribute("id")}"]`), a = e.hasAttribute("aria-label"), i = e.hasAttribute("aria-labelledby");
|
|
68
|
+
return !r && !a && !i ? {
|
|
67
69
|
id: `form-label-${n.cache.get("inputIdx")}`,
|
|
68
70
|
rule: "form-label",
|
|
69
71
|
wcag: "1.3.1",
|
|
@@ -168,7 +170,7 @@ f({
|
|
|
168
170
|
evaluate(t, n) {
|
|
169
171
|
const e = t;
|
|
170
172
|
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "link-text") return null;
|
|
171
|
-
const r = e.textContent?.replace(/\s+/g, "").toLowerCase() || "", a = e.childNodes.length === 1 && e.childNodes[0].nodeName === "BR",
|
|
173
|
+
const r = e.textContent?.replace(/\s+/g, "").toLowerCase() || "", a = e.childNodes.length === 1 && e.childNodes[0].nodeName === "BR", i = ["clickhere", "readmore", "link", "here", "this", "page"];
|
|
172
174
|
return !r && !a ? {
|
|
173
175
|
id: `link-empty-${n.cache.get("aIdx")}`,
|
|
174
176
|
rule: "link-text",
|
|
@@ -180,7 +182,7 @@ f({
|
|
|
180
182
|
suggestion: "All links must have descriptive text",
|
|
181
183
|
fixable: !0,
|
|
182
184
|
fixLabel: "Insert placeholder"
|
|
183
|
-
} :
|
|
185
|
+
} : i.some((s) => r.includes(s)) ? {
|
|
184
186
|
id: `link-vague-${n.cache.get("aIdx")}`,
|
|
185
187
|
rule: "link-text",
|
|
186
188
|
wcag: "2.4.4",
|
|
@@ -206,7 +208,7 @@ f({
|
|
|
206
208
|
const e = t;
|
|
207
209
|
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "list-structure") return null;
|
|
208
210
|
const r = e.querySelectorAll(":scope > li");
|
|
209
|
-
return Array.from(e.children).filter((
|
|
211
|
+
return Array.from(e.children).filter((i) => i.tagName !== "LI").length > 0 ? {
|
|
210
212
|
id: `list-structure-${n.cache.get("ulIdx")}`,
|
|
211
213
|
rule: "list-structure",
|
|
212
214
|
wcag: "1.3.1",
|
|
@@ -229,7 +231,7 @@ f({
|
|
|
229
231
|
} : null;
|
|
230
232
|
}
|
|
231
233
|
});
|
|
232
|
-
const
|
|
234
|
+
const w = () => {
|
|
233
235
|
const t = window.getSelection();
|
|
234
236
|
if (t && t.rangeCount > 0) {
|
|
235
237
|
let e = t.getRangeAt(0).startContainer;
|
|
@@ -250,30 +252,32 @@ const A = () => {
|
|
|
250
252
|
if (e) return e;
|
|
251
253
|
}
|
|
252
254
|
return document.querySelector('[contenteditable="true"]');
|
|
253
|
-
},
|
|
254
|
-
if (
|
|
255
|
+
}, I = () => {
|
|
256
|
+
if (w()?.closest(x)) return !0;
|
|
255
257
|
const n = window.getSelection();
|
|
256
258
|
if (n && n.rangeCount > 0) {
|
|
257
259
|
const r = n.getRangeAt(0).startContainer;
|
|
258
260
|
if ((r.nodeType === Node.ELEMENT_NODE ? r : r.parentElement)?.closest(x)) return !0;
|
|
259
261
|
}
|
|
260
262
|
return document.activeElement?.closest(x) ? !0 : document.body.matches(x) || document.documentElement.matches(x);
|
|
261
|
-
},
|
|
262
|
-
const t =
|
|
263
|
+
}, k = () => {
|
|
264
|
+
const t = w();
|
|
263
265
|
if (!t) return [];
|
|
264
266
|
const n = [], e = { doc: t.ownerDocument || document, cache: /* @__PURE__ */ new Map() }, r = e.doc.createTreeWalker(t, NodeFilter.SHOW_ELEMENT, null);
|
|
265
|
-
let a = r.currentNode
|
|
267
|
+
let a = r.currentNode;
|
|
268
|
+
const i = {}, s = {};
|
|
269
|
+
let p = 0;
|
|
266
270
|
for (; a && p < 5e3; ) {
|
|
267
|
-
const h = a,
|
|
271
|
+
const h = a, o = h.tagName?.toLowerCase?.() || "";
|
|
268
272
|
if (h.hidden || h.style.display === "none" || h.style.visibility === "hidden") {
|
|
269
273
|
a = r.nextNode(), p++;
|
|
270
274
|
continue;
|
|
271
275
|
}
|
|
272
|
-
o
|
|
273
|
-
for (const
|
|
274
|
-
if (
|
|
275
|
-
e.cache.set(`${
|
|
276
|
-
const m =
|
|
276
|
+
i[o] = (i[o] || 0) + 1, s[o] = `${o}[${i[o] - 1}]`;
|
|
277
|
+
for (const g of C) {
|
|
278
|
+
if (H.has(g.id) || g.selector && !a.matches?.(g.selector)) continue;
|
|
279
|
+
e.cache.set(`${o}Idx`, i[o] - 1), e.cache.set(`${o}Path`, s[o]), /^h[1-6]$/.test(o) && (e.cache.set("headingIdx", i[o] - 1), e.cache.set("headingPath", s[o])), o === "a" && (e.cache.set("aIdx", i[o] - 1), e.cache.set("aPath", s[o])), o === "table" && (e.cache.set("tableIdx", i[o] - 1), e.cache.set("tablePath", s[o])), o === "button" && (e.cache.set("buttonIdx", i[o] - 1), e.cache.set("buttonPath", s[o])), o === "input" && (e.cache.set("inputIdx", i[o] - 1), e.cache.set("inputPath", s[o])), (o === "ul" || o === "ol") && (e.cache.set("ulIdx", i[o] - 1), e.cache.set("ulPath", s[o]));
|
|
280
|
+
const m = g.evaluate(a, e);
|
|
277
281
|
m && n.push(m);
|
|
278
282
|
}
|
|
279
283
|
a = r.nextNode(), p++;
|
|
@@ -281,16 +285,16 @@ const A = () => {
|
|
|
281
285
|
return n;
|
|
282
286
|
}, b = (t, n = !0) => {
|
|
283
287
|
t.element && (n ? (t.element.classList.add("a11y-highlighted"), t.element.style.outline = "2px solid #ff9800", t.element.style.backgroundColor = "#fff3cd") : (t.element.classList.remove("a11y-highlighted"), t.element.style.outline = "", t.element.style.backgroundColor = ""));
|
|
284
|
-
},
|
|
285
|
-
t || (t =
|
|
286
|
-
const n = t.filter((a) => a.severity === "error").length, e = t.filter((a) => a.severity === "warning").length;
|
|
287
|
-
let r = 100 - n * 20 - e * 5;
|
|
288
|
+
}, P = (t) => {
|
|
289
|
+
t || (t = k());
|
|
290
|
+
const n = t.filter((a) => a.severity === "error").length, e = t.filter((a) => a.severity === "warning").length, r = 100 - n * 20 - e * 5;
|
|
288
291
|
return Math.max(0, r);
|
|
289
|
-
},
|
|
290
|
-
const n =
|
|
292
|
+
}, N = (t) => {
|
|
293
|
+
const n = C.find((e) => e.id === t.rule);
|
|
291
294
|
n && n.fix && n.fix(t);
|
|
292
|
-
},
|
|
293
|
-
|
|
295
|
+
}, $ = () => {
|
|
296
|
+
document.querySelectorAll(".a11y-dialog-overlay").forEach((c) => c.remove());
|
|
297
|
+
const t = k(), n = P(t), r = I() ? {
|
|
294
298
|
overlay: "rgba(0, 0, 0, 0.62)",
|
|
295
299
|
dialogBg: "#1f2937",
|
|
296
300
|
panelBg: "#222d3a",
|
|
@@ -321,7 +325,7 @@ const A = () => {
|
|
|
321
325
|
fixBtn: "#2196f3",
|
|
322
326
|
fixBtnHover: "#1976d2"
|
|
323
327
|
}, a = document.createElement("div");
|
|
324
|
-
a.className = "a11y-dialog-overlay", a.style.cssText = `
|
|
328
|
+
T(a), a.className = "a11y-dialog-overlay", a.style.cssText = `
|
|
325
329
|
position: fixed;
|
|
326
330
|
top: 0;
|
|
327
331
|
left: 0;
|
|
@@ -333,8 +337,8 @@ const A = () => {
|
|
|
333
337
|
align-items: center;
|
|
334
338
|
justify-content: center;
|
|
335
339
|
`;
|
|
336
|
-
const
|
|
337
|
-
|
|
340
|
+
const i = document.createElement("div");
|
|
341
|
+
i.className = "a11y-dialog", i.style.cssText = `
|
|
338
342
|
background: ${r.dialogBg};
|
|
339
343
|
border: 1px solid ${r.border};
|
|
340
344
|
color: ${r.text};
|
|
@@ -366,8 +370,8 @@ const A = () => {
|
|
|
366
370
|
background: ${n >= 80 ? "#4caf50" : n >= 60 ? "#ff9800" : "#f44336"};
|
|
367
371
|
color: white;
|
|
368
372
|
`, h.textContent = `${n}/100`;
|
|
369
|
-
const
|
|
370
|
-
|
|
373
|
+
const o = document.createElement("button");
|
|
374
|
+
o.textContent = "✕", o.style.cssText = `
|
|
371
375
|
background: none;
|
|
372
376
|
border: none;
|
|
373
377
|
font-size: 24px;
|
|
@@ -380,15 +384,15 @@ const A = () => {
|
|
|
380
384
|
justify-content: center;
|
|
381
385
|
border-radius: 4px;
|
|
382
386
|
color: ${r.muted};
|
|
383
|
-
`,
|
|
384
|
-
|
|
385
|
-
},
|
|
386
|
-
|
|
387
|
-
},
|
|
388
|
-
t.forEach((
|
|
387
|
+
`, o.onmouseover = () => {
|
|
388
|
+
o.style.background = r.closeHover, o.style.color = "#f8fafc";
|
|
389
|
+
}, o.onmouseout = () => {
|
|
390
|
+
o.style.background = "none", o.style.color = r.muted;
|
|
391
|
+
}, o.onclick = () => {
|
|
392
|
+
t.forEach((c) => b(c, !1)), a.remove();
|
|
389
393
|
};
|
|
390
|
-
const
|
|
391
|
-
|
|
394
|
+
const g = document.createElement("div");
|
|
395
|
+
g.style.cssText = "display: flex; align-items: center; gap: 16px;", g.appendChild(p), g.appendChild(h), s.appendChild(g), s.appendChild(o);
|
|
392
396
|
const m = document.createElement("div");
|
|
393
397
|
if (m.style.cssText = `
|
|
394
398
|
flex: 1;
|
|
@@ -404,8 +408,8 @@ const A = () => {
|
|
|
404
408
|
</div>
|
|
405
409
|
`;
|
|
406
410
|
else {
|
|
407
|
-
const
|
|
408
|
-
|
|
411
|
+
const c = document.createElement("div");
|
|
412
|
+
c.style.cssText = `
|
|
409
413
|
background: ${r.summaryBg};
|
|
410
414
|
border: 1px solid ${r.border};
|
|
411
415
|
padding: 12px 16px;
|
|
@@ -414,14 +418,14 @@ const A = () => {
|
|
|
414
418
|
display: flex;
|
|
415
419
|
gap: 20px;
|
|
416
420
|
`;
|
|
417
|
-
const y = t.filter((l) => l.severity === "error").length,
|
|
418
|
-
|
|
421
|
+
const y = t.filter((l) => l.severity === "error").length, E = t.filter((l) => l.severity === "warning").length, L = t.filter((l) => l.severity === "info").length;
|
|
422
|
+
c.innerHTML = `
|
|
419
423
|
<div><strong style="color: #f44336;">${y}</strong> <span style="color: ${r.muted};">Errors</span></div>
|
|
420
|
-
<div><strong style="color: #ff9800;">${
|
|
421
|
-
<div><strong style="color: #2196f3;">${
|
|
422
|
-
`, m.appendChild(
|
|
423
|
-
const
|
|
424
|
-
|
|
424
|
+
<div><strong style="color: #ff9800;">${E}</strong> <span style="color: ${r.muted};">Warnings</span></div>
|
|
425
|
+
<div><strong style="color: #2196f3;">${L}</strong> <span style="color: ${r.muted};">Info</span></div>
|
|
426
|
+
`, m.appendChild(c), t.forEach((l) => {
|
|
427
|
+
const u = document.createElement("div");
|
|
428
|
+
u.style.cssText = `
|
|
425
429
|
border: 1px solid ${r.issueBorder};
|
|
426
430
|
border-radius: 6px;
|
|
427
431
|
padding: 16px;
|
|
@@ -429,16 +433,16 @@ const A = () => {
|
|
|
429
433
|
transition: all 0.2s;
|
|
430
434
|
background: ${r.issueBg};
|
|
431
435
|
color: ${r.text};
|
|
432
|
-
`,
|
|
433
|
-
|
|
434
|
-
},
|
|
435
|
-
|
|
436
|
+
`, u.onmouseover = () => {
|
|
437
|
+
u.style.borderColor = r.issueHoverBorder, u.style.background = r.issueHoverBg, b(l, !0);
|
|
438
|
+
}, u.onmouseout = () => {
|
|
439
|
+
u.style.borderColor = r.issueBorder, u.style.background = r.issueBg, b(l, !1);
|
|
436
440
|
};
|
|
437
|
-
const
|
|
438
|
-
if (
|
|
441
|
+
const B = l.severity === "error" ? "#f44336" : l.severity === "warning" ? "#ff9800" : "#2196f3";
|
|
442
|
+
if (u.innerHTML = `
|
|
439
443
|
<div style="display: flex; align-items: start; gap: 12px; margin-bottom: 8px;">
|
|
440
444
|
<span style="
|
|
441
|
-
background: ${
|
|
445
|
+
background: ${B};
|
|
442
446
|
color: white;
|
|
443
447
|
padding: 2px 8px;
|
|
444
448
|
border-radius: 4px;
|
|
@@ -447,12 +451,12 @@ const A = () => {
|
|
|
447
451
|
text-transform: uppercase;
|
|
448
452
|
">${l.severity}</span>
|
|
449
453
|
<div style="flex: 1;">
|
|
450
|
-
<div style="font-weight: 600; margin-bottom: 4px;">${l.message}</div>
|
|
451
|
-
<div style="font-size: 12px; color: ${r.muted};">WCAG ${l.wcag} · ${l.rule}</div>
|
|
454
|
+
<div style="font-weight: 600; margin-bottom: 4px;">${v(l.message)}</div>
|
|
455
|
+
<div style="font-size: 12px; color: ${r.muted};">WCAG ${v(l.wcag)} · ${v(l.rule)}</div>
|
|
452
456
|
</div>
|
|
453
457
|
</div>
|
|
454
458
|
<div style="font-size: 14px; color: ${r.text}; margin-bottom: 8px; padding-left: 68px;">
|
|
455
|
-
${l.suggestion || ""}
|
|
459
|
+
${v(l.suggestion || "")}
|
|
456
460
|
</div>
|
|
457
461
|
`, l.fixable) {
|
|
458
462
|
const d = document.createElement("button");
|
|
@@ -466,22 +470,22 @@ const A = () => {
|
|
|
466
470
|
font-size: 13px;
|
|
467
471
|
margin-left: 68px;
|
|
468
472
|
`, d.onmouseover = () => d.style.background = r.fixBtnHover, d.onmouseout = () => d.style.background = r.fixBtn, d.onclick = () => {
|
|
469
|
-
|
|
470
|
-
a.remove(),
|
|
473
|
+
N(l), d.textContent = "✓ Fixed", d.style.background = "#4caf50", d.disabled = !0, d.style.cursor = "not-allowed", b(l, !1), setTimeout(() => {
|
|
474
|
+
a.remove(), $();
|
|
471
475
|
}, 1e3);
|
|
472
|
-
},
|
|
476
|
+
}, u.appendChild(d);
|
|
473
477
|
}
|
|
474
|
-
m.appendChild(
|
|
478
|
+
m.appendChild(u);
|
|
475
479
|
});
|
|
476
480
|
}
|
|
477
|
-
|
|
478
|
-
|
|
481
|
+
i.appendChild(s), i.appendChild(m), a.appendChild(i), document.body.appendChild(a), a.onclick = (c) => {
|
|
482
|
+
c.target === a && (t.forEach((y) => b(y, !1)), a.remove());
|
|
479
483
|
};
|
|
480
|
-
const
|
|
481
|
-
|
|
484
|
+
const A = (c) => {
|
|
485
|
+
c.key === "Escape" && (t.forEach((y) => b(y, !1)), a.remove(), document.removeEventListener("keydown", A));
|
|
482
486
|
};
|
|
483
|
-
document.addEventListener("keydown",
|
|
484
|
-
},
|
|
487
|
+
document.addEventListener("keydown", A);
|
|
488
|
+
}, R = () => ({
|
|
485
489
|
name: "a11yChecker",
|
|
486
490
|
toolbar: [
|
|
487
491
|
{
|
|
@@ -494,7 +498,7 @@ const A = () => {
|
|
|
494
498
|
commands: {
|
|
495
499
|
toggleA11yChecker: () => {
|
|
496
500
|
try {
|
|
497
|
-
return
|
|
501
|
+
return $(), !0;
|
|
498
502
|
} catch (t) {
|
|
499
503
|
return console.error("Failed to open accessibility checker:", t), !1;
|
|
500
504
|
}
|
|
@@ -505,5 +509,5 @@ const A = () => {
|
|
|
505
509
|
}
|
|
506
510
|
});
|
|
507
511
|
export {
|
|
508
|
-
|
|
512
|
+
R as A11yCheckerPlugin
|
|
509
513
|
};
|
package/dist/anchor.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const w=require("./editorContainerHelpers-CFbfiOJI.js"),b=new Set,
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const $=require("./dialogHelpers-zU6zpMIA.js"),w=require("./editorContainerHelpers-CFbfiOJI.js"),b=new Set,y='[data-theme="dark"], .dark, .editora-theme-dark';function z(t,c){if(c===t.innerHTML)return;const s=window.execEditorCommand||window.executeEditorCommand;if(typeof s=="function")try{s("recordDomTransaction",t,c,t.innerHTML)}catch{}}function M(){if(typeof window>"u"||window.__anchorObserverInitialized)return;window.__anchorObserverInitialized=!0,new MutationObserver(c=>{c.forEach(s=>{s.removedNodes.forEach(a=>{if(a.nodeType===Node.ELEMENT_NODE){const l=a;if(l.classList?.contains("rte-anchor")){const r=l.id;r&&b.delete(r)}l.querySelectorAll?.(".rte-anchor")?.forEach(r=>{const u=r.id;u&&b.delete(u)})}})})}).observe(document.body,{childList:!0,subtree:!0})}function S(t){return!t||t.trim().length===0?{valid:!1,error:"Anchor ID cannot be empty"}:t.length>256?{valid:!1,error:"Anchor ID must be less than 256 characters"}:/^[A-Za-z_]/.test(t)?/^[A-Za-z0-9\-_]+$/.test(t)?{valid:!0,error:""}:{valid:!1,error:"Anchor ID can only contain letters, numbers, hyphens, and underscores"}:{valid:!1,error:"Anchor ID must start with a letter or underscore"}}function R(){const t=w.findEditorContainerFromSelection();if(!t)return;const c=w.getContentElement(t);if(!c)return;const s=c.querySelectorAll(".rte-anchor"),a=new Set;s.forEach(l=>{const e=l.id;e&&a.add(e)}),b.clear(),a.forEach(l=>b.add(l))}function H(t){if(t){const a=t.startContainer;if((a.nodeType===Node.ELEMENT_NODE?a:a.parentElement)?.closest(y))return!0}const c=window.getSelection();if(c&&c.rangeCount>0){const a=c.getRangeAt(0).startContainer;if((a.nodeType===Node.ELEMENT_NODE?a:a.parentElement)?.closest(y))return!0}return document.activeElement?.closest(y)?!0:document.body.matches(y)||document.documentElement.matches(y)}function _(t,c,s,a){document.querySelectorAll(".rte-anchor-dialog-overlay").forEach(n=>n.remove()),R();const l=H(a),e=l?{overlay:"rgba(0, 0, 0, 0.62)",dialogBg:"#1f2937",panelBg:"#222d3a",border:"#3b4657",text:"#e2e8f0",muted:"#94a3b8",closeHoverBg:"#334155",fieldBg:"#111827",fieldFocusBg:"#111827",fieldBorder:"#4b5563",fieldText:"#e2e8f0",fieldErrorBg:"#3f2124",fieldErrorBorder:"#ef4444",cancelBg:"#334155",cancelHover:"#475569",cancelText:"#e2e8f0",saveBg:"#3b82f6",saveHover:"#2563eb",saveDisabledBg:"#374151",saveDisabledText:"#7f8ca1",help:"#9fb0c6",focusRing:"rgba(88, 166, 255, 0.25)",errorRing:"rgba(239, 68, 68, 0.25)"}:{overlay:"rgba(0, 0, 0, 0.5)",dialogBg:"#ffffff",panelBg:"#f9f9f9",border:"#e0e0e0",text:"#333333",muted:"#999999",closeHoverBg:"#e0e0e0",fieldBg:"#ffffff",fieldFocusBg:"#f9f9ff",fieldBorder:"#d0d0d0",fieldText:"#333333",fieldErrorBg:"#ffebee",fieldErrorBorder:"#d32f2f",cancelBg:"#f0f0f0",cancelHover:"#e0e0e0",cancelText:"#333333",saveBg:"#0066cc",saveHover:"#0052a3",saveDisabledBg:"#d0d0d0",saveDisabledText:"#999999",help:"#999999",focusRing:"rgba(0, 102, 204, 0.1)",errorRing:"rgba(211, 47, 47, 0.1)"},r=document.createElement("div");$.initDialogOverlay(r),r.className="rte-anchor-dialog-overlay",r.style.cssText=`
|
|
2
2
|
position: fixed;
|
|
3
3
|
top: 0;
|
|
4
4
|
left: 0;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
max-width: 450px;
|
|
20
20
|
overflow: hidden;
|
|
21
21
|
animation: rte-anchor-dialog-appear 0.2s ease;
|
|
22
|
-
`,!document.getElementById("rte-anchor-dialog-styles")){const
|
|
22
|
+
`,!document.getElementById("rte-anchor-dialog-styles")){const n=document.createElement("style");n.id="rte-anchor-dialog-styles",n.textContent=`
|
|
23
23
|
@keyframes rte-anchor-dialog-appear {
|
|
24
24
|
from { opacity: 0; transform: scale(0.95); }
|
|
25
25
|
to { opacity: 1; transform: scale(1); }
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
.rte-anchor-dialog input:focus {
|
|
28
28
|
outline: none !important;
|
|
29
29
|
}
|
|
30
|
-
`,document.head.appendChild(
|
|
30
|
+
`,document.head.appendChild(n)}let d="";const h=document.createElement("div");h.style.cssText=`
|
|
31
31
|
display: flex;
|
|
32
32
|
align-items: center;
|
|
33
33
|
justify-content: space-between;
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
justify-content: center;
|
|
49
49
|
border-radius: 4px;
|
|
50
50
|
transition: all 0.2s ease;
|
|
51
|
-
`,f.onmouseover=()=>{f.style.background=e.closeHoverBg,f.style.color="#f8fafc"},f.onmouseout=()=>{f.style.background="none",f.style.color=e.muted},h.appendChild(C),h.appendChild(f);const B=document.createElement("div");B.style.cssText="padding: 20px;";const m=document.createElement("div");m.style.cssText="margin-bottom: 0;";const
|
|
51
|
+
`,f.onmouseover=()=>{f.style.background=e.closeHoverBg,f.style.color="#f8fafc"},f.onmouseout=()=>{f.style.background="none",f.style.color=e.muted},h.appendChild(C),h.appendChild(f);const B=document.createElement("div");B.style.cssText="padding: 20px;";const m=document.createElement("div");m.style.cssText="margin-bottom: 0;";const x=document.createElement("label");x.textContent="Anchor ID",x.style.cssText=`display: block; font-size: 14px; font-weight: 500; color: ${e.text}; margin-bottom: 8px;`,x.setAttribute("for","anchor-id-input");const o=document.createElement("input");o.id="anchor-id-input",o.type="text",o.placeholder="e.g., section-introduction",o.value="",o.style.cssText=`
|
|
52
52
|
width: 100%;
|
|
53
53
|
padding: 10px 12px;
|
|
54
54
|
font-size: 14px;
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
font-size: 12px;
|
|
65
65
|
margin-top: 6px;
|
|
66
66
|
display: none;
|
|
67
|
-
`;const k=document.createElement("div");k.textContent="URL-safe ID (letters, numbers, hyphens, underscores). Must start with letter or underscore.",k.style.cssText=`color: ${e.help}; font-size: 12px; margin-top: 8px; line-height: 1.4;`,m.appendChild(
|
|
67
|
+
`;const k=document.createElement("div");k.textContent="URL-safe ID (letters, numbers, hyphens, underscores). Must start with letter or underscore.",k.style.cssText=`color: ${e.help}; font-size: 12px; margin-top: 8px; line-height: 1.4;`,m.appendChild(x),m.appendChild(o),m.appendChild(p),m.appendChild(k),B.appendChild(m);const v=document.createElement("div");v.style.cssText=`
|
|
68
68
|
display: flex;
|
|
69
69
|
gap: 12px;
|
|
70
70
|
padding: 16px 20px;
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
transition: all 0.2s ease;
|
|
82
82
|
background: ${e.cancelBg};
|
|
83
83
|
color: ${e.cancelText};
|
|
84
|
-
`,g.onmouseover=()=>g.style.background=e.cancelHover,g.onmouseout=()=>g.style.background=e.cancelBg;const
|
|
84
|
+
`,g.onmouseover=()=>g.style.background=e.cancelHover,g.onmouseout=()=>g.style.background=e.cancelBg;const i=document.createElement("button");i.textContent="Add Anchor",i.style.cssText=`
|
|
85
85
|
padding: 8px 16px;
|
|
86
86
|
font-size: 14px;
|
|
87
87
|
font-weight: 500;
|
|
@@ -91,11 +91,11 @@
|
|
|
91
91
|
transition: all 0.2s ease;
|
|
92
92
|
background: ${e.saveBg};
|
|
93
93
|
color: white;
|
|
94
|
-
`,
|
|
94
|
+
`,i.disabled=!o.value.trim();const N=()=>{o.value.trim()?(i.disabled=!1,i.style.background=e.saveBg,i.style.color="white",i.style.cursor="pointer"):(i.disabled=!0,i.style.background=e.saveDisabledBg,i.style.color=e.saveDisabledText,i.style.cursor="not-allowed")};i.onmouseover=()=>{i.disabled||(i.style.background=e.saveHover,i.style.boxShadow=l?"0 2px 8px rgba(59, 130, 246, 0.35)":"0 2px 8px rgba(0, 102, 204, 0.3)")},i.onmouseout=()=>{i.disabled||(i.style.background=e.saveBg,i.style.boxShadow="none")},v.appendChild(g),v.appendChild(i),o.oninput=()=>{const n=o.value;if(N(),n.trim()){const T=S(n);T.valid?b.has(n)?(d=`Anchor ID already exists: ${n}`,p.textContent="⚠ "+d,p.style.display="block",o.style.borderColor=e.fieldErrorBorder,o.style.background=e.fieldErrorBg):(d="",p.style.display="none",o.style.borderColor=e.fieldBorder,o.style.background=e.fieldBg):(d=T.error,p.textContent="⚠ "+d,p.style.display="block",o.style.borderColor=e.fieldErrorBorder,o.style.background=e.fieldErrorBg)}else p.style.display="none",o.style.borderColor=e.fieldBorder,o.style.background=e.fieldBg},o.onfocus=()=>{o.style.borderColor=d?e.fieldErrorBorder:e.saveBg,o.style.boxShadow=d?`0 0 0 3px ${e.errorRing}`:`0 0 0 3px ${e.focusRing}`,o.style.background=d?e.fieldErrorBg:e.fieldFocusBg},o.onblur=()=>{o.style.boxShadow="none",d||(o.style.background=e.fieldBg)};const A=()=>{const n=o.value.trim();!n||!S(n).valid||b.has(n)||(s&&s(n),r.remove())},E=()=>{r.remove()};i.onclick=A,g.onclick=E,f.onclick=E,o.onkeydown=n=>{n.key==="Enter"?(n.preventDefault(),A()):n.key==="Escape"&&(n.preventDefault(),E())},r.onclick=n=>{n.target===r&&E()},u.appendChild(h),u.appendChild(B),u.appendChild(v),r.appendChild(u),document.body.appendChild(r),setTimeout(()=>o.focus(),100)}function I(t,c){let s;if(c)s=c;else{const d=window.getSelection();if(!d||d.rangeCount===0)return;s=d.getRangeAt(0)}let a=null,l=s.startContainer;for(;l&&l!==document.body;){if(l.nodeType===Node.ELEMENT_NODE){const d=l;if(d.getAttribute("contenteditable")==="true"){a=d;break}}l=l.parentNode}const e=a?.innerHTML??"",r=document.createElement("span");r.id=t,r.className="rte-anchor",r.setAttribute("data-type","anchor"),r.setAttribute("data-anchor-id",t),r.setAttribute("title",`Anchor: ${t}`),r.style.cssText=`
|
|
95
95
|
display: inline;
|
|
96
96
|
position: relative;
|
|
97
97
|
cursor: pointer;
|
|
98
|
-
`,
|
|
98
|
+
`,s.insertNode(r),b.add(t),s.setStart(r.nextSibling||r.parentNode,0),s.collapse(!0);const u=window.getSelection();if(u&&(u.removeAllRanges(),u.addRange(s)),a)z(a,e),a.dispatchEvent(new Event("input",{bubbles:!0}));else{const d=w.findEditorContainerFromSelection();if(d){const h=w.getContentElement(d);h&&h.dispatchEvent(new Event("input",{bubbles:!0}))}}D()}function D(){if(document.getElementById("rte-anchor-styles"))return;const t=document.createElement("style");t.id="rte-anchor-styles",t.textContent=`
|
|
99
99
|
.rte-anchor {
|
|
100
100
|
display: inline;
|
|
101
101
|
position: relative;
|
|
@@ -173,4 +173,4 @@
|
|
|
173
173
|
outline: 2px solid #0066cc;
|
|
174
174
|
outline-offset: 2px;
|
|
175
175
|
}
|
|
176
|
-
`,document.head.appendChild(t)}const
|
|
176
|
+
`,document.head.appendChild(t)}const O=()=>(typeof window<"u"&&(M(),D()),{name:"anchor",toolbar:[{label:"Anchor",command:"insertAnchor",icon:'<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M12 8.4C13.4912 8.4 14.7 7.19117 14.7 5.7C14.7 4.20883 13.4912 3 12 3C10.5088 3 9.3 4.20883 9.3 5.7C9.3 7.19117 10.5088 8.4 12 8.4ZM12 8.4V20.9999M12 20.9999C9.61305 20.9999 7.32387 20.0518 5.63604 18.364C3.94821 16.6761 3 14.3869 3 12H5M12 20.9999C14.3869 20.9999 16.6761 20.0518 18.364 18.364C20.0518 16.6761 21 14.3869 21 12H19" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>',shortcut:"Mod-Shift-k"}],commands:{insertAnchor:()=>{try{const t=window.getSelection();if(!t||t.rangeCount===0)return alert("Please place your cursor where you want to insert the anchor."),!1;const c=t.getRangeAt(0).cloneRange();return _("add","",s=>{I(s,c)},c),!0}catch(t){return console.error("Failed to insert anchor:",t),!1}}},keymap:{"Mod-Shift-k":"insertAnchor"}});exports.AnchorPlugin=O;
|