@editora/core 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/dist/{ApprovalWorkflowPlugin.native-C3jtAYjG.mjs → ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs} +136 -133
- package/dist/BlockquotePlugin.native-57_Xcjl1.mjs +212 -0
- package/dist/{BlocksLibraryPlugin.native-HMWKxWNs.mjs → BlocksLibraryPlugin.native-5sdsXsiE.mjs} +90 -87
- package/dist/{BoldPlugin.native-BAzzoqU5.mjs → BoldPlugin.native-CSh_LiIJ.mjs} +11 -7
- package/dist/CapitalizationPlugin.native-DLV4oPmB.mjs +159 -0
- package/dist/ChecklistPlugin.native-BS-kMz9O.mjs +371 -0
- package/dist/{CitationsPlugin.native-BnU0qCwR.mjs → CitationsPlugin.native-DQgoCd1B.mjs} +132 -129
- package/dist/ClearFormattingPlugin.native-DIS6AN2t.mjs +172 -0
- package/dist/CodePlugin.native-C5l1IeSS.mjs +4570 -0
- package/dist/{ContentRulesPlugin.native-nBLQ8QFZ.mjs → ContentRulesPlugin.native-vPx5nC73.mjs} +105 -102
- package/dist/{DataBindingPlugin.native-jQ1JPRTp.mjs → DataBindingPlugin.native-BoXwghTz.mjs} +49 -46
- package/dist/DirectionPlugin.native-Bl-QLFzO.mjs +153 -0
- package/dist/{DocSchemaPlugin.native-CHOge18O.mjs → DocSchemaPlugin.native-DUSVRHqT.mjs} +55 -52
- package/dist/{EmbedIframePlugin.native-DKJx2OS7.mjs → EmbedIframePlugin.native-BF_-LjTq.mjs} +287 -115
- package/dist/HeadingPlugin.native-DZdvubrQ.mjs +249 -0
- package/dist/{HistoryPlugin.native-TDnVMsEO.mjs → HistoryPlugin.native-D2wl32jV.mjs} +88 -103
- package/dist/{ItalicPlugin.native-CQjjDyUL.mjs → ItalicPlugin.native-CmnlwFHB.mjs} +15 -11
- package/dist/MathPlugin.native-NwWPHVmj.mjs +369 -0
- package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-eOsTJFpw.mjs} +204 -202
- package/dist/MergeTagPlugin.native-BzRVoD9-.mjs +580 -0
- package/dist/{PIIRedactionPlugin.native-DcsjmtV1.mjs → PIIRedactionPlugin.native-g7j4jOmm.mjs} +158 -155
- package/dist/{SlashCommandsPlugin.native-CmxvMEaE.mjs → SlashCommandsPlugin.native-BiN6ODw5.mjs} +2 -2
- package/dist/{SmartPastePlugin.native-BOKKtF07.mjs → SmartPastePlugin.native-CZAEHkyt.mjs} +127 -124
- package/dist/{SpecialCharactersPlugin.native-CZDato89.mjs → SpecialCharactersPlugin.native-DaG4b19I.mjs} +100 -76
- package/dist/{StrikethroughPlugin.native-0Be7j49s.mjs → StrikethroughPlugin.native-V0TL4F48.mjs} +12 -26
- package/dist/TemplatePlugin.native-DLjFUaPW.mjs +1150 -0
- package/dist/{TranslationWorkflowPlugin.native-Bz6jDGvj.mjs → TranslationWorkflowPlugin.native-DdF16tgT.mjs} +104 -101
- package/dist/{UnderlinePlugin.native-QpIcK4L2.mjs → UnderlinePlugin.native-DZzg23rv.mjs} +8 -4
- package/dist/editora.min.js +1 -1
- package/dist/editora.umd.js +1 -1
- package/dist/index-CPMGUZfB.js +10 -0
- package/dist/{index-DqC57IEH.mjs → index-DBoj6QfW.mjs} +17 -15
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/inlineFormatting-DJ0-NZtx.mjs +97 -0
- package/dist/plugin-loader.js +37 -37
- package/dist/webcomponent-core.js +18 -16
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +139 -62
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +50 -48
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +1174 -1071
- package/package.json +11 -5
- package/LICENSE +0 -21
- package/dist/BlockquotePlugin.native-JFmOLsxN.mjs +0 -48
- package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs +0 -79
- package/dist/ChecklistPlugin.native-nuSSEFNI.mjs +0 -309
- package/dist/ClearFormattingPlugin.native-Bq_XcTh2.mjs +0 -140
- package/dist/CodePlugin.native-DlpTPdkd.mjs +0 -2691
- package/dist/DirectionPlugin.native-CDnbdNyl.mjs +0 -130
- package/dist/HeadingPlugin.native-DrLYwQnQ.mjs +0 -64
- package/dist/MathPlugin.native-f_mDp8VL.mjs +0 -292
- package/dist/MergeTagPlugin.native-C3eOfEgw.mjs +0 -559
- package/dist/TemplatePlugin.native-CrpfKRJ8.mjs +0 -602
- package/dist/index-D1LOqg5C.js +0 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const v = ".rte-content, .editora-content", ee = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor",
|
|
1
|
+
const v = ".rte-content, .editora-content", ee = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", le = "__editoraCommandEditorRoot", ie = "rte-smart-paste-styles", u = "rte-smart-paste-panel", x = "smart-paste", E = "smartPaste", k = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', ke = typeof NodeFilter != "undefined" ? NodeFilter.SHOW_COMMENT : 128, ce = "__editoraSmartPasteHandled", Ce = /* @__PURE__ */ new Set([
|
|
2
2
|
"script",
|
|
3
3
|
"style",
|
|
4
4
|
"meta",
|
|
@@ -15,7 +15,7 @@ const v = ".rte-content, .editora-content", ee = "[data-editora-editor], .rte-ed
|
|
|
15
15
|
"textarea",
|
|
16
16
|
"select",
|
|
17
17
|
"option"
|
|
18
|
-
]),
|
|
18
|
+
]), Te = /* @__PURE__ */ new Set(["table", "thead", "tbody", "tfoot", "tr", "td", "th", "colgroup", "col"]), Ae = /* @__PURE__ */ new Set(["span", "font"]), Pe = /^(https?:|mailto:|tel:|#|\/)/i, Le = /^data:image\/(?:png|gif|jpeg|jpg|webp);base64,/i, we = /* @__PURE__ */ new Set([
|
|
19
19
|
"color",
|
|
20
20
|
"background-color",
|
|
21
21
|
"font-weight",
|
|
@@ -47,7 +47,7 @@ const v = ".rte-content, .editora-content", ee = "[data-editora-editor], .rte-ed
|
|
|
47
47
|
"border-width",
|
|
48
48
|
"border-style",
|
|
49
49
|
"list-style-type"
|
|
50
|
-
]),
|
|
50
|
+
]), $e = {
|
|
51
51
|
panelTitle: "Smart Paste",
|
|
52
52
|
panelAriaLabel: "Smart paste panel",
|
|
53
53
|
enabledText: "Smart paste is enabled",
|
|
@@ -88,11 +88,11 @@ const v = ".rte-content, .editora-content", ee = "[data-editora-editor], .rte-ed
|
|
|
88
88
|
preserveTables: !1
|
|
89
89
|
}
|
|
90
90
|
}, d = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new Set();
|
|
91
|
-
let W = 0,
|
|
91
|
+
let W = 0, Me = 0, O = null, b = null, L = null, w = null, A = null, $ = null;
|
|
92
92
|
function X(e) {
|
|
93
93
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function Oe(e) {
|
|
96
96
|
return e.replace(/\u00A0/g, " ").replace(/\r\n?/g, `
|
|
97
97
|
`);
|
|
98
98
|
}
|
|
@@ -118,10 +118,10 @@ function V(e = {}) {
|
|
|
118
118
|
removeComments: e.removeComments !== !1,
|
|
119
119
|
normalizeWhitespace: e.normalizeWhitespace !== !1,
|
|
120
120
|
labels: {
|
|
121
|
-
|
|
121
|
+
...$e,
|
|
122
122
|
...e.labels || {}
|
|
123
123
|
},
|
|
124
|
-
normalizeText: e.normalizeText ||
|
|
124
|
+
normalizeText: e.normalizeText || Oe,
|
|
125
125
|
profileOptions: {
|
|
126
126
|
fidelity: Z(t.fidelity, Y.fidelity),
|
|
127
127
|
balanced: Z(t.balanced, Y.balanced),
|
|
@@ -129,7 +129,7 @@ function V(e = {}) {
|
|
|
129
129
|
}
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function de(e) {
|
|
133
133
|
return {
|
|
134
134
|
enabled: e.enabled,
|
|
135
135
|
defaultProfile: e.defaultProfile,
|
|
@@ -154,11 +154,11 @@ function D(e) {
|
|
|
154
154
|
const t = e.querySelector(v);
|
|
155
155
|
return t instanceof HTMLElement ? t : null;
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function Re() {
|
|
158
158
|
if (typeof window == "undefined") return null;
|
|
159
|
-
const e = window[
|
|
159
|
+
const e = window[le];
|
|
160
160
|
if (!(e instanceof HTMLElement)) return null;
|
|
161
|
-
window[
|
|
161
|
+
window[le] = null;
|
|
162
162
|
const t = D(e);
|
|
163
163
|
if (t) return t;
|
|
164
164
|
const a = e.closest(ee);
|
|
@@ -169,7 +169,7 @@ function Oe() {
|
|
|
169
169
|
const r = e.closest(v);
|
|
170
170
|
return r instanceof HTMLElement ? r : null;
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function ze(e) {
|
|
173
173
|
const t = e.closest("[data-editora-editor]");
|
|
174
174
|
if (t && D(t) === e)
|
|
175
175
|
return t;
|
|
@@ -181,7 +181,7 @@ function Re(e) {
|
|
|
181
181
|
}
|
|
182
182
|
return te(e);
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function me(e) {
|
|
185
185
|
return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
|
|
186
186
|
}
|
|
187
187
|
function T(e, t = !0, a = !0) {
|
|
@@ -190,11 +190,11 @@ function T(e, t = !0, a = !0) {
|
|
|
190
190
|
const s = D(e.editorElement);
|
|
191
191
|
if (s) return s;
|
|
192
192
|
}
|
|
193
|
-
const r =
|
|
193
|
+
const r = Re();
|
|
194
194
|
if (r) return r;
|
|
195
195
|
const n = window.getSelection();
|
|
196
196
|
if (n && n.rangeCount > 0) {
|
|
197
|
-
const s =
|
|
197
|
+
const s = me(n.getRangeAt(0).startContainer), l = s == null ? void 0 : s.closest(v);
|
|
198
198
|
if (l) return l;
|
|
199
199
|
}
|
|
200
200
|
const o = document.activeElement;
|
|
@@ -209,7 +209,7 @@ function T(e, t = !0, a = !0) {
|
|
|
209
209
|
}
|
|
210
210
|
return t ? document.querySelector(v) : null;
|
|
211
211
|
}
|
|
212
|
-
function
|
|
212
|
+
function _e(e) {
|
|
213
213
|
const t = e.target;
|
|
214
214
|
if (t) {
|
|
215
215
|
const r = t.closest(v);
|
|
@@ -217,28 +217,28 @@ function ze(e) {
|
|
|
217
217
|
}
|
|
218
218
|
const a = window.getSelection();
|
|
219
219
|
if (a && a.rangeCount > 0) {
|
|
220
|
-
const r =
|
|
220
|
+
const r = me(a.getRangeAt(0).startContainer), n = r == null ? void 0 : r.closest(v);
|
|
221
221
|
if (n) return n;
|
|
222
222
|
}
|
|
223
223
|
return null;
|
|
224
224
|
}
|
|
225
|
-
function
|
|
225
|
+
function K(e) {
|
|
226
226
|
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;
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function He(e) {
|
|
229
229
|
const t = te(e);
|
|
230
|
-
if (
|
|
230
|
+
if (K(t)) return !0;
|
|
231
231
|
const a = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
232
|
-
return
|
|
232
|
+
return K(a) ? !0 : K(document.documentElement) || K(document.body);
|
|
233
233
|
}
|
|
234
234
|
function G(e, t) {
|
|
235
|
-
e.classList.remove("rte-smart-paste-theme-dark"),
|
|
235
|
+
e.classList.remove("rte-smart-paste-theme-dark"), He(t) && e.classList.add("rte-smart-paste-theme-dark");
|
|
236
236
|
}
|
|
237
|
-
function
|
|
237
|
+
function ue(e) {
|
|
238
238
|
return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
|
|
239
239
|
}
|
|
240
240
|
function N(e, t, a) {
|
|
241
|
-
const r =
|
|
241
|
+
const r = ze(e);
|
|
242
242
|
Array.from(
|
|
243
243
|
r.querySelectorAll(
|
|
244
244
|
`.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`
|
|
@@ -254,22 +254,22 @@ function m(e, t) {
|
|
|
254
254
|
enabled: t.enabled,
|
|
255
255
|
profile: t.defaultProfile,
|
|
256
256
|
lastReport: null
|
|
257
|
-
}, M.set(e, a)),
|
|
257
|
+
}, M.set(e, a)), et(e), _.add(e), a;
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function be(e) {
|
|
260
260
|
const t = F.get(e);
|
|
261
261
|
t && (e.removeEventListener("paste", t, !0), F.delete(e));
|
|
262
262
|
}
|
|
263
|
-
function
|
|
263
|
+
function ge(e) {
|
|
264
264
|
var t;
|
|
265
|
-
|
|
265
|
+
be(e), (t = h.get(e)) == null || t.remove(), h.delete(e), I.delete(e), d.delete(e), M.delete(e), _.delete(e), b === e && (b = null);
|
|
266
266
|
}
|
|
267
267
|
function j() {
|
|
268
268
|
Array.from(_).forEach((t) => {
|
|
269
|
-
t.isConnected ||
|
|
269
|
+
t.isConnected || ge(t);
|
|
270
270
|
});
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function De(e) {
|
|
273
273
|
var t, a, r, n;
|
|
274
274
|
for (let o = 0; o < e.length; o += 1) {
|
|
275
275
|
const s = e[o];
|
|
@@ -299,19 +299,19 @@ function J(e, t) {
|
|
|
299
299
|
|
|
300
300
|
`).trim() : a;
|
|
301
301
|
}
|
|
302
|
-
function
|
|
302
|
+
function Ne(e) {
|
|
303
303
|
return /class=["'][^"']*Mso|xmlns:w=|urn:schemas-microsoft-com:office|<o:p\b/i.test(e);
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function qe(e) {
|
|
306
306
|
return /id=["']docs-internal-guid|docs-\w+|data-sheets-value|data-sheets-userformat/i.test(e);
|
|
307
307
|
}
|
|
308
|
-
function
|
|
309
|
-
return e ?
|
|
308
|
+
function Ie(e, t) {
|
|
309
|
+
return e ? Ne(e) ? "word" : qe(e) ? "google-docs" : "html" : t ? "plain" : "html";
|
|
310
310
|
}
|
|
311
|
-
function
|
|
311
|
+
function We(e) {
|
|
312
312
|
return e.split(/\s+/).map((a) => a.trim()).filter(Boolean).filter((a) => !/^mso/i.test(a)).filter((a) => !/^docs-/i.test(a)).filter((a) => !/^c\d+$/i.test(a)).join(" ");
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function Ke(e) {
|
|
315
315
|
if (!e) return { value: "", changed: !1 };
|
|
316
316
|
const t = e.split(";"), a = [];
|
|
317
317
|
let r = !1;
|
|
@@ -326,7 +326,7 @@ function We(e) {
|
|
|
326
326
|
r = !0;
|
|
327
327
|
return;
|
|
328
328
|
}
|
|
329
|
-
if (!
|
|
329
|
+
if (!we.has(s)) {
|
|
330
330
|
r = !0;
|
|
331
331
|
return;
|
|
332
332
|
}
|
|
@@ -340,11 +340,11 @@ function We(e) {
|
|
|
340
340
|
changed: r
|
|
341
341
|
};
|
|
342
342
|
}
|
|
343
|
-
function
|
|
343
|
+
function fe(e) {
|
|
344
344
|
const t = e.trim();
|
|
345
|
-
return t && (
|
|
345
|
+
return t && (Pe.test(t) || Le.test(t)) ? t : "";
|
|
346
346
|
}
|
|
347
|
-
function
|
|
347
|
+
function pe(e) {
|
|
348
348
|
const t = e.parentNode;
|
|
349
349
|
if (t) {
|
|
350
350
|
for (; e.firstChild; )
|
|
@@ -354,11 +354,11 @@ function fe(e) {
|
|
|
354
354
|
}
|
|
355
355
|
function Be(e, t, a, r) {
|
|
356
356
|
const n = e.tagName.toLowerCase();
|
|
357
|
-
if (
|
|
357
|
+
if (Ce.has(n)) {
|
|
358
358
|
r.removedElements += 1, e.remove();
|
|
359
359
|
return;
|
|
360
360
|
}
|
|
361
|
-
if (!t.preserveTables &&
|
|
361
|
+
if (!t.preserveTables && Te.has(n)) {
|
|
362
362
|
const s = e.textContent || "", l = document.createTextNode(s);
|
|
363
363
|
e.replaceWith(l), r.removedElements += 1;
|
|
364
364
|
return;
|
|
@@ -374,7 +374,7 @@ function Be(e, t, a, r) {
|
|
|
374
374
|
e.removeAttribute(s.name), r.removedAttributes += 1;
|
|
375
375
|
return;
|
|
376
376
|
}
|
|
377
|
-
const i =
|
|
377
|
+
const i = Ke(c);
|
|
378
378
|
if (!i.value) {
|
|
379
379
|
e.removeAttribute(s.name), r.removedAttributes += 1, i.changed && (r.normalizedStyles += 1);
|
|
380
380
|
return;
|
|
@@ -387,7 +387,7 @@ function Be(e, t, a, r) {
|
|
|
387
387
|
e.removeAttribute(s.name), r.removedAttributes += 1;
|
|
388
388
|
return;
|
|
389
389
|
}
|
|
390
|
-
const i =
|
|
390
|
+
const i = We(c);
|
|
391
391
|
if (!i) {
|
|
392
392
|
e.removeAttribute(s.name), r.removedAttributes += 1;
|
|
393
393
|
return;
|
|
@@ -408,7 +408,7 @@ function Be(e, t, a, r) {
|
|
|
408
408
|
return;
|
|
409
409
|
}
|
|
410
410
|
if (l === "href" || l === "src" || l === "xlink:href") {
|
|
411
|
-
const i =
|
|
411
|
+
const i = fe(c);
|
|
412
412
|
if (!i) {
|
|
413
413
|
e.removeAttribute(s.name), r.removedAttributes += 1;
|
|
414
414
|
return;
|
|
@@ -417,28 +417,28 @@ function Be(e, t, a, r) {
|
|
|
417
417
|
}
|
|
418
418
|
}), n === "a") {
|
|
419
419
|
if (!e.getAttribute("href")) {
|
|
420
|
-
|
|
420
|
+
pe(e), r.removedElements += 1;
|
|
421
421
|
return;
|
|
422
422
|
}
|
|
423
423
|
e.getAttribute("target") === "_blank" && e.setAttribute("rel", "noopener noreferrer");
|
|
424
424
|
}
|
|
425
425
|
if (n === "img") {
|
|
426
426
|
const s = e.getAttribute("src");
|
|
427
|
-
if (!s || !
|
|
427
|
+
if (!s || !fe(s)) {
|
|
428
428
|
r.removedElements += 1, e.remove();
|
|
429
429
|
return;
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
|
-
if (
|
|
432
|
+
if (Ae.has(n) && !e.attributes.length && !e.className && !e.style.cssText) {
|
|
433
433
|
const s = e.children.length > 0, l = (e.textContent || "").trim().length > 0;
|
|
434
434
|
if (!s && !l) {
|
|
435
435
|
e.remove(), r.removedElements += 1;
|
|
436
436
|
return;
|
|
437
437
|
}
|
|
438
|
-
!s && l && (
|
|
438
|
+
!s && l && (pe(e), r.removedElements += 1);
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
|
-
function
|
|
441
|
+
function Ve(e, t, a, r, n) {
|
|
442
442
|
const o = document.createElement("template");
|
|
443
443
|
o.innerHTML = e;
|
|
444
444
|
const s = {
|
|
@@ -449,7 +449,7 @@ function Ke(e, t, a, r, n) {
|
|
|
449
449
|
};
|
|
450
450
|
if (r.removeComments)
|
|
451
451
|
try {
|
|
452
|
-
const f = document.createTreeWalker(o.content,
|
|
452
|
+
const f = document.createTreeWalker(o.content, ke, null), p = [];
|
|
453
453
|
let y = f.nextNode();
|
|
454
454
|
for (; y; )
|
|
455
455
|
p.push(y), y = f.nextNode();
|
|
@@ -470,25 +470,25 @@ function Ke(e, t, a, r, n) {
|
|
|
470
470
|
counters: s
|
|
471
471
|
};
|
|
472
472
|
}
|
|
473
|
-
function
|
|
473
|
+
function he(e) {
|
|
474
474
|
const t = window.getSelection();
|
|
475
475
|
if (!t || t.rangeCount === 0) return null;
|
|
476
476
|
const a = t.getRangeAt(0);
|
|
477
477
|
return e.contains(a.commonAncestorContainer) ? a : null;
|
|
478
478
|
}
|
|
479
|
-
function
|
|
479
|
+
function ye(e, t) {
|
|
480
480
|
if (!e.isConnected) return;
|
|
481
481
|
const a = window.getSelection();
|
|
482
482
|
a && (a.removeAllRanges(), a.addRange(t));
|
|
483
483
|
}
|
|
484
|
-
function
|
|
484
|
+
function je(e, t) {
|
|
485
485
|
e.focus({ preventScroll: !0 });
|
|
486
486
|
try {
|
|
487
487
|
if (document.execCommand("insertHTML", !1, t))
|
|
488
488
|
return !0;
|
|
489
489
|
} catch (s) {
|
|
490
490
|
}
|
|
491
|
-
const a =
|
|
491
|
+
const a = he(e);
|
|
492
492
|
if (!a) return !1;
|
|
493
493
|
a.deleteContents();
|
|
494
494
|
const r = document.createElement("template");
|
|
@@ -496,26 +496,26 @@ function Ve(e, t) {
|
|
|
496
496
|
const n = r.content, o = n.lastChild;
|
|
497
497
|
if (a.insertNode(n), o) {
|
|
498
498
|
const s = document.createRange();
|
|
499
|
-
s.setStartAfter(o), s.collapse(!0),
|
|
499
|
+
s.setStartAfter(o), s.collapse(!0), ye(e, s);
|
|
500
500
|
}
|
|
501
501
|
return !0;
|
|
502
502
|
}
|
|
503
|
-
function
|
|
503
|
+
function Fe(e, t) {
|
|
504
504
|
e.focus({ preventScroll: !0 });
|
|
505
505
|
try {
|
|
506
506
|
if (document.execCommand("insertText", !1, t))
|
|
507
507
|
return !0;
|
|
508
508
|
} catch (o) {
|
|
509
509
|
}
|
|
510
|
-
const a =
|
|
510
|
+
const a = he(e);
|
|
511
511
|
if (!a) return !1;
|
|
512
512
|
a.deleteContents();
|
|
513
513
|
const r = document.createTextNode(t);
|
|
514
514
|
a.insertNode(r);
|
|
515
515
|
const n = document.createRange();
|
|
516
|
-
return n.setStart(r, r.length), n.collapse(!0),
|
|
516
|
+
return n.setStart(r, r.length), n.collapse(!0), ye(e, n), !0;
|
|
517
517
|
}
|
|
518
|
-
function
|
|
518
|
+
function Ge(e, t) {
|
|
519
519
|
if (t === e.innerHTML) return;
|
|
520
520
|
const a = window.execEditorCommand || window.executeEditorCommand;
|
|
521
521
|
if (typeof a == "function")
|
|
@@ -524,10 +524,10 @@ function Fe(e, t) {
|
|
|
524
524
|
} catch (r) {
|
|
525
525
|
}
|
|
526
526
|
}
|
|
527
|
-
function
|
|
527
|
+
function Ue(e) {
|
|
528
528
|
e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
529
529
|
}
|
|
530
|
-
function
|
|
530
|
+
function B(e, t, a, r, n, o) {
|
|
531
531
|
return {
|
|
532
532
|
source: e,
|
|
533
533
|
profile: t,
|
|
@@ -541,14 +541,14 @@ function K(e, t, a, r, n, o) {
|
|
|
541
541
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
542
542
|
};
|
|
543
543
|
}
|
|
544
|
-
function
|
|
545
|
-
const n =
|
|
544
|
+
function Ye(e, t, a, r) {
|
|
545
|
+
const n = Ie(e, t);
|
|
546
546
|
if (a === "plain") {
|
|
547
547
|
const l = t || e.replace(/<[^>]*>/g, " "), c = J(l, r);
|
|
548
548
|
return {
|
|
549
549
|
mode: "text",
|
|
550
550
|
value: c,
|
|
551
|
-
report:
|
|
551
|
+
report: B(
|
|
552
552
|
n,
|
|
553
553
|
a,
|
|
554
554
|
e.length,
|
|
@@ -568,7 +568,7 @@ function Ue(e, t, a, r) {
|
|
|
568
568
|
return {
|
|
569
569
|
mode: "text",
|
|
570
570
|
value: l,
|
|
571
|
-
report:
|
|
571
|
+
report: B(
|
|
572
572
|
n,
|
|
573
573
|
a,
|
|
574
574
|
e.length,
|
|
@@ -583,19 +583,19 @@ function Ue(e, t, a, r) {
|
|
|
583
583
|
)
|
|
584
584
|
};
|
|
585
585
|
}
|
|
586
|
-
const o = r.profileOptions[a], s =
|
|
586
|
+
const o = r.profileOptions[a], s = Ve(e, o, n, r, a);
|
|
587
587
|
if (!s.html) {
|
|
588
588
|
const l = J(t || e.replace(/<[^>]*>/g, " "), r);
|
|
589
589
|
return {
|
|
590
590
|
mode: "text",
|
|
591
591
|
value: l,
|
|
592
|
-
report:
|
|
592
|
+
report: B(n, a, e.length, 0, l.length, s.counters)
|
|
593
593
|
};
|
|
594
594
|
}
|
|
595
595
|
return {
|
|
596
596
|
mode: "html",
|
|
597
597
|
value: s.html,
|
|
598
|
-
report:
|
|
598
|
+
report: B(
|
|
599
599
|
n,
|
|
600
600
|
a,
|
|
601
601
|
e.length,
|
|
@@ -611,7 +611,7 @@ function U(e, t) {
|
|
|
611
611
|
function ae(e) {
|
|
612
612
|
return e === "fidelity" ? "balanced" : e === "balanced" ? "plain" : "fidelity";
|
|
613
613
|
}
|
|
614
|
-
function
|
|
614
|
+
function Xe(e, t) {
|
|
615
615
|
e.setAttribute("aria-label", t.labels.panelAriaLabel);
|
|
616
616
|
const a = e.querySelector(".rte-smart-paste-title");
|
|
617
617
|
a && (a.textContent = t.labels.panelTitle);
|
|
@@ -619,8 +619,8 @@ function Ye(e, t) {
|
|
|
619
619
|
r && r.setAttribute("aria-label", t.labels.closeText);
|
|
620
620
|
const n = e.querySelector('[data-action="toggle-enabled"]');
|
|
621
621
|
if (n) {
|
|
622
|
-
const
|
|
623
|
-
n.textContent =
|
|
622
|
+
const Ee = n.getAttribute("data-enabled") === "true";
|
|
623
|
+
n.textContent = Ee ? t.labels.toggleOnText : t.labels.toggleOffText;
|
|
624
624
|
}
|
|
625
625
|
const o = e.querySelector('[data-action="cycle-profile"]');
|
|
626
626
|
o && (o.textContent = t.labels.cycleProfileText);
|
|
@@ -644,15 +644,15 @@ function Ye(e, t) {
|
|
|
644
644
|
P && (P.textContent = t.labels.lastPasteProfileLabel);
|
|
645
645
|
const C = e.querySelector('[data-key="removed-label"]');
|
|
646
646
|
C && (C.textContent = t.labels.lastPasteRemovedLabel);
|
|
647
|
-
const
|
|
648
|
-
|
|
649
|
-
const
|
|
650
|
-
|
|
647
|
+
const ne = e.querySelector('[data-key="chars-label"]');
|
|
648
|
+
ne && (ne.textContent = t.labels.lastPasteCharsLabel);
|
|
649
|
+
const se = e.querySelector(".rte-smart-paste-shortcut");
|
|
650
|
+
se && (se.textContent = t.labels.shortcutText);
|
|
651
651
|
}
|
|
652
652
|
function S(e) {
|
|
653
653
|
const t = h.get(e), a = d.get(e) || O, r = M.get(e);
|
|
654
654
|
if (!t || !a || !r) return;
|
|
655
|
-
|
|
655
|
+
Xe(t, a);
|
|
656
656
|
const n = t.querySelector(".rte-smart-paste-status");
|
|
657
657
|
n && (n.textContent = r.enabled ? a.labels.enabledText : a.labels.disabledText);
|
|
658
658
|
const o = t.querySelector('[data-action="toggle-enabled"]');
|
|
@@ -682,10 +682,10 @@ function q(e, t = !1) {
|
|
|
682
682
|
const a = h.get(e);
|
|
683
683
|
a && (a.classList.remove("show"), I.set(e, !1), N(e, "toggleSmartPastePanel", !1), t && e.focus({ preventScroll: !0 }));
|
|
684
684
|
}
|
|
685
|
-
function
|
|
685
|
+
function Ze(e) {
|
|
686
686
|
const t = h.get(e);
|
|
687
687
|
if (t) return t;
|
|
688
|
-
const a = d.get(e) || O || V(), r = `rte-smart-paste-panel-${
|
|
688
|
+
const a = d.get(e) || O || V(), r = `rte-smart-paste-panel-${Me++}`, n = document.createElement("section");
|
|
689
689
|
return n.className = u, n.id = r, n.setAttribute("role", "dialog"), n.setAttribute("aria-modal", "false"), n.setAttribute("aria-label", a.labels.panelAriaLabel), n.innerHTML = `
|
|
690
690
|
<header class="rte-smart-paste-header">
|
|
691
691
|
<h2 class="rte-smart-paste-title">${X(a.labels.panelTitle)}</h2>
|
|
@@ -758,45 +758,45 @@ function Xe(e) {
|
|
|
758
758
|
o.preventDefault(), s[i].focus();
|
|
759
759
|
}), G(n, e), document.body.appendChild(n), h.set(e, n), I.set(e, !1), S(e), n;
|
|
760
760
|
}
|
|
761
|
-
function
|
|
762
|
-
const t =
|
|
761
|
+
function xe(e) {
|
|
762
|
+
const t = Ze(e);
|
|
763
763
|
h.forEach((r, n) => {
|
|
764
764
|
n !== e && q(n, !1);
|
|
765
765
|
}), t.classList.add("show"), I.set(e, !0), N(e, "toggleSmartPastePanel", !0), G(t, e), Q(e, t);
|
|
766
766
|
const a = t.querySelector('[data-action="toggle-enabled"]');
|
|
767
767
|
a == null || a.focus();
|
|
768
768
|
}
|
|
769
|
-
function
|
|
769
|
+
function ve(e, t) {
|
|
770
770
|
const a = re(e);
|
|
771
|
-
return (typeof t == "boolean" ? t : !a) ?
|
|
771
|
+
return (typeof t == "boolean" ? t : !a) ? xe(e) : q(e, !1), !0;
|
|
772
772
|
}
|
|
773
|
-
function
|
|
773
|
+
function Se(e) {
|
|
774
774
|
return {
|
|
775
775
|
enabled: e.enabled,
|
|
776
776
|
profile: e.profile,
|
|
777
777
|
lastReport: e.lastReport ? { ...e.lastReport } : null
|
|
778
778
|
};
|
|
779
779
|
}
|
|
780
|
-
function
|
|
780
|
+
function Je(e, t) {
|
|
781
781
|
const a = d.get(e) || O;
|
|
782
782
|
if (!a) return !1;
|
|
783
783
|
const r = m(e, a);
|
|
784
|
-
if (!r.enabled ||
|
|
784
|
+
if (!r.enabled || ue(e)) {
|
|
785
785
|
const p = h.get(e);
|
|
786
|
-
return p &&
|
|
786
|
+
return p && ue(e) && R(p, a.labels.readonlyMessage), !1;
|
|
787
787
|
}
|
|
788
788
|
const n = t.clipboardData;
|
|
789
789
|
if (!n) return !1;
|
|
790
790
|
const o = n.getData("text/html") || "", s = n.getData("text/plain") || "";
|
|
791
791
|
if (!o && !s) return !1;
|
|
792
|
-
const l =
|
|
792
|
+
const l = Ye(o, s, r.profile, a);
|
|
793
793
|
if (!l.value) return !1;
|
|
794
794
|
const c = e.innerHTML;
|
|
795
|
-
if (!(l.mode === "html" ?
|
|
796
|
-
r.lastReport = { ...l.report }, M.set(e, r),
|
|
795
|
+
if (!(l.mode === "html" ? je(e, l.value) : Fe(e, l.value))) return !1;
|
|
796
|
+
r.lastReport = { ...l.report }, M.set(e, r), Ge(e, c), Ue(e), e.dispatchEvent(
|
|
797
797
|
new CustomEvent("editora:smart-paste", {
|
|
798
798
|
bubbles: !0,
|
|
799
|
-
detail:
|
|
799
|
+
detail: Se(r)
|
|
800
800
|
})
|
|
801
801
|
), S(e);
|
|
802
802
|
const f = h.get(e);
|
|
@@ -809,33 +809,36 @@ function Ze(e, t) {
|
|
|
809
809
|
}
|
|
810
810
|
return !0;
|
|
811
811
|
}
|
|
812
|
-
function
|
|
812
|
+
function Qe(e) {
|
|
813
813
|
return (t) => {
|
|
814
|
-
t.defaultPrevented || t[
|
|
814
|
+
t.defaultPrevented || t[ce] === !0 || (b = e, !Je(e, t)) || (t[ce] = !0, t.preventDefault(), typeof t.stopImmediatePropagation == "function" ? t.stopImmediatePropagation() : t.stopPropagation());
|
|
815
815
|
};
|
|
816
816
|
}
|
|
817
|
-
function
|
|
817
|
+
function et(e) {
|
|
818
818
|
if (F.has(e)) return;
|
|
819
|
-
const t =
|
|
819
|
+
const t = Qe(e);
|
|
820
820
|
e.addEventListener("paste", t, !0), F.set(e, t);
|
|
821
821
|
}
|
|
822
822
|
function z(e) {
|
|
823
823
|
const t = M.get(e);
|
|
824
824
|
N(e, "toggleSmartPastePanel", re(e)), N(e, "toggleSmartPasteEnabled", (t == null ? void 0 : t.enabled) === !0);
|
|
825
825
|
}
|
|
826
|
-
function
|
|
827
|
-
|
|
828
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "s";
|
|
826
|
+
function oe(e) {
|
|
827
|
+
return typeof e.key == "string" ? e.key.toLowerCase() : "";
|
|
829
828
|
}
|
|
830
829
|
function tt(e) {
|
|
831
|
-
const t = e
|
|
832
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "
|
|
830
|
+
const t = oe(e);
|
|
831
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "s";
|
|
833
832
|
}
|
|
834
833
|
function rt(e) {
|
|
835
|
-
const t = e
|
|
836
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "
|
|
834
|
+
const t = oe(e);
|
|
835
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "v";
|
|
837
836
|
}
|
|
838
837
|
function at(e) {
|
|
838
|
+
const t = oe(e);
|
|
839
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "g";
|
|
840
|
+
}
|
|
841
|
+
function ot(e) {
|
|
839
842
|
O = e, L || (L = (t) => {
|
|
840
843
|
j();
|
|
841
844
|
const a = t.target, r = a == null ? void 0 : a.closest(v);
|
|
@@ -848,24 +851,24 @@ function at(e) {
|
|
|
848
851
|
if (t.defaultPrevented) return;
|
|
849
852
|
const a = t.target;
|
|
850
853
|
if (a != null && a.closest(`.${u} input, .${u} textarea, .${u} select`)) return;
|
|
851
|
-
const r =
|
|
854
|
+
const r = _e(t);
|
|
852
855
|
if (!r) return;
|
|
853
856
|
const n = d.get(r) || O || e;
|
|
854
857
|
if (m(r, n), d.set(r, n), b = r, t.key === "Escape" && re(r)) {
|
|
855
858
|
t.preventDefault(), q(r, !0);
|
|
856
859
|
return;
|
|
857
860
|
}
|
|
858
|
-
if (
|
|
859
|
-
t.preventDefault(), t.stopPropagation(),
|
|
861
|
+
if (tt(t)) {
|
|
862
|
+
t.preventDefault(), t.stopPropagation(), ve(r);
|
|
860
863
|
return;
|
|
861
864
|
}
|
|
862
|
-
if (
|
|
865
|
+
if (rt(t)) {
|
|
863
866
|
t.preventDefault(), t.stopPropagation();
|
|
864
867
|
const o = m(r, n);
|
|
865
868
|
o.profile = ae(o.profile), S(r);
|
|
866
869
|
return;
|
|
867
870
|
}
|
|
868
|
-
if (
|
|
871
|
+
if (at(t)) {
|
|
869
872
|
t.preventDefault(), t.stopPropagation();
|
|
870
873
|
const o = m(r, n);
|
|
871
874
|
o.enabled = !o.enabled, z(r), S(r);
|
|
@@ -875,19 +878,19 @@ function at(e) {
|
|
|
875
878
|
!a.isConnected || !t.isConnected || (G(t, a), Q(a, t));
|
|
876
879
|
});
|
|
877
880
|
}, window.addEventListener("scroll", A, !0), window.addEventListener("resize", A)), !$ && typeof MutationObserver != "undefined" && document.body && ($ = new MutationObserver((t) => {
|
|
878
|
-
|
|
881
|
+
De(t) && j();
|
|
879
882
|
}), $.observe(document.body, {
|
|
880
883
|
childList: !0,
|
|
881
884
|
subtree: !0
|
|
882
885
|
}));
|
|
883
886
|
}
|
|
884
|
-
function ot() {
|
|
885
|
-
L && (document.removeEventListener("focusin", L, !0), L = null), w && (document.removeEventListener("keydown", w, !0), w = null), A && (window.removeEventListener("scroll", A, !0), window.removeEventListener("resize", A), A = null), $ && ($.disconnect(), $ = null), h.forEach((e) => e.remove()), h.clear(), _.forEach((e) => me(e)), _.clear(), O = null, b = null;
|
|
886
|
-
}
|
|
887
887
|
function nt() {
|
|
888
|
-
|
|
888
|
+
L && (document.removeEventListener("focusin", L, !0), L = null), w && (document.removeEventListener("keydown", w, !0), w = null), A && (window.removeEventListener("scroll", A, !0), window.removeEventListener("resize", A), A = null), $ && ($.disconnect(), $ = null), h.forEach((e) => e.remove()), h.clear(), _.forEach((e) => be(e)), _.clear(), O = null, b = null;
|
|
889
|
+
}
|
|
890
|
+
function st() {
|
|
891
|
+
if (typeof document == "undefined" || document.getElementById(ie)) return;
|
|
889
892
|
const e = document.createElement("style");
|
|
890
|
-
e.id =
|
|
893
|
+
e.id = ie, e.textContent = `
|
|
891
894
|
.rte-toolbar-group-items.${x},
|
|
892
895
|
.editora-toolbar-group-items.${x},
|
|
893
896
|
.rte-toolbar-group-items.${E},
|
|
@@ -1249,9 +1252,9 @@ function nt() {
|
|
|
1249
1252
|
}
|
|
1250
1253
|
`, document.head.appendChild(e);
|
|
1251
1254
|
}
|
|
1252
|
-
const
|
|
1255
|
+
const lt = (e = {}) => {
|
|
1253
1256
|
const t = V(e), a = /* @__PURE__ */ new Set();
|
|
1254
|
-
return
|
|
1257
|
+
return st(), {
|
|
1255
1258
|
name: "smartPaste",
|
|
1256
1259
|
toolbar: [
|
|
1257
1260
|
{
|
|
@@ -1289,13 +1292,13 @@ const st = (e = {}) => {
|
|
|
1289
1292
|
const o = T(n, !1, !1);
|
|
1290
1293
|
if (!o) return !1;
|
|
1291
1294
|
const s = d.get(o) || t;
|
|
1292
|
-
return m(o, s), d.set(o, s), b = o,
|
|
1295
|
+
return m(o, s), d.set(o, s), b = o, xe(o), !0;
|
|
1293
1296
|
},
|
|
1294
1297
|
toggleSmartPastePanel: (r, n) => {
|
|
1295
1298
|
const o = T(n, !1, !1);
|
|
1296
1299
|
if (!o) return !1;
|
|
1297
1300
|
const s = d.get(o) || t;
|
|
1298
|
-
return m(o, s), d.set(o, s), b = o,
|
|
1301
|
+
return m(o, s), d.set(o, s), b = o, ve(o, typeof r == "boolean" ? r : void 0);
|
|
1299
1302
|
},
|
|
1300
1303
|
cycleSmartPasteProfile: (r, n) => {
|
|
1301
1304
|
const o = T(n, !1, !1);
|
|
@@ -1319,7 +1322,7 @@ const st = (e = {}) => {
|
|
|
1319
1322
|
var f, p, y, g, P, C;
|
|
1320
1323
|
const o = T(n, !1, !1);
|
|
1321
1324
|
if (!o || !r || typeof r != "object") return !1;
|
|
1322
|
-
const s = d.get(o) || t, l =
|
|
1325
|
+
const s = d.get(o) || t, l = de(s), c = V({
|
|
1323
1326
|
...l,
|
|
1324
1327
|
...r,
|
|
1325
1328
|
labels: {
|
|
@@ -1351,7 +1354,7 @@ const st = (e = {}) => {
|
|
|
1351
1354
|
getSmartPasteState: (r, n) => {
|
|
1352
1355
|
const o = T(n, !1, !1);
|
|
1353
1356
|
if (!o) return !1;
|
|
1354
|
-
const s = d.get(o) || t, l = m(o, s), c =
|
|
1357
|
+
const s = d.get(o) || t, l = m(o, s), c = Se(l);
|
|
1355
1358
|
if (typeof r == "function")
|
|
1356
1359
|
try {
|
|
1357
1360
|
r(c);
|
|
@@ -1375,8 +1378,8 @@ const st = (e = {}) => {
|
|
|
1375
1378
|
},
|
|
1376
1379
|
init: function(n) {
|
|
1377
1380
|
W += 1;
|
|
1378
|
-
const o = this && typeof this.__pluginConfig == "object" ? V({ ...
|
|
1379
|
-
|
|
1381
|
+
const o = this && typeof this.__pluginConfig == "object" ? V({ ...de(t), ...this.__pluginConfig }) : t;
|
|
1382
|
+
ot(o);
|
|
1380
1383
|
const s = T(
|
|
1381
1384
|
n != null && n.editorElement ? { editorElement: n.editorElement } : void 0,
|
|
1382
1385
|
!1,
|
|
@@ -1388,11 +1391,11 @@ const st = (e = {}) => {
|
|
|
1388
1391
|
l.enabled = o.enabled, l.profile = o.defaultProfile, d.set(s, o), z(s);
|
|
1389
1392
|
},
|
|
1390
1393
|
destroy: () => {
|
|
1391
|
-
a.forEach((r) =>
|
|
1394
|
+
a.forEach((r) => ge(r)), a.clear(), W = Math.max(0, W - 1), !(W > 0) && nt();
|
|
1392
1395
|
}
|
|
1393
1396
|
};
|
|
1394
1397
|
};
|
|
1395
1398
|
export {
|
|
1396
|
-
|
|
1399
|
+
lt as SmartPastePlugin
|
|
1397
1400
|
};
|
|
1398
|
-
//# sourceMappingURL=SmartPastePlugin.native-
|
|
1401
|
+
//# sourceMappingURL=SmartPastePlugin.native-CZAEHkyt.mjs.map
|