@editora/core 1.0.8 → 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 +6 -1
- package/dist/{ApprovalWorkflowPlugin.native-C3jtAYjG.mjs → ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs} +136 -133
- package/dist/BlockquotePlugin.native-57_Xcjl1.mjs +212 -0
- package/dist/{BlocksLibraryPlugin.native-HMWKxWNs.mjs → BlocksLibraryPlugin.native-5sdsXsiE.mjs} +90 -87
- package/dist/{BoldPlugin.native-BAzzoqU5.mjs → BoldPlugin.native-CSh_LiIJ.mjs} +11 -7
- package/dist/CapitalizationPlugin.native-DLV4oPmB.mjs +159 -0
- package/dist/ChecklistPlugin.native-BS-kMz9O.mjs +371 -0
- package/dist/{CitationsPlugin.native-BnU0qCwR.mjs → CitationsPlugin.native-DQgoCd1B.mjs} +132 -129
- package/dist/ClearFormattingPlugin.native-DIS6AN2t.mjs +172 -0
- package/dist/CodePlugin.native-C5l1IeSS.mjs +4570 -0
- package/dist/{ContentRulesPlugin.native-nBLQ8QFZ.mjs → ContentRulesPlugin.native-vPx5nC73.mjs} +105 -102
- package/dist/{DataBindingPlugin.native-jQ1JPRTp.mjs → DataBindingPlugin.native-BoXwghTz.mjs} +49 -46
- package/dist/DirectionPlugin.native-Bl-QLFzO.mjs +153 -0
- package/dist/{DocSchemaPlugin.native-CHOge18O.mjs → DocSchemaPlugin.native-DUSVRHqT.mjs} +55 -52
- package/dist/{EmbedIframePlugin.native-DKJx2OS7.mjs → EmbedIframePlugin.native-BF_-LjTq.mjs} +287 -115
- package/dist/HeadingPlugin.native-DZdvubrQ.mjs +249 -0
- package/dist/{HistoryPlugin.native-TDnVMsEO.mjs → HistoryPlugin.native-D2wl32jV.mjs} +88 -103
- package/dist/{ItalicPlugin.native-CQjjDyUL.mjs → ItalicPlugin.native-CmnlwFHB.mjs} +15 -11
- package/dist/MathPlugin.native-NwWPHVmj.mjs +369 -0
- package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-eOsTJFpw.mjs} +204 -202
- package/dist/MergeTagPlugin.native-BzRVoD9-.mjs +580 -0
- package/dist/{PIIRedactionPlugin.native-DcsjmtV1.mjs → PIIRedactionPlugin.native-g7j4jOmm.mjs} +158 -155
- package/dist/{SlashCommandsPlugin.native-CmxvMEaE.mjs → SlashCommandsPlugin.native-BiN6ODw5.mjs} +2 -2
- package/dist/{SmartPastePlugin.native-BOKKtF07.mjs → SmartPastePlugin.native-CZAEHkyt.mjs} +127 -124
- package/dist/{SpecialCharactersPlugin.native-CZDato89.mjs → SpecialCharactersPlugin.native-DaG4b19I.mjs} +100 -76
- package/dist/{StrikethroughPlugin.native-0Be7j49s.mjs → StrikethroughPlugin.native-V0TL4F48.mjs} +12 -26
- package/dist/TemplatePlugin.native-DLjFUaPW.mjs +1150 -0
- package/dist/{TranslationWorkflowPlugin.native-Bz6jDGvj.mjs → TranslationWorkflowPlugin.native-DdF16tgT.mjs} +104 -101
- package/dist/{UnderlinePlugin.native-QpIcK4L2.mjs → UnderlinePlugin.native-DZzg23rv.mjs} +8 -4
- package/dist/editora.min.js +1 -1
- package/dist/editora.umd.js +1 -1
- package/dist/index-CPMGUZfB.js +10 -0
- package/dist/{index-DqC57IEH.mjs → index-DBoj6QfW.mjs} +17 -15
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/inlineFormatting-DJ0-NZtx.mjs +97 -0
- package/dist/plugin-loader.js +37 -37
- package/dist/webcomponent-core.js +18 -16
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +139 -62
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +50 -48
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +1174 -1071
- package/package.json +11 -5
- package/LICENSE +0 -21
- package/dist/BlockquotePlugin.native-JFmOLsxN.mjs +0 -48
- package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs +0 -79
- package/dist/ChecklistPlugin.native-nuSSEFNI.mjs +0 -309
- package/dist/ClearFormattingPlugin.native-Bq_XcTh2.mjs +0 -140
- package/dist/CodePlugin.native-DlpTPdkd.mjs +0 -2691
- package/dist/DirectionPlugin.native-CDnbdNyl.mjs +0 -130
- package/dist/HeadingPlugin.native-DrLYwQnQ.mjs +0 -64
- package/dist/MathPlugin.native-f_mDp8VL.mjs +0 -292
- package/dist/MergeTagPlugin.native-C3eOfEgw.mjs +0 -559
- package/dist/TemplatePlugin.native-CrpfKRJ8.mjs +0 -602
- package/dist/index-D1LOqg5C.js +0 -10
package/dist/{BlocksLibraryPlugin.native-HMWKxWNs.mjs → BlocksLibraryPlugin.native-5sdsXsiE.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const L = ".rte-content, .editora-content", fe = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", ye = "__editoraCommandEditorRoot", he = "rte-blocks-library-styles", u = "rte-blocks-library-panel", E = "blocks-library", $ = "blocksLibrary", T = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)';
|
|
2
|
-
const
|
|
2
|
+
const Be = /* @__PURE__ */ new Set(["script", "style", "meta", "link", "object", "embed", "iframe"]), De = /^(https?:|mailto:|tel:|#|\/)/i, Oe = /^data:image\/(?:png|gif|jpeg|jpg|webp);base64,/i, Ke = {
|
|
3
3
|
panelTitle: "Blocks Library",
|
|
4
4
|
panelAriaLabel: "Blocks library panel",
|
|
5
5
|
searchLabel: "Search blocks",
|
|
@@ -23,19 +23,19 @@ let X = 0, Ne = 0, ke = 0, A = null, y = null, _ = null, P = null, I = null, D =
|
|
|
23
23
|
function m(e) {
|
|
24
24
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function je(e) {
|
|
27
27
|
return e.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function We(e) {
|
|
30
30
|
return e.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80);
|
|
31
31
|
}
|
|
32
32
|
function ce(e) {
|
|
33
33
|
const t = e.trim();
|
|
34
|
-
return t && (
|
|
34
|
+
return t && (De.test(t) || Oe.test(t)) ? t : "";
|
|
35
35
|
}
|
|
36
36
|
function xe(e) {
|
|
37
37
|
let t = e;
|
|
38
|
-
return
|
|
38
|
+
return Be.forEach((r) => {
|
|
39
39
|
const o = new RegExp(`<${r}[\\s\\S]*?>[\\s\\S]*?<\\/${r}>`, "gi"), l = new RegExp(`<${r}\\b[^>]*\\/?>`, "gi");
|
|
40
40
|
t = t.replace(o, "").replace(l, "");
|
|
41
41
|
}), t = t.replace(/\son\w+=(\"[^\"]*\"|'[^']*'|[^\s>]+)/gi, "").replace(/\s(xmlns|xml:[^=\s>]+)\s*=\s*(\"[^\"]*\"|'[^']*'|[^\s>]+)/gi, "").replace(
|
|
@@ -60,7 +60,7 @@ function xe(e) {
|
|
|
60
60
|
return ` style=${s}${a}${s}`;
|
|
61
61
|
}).trim(), t;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function Fe(e) {
|
|
64
64
|
if (!e) return "";
|
|
65
65
|
if (typeof document == "undefined")
|
|
66
66
|
return xe(e);
|
|
@@ -69,7 +69,7 @@ function We(e) {
|
|
|
69
69
|
const r = t.content;
|
|
70
70
|
return !r || typeof r.querySelectorAll != "function" ? xe(e) : (Array.from(r.querySelectorAll("*")).forEach((l) => {
|
|
71
71
|
const n = l.tagName.toLowerCase();
|
|
72
|
-
if (
|
|
72
|
+
if (Be.has(n)) {
|
|
73
73
|
l.remove();
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
@@ -97,7 +97,7 @@ function We(e) {
|
|
|
97
97
|
function ne(e) {
|
|
98
98
|
return e.trim().toLowerCase();
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function Ge(e) {
|
|
101
101
|
if (!e) return "";
|
|
102
102
|
if (typeof document == "undefined")
|
|
103
103
|
return e.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
|
|
@@ -106,18 +106,18 @@ function Fe(e) {
|
|
|
106
106
|
const r = t.content;
|
|
107
107
|
return !r || typeof r.textContent != "string" ? e.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim() : r.textContent.replace(/\s+/g, " ").trim();
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function Ce(e, t) {
|
|
110
110
|
if (!Array.isArray(e) || e.length === 0) return [];
|
|
111
111
|
const r = /* @__PURE__ */ new Set(), o = [];
|
|
112
112
|
return e.forEach((l) => {
|
|
113
113
|
const n = t.normalizeText(l.label || ""), a = t.sanitizeBlockHtml(l.html || "", l).trim();
|
|
114
114
|
if (!n || !a) return;
|
|
115
115
|
const s = t.normalizeText(l.category || "General") || "General", i = ne(s);
|
|
116
|
-
let d =
|
|
116
|
+
let d = We(t.normalizeText(l.id || n)) || `block-${ke++}`;
|
|
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), h = t.normalizeText(l.description || ""),
|
|
120
|
+
const f = (l.tags || []).map((H) => t.normalizeText(H)).filter(Boolean), g = (l.keywords || []).map((H) => t.normalizeText(H)).filter(Boolean), h = t.normalizeText(l.description || ""), B = Ge(a), V = [n, h, s, ...f, ...g, B].join(" ").toLowerCase();
|
|
121
121
|
o.push({
|
|
122
122
|
id: d,
|
|
123
123
|
label: n,
|
|
@@ -127,14 +127,14 @@ function Be(e, t) {
|
|
|
127
127
|
categoryKey: i,
|
|
128
128
|
tags: f,
|
|
129
129
|
keywords: g,
|
|
130
|
-
previewText:
|
|
130
|
+
previewText: B,
|
|
131
131
|
searchBlob: V
|
|
132
132
|
});
|
|
133
133
|
}), o;
|
|
134
134
|
}
|
|
135
135
|
function Q(e = {}) {
|
|
136
136
|
var l, n, a, s;
|
|
137
|
-
const t = e.normalizeText ||
|
|
137
|
+
const t = e.normalizeText || je, r = e.sanitizeBlockHtml || Fe, o = {
|
|
138
138
|
blocks: [],
|
|
139
139
|
defaultCategory: t(e.defaultCategory || ""),
|
|
140
140
|
maxResults: Math.max(4, Math.min(300, Number((l = e.maxResults) != null ? l : 80))),
|
|
@@ -142,16 +142,16 @@ function Q(e = {}) {
|
|
|
142
142
|
debounceMs: Math.max(0, Math.min(700, Number((a = e.debounceMs) != null ? a : 90))),
|
|
143
143
|
cacheTtlMs: Math.max(0, Number((s = e.cacheTtlMs) != null ? s : 6e4)),
|
|
144
144
|
labels: {
|
|
145
|
-
...
|
|
145
|
+
...Ke,
|
|
146
146
|
...e.labels || {}
|
|
147
147
|
},
|
|
148
148
|
normalizeText: t,
|
|
149
149
|
sanitizeBlockHtml: r,
|
|
150
150
|
getBlocks: typeof e.getBlocks == "function" ? e.getBlocks : void 0
|
|
151
151
|
};
|
|
152
|
-
return o.blocks =
|
|
152
|
+
return o.blocks = Ce(e.blocks, o), o;
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function Ue(e) {
|
|
155
155
|
return {
|
|
156
156
|
blocks: e.blocks.map((t) => ({
|
|
157
157
|
id: t.id,
|
|
@@ -182,7 +182,7 @@ function G(e) {
|
|
|
182
182
|
const t = e.querySelector(L);
|
|
183
183
|
return t instanceof HTMLElement ? t : null;
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function Ve() {
|
|
186
186
|
if (typeof window == "undefined") return null;
|
|
187
187
|
const e = window[ye];
|
|
188
188
|
if (!(e instanceof HTMLElement)) return null;
|
|
@@ -197,7 +197,7 @@ function Ue() {
|
|
|
197
197
|
const o = e.closest(L);
|
|
198
198
|
return o instanceof HTMLElement ? o : null;
|
|
199
199
|
}
|
|
200
|
-
function
|
|
200
|
+
function Ye(e) {
|
|
201
201
|
const t = e.closest("[data-editora-editor]");
|
|
202
202
|
if (t && G(t) === e)
|
|
203
203
|
return t;
|
|
@@ -223,7 +223,7 @@ function S(e, t = !0, r = !0) {
|
|
|
223
223
|
const a = G(e.editorElement);
|
|
224
224
|
if (a) return a;
|
|
225
225
|
}
|
|
226
|
-
const o =
|
|
226
|
+
const o = Ve();
|
|
227
227
|
if (o) return o;
|
|
228
228
|
const l = window.getSelection();
|
|
229
229
|
if (l && l.rangeCount > 0) {
|
|
@@ -242,7 +242,7 @@ function S(e, t = !0, r = !0) {
|
|
|
242
242
|
}
|
|
243
243
|
return t ? document.querySelector(L) : null;
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function Xe(e) {
|
|
246
246
|
const t = e.target;
|
|
247
247
|
if (t) {
|
|
248
248
|
const o = t.closest(L);
|
|
@@ -258,20 +258,20 @@ function Ye(e) {
|
|
|
258
258
|
function Z(e) {
|
|
259
259
|
return e ? (e.getAttribute("data-theme") || e.getAttribute("theme") || "").toLowerCase() === "dark" ? !0 : e.classList.contains("dark") || e.classList.contains("editora-theme-dark") || e.classList.contains("rte-theme-dark") : !1;
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function Ze(e) {
|
|
262
262
|
const t = le(e);
|
|
263
263
|
if (Z(t)) return !0;
|
|
264
264
|
const r = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
265
265
|
return Z(r) ? !0 : Z(document.documentElement) || Z(document.body);
|
|
266
266
|
}
|
|
267
267
|
function re(e, t) {
|
|
268
|
-
e.classList.remove("rte-blocks-library-theme-dark"),
|
|
268
|
+
e.classList.remove("rte-blocks-library-theme-dark"), Ze(t) && e.classList.add("rte-blocks-library-theme-dark");
|
|
269
269
|
}
|
|
270
270
|
function Te(e) {
|
|
271
271
|
return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
|
|
272
272
|
}
|
|
273
273
|
function we(e, t, r) {
|
|
274
|
-
const o =
|
|
274
|
+
const o = Ye(e);
|
|
275
275
|
Array.from(
|
|
276
276
|
o.querySelectorAll(
|
|
277
277
|
`.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`
|
|
@@ -304,11 +304,11 @@ function Se(e) {
|
|
|
304
304
|
return q.delete(e), null;
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
|
-
function
|
|
307
|
+
function Je(e) {
|
|
308
308
|
const t = Se(e);
|
|
309
309
|
return t ? (He(e, t), !0) : !1;
|
|
310
310
|
}
|
|
311
|
-
function
|
|
311
|
+
function Qe(e) {
|
|
312
312
|
if (te.has(e)) return;
|
|
313
313
|
const t = () => {
|
|
314
314
|
const r = window.getSelection();
|
|
@@ -318,7 +318,7 @@ function Je(e) {
|
|
|
318
318
|
};
|
|
319
319
|
e.addEventListener("keyup", t), e.addEventListener("mouseup", t), e.addEventListener("touchend", t), te.set(e, t);
|
|
320
320
|
}
|
|
321
|
-
function
|
|
321
|
+
function et(e) {
|
|
322
322
|
const t = te.get(e);
|
|
323
323
|
t && (e.removeEventListener("keyup", t), e.removeEventListener("mouseup", t), e.removeEventListener("touchend", t), te.delete(e));
|
|
324
324
|
}
|
|
@@ -337,7 +337,7 @@ function k(e, t) {
|
|
|
337
337
|
visibleMatches: 0,
|
|
338
338
|
filterCache: /* @__PURE__ */ new Map(),
|
|
339
339
|
debounceTimer: null
|
|
340
|
-
}, w.set(e, r)), oe.add(e),
|
|
340
|
+
}, w.set(e, r)), oe.add(e), Qe(e), r;
|
|
341
341
|
}
|
|
342
342
|
function Me(e) {
|
|
343
343
|
const t = w.get(e);
|
|
@@ -345,11 +345,11 @@ function Me(e) {
|
|
|
345
345
|
}
|
|
346
346
|
function ge(e) {
|
|
347
347
|
var r;
|
|
348
|
-
Me(e),
|
|
348
|
+
Me(e), et(e), q.delete(e);
|
|
349
349
|
const t = W.get(e);
|
|
350
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), y === e && (y = null);
|
|
351
351
|
}
|
|
352
|
-
function
|
|
352
|
+
function tt(e) {
|
|
353
353
|
var t, r, o, l;
|
|
354
354
|
for (let n = 0; n < e.length; n += 1) {
|
|
355
355
|
const a = e[n];
|
|
@@ -376,7 +376,7 @@ function ae(e) {
|
|
|
376
376
|
var t;
|
|
377
377
|
return R.get(e) || ((t = b.get(e)) == null ? void 0 : t.blocks) || [];
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function rt(e, t) {
|
|
380
380
|
const r = /* @__PURE__ */ new Map();
|
|
381
381
|
ae(e).forEach((l) => {
|
|
382
382
|
r.has(l.categoryKey) || r.set(l.categoryKey, l.category);
|
|
@@ -405,7 +405,7 @@ function Ae(e, t) {
|
|
|
405
405
|
}
|
|
406
406
|
return i;
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function ot(e, t) {
|
|
409
409
|
const r = w.get(e);
|
|
410
410
|
if (!r) return;
|
|
411
411
|
if (t.length === 0) {
|
|
@@ -414,7 +414,7 @@ function rt(e, t) {
|
|
|
414
414
|
}
|
|
415
415
|
t.some((l) => l.id === r.selectedBlockId) || (r.selectedBlockId = t[0].id);
|
|
416
416
|
}
|
|
417
|
-
function
|
|
417
|
+
function K(e) {
|
|
418
418
|
const t = w.get(e);
|
|
419
419
|
we(e, "toggleBlocksLibraryPanel", pe(e)), we(e, "insertLastBlockSnippet", !!(t != null && t.lastInsertedBlockId));
|
|
420
420
|
}
|
|
@@ -434,8 +434,8 @@ function v(e) {
|
|
|
434
434
|
i && (i.textContent = r.labels.categoryLabel);
|
|
435
435
|
const c = t.querySelector('[data-field="category"]');
|
|
436
436
|
if (c) {
|
|
437
|
-
const
|
|
438
|
-
c.innerHTML =
|
|
437
|
+
const C = rt(e, r);
|
|
438
|
+
c.innerHTML = C.map((p) => `<option value="${m(p.value)}">${m(p.label)}</option>`).join(""), C.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);
|
|
@@ -446,16 +446,16 @@ function v(e) {
|
|
|
446
446
|
const h = t.querySelector('[data-action="insert-selected"]');
|
|
447
447
|
if (h) {
|
|
448
448
|
h.textContent = r.labels.insertText;
|
|
449
|
-
const
|
|
450
|
-
h.disabled = !
|
|
449
|
+
const C = !Te(e) && !!o.selectedBlockId;
|
|
450
|
+
h.disabled = !C, h.setAttribute("aria-disabled", C ? "false" : "true");
|
|
451
451
|
}
|
|
452
|
-
const
|
|
453
|
-
|
|
452
|
+
const B = t.querySelector(".rte-blocks-library-empty"), V = t.querySelector(".rte-blocks-library-list"), H = Ae(e, r);
|
|
453
|
+
ot(e, H);
|
|
454
454
|
const Y = t.querySelector(".rte-blocks-library-status");
|
|
455
455
|
if (Y && (o.loading ? Y.textContent = r.labels.loadingText : o.loadError ? Y.textContent = o.loadError : Y.textContent = `${r.labels.summaryPrefix}: ${o.visibleMatches}/${o.totalMatches}`), V) {
|
|
456
|
-
const
|
|
456
|
+
const C = new Set(o.recentBlockIds);
|
|
457
457
|
V.innerHTML = H.map((p) => {
|
|
458
|
-
const ie = o.selectedBlockId === p.id,
|
|
458
|
+
const ie = o.selectedBlockId === p.id, _e = p.tags.length ? ` • ${p.tags.join(", ")}` : "", Pe = C.has(p.id), me = p.previewText.slice(0, 180);
|
|
459
459
|
return `
|
|
460
460
|
<li class="rte-blocks-library-item-wrapper" role="presentation">
|
|
461
461
|
<button
|
|
@@ -469,9 +469,9 @@ function v(e) {
|
|
|
469
469
|
>
|
|
470
470
|
<span class="rte-blocks-library-item-head">
|
|
471
471
|
<span class="rte-blocks-library-item-label">${m(p.label)}</span>
|
|
472
|
-
${
|
|
472
|
+
${Pe ? `<span class="rte-blocks-library-recent-pill">${m(r.labels.recentHeading)}</span>` : ""}
|
|
473
473
|
</span>
|
|
474
|
-
<span class="rte-blocks-library-item-meta">${m(p.category)}${m(
|
|
474
|
+
<span class="rte-blocks-library-item-meta">${m(p.category)}${m(_e)}</span>
|
|
475
475
|
${p.description ? `<span class="rte-blocks-library-item-description">${m(p.description)}</span>` : ""}
|
|
476
476
|
${me ? `<span class="rte-blocks-library-item-preview">${m(me)}</span>` : ""}
|
|
477
477
|
</button>
|
|
@@ -479,21 +479,21 @@ function v(e) {
|
|
|
479
479
|
`;
|
|
480
480
|
}).join("");
|
|
481
481
|
}
|
|
482
|
-
|
|
483
|
-
const
|
|
484
|
-
if (
|
|
482
|
+
B && (B.hidden = H.length > 0, B.textContent = r.labels.noResultsText);
|
|
483
|
+
const N = t.querySelector(".rte-blocks-library-last-inserted");
|
|
484
|
+
if (N)
|
|
485
485
|
if (o.lastInsertedBlockId) {
|
|
486
|
-
const
|
|
487
|
-
|
|
486
|
+
const C = ae(e).find((p) => p.id === o.lastInsertedBlockId);
|
|
487
|
+
C ? (N.hidden = !1, N.textContent = `${r.labels.lastInsertedPrefix}: ${C.label}`) : N.hidden = !0;
|
|
488
488
|
} else
|
|
489
|
-
|
|
489
|
+
N.hidden = !0;
|
|
490
490
|
t.setAttribute("aria-label", r.labels.panelAriaLabel);
|
|
491
491
|
}
|
|
492
492
|
function M(e, t = !1) {
|
|
493
493
|
const r = x.get(e);
|
|
494
|
-
r && (r.classList.remove("show"), U.set(e, !1),
|
|
494
|
+
r && (r.classList.remove("show"), U.set(e, !1), K(e), t && (e.focus({ preventScroll: !0 }), Je(e)));
|
|
495
495
|
}
|
|
496
|
-
function
|
|
496
|
+
function nt(e) {
|
|
497
497
|
const t = e.querySelector(".rte-blocks-library-item.active");
|
|
498
498
|
t == null || t.focus();
|
|
499
499
|
}
|
|
@@ -510,13 +510,13 @@ function Le(e, t) {
|
|
|
510
510
|
) + t + l.length) % l.length;
|
|
511
511
|
o.selectedBlockId = l[a].id, v(e);
|
|
512
512
|
const s = x.get(e);
|
|
513
|
-
s &&
|
|
513
|
+
s && nt(s);
|
|
514
514
|
}
|
|
515
515
|
function ue(e) {
|
|
516
|
-
const t =
|
|
516
|
+
const t = ct(e);
|
|
517
517
|
se(e), x.forEach((o, l) => {
|
|
518
518
|
l !== e && M(l, !1);
|
|
519
|
-
}), t.classList.add("show"), U.set(e, !0), v(e), de(e, t),
|
|
519
|
+
}), t.classList.add("show"), U.set(e, !0), v(e), de(e, t), K(e);
|
|
520
520
|
const r = t.querySelector('[data-field="query"]');
|
|
521
521
|
r == null || r.focus(), be(e, !1);
|
|
522
522
|
}
|
|
@@ -550,7 +550,7 @@ function ve(e, t, r) {
|
|
|
550
550
|
}
|
|
551
551
|
return se(e), !0;
|
|
552
552
|
}
|
|
553
|
-
function
|
|
553
|
+
function lt(e, t) {
|
|
554
554
|
e.focus({ preventScroll: !0 });
|
|
555
555
|
const r = Se(e);
|
|
556
556
|
if (r && ve(e, r, t))
|
|
@@ -563,7 +563,7 @@ function nt(e, t) {
|
|
|
563
563
|
const o = Re(e);
|
|
564
564
|
return o ? ve(e, o, t) : !1;
|
|
565
565
|
}
|
|
566
|
-
function
|
|
566
|
+
function st(e, t) {
|
|
567
567
|
if (t === e.innerHTML) return;
|
|
568
568
|
const r = window.execEditorCommand || window.executeEditorCommand;
|
|
569
569
|
if (typeof r == "function")
|
|
@@ -572,7 +572,7 @@ function lt(e, t) {
|
|
|
572
572
|
} catch (o) {
|
|
573
573
|
}
|
|
574
574
|
}
|
|
575
|
-
function
|
|
575
|
+
function at(e) {
|
|
576
576
|
e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
577
577
|
}
|
|
578
578
|
function F(e, t) {
|
|
@@ -584,10 +584,10 @@ function F(e, t) {
|
|
|
584
584
|
const n = ae(e).find((i) => i.id === t);
|
|
585
585
|
if (!n) return !1;
|
|
586
586
|
const a = e.innerHTML;
|
|
587
|
-
return
|
|
587
|
+
return lt(e, n.html) ? (o.lastInsertedBlockId = n.id, o.selectedBlockId = n.id, o.recentBlockIds = [n.id, ...o.recentBlockIds.filter((i) => i !== n.id)].slice(
|
|
588
588
|
0,
|
|
589
589
|
r.maxRecentBlocks
|
|
590
|
-
),
|
|
590
|
+
), st(e, a), at(e), K(e), e.dispatchEvent(
|
|
591
591
|
new CustomEvent("editora:blocks-library-insert", {
|
|
592
592
|
bubbles: !0,
|
|
593
593
|
detail: {
|
|
@@ -602,7 +602,7 @@ function ze(e) {
|
|
|
602
602
|
const t = w.get(e);
|
|
603
603
|
return t != null && t.lastInsertedBlockId ? F(e, t.lastInsertedBlockId) : !1;
|
|
604
604
|
}
|
|
605
|
-
function
|
|
605
|
+
function it(e) {
|
|
606
606
|
const t = b.get(e) || A;
|
|
607
607
|
if (!t) return;
|
|
608
608
|
const r = w.get(e);
|
|
@@ -617,7 +617,7 @@ function at(e) {
|
|
|
617
617
|
}
|
|
618
618
|
r.debounceTimer = window.setTimeout(o, t.debounceMs);
|
|
619
619
|
}
|
|
620
|
-
function
|
|
620
|
+
function ct(e) {
|
|
621
621
|
const t = x.get(e);
|
|
622
622
|
if (t) return t;
|
|
623
623
|
const r = b.get(e) || A || Q(), o = k(e, r), l = `rte-blocks-library-panel-${Ne++}`, n = `${l}-query`, a = `${l}-category`, s = document.createElement("section");
|
|
@@ -664,7 +664,7 @@ function it(e) {
|
|
|
664
664
|
g && (o.selectedBlockId = g, v(e), i.detail >= 2 && F(e, g) && M(e, !0));
|
|
665
665
|
}), s.addEventListener("input", (i) => {
|
|
666
666
|
const c = i.target;
|
|
667
|
-
!(c instanceof HTMLInputElement) || c.getAttribute("data-field") !== "query" || (o.query = r.normalizeText(c.value).toLowerCase(), o.filterCache.clear(),
|
|
667
|
+
!(c instanceof HTMLInputElement) || c.getAttribute("data-field") !== "query" || (o.query = r.normalizeText(c.value).toLowerCase(), o.filterCache.clear(), it(e));
|
|
668
668
|
}), s.addEventListener("change", (i) => {
|
|
669
669
|
const c = i.target;
|
|
670
670
|
!(c instanceof HTMLSelectElement) || c.getAttribute("data-field") !== "category" || (o.category = ne(c.value || "all") || "all", o.filterCache.clear(), v(e));
|
|
@@ -688,7 +688,7 @@ function it(e) {
|
|
|
688
688
|
}
|
|
689
689
|
}), re(s, e), document.body.appendChild(s), x.set(e, s), U.set(e, !1), v(e), s;
|
|
690
690
|
}
|
|
691
|
-
function
|
|
691
|
+
function dt(e) {
|
|
692
692
|
const t = w.get(e);
|
|
693
693
|
return {
|
|
694
694
|
query: (t == null ? void 0 : t.query) || "",
|
|
@@ -718,14 +718,14 @@ async function be(e, t) {
|
|
|
718
718
|
const i = (z.get(e) || 0) + 1;
|
|
719
719
|
z.set(e, i), o.loading = !0, o.loadError = null, v(e);
|
|
720
720
|
const c = Promise.resolve().then(async () => {
|
|
721
|
-
var
|
|
721
|
+
var B;
|
|
722
722
|
const d = {
|
|
723
723
|
editor: e,
|
|
724
724
|
editorRoot: le(e),
|
|
725
725
|
signal: s.signal
|
|
726
|
-
}, f = await ((
|
|
726
|
+
}, f = await ((B = r.getBlocks) == null ? void 0 : B.call(r, d));
|
|
727
727
|
if (s.signal.aborted || z.get(e) !== i) return;
|
|
728
|
-
const g =
|
|
728
|
+
const g = Ce(f || [], r);
|
|
729
729
|
R.set(e, g), O.set(e, Date.now());
|
|
730
730
|
const h = w.get(e);
|
|
731
731
|
h && (h.loading = !1, h.loadError = null, h.filterCache.clear());
|
|
@@ -738,21 +738,24 @@ async function be(e, t) {
|
|
|
738
738
|
});
|
|
739
739
|
return j.set(e, c), c;
|
|
740
740
|
}
|
|
741
|
-
function
|
|
742
|
-
|
|
743
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "b";
|
|
741
|
+
function qe(e) {
|
|
742
|
+
return typeof e.key == "string" ? e.key.toLowerCase() : "";
|
|
744
743
|
}
|
|
745
744
|
function ut(e) {
|
|
746
|
-
const t = e
|
|
747
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "
|
|
745
|
+
const t = qe(e);
|
|
746
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "b";
|
|
748
747
|
}
|
|
749
748
|
function bt(e) {
|
|
749
|
+
const t = qe(e);
|
|
750
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "l";
|
|
751
|
+
}
|
|
752
|
+
function ft(e) {
|
|
750
753
|
A = e, _ || (_ = (t) => {
|
|
751
754
|
ee();
|
|
752
755
|
const r = t.target, o = r == null ? void 0 : r.closest(L);
|
|
753
756
|
if (!o) return;
|
|
754
757
|
const l = b.get(o) || e;
|
|
755
|
-
k(o, l), b.set(o, l), y = o,
|
|
758
|
+
k(o, l), b.set(o, l), y = o, K(o);
|
|
756
759
|
const n = x.get(o);
|
|
757
760
|
n && (re(n, o), de(o, n), v(o));
|
|
758
761
|
}, document.addEventListener("focusin", _, !0)), P || (P = (t) => {
|
|
@@ -765,33 +768,33 @@ function bt(e) {
|
|
|
765
768
|
}
|
|
766
769
|
return;
|
|
767
770
|
}
|
|
768
|
-
const l =
|
|
771
|
+
const l = Xe(t);
|
|
769
772
|
if (!l) return;
|
|
770
773
|
const n = b.get(l) || A || e;
|
|
771
774
|
if (k(l, n), b.set(l, n), y = l, t.key === "Escape" && pe(l)) {
|
|
772
775
|
t.preventDefault(), M(l, !0);
|
|
773
776
|
return;
|
|
774
777
|
}
|
|
775
|
-
if (
|
|
778
|
+
if (ut(t)) {
|
|
776
779
|
t.preventDefault(), t.stopPropagation(), Ie(l);
|
|
777
780
|
return;
|
|
778
781
|
}
|
|
779
|
-
|
|
782
|
+
bt(t) && (t.preventDefault(), t.stopPropagation(), ze(l));
|
|
780
783
|
}, document.addEventListener("keydown", P, !0)), I || (I = () => {
|
|
781
784
|
ee(), x.forEach((t, r) => {
|
|
782
785
|
!r.isConnected || !t.isConnected || (re(t, r), de(r, t));
|
|
783
786
|
});
|
|
784
787
|
}, window.addEventListener("scroll", I, !0), window.addEventListener("resize", I)), !D && typeof MutationObserver != "undefined" && document.body && (D = new MutationObserver((t) => {
|
|
785
|
-
|
|
788
|
+
tt(t) && ee();
|
|
786
789
|
}), D.observe(document.body, {
|
|
787
790
|
childList: !0,
|
|
788
791
|
subtree: !0
|
|
789
792
|
}));
|
|
790
793
|
}
|
|
791
|
-
function
|
|
794
|
+
function gt() {
|
|
792
795
|
_ && (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, y = null;
|
|
793
796
|
}
|
|
794
|
-
function
|
|
797
|
+
function pt() {
|
|
795
798
|
if (typeof document == "undefined" || document.getElementById(he)) return;
|
|
796
799
|
const e = document.createElement("style");
|
|
797
800
|
e.id = he, e.textContent = `
|
|
@@ -1194,9 +1197,9 @@ function gt() {
|
|
|
1194
1197
|
}
|
|
1195
1198
|
`, document.head.appendChild(e);
|
|
1196
1199
|
}
|
|
1197
|
-
const
|
|
1200
|
+
const mt = (e = {}) => {
|
|
1198
1201
|
const t = Q(e), r = /* @__PURE__ */ new Set();
|
|
1199
|
-
return
|
|
1202
|
+
return pt(), {
|
|
1200
1203
|
name: "blocksLibrary",
|
|
1201
1204
|
toolbar: [
|
|
1202
1205
|
{
|
|
@@ -1264,7 +1267,7 @@ const pt = (e = {}) => {
|
|
|
1264
1267
|
setBlocksLibraryOptions: (o, l) => {
|
|
1265
1268
|
const n = S(l, !1, !1);
|
|
1266
1269
|
if (!n || !o || typeof o != "object") return !1;
|
|
1267
|
-
const a = b.get(n) || t, s = J.get(n) ||
|
|
1270
|
+
const a = b.get(n) || t, s = J.get(n) || Ue(a), i = {
|
|
1268
1271
|
...s,
|
|
1269
1272
|
...o,
|
|
1270
1273
|
labels: {
|
|
@@ -1278,14 +1281,14 @@ const pt = (e = {}) => {
|
|
|
1278
1281
|
}, c = Q(i), d = Array.isArray(o.blocks), f = o.getBlocks !== void 0;
|
|
1279
1282
|
b.set(n, c), J.set(n, i), (d || f || !R.has(n)) && (R.set(n, c.blocks), O.set(n, f ? 0 : Date.now()));
|
|
1280
1283
|
const g = k(n, c);
|
|
1281
|
-
return g.filterCache.clear(), typeof o.defaultCategory == "string" && (g.category = ne(c.defaultCategory) || "all"), v(n),
|
|
1284
|
+
return g.filterCache.clear(), typeof o.defaultCategory == "string" && (g.category = ne(c.defaultCategory) || "all"), v(n), K(n), f && be(n, !0), !0;
|
|
1282
1285
|
},
|
|
1283
1286
|
getBlocksLibraryState: (o, l) => {
|
|
1284
1287
|
const n = S(l, !1, !1);
|
|
1285
1288
|
if (!n) return !1;
|
|
1286
1289
|
const a = b.get(n) || t;
|
|
1287
1290
|
k(n, a);
|
|
1288
|
-
const s =
|
|
1291
|
+
const s = dt(n);
|
|
1289
1292
|
if (typeof o == "function")
|
|
1290
1293
|
try {
|
|
1291
1294
|
o(s);
|
|
@@ -1308,20 +1311,20 @@ const pt = (e = {}) => {
|
|
|
1308
1311
|
init: function(l) {
|
|
1309
1312
|
X += 1;
|
|
1310
1313
|
const n = this && typeof this.__pluginConfig == "object" ? { ...e, ...this.__pluginConfig } : e, a = Q(n);
|
|
1311
|
-
|
|
1314
|
+
ft(a);
|
|
1312
1315
|
const s = S(
|
|
1313
1316
|
l != null && l.editorElement ? { editorElement: l.editorElement } : void 0,
|
|
1314
1317
|
!1,
|
|
1315
1318
|
!1
|
|
1316
1319
|
);
|
|
1317
|
-
s && (y = 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()),
|
|
1320
|
+
s && (y = 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()), K(s));
|
|
1318
1321
|
},
|
|
1319
1322
|
destroy: () => {
|
|
1320
|
-
r.forEach((o) => ge(o)), r.clear(), X = Math.max(0, X - 1), !(X > 0) &&
|
|
1323
|
+
r.forEach((o) => ge(o)), r.clear(), X = Math.max(0, X - 1), !(X > 0) && gt();
|
|
1321
1324
|
}
|
|
1322
1325
|
};
|
|
1323
1326
|
};
|
|
1324
1327
|
export {
|
|
1325
|
-
|
|
1328
|
+
mt as BlocksLibraryPlugin
|
|
1326
1329
|
};
|
|
1327
|
-
//# sourceMappingURL=BlocksLibraryPlugin.native-
|
|
1330
|
+
//# sourceMappingURL=BlocksLibraryPlugin.native-5sdsXsiE.mjs.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { a as l } from "./inlineFormatting-DJ0-NZtx.mjs";
|
|
2
|
+
const g = () => ({
|
|
2
3
|
name: "bold",
|
|
3
4
|
// Schema definition for bold mark
|
|
4
5
|
marks: {
|
|
@@ -8,9 +9,9 @@ const e = () => ({
|
|
|
8
9
|
{ tag: "b" },
|
|
9
10
|
{
|
|
10
11
|
style: "font-weight",
|
|
11
|
-
getAttrs: (
|
|
12
|
-
const
|
|
13
|
-
return /^(bold(er)?|[5-9]\d{2,})$/.test(
|
|
12
|
+
getAttrs: (o) => {
|
|
13
|
+
const t = typeof o == "string" ? o : o.style.fontWeight;
|
|
14
|
+
return /^(bold(er)?|[5-9]\d{2,})$/.test(t) && null;
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
],
|
|
@@ -31,7 +32,10 @@ const e = () => ({
|
|
|
31
32
|
/**
|
|
32
33
|
* Toggle bold formatting on current selection
|
|
33
34
|
*/
|
|
34
|
-
toggleBold: () => (
|
|
35
|
+
toggleBold: (o, t) => l({
|
|
36
|
+
command: "bold",
|
|
37
|
+
context: t
|
|
38
|
+
})
|
|
35
39
|
},
|
|
36
40
|
// Keyboard shortcuts
|
|
37
41
|
keymap: {
|
|
@@ -40,6 +44,6 @@ const e = () => ({
|
|
|
40
44
|
}
|
|
41
45
|
});
|
|
42
46
|
export {
|
|
43
|
-
|
|
47
|
+
g as BoldPlugin
|
|
44
48
|
};
|
|
45
|
-
//# sourceMappingURL=BoldPlugin.native-
|
|
49
|
+
//# sourceMappingURL=BoldPlugin.native-CSh_LiIJ.mjs.map
|