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