@editora/core 1.0.15 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-DIKuCeFw.mjs} +82 -79
- package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-DXZdK3zr.mjs} +72 -71
- package/dist/{ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs → ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs} +239 -238
- package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-H3XyYD7_.mjs} +2 -2
- package/dist/{BlocksLibraryPlugin.native-5sdsXsiE.mjs → BlocksLibraryPlugin.native-CownM6Rk.mjs} +140 -116
- package/dist/{CapitalizationPlugin.native-DLV4oPmB.mjs → CapitalizationPlugin.native-C-HRbXGh.mjs} +10 -5
- package/dist/{ChecklistPlugin.native-BS-kMz9O.mjs → ChecklistPlugin.native-NVrBUkaL.mjs} +141 -103
- package/dist/{CitationsPlugin.native-DQgoCd1B.mjs → CitationsPlugin.native-C_7wWQ-k.mjs} +441 -422
- package/dist/{ClearFormattingPlugin.native-B6ro3a1h.mjs → ClearFormattingPlugin.native-Pp0O-SBf.mjs} +24 -23
- package/dist/{CodePlugin.native-knhM8NNo.mjs → CodePlugin.native-BH-K4xmW.mjs} +474 -342
- package/dist/CodePlugin.native-hNgfXlfS.mjs +4767 -0
- package/dist/CodeSamplePlugin.native-svbAFWh_.mjs +501 -0
- package/dist/CollaborationPlugin.native-oSybCGPW.mjs +7468 -0
- package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-CLip9wAO.mjs} +233 -185
- package/dist/{ConditionalContentPlugin.native-CfhY46rU.mjs → ConditionalContentPlugin.native-Bf7XgRSW.mjs} +401 -351
- package/dist/{DataBindingPlugin.native-BoXwghTz.mjs → DataBindingPlugin.native-B7lpI_0c.mjs} +29 -28
- package/dist/{DocumentManagerPlugin.native-D1YHQ2NN.mjs → DocumentManagerPlugin.native-iFip6s4Q.mjs} +94 -45
- package/dist/{EmbedIframePlugin.native-BF_-LjTq.mjs → EmbedIframePlugin.native-BfZ_HGlV.mjs} +231 -186
- package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-D92aaOKi.mjs} +288 -76
- package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-M3cNQ0KA.mjs} +57 -50
- package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-DsLrH8eq.mjs} +41 -34
- package/dist/{FormatPainterPlugin.native-CsMrKfFU.mjs → FormatPainterPlugin.native-BhjzsiVq.mjs} +3 -2
- package/dist/{HistoryPlugin.native-D2wl32jV.mjs → HistoryPlugin.native-DPvhks6h.mjs} +36 -32
- package/dist/LinkPlugin.native-BsQXYsK6.mjs +352 -0
- package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-Bt0LANbO.mjs} +68 -35
- package/dist/{MathPlugin.native-NwWPHVmj.mjs → MathPlugin.native-Byo3WL0f.mjs} +211 -115
- package/dist/{MediaManagerPlugin.native-eOsTJFpw.mjs → MediaManagerPlugin.native-BT1NZIJS.mjs} +139 -134
- package/dist/{MentionPlugin.native-BMDlOqur.mjs → MentionPlugin.native-S_lwGZQO.mjs} +23 -18
- package/dist/{MergeTagPlugin.native-BzRVoD9-.mjs → MergeTagPlugin.native-7-6F3S1Y.mjs} +44 -43
- package/dist/{PreviewPlugin.native-WuIwOAOR.mjs → PreviewPlugin.native-CiR51jql.mjs} +31 -28
- package/dist/{SlashCommandsPlugin.native-BiN6ODw5.mjs → SlashCommandsPlugin.native-BDIIwGNs.mjs} +90 -79
- package/dist/{SmartPastePlugin.native-CZAEHkyt.mjs → SmartPastePlugin.native-BATLCds5.mjs} +89 -85
- package/dist/{SpecialCharactersPlugin.native-DaG4b19I.mjs → SpecialCharactersPlugin.native-CdZoc1GB.mjs} +73 -26
- package/dist/SpellCheckPlugin.native-Bef2oTLB.mjs +10935 -0
- package/dist/TablePlugin.native-BjIxYZ2X.mjs +772 -0
- package/dist/{TemplatePlugin.native-DLjFUaPW.mjs → TemplatePlugin.native-D6n5RUnC.mjs} +288 -262
- package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-KMZ2uzlq.mjs} +2 -2
- package/dist/{TranslationWorkflowPlugin.native-DdF16tgT.mjs → TranslationWorkflowPlugin.native-CZtG--06.mjs} +67 -65
- package/dist/{VersionDiffPlugin.native-Bvxgy--t.mjs → VersionDiffPlugin.native-Ca1fMWUJ.mjs} +42 -42
- package/dist/anchoredPopover-DJFD2oAP.mjs +116 -0
- package/dist/core.css +1 -1
- package/dist/dialogHelpers-DBf7WqYH.mjs +40 -0
- package/dist/editora.min.js +26 -24
- package/dist/editora.umd.js +26 -24
- package/dist/escapeHtml-CX8RelZ1.mjs +7 -0
- package/dist/historyHelpers-B0-4mq1E.mjs +15 -0
- package/dist/index-XsYC_KdJ.mjs +3923 -0
- package/dist/index-_eKRBZPq.js +12 -0
- package/dist/index.cjs.js +3 -3
- package/dist/index.esm.js +17 -14
- package/dist/plugin-loader.js +53 -52
- package/dist/webcomponent-core.js +2055 -476
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +96 -66
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +2223 -643
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +1564 -1198
- package/index.d.ts +32 -0
- package/package.json +10 -3
- package/dist/CodeSamplePlugin.native-CgGoH-X4.mjs +0 -384
- package/dist/LinkPlugin.native-DYCIcdTm.mjs +0 -283
- package/dist/SpellCheckPlugin.native-BZB9AewP.mjs +0 -1039
- package/dist/TablePlugin.native-DrHX-efe.mjs +0 -495
- package/dist/anchoredPopover-Bxds0VoB.mjs +0 -110
- package/dist/index-BLm1MtzH.js +0 -10
- package/dist/index-Cd9jEuZP.mjs +0 -2341
|
@@ -1,4 +1,4 @@
|
|
|
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",
|
|
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", Te = /* @__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
|
+
]), Ce = /* @__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",
|
|
@@ -87,7 +87,7 @@ const v = ".rte-content, .editora-content", ee = "[data-editora-editor], .rte-ed
|
|
|
87
87
|
keepDataAttributes: !1,
|
|
88
88
|
preserveTables: !1
|
|
89
89
|
}
|
|
90
|
-
}, d = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(),
|
|
90
|
+
}, d = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), z = /* @__PURE__ */ new Set();
|
|
91
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, "'");
|
|
@@ -148,7 +148,7 @@ function de(e) {
|
|
|
148
148
|
function te(e) {
|
|
149
149
|
return e.closest(ee) || e;
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function N(e) {
|
|
152
152
|
if (!e) return null;
|
|
153
153
|
if (e.matches(v)) return e;
|
|
154
154
|
const t = e.querySelector(v);
|
|
@@ -159,23 +159,23 @@ function Re() {
|
|
|
159
159
|
const e = window[le];
|
|
160
160
|
if (!(e instanceof HTMLElement)) return null;
|
|
161
161
|
window[le] = null;
|
|
162
|
-
const t =
|
|
162
|
+
const t = N(e);
|
|
163
163
|
if (t) return t;
|
|
164
164
|
const a = e.closest(ee);
|
|
165
165
|
if (a) {
|
|
166
|
-
const n =
|
|
166
|
+
const n = N(a);
|
|
167
167
|
if (n) return n;
|
|
168
168
|
}
|
|
169
169
|
const r = e.closest(v);
|
|
170
170
|
return r instanceof HTMLElement ? r : null;
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function _e(e) {
|
|
173
173
|
const t = e.closest("[data-editora-editor]");
|
|
174
|
-
if (t &&
|
|
174
|
+
if (t && N(t) === e)
|
|
175
175
|
return t;
|
|
176
176
|
let a = e;
|
|
177
177
|
for (; a; ) {
|
|
178
|
-
if (a.matches(ee) && (a === e ||
|
|
178
|
+
if (a.matches(ee) && (a === e || N(a) === e))
|
|
179
179
|
return a;
|
|
180
180
|
a = a.parentElement;
|
|
181
181
|
}
|
|
@@ -184,10 +184,10 @@ function ze(e) {
|
|
|
184
184
|
function me(e) {
|
|
185
185
|
return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
|
|
186
186
|
}
|
|
187
|
-
function
|
|
187
|
+
function C(e, t = !0, a = !0) {
|
|
188
188
|
if (j(), (e == null ? void 0 : e.contentElement) instanceof HTMLElement) return e.contentElement;
|
|
189
189
|
if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
|
|
190
|
-
const s =
|
|
190
|
+
const s = N(e.editorElement);
|
|
191
191
|
if (s) return s;
|
|
192
192
|
}
|
|
193
193
|
const r = Re();
|
|
@@ -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 ze(e) {
|
|
213
213
|
const t = e.target;
|
|
214
214
|
if (t) {
|
|
215
215
|
const r = t.closest(v);
|
|
@@ -237,8 +237,8 @@ function G(e, t) {
|
|
|
237
237
|
function ue(e) {
|
|
238
238
|
return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
|
|
239
239
|
}
|
|
240
|
-
function
|
|
241
|
-
const r =
|
|
240
|
+
function D(e, t, a) {
|
|
241
|
+
const r = _e(e);
|
|
242
242
|
Array.from(
|
|
243
243
|
r.querySelectorAll(
|
|
244
244
|
`.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`
|
|
@@ -254,7 +254,7 @@ 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)), rt(e), z.add(e), a;
|
|
258
258
|
}
|
|
259
259
|
function be(e) {
|
|
260
260
|
const t = F.get(e);
|
|
@@ -262,14 +262,14 @@ function be(e) {
|
|
|
262
262
|
}
|
|
263
263
|
function ge(e) {
|
|
264
264
|
var t;
|
|
265
|
-
be(e), (t = h.get(e)) == null || t.remove(), h.delete(e), I.delete(e), d.delete(e), M.delete(e),
|
|
265
|
+
be(e), (t = h.get(e)) == null || t.remove(), h.delete(e), I.delete(e), d.delete(e), M.delete(e), z.delete(e), b === e && (b = null);
|
|
266
266
|
}
|
|
267
267
|
function j() {
|
|
268
|
-
Array.from(
|
|
268
|
+
Array.from(z).forEach((t) => {
|
|
269
269
|
t.isConnected || ge(t);
|
|
270
270
|
});
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function Ne(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,14 +299,14 @@ function J(e, t) {
|
|
|
299
299
|
|
|
300
300
|
`).trim() : a;
|
|
301
301
|
}
|
|
302
|
-
function
|
|
302
|
+
function De(e) {
|
|
303
303
|
return /class=["'][^"']*Mso|xmlns:w=|urn:schemas-microsoft-com:office|<o:p\b/i.test(e);
|
|
304
304
|
}
|
|
305
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
308
|
function Ie(e, t) {
|
|
309
|
-
return e ?
|
|
309
|
+
return e ? De(e) ? "word" : qe(e) ? "google-docs" : "html" : t ? "plain" : "html";
|
|
310
310
|
}
|
|
311
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(" ");
|
|
@@ -354,11 +354,11 @@ function pe(e) {
|
|
|
354
354
|
}
|
|
355
355
|
function Be(e, t, a, r) {
|
|
356
356
|
const n = e.tagName.toLowerCase();
|
|
357
|
-
if (
|
|
357
|
+
if (Te.has(n)) {
|
|
358
358
|
r.removedElements += 1, e.remove();
|
|
359
359
|
return;
|
|
360
360
|
}
|
|
361
|
-
if (!t.preserveTables &&
|
|
361
|
+
if (!t.preserveTables && Ce.has(n)) {
|
|
362
362
|
const s = e.textContent || "", l = document.createTextNode(s);
|
|
363
363
|
e.replaceWith(l), r.removedElements += 1;
|
|
364
364
|
return;
|
|
@@ -438,9 +438,13 @@ function Be(e, t, a, r) {
|
|
|
438
438
|
!s && l && (pe(e), r.removedElements += 1);
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
|
-
|
|
441
|
+
const Ve = /\son\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]*)/gi;
|
|
442
|
+
function je(e) {
|
|
443
|
+
return e.replace(Ve, "");
|
|
444
|
+
}
|
|
445
|
+
function Fe(e, t, a, r, n) {
|
|
442
446
|
const o = document.createElement("template");
|
|
443
|
-
o.innerHTML = e;
|
|
447
|
+
o.innerHTML = je(e);
|
|
444
448
|
const s = {
|
|
445
449
|
removedElements: 0,
|
|
446
450
|
removedAttributes: 0,
|
|
@@ -459,7 +463,7 @@ function Ve(e, t, a, r, n) {
|
|
|
459
463
|
} catch (f) {
|
|
460
464
|
}
|
|
461
465
|
Array.from(o.content.querySelectorAll("*")).forEach((f) => {
|
|
462
|
-
f
|
|
466
|
+
o.content.contains(f) && Be(f, t, a, s);
|
|
463
467
|
});
|
|
464
468
|
let c = o.innerHTML;
|
|
465
469
|
r.normalizeWhitespace && n !== "fidelity" ? c = c.replace(/\s{2,}/g, " ").replace(/>\s+</g, "><").trim() : r.normalizeWhitespace && (c = c.trim());
|
|
@@ -481,7 +485,7 @@ function ye(e, t) {
|
|
|
481
485
|
const a = window.getSelection();
|
|
482
486
|
a && (a.removeAllRanges(), a.addRange(t));
|
|
483
487
|
}
|
|
484
|
-
function
|
|
488
|
+
function Ge(e, t) {
|
|
485
489
|
e.focus({ preventScroll: !0 });
|
|
486
490
|
try {
|
|
487
491
|
if (document.execCommand("insertHTML", !1, t))
|
|
@@ -500,7 +504,7 @@ function je(e, t) {
|
|
|
500
504
|
}
|
|
501
505
|
return !0;
|
|
502
506
|
}
|
|
503
|
-
function
|
|
507
|
+
function Ue(e, t) {
|
|
504
508
|
e.focus({ preventScroll: !0 });
|
|
505
509
|
try {
|
|
506
510
|
if (document.execCommand("insertText", !1, t))
|
|
@@ -515,7 +519,7 @@ function Fe(e, t) {
|
|
|
515
519
|
const n = document.createRange();
|
|
516
520
|
return n.setStart(r, r.length), n.collapse(!0), ye(e, n), !0;
|
|
517
521
|
}
|
|
518
|
-
function
|
|
522
|
+
function Ye(e, t) {
|
|
519
523
|
if (t === e.innerHTML) return;
|
|
520
524
|
const a = window.execEditorCommand || window.executeEditorCommand;
|
|
521
525
|
if (typeof a == "function")
|
|
@@ -524,7 +528,7 @@ function Ge(e, t) {
|
|
|
524
528
|
} catch (r) {
|
|
525
529
|
}
|
|
526
530
|
}
|
|
527
|
-
function
|
|
531
|
+
function Xe(e) {
|
|
528
532
|
e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
529
533
|
}
|
|
530
534
|
function B(e, t, a, r, n, o) {
|
|
@@ -541,7 +545,7 @@ function B(e, t, a, r, n, o) {
|
|
|
541
545
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
542
546
|
};
|
|
543
547
|
}
|
|
544
|
-
function
|
|
548
|
+
function Ze(e, t, a, r) {
|
|
545
549
|
const n = Ie(e, t);
|
|
546
550
|
if (a === "plain") {
|
|
547
551
|
const l = t || e.replace(/<[^>]*>/g, " "), c = J(l, r);
|
|
@@ -583,7 +587,7 @@ function Ye(e, t, a, r) {
|
|
|
583
587
|
)
|
|
584
588
|
};
|
|
585
589
|
}
|
|
586
|
-
const o = r.profileOptions[a], s =
|
|
590
|
+
const o = r.profileOptions[a], s = Fe(e, o, n, r, a);
|
|
587
591
|
if (!s.html) {
|
|
588
592
|
const l = J(t || e.replace(/<[^>]*>/g, " "), r);
|
|
589
593
|
return {
|
|
@@ -611,7 +615,7 @@ function U(e, t) {
|
|
|
611
615
|
function ae(e) {
|
|
612
616
|
return e === "fidelity" ? "balanced" : e === "balanced" ? "plain" : "fidelity";
|
|
613
617
|
}
|
|
614
|
-
function
|
|
618
|
+
function Je(e, t) {
|
|
615
619
|
e.setAttribute("aria-label", t.labels.panelAriaLabel);
|
|
616
620
|
const a = e.querySelector(".rte-smart-paste-title");
|
|
617
621
|
a && (a.textContent = t.labels.panelTitle);
|
|
@@ -642,8 +646,8 @@ function Xe(e, t) {
|
|
|
642
646
|
g && (g.textContent = t.labels.lastPasteSourceLabel);
|
|
643
647
|
const P = e.querySelector('[data-key="profile-label"]');
|
|
644
648
|
P && (P.textContent = t.labels.lastPasteProfileLabel);
|
|
645
|
-
const
|
|
646
|
-
|
|
649
|
+
const T = e.querySelector('[data-key="removed-label"]');
|
|
650
|
+
T && (T.textContent = t.labels.lastPasteRemovedLabel);
|
|
647
651
|
const ne = e.querySelector('[data-key="chars-label"]');
|
|
648
652
|
ne && (ne.textContent = t.labels.lastPasteCharsLabel);
|
|
649
653
|
const se = e.querySelector(".rte-smart-paste-shortcut");
|
|
@@ -652,15 +656,15 @@ function Xe(e, t) {
|
|
|
652
656
|
function S(e) {
|
|
653
657
|
const t = h.get(e), a = d.get(e) || O, r = M.get(e);
|
|
654
658
|
if (!t || !a || !r) return;
|
|
655
|
-
|
|
659
|
+
Je(t, a);
|
|
656
660
|
const n = t.querySelector(".rte-smart-paste-status");
|
|
657
661
|
n && (n.textContent = r.enabled ? a.labels.enabledText : a.labels.disabledText);
|
|
658
662
|
const o = t.querySelector('[data-action="toggle-enabled"]');
|
|
659
663
|
o && (o.setAttribute("data-enabled", r.enabled ? "true" : "false"), o.textContent = r.enabled ? a.labels.toggleOnText : a.labels.toggleOffText, o.setAttribute("aria-pressed", r.enabled ? "true" : "false")), Array.from(
|
|
660
664
|
t.querySelectorAll('[data-action="set-profile"][data-profile]')
|
|
661
665
|
).forEach((g) => {
|
|
662
|
-
const
|
|
663
|
-
g.classList.toggle("active",
|
|
666
|
+
const T = H(g.getAttribute("data-profile")) === r.profile;
|
|
667
|
+
g.classList.toggle("active", T), g.setAttribute("aria-pressed", T ? "true" : "false");
|
|
664
668
|
});
|
|
665
669
|
const l = t.querySelector(".rte-smart-paste-empty"), c = t.querySelector(".rte-smart-paste-report"), i = t.querySelector('[data-key="source-value"]'), f = t.querySelector('[data-key="profile-value"]'), p = t.querySelector('[data-key="removed-value"]'), y = t.querySelector('[data-key="chars-value"]');
|
|
666
670
|
if (!r.lastReport) {
|
|
@@ -680,9 +684,9 @@ function Q(e, t) {
|
|
|
680
684
|
}
|
|
681
685
|
function q(e, t = !1) {
|
|
682
686
|
const a = h.get(e);
|
|
683
|
-
a && (a.classList.remove("show"), I.set(e, !1),
|
|
687
|
+
a && (a.classList.remove("show"), I.set(e, !1), D(e, "toggleSmartPastePanel", !1), t && e.focus({ preventScroll: !0 }));
|
|
684
688
|
}
|
|
685
|
-
function
|
|
689
|
+
function Qe(e) {
|
|
686
690
|
const t = h.get(e);
|
|
687
691
|
if (t) return t;
|
|
688
692
|
const a = d.get(e) || O || V(), r = `rte-smart-paste-panel-${Me++}`, n = document.createElement("section");
|
|
@@ -729,7 +733,7 @@ function Ze(e) {
|
|
|
729
733
|
}
|
|
730
734
|
if (c === "toggle-enabled") {
|
|
731
735
|
const i = m(e, d.get(e) || a);
|
|
732
|
-
i.enabled = !i.enabled,
|
|
736
|
+
i.enabled = !i.enabled, D(e, "toggleSmartPasteEnabled", i.enabled), S(e), R(n, i.enabled ? a.labels.enabledText : a.labels.disabledText);
|
|
733
737
|
return;
|
|
734
738
|
}
|
|
735
739
|
if (c === "cycle-profile") {
|
|
@@ -759,10 +763,10 @@ function Ze(e) {
|
|
|
759
763
|
}), G(n, e), document.body.appendChild(n), h.set(e, n), I.set(e, !1), S(e), n;
|
|
760
764
|
}
|
|
761
765
|
function xe(e) {
|
|
762
|
-
const t =
|
|
766
|
+
const t = Qe(e);
|
|
763
767
|
h.forEach((r, n) => {
|
|
764
768
|
n !== e && q(n, !1);
|
|
765
|
-
}), t.classList.add("show"), I.set(e, !0),
|
|
769
|
+
}), t.classList.add("show"), I.set(e, !0), D(e, "toggleSmartPastePanel", !0), G(t, e), Q(e, t);
|
|
766
770
|
const a = t.querySelector('[data-action="toggle-enabled"]');
|
|
767
771
|
a == null || a.focus();
|
|
768
772
|
}
|
|
@@ -777,7 +781,7 @@ function Se(e) {
|
|
|
777
781
|
lastReport: e.lastReport ? { ...e.lastReport } : null
|
|
778
782
|
};
|
|
779
783
|
}
|
|
780
|
-
function
|
|
784
|
+
function et(e, t) {
|
|
781
785
|
const a = d.get(e) || O;
|
|
782
786
|
if (!a) return !1;
|
|
783
787
|
const r = m(e, a);
|
|
@@ -789,11 +793,11 @@ function Je(e, t) {
|
|
|
789
793
|
if (!n) return !1;
|
|
790
794
|
const o = n.getData("text/html") || "", s = n.getData("text/plain") || "";
|
|
791
795
|
if (!o && !s) return !1;
|
|
792
|
-
const l =
|
|
796
|
+
const l = Ze(o, s, r.profile, a);
|
|
793
797
|
if (!l.value) return !1;
|
|
794
798
|
const c = e.innerHTML;
|
|
795
|
-
if (!(l.mode === "html" ?
|
|
796
|
-
r.lastReport = { ...l.report }, M.set(e, r),
|
|
799
|
+
if (!(l.mode === "html" ? Ge(e, l.value) : Ue(e, l.value))) return !1;
|
|
800
|
+
r.lastReport = { ...l.report }, M.set(e, r), Ye(e, c), Xe(e), e.dispatchEvent(
|
|
797
801
|
new CustomEvent("editora:smart-paste", {
|
|
798
802
|
bubbles: !0,
|
|
799
803
|
detail: Se(r)
|
|
@@ -809,85 +813,85 @@ function Je(e, t) {
|
|
|
809
813
|
}
|
|
810
814
|
return !0;
|
|
811
815
|
}
|
|
812
|
-
function
|
|
816
|
+
function tt(e) {
|
|
813
817
|
return (t) => {
|
|
814
|
-
t.defaultPrevented || t[ce] === !0 || (b = e, !
|
|
818
|
+
t.defaultPrevented || t[ce] === !0 || (b = e, !et(e, t)) || (t[ce] = !0, t.preventDefault(), typeof t.stopImmediatePropagation == "function" ? t.stopImmediatePropagation() : t.stopPropagation());
|
|
815
819
|
};
|
|
816
820
|
}
|
|
817
|
-
function
|
|
821
|
+
function rt(e) {
|
|
818
822
|
if (F.has(e)) return;
|
|
819
|
-
const t =
|
|
823
|
+
const t = tt(e);
|
|
820
824
|
e.addEventListener("paste", t, !0), F.set(e, t);
|
|
821
825
|
}
|
|
822
|
-
function
|
|
826
|
+
function _(e) {
|
|
823
827
|
const t = M.get(e);
|
|
824
|
-
|
|
828
|
+
D(e, "toggleSmartPastePanel", re(e)), D(e, "toggleSmartPasteEnabled", (t == null ? void 0 : t.enabled) === !0);
|
|
825
829
|
}
|
|
826
830
|
function oe(e) {
|
|
827
831
|
return typeof e.key == "string" ? e.key.toLowerCase() : "";
|
|
828
832
|
}
|
|
829
|
-
function
|
|
833
|
+
function at(e) {
|
|
830
834
|
const t = oe(e);
|
|
831
835
|
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "s";
|
|
832
836
|
}
|
|
833
|
-
function
|
|
837
|
+
function ot(e) {
|
|
834
838
|
const t = oe(e);
|
|
835
839
|
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "v";
|
|
836
840
|
}
|
|
837
|
-
function
|
|
841
|
+
function nt(e) {
|
|
838
842
|
const t = oe(e);
|
|
839
843
|
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "g";
|
|
840
844
|
}
|
|
841
|
-
function
|
|
845
|
+
function st(e) {
|
|
842
846
|
O = e, L || (L = (t) => {
|
|
843
847
|
j();
|
|
844
848
|
const a = t.target, r = a == null ? void 0 : a.closest(v);
|
|
845
849
|
if (!r) return;
|
|
846
850
|
const n = d.get(r) || e;
|
|
847
|
-
m(r, n), d.set(r, n), b = r,
|
|
851
|
+
m(r, n), d.set(r, n), b = r, _(r);
|
|
848
852
|
const o = h.get(r);
|
|
849
853
|
o && (G(o, r), Q(r, o), S(r));
|
|
850
854
|
}, document.addEventListener("focusin", L, !0)), w || (w = (t) => {
|
|
851
855
|
if (t.defaultPrevented) return;
|
|
852
856
|
const a = t.target;
|
|
853
857
|
if (a != null && a.closest(`.${u} input, .${u} textarea, .${u} select`)) return;
|
|
854
|
-
const r =
|
|
858
|
+
const r = ze(t);
|
|
855
859
|
if (!r) return;
|
|
856
860
|
const n = d.get(r) || O || e;
|
|
857
861
|
if (m(r, n), d.set(r, n), b = r, t.key === "Escape" && re(r)) {
|
|
858
862
|
t.preventDefault(), q(r, !0);
|
|
859
863
|
return;
|
|
860
864
|
}
|
|
861
|
-
if (
|
|
865
|
+
if (at(t)) {
|
|
862
866
|
t.preventDefault(), t.stopPropagation(), ve(r);
|
|
863
867
|
return;
|
|
864
868
|
}
|
|
865
|
-
if (
|
|
869
|
+
if (ot(t)) {
|
|
866
870
|
t.preventDefault(), t.stopPropagation();
|
|
867
871
|
const o = m(r, n);
|
|
868
872
|
o.profile = ae(o.profile), S(r);
|
|
869
873
|
return;
|
|
870
874
|
}
|
|
871
|
-
if (
|
|
875
|
+
if (nt(t)) {
|
|
872
876
|
t.preventDefault(), t.stopPropagation();
|
|
873
877
|
const o = m(r, n);
|
|
874
|
-
o.enabled = !o.enabled,
|
|
878
|
+
o.enabled = !o.enabled, _(r), S(r);
|
|
875
879
|
}
|
|
876
880
|
}, document.addEventListener("keydown", w, !0)), A || (A = () => {
|
|
877
881
|
j(), h.forEach((t, a) => {
|
|
878
882
|
!a.isConnected || !t.isConnected || (G(t, a), Q(a, t));
|
|
879
883
|
});
|
|
880
884
|
}, window.addEventListener("scroll", A, !0), window.addEventListener("resize", A)), !$ && typeof MutationObserver != "undefined" && document.body && ($ = new MutationObserver((t) => {
|
|
881
|
-
|
|
885
|
+
Ne(t) && j();
|
|
882
886
|
}), $.observe(document.body, {
|
|
883
887
|
childList: !0,
|
|
884
888
|
subtree: !0
|
|
885
889
|
}));
|
|
886
890
|
}
|
|
887
|
-
function
|
|
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(),
|
|
891
|
+
function lt() {
|
|
892
|
+
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(), z.forEach((e) => be(e)), z.clear(), O = null, b = null;
|
|
889
893
|
}
|
|
890
|
-
function
|
|
894
|
+
function it() {
|
|
891
895
|
if (typeof document == "undefined" || document.getElementById(ie)) return;
|
|
892
896
|
const e = document.createElement("style");
|
|
893
897
|
e.id = ie, e.textContent = `
|
|
@@ -1252,9 +1256,9 @@ function st() {
|
|
|
1252
1256
|
}
|
|
1253
1257
|
`, document.head.appendChild(e);
|
|
1254
1258
|
}
|
|
1255
|
-
const
|
|
1259
|
+
const ct = (e = {}) => {
|
|
1256
1260
|
const t = V(e), a = /* @__PURE__ */ new Set();
|
|
1257
|
-
return
|
|
1261
|
+
return it(), {
|
|
1258
1262
|
name: "smartPaste",
|
|
1259
1263
|
toolbar: [
|
|
1260
1264
|
{
|
|
@@ -1289,38 +1293,38 @@ const lt = (e = {}) => {
|
|
|
1289
1293
|
],
|
|
1290
1294
|
commands: {
|
|
1291
1295
|
smartPaste: (r, n) => {
|
|
1292
|
-
const o =
|
|
1296
|
+
const o = C(n, !1, !1);
|
|
1293
1297
|
if (!o) return !1;
|
|
1294
1298
|
const s = d.get(o) || t;
|
|
1295
1299
|
return m(o, s), d.set(o, s), b = o, xe(o), !0;
|
|
1296
1300
|
},
|
|
1297
1301
|
toggleSmartPastePanel: (r, n) => {
|
|
1298
|
-
const o =
|
|
1302
|
+
const o = C(n, !1, !1);
|
|
1299
1303
|
if (!o) return !1;
|
|
1300
1304
|
const s = d.get(o) || t;
|
|
1301
1305
|
return m(o, s), d.set(o, s), b = o, ve(o, typeof r == "boolean" ? r : void 0);
|
|
1302
1306
|
},
|
|
1303
1307
|
cycleSmartPasteProfile: (r, n) => {
|
|
1304
|
-
const o =
|
|
1308
|
+
const o = C(n, !1, !1);
|
|
1305
1309
|
if (!o) return !1;
|
|
1306
1310
|
const s = d.get(o) || t, l = m(o, s);
|
|
1307
1311
|
return d.set(o, s), l.profile = ae(l.profile), S(o), !0;
|
|
1308
1312
|
},
|
|
1309
1313
|
setSmartPasteProfile: (r, n) => {
|
|
1310
|
-
const o =
|
|
1314
|
+
const o = C(n, !1, !1);
|
|
1311
1315
|
if (!o) return !1;
|
|
1312
1316
|
const s = d.get(o) || t, l = m(o, s);
|
|
1313
1317
|
return d.set(o, s), l.profile = H(r), S(o), !0;
|
|
1314
1318
|
},
|
|
1315
1319
|
toggleSmartPasteEnabled: (r, n) => {
|
|
1316
|
-
const o =
|
|
1320
|
+
const o = C(n, !1, !1);
|
|
1317
1321
|
if (!o) return !1;
|
|
1318
1322
|
const s = d.get(o) || t, l = m(o, s);
|
|
1319
|
-
return d.set(o, s), l.enabled = typeof r == "boolean" ? r : !l.enabled,
|
|
1323
|
+
return d.set(o, s), l.enabled = typeof r == "boolean" ? r : !l.enabled, _(o), S(o), !0;
|
|
1320
1324
|
},
|
|
1321
1325
|
setSmartPasteOptions: (r, n) => {
|
|
1322
|
-
var f, p, y, g, P,
|
|
1323
|
-
const o =
|
|
1326
|
+
var f, p, y, g, P, T;
|
|
1327
|
+
const o = C(n, !1, !1);
|
|
1324
1328
|
if (!o || !r || typeof r != "object") return !1;
|
|
1325
1329
|
const s = d.get(o) || t, l = de(s), c = V({
|
|
1326
1330
|
...l,
|
|
@@ -1342,17 +1346,17 @@ const lt = (e = {}) => {
|
|
|
1342
1346
|
},
|
|
1343
1347
|
plain: {
|
|
1344
1348
|
...((P = l.profileOptions) == null ? void 0 : P.plain) || {},
|
|
1345
|
-
...((
|
|
1349
|
+
...((T = r.profileOptions) == null ? void 0 : T.plain) || {}
|
|
1346
1350
|
}
|
|
1347
1351
|
},
|
|
1348
1352
|
normalizeText: r.normalizeText || s.normalizeText
|
|
1349
1353
|
});
|
|
1350
1354
|
d.set(o, c);
|
|
1351
1355
|
const i = m(o, c);
|
|
1352
|
-
return typeof r.enabled == "boolean" && (i.enabled = r.enabled), r.defaultProfile && (i.profile = H(r.defaultProfile)), S(o),
|
|
1356
|
+
return typeof r.enabled == "boolean" && (i.enabled = r.enabled), r.defaultProfile && (i.profile = H(r.defaultProfile)), S(o), _(o), !0;
|
|
1353
1357
|
},
|
|
1354
1358
|
getSmartPasteState: (r, n) => {
|
|
1355
|
-
const o =
|
|
1359
|
+
const o = C(n, !1, !1);
|
|
1356
1360
|
if (!o) return !1;
|
|
1357
1361
|
const s = d.get(o) || t, l = m(o, s), c = Se(l);
|
|
1358
1362
|
if (typeof r == "function")
|
|
@@ -1379,8 +1383,8 @@ const lt = (e = {}) => {
|
|
|
1379
1383
|
init: function(n) {
|
|
1380
1384
|
W += 1;
|
|
1381
1385
|
const o = this && typeof this.__pluginConfig == "object" ? V({ ...de(t), ...this.__pluginConfig }) : t;
|
|
1382
|
-
|
|
1383
|
-
const s =
|
|
1386
|
+
st(o);
|
|
1387
|
+
const s = C(
|
|
1384
1388
|
n != null && n.editorElement ? { editorElement: n.editorElement } : void 0,
|
|
1385
1389
|
!1,
|
|
1386
1390
|
!1
|
|
@@ -1388,14 +1392,14 @@ const lt = (e = {}) => {
|
|
|
1388
1392
|
if (!s) return;
|
|
1389
1393
|
b = s, a.add(s);
|
|
1390
1394
|
const l = m(s, o);
|
|
1391
|
-
l.enabled = o.enabled, l.profile = o.defaultProfile, d.set(s, o),
|
|
1395
|
+
l.enabled = o.enabled, l.profile = o.defaultProfile, d.set(s, o), _(s);
|
|
1392
1396
|
},
|
|
1393
1397
|
destroy: () => {
|
|
1394
|
-
a.forEach((r) => ge(r)), a.clear(), W = Math.max(0, W - 1), !(W > 0) &&
|
|
1398
|
+
a.forEach((r) => ge(r)), a.clear(), W = Math.max(0, W - 1), !(W > 0) && lt();
|
|
1395
1399
|
}
|
|
1396
1400
|
};
|
|
1397
1401
|
};
|
|
1398
1402
|
export {
|
|
1399
|
-
|
|
1403
|
+
ct as SmartPastePlugin
|
|
1400
1404
|
};
|
|
1401
|
-
//# sourceMappingURL=SmartPastePlugin.native-
|
|
1405
|
+
//# sourceMappingURL=SmartPastePlugin.native-BATLCds5.mjs.map
|