@editora/core 1.0.9 → 1.0.11
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 +1 -1
- package/dist/{A11yCheckerPlugin.native-58d12bed.mjs → A11yCheckerPlugin.native-BRdGYMju.mjs} +12 -23
- package/dist/{AnchorPlugin.native-289a112a.mjs → AnchorPlugin.native-BcYGEtd9.mjs} +102 -112
- package/dist/{ApprovalWorkflowPlugin.native-449ce66c.mjs → ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs} +173 -209
- package/dist/{BackgroundColorPlugin.native-8aceb5cc.mjs → BackgroundColorPlugin.native-50iAT9xU.mjs} +9 -16
- package/dist/BlockquotePlugin.native-57_Xcjl1.mjs +212 -0
- package/dist/{BlocksLibraryPlugin.native-1cc51e63.mjs → BlocksLibraryPlugin.native-5sdsXsiE.mjs} +149 -205
- package/dist/{BoldPlugin.native-f9d7f8e4.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-169fb1e8.mjs → CitationsPlugin.native-DQgoCd1B.mjs} +196 -261
- package/dist/ClearFormattingPlugin.native-DIS6AN2t.mjs +172 -0
- package/dist/CodePlugin.native-veDC_kx5.mjs +4600 -0
- package/dist/{CodeSamplePlugin.native-6cc0148e.mjs → CodeSamplePlugin.native-CgGoH-X4.mjs} +10 -19
- package/dist/{CommentsPlugin.native-03659874.mjs → CommentsPlugin.native-DPSqTkiv.mjs} +28 -55
- package/dist/{ConditionalContentPlugin.native-4983143a.mjs → ConditionalContentPlugin.native-CfhY46rU.mjs} +51 -108
- package/dist/{ContentRulesPlugin.native-63ed405b.mjs → ContentRulesPlugin.native-vPx5nC73.mjs} +153 -200
- package/dist/{DataBindingPlugin.native-427e9d75.mjs → DataBindingPlugin.native-BoXwghTz.mjs} +88 -124
- package/dist/DirectionPlugin.native-Bl-QLFzO.mjs +153 -0
- package/dist/{DocSchemaPlugin.native-8e41eda0.mjs → DocSchemaPlugin.native-DUSVRHqT.mjs} +112 -166
- package/dist/{DocumentManagerPlugin.native-e69895ad.mjs → DocumentManagerPlugin.native-C2cs_1w4.mjs} +4 -4
- package/dist/EmbedIframePlugin.native-BF_-LjTq.mjs +740 -0
- package/dist/{EmojisPlugin.native-65c5ac47.mjs → EmojisPlugin.native-CitxxlWX.mjs} +6 -11
- package/dist/{FontFamilyPlugin.native-f9bc255a.mjs → FontFamilyPlugin.native-j8hMTbg4.mjs} +4 -7
- package/dist/{FontSizePlugin.native-f5647872.mjs → FontSizePlugin.native-B_jCh7dY.mjs} +10 -19
- package/dist/{FootnotePlugin.native-494657b3.mjs → FootnotePlugin.native-D730OGRm.mjs} +39 -77
- package/dist/{FullscreenPlugin.native-87ce92e9.mjs → FullscreenPlugin.native-ChXyxeNw.mjs} +1 -1
- package/dist/HeadingPlugin.native-DZdvubrQ.mjs +249 -0
- package/dist/{HistoryPlugin.native-92ed4be4.mjs → HistoryPlugin.native-D2wl32jV.mjs} +107 -143
- package/dist/{IndentPlugin.native-e4ee902b.mjs → IndentPlugin.native-BHixp8sP.mjs} +12 -23
- package/dist/{ItalicPlugin.native-7c95cfbc.mjs → ItalicPlugin.native-CmnlwFHB.mjs} +15 -11
- package/dist/{LineHeightPlugin.native-5668f78c.mjs → LineHeightPlugin.native-CM7iXdQj.mjs} +10 -19
- package/dist/{LinkPlugin.native-6df29111.mjs → LinkPlugin.native-DYCIcdTm.mjs} +5 -9
- package/dist/{ListPlugin.native-fe2e115a.mjs → ListPlugin.native-V7EZC1lM.mjs} +5 -9
- package/dist/MathPlugin.native-NwWPHVmj.mjs +369 -0
- package/dist/{MediaManagerPlugin.native-3cf48a00.mjs → MediaManagerPlugin.native-eOsTJFpw.mjs} +11 -21
- package/dist/{MentionPlugin.native-3b1e8c05.mjs → MentionPlugin.native-BMDlOqur.mjs} +45 -89
- package/dist/MergeTagPlugin.native-BzRVoD9-.mjs +580 -0
- package/dist/{PIIRedactionPlugin.native-7ab10b9f.mjs → PIIRedactionPlugin.native-g7j4jOmm.mjs} +210 -260
- package/dist/{PageBreakPlugin.native-1794c5fb.mjs → PageBreakPlugin.native-DijGuHJZ.mjs} +16 -31
- package/dist/{PreviewPlugin.native-f7b67cc0.mjs → PreviewPlugin.native-WuIwOAOR.mjs} +6 -11
- package/dist/{PrintPlugin.native-f6a168c2.mjs → PrintPlugin.native-7qt5v7L5.mjs} +3 -5
- package/dist/{SlashCommandsPlugin.native-8d45e511.mjs → SlashCommandsPlugin.native-BiN6ODw5.mjs} +36 -71
- package/dist/{SmartPastePlugin.native-a6c5efec.mjs → SmartPastePlugin.native-CZAEHkyt.mjs} +173 -219
- package/dist/{SpecialCharactersPlugin.native-7f06d4ba.mjs → SpecialCharactersPlugin.native-DaG4b19I.mjs} +101 -85
- package/dist/{SpellCheckPlugin.native-04e20834.mjs → SpellCheckPlugin.native-BZB9AewP.mjs} +21 -41
- package/dist/{StrikethroughPlugin.native-905e9501.mjs → StrikethroughPlugin.native-V0TL4F48.mjs} +12 -30
- package/dist/{TablePlugin.native-7d5458c1.mjs → TablePlugin.native-DrHX-efe.mjs} +30 -58
- package/dist/TemplatePlugin.native-DLjFUaPW.mjs +1150 -0
- package/dist/{TextAlignmentPlugin.native-9357b3ed.mjs → TextAlignmentPlugin.native-sM_1s00t.mjs} +6 -11
- package/dist/{TextColorPlugin.native-d53ed459.mjs → TextColorPlugin.native-Bwl_bSmc.mjs} +14 -26
- package/dist/{TrackChangesPlugin.native-e96da509.mjs → TrackChangesPlugin.native-Bghu2q4a.mjs} +58 -115
- package/dist/{TranslationWorkflowPlugin.native-4e711b1e.mjs → TranslationWorkflowPlugin.native-DdF16tgT.mjs} +191 -257
- package/dist/{UnderlinePlugin.native-8080c998.mjs → UnderlinePlugin.native-DZzg23rv.mjs} +8 -4
- package/dist/{VersionDiffPlugin.native-5bbeff85.mjs → VersionDiffPlugin.native-Bvxgy--t.mjs} +26 -51
- package/dist/_commonjsHelpers-DOllISpa.mjs +32 -0
- package/dist/{anchoredPopover-5cca53ba.mjs → anchoredPopover-Bxds0VoB.mjs} +1 -1
- package/dist/core.css +1 -0
- package/dist/documentManager-vQ1VkbUY.mjs +8418 -0
- package/dist/{editorContainerHelpers-69585c07.mjs → editorContainerHelpers-C7kdWnS0.mjs} +2 -3
- package/dist/editora.min.js +13 -14
- package/dist/editora.umd.js +13 -14
- package/dist/{html2canvas.esm-c51cb3b9.mjs → html2canvas.esm-AYkPY5LS.mjs} +894 -978
- package/dist/index-BslAFzmv.mjs +16544 -0
- package/dist/index-CPMGUZfB.js +10 -0
- package/dist/{index-7da30697.mjs → index-DBoj6QfW.mjs} +127 -164
- package/dist/index.cjs.js +1 -1
- package/dist/index.es-BYD2KEo6.mjs +6666 -0
- package/dist/index.esm.js +7 -12
- package/dist/inlineFormatting-DJ0-NZtx.mjs +97 -0
- package/dist/{jspdf.es.min-780c82db.mjs → jspdf.es.min-BJGtOnRT.mjs} +3784 -4808
- package/dist/plugin-loader.js +67 -67
- package/dist/{purify.es-3bdbcfc5.mjs → purify.es-CKpwg8Tk.mjs} +10 -20
- package/dist/webcomponent-core.js +131 -168
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +147 -65
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +191 -228
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +1248 -1346
- package/package.json +1 -1
- package/dist/BlockquotePlugin.native-3541c714.mjs +0 -49
- package/dist/CapitalizationPlugin.native-42c135dc.mjs +0 -80
- package/dist/ChecklistPlugin.native-3b397ee9.mjs +0 -330
- package/dist/ClearFormattingPlugin.native-77baa514.mjs +0 -145
- package/dist/CodePlugin.native-989cf0aa.mjs +0 -2740
- package/dist/DirectionPlugin.native-4e742f42.mjs +0 -139
- package/dist/EmbedIframePlugin.native-55209c87.mjs +0 -568
- package/dist/HeadingPlugin.native-e38c4a16.mjs +0 -64
- package/dist/MathPlugin.native-735bbac2.mjs +0 -296
- package/dist/MergeTagPlugin.native-31cf7d48.mjs +0 -584
- package/dist/TemplatePlugin.native-580f0f63.mjs +0 -617
- package/dist/_commonjsHelpers-69d58be2.mjs +0 -31
- package/dist/documentManager-8327fb6e.mjs +0 -9166
- package/dist/index-072ef022.js +0 -11
- package/dist/index-49d31221.mjs +0 -16860
- package/dist/index.es-b47a189f.mjs +0 -5782
- package/dist/style.css +0 -1
package/dist/{BlocksLibraryPlugin.native-1cc51e63.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(
|
|
@@ -45,8 +45,7 @@ function xe(e) {
|
|
|
45
45
|
/\s(href|src|xlink:href)\s*=\s*("([^"]*)"|'([^']*)')/gi,
|
|
46
46
|
(r, o, l, n, a) => {
|
|
47
47
|
const s = typeof n == "string" && n.length > 0 ? n : a || "", i = ce(s);
|
|
48
|
-
if (!i)
|
|
49
|
-
return "";
|
|
48
|
+
if (!i) return "";
|
|
50
49
|
const c = l.startsWith('"') ? '"' : "'";
|
|
51
50
|
return ` ${o}=${c}${i}${c}`;
|
|
52
51
|
}
|
|
@@ -61,9 +60,8 @@ function xe(e) {
|
|
|
61
60
|
return ` style=${s}${a}${s}`;
|
|
62
61
|
}).trim(), t;
|
|
63
62
|
}
|
|
64
|
-
function
|
|
65
|
-
if (!e)
|
|
66
|
-
return "";
|
|
63
|
+
function Fe(e) {
|
|
64
|
+
if (!e) return "";
|
|
67
65
|
if (typeof document == "undefined")
|
|
68
66
|
return xe(e);
|
|
69
67
|
const t = document.createElement("template");
|
|
@@ -71,7 +69,7 @@ function We(e) {
|
|
|
71
69
|
const r = t.content;
|
|
72
70
|
return !r || typeof r.querySelectorAll != "function" ? xe(e) : (Array.from(r.querySelectorAll("*")).forEach((l) => {
|
|
73
71
|
const n = l.tagName.toLowerCase();
|
|
74
|
-
if (
|
|
72
|
+
if (Be.has(n)) {
|
|
75
73
|
l.remove();
|
|
76
74
|
return;
|
|
77
75
|
}
|
|
@@ -99,9 +97,8 @@ function We(e) {
|
|
|
99
97
|
function ne(e) {
|
|
100
98
|
return e.trim().toLowerCase();
|
|
101
99
|
}
|
|
102
|
-
function
|
|
103
|
-
if (!e)
|
|
104
|
-
return "";
|
|
100
|
+
function Ge(e) {
|
|
101
|
+
if (!e) return "";
|
|
105
102
|
if (typeof document == "undefined")
|
|
106
103
|
return e.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
|
|
107
104
|
const t = document.createElement("template");
|
|
@@ -109,20 +106,18 @@ function Fe(e) {
|
|
|
109
106
|
const r = t.content;
|
|
110
107
|
return !r || typeof r.textContent != "string" ? e.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim() : r.textContent.replace(/\s+/g, " ").trim();
|
|
111
108
|
}
|
|
112
|
-
function
|
|
113
|
-
if (!Array.isArray(e) || e.length === 0)
|
|
114
|
-
return [];
|
|
109
|
+
function Ce(e, t) {
|
|
110
|
+
if (!Array.isArray(e) || e.length === 0) return [];
|
|
115
111
|
const r = /* @__PURE__ */ new Set(), o = [];
|
|
116
112
|
return e.forEach((l) => {
|
|
117
113
|
const n = t.normalizeText(l.label || ""), a = t.sanitizeBlockHtml(l.html || "", l).trim();
|
|
118
|
-
if (!n || !a)
|
|
119
|
-
return;
|
|
114
|
+
if (!n || !a) return;
|
|
120
115
|
const s = t.normalizeText(l.category || "General") || "General", i = ne(s);
|
|
121
|
-
let d =
|
|
116
|
+
let d = We(t.normalizeText(l.id || n)) || `block-${ke++}`;
|
|
122
117
|
for (; r.has(d); )
|
|
123
118
|
d = `${d}-${ke++}`;
|
|
124
119
|
r.add(d);
|
|
125
|
-
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();
|
|
126
121
|
o.push({
|
|
127
122
|
id: d,
|
|
128
123
|
label: n,
|
|
@@ -132,14 +127,14 @@ function Be(e, t) {
|
|
|
132
127
|
categoryKey: i,
|
|
133
128
|
tags: f,
|
|
134
129
|
keywords: g,
|
|
135
|
-
previewText:
|
|
130
|
+
previewText: B,
|
|
136
131
|
searchBlob: V
|
|
137
132
|
});
|
|
138
133
|
}), o;
|
|
139
134
|
}
|
|
140
135
|
function Q(e = {}) {
|
|
141
136
|
var l, n, a, s;
|
|
142
|
-
const t = e.normalizeText ||
|
|
137
|
+
const t = e.normalizeText || je, r = e.sanitizeBlockHtml || Fe, o = {
|
|
143
138
|
blocks: [],
|
|
144
139
|
defaultCategory: t(e.defaultCategory || ""),
|
|
145
140
|
maxResults: Math.max(4, Math.min(300, Number((l = e.maxResults) != null ? l : 80))),
|
|
@@ -147,16 +142,16 @@ function Q(e = {}) {
|
|
|
147
142
|
debounceMs: Math.max(0, Math.min(700, Number((a = e.debounceMs) != null ? a : 90))),
|
|
148
143
|
cacheTtlMs: Math.max(0, Number((s = e.cacheTtlMs) != null ? s : 6e4)),
|
|
149
144
|
labels: {
|
|
150
|
-
...
|
|
145
|
+
...Ke,
|
|
151
146
|
...e.labels || {}
|
|
152
147
|
},
|
|
153
148
|
normalizeText: t,
|
|
154
149
|
sanitizeBlockHtml: r,
|
|
155
150
|
getBlocks: typeof e.getBlocks == "function" ? e.getBlocks : void 0
|
|
156
151
|
};
|
|
157
|
-
return o.blocks =
|
|
152
|
+
return o.blocks = Ce(e.blocks, o), o;
|
|
158
153
|
}
|
|
159
|
-
function
|
|
154
|
+
function Ue(e) {
|
|
160
155
|
return {
|
|
161
156
|
blocks: e.blocks.map((t) => ({
|
|
162
157
|
id: t.id,
|
|
@@ -182,33 +177,27 @@ function le(e) {
|
|
|
182
177
|
return e.closest(fe) || e;
|
|
183
178
|
}
|
|
184
179
|
function G(e) {
|
|
185
|
-
if (!e)
|
|
186
|
-
|
|
187
|
-
if (e.matches(L))
|
|
188
|
-
return e;
|
|
180
|
+
if (!e) return null;
|
|
181
|
+
if (e.matches(L)) return e;
|
|
189
182
|
const t = e.querySelector(L);
|
|
190
183
|
return t instanceof HTMLElement ? t : null;
|
|
191
184
|
}
|
|
192
|
-
function
|
|
193
|
-
if (typeof window == "undefined")
|
|
194
|
-
return null;
|
|
185
|
+
function Ve() {
|
|
186
|
+
if (typeof window == "undefined") return null;
|
|
195
187
|
const e = window[ye];
|
|
196
|
-
if (!(e instanceof HTMLElement))
|
|
197
|
-
return null;
|
|
188
|
+
if (!(e instanceof HTMLElement)) return null;
|
|
198
189
|
window[ye] = null;
|
|
199
190
|
const t = G(e);
|
|
200
|
-
if (t)
|
|
201
|
-
return t;
|
|
191
|
+
if (t) return t;
|
|
202
192
|
const r = e.closest(fe);
|
|
203
193
|
if (r) {
|
|
204
194
|
const l = G(r);
|
|
205
|
-
if (l)
|
|
206
|
-
return l;
|
|
195
|
+
if (l) return l;
|
|
207
196
|
}
|
|
208
197
|
const o = e.closest(L);
|
|
209
198
|
return o instanceof HTMLElement ? o : null;
|
|
210
199
|
}
|
|
211
|
-
function
|
|
200
|
+
function Ye(e) {
|
|
212
201
|
const t = e.closest("[data-editora-editor]");
|
|
213
202
|
if (t && G(t) === e)
|
|
214
203
|
return t;
|
|
@@ -229,70 +218,60 @@ function ee() {
|
|
|
229
218
|
});
|
|
230
219
|
}
|
|
231
220
|
function S(e, t = !0, r = !0) {
|
|
232
|
-
if (ee(), (e == null ? void 0 : e.contentElement) instanceof HTMLElement)
|
|
233
|
-
return e.contentElement;
|
|
221
|
+
if (ee(), (e == null ? void 0 : e.contentElement) instanceof HTMLElement) return e.contentElement;
|
|
234
222
|
if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
|
|
235
223
|
const a = G(e.editorElement);
|
|
236
|
-
if (a)
|
|
237
|
-
return a;
|
|
224
|
+
if (a) return a;
|
|
238
225
|
}
|
|
239
|
-
const o =
|
|
240
|
-
if (o)
|
|
241
|
-
return o;
|
|
226
|
+
const o = Ve();
|
|
227
|
+
if (o) return o;
|
|
242
228
|
const l = window.getSelection();
|
|
243
229
|
if (l && l.rangeCount > 0) {
|
|
244
230
|
const a = $e(l.getRangeAt(0).startContainer), s = a == null ? void 0 : a.closest(L);
|
|
245
|
-
if (s)
|
|
246
|
-
return s;
|
|
231
|
+
if (s) return s;
|
|
247
232
|
}
|
|
248
233
|
const n = document.activeElement;
|
|
249
234
|
if (n) {
|
|
250
|
-
if (n.matches(L))
|
|
251
|
-
return n;
|
|
235
|
+
if (n.matches(L)) return n;
|
|
252
236
|
const a = n.closest(L);
|
|
253
|
-
if (a)
|
|
254
|
-
return a;
|
|
237
|
+
if (a) return a;
|
|
255
238
|
}
|
|
256
239
|
if (r) {
|
|
257
|
-
if (y && y.isConnected)
|
|
258
|
-
return y;
|
|
240
|
+
if (y && y.isConnected) return y;
|
|
259
241
|
y && !y.isConnected && (y = null);
|
|
260
242
|
}
|
|
261
243
|
return t ? document.querySelector(L) : null;
|
|
262
244
|
}
|
|
263
|
-
function
|
|
245
|
+
function Xe(e) {
|
|
264
246
|
const t = e.target;
|
|
265
247
|
if (t) {
|
|
266
248
|
const o = t.closest(L);
|
|
267
|
-
if (o)
|
|
268
|
-
return o;
|
|
249
|
+
if (o) return o;
|
|
269
250
|
}
|
|
270
251
|
const r = window.getSelection();
|
|
271
252
|
if (r && r.rangeCount > 0) {
|
|
272
253
|
const o = $e(r.getRangeAt(0).startContainer), l = o == null ? void 0 : o.closest(L);
|
|
273
|
-
if (l)
|
|
274
|
-
return l;
|
|
254
|
+
if (l) return l;
|
|
275
255
|
}
|
|
276
256
|
return null;
|
|
277
257
|
}
|
|
278
258
|
function Z(e) {
|
|
279
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;
|
|
280
260
|
}
|
|
281
|
-
function
|
|
261
|
+
function Ze(e) {
|
|
282
262
|
const t = le(e);
|
|
283
|
-
if (Z(t))
|
|
284
|
-
return !0;
|
|
263
|
+
if (Z(t)) return !0;
|
|
285
264
|
const r = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
286
265
|
return Z(r) ? !0 : Z(document.documentElement) || Z(document.body);
|
|
287
266
|
}
|
|
288
267
|
function re(e, t) {
|
|
289
|
-
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");
|
|
290
269
|
}
|
|
291
270
|
function Te(e) {
|
|
292
271
|
return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
|
|
293
272
|
}
|
|
294
273
|
function we(e, t, r) {
|
|
295
|
-
const o =
|
|
274
|
+
const o = Ye(e);
|
|
296
275
|
Array.from(
|
|
297
276
|
o.querySelectorAll(
|
|
298
277
|
`.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`
|
|
@@ -315,8 +294,7 @@ function se(e) {
|
|
|
315
294
|
}
|
|
316
295
|
function Se(e) {
|
|
317
296
|
const t = q.get(e);
|
|
318
|
-
if (!t)
|
|
319
|
-
return null;
|
|
297
|
+
if (!t) return null;
|
|
320
298
|
if (!e.isConnected)
|
|
321
299
|
return q.delete(e), null;
|
|
322
300
|
try {
|
|
@@ -326,23 +304,21 @@ function Se(e) {
|
|
|
326
304
|
return q.delete(e), null;
|
|
327
305
|
}
|
|
328
306
|
}
|
|
329
|
-
function
|
|
307
|
+
function Je(e) {
|
|
330
308
|
const t = Se(e);
|
|
331
309
|
return t ? (He(e, t), !0) : !1;
|
|
332
310
|
}
|
|
333
|
-
function
|
|
334
|
-
if (te.has(e))
|
|
335
|
-
return;
|
|
311
|
+
function Qe(e) {
|
|
312
|
+
if (te.has(e)) return;
|
|
336
313
|
const t = () => {
|
|
337
314
|
const r = window.getSelection();
|
|
338
|
-
if (!r || r.rangeCount === 0)
|
|
339
|
-
return;
|
|
315
|
+
if (!r || r.rangeCount === 0) return;
|
|
340
316
|
const o = r.getRangeAt(0);
|
|
341
317
|
e.contains(o.commonAncestorContainer) && se(e);
|
|
342
318
|
};
|
|
343
319
|
e.addEventListener("keyup", t), e.addEventListener("mouseup", t), e.addEventListener("touchend", t), te.set(e, t);
|
|
344
320
|
}
|
|
345
|
-
function
|
|
321
|
+
function et(e) {
|
|
346
322
|
const t = te.get(e);
|
|
347
323
|
t && (e.removeEventListener("keyup", t), e.removeEventListener("mouseup", t), e.removeEventListener("touchend", t), te.delete(e));
|
|
348
324
|
}
|
|
@@ -361,7 +337,7 @@ function k(e, t) {
|
|
|
361
337
|
visibleMatches: 0,
|
|
362
338
|
filterCache: /* @__PURE__ */ new Map(),
|
|
363
339
|
debounceTimer: null
|
|
364
|
-
}, w.set(e, r)), oe.add(e),
|
|
340
|
+
}, w.set(e, r)), oe.add(e), Qe(e), r;
|
|
365
341
|
}
|
|
366
342
|
function Me(e) {
|
|
367
343
|
const t = w.get(e);
|
|
@@ -369,19 +345,18 @@ function Me(e) {
|
|
|
369
345
|
}
|
|
370
346
|
function ge(e) {
|
|
371
347
|
var r;
|
|
372
|
-
Me(e),
|
|
348
|
+
Me(e), et(e), q.delete(e);
|
|
373
349
|
const t = W.get(e);
|
|
374
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);
|
|
375
351
|
}
|
|
376
|
-
function
|
|
352
|
+
function tt(e) {
|
|
377
353
|
var t, r, o, l;
|
|
378
354
|
for (let n = 0; n < e.length; n += 1) {
|
|
379
355
|
const a = e[n];
|
|
380
356
|
if (!(a.type !== "childList" || a.removedNodes.length === 0))
|
|
381
357
|
for (let s = 0; s < a.removedNodes.length; s += 1) {
|
|
382
358
|
const i = a.removedNodes[s];
|
|
383
|
-
if (i.nodeType !== Node.ELEMENT_NODE)
|
|
384
|
-
continue;
|
|
359
|
+
if (i.nodeType !== Node.ELEMENT_NODE) continue;
|
|
385
360
|
const c = i;
|
|
386
361
|
if ((t = c.matches) != null && t.call(c, L) || (r = c.matches) != null && r.call(c, `.${u}`) || (o = c.querySelector) != null && o.call(c, L) || (l = c.querySelector) != null && l.call(c, `.${u}`))
|
|
387
362
|
return !0;
|
|
@@ -393,8 +368,7 @@ function pe(e) {
|
|
|
393
368
|
return U.get(e) === !0;
|
|
394
369
|
}
|
|
395
370
|
function de(e, t) {
|
|
396
|
-
if (!t.classList.contains("show"))
|
|
397
|
-
return;
|
|
371
|
+
if (!t.classList.contains("show")) return;
|
|
398
372
|
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));
|
|
399
373
|
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`;
|
|
400
374
|
}
|
|
@@ -402,7 +376,7 @@ function ae(e) {
|
|
|
402
376
|
var t;
|
|
403
377
|
return R.get(e) || ((t = b.get(e)) == null ? void 0 : t.blocks) || [];
|
|
404
378
|
}
|
|
405
|
-
function
|
|
379
|
+
function rt(e, t) {
|
|
406
380
|
const r = /* @__PURE__ */ new Map();
|
|
407
381
|
ae(e).forEach((l) => {
|
|
408
382
|
r.has(l.categoryKey) || r.set(l.categoryKey, l.category);
|
|
@@ -431,24 +405,22 @@ function Ae(e, t) {
|
|
|
431
405
|
}
|
|
432
406
|
return i;
|
|
433
407
|
}
|
|
434
|
-
function
|
|
408
|
+
function ot(e, t) {
|
|
435
409
|
const r = w.get(e);
|
|
436
|
-
if (!r)
|
|
437
|
-
return;
|
|
410
|
+
if (!r) return;
|
|
438
411
|
if (t.length === 0) {
|
|
439
412
|
r.selectedBlockId = null;
|
|
440
413
|
return;
|
|
441
414
|
}
|
|
442
415
|
t.some((l) => l.id === r.selectedBlockId) || (r.selectedBlockId = t[0].id);
|
|
443
416
|
}
|
|
444
|
-
function
|
|
417
|
+
function K(e) {
|
|
445
418
|
const t = w.get(e);
|
|
446
419
|
we(e, "toggleBlocksLibraryPanel", pe(e)), we(e, "insertLastBlockSnippet", !!(t != null && t.lastInsertedBlockId));
|
|
447
420
|
}
|
|
448
421
|
function v(e) {
|
|
449
422
|
const t = x.get(e), r = b.get(e) || A, o = w.get(e);
|
|
450
|
-
if (!t || !r || !o)
|
|
451
|
-
return;
|
|
423
|
+
if (!t || !r || !o) return;
|
|
452
424
|
re(t, e);
|
|
453
425
|
const l = t.querySelector(".rte-blocks-library-title");
|
|
454
426
|
l && (l.textContent = r.labels.panelTitle);
|
|
@@ -462,8 +434,8 @@ function v(e) {
|
|
|
462
434
|
i && (i.textContent = r.labels.categoryLabel);
|
|
463
435
|
const c = t.querySelector('[data-field="category"]');
|
|
464
436
|
if (c) {
|
|
465
|
-
const
|
|
466
|
-
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;
|
|
467
439
|
}
|
|
468
440
|
const d = t.querySelector(".rte-blocks-library-helper");
|
|
469
441
|
d && (d.textContent = r.labels.helperText);
|
|
@@ -474,16 +446,16 @@ function v(e) {
|
|
|
474
446
|
const h = t.querySelector('[data-action="insert-selected"]');
|
|
475
447
|
if (h) {
|
|
476
448
|
h.textContent = r.labels.insertText;
|
|
477
|
-
const
|
|
478
|
-
h.disabled = !
|
|
449
|
+
const C = !Te(e) && !!o.selectedBlockId;
|
|
450
|
+
h.disabled = !C, h.setAttribute("aria-disabled", C ? "false" : "true");
|
|
479
451
|
}
|
|
480
|
-
const
|
|
481
|
-
|
|
452
|
+
const B = t.querySelector(".rte-blocks-library-empty"), V = t.querySelector(".rte-blocks-library-list"), H = Ae(e, r);
|
|
453
|
+
ot(e, H);
|
|
482
454
|
const Y = t.querySelector(".rte-blocks-library-status");
|
|
483
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) {
|
|
484
|
-
const
|
|
456
|
+
const C = new Set(o.recentBlockIds);
|
|
485
457
|
V.innerHTML = H.map((p) => {
|
|
486
|
-
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);
|
|
487
459
|
return `
|
|
488
460
|
<li class="rte-blocks-library-item-wrapper" role="presentation">
|
|
489
461
|
<button
|
|
@@ -497,9 +469,9 @@ function v(e) {
|
|
|
497
469
|
>
|
|
498
470
|
<span class="rte-blocks-library-item-head">
|
|
499
471
|
<span class="rte-blocks-library-item-label">${m(p.label)}</span>
|
|
500
|
-
${
|
|
472
|
+
${Pe ? `<span class="rte-blocks-library-recent-pill">${m(r.labels.recentHeading)}</span>` : ""}
|
|
501
473
|
</span>
|
|
502
|
-
<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>
|
|
503
475
|
${p.description ? `<span class="rte-blocks-library-item-description">${m(p.description)}</span>` : ""}
|
|
504
476
|
${me ? `<span class="rte-blocks-library-item-preview">${m(me)}</span>` : ""}
|
|
505
477
|
</button>
|
|
@@ -507,47 +479,44 @@ function v(e) {
|
|
|
507
479
|
`;
|
|
508
480
|
}).join("");
|
|
509
481
|
}
|
|
510
|
-
|
|
511
|
-
const
|
|
512
|
-
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)
|
|
513
485
|
if (o.lastInsertedBlockId) {
|
|
514
|
-
const
|
|
515
|
-
|
|
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;
|
|
516
488
|
} else
|
|
517
|
-
|
|
489
|
+
N.hidden = !0;
|
|
518
490
|
t.setAttribute("aria-label", r.labels.panelAriaLabel);
|
|
519
491
|
}
|
|
520
492
|
function M(e, t = !1) {
|
|
521
493
|
const r = x.get(e);
|
|
522
|
-
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)));
|
|
523
495
|
}
|
|
524
|
-
function
|
|
496
|
+
function nt(e) {
|
|
525
497
|
const t = e.querySelector(".rte-blocks-library-item.active");
|
|
526
498
|
t == null || t.focus();
|
|
527
499
|
}
|
|
528
500
|
function Le(e, t) {
|
|
529
501
|
const r = b.get(e) || A;
|
|
530
|
-
if (!r)
|
|
531
|
-
return;
|
|
502
|
+
if (!r) return;
|
|
532
503
|
const o = w.get(e);
|
|
533
|
-
if (!o)
|
|
534
|
-
return;
|
|
504
|
+
if (!o) return;
|
|
535
505
|
const l = Ae(e, r);
|
|
536
|
-
if (l.length === 0)
|
|
537
|
-
return;
|
|
506
|
+
if (l.length === 0) return;
|
|
538
507
|
const a = (Math.max(
|
|
539
508
|
0,
|
|
540
509
|
l.findIndex((i) => i.id === o.selectedBlockId)
|
|
541
510
|
) + t + l.length) % l.length;
|
|
542
511
|
o.selectedBlockId = l[a].id, v(e);
|
|
543
512
|
const s = x.get(e);
|
|
544
|
-
s &&
|
|
513
|
+
s && nt(s);
|
|
545
514
|
}
|
|
546
515
|
function ue(e) {
|
|
547
|
-
const t =
|
|
516
|
+
const t = ct(e);
|
|
548
517
|
se(e), x.forEach((o, l) => {
|
|
549
518
|
l !== e && M(l, !1);
|
|
550
|
-
}), 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);
|
|
551
520
|
const r = t.querySelector('[data-field="query"]');
|
|
552
521
|
r == null || r.focus(), be(e, !1);
|
|
553
522
|
}
|
|
@@ -557,27 +526,23 @@ function Ie(e, t) {
|
|
|
557
526
|
}
|
|
558
527
|
function Re(e) {
|
|
559
528
|
const t = window.getSelection();
|
|
560
|
-
if (!t || t.rangeCount === 0)
|
|
561
|
-
return null;
|
|
529
|
+
if (!t || t.rangeCount === 0) return null;
|
|
562
530
|
const r = t.getRangeAt(0);
|
|
563
531
|
return e.contains(r.commonAncestorContainer) ? r : null;
|
|
564
532
|
}
|
|
565
533
|
function He(e, t) {
|
|
566
|
-
if (!e.isConnected)
|
|
567
|
-
return;
|
|
534
|
+
if (!e.isConnected) return;
|
|
568
535
|
const r = window.getSelection();
|
|
569
536
|
r && (r.removeAllRanges(), r.addRange(t));
|
|
570
537
|
}
|
|
571
538
|
function ve(e, t, r) {
|
|
572
539
|
const o = t.cloneRange();
|
|
573
|
-
if (!e.contains(o.commonAncestorContainer))
|
|
574
|
-
return !1;
|
|
540
|
+
if (!e.contains(o.commonAncestorContainer)) return !1;
|
|
575
541
|
o.deleteContents();
|
|
576
542
|
const l = document.createElement("template");
|
|
577
543
|
l.innerHTML = r;
|
|
578
544
|
const n = l.content;
|
|
579
|
-
if (!n)
|
|
580
|
-
return !1;
|
|
545
|
+
if (!n) return !1;
|
|
581
546
|
const a = n.lastChild;
|
|
582
547
|
if (o.insertNode(n), a) {
|
|
583
548
|
const s = document.createRange();
|
|
@@ -585,7 +550,7 @@ function ve(e, t, r) {
|
|
|
585
550
|
}
|
|
586
551
|
return se(e), !0;
|
|
587
552
|
}
|
|
588
|
-
function
|
|
553
|
+
function lt(e, t) {
|
|
589
554
|
e.focus({ preventScroll: !0 });
|
|
590
555
|
const r = Se(e);
|
|
591
556
|
if (r && ve(e, r, t))
|
|
@@ -598,9 +563,8 @@ function nt(e, t) {
|
|
|
598
563
|
const o = Re(e);
|
|
599
564
|
return o ? ve(e, o, t) : !1;
|
|
600
565
|
}
|
|
601
|
-
function
|
|
602
|
-
if (t === e.innerHTML)
|
|
603
|
-
return;
|
|
566
|
+
function st(e, t) {
|
|
567
|
+
if (t === e.innerHTML) return;
|
|
604
568
|
const r = window.execEditorCommand || window.executeEditorCommand;
|
|
605
569
|
if (typeof r == "function")
|
|
606
570
|
try {
|
|
@@ -608,24 +572,22 @@ function lt(e, t) {
|
|
|
608
572
|
} catch (o) {
|
|
609
573
|
}
|
|
610
574
|
}
|
|
611
|
-
function
|
|
575
|
+
function at(e) {
|
|
612
576
|
e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
613
577
|
}
|
|
614
578
|
function F(e, t) {
|
|
615
579
|
const r = b.get(e) || A;
|
|
616
|
-
if (!r)
|
|
617
|
-
return !1;
|
|
580
|
+
if (!r) return !1;
|
|
618
581
|
const o = k(e, r), l = x.get(e);
|
|
619
582
|
if (Te(e))
|
|
620
583
|
return l && Ee(l, r.labels.readonlyMessage), !1;
|
|
621
584
|
const n = ae(e).find((i) => i.id === t);
|
|
622
|
-
if (!n)
|
|
623
|
-
return !1;
|
|
585
|
+
if (!n) return !1;
|
|
624
586
|
const a = e.innerHTML;
|
|
625
|
-
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(
|
|
626
588
|
0,
|
|
627
589
|
r.maxRecentBlocks
|
|
628
|
-
),
|
|
590
|
+
), st(e, a), at(e), K(e), e.dispatchEvent(
|
|
629
591
|
new CustomEvent("editora:blocks-library-insert", {
|
|
630
592
|
bubbles: !0,
|
|
631
593
|
detail: {
|
|
@@ -640,13 +602,11 @@ function ze(e) {
|
|
|
640
602
|
const t = w.get(e);
|
|
641
603
|
return t != null && t.lastInsertedBlockId ? F(e, t.lastInsertedBlockId) : !1;
|
|
642
604
|
}
|
|
643
|
-
function
|
|
605
|
+
function it(e) {
|
|
644
606
|
const t = b.get(e) || A;
|
|
645
|
-
if (!t)
|
|
646
|
-
return;
|
|
607
|
+
if (!t) return;
|
|
647
608
|
const r = w.get(e);
|
|
648
|
-
if (!r)
|
|
649
|
-
return;
|
|
609
|
+
if (!r) return;
|
|
650
610
|
Me(e);
|
|
651
611
|
const o = () => {
|
|
652
612
|
r.debounceTimer = null, r.filterCache.clear(), v(e);
|
|
@@ -657,10 +617,9 @@ function at(e) {
|
|
|
657
617
|
}
|
|
658
618
|
r.debounceTimer = window.setTimeout(o, t.debounceMs);
|
|
659
619
|
}
|
|
660
|
-
function
|
|
620
|
+
function ct(e) {
|
|
661
621
|
const t = x.get(e);
|
|
662
|
-
if (t)
|
|
663
|
-
return t;
|
|
622
|
+
if (t) return t;
|
|
664
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");
|
|
665
624
|
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 = `
|
|
666
625
|
<header class="rte-blocks-library-header">
|
|
@@ -694,20 +653,18 @@ function it(e) {
|
|
|
694
653
|
return;
|
|
695
654
|
}
|
|
696
655
|
if (h === "insert-selected") {
|
|
697
|
-
if (!o.selectedBlockId)
|
|
698
|
-
return;
|
|
656
|
+
if (!o.selectedBlockId) return;
|
|
699
657
|
F(e, o.selectedBlockId) && M(e, !0);
|
|
700
658
|
}
|
|
701
659
|
return;
|
|
702
660
|
}
|
|
703
661
|
const f = c == null ? void 0 : c.closest("[data-block-id]");
|
|
704
|
-
if (!f)
|
|
705
|
-
return;
|
|
662
|
+
if (!f) return;
|
|
706
663
|
const g = f.getAttribute("data-block-id");
|
|
707
664
|
g && (o.selectedBlockId = g, v(e), i.detail >= 2 && F(e, g) && M(e, !0));
|
|
708
665
|
}), s.addEventListener("input", (i) => {
|
|
709
666
|
const c = i.target;
|
|
710
|
-
!(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));
|
|
711
668
|
}), s.addEventListener("change", (i) => {
|
|
712
669
|
const c = i.target;
|
|
713
670
|
!(c instanceof HTMLSelectElement) || c.getAttribute("data-field") !== "category" || (o.category = ne(c.value || "all") || "all", o.filterCache.clear(), v(e));
|
|
@@ -726,13 +683,12 @@ function it(e) {
|
|
|
726
683
|
}
|
|
727
684
|
if (i.key === "Enter") {
|
|
728
685
|
const c = i.target;
|
|
729
|
-
if (!(c == null ? void 0 : c.matches('[data-field="query"], [data-field="category"], [data-block-id]')) || !o.selectedBlockId)
|
|
730
|
-
return;
|
|
686
|
+
if (!(c == null ? void 0 : c.matches('[data-field="query"], [data-field="category"], [data-block-id]')) || !o.selectedBlockId) return;
|
|
731
687
|
i.preventDefault(), F(e, o.selectedBlockId) && M(e, !0);
|
|
732
688
|
}
|
|
733
689
|
}), re(s, e), document.body.appendChild(s), x.set(e, s), U.set(e, !1), v(e), s;
|
|
734
690
|
}
|
|
735
|
-
function
|
|
691
|
+
function dt(e) {
|
|
736
692
|
const t = w.get(e);
|
|
737
693
|
return {
|
|
738
694
|
query: (t == null ? void 0 : t.query) || "",
|
|
@@ -748,8 +704,7 @@ function ct(e) {
|
|
|
748
704
|
}
|
|
749
705
|
async function be(e, t) {
|
|
750
706
|
const r = b.get(e) || A;
|
|
751
|
-
if (!r || typeof r.getBlocks != "function")
|
|
752
|
-
return;
|
|
707
|
+
if (!r || typeof r.getBlocks != "function") return;
|
|
753
708
|
const o = k(e, r), l = O.get(e) || 0;
|
|
754
709
|
if (!t && r.cacheTtlMs > 0 && Date.now() - l < r.cacheTtlMs)
|
|
755
710
|
return;
|
|
@@ -763,21 +718,19 @@ async function be(e, t) {
|
|
|
763
718
|
const i = (z.get(e) || 0) + 1;
|
|
764
719
|
z.set(e, i), o.loading = !0, o.loadError = null, v(e);
|
|
765
720
|
const c = Promise.resolve().then(async () => {
|
|
766
|
-
var
|
|
721
|
+
var B;
|
|
767
722
|
const d = {
|
|
768
723
|
editor: e,
|
|
769
724
|
editorRoot: le(e),
|
|
770
725
|
signal: s.signal
|
|
771
|
-
}, f = await ((
|
|
772
|
-
if (s.signal.aborted || z.get(e) !== i)
|
|
773
|
-
|
|
774
|
-
const g = Be(f || [], r);
|
|
726
|
+
}, f = await ((B = r.getBlocks) == null ? void 0 : B.call(r, d));
|
|
727
|
+
if (s.signal.aborted || z.get(e) !== i) return;
|
|
728
|
+
const g = Ce(f || [], r);
|
|
775
729
|
R.set(e, g), O.set(e, Date.now());
|
|
776
730
|
const h = w.get(e);
|
|
777
731
|
h && (h.loading = !1, h.loadError = null, h.filterCache.clear());
|
|
778
732
|
}).catch(() => {
|
|
779
|
-
if (s.signal.aborted || z.get(e) !== i)
|
|
780
|
-
return;
|
|
733
|
+
if (s.signal.aborted || z.get(e) !== i) return;
|
|
781
734
|
const d = w.get(e);
|
|
782
735
|
d && (d.loading = !1, d.loadError = r.labels.loadErrorText);
|
|
783
736
|
}).finally(() => {
|
|
@@ -785,27 +738,28 @@ async function be(e, t) {
|
|
|
785
738
|
});
|
|
786
739
|
return j.set(e, c), c;
|
|
787
740
|
}
|
|
788
|
-
function
|
|
789
|
-
|
|
790
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "b";
|
|
741
|
+
function qe(e) {
|
|
742
|
+
return typeof e.key == "string" ? e.key.toLowerCase() : "";
|
|
791
743
|
}
|
|
792
744
|
function ut(e) {
|
|
793
|
-
const t = e
|
|
794
|
-
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";
|
|
795
747
|
}
|
|
796
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) {
|
|
797
753
|
A = e, _ || (_ = (t) => {
|
|
798
754
|
ee();
|
|
799
755
|
const r = t.target, o = r == null ? void 0 : r.closest(L);
|
|
800
|
-
if (!o)
|
|
801
|
-
return;
|
|
756
|
+
if (!o) return;
|
|
802
757
|
const l = b.get(o) || e;
|
|
803
|
-
k(o, l), b.set(o, l), y = o,
|
|
758
|
+
k(o, l), b.set(o, l), y = o, K(o);
|
|
804
759
|
const n = x.get(o);
|
|
805
760
|
n && (re(n, o), de(o, n), v(o));
|
|
806
761
|
}, document.addEventListener("focusin", _, !0)), P || (P = (t) => {
|
|
807
|
-
if (t.defaultPrevented)
|
|
808
|
-
return;
|
|
762
|
+
if (t.defaultPrevented) return;
|
|
809
763
|
const r = `.${u} input, .${u} textarea, .${u} select`, o = t.target;
|
|
810
764
|
if (o != null && o.closest(r)) {
|
|
811
765
|
if (t.key === "Escape") {
|
|
@@ -814,36 +768,34 @@ function bt(e) {
|
|
|
814
768
|
}
|
|
815
769
|
return;
|
|
816
770
|
}
|
|
817
|
-
const l =
|
|
818
|
-
if (!l)
|
|
819
|
-
return;
|
|
771
|
+
const l = Xe(t);
|
|
772
|
+
if (!l) return;
|
|
820
773
|
const n = b.get(l) || A || e;
|
|
821
774
|
if (k(l, n), b.set(l, n), y = l, t.key === "Escape" && pe(l)) {
|
|
822
775
|
t.preventDefault(), M(l, !0);
|
|
823
776
|
return;
|
|
824
777
|
}
|
|
825
|
-
if (
|
|
778
|
+
if (ut(t)) {
|
|
826
779
|
t.preventDefault(), t.stopPropagation(), Ie(l);
|
|
827
780
|
return;
|
|
828
781
|
}
|
|
829
|
-
|
|
782
|
+
bt(t) && (t.preventDefault(), t.stopPropagation(), ze(l));
|
|
830
783
|
}, document.addEventListener("keydown", P, !0)), I || (I = () => {
|
|
831
784
|
ee(), x.forEach((t, r) => {
|
|
832
785
|
!r.isConnected || !t.isConnected || (re(t, r), de(r, t));
|
|
833
786
|
});
|
|
834
787
|
}, window.addEventListener("scroll", I, !0), window.addEventListener("resize", I)), !D && typeof MutationObserver != "undefined" && document.body && (D = new MutationObserver((t) => {
|
|
835
|
-
|
|
788
|
+
tt(t) && ee();
|
|
836
789
|
}), D.observe(document.body, {
|
|
837
790
|
childList: !0,
|
|
838
791
|
subtree: !0
|
|
839
792
|
}));
|
|
840
793
|
}
|
|
841
|
-
function
|
|
794
|
+
function gt() {
|
|
842
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;
|
|
843
796
|
}
|
|
844
|
-
function
|
|
845
|
-
if (typeof document == "undefined" || document.getElementById(he))
|
|
846
|
-
return;
|
|
797
|
+
function pt() {
|
|
798
|
+
if (typeof document == "undefined" || document.getElementById(he)) return;
|
|
847
799
|
const e = document.createElement("style");
|
|
848
800
|
e.id = he, e.textContent = `
|
|
849
801
|
.rte-toolbar-group-items.${E},
|
|
@@ -1245,9 +1197,9 @@ function gt() {
|
|
|
1245
1197
|
}
|
|
1246
1198
|
`, document.head.appendChild(e);
|
|
1247
1199
|
}
|
|
1248
|
-
const
|
|
1200
|
+
const mt = (e = {}) => {
|
|
1249
1201
|
const t = Q(e), r = /* @__PURE__ */ new Set();
|
|
1250
|
-
return
|
|
1202
|
+
return pt(), {
|
|
1251
1203
|
name: "blocksLibrary",
|
|
1252
1204
|
toolbar: [
|
|
1253
1205
|
{
|
|
@@ -1276,29 +1228,25 @@ const pt = (e = {}) => {
|
|
|
1276
1228
|
commands: {
|
|
1277
1229
|
blocksLibrary: (o, l) => {
|
|
1278
1230
|
const n = S(l, !1, !1);
|
|
1279
|
-
if (!n)
|
|
1280
|
-
return !1;
|
|
1231
|
+
if (!n) return !1;
|
|
1281
1232
|
const a = b.get(n) || t;
|
|
1282
1233
|
return k(n, a), b.set(n, a), y = n, ue(n), !0;
|
|
1283
1234
|
},
|
|
1284
1235
|
openBlocksLibraryPanel: (o, l) => {
|
|
1285
1236
|
const n = S(l, !1, !1);
|
|
1286
|
-
if (!n)
|
|
1287
|
-
return !1;
|
|
1237
|
+
if (!n) return !1;
|
|
1288
1238
|
const a = b.get(n) || t;
|
|
1289
1239
|
return k(n, a), b.set(n, a), y = n, ue(n), !0;
|
|
1290
1240
|
},
|
|
1291
1241
|
toggleBlocksLibraryPanel: (o, l) => {
|
|
1292
1242
|
const n = S(l, !1, !1);
|
|
1293
|
-
if (!n)
|
|
1294
|
-
return !1;
|
|
1243
|
+
if (!n) return !1;
|
|
1295
1244
|
const a = b.get(n) || t;
|
|
1296
1245
|
return k(n, a), b.set(n, a), y = n, Ie(n, typeof o == "boolean" ? o : void 0);
|
|
1297
1246
|
},
|
|
1298
1247
|
insertBlockSnippet: (o, l) => {
|
|
1299
1248
|
const n = S(l, !1, !1);
|
|
1300
|
-
if (!n)
|
|
1301
|
-
return !1;
|
|
1249
|
+
if (!n) return !1;
|
|
1302
1250
|
const a = b.get(n) || t;
|
|
1303
1251
|
k(n, a), b.set(n, a);
|
|
1304
1252
|
const s = typeof o == "string" ? o : o == null ? void 0 : o.id;
|
|
@@ -1306,23 +1254,20 @@ const pt = (e = {}) => {
|
|
|
1306
1254
|
},
|
|
1307
1255
|
insertLastBlockSnippet: (o, l) => {
|
|
1308
1256
|
const n = S(l, !1, !1);
|
|
1309
|
-
if (!n)
|
|
1310
|
-
return !1;
|
|
1257
|
+
if (!n) return !1;
|
|
1311
1258
|
const a = b.get(n) || t;
|
|
1312
1259
|
return k(n, a), b.set(n, a), y = n, ze(n);
|
|
1313
1260
|
},
|
|
1314
1261
|
refreshBlocksLibraryData: (o, l) => {
|
|
1315
1262
|
const n = S(l, !1, !1);
|
|
1316
|
-
if (!n)
|
|
1317
|
-
return !1;
|
|
1263
|
+
if (!n) return !1;
|
|
1318
1264
|
const a = b.get(n) || t;
|
|
1319
1265
|
return k(n, a), b.set(n, a), be(n, !0), !0;
|
|
1320
1266
|
},
|
|
1321
1267
|
setBlocksLibraryOptions: (o, l) => {
|
|
1322
1268
|
const n = S(l, !1, !1);
|
|
1323
|
-
if (!n || !o || typeof o != "object")
|
|
1324
|
-
|
|
1325
|
-
const a = b.get(n) || t, s = J.get(n) || Ge(a), i = {
|
|
1269
|
+
if (!n || !o || typeof o != "object") return !1;
|
|
1270
|
+
const a = b.get(n) || t, s = J.get(n) || Ue(a), i = {
|
|
1326
1271
|
...s,
|
|
1327
1272
|
...o,
|
|
1328
1273
|
labels: {
|
|
@@ -1336,15 +1281,14 @@ const pt = (e = {}) => {
|
|
|
1336
1281
|
}, c = Q(i), d = Array.isArray(o.blocks), f = o.getBlocks !== void 0;
|
|
1337
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()));
|
|
1338
1283
|
const g = k(n, c);
|
|
1339
|
-
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;
|
|
1340
1285
|
},
|
|
1341
1286
|
getBlocksLibraryState: (o, l) => {
|
|
1342
1287
|
const n = S(l, !1, !1);
|
|
1343
|
-
if (!n)
|
|
1344
|
-
return !1;
|
|
1288
|
+
if (!n) return !1;
|
|
1345
1289
|
const a = b.get(n) || t;
|
|
1346
1290
|
k(n, a);
|
|
1347
|
-
const s =
|
|
1291
|
+
const s = dt(n);
|
|
1348
1292
|
if (typeof o == "function")
|
|
1349
1293
|
try {
|
|
1350
1294
|
o(s);
|
|
@@ -1367,20 +1311,20 @@ const pt = (e = {}) => {
|
|
|
1367
1311
|
init: function(l) {
|
|
1368
1312
|
X += 1;
|
|
1369
1313
|
const n = this && typeof this.__pluginConfig == "object" ? { ...e, ...this.__pluginConfig } : e, a = Q(n);
|
|
1370
|
-
|
|
1314
|
+
ft(a);
|
|
1371
1315
|
const s = S(
|
|
1372
1316
|
l != null && l.editorElement ? { editorElement: l.editorElement } : void 0,
|
|
1373
1317
|
!1,
|
|
1374
1318
|
!1
|
|
1375
1319
|
);
|
|
1376
|
-
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));
|
|
1377
1321
|
},
|
|
1378
1322
|
destroy: () => {
|
|
1379
|
-
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();
|
|
1380
1324
|
}
|
|
1381
1325
|
};
|
|
1382
1326
|
};
|
|
1383
1327
|
export {
|
|
1384
|
-
|
|
1328
|
+
mt as BlocksLibraryPlugin
|
|
1385
1329
|
};
|
|
1386
|
-
//# sourceMappingURL=BlocksLibraryPlugin.native-
|
|
1330
|
+
//# sourceMappingURL=BlocksLibraryPlugin.native-5sdsXsiE.mjs.map
|