@editora/core 1.0.23 → 1.0.25
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/{A11yCheckerPlugin.native-qW_njhLY.mjs → A11yCheckerPlugin.native-BBCsR5Ur.mjs} +7 -5
- package/dist/{AnchorPlugin.native-Drmxhy98.mjs → AnchorPlugin.native-Dk9R26cF.mjs} +20 -19
- package/dist/{ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs → ApprovalWorkflowPlugin.native-AeJsehXM.mjs} +56 -55
- package/dist/{BackgroundColorPlugin.native-H3XyYD7_.mjs → BackgroundColorPlugin.native-DCAd94kp.mjs} +103 -98
- package/dist/{BlocksLibraryPlugin.native-CownM6Rk.mjs → BlocksLibraryPlugin.native-D9OPcnQV.mjs} +42 -43
- package/dist/{CitationsPlugin.native-C_7wWQ-k.mjs → CitationsPlugin.native-BFChgCSV.mjs} +51 -51
- package/dist/{CodePlugin.native-DZgIez08.mjs → CodePlugin.native-CPfKDrkr.mjs} +1383 -1094
- package/dist/{CodePlugin.native-CAHk9ecG.mjs → CodePlugin.native-CRpX2G93.mjs} +167 -113
- package/dist/{CodeSamplePlugin.native-svbAFWh_.mjs → CodeSamplePlugin.native-Bai8bgl3.mjs} +5 -5
- package/dist/{CommentsPlugin.native-DncTHiEe.mjs → CommentsPlugin.native-DHCDUm9f.mjs} +161 -141
- package/dist/{ConditionalContentPlugin.native-Bf7XgRSW.mjs → ConditionalContentPlugin.native-B3R6xcqn.mjs} +3 -3
- package/dist/{ContentRulesPlugin.native-vPx5nC73.mjs → ContentRulesPlugin.native-BISqhQKJ.mjs} +52 -52
- package/dist/{DataBindingPlugin.native-B7lpI_0c.mjs → DataBindingPlugin.native-DbaDeXNp.mjs} +37 -37
- package/dist/{DocumentManagerPlugin.native-B8K-Oqom.mjs → DocumentManagerPlugin.native-CaBqCH-p.mjs} +21 -20
- package/dist/{EmbedIframePlugin.native-BfZ_HGlV.mjs → EmbedIframePlugin.native-qHMf1Jtg.mjs} +7 -7
- package/dist/{EmojisPlugin.native-D92aaOKi.mjs → EmojisPlugin.native-B64efKg5.mjs} +4 -4
- package/dist/{FormatPainterPlugin.native-BhjzsiVq.mjs → FormatPainterPlugin.native-CAc1N6xU.mjs} +183 -161
- package/dist/{HeadingPlugin.native-DZdvubrQ.mjs → HeadingPlugin.native-C3YiGERx.mjs} +85 -72
- package/dist/HistoryPlugin.native-C8GyxsgC.mjs +330 -0
- package/dist/{LinkPlugin.native-BsQXYsK6.mjs → LinkPlugin.native-Dt_p6Ukb.mjs} +4 -4
- package/dist/ListPlugin.native-UYaoRiub.mjs +239 -0
- package/dist/{MathPlugin.native-Byo3WL0f.mjs → MathPlugin.native-Cq9WQ7cq.mjs} +148 -130
- package/dist/MediaManagerPlugin.native-0YFHZfsb.mjs +4823 -0
- package/dist/MediaManagerPlugin.native-mXWWARRX.mjs +4908 -0
- package/dist/{MentionPlugin.native-S_lwGZQO.mjs → MentionPlugin.native-Zb1dwdxU.mjs} +304 -300
- package/dist/{MergeTagPlugin.native-7-6F3S1Y.mjs → MergeTagPlugin.native-BXkVPvCo.mjs} +6 -4
- package/dist/{PIIRedactionPlugin.native-g7j4jOmm.mjs → PIIRedactionPlugin.native-Cm0bpzQb.mjs} +2 -2
- package/dist/{PreviewPlugin.native-Dv5OsffK.mjs → PreviewPlugin.native-CrfiwP2J.mjs} +2 -2
- package/dist/{SlashCommandsPlugin.native-BDIIwGNs.mjs → SlashCommandsPlugin.native-BzGTRmMB.mjs} +264 -240
- package/dist/{SmartPastePlugin.native-BATLCds5.mjs → SmartPastePlugin.native-DnOJhDsf.mjs} +2 -2
- package/dist/{SpecialCharactersPlugin.native-CdZoc1GB.mjs → SpecialCharactersPlugin.native-B0XaCfjZ.mjs} +4 -4
- package/dist/{SpellCheckPlugin.native-BGm2qPfn.mjs → SpellCheckPlugin.native-BE7os1Xj.mjs} +302 -265
- package/dist/{TablePlugin.native-C1YZ372P.mjs → TablePlugin.native-CWxEFpV8.mjs} +159 -136
- package/dist/{TemplatePlugin.native-Dwk8TgxI.mjs → TemplatePlugin.native-OD8Wc1R7.mjs} +6 -4
- package/dist/{TextColorPlugin.native-KMZ2uzlq.mjs → TextColorPlugin.native-C2IjioNM.mjs} +75 -71
- package/dist/{TranslationWorkflowPlugin.native-CZtG--06.mjs → TranslationWorkflowPlugin.native-BGXVJD9f.mjs} +101 -98
- package/dist/{VersionDiffPlugin.native-Ca1fMWUJ.mjs → VersionDiffPlugin.native-DJZIzFSK.mjs} +11 -11
- package/dist/anchoredPopover-QN4jNbW1.mjs +134 -0
- package/dist/confirmDialog-CNqPHT5x.mjs +92 -0
- package/dist/dialogHelpers-Dzn8DHoF.mjs +194 -0
- package/dist/{documentManager-BWK_-KJp.mjs → documentManager-DHLCoWzw.mjs} +1963 -1969
- package/dist/editora.min.js +21 -21
- package/dist/editora.umd.js +10 -10
- package/dist/index-DHPPVQwx.js +12 -0
- package/dist/{index-DGMYWPLx.mjs → index-gI4djib2.mjs} +407 -327
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/katex-DLIObQUm.mjs +11683 -0
- package/dist/katex.min--Ws3c9be.mjs +6 -0
- package/dist/notify-DCQGpmq-.mjs +60 -0
- package/dist/plugin-loader.js +54 -54
- package/dist/shared-config-DuA34Iii.mjs +26 -0
- package/dist/webcomponent-core.js +315 -235
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +153 -80
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +672 -592
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +3099 -1532
- package/package.json +1 -1
- package/dist/HistoryPlugin.native-DPvhks6h.mjs +0 -246
- package/dist/ListPlugin.native-Bt0LANbO.mjs +0 -139
- package/dist/MediaManagerPlugin.native-BT1NZIJS.mjs +0 -998
- package/dist/anchoredPopover-DJFD2oAP.mjs +0 -116
- package/dist/dialogHelpers-DBf7WqYH.mjs +0 -40
- package/dist/index-C1sO7DAC.js +0 -12
package/dist/{BackgroundColorPlugin.native-H3XyYD7_.mjs → BackgroundColorPlugin.native-DCAd94kp.mjs}
RENAMED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { n as P } from "./notify-DCQGpmq-.mjs";
|
|
2
|
+
import { a as R, b as T } from "./anchoredPopover-QN4jNbW1.mjs";
|
|
3
|
+
import { r as I } from "./dialogHelpers-Dzn8DHoF.mjs";
|
|
4
|
+
let l = null, L = null, g = null, y = null, i = "#ffff00";
|
|
5
|
+
const k = '[data-theme="dark"], .dark, .editora-theme-dark', M = [
|
|
4
6
|
"#000000",
|
|
5
7
|
"#ffffff",
|
|
6
8
|
"#808080",
|
|
@@ -19,10 +21,10 @@ function A() {
|
|
|
19
21
|
if (e && e.rangeCount > 0) {
|
|
20
22
|
const c = e.getRangeAt(0).startContainer, n = c.nodeType === Node.ELEMENT_NODE ? c : c.parentElement;
|
|
21
23
|
if (n) {
|
|
22
|
-
const
|
|
24
|
+
const r = n.closest(
|
|
23
25
|
'[data-editora-editor="true"], .rte-editor, .editora-editor'
|
|
24
26
|
);
|
|
25
|
-
if (
|
|
27
|
+
if (r) return r;
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
const t = document.activeElement;
|
|
@@ -30,15 +32,15 @@ function A() {
|
|
|
30
32
|
'[data-editora-editor="true"], .rte-editor, .editora-editor'
|
|
31
33
|
) : null;
|
|
32
34
|
}
|
|
33
|
-
function
|
|
34
|
-
const t = window.__editoraLastCommand,
|
|
35
|
-
if (t === e &&
|
|
36
|
-
const
|
|
37
|
-
if (
|
|
38
|
-
return
|
|
35
|
+
function U(e) {
|
|
36
|
+
const t = window.__editoraLastCommand, o = window.__editoraLastCommandButton;
|
|
37
|
+
if (t === e && o && o.isConnected) {
|
|
38
|
+
const a = window.getComputedStyle(o), s = o.getBoundingClientRect();
|
|
39
|
+
if (a.display !== "none" && a.visibility !== "hidden" && a.pointerEvents !== "none" && !(s.width === 0 && s.height === 0))
|
|
40
|
+
return o;
|
|
39
41
|
}
|
|
40
|
-
const c = (
|
|
41
|
-
for (const s of
|
|
42
|
+
const c = (a) => {
|
|
43
|
+
for (const s of a) {
|
|
42
44
|
const d = window.getComputedStyle(s), p = s.getBoundingClientRect();
|
|
43
45
|
if (!(d.display === "none" || d.visibility === "hidden" || d.pointerEvents === "none") && !(p.width === 0 && p.height === 0))
|
|
44
46
|
return s;
|
|
@@ -46,27 +48,27 @@ function M(e) {
|
|
|
46
48
|
return null;
|
|
47
49
|
}, n = A();
|
|
48
50
|
if (n) {
|
|
49
|
-
const
|
|
51
|
+
const a = Array.from(
|
|
50
52
|
n.querySelectorAll(`[data-command="${e}"]`)
|
|
51
|
-
), s = c(
|
|
53
|
+
), s = c(a);
|
|
52
54
|
if (s) return s;
|
|
53
55
|
}
|
|
54
|
-
const
|
|
56
|
+
const r = Array.from(
|
|
55
57
|
document.querySelectorAll(`[data-command="${e}"]`)
|
|
56
58
|
);
|
|
57
|
-
return c(
|
|
59
|
+
return c(r);
|
|
58
60
|
}
|
|
59
|
-
function
|
|
61
|
+
function q(e) {
|
|
60
62
|
if (e != null && e.closest(k)) return !0;
|
|
61
63
|
const t = window.getSelection();
|
|
62
64
|
if (t && t.rangeCount > 0) {
|
|
63
65
|
const c = t.getRangeAt(0).startContainer, n = c.nodeType === Node.ELEMENT_NODE ? c : c.parentElement;
|
|
64
66
|
if (n != null && n.closest(k)) return !0;
|
|
65
67
|
}
|
|
66
|
-
const
|
|
67
|
-
return
|
|
68
|
+
const o = document.activeElement;
|
|
69
|
+
return o != null && o.closest(k) ? !0 : document.body.matches(k) || document.documentElement.matches(k);
|
|
68
70
|
}
|
|
69
|
-
function
|
|
71
|
+
function F() {
|
|
70
72
|
if (document.getElementById("rte-bg-color-picker-styles"))
|
|
71
73
|
return;
|
|
72
74
|
const e = document.createElement("style");
|
|
@@ -289,97 +291,97 @@ function U() {
|
|
|
289
291
|
}
|
|
290
292
|
`, document.head.appendChild(e);
|
|
291
293
|
}
|
|
292
|
-
function
|
|
294
|
+
function _() {
|
|
293
295
|
const e = document.createElement("div");
|
|
294
|
-
e.className = "rte-bg-color-picker",
|
|
296
|
+
e.className = "rte-bg-color-picker", q(L) && e.classList.add("rte-theme-dark"), e.addEventListener("click", (h) => h.stopPropagation());
|
|
295
297
|
const t = document.createElement("div");
|
|
296
298
|
t.className = "rte-bg-color-picker-header";
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
+
const o = document.createElement("span");
|
|
300
|
+
o.className = "rte-bg-color-picker-title", o.textContent = "Background Color";
|
|
299
301
|
const c = document.createElement("button");
|
|
300
|
-
c.type = "button", c.className = "rte-bg-color-picker-close", c.id = "rte-bg-color-close", c.setAttribute("aria-label", "Close"), c.textContent = "×", t.appendChild(
|
|
302
|
+
c.type = "button", c.className = "rte-bg-color-picker-close", c.id = "rte-bg-color-close", c.setAttribute("aria-label", "Close"), c.textContent = "×", t.appendChild(o), t.appendChild(c);
|
|
301
303
|
const n = document.createElement("div");
|
|
302
304
|
n.className = "rte-bg-color-picker-body";
|
|
303
|
-
const
|
|
304
|
-
|
|
305
|
-
const
|
|
306
|
-
|
|
305
|
+
const r = document.createElement("div");
|
|
306
|
+
r.className = "rte-bg-color-section";
|
|
307
|
+
const a = document.createElement("div");
|
|
308
|
+
a.className = "rte-bg-color-preview";
|
|
307
309
|
const s = document.createElement("div");
|
|
308
310
|
s.className = "rte-bg-color-preview-swatch", s.id = "rte-bg-color-preview-swatch";
|
|
309
311
|
const d = document.createElement("span");
|
|
310
|
-
d.className = "rte-bg-color-preview-hex", d.id = "rte-bg-color-preview-hex",
|
|
312
|
+
d.className = "rte-bg-color-preview-hex", d.id = "rte-bg-color-preview-hex", a.appendChild(s), a.appendChild(d), r.appendChild(a);
|
|
311
313
|
const p = document.createElement("div");
|
|
312
314
|
p.className = "rte-bg-color-section";
|
|
313
|
-
const
|
|
314
|
-
|
|
315
|
+
const E = document.createElement("div");
|
|
316
|
+
E.className = "rte-bg-color-section-label", E.textContent = "Colors";
|
|
315
317
|
const x = document.createElement("div");
|
|
316
|
-
x.className = "rte-bg-color-grid", x.id = "rte-bg-color-grid",
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
}), p.appendChild(
|
|
318
|
+
x.className = "rte-bg-color-grid", x.id = "rte-bg-color-grid", M.forEach((h) => {
|
|
319
|
+
const f = document.createElement("button");
|
|
320
|
+
f.type = "button", f.className = "rte-bg-color-swatch", f.style.backgroundColor = h, f.dataset.color = h, f.title = h, x.appendChild(f);
|
|
321
|
+
}), p.appendChild(E), p.appendChild(x);
|
|
320
322
|
const C = document.createElement("div");
|
|
321
323
|
C.className = "rte-bg-color-section";
|
|
322
|
-
const
|
|
323
|
-
|
|
324
|
+
const S = document.createElement("div");
|
|
325
|
+
S.className = "rte-bg-color-section-label", S.textContent = "Custom";
|
|
324
326
|
const w = document.createElement("div");
|
|
325
327
|
w.className = "rte-bg-color-custom";
|
|
326
|
-
const
|
|
327
|
-
|
|
328
|
+
const b = document.createElement("input");
|
|
329
|
+
b.type = "color", b.className = "rte-bg-color-input", b.id = "rte-bg-color-input", b.setAttribute("aria-label", "Custom background colour"), b.value = i;
|
|
328
330
|
const u = document.createElement("input");
|
|
329
|
-
return u.type = "text", u.className = "rte-bg-color-text-input", u.id = "rte-bg-color-text-input", u.placeholder = "#FFFF00", u.value = i.toUpperCase(), u.maxLength = 7, w.appendChild(
|
|
331
|
+
return u.type = "text", u.className = "rte-bg-color-text-input", u.id = "rte-bg-color-text-input", u.placeholder = "#FFFF00", u.value = i.toUpperCase(), u.maxLength = 7, w.appendChild(b), w.appendChild(u), C.appendChild(S), C.appendChild(w), n.appendChild(r), n.appendChild(p), n.appendChild(C), e.appendChild(t), e.appendChild(n), e;
|
|
330
332
|
}
|
|
331
|
-
function
|
|
332
|
-
if (!
|
|
333
|
-
const e =
|
|
334
|
-
e == null || e.addEventListener("click", () =>
|
|
335
|
-
const t =
|
|
333
|
+
function z() {
|
|
334
|
+
if (!l) return;
|
|
335
|
+
const e = l.querySelector("#rte-bg-color-close");
|
|
336
|
+
e == null || e.addEventListener("click", () => m());
|
|
337
|
+
const t = l.querySelector("#rte-bg-color-grid");
|
|
336
338
|
t && t.addEventListener("click", (n) => {
|
|
337
|
-
const
|
|
338
|
-
if (
|
|
339
|
-
const
|
|
340
|
-
|
|
339
|
+
const r = n.target;
|
|
340
|
+
if (r.classList.contains("rte-bg-color-swatch")) {
|
|
341
|
+
const a = r.dataset.color;
|
|
342
|
+
a && (i = a, v(a), m());
|
|
341
343
|
}
|
|
342
344
|
});
|
|
343
|
-
const
|
|
344
|
-
|
|
345
|
-
const
|
|
346
|
-
i =
|
|
347
|
-
}),
|
|
348
|
-
i = n.target.value.toUpperCase(),
|
|
345
|
+
const o = l.querySelector("#rte-bg-color-input");
|
|
346
|
+
o && (o.addEventListener("change", (n) => {
|
|
347
|
+
const r = n.target.value.toUpperCase();
|
|
348
|
+
i = r, v(r), m();
|
|
349
|
+
}), o.addEventListener("input", (n) => {
|
|
350
|
+
i = n.target.value.toUpperCase(), N(), B();
|
|
349
351
|
}));
|
|
350
|
-
const c =
|
|
352
|
+
const c = l.querySelector("#rte-bg-color-text-input");
|
|
351
353
|
c && (c.addEventListener("change", (n) => {
|
|
352
|
-
let
|
|
353
|
-
|
|
354
|
+
let r = n.target.value.trim();
|
|
355
|
+
r && !r.startsWith("#") && (r = "#" + r), /^#[0-9A-F]{6}$/i.test(r) && (i = r.toUpperCase(), v(i), m());
|
|
354
356
|
}), c.addEventListener("input", (n) => {
|
|
355
|
-
let
|
|
356
|
-
|
|
357
|
+
let r = n.target.value.trim();
|
|
358
|
+
r && !r.startsWith("#") && (r = "#" + r, c.value = r), /^#[0-9A-F]{6}$/i.test(r) && (i = r.toUpperCase(), N(), B());
|
|
357
359
|
}));
|
|
358
360
|
}
|
|
359
|
-
function S() {
|
|
360
|
-
if (!a) return;
|
|
361
|
-
const e = a.querySelector("#rte-bg-color-preview-swatch"), t = a.querySelector("#rte-bg-color-preview-hex"), r = a.querySelector("#rte-bg-color-input"), c = a.querySelector("#rte-bg-color-text-input");
|
|
362
|
-
e && (e.style.backgroundColor = i), t && (t.textContent = i.toUpperCase()), r && (r.value = i), c && (c.value = i.toUpperCase());
|
|
363
|
-
}
|
|
364
361
|
function N() {
|
|
365
|
-
if (!
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
362
|
+
if (!l) return;
|
|
363
|
+
const e = l.querySelector("#rte-bg-color-preview-swatch"), t = l.querySelector("#rte-bg-color-preview-hex"), o = l.querySelector("#rte-bg-color-input"), c = l.querySelector("#rte-bg-color-text-input");
|
|
364
|
+
e && (e.style.backgroundColor = i), t && (t.textContent = i.toUpperCase()), o && (o.value = i), c && (c.value = i.toUpperCase());
|
|
365
|
+
}
|
|
366
|
+
function B() {
|
|
367
|
+
if (!l) return;
|
|
368
|
+
l.querySelectorAll(".rte-bg-color-swatch").forEach((t) => {
|
|
369
|
+
const o = t.dataset.color;
|
|
370
|
+
(o == null ? void 0 : o.toUpperCase()) === i.toUpperCase() ? t.classList.add("selected") : t.classList.remove("selected");
|
|
369
371
|
});
|
|
370
372
|
}
|
|
371
|
-
function
|
|
373
|
+
function H() {
|
|
372
374
|
try {
|
|
373
375
|
const e = window.getSelection();
|
|
374
376
|
if (!e || e.rangeCount === 0)
|
|
375
377
|
return "#ffff00";
|
|
376
|
-
const
|
|
378
|
+
const o = e.getRangeAt(0).commonAncestorContainer, c = o.nodeType === 1 ? o : o.parentElement;
|
|
377
379
|
if (c) {
|
|
378
380
|
const n = c.closest('[style*="background-color"]');
|
|
379
381
|
if (n) {
|
|
380
|
-
const
|
|
381
|
-
if (
|
|
382
|
-
return
|
|
382
|
+
const r = n.style.backgroundColor;
|
|
383
|
+
if (r)
|
|
384
|
+
return D(r);
|
|
383
385
|
}
|
|
384
386
|
}
|
|
385
387
|
return "#ffff00";
|
|
@@ -387,51 +389,54 @@ function z() {
|
|
|
387
389
|
return "#ffff00";
|
|
388
390
|
}
|
|
389
391
|
}
|
|
390
|
-
function
|
|
392
|
+
function D(e) {
|
|
391
393
|
if (e.startsWith("#"))
|
|
392
394
|
return e.toUpperCase();
|
|
393
395
|
const t = e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);
|
|
394
396
|
if (t) {
|
|
395
|
-
const
|
|
396
|
-
return "#" + [
|
|
397
|
-
const
|
|
398
|
-
return
|
|
397
|
+
const o = parseInt(t[1]), c = parseInt(t[2]), n = parseInt(t[3]);
|
|
398
|
+
return "#" + [o, c, n].map((r) => {
|
|
399
|
+
const a = r.toString(16);
|
|
400
|
+
return a.length === 1 ? "0" + a : a;
|
|
399
401
|
}).join("").toUpperCase();
|
|
400
402
|
}
|
|
401
403
|
return "#ffff00";
|
|
402
404
|
}
|
|
403
405
|
function v(e) {
|
|
404
|
-
const t =
|
|
406
|
+
const t = R({
|
|
405
407
|
color: e,
|
|
406
408
|
className: "rte-bg-color",
|
|
407
409
|
styleProperty: "backgroundColor",
|
|
408
410
|
commands: ["hiliteColor", "backColor"],
|
|
409
|
-
savedRange:
|
|
411
|
+
savedRange: y,
|
|
410
412
|
getActiveEditorRoot: A,
|
|
411
413
|
warnMessage: "[BackgroundColor] Could not apply highlight for current selection"
|
|
412
414
|
});
|
|
413
415
|
return t && console.log("[BackgroundColor] Applied color:", e), t;
|
|
414
416
|
}
|
|
415
|
-
function
|
|
416
|
-
|
|
417
|
+
function m() {
|
|
418
|
+
const e = !!l && l.contains(document.activeElement), t = y, o = e ? A() : null;
|
|
419
|
+
g && (g.destroy(), g = null), l && (l.remove(), l = null), L = null, y = null, e && I(o, t);
|
|
417
420
|
}
|
|
418
|
-
function
|
|
419
|
-
if (
|
|
420
|
-
return
|
|
421
|
-
const e =
|
|
421
|
+
function O() {
|
|
422
|
+
if (F(), l)
|
|
423
|
+
return m(), !0;
|
|
424
|
+
const e = U("openBackgroundColorPicker");
|
|
422
425
|
if (!e)
|
|
423
426
|
return !1;
|
|
424
427
|
const t = window.getSelection();
|
|
425
|
-
return !t || t.isCollapsed ? (
|
|
426
|
-
popover:
|
|
428
|
+
return !t || t.isCollapsed ? (P("Please select text to apply background color"), !1) : (t.rangeCount > 0 && (y = t.getRangeAt(0).cloneRange()), i = H(), l = _(), document.body.appendChild(l), L = e, g && (g.destroy(), g = null), g = T({
|
|
429
|
+
popover: l,
|
|
427
430
|
anchor: e,
|
|
428
|
-
onClose:
|
|
431
|
+
onClose: m,
|
|
429
432
|
gap: 8,
|
|
430
433
|
margin: 8,
|
|
431
|
-
zIndex: 1e4
|
|
432
|
-
|
|
434
|
+
zIndex: 1e4,
|
|
435
|
+
label: "Background color",
|
|
436
|
+
initialFocus: ".rte-bg-color-swatch.selected, .rte-bg-color-swatch"
|
|
437
|
+
}), N(), B(), z(), !0);
|
|
433
438
|
}
|
|
434
|
-
const
|
|
439
|
+
const V = () => ({
|
|
435
440
|
name: "backgroundColor",
|
|
436
441
|
marks: {
|
|
437
442
|
backgroundColor: {
|
|
@@ -473,7 +478,7 @@ const O = () => ({
|
|
|
473
478
|
}
|
|
474
479
|
],
|
|
475
480
|
commands: {
|
|
476
|
-
openBackgroundColorPicker: () =>
|
|
481
|
+
openBackgroundColorPicker: () => O(),
|
|
477
482
|
setBackgroundColor: (e) => e ? v(e) : !1
|
|
478
483
|
},
|
|
479
484
|
keymap: {
|
|
@@ -481,6 +486,6 @@ const O = () => ({
|
|
|
481
486
|
}
|
|
482
487
|
});
|
|
483
488
|
export {
|
|
484
|
-
|
|
489
|
+
V as BackgroundColorPlugin
|
|
485
490
|
};
|
|
486
|
-
//# sourceMappingURL=BackgroundColorPlugin.native-
|
|
491
|
+
//# sourceMappingURL=BackgroundColorPlugin.native-DCAd94kp.mjs.map
|
package/dist/{BlocksLibraryPlugin.native-CownM6Rk.mjs → BlocksLibraryPlugin.native-D9OPcnQV.mjs}
RENAMED
|
@@ -19,8 +19,8 @@ const Be = /* @__PURE__ */ new Set(["script", "style", "meta", "link", "object",
|
|
|
19
19
|
lastInsertedPrefix: "Last inserted",
|
|
20
20
|
resultsListLabel: "Block results"
|
|
21
21
|
}, b = /* @__PURE__ */ new WeakMap(), J = /* @__PURE__ */ new WeakMap(), w = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap(), O = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new WeakMap(), W = /* @__PURE__ */ new WeakMap(), z = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), te = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new WeakMap(), oe = /* @__PURE__ */ new Set();
|
|
22
|
-
let X = 0, je = 0, ke = 0, A = null,
|
|
23
|
-
function
|
|
22
|
+
let X = 0, je = 0, ke = 0, A = null, m = null, _ = null, P = null, I = null, D = null;
|
|
23
|
+
function h(e) {
|
|
24
24
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
25
25
|
}
|
|
26
26
|
function We(e) {
|
|
@@ -117,12 +117,12 @@ function $e(e, t) {
|
|
|
117
117
|
for (; r.has(d); )
|
|
118
118
|
d = `${d}-${ke++}`;
|
|
119
119
|
r.add(d);
|
|
120
|
-
const f = (l.tags || []).map((H) => t.normalizeText(H)).filter(Boolean), g = (l.keywords || []).map((H) => t.normalizeText(H)).filter(Boolean),
|
|
120
|
+
const f = (l.tags || []).map((H) => t.normalizeText(H)).filter(Boolean), g = (l.keywords || []).map((H) => t.normalizeText(H)).filter(Boolean), y = t.normalizeText(l.description || ""), C = Ue(a), V = [n, y, s, ...f, ...g, C].join(" ").toLowerCase();
|
|
121
121
|
o.push({
|
|
122
122
|
id: d,
|
|
123
123
|
label: n,
|
|
124
124
|
html: a,
|
|
125
|
-
description:
|
|
125
|
+
description: y,
|
|
126
126
|
category: s,
|
|
127
127
|
categoryKey: i,
|
|
128
128
|
tags: f,
|
|
@@ -237,8 +237,8 @@ function S(e, t = !0, r = !0) {
|
|
|
237
237
|
if (a) return a;
|
|
238
238
|
}
|
|
239
239
|
if (r) {
|
|
240
|
-
if (
|
|
241
|
-
|
|
240
|
+
if (m && m.isConnected) return m;
|
|
241
|
+
m && !m.isConnected && (m = null);
|
|
242
242
|
}
|
|
243
243
|
return t ? document.querySelector(L) : null;
|
|
244
244
|
}
|
|
@@ -347,7 +347,7 @@ function ge(e) {
|
|
|
347
347
|
var r;
|
|
348
348
|
Ae(e), tt(e), q.delete(e);
|
|
349
349
|
const t = W.get(e);
|
|
350
|
-
t && (t.abort(), W.delete(e)), j.delete(e), z.delete(e), (r = x.get(e)) == null || r.remove(), x.delete(e), U.delete(e), b.delete(e), J.delete(e), w.delete(e), R.delete(e), O.delete(e), oe.delete(e),
|
|
350
|
+
t && (t.abort(), W.delete(e)), j.delete(e), z.delete(e), (r = x.get(e)) == null || r.remove(), x.delete(e), U.delete(e), b.delete(e), J.delete(e), w.delete(e), R.delete(e), O.delete(e), oe.delete(e), m === e && (m = null);
|
|
351
351
|
}
|
|
352
352
|
function rt(e) {
|
|
353
353
|
var t, r, o, l;
|
|
@@ -435,7 +435,7 @@ function v(e) {
|
|
|
435
435
|
const c = t.querySelector('[data-field="category"]');
|
|
436
436
|
if (c) {
|
|
437
437
|
const B = ot(e, r);
|
|
438
|
-
c.innerHTML = B.map((p) => `<option value="${
|
|
438
|
+
c.innerHTML = B.map((p) => `<option value="${h(p.value)}">${h(p.label)}</option>`).join(""), B.some((p) => p.value === o.category) || (o.category = "all"), c.value = o.category;
|
|
439
439
|
}
|
|
440
440
|
const d = t.querySelector(".rte-blocks-library-helper");
|
|
441
441
|
d && (d.textContent = r.labels.helperText);
|
|
@@ -443,11 +443,11 @@ function v(e) {
|
|
|
443
443
|
f && f.setAttribute("aria-label", r.labels.resultsListLabel);
|
|
444
444
|
const g = t.querySelector(".rte-blocks-library-shortcut");
|
|
445
445
|
g && (g.textContent = r.labels.shortcutText);
|
|
446
|
-
const
|
|
447
|
-
if (
|
|
448
|
-
|
|
446
|
+
const y = t.querySelector('[data-action="insert-selected"]');
|
|
447
|
+
if (y) {
|
|
448
|
+
y.textContent = r.labels.insertText;
|
|
449
449
|
const B = !Se(e) && !!o.selectedBlockId;
|
|
450
|
-
|
|
450
|
+
y.disabled = !B, y.setAttribute("aria-disabled", B ? "false" : "true");
|
|
451
451
|
}
|
|
452
452
|
const C = t.querySelector(".rte-blocks-library-empty"), V = t.querySelector(".rte-blocks-library-list"), H = Ie(e, r);
|
|
453
453
|
nt(e, H);
|
|
@@ -461,19 +461,18 @@ function v(e) {
|
|
|
461
461
|
<button
|
|
462
462
|
type="button"
|
|
463
463
|
class="rte-blocks-library-item${ie ? " active" : ""}"
|
|
464
|
-
data-block-id="${
|
|
464
|
+
data-block-id="${h(p.id)}"
|
|
465
465
|
role="option"
|
|
466
466
|
aria-selected="${ie ? "true" : "false"}"
|
|
467
|
-
aria-label="${m(p.label)}"
|
|
468
467
|
tabindex="${ie ? "0" : "-1"}"
|
|
469
468
|
>
|
|
470
469
|
<span class="rte-blocks-library-item-head">
|
|
471
|
-
<span class="rte-blocks-library-item-label">${
|
|
472
|
-
${De ? `<span class="rte-blocks-library-recent-pill">${
|
|
470
|
+
<span class="rte-blocks-library-item-label">${h(p.label)}</span>
|
|
471
|
+
${De ? `<span class="rte-blocks-library-recent-pill">${h(r.labels.recentHeading)}</span>` : ""}
|
|
473
472
|
</span>
|
|
474
|
-
<span class="rte-blocks-library-item-meta">${
|
|
475
|
-
${p.description ? `<span class="rte-blocks-library-item-description">${
|
|
476
|
-
${me ? `<span class="rte-blocks-library-item-preview">${
|
|
473
|
+
<span class="rte-blocks-library-item-meta">${h(p.category)}${h(Pe)}</span>
|
|
474
|
+
${p.description ? `<span class="rte-blocks-library-item-description">${h(p.description)}</span>` : ""}
|
|
475
|
+
${me ? `<span class="rte-blocks-library-item-preview">${h(me)}</span>` : ""}
|
|
477
476
|
</button>
|
|
478
477
|
</li>
|
|
479
478
|
`;
|
|
@@ -647,19 +646,19 @@ function ut(e) {
|
|
|
647
646
|
const r = b.get(e) || A || Q(), o = k(e, r), l = `rte-blocks-library-panel-${je++}`, n = `${l}-query`, a = `${l}-category`, s = document.createElement("section");
|
|
648
647
|
return s.className = u, s.id = l, s.setAttribute("role", "dialog"), s.setAttribute("aria-modal", "false"), s.setAttribute("aria-label", r.labels.panelAriaLabel), s.innerHTML = `
|
|
649
648
|
<header class="rte-blocks-library-header">
|
|
650
|
-
<h2 class="rte-blocks-library-title">${
|
|
651
|
-
<button type="button" class="rte-blocks-library-icon-btn" data-action="close" aria-label="${
|
|
649
|
+
<h2 class="rte-blocks-library-title">${h(r.labels.panelTitle)}</h2>
|
|
650
|
+
<button type="button" class="rte-blocks-library-icon-btn" data-action="close" aria-label="${h(r.labels.closeText)}">✕</button>
|
|
652
651
|
</header>
|
|
653
652
|
<div class="rte-blocks-library-body">
|
|
654
|
-
<label class="rte-blocks-library-search-label" for="${
|
|
655
|
-
<input id="${
|
|
656
|
-
<label class="rte-blocks-library-category-label" for="${
|
|
657
|
-
<select id="${
|
|
653
|
+
<label class="rte-blocks-library-search-label" for="${h(n)}"></label>
|
|
654
|
+
<input id="${h(n)}" class="rte-blocks-library-input" type="text" data-field="query" autocomplete="off" />
|
|
655
|
+
<label class="rte-blocks-library-category-label" for="${h(a)}"></label>
|
|
656
|
+
<select id="${h(a)}" class="rte-blocks-library-select" data-field="category"></select>
|
|
658
657
|
<p class="rte-blocks-library-status" aria-live="polite"></p>
|
|
659
658
|
<p class="rte-blocks-library-helper"></p>
|
|
660
659
|
<p class="rte-blocks-library-last-inserted" hidden></p>
|
|
661
660
|
<div class="rte-blocks-library-list-wrap">
|
|
662
|
-
<ul class="rte-blocks-library-list" role="listbox" aria-label="${
|
|
661
|
+
<ul class="rte-blocks-library-list" role="listbox" aria-label="${h(r.labels.resultsListLabel)}"></ul>
|
|
663
662
|
<p class="rte-blocks-library-empty" hidden></p>
|
|
664
663
|
</div>
|
|
665
664
|
<div class="rte-blocks-library-actions">
|
|
@@ -671,12 +670,12 @@ function ut(e) {
|
|
|
671
670
|
`, s.addEventListener("click", (i) => {
|
|
672
671
|
const c = i.target, d = c == null ? void 0 : c.closest("[data-action]");
|
|
673
672
|
if (d) {
|
|
674
|
-
const
|
|
675
|
-
if (
|
|
673
|
+
const y = d.getAttribute("data-action");
|
|
674
|
+
if (y === "close") {
|
|
676
675
|
M(e, !0);
|
|
677
676
|
return;
|
|
678
677
|
}
|
|
679
|
-
if (
|
|
678
|
+
if (y === "insert-selected") {
|
|
680
679
|
if (!o.selectedBlockId) return;
|
|
681
680
|
F(e, o.selectedBlockId) && M(e, !0);
|
|
682
681
|
}
|
|
@@ -751,8 +750,8 @@ async function be(e, t) {
|
|
|
751
750
|
if (s.signal.aborted || z.get(e) !== i) return;
|
|
752
751
|
const g = $e(f || [], r);
|
|
753
752
|
R.set(e, g), O.set(e, Date.now());
|
|
754
|
-
const
|
|
755
|
-
|
|
753
|
+
const y = w.get(e);
|
|
754
|
+
y && (y.loading = !1, y.loadError = null, y.filterCache.clear());
|
|
756
755
|
}).catch(() => {
|
|
757
756
|
if (s.signal.aborted || z.get(e) !== i) return;
|
|
758
757
|
const d = w.get(e);
|
|
@@ -779,7 +778,7 @@ function pt(e) {
|
|
|
779
778
|
const r = t.target, o = r == null ? void 0 : r.closest(L);
|
|
780
779
|
if (!o) return;
|
|
781
780
|
const l = b.get(o) || e;
|
|
782
|
-
k(o, l), b.set(o, l),
|
|
781
|
+
k(o, l), b.set(o, l), m = o, N(o);
|
|
783
782
|
const n = x.get(o);
|
|
784
783
|
n && (re(n, o), de(o, n), v(o));
|
|
785
784
|
}, document.addEventListener("focusin", _, !0)), P || (P = (t) => {
|
|
@@ -795,7 +794,7 @@ function pt(e) {
|
|
|
795
794
|
const l = Ze(t);
|
|
796
795
|
if (!l) return;
|
|
797
796
|
const n = b.get(l) || A || e;
|
|
798
|
-
if (k(l, n), b.set(l, n),
|
|
797
|
+
if (k(l, n), b.set(l, n), m = l, t.key === "Escape" && pe(l)) {
|
|
799
798
|
t.preventDefault(), M(l, !0);
|
|
800
799
|
return;
|
|
801
800
|
}
|
|
@@ -816,7 +815,7 @@ function pt(e) {
|
|
|
816
815
|
}));
|
|
817
816
|
}
|
|
818
817
|
function mt() {
|
|
819
|
-
_ && (document.removeEventListener("focusin", _, !0), _ = null), P && (document.removeEventListener("keydown", P, !0), P = null), I && (window.removeEventListener("scroll", I, !0), window.removeEventListener("resize", I), I = null), D && (D.disconnect(), D = null), x.forEach((t) => t.remove()), x.clear(), Array.from(oe).forEach((t) => ge(t)), A = null,
|
|
818
|
+
_ && (document.removeEventListener("focusin", _, !0), _ = null), P && (document.removeEventListener("keydown", P, !0), P = null), I && (window.removeEventListener("scroll", I, !0), window.removeEventListener("resize", I), I = null), D && (D.disconnect(), D = null), x.forEach((t) => t.remove()), x.clear(), Array.from(oe).forEach((t) => ge(t)), A = null, m = null;
|
|
820
819
|
}
|
|
821
820
|
function yt() {
|
|
822
821
|
if (typeof document == "undefined" || document.getElementById(he)) return;
|
|
@@ -1125,7 +1124,7 @@ function yt() {
|
|
|
1125
1124
|
.rte-blocks-library-item-preview {
|
|
1126
1125
|
font-size: 11px;
|
|
1127
1126
|
line-height: 1.3;
|
|
1128
|
-
color: #
|
|
1127
|
+
color: #475569;
|
|
1129
1128
|
}
|
|
1130
1129
|
|
|
1131
1130
|
.rte-blocks-library-item-preview {
|
|
@@ -1149,7 +1148,7 @@ function yt() {
|
|
|
1149
1148
|
.rte-blocks-library-empty {
|
|
1150
1149
|
margin: 8px;
|
|
1151
1150
|
font-size: 12px;
|
|
1152
|
-
color: #
|
|
1151
|
+
color: #475569;
|
|
1153
1152
|
}
|
|
1154
1153
|
|
|
1155
1154
|
.rte-blocks-library-actions {
|
|
@@ -1254,19 +1253,19 @@ const ht = (e = {}) => {
|
|
|
1254
1253
|
const n = S(l, !1, !1);
|
|
1255
1254
|
if (!n) return !1;
|
|
1256
1255
|
const a = b.get(n) || t;
|
|
1257
|
-
return k(n, a), b.set(n, a),
|
|
1256
|
+
return k(n, a), b.set(n, a), m = n, ue(n), !0;
|
|
1258
1257
|
},
|
|
1259
1258
|
openBlocksLibraryPanel: (o, l) => {
|
|
1260
1259
|
const n = S(l, !1, !1);
|
|
1261
1260
|
if (!n) return !1;
|
|
1262
1261
|
const a = b.get(n) || t;
|
|
1263
|
-
return k(n, a), b.set(n, a),
|
|
1262
|
+
return k(n, a), b.set(n, a), m = n, ue(n), !0;
|
|
1264
1263
|
},
|
|
1265
1264
|
toggleBlocksLibraryPanel: (o, l) => {
|
|
1266
1265
|
const n = S(l, !1, !1);
|
|
1267
1266
|
if (!n) return !1;
|
|
1268
1267
|
const a = b.get(n) || t;
|
|
1269
|
-
return k(n, a), b.set(n, a),
|
|
1268
|
+
return k(n, a), b.set(n, a), m = n, Re(n, typeof o == "boolean" ? o : void 0);
|
|
1270
1269
|
},
|
|
1271
1270
|
insertBlockSnippet: (o, l) => {
|
|
1272
1271
|
const n = S(l, !1, !1);
|
|
@@ -1274,13 +1273,13 @@ const ht = (e = {}) => {
|
|
|
1274
1273
|
const a = b.get(n) || t;
|
|
1275
1274
|
k(n, a), b.set(n, a);
|
|
1276
1275
|
const s = typeof o == "string" ? o : o == null ? void 0 : o.id;
|
|
1277
|
-
return s ? (
|
|
1276
|
+
return s ? (m = n, F(n, s)) : !1;
|
|
1278
1277
|
},
|
|
1279
1278
|
insertLastBlockSnippet: (o, l) => {
|
|
1280
1279
|
const n = S(l, !1, !1);
|
|
1281
1280
|
if (!n) return !1;
|
|
1282
1281
|
const a = b.get(n) || t;
|
|
1283
|
-
return k(n, a), b.set(n, a),
|
|
1282
|
+
return k(n, a), b.set(n, a), m = n, qe(n);
|
|
1284
1283
|
},
|
|
1285
1284
|
refreshBlocksLibraryData: (o, l) => {
|
|
1286
1285
|
const n = S(l, !1, !1);
|
|
@@ -1341,7 +1340,7 @@ const ht = (e = {}) => {
|
|
|
1341
1340
|
!1,
|
|
1342
1341
|
!1
|
|
1343
1342
|
);
|
|
1344
|
-
s && (
|
|
1343
|
+
s && (m = s, r.add(s), k(s, a), b.set(s, a), J.set(s, n), R.set(s, a.blocks), O.set(s, Date.now()), N(s));
|
|
1345
1344
|
},
|
|
1346
1345
|
destroy: () => {
|
|
1347
1346
|
r.forEach((o) => ge(o)), r.clear(), X = Math.max(0, X - 1), !(X > 0) && mt();
|
|
@@ -1351,4 +1350,4 @@ const ht = (e = {}) => {
|
|
|
1351
1350
|
export {
|
|
1352
1351
|
ht as BlocksLibraryPlugin
|
|
1353
1352
|
};
|
|
1354
|
-
//# sourceMappingURL=BlocksLibraryPlugin.native-
|
|
1353
|
+
//# sourceMappingURL=BlocksLibraryPlugin.native-D9OPcnQV.mjs.map
|