@editora/plugins 1.0.17 → 1.0.19
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 +12 -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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
const Be = /* @__PURE__ */ new Set(["script", "style", "meta", "link", "object", "embed", "iframe"]),
|
|
1
|
+
const L = ".rte-content, .editora-content", fe = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", ye = "__editoraCommandEditorRoot", he = "rte-blocks-library-styles", d = "rte-blocks-library-panel", E = "blocks-library", B = "blocksLibrary", $ = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)';
|
|
2
|
+
const Be = /* @__PURE__ */ new Set(["script", "style", "meta", "link", "object", "embed", "iframe"]), Oe = /^(https?:|mailto:|tel:|#|\/)/i, Ne = /^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",
|
|
@@ -19,19 +19,19 @@ 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(), I = /* @__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,
|
|
22
|
+
let X = 0, je = 0, ke = 0, M = null, y = null, _ = null, P = null, A = null, D = null;
|
|
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 We(e) {
|
|
27
27
|
return e.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function Fe(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 && (Oe.test(t) || Ne.test(t)) ? t : "";
|
|
35
35
|
}
|
|
36
36
|
function xe(e) {
|
|
37
37
|
let t = e;
|
|
@@ -60,7 +60,7 @@ function xe(e) {
|
|
|
60
60
|
return ` style=${s}${a}${s}`;
|
|
61
61
|
}).trim(), t;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function Ge(e) {
|
|
64
64
|
if (!e) return "";
|
|
65
65
|
if (typeof document > "u")
|
|
66
66
|
return xe(e);
|
|
@@ -84,12 +84,12 @@ function Fe(e) {
|
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
if (i === "href" || i === "src" || i === "xlink:href") {
|
|
87
|
-
const
|
|
88
|
-
if (!
|
|
87
|
+
const u = ce(c);
|
|
88
|
+
if (!u) {
|
|
89
89
|
l.removeAttribute(s.name);
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
|
-
|
|
92
|
+
u !== c && l.setAttribute(s.name, u);
|
|
93
93
|
}
|
|
94
94
|
});
|
|
95
95
|
}), t.innerHTML.trim());
|
|
@@ -97,7 +97,7 @@ function Fe(e) {
|
|
|
97
97
|
function ne(e) {
|
|
98
98
|
return e.trim().toLowerCase();
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function Ue(e) {
|
|
101
101
|
if (!e) return "";
|
|
102
102
|
if (typeof document > "u")
|
|
103
103
|
return e.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
|
|
@@ -106,20 +106,20 @@ function Ge(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 $e(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
|
|
117
|
-
for (; r.has(
|
|
118
|
-
|
|
119
|
-
r.add(
|
|
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 || ""), R =
|
|
116
|
+
let u = Fe(t.normalizeText(l.id || n)) || `block-${ke++}`;
|
|
117
|
+
for (; r.has(u); )
|
|
118
|
+
u = `${u}-${ke++}`;
|
|
119
|
+
r.add(u);
|
|
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 || ""), R = Ue(a), V = [n, h, s, ...f, ...g, R].join(" ").toLowerCase();
|
|
121
121
|
o.push({
|
|
122
|
-
id:
|
|
122
|
+
id: u,
|
|
123
123
|
label: n,
|
|
124
124
|
html: a,
|
|
125
125
|
description: h,
|
|
@@ -133,7 +133,7 @@ function Ce(e, t) {
|
|
|
133
133
|
}), o;
|
|
134
134
|
}
|
|
135
135
|
function Q(e = {}) {
|
|
136
|
-
const t = e.normalizeText ||
|
|
136
|
+
const t = e.normalizeText || We, r = e.sanitizeBlockHtml || Ge, o = {
|
|
137
137
|
blocks: [],
|
|
138
138
|
defaultCategory: t(e.defaultCategory || ""),
|
|
139
139
|
maxResults: Math.max(4, Math.min(300, Number(e.maxResults ?? 80))),
|
|
@@ -148,9 +148,9 @@ function Q(e = {}) {
|
|
|
148
148
|
sanitizeBlockHtml: r,
|
|
149
149
|
getBlocks: typeof e.getBlocks == "function" ? e.getBlocks : void 0
|
|
150
150
|
};
|
|
151
|
-
return o.blocks =
|
|
151
|
+
return o.blocks = $e(e.blocks, o), o;
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function Ve(e) {
|
|
154
154
|
return {
|
|
155
155
|
blocks: e.blocks.map((t) => ({
|
|
156
156
|
id: t.id,
|
|
@@ -177,11 +177,11 @@ function le(e) {
|
|
|
177
177
|
}
|
|
178
178
|
function G(e) {
|
|
179
179
|
if (!e) return null;
|
|
180
|
-
if (e.matches(
|
|
181
|
-
const t = e.querySelector(
|
|
180
|
+
if (e.matches(L)) return e;
|
|
181
|
+
const t = e.querySelector(L);
|
|
182
182
|
return t instanceof HTMLElement ? t : null;
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function Ye() {
|
|
185
185
|
if (typeof window > "u") return null;
|
|
186
186
|
const e = window[ye];
|
|
187
187
|
if (!(e instanceof HTMLElement)) return null;
|
|
@@ -193,10 +193,10 @@ function Ve() {
|
|
|
193
193
|
const l = G(r);
|
|
194
194
|
if (l) return l;
|
|
195
195
|
}
|
|
196
|
-
const o = e.closest(
|
|
196
|
+
const o = e.closest(L);
|
|
197
197
|
return o instanceof HTMLElement ? o : null;
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function Xe(e) {
|
|
200
200
|
const t = e.closest("[data-editora-editor]");
|
|
201
201
|
if (t && G(t) === e)
|
|
202
202
|
return t;
|
|
@@ -208,7 +208,7 @@ function Ye(e) {
|
|
|
208
208
|
}
|
|
209
209
|
return le(e);
|
|
210
210
|
}
|
|
211
|
-
function
|
|
211
|
+
function Te(e) {
|
|
212
212
|
return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
|
|
213
213
|
}
|
|
214
214
|
function ee() {
|
|
@@ -222,34 +222,34 @@ function T(e, t = !0, r = !0) {
|
|
|
222
222
|
const a = G(e.editorElement);
|
|
223
223
|
if (a) return a;
|
|
224
224
|
}
|
|
225
|
-
const o =
|
|
225
|
+
const o = Ye();
|
|
226
226
|
if (o) return o;
|
|
227
227
|
const l = window.getSelection();
|
|
228
228
|
if (l && l.rangeCount > 0) {
|
|
229
|
-
const s =
|
|
229
|
+
const s = Te(l.getRangeAt(0).startContainer)?.closest(L);
|
|
230
230
|
if (s) return s;
|
|
231
231
|
}
|
|
232
232
|
const n = document.activeElement;
|
|
233
233
|
if (n) {
|
|
234
|
-
if (n.matches(
|
|
235
|
-
const a = n.closest(
|
|
234
|
+
if (n.matches(L)) return n;
|
|
235
|
+
const a = n.closest(L);
|
|
236
236
|
if (a) return a;
|
|
237
237
|
}
|
|
238
238
|
if (r) {
|
|
239
239
|
if (y && y.isConnected) return y;
|
|
240
240
|
y && !y.isConnected && (y = null);
|
|
241
241
|
}
|
|
242
|
-
return t ? document.querySelector(
|
|
242
|
+
return t ? document.querySelector(L) : null;
|
|
243
243
|
}
|
|
244
|
-
function
|
|
244
|
+
function Ze(e) {
|
|
245
245
|
const t = e.target;
|
|
246
246
|
if (t) {
|
|
247
|
-
const o = t.closest(
|
|
247
|
+
const o = t.closest(L);
|
|
248
248
|
if (o) return o;
|
|
249
249
|
}
|
|
250
250
|
const r = window.getSelection();
|
|
251
251
|
if (r && r.rangeCount > 0) {
|
|
252
|
-
const l =
|
|
252
|
+
const l = Te(r.getRangeAt(0).startContainer)?.closest(L);
|
|
253
253
|
if (l) return l;
|
|
254
254
|
}
|
|
255
255
|
return null;
|
|
@@ -257,20 +257,20 @@ function Xe(e) {
|
|
|
257
257
|
function Z(e) {
|
|
258
258
|
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;
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function Je(e) {
|
|
261
261
|
const t = le(e);
|
|
262
262
|
if (Z(t)) return !0;
|
|
263
263
|
const r = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
264
264
|
return Z(r) ? !0 : Z(document.documentElement) || Z(document.body);
|
|
265
265
|
}
|
|
266
266
|
function re(e, t) {
|
|
267
|
-
e.classList.remove("rte-blocks-library-theme-dark"),
|
|
267
|
+
e.classList.remove("rte-blocks-library-theme-dark"), Je(t) && e.classList.add("rte-blocks-library-theme-dark");
|
|
268
268
|
}
|
|
269
|
-
function
|
|
269
|
+
function Se(e) {
|
|
270
270
|
return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
|
|
271
271
|
}
|
|
272
272
|
function we(e, t, r) {
|
|
273
|
-
const o =
|
|
273
|
+
const o = Xe(e);
|
|
274
274
|
Array.from(
|
|
275
275
|
o.querySelectorAll(
|
|
276
276
|
`.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`
|
|
@@ -284,14 +284,14 @@ function Ee(e, t) {
|
|
|
284
284
|
r && (r.textContent = t);
|
|
285
285
|
}
|
|
286
286
|
function se(e) {
|
|
287
|
-
const t =
|
|
287
|
+
const t = He(e);
|
|
288
288
|
if (t)
|
|
289
289
|
try {
|
|
290
290
|
q.set(e, t.cloneRange());
|
|
291
291
|
} catch {
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
|
-
function
|
|
294
|
+
function Me(e) {
|
|
295
295
|
const t = q.get(e);
|
|
296
296
|
if (!t) return null;
|
|
297
297
|
if (!e.isConnected)
|
|
@@ -303,11 +303,11 @@ function Se(e) {
|
|
|
303
303
|
return q.delete(e), null;
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
|
-
function Je(e) {
|
|
307
|
-
const t = Se(e);
|
|
308
|
-
return t ? (He(e, t), !0) : !1;
|
|
309
|
-
}
|
|
310
306
|
function Qe(e) {
|
|
307
|
+
const t = Me(e);
|
|
308
|
+
return t ? (ze(e, t), !0) : !1;
|
|
309
|
+
}
|
|
310
|
+
function et(e) {
|
|
311
311
|
if (te.has(e)) return;
|
|
312
312
|
const t = () => {
|
|
313
313
|
const r = window.getSelection();
|
|
@@ -317,7 +317,7 @@ function Qe(e) {
|
|
|
317
317
|
};
|
|
318
318
|
e.addEventListener("keyup", t), e.addEventListener("mouseup", t), e.addEventListener("touchend", t), te.set(e, t);
|
|
319
319
|
}
|
|
320
|
-
function
|
|
320
|
+
function tt(e) {
|
|
321
321
|
const t = te.get(e);
|
|
322
322
|
t && (e.removeEventListener("keyup", t), e.removeEventListener("mouseup", t), e.removeEventListener("touchend", t), te.delete(e));
|
|
323
323
|
}
|
|
@@ -336,18 +336,18 @@ function k(e, t) {
|
|
|
336
336
|
visibleMatches: 0,
|
|
337
337
|
filterCache: /* @__PURE__ */ new Map(),
|
|
338
338
|
debounceTimer: null
|
|
339
|
-
}, w.set(e, r)), oe.add(e),
|
|
339
|
+
}, w.set(e, r)), oe.add(e), et(e), r;
|
|
340
340
|
}
|
|
341
|
-
function
|
|
341
|
+
function Ae(e) {
|
|
342
342
|
const t = w.get(e);
|
|
343
343
|
!t || t.debounceTimer === null || (window.clearTimeout(t.debounceTimer), t.debounceTimer = null);
|
|
344
344
|
}
|
|
345
345
|
function ge(e) {
|
|
346
|
-
|
|
346
|
+
Ae(e), tt(e), q.delete(e);
|
|
347
347
|
const t = W.get(e);
|
|
348
348
|
t && (t.abort(), W.delete(e)), j.delete(e), z.delete(e), x.get(e)?.remove(), x.delete(e), U.delete(e), b.delete(e), J.delete(e), w.delete(e), I.delete(e), O.delete(e), oe.delete(e), y === e && (y = null);
|
|
349
349
|
}
|
|
350
|
-
function
|
|
350
|
+
function rt(e) {
|
|
351
351
|
for (let t = 0; t < e.length; t += 1) {
|
|
352
352
|
const r = e[t];
|
|
353
353
|
if (!(r.type !== "childList" || r.removedNodes.length === 0))
|
|
@@ -355,7 +355,7 @@ function tt(e) {
|
|
|
355
355
|
const l = r.removedNodes[o];
|
|
356
356
|
if (l.nodeType !== Node.ELEMENT_NODE) continue;
|
|
357
357
|
const n = l;
|
|
358
|
-
if (n.matches?.(
|
|
358
|
+
if (n.matches?.(L) || n.matches?.(`.${d}`) || n.querySelector?.(L) || n.querySelector?.(`.${d}`))
|
|
359
359
|
return !0;
|
|
360
360
|
}
|
|
361
361
|
}
|
|
@@ -364,7 +364,7 @@ function tt(e) {
|
|
|
364
364
|
function pe(e) {
|
|
365
365
|
return U.get(e) === !0;
|
|
366
366
|
}
|
|
367
|
-
function
|
|
367
|
+
function ue(e, t) {
|
|
368
368
|
if (!t.classList.contains("show")) return;
|
|
369
369
|
const r = le(e).getBoundingClientRect(), o = Math.min(window.innerWidth - 20, 420), l = Math.max(10, window.innerWidth - o - 10), n = Math.min(Math.max(10, r.right - o), l), a = Math.max(10, Math.min(window.innerHeight - 10, r.top + 12));
|
|
370
370
|
t.style.width = `${o}px`, t.style.left = `${n}px`, t.style.top = `${a}px`, t.style.maxHeight = `${Math.max(260, window.innerHeight - 20)}px`;
|
|
@@ -372,7 +372,7 @@ function de(e, t) {
|
|
|
372
372
|
function ae(e) {
|
|
373
373
|
return I.get(e) || b.get(e)?.blocks || [];
|
|
374
374
|
}
|
|
375
|
-
function
|
|
375
|
+
function ot(e, t) {
|
|
376
376
|
const r = /* @__PURE__ */ new Map();
|
|
377
377
|
ae(e).forEach((l) => {
|
|
378
378
|
r.has(l.categoryKey) || r.set(l.categoryKey, l.category);
|
|
@@ -380,28 +380,28 @@ function rt(e, t) {
|
|
|
380
380
|
const o = Array.from(r.entries()).sort((l, n) => l[1].localeCompare(n[1])).map(([l, n]) => ({ value: l, label: n }));
|
|
381
381
|
return [{ value: "all", label: t.labels.allCategoriesText }, ...o];
|
|
382
382
|
}
|
|
383
|
-
function
|
|
383
|
+
function Ie(e, t) {
|
|
384
384
|
const r = k(e, t), o = ae(e), l = r.query.trim().toLowerCase(), n = r.category || "all", a = `${l}|${n}|${t.maxResults}`, s = r.filterCache.get(a);
|
|
385
385
|
if (s) {
|
|
386
|
-
const
|
|
386
|
+
const u = new Map(o.map((g) => [g.id, g])), f = s.ids.map((g) => u.get(g)).filter(Boolean);
|
|
387
387
|
return r.totalMatches = s.total, r.visibleMatches = f.length, f;
|
|
388
388
|
}
|
|
389
389
|
const i = [];
|
|
390
390
|
let c = 0;
|
|
391
|
-
for (let
|
|
392
|
-
const f = o[
|
|
391
|
+
for (let u = 0; u < o.length; u += 1) {
|
|
392
|
+
const f = o[u];
|
|
393
393
|
n !== "all" && f.categoryKey !== n || l && !f.searchBlob.includes(l) || (c += 1, i.length < t.maxResults && i.push(f));
|
|
394
394
|
}
|
|
395
395
|
if (r.totalMatches = c, r.visibleMatches = i.length, r.filterCache.set(a, {
|
|
396
|
-
ids: i.map((
|
|
396
|
+
ids: i.map((u) => u.id),
|
|
397
397
|
total: c
|
|
398
398
|
}), r.filterCache.size > 80) {
|
|
399
|
-
const
|
|
400
|
-
typeof
|
|
399
|
+
const u = r.filterCache.keys().next().value;
|
|
400
|
+
typeof u == "string" && r.filterCache.delete(u);
|
|
401
401
|
}
|
|
402
402
|
return i;
|
|
403
403
|
}
|
|
404
|
-
function
|
|
404
|
+
function nt(e, t) {
|
|
405
405
|
const r = w.get(e);
|
|
406
406
|
if (!r) return;
|
|
407
407
|
if (t.length === 0) {
|
|
@@ -410,11 +410,11 @@ function ot(e, t) {
|
|
|
410
410
|
}
|
|
411
411
|
t.some((l) => l.id === r.selectedBlockId) || (r.selectedBlockId = t[0].id);
|
|
412
412
|
}
|
|
413
|
-
function
|
|
413
|
+
function N(e) {
|
|
414
414
|
const t = w.get(e);
|
|
415
415
|
we(e, "toggleBlocksLibraryPanel", pe(e)), we(e, "insertLastBlockSnippet", !!t?.lastInsertedBlockId);
|
|
416
416
|
}
|
|
417
|
-
function
|
|
417
|
+
function v(e) {
|
|
418
418
|
const t = x.get(e), r = b.get(e) || M, o = w.get(e);
|
|
419
419
|
if (!t || !r || !o) return;
|
|
420
420
|
re(t, e);
|
|
@@ -430,11 +430,11 @@ function L(e) {
|
|
|
430
430
|
i && (i.textContent = r.labels.categoryLabel);
|
|
431
431
|
const c = t.querySelector('[data-field="category"]');
|
|
432
432
|
if (c) {
|
|
433
|
-
const
|
|
434
|
-
c.innerHTML =
|
|
433
|
+
const C = ot(e, r);
|
|
434
|
+
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;
|
|
435
435
|
}
|
|
436
|
-
const
|
|
437
|
-
|
|
436
|
+
const u = t.querySelector(".rte-blocks-library-helper");
|
|
437
|
+
u && (u.textContent = r.labels.helperText);
|
|
438
438
|
const f = t.querySelector('.rte-blocks-library-list[role="listbox"]');
|
|
439
439
|
f && f.setAttribute("aria-label", r.labels.resultsListLabel);
|
|
440
440
|
const g = t.querySelector(".rte-blocks-library-shortcut");
|
|
@@ -442,16 +442,16 @@ function L(e) {
|
|
|
442
442
|
const h = t.querySelector('[data-action="insert-selected"]');
|
|
443
443
|
if (h) {
|
|
444
444
|
h.textContent = r.labels.insertText;
|
|
445
|
-
const
|
|
446
|
-
h.disabled = !
|
|
445
|
+
const C = !Se(e) && !!o.selectedBlockId;
|
|
446
|
+
h.disabled = !C, h.setAttribute("aria-disabled", C ? "false" : "true");
|
|
447
447
|
}
|
|
448
|
-
const R = t.querySelector(".rte-blocks-library-empty"), V = t.querySelector(".rte-blocks-library-list"), H =
|
|
449
|
-
|
|
448
|
+
const R = t.querySelector(".rte-blocks-library-empty"), V = t.querySelector(".rte-blocks-library-list"), H = Ie(e, r);
|
|
449
|
+
nt(e, H);
|
|
450
450
|
const Y = t.querySelector(".rte-blocks-library-status");
|
|
451
451
|
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) {
|
|
452
|
-
const
|
|
452
|
+
const C = new Set(o.recentBlockIds);
|
|
453
453
|
V.innerHTML = H.map((p) => {
|
|
454
|
-
const ie = o.selectedBlockId === p.id,
|
|
454
|
+
const ie = o.selectedBlockId === p.id, Pe = p.tags.length ? ` • ${p.tags.join(", ")}` : "", De = C.has(p.id), me = p.previewText.slice(0, 180);
|
|
455
455
|
return `
|
|
456
456
|
<li class="rte-blocks-library-item-wrapper" role="presentation">
|
|
457
457
|
<button
|
|
@@ -465,9 +465,9 @@ function L(e) {
|
|
|
465
465
|
>
|
|
466
466
|
<span class="rte-blocks-library-item-head">
|
|
467
467
|
<span class="rte-blocks-library-item-label">${m(p.label)}</span>
|
|
468
|
-
${
|
|
468
|
+
${De ? `<span class="rte-blocks-library-recent-pill">${m(r.labels.recentHeading)}</span>` : ""}
|
|
469
469
|
</span>
|
|
470
|
-
<span class="rte-blocks-library-item-meta">${m(p.category)}${m(
|
|
470
|
+
<span class="rte-blocks-library-item-meta">${m(p.category)}${m(Pe)}</span>
|
|
471
471
|
${p.description ? `<span class="rte-blocks-library-item-description">${m(p.description)}</span>` : ""}
|
|
472
472
|
${me ? `<span class="rte-blocks-library-item-preview">${m(me)}</span>` : ""}
|
|
473
473
|
</button>
|
|
@@ -476,59 +476,83 @@ function L(e) {
|
|
|
476
476
|
}).join("");
|
|
477
477
|
}
|
|
478
478
|
R && (R.hidden = H.length > 0, R.textContent = r.labels.noResultsText);
|
|
479
|
-
const
|
|
480
|
-
if (
|
|
479
|
+
const K = t.querySelector(".rte-blocks-library-last-inserted");
|
|
480
|
+
if (K)
|
|
481
481
|
if (o.lastInsertedBlockId) {
|
|
482
|
-
const
|
|
483
|
-
|
|
482
|
+
const C = ae(e).find((p) => p.id === o.lastInsertedBlockId);
|
|
483
|
+
C ? (K.hidden = !1, K.textContent = `${r.labels.lastInsertedPrefix}: ${C.label}`) : K.hidden = !0;
|
|
484
484
|
} else
|
|
485
|
-
|
|
485
|
+
K.hidden = !0;
|
|
486
486
|
t.setAttribute("aria-label", r.labels.panelAriaLabel);
|
|
487
487
|
}
|
|
488
488
|
function S(e, t = !1) {
|
|
489
489
|
const r = x.get(e);
|
|
490
|
-
r && (r.classList.remove("show"), U.set(e, !1),
|
|
490
|
+
r && (r.classList.remove("show"), U.set(e, !1), N(e), t && (e.focus({ preventScroll: !0 }), Qe(e)));
|
|
491
491
|
}
|
|
492
|
-
function
|
|
492
|
+
function lt(e) {
|
|
493
493
|
e.querySelector(".rte-blocks-library-item.active")?.focus();
|
|
494
494
|
}
|
|
495
|
-
function
|
|
495
|
+
function Le(e, t) {
|
|
496
496
|
const r = b.get(e) || M;
|
|
497
497
|
if (!r) return;
|
|
498
498
|
const o = w.get(e);
|
|
499
499
|
if (!o) return;
|
|
500
|
-
const l =
|
|
500
|
+
const l = Ie(e, r);
|
|
501
501
|
if (l.length === 0) return;
|
|
502
502
|
const a = (Math.max(
|
|
503
503
|
0,
|
|
504
504
|
l.findIndex((i) => i.id === o.selectedBlockId)
|
|
505
505
|
) + t + l.length) % l.length;
|
|
506
|
-
o.selectedBlockId = l[a].id,
|
|
506
|
+
o.selectedBlockId = l[a].id, v(e);
|
|
507
507
|
const s = x.get(e);
|
|
508
|
-
s &&
|
|
508
|
+
s && lt(s);
|
|
509
509
|
}
|
|
510
|
-
function
|
|
511
|
-
const t =
|
|
510
|
+
function de(e) {
|
|
511
|
+
const t = dt(e);
|
|
512
512
|
se(e), x.forEach((o, l) => {
|
|
513
513
|
l !== e && S(l, !1);
|
|
514
|
-
}), t.classList.add("show"), U.set(e, !0),
|
|
514
|
+
}), t.classList.add("show"), U.set(e, !0), v(e), ue(e, t), N(e), t.querySelector('[data-field="query"]')?.focus(), be(e, !1);
|
|
515
515
|
}
|
|
516
|
-
function
|
|
516
|
+
function Re(e, t) {
|
|
517
517
|
const r = pe(e);
|
|
518
|
-
return (typeof t == "boolean" ? t : !r) ?
|
|
518
|
+
return (typeof t == "boolean" ? t : !r) ? de(e) : S(e, !1), !0;
|
|
519
519
|
}
|
|
520
|
-
function
|
|
520
|
+
function He(e) {
|
|
521
521
|
const t = window.getSelection();
|
|
522
522
|
if (!t || t.rangeCount === 0) return null;
|
|
523
523
|
const r = t.getRangeAt(0);
|
|
524
524
|
return e.contains(r.commonAncestorContainer) ? r : null;
|
|
525
525
|
}
|
|
526
|
-
function
|
|
526
|
+
function ze(e, t) {
|
|
527
527
|
if (!e.isConnected) return;
|
|
528
528
|
const r = window.getSelection();
|
|
529
529
|
r && (r.removeAllRanges(), r.addRange(t));
|
|
530
530
|
}
|
|
531
|
-
|
|
531
|
+
const st = /* @__PURE__ */ new Set([
|
|
532
|
+
"DIV",
|
|
533
|
+
"P",
|
|
534
|
+
"BLOCKQUOTE",
|
|
535
|
+
"PRE",
|
|
536
|
+
"H1",
|
|
537
|
+
"H2",
|
|
538
|
+
"H3",
|
|
539
|
+
"H4",
|
|
540
|
+
"H5",
|
|
541
|
+
"H6",
|
|
542
|
+
"LI",
|
|
543
|
+
"TD",
|
|
544
|
+
"TH"
|
|
545
|
+
]);
|
|
546
|
+
function ve(e, t) {
|
|
547
|
+
let r = e;
|
|
548
|
+
for (; r && r !== t; ) {
|
|
549
|
+
if (r.nodeType === Node.ELEMENT_NODE && st.has(r.tagName))
|
|
550
|
+
return r;
|
|
551
|
+
r = r.parentNode;
|
|
552
|
+
}
|
|
553
|
+
return null;
|
|
554
|
+
}
|
|
555
|
+
function Ce(e, t, r) {
|
|
532
556
|
const o = t.cloneRange();
|
|
533
557
|
if (!e.contains(o.commonAncestorContainer)) return !1;
|
|
534
558
|
o.deleteContents();
|
|
@@ -536,27 +560,27 @@ function Le(e, t, r) {
|
|
|
536
560
|
l.innerHTML = r;
|
|
537
561
|
const n = l.content;
|
|
538
562
|
if (!n) return !1;
|
|
539
|
-
const a = n.lastChild;
|
|
540
|
-
if (o.insertNode(n), a) {
|
|
541
|
-
const
|
|
542
|
-
|
|
563
|
+
const a = n.lastChild, s = ve(o.endContainer, e) || ve(o.startContainer, e);
|
|
564
|
+
if (s && s.parentNode ? s.parentNode.insertBefore(n, s.nextSibling) : o.insertNode(n), a) {
|
|
565
|
+
const i = document.createRange();
|
|
566
|
+
i.setStartAfter(a), i.collapse(!0), ze(e, i);
|
|
543
567
|
}
|
|
544
568
|
return se(e), !0;
|
|
545
569
|
}
|
|
546
|
-
function
|
|
570
|
+
function at(e, t) {
|
|
547
571
|
e.focus({ preventScroll: !0 });
|
|
548
|
-
const r =
|
|
549
|
-
if (r &&
|
|
572
|
+
const r = Me(e);
|
|
573
|
+
if (r && Ce(e, r, t))
|
|
550
574
|
return !0;
|
|
551
575
|
try {
|
|
552
576
|
if (document.execCommand("insertHTML", !1, t))
|
|
553
577
|
return se(e), !0;
|
|
554
578
|
} catch {
|
|
555
579
|
}
|
|
556
|
-
const o =
|
|
557
|
-
return o ?
|
|
580
|
+
const o = He(e);
|
|
581
|
+
return o ? Ce(e, o, t) : !1;
|
|
558
582
|
}
|
|
559
|
-
function
|
|
583
|
+
function it(e, t) {
|
|
560
584
|
if (t === e.innerHTML) return;
|
|
561
585
|
const r = window.execEditorCommand || window.executeEditorCommand;
|
|
562
586
|
if (typeof r == "function")
|
|
@@ -565,22 +589,22 @@ function st(e, t) {
|
|
|
565
589
|
} catch {
|
|
566
590
|
}
|
|
567
591
|
}
|
|
568
|
-
function
|
|
592
|
+
function ct(e) {
|
|
569
593
|
e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
570
594
|
}
|
|
571
595
|
function F(e, t) {
|
|
572
596
|
const r = b.get(e) || M;
|
|
573
597
|
if (!r) return !1;
|
|
574
598
|
const o = k(e, r), l = x.get(e);
|
|
575
|
-
if (
|
|
599
|
+
if (Se(e))
|
|
576
600
|
return l && Ee(l, r.labels.readonlyMessage), !1;
|
|
577
601
|
const n = ae(e).find((i) => i.id === t);
|
|
578
602
|
if (!n) return !1;
|
|
579
603
|
const a = e.innerHTML;
|
|
580
|
-
return
|
|
604
|
+
return at(e, n.html) ? (o.lastInsertedBlockId = n.id, o.selectedBlockId = n.id, o.recentBlockIds = [n.id, ...o.recentBlockIds.filter((i) => i !== n.id)].slice(
|
|
581
605
|
0,
|
|
582
606
|
r.maxRecentBlocks
|
|
583
|
-
),
|
|
607
|
+
), it(e, a), ct(e), N(e), e.dispatchEvent(
|
|
584
608
|
new CustomEvent("editora:blocks-library-insert", {
|
|
585
609
|
bubbles: !0,
|
|
586
610
|
detail: {
|
|
@@ -589,20 +613,20 @@ function F(e, t) {
|
|
|
589
613
|
category: n.category
|
|
590
614
|
}
|
|
591
615
|
})
|
|
592
|
-
),
|
|
616
|
+
), v(e), l && Ee(l, `${r.labels.lastInsertedPrefix}: ${n.label}`), !0) : !1;
|
|
593
617
|
}
|
|
594
|
-
function
|
|
618
|
+
function qe(e) {
|
|
595
619
|
const t = w.get(e);
|
|
596
620
|
return t?.lastInsertedBlockId ? F(e, t.lastInsertedBlockId) : !1;
|
|
597
621
|
}
|
|
598
|
-
function
|
|
622
|
+
function ut(e) {
|
|
599
623
|
const t = b.get(e) || M;
|
|
600
624
|
if (!t) return;
|
|
601
625
|
const r = w.get(e);
|
|
602
626
|
if (!r) return;
|
|
603
|
-
|
|
627
|
+
Ae(e);
|
|
604
628
|
const o = () => {
|
|
605
|
-
r.debounceTimer = null, r.filterCache.clear(),
|
|
629
|
+
r.debounceTimer = null, r.filterCache.clear(), v(e);
|
|
606
630
|
};
|
|
607
631
|
if (t.debounceMs <= 0) {
|
|
608
632
|
o();
|
|
@@ -610,11 +634,11 @@ function it(e) {
|
|
|
610
634
|
}
|
|
611
635
|
r.debounceTimer = window.setTimeout(o, t.debounceMs);
|
|
612
636
|
}
|
|
613
|
-
function
|
|
637
|
+
function dt(e) {
|
|
614
638
|
const t = x.get(e);
|
|
615
639
|
if (t) return t;
|
|
616
|
-
const r = b.get(e) || M || Q(), o = k(e, r), l = `rte-blocks-library-panel-${
|
|
617
|
-
return s.className =
|
|
640
|
+
const r = b.get(e) || M || Q(), o = k(e, r), l = `rte-blocks-library-panel-${je++}`, n = `${l}-query`, a = `${l}-category`, s = document.createElement("section");
|
|
641
|
+
return s.className = d, s.id = l, s.setAttribute("role", "dialog"), s.setAttribute("aria-modal", "false"), s.setAttribute("aria-label", r.labels.panelAriaLabel), s.innerHTML = `
|
|
618
642
|
<header class="rte-blocks-library-header">
|
|
619
643
|
<h2 class="rte-blocks-library-title">${m(r.labels.panelTitle)}</h2>
|
|
620
644
|
<button type="button" class="rte-blocks-library-icon-btn" data-action="close" aria-label="${m(r.labels.closeText)}">✕</button>
|
|
@@ -638,9 +662,9 @@ function ct(e) {
|
|
|
638
662
|
</div>
|
|
639
663
|
<div class="rte-blocks-library-live" aria-live="polite" aria-atomic="true"></div>
|
|
640
664
|
`, s.addEventListener("click", (i) => {
|
|
641
|
-
const c = i.target,
|
|
642
|
-
if (
|
|
643
|
-
const h =
|
|
665
|
+
const c = i.target, u = c?.closest("[data-action]");
|
|
666
|
+
if (u) {
|
|
667
|
+
const h = u.getAttribute("data-action");
|
|
644
668
|
if (h === "close") {
|
|
645
669
|
S(e, !0);
|
|
646
670
|
return;
|
|
@@ -654,33 +678,33 @@ function ct(e) {
|
|
|
654
678
|
const f = c?.closest("[data-block-id]");
|
|
655
679
|
if (!f) return;
|
|
656
680
|
const g = f.getAttribute("data-block-id");
|
|
657
|
-
g && (o.selectedBlockId = g,
|
|
681
|
+
g && (o.selectedBlockId = g, v(e), i.detail >= 2 && F(e, g) && S(e, !0));
|
|
658
682
|
}), s.addEventListener("input", (i) => {
|
|
659
683
|
const c = i.target;
|
|
660
|
-
!(c instanceof HTMLInputElement) || c.getAttribute("data-field") !== "query" || (o.query = r.normalizeText(c.value).toLowerCase(), o.filterCache.clear(),
|
|
684
|
+
!(c instanceof HTMLInputElement) || c.getAttribute("data-field") !== "query" || (o.query = r.normalizeText(c.value).toLowerCase(), o.filterCache.clear(), ut(e));
|
|
661
685
|
}), s.addEventListener("change", (i) => {
|
|
662
686
|
const c = i.target;
|
|
663
|
-
!(c instanceof HTMLSelectElement) || c.getAttribute("data-field") !== "category" || (o.category = ne(c.value || "all") || "all", o.filterCache.clear(),
|
|
687
|
+
!(c instanceof HTMLSelectElement) || c.getAttribute("data-field") !== "category" || (o.category = ne(c.value || "all") || "all", o.filterCache.clear(), v(e));
|
|
664
688
|
}), s.addEventListener("keydown", (i) => {
|
|
665
689
|
if (i.key === "Escape") {
|
|
666
690
|
i.preventDefault(), S(e, !0);
|
|
667
691
|
return;
|
|
668
692
|
}
|
|
669
693
|
if (i.key === "ArrowDown") {
|
|
670
|
-
i.preventDefault(),
|
|
694
|
+
i.preventDefault(), Le(e, 1);
|
|
671
695
|
return;
|
|
672
696
|
}
|
|
673
697
|
if (i.key === "ArrowUp") {
|
|
674
|
-
i.preventDefault(),
|
|
698
|
+
i.preventDefault(), Le(e, -1);
|
|
675
699
|
return;
|
|
676
700
|
}
|
|
677
701
|
if (i.key === "Enter") {
|
|
678
702
|
if (!i.target?.matches('[data-field="query"], [data-field="category"], [data-block-id]') || !o.selectedBlockId) return;
|
|
679
703
|
i.preventDefault(), F(e, o.selectedBlockId) && S(e, !0);
|
|
680
704
|
}
|
|
681
|
-
}), re(s, e), document.body.appendChild(s), x.set(e, s), U.set(e, !1),
|
|
705
|
+
}), re(s, e), document.body.appendChild(s), x.set(e, s), U.set(e, !1), v(e), s;
|
|
682
706
|
}
|
|
683
|
-
function
|
|
707
|
+
function bt(e) {
|
|
684
708
|
const t = w.get(e);
|
|
685
709
|
return {
|
|
686
710
|
query: t?.query || "",
|
|
@@ -708,91 +732,91 @@ async function be(e, t) {
|
|
|
708
732
|
const s = new AbortController();
|
|
709
733
|
W.set(e, s);
|
|
710
734
|
const i = (z.get(e) || 0) + 1;
|
|
711
|
-
z.set(e, i), o.loading = !0, o.loadError = null,
|
|
735
|
+
z.set(e, i), o.loading = !0, o.loadError = null, v(e);
|
|
712
736
|
const c = Promise.resolve().then(async () => {
|
|
713
|
-
const
|
|
737
|
+
const u = {
|
|
714
738
|
editor: e,
|
|
715
739
|
editorRoot: le(e),
|
|
716
740
|
signal: s.signal
|
|
717
|
-
}, f = await r.getBlocks?.(
|
|
741
|
+
}, f = await r.getBlocks?.(u);
|
|
718
742
|
if (s.signal.aborted || z.get(e) !== i) return;
|
|
719
|
-
const g =
|
|
743
|
+
const g = $e(f || [], r);
|
|
720
744
|
I.set(e, g), O.set(e, Date.now());
|
|
721
745
|
const h = w.get(e);
|
|
722
746
|
h && (h.loading = !1, h.loadError = null, h.filterCache.clear());
|
|
723
747
|
}).catch(() => {
|
|
724
748
|
if (s.signal.aborted || z.get(e) !== i) return;
|
|
725
|
-
const
|
|
726
|
-
|
|
749
|
+
const u = w.get(e);
|
|
750
|
+
u && (u.loading = !1, u.loadError = r.labels.loadErrorText);
|
|
727
751
|
}).finally(() => {
|
|
728
|
-
z.get(e) === i && (j.delete(e), W.delete(e)),
|
|
752
|
+
z.get(e) === i && (j.delete(e), W.delete(e)), v(e);
|
|
729
753
|
});
|
|
730
754
|
return j.set(e, c), c;
|
|
731
755
|
}
|
|
732
|
-
function
|
|
756
|
+
function _e(e) {
|
|
733
757
|
return typeof e.key == "string" ? e.key.toLowerCase() : "";
|
|
734
758
|
}
|
|
735
|
-
function
|
|
736
|
-
const t =
|
|
759
|
+
function ft(e) {
|
|
760
|
+
const t = _e(e);
|
|
737
761
|
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "b";
|
|
738
762
|
}
|
|
739
|
-
function
|
|
740
|
-
const t =
|
|
763
|
+
function gt(e) {
|
|
764
|
+
const t = _e(e);
|
|
741
765
|
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "l";
|
|
742
766
|
}
|
|
743
|
-
function
|
|
767
|
+
function pt(e) {
|
|
744
768
|
M = e, _ || (_ = (t) => {
|
|
745
769
|
ee();
|
|
746
|
-
const o = t.target?.closest(
|
|
770
|
+
const o = t.target?.closest(L);
|
|
747
771
|
if (!o) return;
|
|
748
772
|
const l = b.get(o) || e;
|
|
749
|
-
k(o, l), b.set(o, l), y = o,
|
|
773
|
+
k(o, l), b.set(o, l), y = o, N(o);
|
|
750
774
|
const n = x.get(o);
|
|
751
|
-
n && (re(n, o),
|
|
775
|
+
n && (re(n, o), ue(o, n), v(o));
|
|
752
776
|
}, document.addEventListener("focusin", _, !0)), P || (P = (t) => {
|
|
753
777
|
if (t.defaultPrevented) return;
|
|
754
|
-
const r = `.${
|
|
778
|
+
const r = `.${d} input, .${d} textarea, .${d} select`, o = t.target;
|
|
755
779
|
if (o?.closest(r)) {
|
|
756
780
|
if (t.key === "Escape") {
|
|
757
|
-
const a = o.closest(`.${
|
|
781
|
+
const a = o.closest(`.${d}`), s = Array.from(x.entries()).find(([, i]) => i === a);
|
|
758
782
|
s && (t.preventDefault(), S(s[0], !0));
|
|
759
783
|
}
|
|
760
784
|
return;
|
|
761
785
|
}
|
|
762
|
-
const l =
|
|
786
|
+
const l = Ze(t);
|
|
763
787
|
if (!l) return;
|
|
764
788
|
const n = b.get(l) || M || e;
|
|
765
789
|
if (k(l, n), b.set(l, n), y = l, t.key === "Escape" && pe(l)) {
|
|
766
790
|
t.preventDefault(), S(l, !0);
|
|
767
791
|
return;
|
|
768
792
|
}
|
|
769
|
-
if (
|
|
770
|
-
t.preventDefault(), t.stopPropagation(),
|
|
793
|
+
if (ft(t)) {
|
|
794
|
+
t.preventDefault(), t.stopPropagation(), Re(l);
|
|
771
795
|
return;
|
|
772
796
|
}
|
|
773
|
-
|
|
797
|
+
gt(t) && (t.preventDefault(), t.stopPropagation(), qe(l));
|
|
774
798
|
}, document.addEventListener("keydown", P, !0)), A || (A = () => {
|
|
775
799
|
ee(), x.forEach((t, r) => {
|
|
776
|
-
!r.isConnected || !t.isConnected || (re(t, r),
|
|
800
|
+
!r.isConnected || !t.isConnected || (re(t, r), ue(r, t));
|
|
777
801
|
});
|
|
778
802
|
}, window.addEventListener("scroll", A, !0), window.addEventListener("resize", A)), !D && typeof MutationObserver < "u" && document.body && (D = new MutationObserver((t) => {
|
|
779
|
-
|
|
803
|
+
rt(t) && ee();
|
|
780
804
|
}), D.observe(document.body, {
|
|
781
805
|
childList: !0,
|
|
782
806
|
subtree: !0
|
|
783
807
|
}));
|
|
784
808
|
}
|
|
785
|
-
function
|
|
809
|
+
function mt() {
|
|
786
810
|
_ && (document.removeEventListener("focusin", _, !0), _ = null), P && (document.removeEventListener("keydown", P, !0), P = null), A && (window.removeEventListener("scroll", A, !0), window.removeEventListener("resize", A), A = null), D && (D.disconnect(), D = null), x.forEach((t) => t.remove()), x.clear(), Array.from(oe).forEach((t) => ge(t)), M = null, y = null;
|
|
787
811
|
}
|
|
788
|
-
function
|
|
812
|
+
function yt() {
|
|
789
813
|
if (typeof document > "u" || document.getElementById(he)) return;
|
|
790
814
|
const e = document.createElement("style");
|
|
791
815
|
e.id = he, e.textContent = `
|
|
792
816
|
.rte-toolbar-group-items.${E},
|
|
793
817
|
.editora-toolbar-group-items.${E},
|
|
794
|
-
.rte-toolbar-group-items.${
|
|
795
|
-
.editora-toolbar-group-items.${
|
|
818
|
+
.rte-toolbar-group-items.${B},
|
|
819
|
+
.editora-toolbar-group-items.${B} {
|
|
796
820
|
display: flex;
|
|
797
821
|
border: 1px solid #cbd5e1;
|
|
798
822
|
border-radius: 4px;
|
|
@@ -801,8 +825,8 @@ function pt() {
|
|
|
801
825
|
|
|
802
826
|
.rte-toolbar-group-items.${E} .rte-toolbar-button,
|
|
803
827
|
.editora-toolbar-group-items.${E} .editora-toolbar-button,
|
|
804
|
-
.rte-toolbar-group-items.${
|
|
805
|
-
.editora-toolbar-group-items.${
|
|
828
|
+
.rte-toolbar-group-items.${B} .rte-toolbar-button,
|
|
829
|
+
.editora-toolbar-group-items.${B} .editora-toolbar-button {
|
|
806
830
|
border: none;
|
|
807
831
|
border-right: 1px solid #cbd5e1;
|
|
808
832
|
border-radius: 0;
|
|
@@ -810,8 +834,8 @@ function pt() {
|
|
|
810
834
|
|
|
811
835
|
.rte-toolbar-group-items.${E} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
812
836
|
.editora-toolbar-group-items.${E} .editora-toolbar-item:last-child .editora-toolbar-button,
|
|
813
|
-
.rte-toolbar-group-items.${
|
|
814
|
-
.editora-toolbar-group-items.${
|
|
837
|
+
.rte-toolbar-group-items.${B} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
838
|
+
.editora-toolbar-group-items.${B} .editora-toolbar-item:last-child .editora-toolbar-button {
|
|
815
839
|
border-right: none;
|
|
816
840
|
}
|
|
817
841
|
|
|
@@ -822,14 +846,14 @@ function pt() {
|
|
|
822
846
|
|
|
823
847
|
${$} .rte-toolbar-group-items.${E},
|
|
824
848
|
${$} .editora-toolbar-group-items.${E},
|
|
825
|
-
${$} .rte-toolbar-group-items.${
|
|
826
|
-
${$} .editora-toolbar-group-items.${
|
|
849
|
+
${$} .rte-toolbar-group-items.${B},
|
|
850
|
+
${$} .editora-toolbar-group-items.${B} {
|
|
827
851
|
border-color: #566275;
|
|
828
852
|
}
|
|
829
853
|
${$} .rte-toolbar-group-items.${E} .rte-toolbar-button svg,
|
|
830
854
|
${$} .editora-toolbar-group-items.${E} .editora-toolbar-button svg,
|
|
831
|
-
${$} .rte-toolbar-group-items.${
|
|
832
|
-
${$} .editora-toolbar-group-items.${
|
|
855
|
+
${$} .rte-toolbar-group-items.${B} .rte-toolbar-button svg,
|
|
856
|
+
${$} .editora-toolbar-group-items.${B} .editora-toolbar-button svg
|
|
833
857
|
{
|
|
834
858
|
fill: none;
|
|
835
859
|
}
|
|
@@ -838,7 +862,7 @@ function pt() {
|
|
|
838
862
|
{
|
|
839
863
|
border-color: #566275;
|
|
840
864
|
}
|
|
841
|
-
.${
|
|
865
|
+
.${d} {
|
|
842
866
|
position: fixed;
|
|
843
867
|
z-index: 12000;
|
|
844
868
|
display: none;
|
|
@@ -852,12 +876,12 @@ function pt() {
|
|
|
852
876
|
overflow: hidden;
|
|
853
877
|
}
|
|
854
878
|
|
|
855
|
-
.${
|
|
879
|
+
.${d}.show {
|
|
856
880
|
display: flex;
|
|
857
881
|
flex-direction: column;
|
|
858
882
|
}
|
|
859
883
|
|
|
860
|
-
.${
|
|
884
|
+
.${d}.rte-blocks-library-theme-dark {
|
|
861
885
|
border-color: #334155;
|
|
862
886
|
background: #0f172a;
|
|
863
887
|
color: #e2e8f0;
|
|
@@ -874,7 +898,7 @@ function pt() {
|
|
|
874
898
|
background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
|
|
875
899
|
}
|
|
876
900
|
|
|
877
|
-
.${
|
|
901
|
+
.${d}.rte-blocks-library-theme-dark .rte-blocks-library-header {
|
|
878
902
|
border-color: #1e293b;
|
|
879
903
|
background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
|
|
880
904
|
}
|
|
@@ -912,14 +936,14 @@ function pt() {
|
|
|
912
936
|
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
|
|
913
937
|
}
|
|
914
938
|
|
|
915
|
-
.${
|
|
939
|
+
.${d}.rte-blocks-library-theme-dark .rte-blocks-library-icon-btn {
|
|
916
940
|
border-color: #475569;
|
|
917
941
|
background: #0f172a;
|
|
918
942
|
color: #e2e8f0;
|
|
919
943
|
}
|
|
920
944
|
|
|
921
|
-
.${
|
|
922
|
-
.${
|
|
945
|
+
.${d}.rte-blocks-library-theme-dark .rte-blocks-library-icon-btn:hover,
|
|
946
|
+
.${d}.rte-blocks-library-theme-dark .rte-blocks-library-icon-btn:focus-visible {
|
|
923
947
|
border-color: #60a5fa;
|
|
924
948
|
box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
|
|
925
949
|
}
|
|
@@ -940,8 +964,8 @@ function pt() {
|
|
|
940
964
|
color: #334155;
|
|
941
965
|
}
|
|
942
966
|
|
|
943
|
-
.${
|
|
944
|
-
.${
|
|
967
|
+
.${d}.rte-blocks-library-theme-dark .rte-blocks-library-search-label,
|
|
968
|
+
.${d}.rte-blocks-library-theme-dark .rte-blocks-library-category-label {
|
|
945
969
|
color: #cbd5e1;
|
|
946
970
|
}
|
|
947
971
|
|
|
@@ -963,8 +987,8 @@ function pt() {
|
|
|
963
987
|
outline: none;
|
|
964
988
|
}
|
|
965
989
|
|
|
966
|
-
.${
|
|
967
|
-
.${
|
|
990
|
+
.${d}.rte-blocks-library-theme-dark .rte-blocks-library-input,
|
|
991
|
+
.${d}.rte-blocks-library-theme-dark .rte-blocks-library-select {
|
|
968
992
|
border-color: #334155;
|
|
969
993
|
background: #0b1220;
|
|
970
994
|
color: #e2e8f0;
|
|
@@ -985,13 +1009,13 @@ function pt() {
|
|
|
985
1009
|
color: #0f766e;
|
|
986
1010
|
}
|
|
987
1011
|
|
|
988
|
-
.${
|
|
989
|
-
.${
|
|
990
|
-
.${
|
|
1012
|
+
.${d}.rte-blocks-library-theme-dark .rte-blocks-library-status,
|
|
1013
|
+
.${d}.rte-blocks-library-theme-dark .rte-blocks-library-helper,
|
|
1014
|
+
.${d}.rte-blocks-library-theme-dark .rte-blocks-library-shortcut {
|
|
991
1015
|
color: #94a3b8;
|
|
992
1016
|
}
|
|
993
1017
|
|
|
994
|
-
.${
|
|
1018
|
+
.${d}.rte-blocks-library-theme-dark .rte-blocks-library-last-inserted {
|
|
995
1019
|
color: #5eead4;
|
|
996
1020
|
}
|
|
997
1021
|
|
|
@@ -1004,7 +1028,7 @@ function pt() {
|
|
|
1004
1028
|
overflow: auto;
|
|
1005
1029
|
}
|
|
1006
1030
|
|
|
1007
|
-
.${
|
|
1031
|
+
.${d}.rte-blocks-library-theme-dark .rte-blocks-library-list-wrap {
|
|
1008
1032
|
border-color: #334155;
|
|
1009
1033
|
background: #0b1220;
|
|
1010
1034
|
}
|
|
@@ -1046,13 +1070,13 @@ function pt() {
|
|
|
1046
1070
|
background: rgba(15, 118, 110, 0.12);
|
|
1047
1071
|
}
|
|
1048
1072
|
|
|
1049
|
-
.${
|
|
1073
|
+
.${d}.rte-blocks-library-theme-dark .rte-blocks-library-item {
|
|
1050
1074
|
border-color: #334155;
|
|
1051
1075
|
background: #111827;
|
|
1052
1076
|
color: #e2e8f0;
|
|
1053
1077
|
}
|
|
1054
1078
|
|
|
1055
|
-
.${
|
|
1079
|
+
.${d}.rte-blocks-library-theme-dark .rte-blocks-library-item.active {
|
|
1056
1080
|
border-color: #2dd4bf;
|
|
1057
1081
|
background: rgba(45, 212, 191, 0.15);
|
|
1058
1082
|
}
|
|
@@ -1082,7 +1106,7 @@ function pt() {
|
|
|
1082
1106
|
padding: 2px 6px;
|
|
1083
1107
|
}
|
|
1084
1108
|
|
|
1085
|
-
.${
|
|
1109
|
+
.${d}.rte-blocks-library-theme-dark .rte-blocks-library-recent-pill {
|
|
1086
1110
|
color: #5eead4;
|
|
1087
1111
|
border-color: rgba(94, 234, 212, 0.45);
|
|
1088
1112
|
}
|
|
@@ -1104,12 +1128,12 @@ function pt() {
|
|
|
1104
1128
|
overflow: hidden;
|
|
1105
1129
|
}
|
|
1106
1130
|
|
|
1107
|
-
.${
|
|
1108
|
-
.${
|
|
1131
|
+
.${d}.rte-blocks-library-theme-dark .rte-blocks-library-item-meta,
|
|
1132
|
+
.${d}.rte-blocks-library-theme-dark .rte-blocks-library-item-description {
|
|
1109
1133
|
color: #94a3b8;
|
|
1110
1134
|
}
|
|
1111
1135
|
|
|
1112
|
-
.${
|
|
1136
|
+
.${d}.rte-blocks-library-theme-dark .rte-blocks-library-item-preview {
|
|
1113
1137
|
color: #cbd5e1;
|
|
1114
1138
|
}
|
|
1115
1139
|
|
|
@@ -1154,13 +1178,13 @@ function pt() {
|
|
|
1154
1178
|
outline: none;
|
|
1155
1179
|
}
|
|
1156
1180
|
|
|
1157
|
-
.${
|
|
1181
|
+
.${d}.rte-blocks-library-theme-dark .rte-blocks-library-btn {
|
|
1158
1182
|
border-color: #334155;
|
|
1159
1183
|
background: #111827;
|
|
1160
1184
|
color: #e2e8f0;
|
|
1161
1185
|
}
|
|
1162
1186
|
|
|
1163
|
-
.${
|
|
1187
|
+
.${d}.rte-blocks-library-theme-dark .rte-blocks-library-btn-primary {
|
|
1164
1188
|
border-color: #14b8a6;
|
|
1165
1189
|
background: #0f766e;
|
|
1166
1190
|
color: #f0fdfa;
|
|
@@ -1178,7 +1202,7 @@ function pt() {
|
|
|
1178
1202
|
}
|
|
1179
1203
|
|
|
1180
1204
|
@media (max-width: 768px) {
|
|
1181
|
-
.${
|
|
1205
|
+
.${d} {
|
|
1182
1206
|
left: 10px !important;
|
|
1183
1207
|
right: 10px;
|
|
1184
1208
|
top: 10px !important;
|
|
@@ -1188,9 +1212,9 @@ function pt() {
|
|
|
1188
1212
|
}
|
|
1189
1213
|
`, document.head.appendChild(e);
|
|
1190
1214
|
}
|
|
1191
|
-
const
|
|
1215
|
+
const ht = (e = {}) => {
|
|
1192
1216
|
const t = Q(e), r = /* @__PURE__ */ new Set();
|
|
1193
|
-
return
|
|
1217
|
+
return yt(), {
|
|
1194
1218
|
name: "blocksLibrary",
|
|
1195
1219
|
toolbar: [
|
|
1196
1220
|
{
|
|
@@ -1221,19 +1245,19 @@ const mt = (e = {}) => {
|
|
|
1221
1245
|
const n = T(l, !1, !1);
|
|
1222
1246
|
if (!n) return !1;
|
|
1223
1247
|
const a = b.get(n) || t;
|
|
1224
|
-
return k(n, a), b.set(n, a), y = n,
|
|
1248
|
+
return k(n, a), b.set(n, a), y = n, de(n), !0;
|
|
1225
1249
|
},
|
|
1226
1250
|
openBlocksLibraryPanel: (o, l) => {
|
|
1227
1251
|
const n = T(l, !1, !1);
|
|
1228
1252
|
if (!n) return !1;
|
|
1229
1253
|
const a = b.get(n) || t;
|
|
1230
|
-
return k(n, a), b.set(n, a), y = n,
|
|
1254
|
+
return k(n, a), b.set(n, a), y = n, de(n), !0;
|
|
1231
1255
|
},
|
|
1232
1256
|
toggleBlocksLibraryPanel: (o, l) => {
|
|
1233
1257
|
const n = T(l, !1, !1);
|
|
1234
1258
|
if (!n) return !1;
|
|
1235
1259
|
const a = b.get(n) || t;
|
|
1236
|
-
return k(n, a), b.set(n, a), y = n,
|
|
1260
|
+
return k(n, a), b.set(n, a), y = n, Re(n, typeof o == "boolean" ? o : void 0);
|
|
1237
1261
|
},
|
|
1238
1262
|
insertBlockSnippet: (o, l) => {
|
|
1239
1263
|
const n = T(l, !1, !1);
|
|
@@ -1247,7 +1271,7 @@ const mt = (e = {}) => {
|
|
|
1247
1271
|
const n = T(l, !1, !1);
|
|
1248
1272
|
if (!n) return !1;
|
|
1249
1273
|
const a = b.get(n) || t;
|
|
1250
|
-
return k(n, a), b.set(n, a), y = n,
|
|
1274
|
+
return k(n, a), b.set(n, a), y = n, qe(n);
|
|
1251
1275
|
},
|
|
1252
1276
|
refreshBlocksLibraryData: (o, l) => {
|
|
1253
1277
|
const n = T(l, !1, !1);
|
|
@@ -1258,7 +1282,7 @@ const mt = (e = {}) => {
|
|
|
1258
1282
|
setBlocksLibraryOptions: (o, l) => {
|
|
1259
1283
|
const n = T(l, !1, !1);
|
|
1260
1284
|
if (!n || !o || typeof o != "object") return !1;
|
|
1261
|
-
const a = b.get(n) || t, s = J.get(n) ||
|
|
1285
|
+
const a = b.get(n) || t, s = J.get(n) || Ve(a), i = {
|
|
1262
1286
|
...s,
|
|
1263
1287
|
...o,
|
|
1264
1288
|
labels: {
|
|
@@ -1269,17 +1293,17 @@ const mt = (e = {}) => {
|
|
|
1269
1293
|
normalizeText: o.normalizeText || a.normalizeText,
|
|
1270
1294
|
sanitizeBlockHtml: o.sanitizeBlockHtml || a.sanitizeBlockHtml,
|
|
1271
1295
|
getBlocks: o.getBlocks || a.getBlocks
|
|
1272
|
-
}, c = Q(i),
|
|
1273
|
-
b.set(n, c), J.set(n, i), (
|
|
1296
|
+
}, c = Q(i), u = Array.isArray(o.blocks), f = o.getBlocks !== void 0;
|
|
1297
|
+
b.set(n, c), J.set(n, i), (u || f || !I.has(n)) && (I.set(n, c.blocks), O.set(n, f ? 0 : Date.now()));
|
|
1274
1298
|
const g = k(n, c);
|
|
1275
|
-
return g.filterCache.clear(), typeof o.defaultCategory == "string" && (g.category = ne(c.defaultCategory) || "all"),
|
|
1299
|
+
return g.filterCache.clear(), typeof o.defaultCategory == "string" && (g.category = ne(c.defaultCategory) || "all"), v(n), N(n), f && be(n, !0), !0;
|
|
1276
1300
|
},
|
|
1277
1301
|
getBlocksLibraryState: (o, l) => {
|
|
1278
1302
|
const n = T(l, !1, !1);
|
|
1279
1303
|
if (!n) return !1;
|
|
1280
1304
|
const a = b.get(n) || t;
|
|
1281
1305
|
k(n, a);
|
|
1282
|
-
const s =
|
|
1306
|
+
const s = bt(n);
|
|
1283
1307
|
if (typeof o == "function")
|
|
1284
1308
|
try {
|
|
1285
1309
|
o(s);
|
|
@@ -1302,19 +1326,19 @@ const mt = (e = {}) => {
|
|
|
1302
1326
|
init: function(l) {
|
|
1303
1327
|
X += 1;
|
|
1304
1328
|
const n = this && typeof this.__pluginConfig == "object" ? { ...e, ...this.__pluginConfig } : e, a = Q(n);
|
|
1305
|
-
|
|
1329
|
+
pt(a);
|
|
1306
1330
|
const s = T(
|
|
1307
1331
|
l?.editorElement ? { editorElement: l.editorElement } : void 0,
|
|
1308
1332
|
!1,
|
|
1309
1333
|
!1
|
|
1310
1334
|
);
|
|
1311
|
-
s && (y = s, r.add(s), k(s, a), b.set(s, a), J.set(s, n), I.set(s, a.blocks), O.set(s, Date.now()),
|
|
1335
|
+
s && (y = s, r.add(s), k(s, a), b.set(s, a), J.set(s, n), I.set(s, a.blocks), O.set(s, Date.now()), N(s));
|
|
1312
1336
|
},
|
|
1313
1337
|
destroy: () => {
|
|
1314
|
-
r.forEach((o) => ge(o)), r.clear(), X = Math.max(0, X - 1), !(X > 0) &&
|
|
1338
|
+
r.forEach((o) => ge(o)), r.clear(), X = Math.max(0, X - 1), !(X > 0) && mt();
|
|
1315
1339
|
}
|
|
1316
1340
|
};
|
|
1317
1341
|
};
|
|
1318
1342
|
export {
|
|
1319
|
-
|
|
1343
|
+
ht as BlocksLibraryPlugin
|
|
1320
1344
|
};
|