@editora/plugins 1.0.11 → 1.0.13
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/approval-workflow.cjs.js +14 -14
- package/dist/approval-workflow.esm.js +265 -262
- package/dist/blockquote.cjs.js +1 -1
- package/dist/blockquote.esm.js +177 -15
- package/dist/blocks-library.cjs.js +6 -6
- package/dist/blocks-library.esm.js +95 -92
- package/dist/bold.cjs.js +1 -1
- package/dist/bold.esm.js +10 -6
- package/dist/capitalization.cjs.js +1 -1
- package/dist/capitalization.esm.js +124 -44
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +251 -191
- package/dist/citations.cjs.js +4 -4
- package/dist/citations.esm.js +131 -128
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/clear-formatting.esm.js +68 -36
- package/dist/code.cjs.js +121 -44
- package/dist/code.esm.js +2694 -889
- package/dist/content-rules.cjs.js +5 -5
- package/dist/content-rules.esm.js +104 -101
- package/dist/data-binding.cjs.js +3 -3
- package/dist/data-binding.esm.js +51 -48
- package/dist/direction.cjs.js +1 -1
- package/dist/direction.esm.js +97 -74
- package/dist/doc-schema.cjs.js +4 -4
- package/dist/doc-schema.esm.js +104 -101
- package/dist/embed-iframe.cjs.js +21 -4
- package/dist/embed-iframe.esm.js +279 -116
- package/dist/heading.cjs.js +1 -1
- package/dist/heading.esm.js +239 -56
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +74 -89
- package/dist/inlineFormatting-DOYOJdnD.js +1 -0
- package/dist/inlineFormatting-DuVTGXYG.mjs +95 -0
- package/dist/italic.cjs.js +1 -1
- package/dist/italic.esm.js +12 -8
- package/dist/math.cjs.js +27 -21
- package/dist/math.esm.js +218 -146
- package/dist/merge-tag.cjs.js +8 -2
- package/dist/merge-tag.esm.js +130 -111
- package/dist/pii-redaction.cjs.js +6 -6
- package/dist/pii-redaction.esm.js +169 -166
- package/dist/smart-paste.cjs.js +5 -5
- package/dist/smart-paste.esm.js +120 -117
- package/dist/special-characters.cjs.js +6 -10
- package/dist/special-characters.esm.js +97 -75
- package/dist/strikethrough.cjs.js +1 -1
- package/dist/strikethrough.esm.js +11 -25
- package/dist/translation-workflow.cjs.js +7 -7
- package/dist/translation-workflow.esm.js +103 -100
- package/dist/underline.cjs.js +1 -1
- package/dist/underline.esm.js +7 -3
- package/package.json +3 -3
package/dist/smart-paste.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const y = ".rte-content, .editora-content", ee = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor",
|
|
1
|
+
const y = ".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", h = "smart-paste", S = "smartPaste", E = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', ke = typeof NodeFilter < "u" ? NodeFilter.SHOW_COMMENT : 128, ce = "__editoraSmartPasteHandled", Ce = /* @__PURE__ */ new Set([
|
|
2
2
|
"script",
|
|
3
3
|
"style",
|
|
4
4
|
"meta",
|
|
@@ -15,7 +15,7 @@ const y = ".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, we = /^data:image\/(?:png|gif|jpeg|jpg|webp);base64,/i, Le = /* @__PURE__ */ new Set([
|
|
19
19
|
"color",
|
|
20
20
|
"background-color",
|
|
21
21
|
"font-weight",
|
|
@@ -47,7 +47,7 @@ const y = ".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 y = ".rte-content, .editora-content", ee = "[data-editora-editor], .rte-ed
|
|
|
88
88
|
preserveTables: !1
|
|
89
89
|
}
|
|
90
90
|
}, d = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new WeakMap(), z = /* @__PURE__ */ new Set();
|
|
91
|
-
let I = 0,
|
|
91
|
+
let I = 0, Me = 0, $ = null, m = null, A = null, P = null, T = null, w = 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
|
}
|
|
@@ -116,10 +116,10 @@ function K(e = {}) {
|
|
|
116
116
|
removeComments: e.removeComments !== !1,
|
|
117
117
|
normalizeWhitespace: e.normalizeWhitespace !== !1,
|
|
118
118
|
labels: {
|
|
119
|
-
|
|
119
|
+
...$e,
|
|
120
120
|
...e.labels || {}
|
|
121
121
|
},
|
|
122
|
-
normalizeText: e.normalizeText ||
|
|
122
|
+
normalizeText: e.normalizeText || Oe,
|
|
123
123
|
profileOptions: {
|
|
124
124
|
fidelity: Z(t.fidelity, Y.fidelity),
|
|
125
125
|
balanced: Z(t.balanced, Y.balanced),
|
|
@@ -127,7 +127,7 @@ function K(e = {}) {
|
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function de(e) {
|
|
131
131
|
return {
|
|
132
132
|
enabled: e.enabled,
|
|
133
133
|
defaultProfile: e.defaultProfile,
|
|
@@ -152,11 +152,11 @@ function H(e) {
|
|
|
152
152
|
const t = e.querySelector(y);
|
|
153
153
|
return t instanceof HTMLElement ? t : null;
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function Re() {
|
|
156
156
|
if (typeof window > "u") return null;
|
|
157
|
-
const e = window[
|
|
157
|
+
const e = window[le];
|
|
158
158
|
if (!(e instanceof HTMLElement)) return null;
|
|
159
|
-
window[
|
|
159
|
+
window[le] = null;
|
|
160
160
|
const t = H(e);
|
|
161
161
|
if (t) return t;
|
|
162
162
|
const a = e.closest(ee);
|
|
@@ -167,7 +167,7 @@ function Oe() {
|
|
|
167
167
|
const r = e.closest(y);
|
|
168
168
|
return r instanceof HTMLElement ? r : null;
|
|
169
169
|
}
|
|
170
|
-
function
|
|
170
|
+
function ze(e) {
|
|
171
171
|
const t = e.closest("[data-editora-editor]");
|
|
172
172
|
if (t && H(t) === e)
|
|
173
173
|
return t;
|
|
@@ -179,7 +179,7 @@ function Re(e) {
|
|
|
179
179
|
}
|
|
180
180
|
return te(e);
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function me(e) {
|
|
183
183
|
return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
|
|
184
184
|
}
|
|
185
185
|
function C(e, t = !0, a = !0) {
|
|
@@ -188,11 +188,11 @@ function C(e, t = !0, a = !0) {
|
|
|
188
188
|
const s = H(e.editorElement);
|
|
189
189
|
if (s) return s;
|
|
190
190
|
}
|
|
191
|
-
const r =
|
|
191
|
+
const r = Re();
|
|
192
192
|
if (r) return r;
|
|
193
193
|
const n = window.getSelection();
|
|
194
194
|
if (n && n.rangeCount > 0) {
|
|
195
|
-
const l =
|
|
195
|
+
const l = me(n.getRangeAt(0).startContainer)?.closest(y);
|
|
196
196
|
if (l) return l;
|
|
197
197
|
}
|
|
198
198
|
const o = document.activeElement;
|
|
@@ -207,7 +207,7 @@ function C(e, t = !0, a = !0) {
|
|
|
207
207
|
}
|
|
208
208
|
return t ? document.querySelector(y) : null;
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function _e(e) {
|
|
211
211
|
const t = e.target;
|
|
212
212
|
if (t) {
|
|
213
213
|
const r = t.closest(y);
|
|
@@ -215,7 +215,7 @@ function ze(e) {
|
|
|
215
215
|
}
|
|
216
216
|
const a = window.getSelection();
|
|
217
217
|
if (a && a.rangeCount > 0) {
|
|
218
|
-
const n =
|
|
218
|
+
const n = me(a.getRangeAt(0).startContainer)?.closest(y);
|
|
219
219
|
if (n) return n;
|
|
220
220
|
}
|
|
221
221
|
return null;
|
|
@@ -223,20 +223,20 @@ function ze(e) {
|
|
|
223
223
|
function B(e) {
|
|
224
224
|
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;
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function He(e) {
|
|
227
227
|
const t = te(e);
|
|
228
228
|
if (B(t)) return !0;
|
|
229
229
|
const a = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
230
230
|
return B(a) ? !0 : B(document.documentElement) || B(document.body);
|
|
231
231
|
}
|
|
232
232
|
function F(e, t) {
|
|
233
|
-
e.classList.remove("rte-smart-paste-theme-dark"),
|
|
233
|
+
e.classList.remove("rte-smart-paste-theme-dark"), He(t) && e.classList.add("rte-smart-paste-theme-dark");
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function ue(e) {
|
|
236
236
|
return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
|
|
237
237
|
}
|
|
238
238
|
function D(e, t, a) {
|
|
239
|
-
const r =
|
|
239
|
+
const r = ze(e);
|
|
240
240
|
Array.from(
|
|
241
241
|
r.querySelectorAll(
|
|
242
242
|
`.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`
|
|
@@ -252,21 +252,21 @@ function p(e, t) {
|
|
|
252
252
|
enabled: t.enabled,
|
|
253
253
|
profile: t.defaultProfile,
|
|
254
254
|
lastReport: null
|
|
255
|
-
}, L.set(e, a)),
|
|
255
|
+
}, L.set(e, a)), et(e), z.add(e), a;
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function be(e) {
|
|
258
258
|
const t = j.get(e);
|
|
259
259
|
t && (e.removeEventListener("paste", t, !0), j.delete(e));
|
|
260
260
|
}
|
|
261
|
-
function
|
|
262
|
-
|
|
261
|
+
function ge(e) {
|
|
262
|
+
be(e), g.get(e)?.remove(), g.delete(e), q.delete(e), d.delete(e), L.delete(e), z.delete(e), m === e && (m = null);
|
|
263
263
|
}
|
|
264
264
|
function V() {
|
|
265
265
|
Array.from(z).forEach((t) => {
|
|
266
|
-
t.isConnected ||
|
|
266
|
+
t.isConnected || ge(t);
|
|
267
267
|
});
|
|
268
268
|
}
|
|
269
|
-
function
|
|
269
|
+
function De(e) {
|
|
270
270
|
for (let t = 0; t < e.length; t += 1) {
|
|
271
271
|
const a = e[t];
|
|
272
272
|
if (!(a.type !== "childList" || a.removedNodes.length === 0))
|
|
@@ -295,19 +295,19 @@ function J(e, t) {
|
|
|
295
295
|
|
|
296
296
|
`).trim() : a;
|
|
297
297
|
}
|
|
298
|
-
function
|
|
298
|
+
function Ne(e) {
|
|
299
299
|
return /class=["'][^"']*Mso|xmlns:w=|urn:schemas-microsoft-com:office|<o:p\b/i.test(e);
|
|
300
300
|
}
|
|
301
|
-
function
|
|
301
|
+
function qe(e) {
|
|
302
302
|
return /id=["']docs-internal-guid|docs-\w+|data-sheets-value|data-sheets-userformat/i.test(e);
|
|
303
303
|
}
|
|
304
|
-
function
|
|
305
|
-
return e ?
|
|
304
|
+
function Ie(e, t) {
|
|
305
|
+
return e ? Ne(e) ? "word" : qe(e) ? "google-docs" : "html" : t ? "plain" : "html";
|
|
306
306
|
}
|
|
307
|
-
function
|
|
307
|
+
function Be(e) {
|
|
308
308
|
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(" ");
|
|
309
309
|
}
|
|
310
|
-
function
|
|
310
|
+
function We(e) {
|
|
311
311
|
if (!e) return { value: "", changed: !1 };
|
|
312
312
|
const t = e.split(";"), a = [];
|
|
313
313
|
let r = !1;
|
|
@@ -322,7 +322,7 @@ function Be(e) {
|
|
|
322
322
|
r = !0;
|
|
323
323
|
return;
|
|
324
324
|
}
|
|
325
|
-
if (!
|
|
325
|
+
if (!Le.has(s)) {
|
|
326
326
|
r = !0;
|
|
327
327
|
return;
|
|
328
328
|
}
|
|
@@ -336,11 +336,11 @@ function Be(e) {
|
|
|
336
336
|
changed: r
|
|
337
337
|
};
|
|
338
338
|
}
|
|
339
|
-
function
|
|
339
|
+
function fe(e) {
|
|
340
340
|
const t = e.trim();
|
|
341
|
-
return t && (
|
|
341
|
+
return t && (Pe.test(t) || we.test(t)) ? t : "";
|
|
342
342
|
}
|
|
343
|
-
function
|
|
343
|
+
function pe(e) {
|
|
344
344
|
const t = e.parentNode;
|
|
345
345
|
if (t) {
|
|
346
346
|
for (; e.firstChild; )
|
|
@@ -348,13 +348,13 @@ function fe(e) {
|
|
|
348
348
|
t.removeChild(e);
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function Ke(e, t, a, r) {
|
|
352
352
|
const n = e.tagName.toLowerCase();
|
|
353
|
-
if (
|
|
353
|
+
if (Ce.has(n)) {
|
|
354
354
|
r.removedElements += 1, e.remove();
|
|
355
355
|
return;
|
|
356
356
|
}
|
|
357
|
-
if (!t.preserveTables &&
|
|
357
|
+
if (!t.preserveTables && Te.has(n)) {
|
|
358
358
|
const s = e.textContent || "", l = document.createTextNode(s);
|
|
359
359
|
e.replaceWith(l), r.removedElements += 1;
|
|
360
360
|
return;
|
|
@@ -370,7 +370,7 @@ function We(e, t, a, r) {
|
|
|
370
370
|
e.removeAttribute(s.name), r.removedAttributes += 1;
|
|
371
371
|
return;
|
|
372
372
|
}
|
|
373
|
-
const c =
|
|
373
|
+
const c = We(i);
|
|
374
374
|
if (!c.value) {
|
|
375
375
|
e.removeAttribute(s.name), r.removedAttributes += 1, c.changed && (r.normalizedStyles += 1);
|
|
376
376
|
return;
|
|
@@ -383,7 +383,7 @@ function We(e, t, a, r) {
|
|
|
383
383
|
e.removeAttribute(s.name), r.removedAttributes += 1;
|
|
384
384
|
return;
|
|
385
385
|
}
|
|
386
|
-
const c =
|
|
386
|
+
const c = Be(i);
|
|
387
387
|
if (!c) {
|
|
388
388
|
e.removeAttribute(s.name), r.removedAttributes += 1;
|
|
389
389
|
return;
|
|
@@ -404,7 +404,7 @@ function We(e, t, a, r) {
|
|
|
404
404
|
return;
|
|
405
405
|
}
|
|
406
406
|
if (l === "href" || l === "src" || l === "xlink:href") {
|
|
407
|
-
const c =
|
|
407
|
+
const c = fe(i);
|
|
408
408
|
if (!c) {
|
|
409
409
|
e.removeAttribute(s.name), r.removedAttributes += 1;
|
|
410
410
|
return;
|
|
@@ -413,28 +413,28 @@ function We(e, t, a, r) {
|
|
|
413
413
|
}
|
|
414
414
|
}), n === "a") {
|
|
415
415
|
if (!e.getAttribute("href")) {
|
|
416
|
-
|
|
416
|
+
pe(e), r.removedElements += 1;
|
|
417
417
|
return;
|
|
418
418
|
}
|
|
419
419
|
e.getAttribute("target") === "_blank" && e.setAttribute("rel", "noopener noreferrer");
|
|
420
420
|
}
|
|
421
421
|
if (n === "img") {
|
|
422
422
|
const s = e.getAttribute("src");
|
|
423
|
-
if (!s || !
|
|
423
|
+
if (!s || !fe(s)) {
|
|
424
424
|
r.removedElements += 1, e.remove();
|
|
425
425
|
return;
|
|
426
426
|
}
|
|
427
427
|
}
|
|
428
|
-
if (
|
|
428
|
+
if (Ae.has(n) && !e.attributes.length && !e.className && !e.style.cssText) {
|
|
429
429
|
const s = e.children.length > 0, l = (e.textContent || "").trim().length > 0;
|
|
430
430
|
if (!s && !l) {
|
|
431
431
|
e.remove(), r.removedElements += 1;
|
|
432
432
|
return;
|
|
433
433
|
}
|
|
434
|
-
!s && l && (
|
|
434
|
+
!s && l && (pe(e), r.removedElements += 1);
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
|
-
function
|
|
437
|
+
function Ve(e, t, a, r, n) {
|
|
438
438
|
const o = document.createElement("template");
|
|
439
439
|
o.innerHTML = e;
|
|
440
440
|
const s = {
|
|
@@ -445,7 +445,7 @@ function Ke(e, t, a, r, n) {
|
|
|
445
445
|
};
|
|
446
446
|
if (r.removeComments)
|
|
447
447
|
try {
|
|
448
|
-
const f = document.createTreeWalker(o.content,
|
|
448
|
+
const f = document.createTreeWalker(o.content, ke, null), b = [];
|
|
449
449
|
let k = f.nextNode();
|
|
450
450
|
for (; k; )
|
|
451
451
|
b.push(k), k = f.nextNode();
|
|
@@ -455,7 +455,7 @@ function Ke(e, t, a, r, n) {
|
|
|
455
455
|
} catch {
|
|
456
456
|
}
|
|
457
457
|
Array.from(o.content.querySelectorAll("*")).forEach((f) => {
|
|
458
|
-
f.isConnected &&
|
|
458
|
+
f.isConnected && Ke(f, t, a, s);
|
|
459
459
|
});
|
|
460
460
|
let i = o.innerHTML;
|
|
461
461
|
r.normalizeWhitespace && n !== "fidelity" ? i = i.replace(/\s{2,}/g, " ").replace(/>\s+</g, "><").trim() : r.normalizeWhitespace && (i = i.trim());
|
|
@@ -466,25 +466,25 @@ function Ke(e, t, a, r, n) {
|
|
|
466
466
|
counters: s
|
|
467
467
|
};
|
|
468
468
|
}
|
|
469
|
-
function
|
|
469
|
+
function he(e) {
|
|
470
470
|
const t = window.getSelection();
|
|
471
471
|
if (!t || t.rangeCount === 0) return null;
|
|
472
472
|
const a = t.getRangeAt(0);
|
|
473
473
|
return e.contains(a.commonAncestorContainer) ? a : null;
|
|
474
474
|
}
|
|
475
|
-
function
|
|
475
|
+
function ye(e, t) {
|
|
476
476
|
if (!e.isConnected) return;
|
|
477
477
|
const a = window.getSelection();
|
|
478
478
|
a && (a.removeAllRanges(), a.addRange(t));
|
|
479
479
|
}
|
|
480
|
-
function
|
|
480
|
+
function je(e, t) {
|
|
481
481
|
e.focus({ preventScroll: !0 });
|
|
482
482
|
try {
|
|
483
483
|
if (document.execCommand("insertHTML", !1, t))
|
|
484
484
|
return !0;
|
|
485
485
|
} catch {
|
|
486
486
|
}
|
|
487
|
-
const a =
|
|
487
|
+
const a = he(e);
|
|
488
488
|
if (!a) return !1;
|
|
489
489
|
a.deleteContents();
|
|
490
490
|
const r = document.createElement("template");
|
|
@@ -492,26 +492,26 @@ function Ve(e, t) {
|
|
|
492
492
|
const n = r.content, o = n.lastChild;
|
|
493
493
|
if (a.insertNode(n), o) {
|
|
494
494
|
const s = document.createRange();
|
|
495
|
-
s.setStartAfter(o), s.collapse(!0),
|
|
495
|
+
s.setStartAfter(o), s.collapse(!0), ye(e, s);
|
|
496
496
|
}
|
|
497
497
|
return !0;
|
|
498
498
|
}
|
|
499
|
-
function
|
|
499
|
+
function Fe(e, t) {
|
|
500
500
|
e.focus({ preventScroll: !0 });
|
|
501
501
|
try {
|
|
502
502
|
if (document.execCommand("insertText", !1, t))
|
|
503
503
|
return !0;
|
|
504
504
|
} catch {
|
|
505
505
|
}
|
|
506
|
-
const a =
|
|
506
|
+
const a = he(e);
|
|
507
507
|
if (!a) return !1;
|
|
508
508
|
a.deleteContents();
|
|
509
509
|
const r = document.createTextNode(t);
|
|
510
510
|
a.insertNode(r);
|
|
511
511
|
const n = document.createRange();
|
|
512
|
-
return n.setStart(r, r.length), n.collapse(!0),
|
|
512
|
+
return n.setStart(r, r.length), n.collapse(!0), ye(e, n), !0;
|
|
513
513
|
}
|
|
514
|
-
function
|
|
514
|
+
function Ge(e, t) {
|
|
515
515
|
if (t === e.innerHTML) return;
|
|
516
516
|
const a = window.execEditorCommand || window.executeEditorCommand;
|
|
517
517
|
if (typeof a == "function")
|
|
@@ -520,7 +520,7 @@ function Fe(e, t) {
|
|
|
520
520
|
} catch {
|
|
521
521
|
}
|
|
522
522
|
}
|
|
523
|
-
function
|
|
523
|
+
function Ue(e) {
|
|
524
524
|
e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
525
525
|
}
|
|
526
526
|
function W(e, t, a, r, n, o) {
|
|
@@ -537,8 +537,8 @@ function W(e, t, a, r, n, o) {
|
|
|
537
537
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
538
538
|
};
|
|
539
539
|
}
|
|
540
|
-
function
|
|
541
|
-
const n =
|
|
540
|
+
function Ye(e, t, a, r) {
|
|
541
|
+
const n = Ie(e, t);
|
|
542
542
|
if (a === "plain") {
|
|
543
543
|
const l = t || e.replace(/<[^>]*>/g, " "), i = J(l, r);
|
|
544
544
|
return {
|
|
@@ -579,7 +579,7 @@ function Ue(e, t, a, r) {
|
|
|
579
579
|
)
|
|
580
580
|
};
|
|
581
581
|
}
|
|
582
|
-
const o = r.profileOptions[a], s =
|
|
582
|
+
const o = r.profileOptions[a], s = Ve(e, o, n, r, a);
|
|
583
583
|
if (!s.html) {
|
|
584
584
|
const l = J(t || e.replace(/<[^>]*>/g, " "), r);
|
|
585
585
|
return {
|
|
@@ -607,7 +607,7 @@ function G(e, t) {
|
|
|
607
607
|
function ae(e) {
|
|
608
608
|
return e === "fidelity" ? "balanced" : e === "balanced" ? "plain" : "fidelity";
|
|
609
609
|
}
|
|
610
|
-
function
|
|
610
|
+
function Xe(e, t) {
|
|
611
611
|
e.setAttribute("aria-label", t.labels.panelAriaLabel);
|
|
612
612
|
const a = e.querySelector(".rte-smart-paste-title");
|
|
613
613
|
a && (a.textContent = t.labels.panelTitle);
|
|
@@ -615,8 +615,8 @@ function Ye(e, t) {
|
|
|
615
615
|
r && r.setAttribute("aria-label", t.labels.closeText);
|
|
616
616
|
const n = e.querySelector('[data-action="toggle-enabled"]');
|
|
617
617
|
if (n) {
|
|
618
|
-
const
|
|
619
|
-
n.textContent =
|
|
618
|
+
const Ee = n.getAttribute("data-enabled") === "true";
|
|
619
|
+
n.textContent = Ee ? t.labels.toggleOnText : t.labels.toggleOffText;
|
|
620
620
|
}
|
|
621
621
|
const o = e.querySelector('[data-action="cycle-profile"]');
|
|
622
622
|
o && (o.textContent = t.labels.cycleProfileText);
|
|
@@ -640,15 +640,15 @@ function Ye(e, t) {
|
|
|
640
640
|
U && (U.textContent = t.labels.lastPasteProfileLabel);
|
|
641
641
|
const M = e.querySelector('[data-key="removed-label"]');
|
|
642
642
|
M && (M.textContent = t.labels.lastPasteRemovedLabel);
|
|
643
|
-
const
|
|
644
|
-
|
|
645
|
-
const
|
|
646
|
-
|
|
643
|
+
const ne = e.querySelector('[data-key="chars-label"]');
|
|
644
|
+
ne && (ne.textContent = t.labels.lastPasteCharsLabel);
|
|
645
|
+
const se = e.querySelector(".rte-smart-paste-shortcut");
|
|
646
|
+
se && (se.textContent = t.labels.shortcutText);
|
|
647
647
|
}
|
|
648
648
|
function x(e) {
|
|
649
649
|
const t = g.get(e), a = d.get(e) || $, r = L.get(e);
|
|
650
650
|
if (!t || !a || !r) return;
|
|
651
|
-
|
|
651
|
+
Xe(t, a);
|
|
652
652
|
const n = t.querySelector(".rte-smart-paste-status");
|
|
653
653
|
n && (n.textContent = r.enabled ? a.labels.enabledText : a.labels.disabledText);
|
|
654
654
|
const o = t.querySelector('[data-action="toggle-enabled"]');
|
|
@@ -678,10 +678,10 @@ function N(e, t = !1) {
|
|
|
678
678
|
const a = g.get(e);
|
|
679
679
|
a && (a.classList.remove("show"), q.set(e, !1), D(e, "toggleSmartPastePanel", !1), t && e.focus({ preventScroll: !0 }));
|
|
680
680
|
}
|
|
681
|
-
function
|
|
681
|
+
function Ze(e) {
|
|
682
682
|
const t = g.get(e);
|
|
683
683
|
if (t) return t;
|
|
684
|
-
const a = d.get(e) || $ || K(), r = `rte-smart-paste-panel-${
|
|
684
|
+
const a = d.get(e) || $ || K(), r = `rte-smart-paste-panel-${Me++}`, n = document.createElement("section");
|
|
685
685
|
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 = `
|
|
686
686
|
<header class="rte-smart-paste-header">
|
|
687
687
|
<h2 class="rte-smart-paste-title">${X(a.labels.panelTitle)}</h2>
|
|
@@ -754,43 +754,43 @@ function Xe(e) {
|
|
|
754
754
|
o.preventDefault(), s[c].focus();
|
|
755
755
|
}), F(n, e), document.body.appendChild(n), g.set(e, n), q.set(e, !1), x(e), n;
|
|
756
756
|
}
|
|
757
|
-
function
|
|
758
|
-
const t =
|
|
757
|
+
function xe(e) {
|
|
758
|
+
const t = Ze(e);
|
|
759
759
|
g.forEach((r, n) => {
|
|
760
760
|
n !== e && N(n, !1);
|
|
761
761
|
}), t.classList.add("show"), q.set(e, !0), D(e, "toggleSmartPastePanel", !0), F(t, e), Q(e, t), t.querySelector('[data-action="toggle-enabled"]')?.focus();
|
|
762
762
|
}
|
|
763
|
-
function
|
|
763
|
+
function ve(e, t) {
|
|
764
764
|
const a = re(e);
|
|
765
|
-
return (typeof t == "boolean" ? t : !a) ?
|
|
765
|
+
return (typeof t == "boolean" ? t : !a) ? xe(e) : N(e, !1), !0;
|
|
766
766
|
}
|
|
767
|
-
function
|
|
767
|
+
function Se(e) {
|
|
768
768
|
return {
|
|
769
769
|
enabled: e.enabled,
|
|
770
770
|
profile: e.profile,
|
|
771
771
|
lastReport: e.lastReport ? { ...e.lastReport } : null
|
|
772
772
|
};
|
|
773
773
|
}
|
|
774
|
-
function
|
|
774
|
+
function Je(e, t) {
|
|
775
775
|
const a = d.get(e) || $;
|
|
776
776
|
if (!a) return !1;
|
|
777
777
|
const r = p(e, a);
|
|
778
|
-
if (!r.enabled ||
|
|
778
|
+
if (!r.enabled || ue(e)) {
|
|
779
779
|
const b = g.get(e);
|
|
780
|
-
return b &&
|
|
780
|
+
return b && ue(e) && O(b, a.labels.readonlyMessage), !1;
|
|
781
781
|
}
|
|
782
782
|
const n = t.clipboardData;
|
|
783
783
|
if (!n) return !1;
|
|
784
784
|
const o = n.getData("text/html") || "", s = n.getData("text/plain") || "";
|
|
785
785
|
if (!o && !s) return !1;
|
|
786
|
-
const l =
|
|
786
|
+
const l = Ye(o, s, r.profile, a);
|
|
787
787
|
if (!l.value) return !1;
|
|
788
788
|
const i = e.innerHTML;
|
|
789
|
-
if (!(l.mode === "html" ?
|
|
790
|
-
r.lastReport = { ...l.report }, L.set(e, r),
|
|
789
|
+
if (!(l.mode === "html" ? je(e, l.value) : Fe(e, l.value))) return !1;
|
|
790
|
+
r.lastReport = { ...l.report }, L.set(e, r), Ge(e, i), Ue(e), e.dispatchEvent(
|
|
791
791
|
new CustomEvent("editora:smart-paste", {
|
|
792
792
|
bubbles: !0,
|
|
793
|
-
detail:
|
|
793
|
+
detail: Se(r)
|
|
794
794
|
})
|
|
795
795
|
), x(e);
|
|
796
796
|
const f = g.get(e);
|
|
@@ -803,33 +803,36 @@ function Ze(e, t) {
|
|
|
803
803
|
}
|
|
804
804
|
return !0;
|
|
805
805
|
}
|
|
806
|
-
function
|
|
806
|
+
function Qe(e) {
|
|
807
807
|
return (t) => {
|
|
808
|
-
t.defaultPrevented || t[
|
|
808
|
+
t.defaultPrevented || t[ce] === !0 || (m = e, !Je(e, t)) || (t[ce] = !0, t.preventDefault(), typeof t.stopImmediatePropagation == "function" ? t.stopImmediatePropagation() : t.stopPropagation());
|
|
809
809
|
};
|
|
810
810
|
}
|
|
811
|
-
function
|
|
811
|
+
function et(e) {
|
|
812
812
|
if (j.has(e)) return;
|
|
813
|
-
const t =
|
|
813
|
+
const t = Qe(e);
|
|
814
814
|
e.addEventListener("paste", t, !0), j.set(e, t);
|
|
815
815
|
}
|
|
816
816
|
function R(e) {
|
|
817
817
|
const t = L.get(e);
|
|
818
818
|
D(e, "toggleSmartPastePanel", re(e)), D(e, "toggleSmartPasteEnabled", t?.enabled === !0);
|
|
819
819
|
}
|
|
820
|
-
function
|
|
821
|
-
|
|
822
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "s";
|
|
820
|
+
function oe(e) {
|
|
821
|
+
return typeof e.key == "string" ? e.key.toLowerCase() : "";
|
|
823
822
|
}
|
|
824
823
|
function tt(e) {
|
|
825
|
-
const t = e
|
|
826
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "
|
|
824
|
+
const t = oe(e);
|
|
825
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "s";
|
|
827
826
|
}
|
|
828
827
|
function rt(e) {
|
|
829
|
-
const t = e
|
|
830
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "
|
|
828
|
+
const t = oe(e);
|
|
829
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "v";
|
|
831
830
|
}
|
|
832
831
|
function at(e) {
|
|
832
|
+
const t = oe(e);
|
|
833
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "g";
|
|
834
|
+
}
|
|
835
|
+
function ot(e) {
|
|
833
836
|
$ = e, A || (A = (t) => {
|
|
834
837
|
V();
|
|
835
838
|
const r = t.target?.closest(y);
|
|
@@ -840,24 +843,24 @@ function at(e) {
|
|
|
840
843
|
o && (F(o, r), Q(r, o), x(r));
|
|
841
844
|
}, document.addEventListener("focusin", A, !0)), P || (P = (t) => {
|
|
842
845
|
if (t.defaultPrevented || t.target?.closest(`.${u} input, .${u} textarea, .${u} select`)) return;
|
|
843
|
-
const r =
|
|
846
|
+
const r = _e(t);
|
|
844
847
|
if (!r) return;
|
|
845
848
|
const n = d.get(r) || $ || e;
|
|
846
849
|
if (p(r, n), d.set(r, n), m = r, t.key === "Escape" && re(r)) {
|
|
847
850
|
t.preventDefault(), N(r, !0);
|
|
848
851
|
return;
|
|
849
852
|
}
|
|
850
|
-
if (
|
|
851
|
-
t.preventDefault(), t.stopPropagation(),
|
|
853
|
+
if (tt(t)) {
|
|
854
|
+
t.preventDefault(), t.stopPropagation(), ve(r);
|
|
852
855
|
return;
|
|
853
856
|
}
|
|
854
|
-
if (
|
|
857
|
+
if (rt(t)) {
|
|
855
858
|
t.preventDefault(), t.stopPropagation();
|
|
856
859
|
const o = p(r, n);
|
|
857
860
|
o.profile = ae(o.profile), x(r);
|
|
858
861
|
return;
|
|
859
862
|
}
|
|
860
|
-
if (
|
|
863
|
+
if (at(t)) {
|
|
861
864
|
t.preventDefault(), t.stopPropagation();
|
|
862
865
|
const o = p(r, n);
|
|
863
866
|
o.enabled = !o.enabled, R(r), x(r);
|
|
@@ -867,19 +870,19 @@ function at(e) {
|
|
|
867
870
|
!a.isConnected || !t.isConnected || (F(t, a), Q(a, t));
|
|
868
871
|
});
|
|
869
872
|
}, window.addEventListener("scroll", T, !0), window.addEventListener("resize", T)), !w && typeof MutationObserver < "u" && document.body && (w = new MutationObserver((t) => {
|
|
870
|
-
|
|
873
|
+
De(t) && V();
|
|
871
874
|
}), w.observe(document.body, {
|
|
872
875
|
childList: !0,
|
|
873
876
|
subtree: !0
|
|
874
877
|
}));
|
|
875
878
|
}
|
|
876
|
-
function ot() {
|
|
877
|
-
A && (document.removeEventListener("focusin", A, !0), A = null), P && (document.removeEventListener("keydown", P, !0), P = null), T && (window.removeEventListener("scroll", T, !0), window.removeEventListener("resize", T), T = null), w && (w.disconnect(), w = null), g.forEach((e) => e.remove()), g.clear(), z.forEach((e) => me(e)), z.clear(), $ = null, m = null;
|
|
878
|
-
}
|
|
879
879
|
function nt() {
|
|
880
|
-
|
|
880
|
+
A && (document.removeEventListener("focusin", A, !0), A = null), P && (document.removeEventListener("keydown", P, !0), P = null), T && (window.removeEventListener("scroll", T, !0), window.removeEventListener("resize", T), T = null), w && (w.disconnect(), w = null), g.forEach((e) => e.remove()), g.clear(), z.forEach((e) => be(e)), z.clear(), $ = null, m = null;
|
|
881
|
+
}
|
|
882
|
+
function st() {
|
|
883
|
+
if (typeof document > "u" || document.getElementById(ie)) return;
|
|
881
884
|
const e = document.createElement("style");
|
|
882
|
-
e.id =
|
|
885
|
+
e.id = ie, e.textContent = `
|
|
883
886
|
.rte-toolbar-group-items.${h},
|
|
884
887
|
.editora-toolbar-group-items.${h},
|
|
885
888
|
.rte-toolbar-group-items.${S},
|
|
@@ -1241,9 +1244,9 @@ function nt() {
|
|
|
1241
1244
|
}
|
|
1242
1245
|
`, document.head.appendChild(e);
|
|
1243
1246
|
}
|
|
1244
|
-
const
|
|
1247
|
+
const lt = (e = {}) => {
|
|
1245
1248
|
const t = K(e), a = /* @__PURE__ */ new Set();
|
|
1246
|
-
return
|
|
1249
|
+
return st(), {
|
|
1247
1250
|
name: "smartPaste",
|
|
1248
1251
|
toolbar: [
|
|
1249
1252
|
{
|
|
@@ -1281,13 +1284,13 @@ const st = (e = {}) => {
|
|
|
1281
1284
|
const o = C(n, !1, !1);
|
|
1282
1285
|
if (!o) return !1;
|
|
1283
1286
|
const s = d.get(o) || t;
|
|
1284
|
-
return p(o, s), d.set(o, s), m = o,
|
|
1287
|
+
return p(o, s), d.set(o, s), m = o, xe(o), !0;
|
|
1285
1288
|
},
|
|
1286
1289
|
toggleSmartPastePanel: (r, n) => {
|
|
1287
1290
|
const o = C(n, !1, !1);
|
|
1288
1291
|
if (!o) return !1;
|
|
1289
1292
|
const s = d.get(o) || t;
|
|
1290
|
-
return p(o, s), d.set(o, s), m = o,
|
|
1293
|
+
return p(o, s), d.set(o, s), m = o, ve(o, typeof r == "boolean" ? r : void 0);
|
|
1291
1294
|
},
|
|
1292
1295
|
cycleSmartPasteProfile: (r, n) => {
|
|
1293
1296
|
const o = C(n, !1, !1);
|
|
@@ -1310,7 +1313,7 @@ const st = (e = {}) => {
|
|
|
1310
1313
|
setSmartPasteOptions: (r, n) => {
|
|
1311
1314
|
const o = C(n, !1, !1);
|
|
1312
1315
|
if (!o || !r || typeof r != "object") return !1;
|
|
1313
|
-
const s = d.get(o) || t, l =
|
|
1316
|
+
const s = d.get(o) || t, l = de(s), i = K({
|
|
1314
1317
|
...l,
|
|
1315
1318
|
...r,
|
|
1316
1319
|
labels: {
|
|
@@ -1342,7 +1345,7 @@ const st = (e = {}) => {
|
|
|
1342
1345
|
getSmartPasteState: (r, n) => {
|
|
1343
1346
|
const o = C(n, !1, !1);
|
|
1344
1347
|
if (!o) return !1;
|
|
1345
|
-
const s = d.get(o) || t, l = p(o, s), i =
|
|
1348
|
+
const s = d.get(o) || t, l = p(o, s), i = Se(l);
|
|
1346
1349
|
if (typeof r == "function")
|
|
1347
1350
|
try {
|
|
1348
1351
|
r(i);
|
|
@@ -1366,8 +1369,8 @@ const st = (e = {}) => {
|
|
|
1366
1369
|
},
|
|
1367
1370
|
init: function(n) {
|
|
1368
1371
|
I += 1;
|
|
1369
|
-
const o = this && typeof this.__pluginConfig == "object" ? K({ ...
|
|
1370
|
-
|
|
1372
|
+
const o = this && typeof this.__pluginConfig == "object" ? K({ ...de(t), ...this.__pluginConfig }) : t;
|
|
1373
|
+
ot(o);
|
|
1371
1374
|
const s = C(
|
|
1372
1375
|
n?.editorElement ? { editorElement: n.editorElement } : void 0,
|
|
1373
1376
|
!1,
|
|
@@ -1379,10 +1382,10 @@ const st = (e = {}) => {
|
|
|
1379
1382
|
l.enabled = o.enabled, l.profile = o.defaultProfile, d.set(s, o), R(s);
|
|
1380
1383
|
},
|
|
1381
1384
|
destroy: () => {
|
|
1382
|
-
a.forEach((r) =>
|
|
1385
|
+
a.forEach((r) => ge(r)), a.clear(), I = Math.max(0, I - 1), !(I > 0) && nt();
|
|
1383
1386
|
}
|
|
1384
1387
|
};
|
|
1385
1388
|
};
|
|
1386
1389
|
export {
|
|
1387
|
-
|
|
1390
|
+
lt as SmartPastePlugin
|
|
1388
1391
|
};
|