@editora/plugins 1.0.10 → 1.0.12
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/_commonjsHelpers-BH3jXuIh.js +1 -0
- package/dist/_commonjsHelpers-ByX85dGu.mjs +33 -0
- package/dist/a11y-checker.cjs.js +12 -12
- package/dist/a11y-checker.esm.js +80 -98
- package/dist/anchor.cjs.js +12 -12
- package/dist/anchor.esm.js +115 -128
- package/dist/anchoredPopover-BzqGPOAE.js +1 -0
- package/dist/anchoredPopover-Dts0IrgU.mjs +106 -0
- package/dist/approval-workflow.cjs.js +40 -40
- package/dist/approval-workflow.esm.js +208 -249
- package/dist/background-color.cjs.js +2 -2
- package/dist/background-color.esm.js +55 -68
- package/dist/blockquote.esm.js +1 -2
- package/dist/blocks-library.cjs.js +45 -45
- package/dist/blocks-library.esm.js +178 -245
- package/dist/capitalization.esm.js +1 -2
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +58 -82
- package/dist/citations.cjs.js +37 -37
- package/dist/citations.esm.js +439 -512
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/clear-formatting.esm.js +27 -33
- package/dist/code-sample.cjs.js +14 -14
- package/dist/code-sample.esm.js +82 -93
- package/dist/code.cjs.js +119 -42
- package/dist/code.esm.js +2560 -760
- package/dist/comments.cjs.js +6 -6
- package/dist/comments.esm.js +116 -158
- package/dist/conditional-content.cjs.js +90 -90
- package/dist/conditional-content.esm.js +371 -432
- package/dist/content-rules.cjs.js +7 -7
- package/dist/content-rules.esm.js +105 -159
- package/dist/data-binding.cjs.js +46 -46
- package/dist/data-binding.esm.js +328 -368
- package/dist/direction.esm.js +9 -18
- package/dist/doc-schema.cjs.js +29 -29
- package/dist/doc-schema.esm.js +240 -308
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +4 -5
- package/dist/documentManager-CTqRftU8.mjs +8369 -0
- package/dist/documentManager-Jf0RbSks.js +17 -0
- package/dist/{editorContainerHelpers-69585c07.mjs → editorContainerHelpers-C7kdWnS0.mjs} +1 -2
- package/dist/embed-iframe.cjs.js +4 -4
- package/dist/embed-iframe.esm.js +73 -81
- package/dist/emojis.cjs.js +8 -8
- package/dist/emojis.esm.js +65 -77
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +54 -56
- package/dist/font-family.cjs.js +1 -1
- package/dist/font-family.esm.js +39 -47
- package/dist/font-size.cjs.js +1 -1
- package/dist/font-size.esm.js +37 -53
- package/dist/footnote.cjs.js +2 -2
- package/dist/footnote.esm.js +76 -117
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +70 -92
- package/dist/html2canvas.esm-B5qzocYs.js +5 -0
- package/dist/{html2canvas.esm-1a1724a1.mjs → html2canvas.esm-BWVIUcAF.mjs} +141 -225
- package/dist/indent.cjs.js +1 -1
- package/dist/indent.esm.js +12 -24
- package/dist/{index-f04538f2.mjs → index-BFsKNTTj.mjs} +70 -71
- package/dist/index-CvJk4DKa.js +221 -0
- package/dist/index-D3CycEFU.mjs +16543 -0
- package/dist/index-tqLTHcO6.js +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es-CE_A4QSm.js +5 -0
- package/dist/index.es-DQ78mYYo.mjs +6665 -0
- package/dist/index.esm.js +125 -128
- package/dist/italic.cjs.js +1 -1
- package/dist/italic.esm.js +8 -9
- package/dist/jspdf.es.min-BoS80556.js +77 -0
- package/dist/{jspdf.es.min-c36a4fd8.mjs → jspdf.es.min-DQCoX5yh.mjs} +3658 -4682
- package/dist/line-height.cjs.js +1 -1
- package/dist/line-height.esm.js +11 -24
- package/dist/link.cjs.js +5 -5
- package/dist/link.esm.js +24 -30
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +20 -25
- package/dist/lite.cjs.js +1 -1
- package/dist/lite.esm.js +59 -61
- package/dist/math.cjs.js +21 -21
- package/dist/math.esm.js +139 -146
- package/dist/media-manager.cjs.js +31 -31
- package/dist/media-manager.esm.js +285 -300
- package/dist/mentions.cjs.js +9 -9
- package/dist/mentions.esm.js +238 -286
- package/dist/merge-tag.cjs.js +2 -2
- package/dist/merge-tag.esm.js +177 -216
- package/dist/page-break.cjs.js +2 -2
- package/dist/page-break.esm.js +33 -49
- package/dist/pii-redaction.cjs.js +19 -19
- package/dist/pii-redaction.esm.js +393 -463
- package/dist/plugins.css +1 -0
- package/dist/preview.esm.js +5 -10
- package/dist/print.cjs.js +4 -4
- package/dist/print.esm.js +17 -20
- package/dist/{purify.es-35a15df8.mjs → purify.es-DHhaBdbu.mjs} +9 -19
- package/dist/{purify.es-a8d731c6.js → purify.es-T2a3nLiC.js} +1 -1
- package/dist/slash-commands.cjs.js +2 -2
- package/dist/slash-commands.esm.js +39 -75
- package/dist/smart-paste.cjs.js +27 -27
- package/dist/smart-paste.esm.js +280 -336
- package/dist/special-characters.cjs.js +7 -7
- package/dist/special-characters.esm.js +61 -69
- package/dist/spell-check.cjs.js +5 -5
- package/dist/spell-check.esm.js +97 -123
- package/dist/strikethrough.cjs.js +1 -1
- package/dist/strikethrough.esm.js +14 -19
- package/dist/table.cjs.js +4 -4
- package/dist/table.esm.js +191 -225
- package/dist/template.cjs.js +21 -20
- package/dist/template.esm.js +715 -196
- package/dist/text-alignment.cjs.js +1 -1
- package/dist/text-alignment.esm.js +21 -27
- package/dist/text-color.cjs.js +3 -3
- package/dist/text-color.esm.js +70 -87
- package/dist/track-changes.cjs.js +2 -2
- package/dist/track-changes.esm.js +100 -162
- package/dist/translation-workflow.cjs.js +74 -74
- package/dist/translation-workflow.esm.js +602 -678
- package/dist/version-diff.cjs.js +14 -14
- package/dist/version-diff.esm.js +128 -157
- package/package.json +1 -1
- package/dist/_commonjsHelpers-6763f629.js +0 -1
- package/dist/_commonjsHelpers-c5d32002.mjs +0 -30
- package/dist/anchoredPopover-33f1358d.mjs +0 -109
- package/dist/anchoredPopover-8151d535.js +0 -1
- package/dist/documentManager-25b6203c.mjs +0 -9122
- package/dist/documentManager-b69e7054.js +0 -17
- package/dist/html2canvas.esm-09133e29.js +0 -22
- package/dist/index-656d224b.js +0 -231
- package/dist/index-6a8c48bb.js +0 -1
- package/dist/index-d027b7e2.mjs +0 -16859
- package/dist/index.es-730f2d98.mjs +0 -5775
- package/dist/index.es-dd40173b.js +0 -18
- package/dist/jspdf.es.min-90db2c97.js +0 -243
- package/dist/style.css +0 -1
- /package/dist/{editorContainerHelpers-36b8ddf3.js → editorContainerHelpers-CFbfiOJI.js} +0 -0
package/dist/smart-paste.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const y = ".rte-content, .editora-content", ee = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", se = "__editoraCommandEditorRoot", le = "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)', Ee = typeof NodeFilter < "u" ? NodeFilter.SHOW_COMMENT : 128, ie = "__editoraSmartPasteHandled", ke = /* @__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
|
-
]), Ce = /* @__PURE__ */ new Set(["table", "thead", "tbody", "tfoot", "tr", "td", "th", "colgroup", "col"]), Te = /* @__PURE__ */ new Set(["span", "font"]), Ae = /^(https?:|mailto:|tel:|#|\/)/i, Pe = /^data:image\/(?:png|gif|jpeg|jpg|webp);base64,/i,
|
|
18
|
+
]), Ce = /* @__PURE__ */ new Set(["table", "thead", "tbody", "tfoot", "tr", "td", "th", "colgroup", "col"]), Te = /* @__PURE__ */ new Set(["span", "font"]), Ae = /^(https?:|mailto:|tel:|#|\/)/i, Pe = /^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
|
+
]), Le = {
|
|
51
51
|
panelTitle: "Smart Paste",
|
|
52
52
|
panelAriaLabel: "Smart paste panel",
|
|
53
53
|
enabledText: "Smart paste is enabled",
|
|
@@ -87,8 +87,8 @@ 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(),
|
|
91
|
-
let
|
|
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, $e = 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
|
}
|
|
@@ -96,27 +96,27 @@ function Me(e) {
|
|
|
96
96
|
return e.replace(/\u00A0/g, " ").replace(/\r\n?/g, `
|
|
97
97
|
`);
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function _(e) {
|
|
100
100
|
return e === "balanced" || e === "plain" ? e : "fidelity";
|
|
101
101
|
}
|
|
102
102
|
function Z(e, t) {
|
|
103
103
|
return {
|
|
104
|
-
keepStyles:
|
|
105
|
-
keepClasses:
|
|
106
|
-
keepDataAttributes:
|
|
107
|
-
preserveTables:
|
|
104
|
+
keepStyles: e?.keepStyles ?? t.keepStyles,
|
|
105
|
+
keepClasses: e?.keepClasses ?? t.keepClasses,
|
|
106
|
+
keepDataAttributes: e?.keepDataAttributes ?? t.keepDataAttributes,
|
|
107
|
+
preserveTables: e?.preserveTables ?? t.preserveTables
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function K(e = {}) {
|
|
111
111
|
const t = e.profileOptions || {};
|
|
112
112
|
return {
|
|
113
113
|
enabled: e.enabled !== !1,
|
|
114
|
-
defaultProfile:
|
|
114
|
+
defaultProfile: _(e.defaultProfile),
|
|
115
115
|
maxHtmlLength: Math.max(8e3, Math.min(8e5, Number(e.maxHtmlLength ?? 22e4))),
|
|
116
116
|
removeComments: e.removeComments !== !1,
|
|
117
117
|
normalizeWhitespace: e.normalizeWhitespace !== !1,
|
|
118
118
|
labels: {
|
|
119
|
-
...
|
|
119
|
+
...Le,
|
|
120
120
|
...e.labels || {}
|
|
121
121
|
},
|
|
122
122
|
normalizeText: e.normalizeText || Me,
|
|
@@ -146,40 +146,34 @@ function ce(e) {
|
|
|
146
146
|
function te(e) {
|
|
147
147
|
return e.closest(ee) || e;
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
if (!e)
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
return e;
|
|
154
|
-
const t = e.querySelector(v);
|
|
149
|
+
function H(e) {
|
|
150
|
+
if (!e) return null;
|
|
151
|
+
if (e.matches(y)) return e;
|
|
152
|
+
const t = e.querySelector(y);
|
|
155
153
|
return t instanceof HTMLElement ? t : null;
|
|
156
154
|
}
|
|
157
155
|
function Oe() {
|
|
158
|
-
if (typeof window > "u")
|
|
159
|
-
return null;
|
|
156
|
+
if (typeof window > "u") return null;
|
|
160
157
|
const e = window[se];
|
|
161
|
-
if (!(e instanceof HTMLElement))
|
|
162
|
-
return null;
|
|
158
|
+
if (!(e instanceof HTMLElement)) return null;
|
|
163
159
|
window[se] = null;
|
|
164
|
-
const t =
|
|
165
|
-
if (t)
|
|
166
|
-
return t;
|
|
160
|
+
const t = H(e);
|
|
161
|
+
if (t) return t;
|
|
167
162
|
const a = e.closest(ee);
|
|
168
163
|
if (a) {
|
|
169
|
-
const n =
|
|
170
|
-
if (n)
|
|
171
|
-
return n;
|
|
164
|
+
const n = H(a);
|
|
165
|
+
if (n) return n;
|
|
172
166
|
}
|
|
173
|
-
const r = e.closest(
|
|
167
|
+
const r = e.closest(y);
|
|
174
168
|
return r instanceof HTMLElement ? r : null;
|
|
175
169
|
}
|
|
176
170
|
function Re(e) {
|
|
177
171
|
const t = e.closest("[data-editora-editor]");
|
|
178
|
-
if (t &&
|
|
172
|
+
if (t && H(t) === e)
|
|
179
173
|
return t;
|
|
180
174
|
let a = e;
|
|
181
175
|
for (; a; ) {
|
|
182
|
-
if (a.matches(ee) && (a === e ||
|
|
176
|
+
if (a.matches(ee) && (a === e || H(a) === e))
|
|
183
177
|
return a;
|
|
184
178
|
a = a.parentElement;
|
|
185
179
|
}
|
|
@@ -188,50 +182,41 @@ function Re(e) {
|
|
|
188
182
|
function pe(e) {
|
|
189
183
|
return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
|
|
190
184
|
}
|
|
191
|
-
function
|
|
192
|
-
if (
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
if (s)
|
|
197
|
-
return s;
|
|
185
|
+
function C(e, t = !0, a = !0) {
|
|
186
|
+
if (V(), e?.contentElement instanceof HTMLElement) return e.contentElement;
|
|
187
|
+
if (e?.editorElement instanceof HTMLElement) {
|
|
188
|
+
const s = H(e.editorElement);
|
|
189
|
+
if (s) return s;
|
|
198
190
|
}
|
|
199
191
|
const r = Oe();
|
|
200
|
-
if (r)
|
|
201
|
-
return r;
|
|
192
|
+
if (r) return r;
|
|
202
193
|
const n = window.getSelection();
|
|
203
194
|
if (n && n.rangeCount > 0) {
|
|
204
|
-
const
|
|
205
|
-
if (l)
|
|
206
|
-
return l;
|
|
195
|
+
const l = pe(n.getRangeAt(0).startContainer)?.closest(y);
|
|
196
|
+
if (l) return l;
|
|
207
197
|
}
|
|
208
198
|
const o = document.activeElement;
|
|
209
199
|
if (o) {
|
|
210
|
-
if (o.matches(
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
if (s)
|
|
214
|
-
return s;
|
|
200
|
+
if (o.matches(y)) return o;
|
|
201
|
+
const s = o.closest(y);
|
|
202
|
+
if (s) return s;
|
|
215
203
|
}
|
|
216
204
|
if (a) {
|
|
217
|
-
if (
|
|
218
|
-
|
|
219
|
-
b && !b.isConnected && (b = null);
|
|
205
|
+
if (m && m.isConnected) return m;
|
|
206
|
+
m && !m.isConnected && (m = null);
|
|
220
207
|
}
|
|
221
|
-
return t ? document.querySelector(
|
|
208
|
+
return t ? document.querySelector(y) : null;
|
|
222
209
|
}
|
|
223
210
|
function ze(e) {
|
|
224
211
|
const t = e.target;
|
|
225
212
|
if (t) {
|
|
226
|
-
const r = t.closest(
|
|
227
|
-
if (r)
|
|
228
|
-
return r;
|
|
213
|
+
const r = t.closest(y);
|
|
214
|
+
if (r) return r;
|
|
229
215
|
}
|
|
230
216
|
const a = window.getSelection();
|
|
231
217
|
if (a && a.rangeCount > 0) {
|
|
232
|
-
const
|
|
233
|
-
if (n)
|
|
234
|
-
return n;
|
|
218
|
+
const n = pe(a.getRangeAt(0).startContainer)?.closest(y);
|
|
219
|
+
if (n) return n;
|
|
235
220
|
}
|
|
236
221
|
return null;
|
|
237
222
|
}
|
|
@@ -240,18 +225,17 @@ function B(e) {
|
|
|
240
225
|
}
|
|
241
226
|
function _e(e) {
|
|
242
227
|
const t = te(e);
|
|
243
|
-
if (B(t))
|
|
244
|
-
return !0;
|
|
228
|
+
if (B(t)) return !0;
|
|
245
229
|
const a = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
246
230
|
return B(a) ? !0 : B(document.documentElement) || B(document.body);
|
|
247
231
|
}
|
|
248
|
-
function
|
|
232
|
+
function F(e, t) {
|
|
249
233
|
e.classList.remove("rte-smart-paste-theme-dark"), _e(t) && e.classList.add("rte-smart-paste-theme-dark");
|
|
250
234
|
}
|
|
251
235
|
function de(e) {
|
|
252
236
|
return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
|
|
253
237
|
}
|
|
254
|
-
function
|
|
238
|
+
function D(e, t, a) {
|
|
255
239
|
const r = Re(e);
|
|
256
240
|
Array.from(
|
|
257
241
|
r.querySelectorAll(
|
|
@@ -261,48 +245,45 @@ function N(e, t, a) {
|
|
|
261
245
|
o.classList.toggle("active", a), o.setAttribute("data-active", a ? "true" : "false"), o.setAttribute("aria-pressed", a ? "true" : "false");
|
|
262
246
|
});
|
|
263
247
|
}
|
|
264
|
-
function
|
|
248
|
+
function p(e, t) {
|
|
265
249
|
d.has(e) || d.set(e, t);
|
|
266
|
-
let a =
|
|
250
|
+
let a = L.get(e);
|
|
267
251
|
return a || (a = {
|
|
268
252
|
enabled: t.enabled,
|
|
269
253
|
profile: t.defaultProfile,
|
|
270
254
|
lastReport: null
|
|
271
|
-
},
|
|
255
|
+
}, L.set(e, a)), Qe(e), z.add(e), a;
|
|
272
256
|
}
|
|
273
257
|
function me(e) {
|
|
274
|
-
const t =
|
|
275
|
-
t && (e.removeEventListener("paste", t, !0),
|
|
258
|
+
const t = j.get(e);
|
|
259
|
+
t && (e.removeEventListener("paste", t, !0), j.delete(e));
|
|
276
260
|
}
|
|
277
261
|
function be(e) {
|
|
278
|
-
|
|
279
|
-
me(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);
|
|
262
|
+
me(e), g.get(e)?.remove(), g.delete(e), q.delete(e), d.delete(e), L.delete(e), z.delete(e), m === e && (m = null);
|
|
280
263
|
}
|
|
281
|
-
function
|
|
282
|
-
Array.from(
|
|
264
|
+
function V() {
|
|
265
|
+
Array.from(z).forEach((t) => {
|
|
283
266
|
t.isConnected || be(t);
|
|
284
267
|
});
|
|
285
268
|
}
|
|
286
269
|
function He(e) {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
const i = c;
|
|
296
|
-
if ((t = i.matches) != null && t.call(i, v) || (a = i.matches) != null && a.call(i, `.${u}`) || (r = i.querySelector) != null && r.call(i, v) || (n = i.querySelector) != null && n.call(i, `.${u}`))
|
|
270
|
+
for (let t = 0; t < e.length; t += 1) {
|
|
271
|
+
const a = e[t];
|
|
272
|
+
if (!(a.type !== "childList" || a.removedNodes.length === 0))
|
|
273
|
+
for (let r = 0; r < a.removedNodes.length; r += 1) {
|
|
274
|
+
const n = a.removedNodes[r];
|
|
275
|
+
if (n.nodeType !== Node.ELEMENT_NODE) continue;
|
|
276
|
+
const o = n;
|
|
277
|
+
if (o.matches?.(y) || o.matches?.(`.${u}`) || o.querySelector?.(y) || o.querySelector?.(`.${u}`))
|
|
297
278
|
return !0;
|
|
298
279
|
}
|
|
299
280
|
}
|
|
300
281
|
return !1;
|
|
301
282
|
}
|
|
302
283
|
function re(e) {
|
|
303
|
-
return
|
|
284
|
+
return q.get(e) === !0;
|
|
304
285
|
}
|
|
305
|
-
function
|
|
286
|
+
function O(e, t) {
|
|
306
287
|
const a = e.querySelector(".rte-smart-paste-live");
|
|
307
288
|
a && (a.textContent = t);
|
|
308
289
|
}
|
|
@@ -326,9 +307,8 @@ function qe(e, t) {
|
|
|
326
307
|
function Ie(e) {
|
|
327
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(" ");
|
|
328
309
|
}
|
|
329
|
-
function
|
|
330
|
-
if (!e)
|
|
331
|
-
return { value: "", changed: !1 };
|
|
310
|
+
function Be(e) {
|
|
311
|
+
if (!e) return { value: "", changed: !1 };
|
|
332
312
|
const t = e.split(";"), a = [];
|
|
333
313
|
let r = !1;
|
|
334
314
|
return t.forEach((n) => {
|
|
@@ -342,7 +322,7 @@ function We(e) {
|
|
|
342
322
|
r = !0;
|
|
343
323
|
return;
|
|
344
324
|
}
|
|
345
|
-
if (!
|
|
325
|
+
if (!we.has(s)) {
|
|
346
326
|
r = !0;
|
|
347
327
|
return;
|
|
348
328
|
}
|
|
@@ -368,7 +348,7 @@ function fe(e) {
|
|
|
368
348
|
t.removeChild(e);
|
|
369
349
|
}
|
|
370
350
|
}
|
|
371
|
-
function
|
|
351
|
+
function We(e, t, a, r) {
|
|
372
352
|
const n = e.tagName.toLowerCase();
|
|
373
353
|
if (ke.has(n)) {
|
|
374
354
|
r.removedElements += 1, e.remove();
|
|
@@ -380,7 +360,7 @@ function Be(e, t, a, r) {
|
|
|
380
360
|
return;
|
|
381
361
|
}
|
|
382
362
|
if (Array.from(e.attributes).forEach((s) => {
|
|
383
|
-
const l = s.name.toLowerCase(),
|
|
363
|
+
const l = s.name.toLowerCase(), i = s.value;
|
|
384
364
|
if (l.startsWith("on")) {
|
|
385
365
|
e.removeAttribute(s.name), r.removedAttributes += 1;
|
|
386
366
|
return;
|
|
@@ -390,12 +370,12 @@ function Be(e, t, a, r) {
|
|
|
390
370
|
e.removeAttribute(s.name), r.removedAttributes += 1;
|
|
391
371
|
return;
|
|
392
372
|
}
|
|
393
|
-
const
|
|
394
|
-
if (!
|
|
395
|
-
e.removeAttribute(s.name), r.removedAttributes += 1,
|
|
373
|
+
const c = Be(i);
|
|
374
|
+
if (!c.value) {
|
|
375
|
+
e.removeAttribute(s.name), r.removedAttributes += 1, c.changed && (r.normalizedStyles += 1);
|
|
396
376
|
return;
|
|
397
377
|
}
|
|
398
|
-
(
|
|
378
|
+
(c.changed || c.value !== i) && (e.setAttribute("style", c.value), r.normalizedStyles += 1);
|
|
399
379
|
return;
|
|
400
380
|
}
|
|
401
381
|
if (l === "class") {
|
|
@@ -403,12 +383,12 @@ function Be(e, t, a, r) {
|
|
|
403
383
|
e.removeAttribute(s.name), r.removedAttributes += 1;
|
|
404
384
|
return;
|
|
405
385
|
}
|
|
406
|
-
const
|
|
407
|
-
if (!
|
|
386
|
+
const c = Ie(i);
|
|
387
|
+
if (!c) {
|
|
408
388
|
e.removeAttribute(s.name), r.removedAttributes += 1;
|
|
409
389
|
return;
|
|
410
390
|
}
|
|
411
|
-
|
|
391
|
+
c !== i && (e.setAttribute("class", c), r.removedAttributes += 1);
|
|
412
392
|
return;
|
|
413
393
|
}
|
|
414
394
|
if (l.startsWith("data-") && !t.keepDataAttributes) {
|
|
@@ -424,12 +404,12 @@ function Be(e, t, a, r) {
|
|
|
424
404
|
return;
|
|
425
405
|
}
|
|
426
406
|
if (l === "href" || l === "src" || l === "xlink:href") {
|
|
427
|
-
const
|
|
428
|
-
if (!
|
|
407
|
+
const c = ue(i);
|
|
408
|
+
if (!c) {
|
|
429
409
|
e.removeAttribute(s.name), r.removedAttributes += 1;
|
|
430
410
|
return;
|
|
431
411
|
}
|
|
432
|
-
|
|
412
|
+
c !== i && e.setAttribute(s.name, c);
|
|
433
413
|
}
|
|
434
414
|
}), n === "a") {
|
|
435
415
|
if (!e.getAttribute("href")) {
|
|
@@ -465,37 +445,35 @@ function Ke(e, t, a, r, n) {
|
|
|
465
445
|
};
|
|
466
446
|
if (r.removeComments)
|
|
467
447
|
try {
|
|
468
|
-
const f = document.createTreeWalker(o.content, Ee, null),
|
|
469
|
-
let
|
|
470
|
-
for (;
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
448
|
+
const f = document.createTreeWalker(o.content, Ee, null), b = [];
|
|
449
|
+
let k = f.nextNode();
|
|
450
|
+
for (; k; )
|
|
451
|
+
b.push(k), k = f.nextNode();
|
|
452
|
+
b.forEach((v) => {
|
|
453
|
+
v.remove(), s.removedComments += 1;
|
|
474
454
|
});
|
|
475
455
|
} catch {
|
|
476
456
|
}
|
|
477
457
|
Array.from(o.content.querySelectorAll("*")).forEach((f) => {
|
|
478
|
-
f.isConnected &&
|
|
458
|
+
f.isConnected && We(f, t, a, s);
|
|
479
459
|
});
|
|
480
|
-
let
|
|
481
|
-
r.normalizeWhitespace && n !== "fidelity" ?
|
|
482
|
-
const
|
|
460
|
+
let i = o.innerHTML;
|
|
461
|
+
r.normalizeWhitespace && n !== "fidelity" ? i = i.replace(/\s{2,}/g, " ").replace(/>\s+</g, "><").trim() : r.normalizeWhitespace && (i = i.trim());
|
|
462
|
+
const c = (o.content.textContent || "").trim().length;
|
|
483
463
|
return {
|
|
484
|
-
html:
|
|
485
|
-
textLength:
|
|
464
|
+
html: i,
|
|
465
|
+
textLength: c,
|
|
486
466
|
counters: s
|
|
487
467
|
};
|
|
488
468
|
}
|
|
489
469
|
function ge(e) {
|
|
490
470
|
const t = window.getSelection();
|
|
491
|
-
if (!t || t.rangeCount === 0)
|
|
492
|
-
return null;
|
|
471
|
+
if (!t || t.rangeCount === 0) return null;
|
|
493
472
|
const a = t.getRangeAt(0);
|
|
494
473
|
return e.contains(a.commonAncestorContainer) ? a : null;
|
|
495
474
|
}
|
|
496
475
|
function he(e, t) {
|
|
497
|
-
if (!e.isConnected)
|
|
498
|
-
return;
|
|
476
|
+
if (!e.isConnected) return;
|
|
499
477
|
const a = window.getSelection();
|
|
500
478
|
a && (a.removeAllRanges(), a.addRange(t));
|
|
501
479
|
}
|
|
@@ -507,8 +485,7 @@ function Ve(e, t) {
|
|
|
507
485
|
} catch {
|
|
508
486
|
}
|
|
509
487
|
const a = ge(e);
|
|
510
|
-
if (!a)
|
|
511
|
-
return !1;
|
|
488
|
+
if (!a) return !1;
|
|
512
489
|
a.deleteContents();
|
|
513
490
|
const r = document.createElement("template");
|
|
514
491
|
r.innerHTML = t;
|
|
@@ -527,8 +504,7 @@ function je(e, t) {
|
|
|
527
504
|
} catch {
|
|
528
505
|
}
|
|
529
506
|
const a = ge(e);
|
|
530
|
-
if (!a)
|
|
531
|
-
return !1;
|
|
507
|
+
if (!a) return !1;
|
|
532
508
|
a.deleteContents();
|
|
533
509
|
const r = document.createTextNode(t);
|
|
534
510
|
a.insertNode(r);
|
|
@@ -536,8 +512,7 @@ function je(e, t) {
|
|
|
536
512
|
return n.setStart(r, r.length), n.collapse(!0), he(e, n), !0;
|
|
537
513
|
}
|
|
538
514
|
function Fe(e, t) {
|
|
539
|
-
if (t === e.innerHTML)
|
|
540
|
-
return;
|
|
515
|
+
if (t === e.innerHTML) return;
|
|
541
516
|
const a = window.execEditorCommand || window.executeEditorCommand;
|
|
542
517
|
if (typeof a == "function")
|
|
543
518
|
try {
|
|
@@ -548,7 +523,7 @@ function Fe(e, t) {
|
|
|
548
523
|
function Ge(e) {
|
|
549
524
|
e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
550
525
|
}
|
|
551
|
-
function
|
|
526
|
+
function W(e, t, a, r, n, o) {
|
|
552
527
|
return {
|
|
553
528
|
source: e,
|
|
554
529
|
profile: t,
|
|
@@ -565,16 +540,16 @@ function K(e, t, a, r, n, o) {
|
|
|
565
540
|
function Ue(e, t, a, r) {
|
|
566
541
|
const n = qe(e, t);
|
|
567
542
|
if (a === "plain") {
|
|
568
|
-
const l = t || e.replace(/<[^>]*>/g, " "),
|
|
543
|
+
const l = t || e.replace(/<[^>]*>/g, " "), i = J(l, r);
|
|
569
544
|
return {
|
|
570
545
|
mode: "text",
|
|
571
|
-
value:
|
|
572
|
-
report:
|
|
546
|
+
value: i,
|
|
547
|
+
report: W(
|
|
573
548
|
n,
|
|
574
549
|
a,
|
|
575
550
|
e.length,
|
|
576
551
|
0,
|
|
577
|
-
|
|
552
|
+
i.length,
|
|
578
553
|
{
|
|
579
554
|
removedElements: 0,
|
|
580
555
|
removedAttributes: 0,
|
|
@@ -589,7 +564,7 @@ function Ue(e, t, a, r) {
|
|
|
589
564
|
return {
|
|
590
565
|
mode: "text",
|
|
591
566
|
value: l,
|
|
592
|
-
report:
|
|
567
|
+
report: W(
|
|
593
568
|
n,
|
|
594
569
|
a,
|
|
595
570
|
e.length,
|
|
@@ -610,13 +585,13 @@ function Ue(e, t, a, r) {
|
|
|
610
585
|
return {
|
|
611
586
|
mode: "text",
|
|
612
587
|
value: l,
|
|
613
|
-
report:
|
|
588
|
+
report: W(n, a, e.length, 0, l.length, s.counters)
|
|
614
589
|
};
|
|
615
590
|
}
|
|
616
591
|
return {
|
|
617
592
|
mode: "html",
|
|
618
593
|
value: s.html,
|
|
619
|
-
report:
|
|
594
|
+
report: W(
|
|
620
595
|
n,
|
|
621
596
|
a,
|
|
622
597
|
e.length,
|
|
@@ -626,7 +601,7 @@ function Ue(e, t, a, r) {
|
|
|
626
601
|
)
|
|
627
602
|
};
|
|
628
603
|
}
|
|
629
|
-
function
|
|
604
|
+
function G(e, t) {
|
|
630
605
|
return e === "balanced" ? t.balancedText : e === "plain" ? t.plainText : t.fidelityText;
|
|
631
606
|
}
|
|
632
607
|
function ae(e) {
|
|
@@ -649,67 +624,64 @@ function Ye(e, t) {
|
|
|
649
624
|
s && (s.textContent = t.labels.profileLabel);
|
|
650
625
|
const l = e.querySelector('.rte-smart-paste-profile[role="group"]');
|
|
651
626
|
l && l.setAttribute("aria-label", t.labels.profileLabel);
|
|
652
|
-
const
|
|
653
|
-
|
|
654
|
-
const
|
|
655
|
-
|
|
627
|
+
const i = e.querySelector('[data-action="set-profile"][data-profile="fidelity"]');
|
|
628
|
+
i && (i.textContent = t.labels.fidelityText);
|
|
629
|
+
const c = e.querySelector('[data-action="set-profile"][data-profile="balanced"]');
|
|
630
|
+
c && (c.textContent = t.labels.balancedText);
|
|
656
631
|
const f = e.querySelector('[data-action="set-profile"][data-profile="plain"]');
|
|
657
632
|
f && (f.textContent = t.labels.plainText);
|
|
658
|
-
const
|
|
659
|
-
|
|
660
|
-
const
|
|
661
|
-
|
|
662
|
-
const
|
|
663
|
-
|
|
664
|
-
const
|
|
665
|
-
|
|
666
|
-
const
|
|
667
|
-
|
|
633
|
+
const b = e.querySelector(".rte-smart-paste-report-title");
|
|
634
|
+
b && (b.textContent = t.labels.lastPasteHeading);
|
|
635
|
+
const k = e.querySelector(".rte-smart-paste-empty");
|
|
636
|
+
k && (k.textContent = t.labels.lastPasteEmptyText);
|
|
637
|
+
const v = e.querySelector('[data-key="source-label"]');
|
|
638
|
+
v && (v.textContent = t.labels.lastPasteSourceLabel);
|
|
639
|
+
const U = e.querySelector('[data-key="profile-label"]');
|
|
640
|
+
U && (U.textContent = t.labels.lastPasteProfileLabel);
|
|
641
|
+
const M = e.querySelector('[data-key="removed-label"]');
|
|
642
|
+
M && (M.textContent = t.labels.lastPasteRemovedLabel);
|
|
668
643
|
const oe = e.querySelector('[data-key="chars-label"]');
|
|
669
644
|
oe && (oe.textContent = t.labels.lastPasteCharsLabel);
|
|
670
645
|
const ne = e.querySelector(".rte-smart-paste-shortcut");
|
|
671
646
|
ne && (ne.textContent = t.labels.shortcutText);
|
|
672
647
|
}
|
|
673
|
-
function
|
|
674
|
-
const t =
|
|
675
|
-
if (!t || !a || !r)
|
|
676
|
-
return;
|
|
648
|
+
function x(e) {
|
|
649
|
+
const t = g.get(e), a = d.get(e) || $, r = L.get(e);
|
|
650
|
+
if (!t || !a || !r) return;
|
|
677
651
|
Ye(t, a);
|
|
678
652
|
const n = t.querySelector(".rte-smart-paste-status");
|
|
679
653
|
n && (n.textContent = r.enabled ? a.labels.enabledText : a.labels.disabledText);
|
|
680
654
|
const o = t.querySelector('[data-action="toggle-enabled"]');
|
|
681
655
|
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(
|
|
682
656
|
t.querySelectorAll('[data-action="set-profile"][data-profile]')
|
|
683
|
-
).forEach((
|
|
684
|
-
const
|
|
685
|
-
|
|
657
|
+
).forEach((v) => {
|
|
658
|
+
const M = _(v.getAttribute("data-profile")) === r.profile;
|
|
659
|
+
v.classList.toggle("active", M), v.setAttribute("aria-pressed", M ? "true" : "false");
|
|
686
660
|
});
|
|
687
|
-
const l = t.querySelector(".rte-smart-paste-empty"),
|
|
661
|
+
const l = t.querySelector(".rte-smart-paste-empty"), i = t.querySelector(".rte-smart-paste-report"), c = t.querySelector('[data-key="source-value"]'), f = t.querySelector('[data-key="profile-value"]'), b = t.querySelector('[data-key="removed-value"]'), k = t.querySelector('[data-key="chars-value"]');
|
|
688
662
|
if (!r.lastReport) {
|
|
689
|
-
l && (l.hidden = !1),
|
|
663
|
+
l && (l.hidden = !1), i && (i.hidden = !0);
|
|
690
664
|
return;
|
|
691
665
|
}
|
|
692
|
-
if (l && (l.hidden = !0),
|
|
693
|
-
const
|
|
694
|
-
|
|
666
|
+
if (l && (l.hidden = !0), i && (i.hidden = !1), c && (c.textContent = r.lastReport.source), f && (f.textContent = G(r.lastReport.profile, a.labels)), b) {
|
|
667
|
+
const v = r.lastReport.removedElements + r.lastReport.removedAttributes + r.lastReport.removedComments + r.lastReport.normalizedStyles;
|
|
668
|
+
b.textContent = String(v);
|
|
695
669
|
}
|
|
696
|
-
|
|
670
|
+
k && (k.textContent = String(r.lastReport.outputTextLength));
|
|
697
671
|
}
|
|
698
672
|
function Q(e, t) {
|
|
699
|
-
if (!t.classList.contains("show"))
|
|
700
|
-
return;
|
|
673
|
+
if (!t.classList.contains("show")) return;
|
|
701
674
|
const a = te(e).getBoundingClientRect(), r = Math.min(window.innerWidth - 20, 360), n = Math.max(10, window.innerWidth - r - 10), o = Math.min(Math.max(10, a.right - r), n), s = Math.max(10, Math.min(window.innerHeight - 10, a.top + 12));
|
|
702
675
|
t.style.width = `${r}px`, t.style.left = `${o}px`, t.style.top = `${s}px`, t.style.maxHeight = `${Math.max(240, window.innerHeight - 20)}px`;
|
|
703
676
|
}
|
|
704
|
-
function
|
|
705
|
-
const a =
|
|
706
|
-
a && (a.classList.remove("show"),
|
|
677
|
+
function N(e, t = !1) {
|
|
678
|
+
const a = g.get(e);
|
|
679
|
+
a && (a.classList.remove("show"), q.set(e, !1), D(e, "toggleSmartPastePanel", !1), t && e.focus({ preventScroll: !0 }));
|
|
707
680
|
}
|
|
708
681
|
function Xe(e) {
|
|
709
|
-
const t =
|
|
710
|
-
if (t)
|
|
711
|
-
|
|
712
|
-
const a = d.get(e) || O || V(), r = `rte-smart-paste-panel-${$e++}`, n = document.createElement("section");
|
|
682
|
+
const t = g.get(e);
|
|
683
|
+
if (t) return t;
|
|
684
|
+
const a = d.get(e) || $ || K(), r = `rte-smart-paste-panel-${$e++}`, n = document.createElement("section");
|
|
713
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 = `
|
|
714
686
|
<header class="rte-smart-paste-header">
|
|
715
687
|
<h2 class="rte-smart-paste-title">${X(a.labels.panelTitle)}</h2>
|
|
@@ -743,60 +715,54 @@ function Xe(e) {
|
|
|
743
715
|
</div>
|
|
744
716
|
<div class="rte-smart-paste-live" aria-live="polite" aria-atomic="true"></div>
|
|
745
717
|
`, n.addEventListener("click", (o) => {
|
|
746
|
-
const
|
|
747
|
-
if (!l)
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
q(e, !0);
|
|
718
|
+
const l = o.target?.closest("[data-action]");
|
|
719
|
+
if (!l) return;
|
|
720
|
+
const i = l.getAttribute("data-action");
|
|
721
|
+
if (i) {
|
|
722
|
+
if (i === "close") {
|
|
723
|
+
N(e, !0);
|
|
753
724
|
return;
|
|
754
725
|
}
|
|
755
|
-
if (
|
|
756
|
-
const
|
|
757
|
-
|
|
726
|
+
if (i === "toggle-enabled") {
|
|
727
|
+
const c = p(e, d.get(e) || a);
|
|
728
|
+
c.enabled = !c.enabled, D(e, "toggleSmartPasteEnabled", c.enabled), x(e), O(n, c.enabled ? a.labels.enabledText : a.labels.disabledText);
|
|
758
729
|
return;
|
|
759
730
|
}
|
|
760
|
-
if (
|
|
761
|
-
const
|
|
762
|
-
|
|
731
|
+
if (i === "cycle-profile") {
|
|
732
|
+
const c = p(e, d.get(e) || a);
|
|
733
|
+
c.profile = ae(c.profile), x(e), O(n, `${a.labels.profileLabel}: ${G(c.profile, a.labels)}`);
|
|
763
734
|
return;
|
|
764
735
|
}
|
|
765
|
-
if (
|
|
766
|
-
const
|
|
767
|
-
|
|
736
|
+
if (i === "set-profile") {
|
|
737
|
+
const c = p(e, d.get(e) || a);
|
|
738
|
+
c.profile = _(l.getAttribute("data-profile")), x(e), O(n, `${a.labels.profileLabel}: ${G(c.profile, a.labels)}`);
|
|
768
739
|
}
|
|
769
740
|
}
|
|
770
741
|
}), n.addEventListener("keydown", (o) => {
|
|
771
742
|
if (o.key === "Escape") {
|
|
772
|
-
o.preventDefault(),
|
|
743
|
+
o.preventDefault(), N(e, !0);
|
|
773
744
|
return;
|
|
774
745
|
}
|
|
775
|
-
if (o.key !== "ArrowRight" && o.key !== "ArrowLeft")
|
|
776
|
-
return;
|
|
746
|
+
if (o.key !== "ArrowRight" && o.key !== "ArrowLeft") return;
|
|
777
747
|
const s = Array.from(
|
|
778
748
|
n.querySelectorAll('[data-action="set-profile"][data-profile]')
|
|
779
749
|
);
|
|
780
|
-
if (s.length === 0)
|
|
781
|
-
return;
|
|
750
|
+
if (s.length === 0) return;
|
|
782
751
|
const l = s.findIndex((f) => f === document.activeElement);
|
|
783
|
-
if (l < 0)
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
}), G(n, e), document.body.appendChild(n), h.set(e, n), I.set(e, !1), S(e), n;
|
|
752
|
+
if (l < 0) return;
|
|
753
|
+
const i = o.key === "ArrowRight" ? 1 : -1, c = (l + i + s.length) % s.length;
|
|
754
|
+
o.preventDefault(), s[c].focus();
|
|
755
|
+
}), F(n, e), document.body.appendChild(n), g.set(e, n), q.set(e, !1), x(e), n;
|
|
788
756
|
}
|
|
789
757
|
function ye(e) {
|
|
790
758
|
const t = Xe(e);
|
|
791
|
-
|
|
792
|
-
n !== e &&
|
|
793
|
-
}), t.classList.add("show"),
|
|
794
|
-
const a = t.querySelector('[data-action="toggle-enabled"]');
|
|
795
|
-
a == null || a.focus();
|
|
759
|
+
g.forEach((r, n) => {
|
|
760
|
+
n !== e && N(n, !1);
|
|
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();
|
|
796
762
|
}
|
|
797
763
|
function xe(e, t) {
|
|
798
764
|
const a = re(e);
|
|
799
|
-
return (typeof t == "boolean" ? t : !a) ? ye(e) :
|
|
765
|
+
return (typeof t == "boolean" ? t : !a) ? ye(e) : N(e, !1), !0;
|
|
800
766
|
}
|
|
801
767
|
function ve(e) {
|
|
802
768
|
return {
|
|
@@ -806,56 +772,50 @@ function ve(e) {
|
|
|
806
772
|
};
|
|
807
773
|
}
|
|
808
774
|
function Ze(e, t) {
|
|
809
|
-
const a = d.get(e) ||
|
|
810
|
-
if (!a)
|
|
811
|
-
|
|
812
|
-
const r = m(e, a);
|
|
775
|
+
const a = d.get(e) || $;
|
|
776
|
+
if (!a) return !1;
|
|
777
|
+
const r = p(e, a);
|
|
813
778
|
if (!r.enabled || de(e)) {
|
|
814
|
-
const
|
|
815
|
-
return
|
|
779
|
+
const b = g.get(e);
|
|
780
|
+
return b && de(e) && O(b, a.labels.readonlyMessage), !1;
|
|
816
781
|
}
|
|
817
782
|
const n = t.clipboardData;
|
|
818
|
-
if (!n)
|
|
819
|
-
return !1;
|
|
783
|
+
if (!n) return !1;
|
|
820
784
|
const o = n.getData("text/html") || "", s = n.getData("text/plain") || "";
|
|
821
|
-
if (!o && !s)
|
|
822
|
-
return !1;
|
|
785
|
+
if (!o && !s) return !1;
|
|
823
786
|
const l = Ue(o, s, r.profile, a);
|
|
824
|
-
if (!l.value)
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
return !1;
|
|
829
|
-
r.lastReport = { ...l.report }, M.set(e, r), Fe(e, c), Ge(e), e.dispatchEvent(
|
|
787
|
+
if (!l.value) return !1;
|
|
788
|
+
const i = e.innerHTML;
|
|
789
|
+
if (!(l.mode === "html" ? Ve(e, l.value) : je(e, l.value))) return !1;
|
|
790
|
+
r.lastReport = { ...l.report }, L.set(e, r), Fe(e, i), Ge(e), e.dispatchEvent(
|
|
830
791
|
new CustomEvent("editora:smart-paste", {
|
|
831
792
|
bubbles: !0,
|
|
832
793
|
detail: ve(r)
|
|
833
794
|
})
|
|
834
|
-
),
|
|
835
|
-
const f =
|
|
795
|
+
), x(e);
|
|
796
|
+
const f = g.get(e);
|
|
836
797
|
if (f) {
|
|
837
|
-
const
|
|
838
|
-
|
|
798
|
+
const b = l.report.removedElements + l.report.removedAttributes + l.report.removedComments + l.report.normalizedStyles;
|
|
799
|
+
O(
|
|
839
800
|
f,
|
|
840
|
-
`${a.labels.panelTitle}: ${
|
|
801
|
+
`${a.labels.panelTitle}: ${G(r.profile, a.labels)}. ${a.labels.lastPasteRemovedLabel}: ${b}.`
|
|
841
802
|
);
|
|
842
803
|
}
|
|
843
804
|
return !0;
|
|
844
805
|
}
|
|
845
806
|
function Je(e) {
|
|
846
807
|
return (t) => {
|
|
847
|
-
t.defaultPrevented || t[ie] === !0 || (
|
|
808
|
+
t.defaultPrevented || t[ie] === !0 || (m = e, !Ze(e, t)) || (t[ie] = !0, t.preventDefault(), typeof t.stopImmediatePropagation == "function" ? t.stopImmediatePropagation() : t.stopPropagation());
|
|
848
809
|
};
|
|
849
810
|
}
|
|
850
811
|
function Qe(e) {
|
|
851
|
-
if (
|
|
852
|
-
return;
|
|
812
|
+
if (j.has(e)) return;
|
|
853
813
|
const t = Je(e);
|
|
854
|
-
e.addEventListener("paste", t, !0),
|
|
814
|
+
e.addEventListener("paste", t, !0), j.set(e, t);
|
|
855
815
|
}
|
|
856
|
-
function
|
|
857
|
-
const t =
|
|
858
|
-
|
|
816
|
+
function R(e) {
|
|
817
|
+
const t = L.get(e);
|
|
818
|
+
D(e, "toggleSmartPastePanel", re(e)), D(e, "toggleSmartPasteEnabled", t?.enabled === !0);
|
|
859
819
|
}
|
|
860
820
|
function et(e) {
|
|
861
821
|
const t = e.key.toLowerCase();
|
|
@@ -870,27 +830,21 @@ function rt(e) {
|
|
|
870
830
|
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "g";
|
|
871
831
|
}
|
|
872
832
|
function at(e) {
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
const
|
|
876
|
-
if (!r)
|
|
877
|
-
return;
|
|
833
|
+
$ = e, A || (A = (t) => {
|
|
834
|
+
V();
|
|
835
|
+
const r = t.target?.closest(y);
|
|
836
|
+
if (!r) return;
|
|
878
837
|
const n = d.get(r) || e;
|
|
879
|
-
|
|
880
|
-
const o =
|
|
881
|
-
o && (
|
|
882
|
-
}, document.addEventListener("focusin",
|
|
883
|
-
if (t.defaultPrevented)
|
|
884
|
-
return;
|
|
885
|
-
const a = t.target;
|
|
886
|
-
if (a != null && a.closest(`.${u} input, .${u} textarea, .${u} select`))
|
|
887
|
-
return;
|
|
838
|
+
p(r, n), d.set(r, n), m = r, R(r);
|
|
839
|
+
const o = g.get(r);
|
|
840
|
+
o && (F(o, r), Q(r, o), x(r));
|
|
841
|
+
}, document.addEventListener("focusin", A, !0)), P || (P = (t) => {
|
|
842
|
+
if (t.defaultPrevented || t.target?.closest(`.${u} input, .${u} textarea, .${u} select`)) return;
|
|
888
843
|
const r = ze(t);
|
|
889
|
-
if (!r)
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
t.preventDefault(), q(r, !0);
|
|
844
|
+
if (!r) return;
|
|
845
|
+
const n = d.get(r) || $ || e;
|
|
846
|
+
if (p(r, n), d.set(r, n), m = r, t.key === "Escape" && re(r)) {
|
|
847
|
+
t.preventDefault(), N(r, !0);
|
|
894
848
|
return;
|
|
895
849
|
}
|
|
896
850
|
if (et(t)) {
|
|
@@ -899,57 +853,56 @@ function at(e) {
|
|
|
899
853
|
}
|
|
900
854
|
if (tt(t)) {
|
|
901
855
|
t.preventDefault(), t.stopPropagation();
|
|
902
|
-
const o =
|
|
903
|
-
o.profile = ae(o.profile),
|
|
856
|
+
const o = p(r, n);
|
|
857
|
+
o.profile = ae(o.profile), x(r);
|
|
904
858
|
return;
|
|
905
859
|
}
|
|
906
860
|
if (rt(t)) {
|
|
907
861
|
t.preventDefault(), t.stopPropagation();
|
|
908
|
-
const o =
|
|
909
|
-
o.enabled = !o.enabled,
|
|
862
|
+
const o = p(r, n);
|
|
863
|
+
o.enabled = !o.enabled, R(r), x(r);
|
|
910
864
|
}
|
|
911
|
-
}, document.addEventListener("keydown",
|
|
912
|
-
|
|
913
|
-
!a.isConnected || !t.isConnected || (
|
|
865
|
+
}, document.addEventListener("keydown", P, !0)), T || (T = () => {
|
|
866
|
+
V(), g.forEach((t, a) => {
|
|
867
|
+
!a.isConnected || !t.isConnected || (F(t, a), Q(a, t));
|
|
914
868
|
});
|
|
915
|
-
}, window.addEventListener("scroll",
|
|
916
|
-
He(t) &&
|
|
917
|
-
}),
|
|
869
|
+
}, window.addEventListener("scroll", T, !0), window.addEventListener("resize", T)), !w && typeof MutationObserver < "u" && document.body && (w = new MutationObserver((t) => {
|
|
870
|
+
He(t) && V();
|
|
871
|
+
}), w.observe(document.body, {
|
|
918
872
|
childList: !0,
|
|
919
873
|
subtree: !0
|
|
920
874
|
}));
|
|
921
875
|
}
|
|
922
876
|
function ot() {
|
|
923
|
-
|
|
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;
|
|
924
878
|
}
|
|
925
879
|
function nt() {
|
|
926
|
-
if (typeof document > "u" || document.getElementById(le))
|
|
927
|
-
return;
|
|
880
|
+
if (typeof document > "u" || document.getElementById(le)) return;
|
|
928
881
|
const e = document.createElement("style");
|
|
929
882
|
e.id = le, e.textContent = `
|
|
930
|
-
.rte-toolbar-group-items.${
|
|
931
|
-
.editora-toolbar-group-items.${
|
|
932
|
-
.rte-toolbar-group-items.${
|
|
933
|
-
.editora-toolbar-group-items.${
|
|
883
|
+
.rte-toolbar-group-items.${h},
|
|
884
|
+
.editora-toolbar-group-items.${h},
|
|
885
|
+
.rte-toolbar-group-items.${S},
|
|
886
|
+
.editora-toolbar-group-items.${S} {
|
|
934
887
|
display: flex;
|
|
935
888
|
border: 1px solid #ccc;
|
|
936
889
|
border-radius: 3px;
|
|
937
890
|
background: #fff;
|
|
938
891
|
}
|
|
939
892
|
|
|
940
|
-
.rte-toolbar-group-items.${
|
|
941
|
-
.editora-toolbar-group-items.${
|
|
942
|
-
.rte-toolbar-group-items.${
|
|
943
|
-
.editora-toolbar-group-items.${
|
|
893
|
+
.rte-toolbar-group-items.${h} .rte-toolbar-button,
|
|
894
|
+
.editora-toolbar-group-items.${h} .editora-toolbar-button,
|
|
895
|
+
.rte-toolbar-group-items.${S} .rte-toolbar-button,
|
|
896
|
+
.editora-toolbar-group-items.${S} .editora-toolbar-button {
|
|
944
897
|
border: none;
|
|
945
898
|
border-right: 1px solid #ccc;
|
|
946
899
|
border-radius: 0;
|
|
947
900
|
}
|
|
948
901
|
|
|
949
|
-
.rte-toolbar-group-items.${
|
|
950
|
-
.editora-toolbar-group-items.${
|
|
951
|
-
.rte-toolbar-group-items.${
|
|
952
|
-
.editora-toolbar-group-items.${
|
|
902
|
+
.rte-toolbar-group-items.${h} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
903
|
+
.editora-toolbar-group-items.${h} .editora-toolbar-item:last-child .editora-toolbar-button,
|
|
904
|
+
.rte-toolbar-group-items.${S} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
905
|
+
.editora-toolbar-group-items.${S} .editora-toolbar-item:last-child .editora-toolbar-button {
|
|
953
906
|
border-right: none;
|
|
954
907
|
}
|
|
955
908
|
|
|
@@ -958,23 +911,23 @@ function nt() {
|
|
|
958
911
|
background-color: #ccc;
|
|
959
912
|
}
|
|
960
913
|
|
|
961
|
-
${
|
|
962
|
-
${
|
|
963
|
-
${
|
|
964
|
-
${
|
|
914
|
+
${E} .rte-toolbar-group-items.${h},
|
|
915
|
+
${E} .editora-toolbar-group-items.${h},
|
|
916
|
+
${E} .rte-toolbar-group-items.${S},
|
|
917
|
+
${E} .editora-toolbar-group-items.${S},
|
|
965
918
|
.${u}.rte-smart-paste-theme-dark {
|
|
966
919
|
border-color: #566275;
|
|
967
920
|
}
|
|
968
921
|
|
|
969
|
-
${
|
|
970
|
-
${
|
|
971
|
-
${
|
|
972
|
-
${
|
|
922
|
+
${E} .rte-toolbar-group-items.${h} .rte-toolbar-button svg,
|
|
923
|
+
${E} .editora-toolbar-group-items.${h} .editora-toolbar-button svg,
|
|
924
|
+
${E} .rte-toolbar-group-items.${S} .rte-toolbar-button svg,
|
|
925
|
+
${E} .editora-toolbar-group-items.${S} .editora-toolbar-button svg {
|
|
973
926
|
fill: none;
|
|
974
927
|
}
|
|
975
928
|
|
|
976
|
-
${
|
|
977
|
-
${
|
|
929
|
+
${E} .rte-toolbar-group-items.${h} .rte-toolbar-button,
|
|
930
|
+
${E} .editora-toolbar-group-items.${h} .editora-toolbar-button
|
|
978
931
|
{
|
|
979
932
|
border-color: #566275;
|
|
980
933
|
}
|
|
@@ -1289,7 +1242,7 @@ function nt() {
|
|
|
1289
1242
|
`, document.head.appendChild(e);
|
|
1290
1243
|
}
|
|
1291
1244
|
const st = (e = {}) => {
|
|
1292
|
-
const t =
|
|
1245
|
+
const t = K(e), a = /* @__PURE__ */ new Set();
|
|
1293
1246
|
return nt(), {
|
|
1294
1247
|
name: "smartPaste",
|
|
1295
1248
|
toolbar: [
|
|
@@ -1325,46 +1278,39 @@ const st = (e = {}) => {
|
|
|
1325
1278
|
],
|
|
1326
1279
|
commands: {
|
|
1327
1280
|
smartPaste: (r, n) => {
|
|
1328
|
-
const o =
|
|
1329
|
-
if (!o)
|
|
1330
|
-
return !1;
|
|
1281
|
+
const o = C(n, !1, !1);
|
|
1282
|
+
if (!o) return !1;
|
|
1331
1283
|
const s = d.get(o) || t;
|
|
1332
|
-
return
|
|
1284
|
+
return p(o, s), d.set(o, s), m = o, ye(o), !0;
|
|
1333
1285
|
},
|
|
1334
1286
|
toggleSmartPastePanel: (r, n) => {
|
|
1335
|
-
const o =
|
|
1336
|
-
if (!o)
|
|
1337
|
-
return !1;
|
|
1287
|
+
const o = C(n, !1, !1);
|
|
1288
|
+
if (!o) return !1;
|
|
1338
1289
|
const s = d.get(o) || t;
|
|
1339
|
-
return
|
|
1290
|
+
return p(o, s), d.set(o, s), m = o, xe(o, typeof r == "boolean" ? r : void 0);
|
|
1340
1291
|
},
|
|
1341
1292
|
cycleSmartPasteProfile: (r, n) => {
|
|
1342
|
-
const o =
|
|
1343
|
-
if (!o)
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
return d.set(o, s), l.profile = ae(l.profile), S(o), !0;
|
|
1293
|
+
const o = C(n, !1, !1);
|
|
1294
|
+
if (!o) return !1;
|
|
1295
|
+
const s = d.get(o) || t, l = p(o, s);
|
|
1296
|
+
return d.set(o, s), l.profile = ae(l.profile), x(o), !0;
|
|
1347
1297
|
},
|
|
1348
1298
|
setSmartPasteProfile: (r, n) => {
|
|
1349
|
-
const o =
|
|
1350
|
-
if (!o)
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
return d.set(o, s), l.profile = H(r), S(o), !0;
|
|
1299
|
+
const o = C(n, !1, !1);
|
|
1300
|
+
if (!o) return !1;
|
|
1301
|
+
const s = d.get(o) || t, l = p(o, s);
|
|
1302
|
+
return d.set(o, s), l.profile = _(r), x(o), !0;
|
|
1354
1303
|
},
|
|
1355
1304
|
toggleSmartPasteEnabled: (r, n) => {
|
|
1356
|
-
const o =
|
|
1357
|
-
if (!o)
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
return d.set(o, s), l.enabled = typeof r == "boolean" ? r : !l.enabled, z(o), S(o), !0;
|
|
1305
|
+
const o = C(n, !1, !1);
|
|
1306
|
+
if (!o) return !1;
|
|
1307
|
+
const s = d.get(o) || t, l = p(o, s);
|
|
1308
|
+
return d.set(o, s), l.enabled = typeof r == "boolean" ? r : !l.enabled, R(o), x(o), !0;
|
|
1361
1309
|
},
|
|
1362
1310
|
setSmartPasteOptions: (r, n) => {
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
return !1;
|
|
1367
|
-
const s = d.get(o) || t, l = ce(s), c = V({
|
|
1311
|
+
const o = C(n, !1, !1);
|
|
1312
|
+
if (!o || !r || typeof r != "object") return !1;
|
|
1313
|
+
const s = d.get(o) || t, l = ce(s), i = K({
|
|
1368
1314
|
...l,
|
|
1369
1315
|
...r,
|
|
1370
1316
|
labels: {
|
|
@@ -1375,38 +1321,37 @@ const st = (e = {}) => {
|
|
|
1375
1321
|
...l.profileOptions,
|
|
1376
1322
|
...r.profileOptions || {},
|
|
1377
1323
|
fidelity: {
|
|
1378
|
-
...
|
|
1379
|
-
...
|
|
1324
|
+
...l.profileOptions?.fidelity || {},
|
|
1325
|
+
...r.profileOptions?.fidelity || {}
|
|
1380
1326
|
},
|
|
1381
1327
|
balanced: {
|
|
1382
|
-
...
|
|
1383
|
-
...
|
|
1328
|
+
...l.profileOptions?.balanced || {},
|
|
1329
|
+
...r.profileOptions?.balanced || {}
|
|
1384
1330
|
},
|
|
1385
1331
|
plain: {
|
|
1386
|
-
...
|
|
1387
|
-
...
|
|
1332
|
+
...l.profileOptions?.plain || {},
|
|
1333
|
+
...r.profileOptions?.plain || {}
|
|
1388
1334
|
}
|
|
1389
1335
|
},
|
|
1390
1336
|
normalizeText: r.normalizeText || s.normalizeText
|
|
1391
1337
|
});
|
|
1392
|
-
d.set(o,
|
|
1393
|
-
const
|
|
1394
|
-
return typeof r.enabled == "boolean" && (
|
|
1338
|
+
d.set(o, i);
|
|
1339
|
+
const c = p(o, i);
|
|
1340
|
+
return typeof r.enabled == "boolean" && (c.enabled = r.enabled), r.defaultProfile && (c.profile = _(r.defaultProfile)), x(o), R(o), !0;
|
|
1395
1341
|
},
|
|
1396
1342
|
getSmartPasteState: (r, n) => {
|
|
1397
|
-
const o =
|
|
1398
|
-
if (!o)
|
|
1399
|
-
|
|
1400
|
-
const s = d.get(o) || t, l = m(o, s), c = ve(l);
|
|
1343
|
+
const o = C(n, !1, !1);
|
|
1344
|
+
if (!o) return !1;
|
|
1345
|
+
const s = d.get(o) || t, l = p(o, s), i = ve(l);
|
|
1401
1346
|
if (typeof r == "function")
|
|
1402
1347
|
try {
|
|
1403
|
-
r(
|
|
1348
|
+
r(i);
|
|
1404
1349
|
} catch {
|
|
1405
1350
|
}
|
|
1406
|
-
return o.__smartPasteState =
|
|
1351
|
+
return o.__smartPasteState = i, o.dispatchEvent(
|
|
1407
1352
|
new CustomEvent("editora:smart-paste-state", {
|
|
1408
1353
|
bubbles: !0,
|
|
1409
|
-
detail:
|
|
1354
|
+
detail: i
|
|
1410
1355
|
})
|
|
1411
1356
|
), !0;
|
|
1412
1357
|
}
|
|
@@ -1420,22 +1365,21 @@ const st = (e = {}) => {
|
|
|
1420
1365
|
"Mod-Alt-Shift-G": "toggleSmartPasteEnabled"
|
|
1421
1366
|
},
|
|
1422
1367
|
init: function(n) {
|
|
1423
|
-
|
|
1424
|
-
const o = this && typeof this.__pluginConfig == "object" ?
|
|
1368
|
+
I += 1;
|
|
1369
|
+
const o = this && typeof this.__pluginConfig == "object" ? K({ ...ce(t), ...this.__pluginConfig }) : t;
|
|
1425
1370
|
at(o);
|
|
1426
|
-
const s =
|
|
1427
|
-
n
|
|
1371
|
+
const s = C(
|
|
1372
|
+
n?.editorElement ? { editorElement: n.editorElement } : void 0,
|
|
1428
1373
|
!1,
|
|
1429
1374
|
!1
|
|
1430
1375
|
);
|
|
1431
|
-
if (!s)
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
l.enabled = o.enabled, l.profile = o.defaultProfile, d.set(s, o), z(s);
|
|
1376
|
+
if (!s) return;
|
|
1377
|
+
m = s, a.add(s);
|
|
1378
|
+
const l = p(s, o);
|
|
1379
|
+
l.enabled = o.enabled, l.profile = o.defaultProfile, d.set(s, o), R(s);
|
|
1436
1380
|
},
|
|
1437
1381
|
destroy: () => {
|
|
1438
|
-
a.forEach((r) => be(r)), a.clear(),
|
|
1382
|
+
a.forEach((r) => be(r)), a.clear(), I = Math.max(0, I - 1), !(I > 0) && ot();
|
|
1439
1383
|
}
|
|
1440
1384
|
};
|
|
1441
1385
|
};
|