@editora/core 1.0.6 → 1.0.8
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/LICENSE +21 -0
- package/dist/{AnchorPlugin.native-C1Rw5m04.mjs → AnchorPlugin.native-BcYGEtd9.mjs} +129 -105
- package/dist/ApprovalWorkflowPlugin.native-C3jtAYjG.mjs +1076 -0
- package/dist/{BackgroundColorPlugin.native-BE-p9DRd.mjs → BackgroundColorPlugin.native-50iAT9xU.mjs} +119 -122
- package/dist/BlocksLibraryPlugin.native-HMWKxWNs.mjs +1327 -0
- package/dist/CitationsPlugin.native-BnU0qCwR.mjs +1464 -0
- package/dist/CodePlugin.native-DlpTPdkd.mjs +2691 -0
- package/dist/{CommentsPlugin.native-tMnWn8a2.mjs → CommentsPlugin.native-DPSqTkiv.mjs} +153 -135
- package/dist/ConditionalContentPlugin.native-CfhY46rU.mjs +1367 -0
- package/dist/ContentRulesPlugin.native-nBLQ8QFZ.mjs +1099 -0
- package/dist/DataBindingPlugin.native-jQ1JPRTp.mjs +917 -0
- package/dist/DocSchemaPlugin.native-CHOge18O.mjs +1325 -0
- package/dist/{DocumentManagerPlugin.native-BvZL5CSG.mjs → DocumentManagerPlugin.native-C2cs_1w4.mjs} +43 -43
- package/dist/{EmbedIframePlugin.native-CSWIB1jm.mjs → EmbedIframePlugin.native-DKJx2OS7.mjs} +61 -58
- package/dist/{EmojisPlugin.native-DxTm_DL-.mjs → EmojisPlugin.native-CitxxlWX.mjs} +135 -104
- package/dist/{LinkPlugin.native-CS2g-G18.mjs → LinkPlugin.native-DYCIcdTm.mjs} +47 -45
- package/dist/{MathPlugin.native-KUxz0o8C.mjs → MathPlugin.native-f_mDp8VL.mjs} +149 -108
- package/dist/{MediaManagerPlugin.native-CgP5iInD.mjs → MediaManagerPlugin.native-BiXiK8FC.mjs} +238 -217
- package/dist/MentionPlugin.native-BMDlOqur.mjs +734 -0
- package/dist/MergeTagPlugin.native-C3eOfEgw.mjs +559 -0
- package/dist/PIIRedactionPlugin.native-DcsjmtV1.mjs +1396 -0
- package/dist/{PageBreakPlugin.native-CGiQxXqR.mjs → PageBreakPlugin.native-DijGuHJZ.mjs} +86 -77
- package/dist/{PreviewPlugin.native-DBvfpmIv.mjs → PreviewPlugin.native-WuIwOAOR.mjs} +30 -30
- package/dist/SlashCommandsPlugin.native-CmxvMEaE.mjs +755 -0
- package/dist/SmartPastePlugin.native-BOKKtF07.mjs +1398 -0
- package/dist/{SpecialCharactersPlugin.native-DANrbExJ.mjs → SpecialCharactersPlugin.native-CZDato89.mjs} +143 -98
- package/dist/{SpellCheckPlugin.native-C8bPvRHy.mjs → SpellCheckPlugin.native-BZB9AewP.mjs} +239 -219
- package/dist/{TemplatePlugin.native-4lKEm-WY.mjs → TemplatePlugin.native-CrpfKRJ8.mjs} +167 -143
- package/dist/{TextColorPlugin.native-Clgtb50j.mjs → TextColorPlugin.native-Bwl_bSmc.mjs} +134 -118
- package/dist/TrackChangesPlugin.native-Bghu2q4a.mjs +761 -0
- package/dist/TranslationWorkflowPlugin.native-Bz6jDGvj.mjs +1728 -0
- package/dist/VersionDiffPlugin.native-Bvxgy--t.mjs +776 -0
- package/dist/_commonjsHelpers-DOllISpa.mjs +32 -0
- package/dist/anchoredPopover-Bxds0VoB.mjs +110 -0
- package/dist/documentManager-vQ1VkbUY.mjs +8418 -0
- package/dist/editora.min.js +13 -13
- package/dist/editora.umd.js +13 -13
- package/dist/html2canvas.esm-AYkPY5LS.mjs +4803 -0
- package/dist/index-BslAFzmv.mjs +16544 -0
- package/dist/index-D1LOqg5C.js +10 -0
- package/dist/{index-OwnkG39N.mjs → index-DqC57IEH.mjs} +438 -328
- package/dist/index.cjs.js +1 -1
- package/dist/{index.es-CuicffkQ.mjs → index.es-BYD2KEo6.mjs} +5 -4
- package/dist/index.esm.js +2 -2
- package/dist/jspdf.es.min-BJGtOnRT.mjs +7890 -0
- package/dist/plugin-loader.js +77 -40
- package/dist/webcomponent-core.js +456 -346
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +87 -107
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +503 -356
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +6003 -658
- package/package.json +2 -2
- package/dist/CodePlugin.native-B263UI8O.mjs +0 -2173
- package/dist/MergeTagPlugin.native-DIGWhdnF.mjs +0 -419
- package/dist/colorSelectionApply-CK1My9N2.mjs +0 -67
- package/dist/documentManager-irzj9n3V.mjs +0 -37627
- package/dist/index-CqWQFb3D.js +0 -10
|
@@ -0,0 +1,1398 @@
|
|
|
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 != "undefined" ? NodeFilter.SHOW_COMMENT : 128, ie = "__editoraSmartPasteHandled", ke = /* @__PURE__ */ new Set([
|
|
2
|
+
"script",
|
|
3
|
+
"style",
|
|
4
|
+
"meta",
|
|
5
|
+
"link",
|
|
6
|
+
"object",
|
|
7
|
+
"embed",
|
|
8
|
+
"iframe",
|
|
9
|
+
"svg",
|
|
10
|
+
"canvas",
|
|
11
|
+
"math",
|
|
12
|
+
"form",
|
|
13
|
+
"input",
|
|
14
|
+
"button",
|
|
15
|
+
"textarea",
|
|
16
|
+
"select",
|
|
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, Le = /* @__PURE__ */ new Set([
|
|
19
|
+
"color",
|
|
20
|
+
"background-color",
|
|
21
|
+
"font-weight",
|
|
22
|
+
"font-style",
|
|
23
|
+
"text-decoration",
|
|
24
|
+
"text-align",
|
|
25
|
+
"font-size",
|
|
26
|
+
"font-family",
|
|
27
|
+
"line-height",
|
|
28
|
+
"letter-spacing",
|
|
29
|
+
"word-spacing",
|
|
30
|
+
"white-space",
|
|
31
|
+
"vertical-align",
|
|
32
|
+
"margin-left",
|
|
33
|
+
"margin-right",
|
|
34
|
+
"margin-top",
|
|
35
|
+
"margin-bottom",
|
|
36
|
+
"padding-left",
|
|
37
|
+
"padding-right",
|
|
38
|
+
"padding-top",
|
|
39
|
+
"padding-bottom",
|
|
40
|
+
"text-indent",
|
|
41
|
+
"border",
|
|
42
|
+
"border-top",
|
|
43
|
+
"border-right",
|
|
44
|
+
"border-bottom",
|
|
45
|
+
"border-left",
|
|
46
|
+
"border-color",
|
|
47
|
+
"border-width",
|
|
48
|
+
"border-style",
|
|
49
|
+
"list-style-type"
|
|
50
|
+
]), we = {
|
|
51
|
+
panelTitle: "Smart Paste",
|
|
52
|
+
panelAriaLabel: "Smart paste panel",
|
|
53
|
+
enabledText: "Smart paste is enabled",
|
|
54
|
+
disabledText: "Smart paste is disabled",
|
|
55
|
+
toggleOnText: "Disable Smart Paste",
|
|
56
|
+
toggleOffText: "Enable Smart Paste",
|
|
57
|
+
cycleProfileText: "Cycle Profile",
|
|
58
|
+
profileLabel: "Profile",
|
|
59
|
+
fidelityText: "Fidelity",
|
|
60
|
+
balancedText: "Balanced",
|
|
61
|
+
plainText: "Plain Text",
|
|
62
|
+
lastPasteHeading: "Last Paste Result",
|
|
63
|
+
lastPasteEmptyText: "Paste content to see cleanup metrics.",
|
|
64
|
+
lastPasteSourceLabel: "Source",
|
|
65
|
+
lastPasteProfileLabel: "Profile",
|
|
66
|
+
lastPasteRemovedLabel: "Removed",
|
|
67
|
+
lastPasteCharsLabel: "Output Chars",
|
|
68
|
+
closeText: "Close",
|
|
69
|
+
shortcutText: "Shortcuts: Ctrl/Cmd+Alt+Shift+S/V/G",
|
|
70
|
+
readonlyMessage: "Editor is read-only. Smart paste was skipped."
|
|
71
|
+
}, Y = {
|
|
72
|
+
fidelity: {
|
|
73
|
+
keepStyles: !0,
|
|
74
|
+
keepClasses: !1,
|
|
75
|
+
keepDataAttributes: !1,
|
|
76
|
+
preserveTables: !0
|
|
77
|
+
},
|
|
78
|
+
balanced: {
|
|
79
|
+
keepStyles: !1,
|
|
80
|
+
keepClasses: !1,
|
|
81
|
+
keepDataAttributes: !1,
|
|
82
|
+
preserveTables: !0
|
|
83
|
+
},
|
|
84
|
+
plain: {
|
|
85
|
+
keepStyles: !1,
|
|
86
|
+
keepClasses: !1,
|
|
87
|
+
keepDataAttributes: !1,
|
|
88
|
+
preserveTables: !1
|
|
89
|
+
}
|
|
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
|
+
function X(e) {
|
|
93
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
94
|
+
}
|
|
95
|
+
function Me(e) {
|
|
96
|
+
return e.replace(/\u00A0/g, " ").replace(/\r\n?/g, `
|
|
97
|
+
`);
|
|
98
|
+
}
|
|
99
|
+
function H(e) {
|
|
100
|
+
return e === "balanced" || e === "plain" ? e : "fidelity";
|
|
101
|
+
}
|
|
102
|
+
function Z(e, t) {
|
|
103
|
+
var a, r, n, o;
|
|
104
|
+
return {
|
|
105
|
+
keepStyles: (a = e == null ? void 0 : e.keepStyles) != null ? a : t.keepStyles,
|
|
106
|
+
keepClasses: (r = e == null ? void 0 : e.keepClasses) != null ? r : t.keepClasses,
|
|
107
|
+
keepDataAttributes: (n = e == null ? void 0 : e.keepDataAttributes) != null ? n : t.keepDataAttributes,
|
|
108
|
+
preserveTables: (o = e == null ? void 0 : e.preserveTables) != null ? o : t.preserveTables
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function V(e = {}) {
|
|
112
|
+
var a;
|
|
113
|
+
const t = e.profileOptions || {};
|
|
114
|
+
return {
|
|
115
|
+
enabled: e.enabled !== !1,
|
|
116
|
+
defaultProfile: H(e.defaultProfile),
|
|
117
|
+
maxHtmlLength: Math.max(8e3, Math.min(8e5, Number((a = e.maxHtmlLength) != null ? a : 22e4))),
|
|
118
|
+
removeComments: e.removeComments !== !1,
|
|
119
|
+
normalizeWhitespace: e.normalizeWhitespace !== !1,
|
|
120
|
+
labels: {
|
|
121
|
+
...we,
|
|
122
|
+
...e.labels || {}
|
|
123
|
+
},
|
|
124
|
+
normalizeText: e.normalizeText || Me,
|
|
125
|
+
profileOptions: {
|
|
126
|
+
fidelity: Z(t.fidelity, Y.fidelity),
|
|
127
|
+
balanced: Z(t.balanced, Y.balanced),
|
|
128
|
+
plain: Z(t.plain, Y.plain)
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function ce(e) {
|
|
133
|
+
return {
|
|
134
|
+
enabled: e.enabled,
|
|
135
|
+
defaultProfile: e.defaultProfile,
|
|
136
|
+
maxHtmlLength: e.maxHtmlLength,
|
|
137
|
+
removeComments: e.removeComments,
|
|
138
|
+
normalizeWhitespace: e.normalizeWhitespace,
|
|
139
|
+
labels: { ...e.labels },
|
|
140
|
+
normalizeText: e.normalizeText,
|
|
141
|
+
profileOptions: {
|
|
142
|
+
fidelity: { ...e.profileOptions.fidelity },
|
|
143
|
+
balanced: { ...e.profileOptions.balanced },
|
|
144
|
+
plain: { ...e.profileOptions.plain }
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function te(e) {
|
|
149
|
+
return e.closest(ee) || e;
|
|
150
|
+
}
|
|
151
|
+
function D(e) {
|
|
152
|
+
if (!e) return null;
|
|
153
|
+
if (e.matches(v)) return e;
|
|
154
|
+
const t = e.querySelector(v);
|
|
155
|
+
return t instanceof HTMLElement ? t : null;
|
|
156
|
+
}
|
|
157
|
+
function Oe() {
|
|
158
|
+
if (typeof window == "undefined") return null;
|
|
159
|
+
const e = window[se];
|
|
160
|
+
if (!(e instanceof HTMLElement)) return null;
|
|
161
|
+
window[se] = null;
|
|
162
|
+
const t = D(e);
|
|
163
|
+
if (t) return t;
|
|
164
|
+
const a = e.closest(ee);
|
|
165
|
+
if (a) {
|
|
166
|
+
const n = D(a);
|
|
167
|
+
if (n) return n;
|
|
168
|
+
}
|
|
169
|
+
const r = e.closest(v);
|
|
170
|
+
return r instanceof HTMLElement ? r : null;
|
|
171
|
+
}
|
|
172
|
+
function Re(e) {
|
|
173
|
+
const t = e.closest("[data-editora-editor]");
|
|
174
|
+
if (t && D(t) === e)
|
|
175
|
+
return t;
|
|
176
|
+
let a = e;
|
|
177
|
+
for (; a; ) {
|
|
178
|
+
if (a.matches(ee) && (a === e || D(a) === e))
|
|
179
|
+
return a;
|
|
180
|
+
a = a.parentElement;
|
|
181
|
+
}
|
|
182
|
+
return te(e);
|
|
183
|
+
}
|
|
184
|
+
function pe(e) {
|
|
185
|
+
return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
|
|
186
|
+
}
|
|
187
|
+
function T(e, t = !0, a = !0) {
|
|
188
|
+
if (j(), (e == null ? void 0 : e.contentElement) instanceof HTMLElement) return e.contentElement;
|
|
189
|
+
if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
|
|
190
|
+
const s = D(e.editorElement);
|
|
191
|
+
if (s) return s;
|
|
192
|
+
}
|
|
193
|
+
const r = Oe();
|
|
194
|
+
if (r) return r;
|
|
195
|
+
const n = window.getSelection();
|
|
196
|
+
if (n && n.rangeCount > 0) {
|
|
197
|
+
const s = pe(n.getRangeAt(0).startContainer), l = s == null ? void 0 : s.closest(v);
|
|
198
|
+
if (l) return l;
|
|
199
|
+
}
|
|
200
|
+
const o = document.activeElement;
|
|
201
|
+
if (o) {
|
|
202
|
+
if (o.matches(v)) return o;
|
|
203
|
+
const s = o.closest(v);
|
|
204
|
+
if (s) return s;
|
|
205
|
+
}
|
|
206
|
+
if (a) {
|
|
207
|
+
if (b && b.isConnected) return b;
|
|
208
|
+
b && !b.isConnected && (b = null);
|
|
209
|
+
}
|
|
210
|
+
return t ? document.querySelector(v) : null;
|
|
211
|
+
}
|
|
212
|
+
function ze(e) {
|
|
213
|
+
const t = e.target;
|
|
214
|
+
if (t) {
|
|
215
|
+
const r = t.closest(v);
|
|
216
|
+
if (r) return r;
|
|
217
|
+
}
|
|
218
|
+
const a = window.getSelection();
|
|
219
|
+
if (a && a.rangeCount > 0) {
|
|
220
|
+
const r = pe(a.getRangeAt(0).startContainer), n = r == null ? void 0 : r.closest(v);
|
|
221
|
+
if (n) return n;
|
|
222
|
+
}
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
function B(e) {
|
|
226
|
+
return e ? (e.getAttribute("data-theme") || e.getAttribute("theme") || "").toLowerCase() === "dark" ? !0 : e.classList.contains("dark") || e.classList.contains("editora-theme-dark") || e.classList.contains("rte-theme-dark") : !1;
|
|
227
|
+
}
|
|
228
|
+
function _e(e) {
|
|
229
|
+
const t = te(e);
|
|
230
|
+
if (B(t)) return !0;
|
|
231
|
+
const a = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
232
|
+
return B(a) ? !0 : B(document.documentElement) || B(document.body);
|
|
233
|
+
}
|
|
234
|
+
function G(e, t) {
|
|
235
|
+
e.classList.remove("rte-smart-paste-theme-dark"), _e(t) && e.classList.add("rte-smart-paste-theme-dark");
|
|
236
|
+
}
|
|
237
|
+
function de(e) {
|
|
238
|
+
return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
|
|
239
|
+
}
|
|
240
|
+
function N(e, t, a) {
|
|
241
|
+
const r = Re(e);
|
|
242
|
+
Array.from(
|
|
243
|
+
r.querySelectorAll(
|
|
244
|
+
`.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`
|
|
245
|
+
)
|
|
246
|
+
).forEach((o) => {
|
|
247
|
+
o.classList.toggle("active", a), o.setAttribute("data-active", a ? "true" : "false"), o.setAttribute("aria-pressed", a ? "true" : "false");
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
function m(e, t) {
|
|
251
|
+
d.has(e) || d.set(e, t);
|
|
252
|
+
let a = M.get(e);
|
|
253
|
+
return a || (a = {
|
|
254
|
+
enabled: t.enabled,
|
|
255
|
+
profile: t.defaultProfile,
|
|
256
|
+
lastReport: null
|
|
257
|
+
}, M.set(e, a)), Qe(e), _.add(e), a;
|
|
258
|
+
}
|
|
259
|
+
function me(e) {
|
|
260
|
+
const t = F.get(e);
|
|
261
|
+
t && (e.removeEventListener("paste", t, !0), F.delete(e));
|
|
262
|
+
}
|
|
263
|
+
function be(e) {
|
|
264
|
+
var t;
|
|
265
|
+
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);
|
|
266
|
+
}
|
|
267
|
+
function j() {
|
|
268
|
+
Array.from(_).forEach((t) => {
|
|
269
|
+
t.isConnected || be(t);
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
function He(e) {
|
|
273
|
+
var t, a, r, n;
|
|
274
|
+
for (let o = 0; o < e.length; o += 1) {
|
|
275
|
+
const s = e[o];
|
|
276
|
+
if (!(s.type !== "childList" || s.removedNodes.length === 0))
|
|
277
|
+
for (let l = 0; l < s.removedNodes.length; l += 1) {
|
|
278
|
+
const c = s.removedNodes[l];
|
|
279
|
+
if (c.nodeType !== Node.ELEMENT_NODE) continue;
|
|
280
|
+
const i = c;
|
|
281
|
+
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}`))
|
|
282
|
+
return !0;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
return !1;
|
|
286
|
+
}
|
|
287
|
+
function re(e) {
|
|
288
|
+
return I.get(e) === !0;
|
|
289
|
+
}
|
|
290
|
+
function R(e, t) {
|
|
291
|
+
const a = e.querySelector(".rte-smart-paste-live");
|
|
292
|
+
a && (a.textContent = t);
|
|
293
|
+
}
|
|
294
|
+
function J(e, t) {
|
|
295
|
+
const a = t.normalizeText(e);
|
|
296
|
+
return t.normalizeWhitespace ? a.split(`
|
|
297
|
+
`).map((n) => n.replace(/[\t ]+/g, " ").trimEnd()).join(`
|
|
298
|
+
`).replace(/\n{3,}/g, `
|
|
299
|
+
|
|
300
|
+
`).trim() : a;
|
|
301
|
+
}
|
|
302
|
+
function De(e) {
|
|
303
|
+
return /class=["'][^"']*Mso|xmlns:w=|urn:schemas-microsoft-com:office|<o:p\b/i.test(e);
|
|
304
|
+
}
|
|
305
|
+
function Ne(e) {
|
|
306
|
+
return /id=["']docs-internal-guid|docs-\w+|data-sheets-value|data-sheets-userformat/i.test(e);
|
|
307
|
+
}
|
|
308
|
+
function qe(e, t) {
|
|
309
|
+
return e ? De(e) ? "word" : Ne(e) ? "google-docs" : "html" : t ? "plain" : "html";
|
|
310
|
+
}
|
|
311
|
+
function Ie(e) {
|
|
312
|
+
return e.split(/\s+/).map((a) => a.trim()).filter(Boolean).filter((a) => !/^mso/i.test(a)).filter((a) => !/^docs-/i.test(a)).filter((a) => !/^c\d+$/i.test(a)).join(" ");
|
|
313
|
+
}
|
|
314
|
+
function We(e) {
|
|
315
|
+
if (!e) return { value: "", changed: !1 };
|
|
316
|
+
const t = e.split(";"), a = [];
|
|
317
|
+
let r = !1;
|
|
318
|
+
return t.forEach((n) => {
|
|
319
|
+
const o = n.indexOf(":");
|
|
320
|
+
if (o <= 0) {
|
|
321
|
+
n.trim() && (r = !0);
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
const s = n.slice(0, o).trim().toLowerCase(), l = n.slice(o + 1).trim();
|
|
325
|
+
if (!s || !l) {
|
|
326
|
+
r = !0;
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
if (!Le.has(s)) {
|
|
330
|
+
r = !0;
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
if (/expression\s*\(|javascript\s*:|vbscript\s*:|url\s*\(/i.test(l)) {
|
|
334
|
+
r = !0;
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
a.push(`${s}: ${l}`);
|
|
338
|
+
}), {
|
|
339
|
+
value: a.join("; "),
|
|
340
|
+
changed: r
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
function ue(e) {
|
|
344
|
+
const t = e.trim();
|
|
345
|
+
return t && (Ae.test(t) || Pe.test(t)) ? t : "";
|
|
346
|
+
}
|
|
347
|
+
function fe(e) {
|
|
348
|
+
const t = e.parentNode;
|
|
349
|
+
if (t) {
|
|
350
|
+
for (; e.firstChild; )
|
|
351
|
+
t.insertBefore(e.firstChild, e);
|
|
352
|
+
t.removeChild(e);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
function Be(e, t, a, r) {
|
|
356
|
+
const n = e.tagName.toLowerCase();
|
|
357
|
+
if (ke.has(n)) {
|
|
358
|
+
r.removedElements += 1, e.remove();
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
if (!t.preserveTables && Ce.has(n)) {
|
|
362
|
+
const s = e.textContent || "", l = document.createTextNode(s);
|
|
363
|
+
e.replaceWith(l), r.removedElements += 1;
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
if (Array.from(e.attributes).forEach((s) => {
|
|
367
|
+
const l = s.name.toLowerCase(), c = s.value;
|
|
368
|
+
if (l.startsWith("on")) {
|
|
369
|
+
e.removeAttribute(s.name), r.removedAttributes += 1;
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
if (l === "style") {
|
|
373
|
+
if (!t.keepStyles) {
|
|
374
|
+
e.removeAttribute(s.name), r.removedAttributes += 1;
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
const i = We(c);
|
|
378
|
+
if (!i.value) {
|
|
379
|
+
e.removeAttribute(s.name), r.removedAttributes += 1, i.changed && (r.normalizedStyles += 1);
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
(i.changed || i.value !== c) && (e.setAttribute("style", i.value), r.normalizedStyles += 1);
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
if (l === "class") {
|
|
386
|
+
if (!t.keepClasses) {
|
|
387
|
+
e.removeAttribute(s.name), r.removedAttributes += 1;
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
const i = Ie(c);
|
|
391
|
+
if (!i) {
|
|
392
|
+
e.removeAttribute(s.name), r.removedAttributes += 1;
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
i !== c && (e.setAttribute("class", i), r.removedAttributes += 1);
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
if (l.startsWith("data-") && !t.keepDataAttributes) {
|
|
399
|
+
e.removeAttribute(s.name), r.removedAttributes += 1;
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
if (l === "id" || l === "xmlns" || l.startsWith("xml")) {
|
|
403
|
+
e.removeAttribute(s.name), r.removedAttributes += 1;
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
if ((a === "word" || a === "google-docs") && (l === "lang" || l === "dir")) {
|
|
407
|
+
e.removeAttribute(s.name), r.removedAttributes += 1;
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
if (l === "href" || l === "src" || l === "xlink:href") {
|
|
411
|
+
const i = ue(c);
|
|
412
|
+
if (!i) {
|
|
413
|
+
e.removeAttribute(s.name), r.removedAttributes += 1;
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
i !== c && e.setAttribute(s.name, i);
|
|
417
|
+
}
|
|
418
|
+
}), n === "a") {
|
|
419
|
+
if (!e.getAttribute("href")) {
|
|
420
|
+
fe(e), r.removedElements += 1;
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
e.getAttribute("target") === "_blank" && e.setAttribute("rel", "noopener noreferrer");
|
|
424
|
+
}
|
|
425
|
+
if (n === "img") {
|
|
426
|
+
const s = e.getAttribute("src");
|
|
427
|
+
if (!s || !ue(s)) {
|
|
428
|
+
r.removedElements += 1, e.remove();
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
if (Te.has(n) && !e.attributes.length && !e.className && !e.style.cssText) {
|
|
433
|
+
const s = e.children.length > 0, l = (e.textContent || "").trim().length > 0;
|
|
434
|
+
if (!s && !l) {
|
|
435
|
+
e.remove(), r.removedElements += 1;
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
!s && l && (fe(e), r.removedElements += 1);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
function Ke(e, t, a, r, n) {
|
|
442
|
+
const o = document.createElement("template");
|
|
443
|
+
o.innerHTML = e;
|
|
444
|
+
const s = {
|
|
445
|
+
removedElements: 0,
|
|
446
|
+
removedAttributes: 0,
|
|
447
|
+
removedComments: 0,
|
|
448
|
+
normalizedStyles: 0
|
|
449
|
+
};
|
|
450
|
+
if (r.removeComments)
|
|
451
|
+
try {
|
|
452
|
+
const f = document.createTreeWalker(o.content, Ee, null), p = [];
|
|
453
|
+
let y = f.nextNode();
|
|
454
|
+
for (; y; )
|
|
455
|
+
p.push(y), y = f.nextNode();
|
|
456
|
+
p.forEach((g) => {
|
|
457
|
+
g.remove(), s.removedComments += 1;
|
|
458
|
+
});
|
|
459
|
+
} catch (f) {
|
|
460
|
+
}
|
|
461
|
+
Array.from(o.content.querySelectorAll("*")).forEach((f) => {
|
|
462
|
+
f.isConnected && Be(f, t, a, s);
|
|
463
|
+
});
|
|
464
|
+
let c = o.innerHTML;
|
|
465
|
+
r.normalizeWhitespace && n !== "fidelity" ? c = c.replace(/\s{2,}/g, " ").replace(/>\s+</g, "><").trim() : r.normalizeWhitespace && (c = c.trim());
|
|
466
|
+
const i = (o.content.textContent || "").trim().length;
|
|
467
|
+
return {
|
|
468
|
+
html: c,
|
|
469
|
+
textLength: i,
|
|
470
|
+
counters: s
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
function ge(e) {
|
|
474
|
+
const t = window.getSelection();
|
|
475
|
+
if (!t || t.rangeCount === 0) return null;
|
|
476
|
+
const a = t.getRangeAt(0);
|
|
477
|
+
return e.contains(a.commonAncestorContainer) ? a : null;
|
|
478
|
+
}
|
|
479
|
+
function he(e, t) {
|
|
480
|
+
if (!e.isConnected) return;
|
|
481
|
+
const a = window.getSelection();
|
|
482
|
+
a && (a.removeAllRanges(), a.addRange(t));
|
|
483
|
+
}
|
|
484
|
+
function Ve(e, t) {
|
|
485
|
+
e.focus({ preventScroll: !0 });
|
|
486
|
+
try {
|
|
487
|
+
if (document.execCommand("insertHTML", !1, t))
|
|
488
|
+
return !0;
|
|
489
|
+
} catch (s) {
|
|
490
|
+
}
|
|
491
|
+
const a = ge(e);
|
|
492
|
+
if (!a) return !1;
|
|
493
|
+
a.deleteContents();
|
|
494
|
+
const r = document.createElement("template");
|
|
495
|
+
r.innerHTML = t;
|
|
496
|
+
const n = r.content, o = n.lastChild;
|
|
497
|
+
if (a.insertNode(n), o) {
|
|
498
|
+
const s = document.createRange();
|
|
499
|
+
s.setStartAfter(o), s.collapse(!0), he(e, s);
|
|
500
|
+
}
|
|
501
|
+
return !0;
|
|
502
|
+
}
|
|
503
|
+
function je(e, t) {
|
|
504
|
+
e.focus({ preventScroll: !0 });
|
|
505
|
+
try {
|
|
506
|
+
if (document.execCommand("insertText", !1, t))
|
|
507
|
+
return !0;
|
|
508
|
+
} catch (o) {
|
|
509
|
+
}
|
|
510
|
+
const a = ge(e);
|
|
511
|
+
if (!a) return !1;
|
|
512
|
+
a.deleteContents();
|
|
513
|
+
const r = document.createTextNode(t);
|
|
514
|
+
a.insertNode(r);
|
|
515
|
+
const n = document.createRange();
|
|
516
|
+
return n.setStart(r, r.length), n.collapse(!0), he(e, n), !0;
|
|
517
|
+
}
|
|
518
|
+
function Fe(e, t) {
|
|
519
|
+
if (t === e.innerHTML) return;
|
|
520
|
+
const a = window.execEditorCommand || window.executeEditorCommand;
|
|
521
|
+
if (typeof a == "function")
|
|
522
|
+
try {
|
|
523
|
+
a("recordDomTransaction", e, t, e.innerHTML);
|
|
524
|
+
} catch (r) {
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
function Ge(e) {
|
|
528
|
+
e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
529
|
+
}
|
|
530
|
+
function K(e, t, a, r, n, o) {
|
|
531
|
+
return {
|
|
532
|
+
source: e,
|
|
533
|
+
profile: t,
|
|
534
|
+
inputHtmlLength: a,
|
|
535
|
+
outputHtmlLength: r,
|
|
536
|
+
outputTextLength: n,
|
|
537
|
+
removedElements: o.removedElements,
|
|
538
|
+
removedAttributes: o.removedAttributes,
|
|
539
|
+
removedComments: o.removedComments,
|
|
540
|
+
normalizedStyles: o.normalizedStyles,
|
|
541
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
function Ue(e, t, a, r) {
|
|
545
|
+
const n = qe(e, t);
|
|
546
|
+
if (a === "plain") {
|
|
547
|
+
const l = t || e.replace(/<[^>]*>/g, " "), c = J(l, r);
|
|
548
|
+
return {
|
|
549
|
+
mode: "text",
|
|
550
|
+
value: c,
|
|
551
|
+
report: K(
|
|
552
|
+
n,
|
|
553
|
+
a,
|
|
554
|
+
e.length,
|
|
555
|
+
0,
|
|
556
|
+
c.length,
|
|
557
|
+
{
|
|
558
|
+
removedElements: 0,
|
|
559
|
+
removedAttributes: 0,
|
|
560
|
+
removedComments: 0,
|
|
561
|
+
normalizedStyles: 0
|
|
562
|
+
}
|
|
563
|
+
)
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
if (!e || e.length > r.maxHtmlLength) {
|
|
567
|
+
const l = J(t || e.replace(/<[^>]*>/g, " "), r);
|
|
568
|
+
return {
|
|
569
|
+
mode: "text",
|
|
570
|
+
value: l,
|
|
571
|
+
report: K(
|
|
572
|
+
n,
|
|
573
|
+
a,
|
|
574
|
+
e.length,
|
|
575
|
+
0,
|
|
576
|
+
l.length,
|
|
577
|
+
{
|
|
578
|
+
removedElements: 0,
|
|
579
|
+
removedAttributes: 0,
|
|
580
|
+
removedComments: 0,
|
|
581
|
+
normalizedStyles: 0
|
|
582
|
+
}
|
|
583
|
+
)
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
const o = r.profileOptions[a], s = Ke(e, o, n, r, a);
|
|
587
|
+
if (!s.html) {
|
|
588
|
+
const l = J(t || e.replace(/<[^>]*>/g, " "), r);
|
|
589
|
+
return {
|
|
590
|
+
mode: "text",
|
|
591
|
+
value: l,
|
|
592
|
+
report: K(n, a, e.length, 0, l.length, s.counters)
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
return {
|
|
596
|
+
mode: "html",
|
|
597
|
+
value: s.html,
|
|
598
|
+
report: K(
|
|
599
|
+
n,
|
|
600
|
+
a,
|
|
601
|
+
e.length,
|
|
602
|
+
s.html.length,
|
|
603
|
+
s.textLength,
|
|
604
|
+
s.counters
|
|
605
|
+
)
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
function U(e, t) {
|
|
609
|
+
return e === "balanced" ? t.balancedText : e === "plain" ? t.plainText : t.fidelityText;
|
|
610
|
+
}
|
|
611
|
+
function ae(e) {
|
|
612
|
+
return e === "fidelity" ? "balanced" : e === "balanced" ? "plain" : "fidelity";
|
|
613
|
+
}
|
|
614
|
+
function Ye(e, t) {
|
|
615
|
+
e.setAttribute("aria-label", t.labels.panelAriaLabel);
|
|
616
|
+
const a = e.querySelector(".rte-smart-paste-title");
|
|
617
|
+
a && (a.textContent = t.labels.panelTitle);
|
|
618
|
+
const r = e.querySelector('[data-action="close"]');
|
|
619
|
+
r && r.setAttribute("aria-label", t.labels.closeText);
|
|
620
|
+
const n = e.querySelector('[data-action="toggle-enabled"]');
|
|
621
|
+
if (n) {
|
|
622
|
+
const Se = n.getAttribute("data-enabled") === "true";
|
|
623
|
+
n.textContent = Se ? t.labels.toggleOnText : t.labels.toggleOffText;
|
|
624
|
+
}
|
|
625
|
+
const o = e.querySelector('[data-action="cycle-profile"]');
|
|
626
|
+
o && (o.textContent = t.labels.cycleProfileText);
|
|
627
|
+
const s = e.querySelector(".rte-smart-paste-profile-heading");
|
|
628
|
+
s && (s.textContent = t.labels.profileLabel);
|
|
629
|
+
const l = e.querySelector('.rte-smart-paste-profile[role="group"]');
|
|
630
|
+
l && l.setAttribute("aria-label", t.labels.profileLabel);
|
|
631
|
+
const c = e.querySelector('[data-action="set-profile"][data-profile="fidelity"]');
|
|
632
|
+
c && (c.textContent = t.labels.fidelityText);
|
|
633
|
+
const i = e.querySelector('[data-action="set-profile"][data-profile="balanced"]');
|
|
634
|
+
i && (i.textContent = t.labels.balancedText);
|
|
635
|
+
const f = e.querySelector('[data-action="set-profile"][data-profile="plain"]');
|
|
636
|
+
f && (f.textContent = t.labels.plainText);
|
|
637
|
+
const p = e.querySelector(".rte-smart-paste-report-title");
|
|
638
|
+
p && (p.textContent = t.labels.lastPasteHeading);
|
|
639
|
+
const y = e.querySelector(".rte-smart-paste-empty");
|
|
640
|
+
y && (y.textContent = t.labels.lastPasteEmptyText);
|
|
641
|
+
const g = e.querySelector('[data-key="source-label"]');
|
|
642
|
+
g && (g.textContent = t.labels.lastPasteSourceLabel);
|
|
643
|
+
const P = e.querySelector('[data-key="profile-label"]');
|
|
644
|
+
P && (P.textContent = t.labels.lastPasteProfileLabel);
|
|
645
|
+
const C = e.querySelector('[data-key="removed-label"]');
|
|
646
|
+
C && (C.textContent = t.labels.lastPasteRemovedLabel);
|
|
647
|
+
const oe = e.querySelector('[data-key="chars-label"]');
|
|
648
|
+
oe && (oe.textContent = t.labels.lastPasteCharsLabel);
|
|
649
|
+
const ne = e.querySelector(".rte-smart-paste-shortcut");
|
|
650
|
+
ne && (ne.textContent = t.labels.shortcutText);
|
|
651
|
+
}
|
|
652
|
+
function S(e) {
|
|
653
|
+
const t = h.get(e), a = d.get(e) || O, r = M.get(e);
|
|
654
|
+
if (!t || !a || !r) return;
|
|
655
|
+
Ye(t, a);
|
|
656
|
+
const n = t.querySelector(".rte-smart-paste-status");
|
|
657
|
+
n && (n.textContent = r.enabled ? a.labels.enabledText : a.labels.disabledText);
|
|
658
|
+
const o = t.querySelector('[data-action="toggle-enabled"]');
|
|
659
|
+
o && (o.setAttribute("data-enabled", r.enabled ? "true" : "false"), o.textContent = r.enabled ? a.labels.toggleOnText : a.labels.toggleOffText, o.setAttribute("aria-pressed", r.enabled ? "true" : "false")), Array.from(
|
|
660
|
+
t.querySelectorAll('[data-action="set-profile"][data-profile]')
|
|
661
|
+
).forEach((g) => {
|
|
662
|
+
const C = H(g.getAttribute("data-profile")) === r.profile;
|
|
663
|
+
g.classList.toggle("active", C), g.setAttribute("aria-pressed", C ? "true" : "false");
|
|
664
|
+
});
|
|
665
|
+
const l = t.querySelector(".rte-smart-paste-empty"), c = t.querySelector(".rte-smart-paste-report"), i = t.querySelector('[data-key="source-value"]'), f = t.querySelector('[data-key="profile-value"]'), p = t.querySelector('[data-key="removed-value"]'), y = t.querySelector('[data-key="chars-value"]');
|
|
666
|
+
if (!r.lastReport) {
|
|
667
|
+
l && (l.hidden = !1), c && (c.hidden = !0);
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
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) {
|
|
671
|
+
const g = r.lastReport.removedElements + r.lastReport.removedAttributes + r.lastReport.removedComments + r.lastReport.normalizedStyles;
|
|
672
|
+
p.textContent = String(g);
|
|
673
|
+
}
|
|
674
|
+
y && (y.textContent = String(r.lastReport.outputTextLength));
|
|
675
|
+
}
|
|
676
|
+
function Q(e, t) {
|
|
677
|
+
if (!t.classList.contains("show")) return;
|
|
678
|
+
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));
|
|
679
|
+
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`;
|
|
680
|
+
}
|
|
681
|
+
function q(e, t = !1) {
|
|
682
|
+
const a = h.get(e);
|
|
683
|
+
a && (a.classList.remove("show"), I.set(e, !1), N(e, "toggleSmartPastePanel", !1), t && e.focus({ preventScroll: !0 }));
|
|
684
|
+
}
|
|
685
|
+
function Xe(e) {
|
|
686
|
+
const t = h.get(e);
|
|
687
|
+
if (t) return t;
|
|
688
|
+
const a = d.get(e) || O || V(), r = `rte-smart-paste-panel-${$e++}`, n = document.createElement("section");
|
|
689
|
+
return n.className = u, n.id = r, n.setAttribute("role", "dialog"), n.setAttribute("aria-modal", "false"), n.setAttribute("aria-label", a.labels.panelAriaLabel), n.innerHTML = `
|
|
690
|
+
<header class="rte-smart-paste-header">
|
|
691
|
+
<h2 class="rte-smart-paste-title">${X(a.labels.panelTitle)}</h2>
|
|
692
|
+
<button type="button" class="rte-smart-paste-icon-btn" data-action="close" aria-label="${X(a.labels.closeText)}">✕</button>
|
|
693
|
+
</header>
|
|
694
|
+
<div class="rte-smart-paste-body">
|
|
695
|
+
<p class="rte-smart-paste-status"></p>
|
|
696
|
+
<div class="rte-smart-paste-controls">
|
|
697
|
+
<button type="button" class="rte-smart-paste-btn rte-smart-paste-btn-primary" data-action="toggle-enabled" data-enabled="true"></button>
|
|
698
|
+
<button type="button" class="rte-smart-paste-btn" data-action="cycle-profile"></button>
|
|
699
|
+
</div>
|
|
700
|
+
<div class="rte-smart-paste-profile" role="group" aria-label="${X(a.labels.profileLabel)}">
|
|
701
|
+
<p class="rte-smart-paste-profile-heading"></p>
|
|
702
|
+
<div class="rte-smart-paste-profile-grid">
|
|
703
|
+
<button type="button" class="rte-smart-paste-chip" data-action="set-profile" data-profile="fidelity" aria-pressed="false"></button>
|
|
704
|
+
<button type="button" class="rte-smart-paste-chip" data-action="set-profile" data-profile="balanced" aria-pressed="false"></button>
|
|
705
|
+
<button type="button" class="rte-smart-paste-chip" data-action="set-profile" data-profile="plain" aria-pressed="false"></button>
|
|
706
|
+
</div>
|
|
707
|
+
</div>
|
|
708
|
+
<section class="rte-smart-paste-metrics" aria-live="polite">
|
|
709
|
+
<h3 class="rte-smart-paste-report-title"></h3>
|
|
710
|
+
<p class="rte-smart-paste-empty"></p>
|
|
711
|
+
<dl class="rte-smart-paste-report" hidden>
|
|
712
|
+
<div class="rte-smart-paste-line"><dt data-key="source-label"></dt><dd data-key="source-value"></dd></div>
|
|
713
|
+
<div class="rte-smart-paste-line"><dt data-key="profile-label"></dt><dd data-key="profile-value"></dd></div>
|
|
714
|
+
<div class="rte-smart-paste-line"><dt data-key="removed-label"></dt><dd data-key="removed-value"></dd></div>
|
|
715
|
+
<div class="rte-smart-paste-line"><dt data-key="chars-label"></dt><dd data-key="chars-value"></dd></div>
|
|
716
|
+
</dl>
|
|
717
|
+
</section>
|
|
718
|
+
<p class="rte-smart-paste-shortcut"></p>
|
|
719
|
+
</div>
|
|
720
|
+
<div class="rte-smart-paste-live" aria-live="polite" aria-atomic="true"></div>
|
|
721
|
+
`, n.addEventListener("click", (o) => {
|
|
722
|
+
const s = o.target, l = s == null ? void 0 : s.closest("[data-action]");
|
|
723
|
+
if (!l) return;
|
|
724
|
+
const c = l.getAttribute("data-action");
|
|
725
|
+
if (c) {
|
|
726
|
+
if (c === "close") {
|
|
727
|
+
q(e, !0);
|
|
728
|
+
return;
|
|
729
|
+
}
|
|
730
|
+
if (c === "toggle-enabled") {
|
|
731
|
+
const i = m(e, d.get(e) || a);
|
|
732
|
+
i.enabled = !i.enabled, N(e, "toggleSmartPasteEnabled", i.enabled), S(e), R(n, i.enabled ? a.labels.enabledText : a.labels.disabledText);
|
|
733
|
+
return;
|
|
734
|
+
}
|
|
735
|
+
if (c === "cycle-profile") {
|
|
736
|
+
const i = m(e, d.get(e) || a);
|
|
737
|
+
i.profile = ae(i.profile), S(e), R(n, `${a.labels.profileLabel}: ${U(i.profile, a.labels)}`);
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
if (c === "set-profile") {
|
|
741
|
+
const i = m(e, d.get(e) || a);
|
|
742
|
+
i.profile = H(l.getAttribute("data-profile")), S(e), R(n, `${a.labels.profileLabel}: ${U(i.profile, a.labels)}`);
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
}), n.addEventListener("keydown", (o) => {
|
|
746
|
+
if (o.key === "Escape") {
|
|
747
|
+
o.preventDefault(), q(e, !0);
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
if (o.key !== "ArrowRight" && o.key !== "ArrowLeft") return;
|
|
751
|
+
const s = Array.from(
|
|
752
|
+
n.querySelectorAll('[data-action="set-profile"][data-profile]')
|
|
753
|
+
);
|
|
754
|
+
if (s.length === 0) return;
|
|
755
|
+
const l = s.findIndex((f) => f === document.activeElement);
|
|
756
|
+
if (l < 0) return;
|
|
757
|
+
const c = o.key === "ArrowRight" ? 1 : -1, i = (l + c + s.length) % s.length;
|
|
758
|
+
o.preventDefault(), s[i].focus();
|
|
759
|
+
}), G(n, e), document.body.appendChild(n), h.set(e, n), I.set(e, !1), S(e), n;
|
|
760
|
+
}
|
|
761
|
+
function ye(e) {
|
|
762
|
+
const t = Xe(e);
|
|
763
|
+
h.forEach((r, n) => {
|
|
764
|
+
n !== e && q(n, !1);
|
|
765
|
+
}), t.classList.add("show"), I.set(e, !0), N(e, "toggleSmartPastePanel", !0), G(t, e), Q(e, t);
|
|
766
|
+
const a = t.querySelector('[data-action="toggle-enabled"]');
|
|
767
|
+
a == null || a.focus();
|
|
768
|
+
}
|
|
769
|
+
function xe(e, t) {
|
|
770
|
+
const a = re(e);
|
|
771
|
+
return (typeof t == "boolean" ? t : !a) ? ye(e) : q(e, !1), !0;
|
|
772
|
+
}
|
|
773
|
+
function ve(e) {
|
|
774
|
+
return {
|
|
775
|
+
enabled: e.enabled,
|
|
776
|
+
profile: e.profile,
|
|
777
|
+
lastReport: e.lastReport ? { ...e.lastReport } : null
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
function Ze(e, t) {
|
|
781
|
+
const a = d.get(e) || O;
|
|
782
|
+
if (!a) return !1;
|
|
783
|
+
const r = m(e, a);
|
|
784
|
+
if (!r.enabled || de(e)) {
|
|
785
|
+
const p = h.get(e);
|
|
786
|
+
return p && de(e) && R(p, a.labels.readonlyMessage), !1;
|
|
787
|
+
}
|
|
788
|
+
const n = t.clipboardData;
|
|
789
|
+
if (!n) return !1;
|
|
790
|
+
const o = n.getData("text/html") || "", s = n.getData("text/plain") || "";
|
|
791
|
+
if (!o && !s) return !1;
|
|
792
|
+
const l = Ue(o, s, r.profile, a);
|
|
793
|
+
if (!l.value) return !1;
|
|
794
|
+
const c = e.innerHTML;
|
|
795
|
+
if (!(l.mode === "html" ? Ve(e, l.value) : je(e, l.value))) return !1;
|
|
796
|
+
r.lastReport = { ...l.report }, M.set(e, r), Fe(e, c), Ge(e), e.dispatchEvent(
|
|
797
|
+
new CustomEvent("editora:smart-paste", {
|
|
798
|
+
bubbles: !0,
|
|
799
|
+
detail: ve(r)
|
|
800
|
+
})
|
|
801
|
+
), S(e);
|
|
802
|
+
const f = h.get(e);
|
|
803
|
+
if (f) {
|
|
804
|
+
const p = l.report.removedElements + l.report.removedAttributes + l.report.removedComments + l.report.normalizedStyles;
|
|
805
|
+
R(
|
|
806
|
+
f,
|
|
807
|
+
`${a.labels.panelTitle}: ${U(r.profile, a.labels)}. ${a.labels.lastPasteRemovedLabel}: ${p}.`
|
|
808
|
+
);
|
|
809
|
+
}
|
|
810
|
+
return !0;
|
|
811
|
+
}
|
|
812
|
+
function Je(e) {
|
|
813
|
+
return (t) => {
|
|
814
|
+
t.defaultPrevented || t[ie] === !0 || (b = e, !Ze(e, t)) || (t[ie] = !0, t.preventDefault(), typeof t.stopImmediatePropagation == "function" ? t.stopImmediatePropagation() : t.stopPropagation());
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
function Qe(e) {
|
|
818
|
+
if (F.has(e)) return;
|
|
819
|
+
const t = Je(e);
|
|
820
|
+
e.addEventListener("paste", t, !0), F.set(e, t);
|
|
821
|
+
}
|
|
822
|
+
function z(e) {
|
|
823
|
+
const t = M.get(e);
|
|
824
|
+
N(e, "toggleSmartPastePanel", re(e)), N(e, "toggleSmartPasteEnabled", (t == null ? void 0 : t.enabled) === !0);
|
|
825
|
+
}
|
|
826
|
+
function et(e) {
|
|
827
|
+
const t = e.key.toLowerCase();
|
|
828
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "s";
|
|
829
|
+
}
|
|
830
|
+
function tt(e) {
|
|
831
|
+
const t = e.key.toLowerCase();
|
|
832
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "v";
|
|
833
|
+
}
|
|
834
|
+
function rt(e) {
|
|
835
|
+
const t = e.key.toLowerCase();
|
|
836
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "g";
|
|
837
|
+
}
|
|
838
|
+
function at(e) {
|
|
839
|
+
O = e, L || (L = (t) => {
|
|
840
|
+
j();
|
|
841
|
+
const a = t.target, r = a == null ? void 0 : a.closest(v);
|
|
842
|
+
if (!r) return;
|
|
843
|
+
const n = d.get(r) || e;
|
|
844
|
+
m(r, n), d.set(r, n), b = r, z(r);
|
|
845
|
+
const o = h.get(r);
|
|
846
|
+
o && (G(o, r), Q(r, o), S(r));
|
|
847
|
+
}, document.addEventListener("focusin", L, !0)), w || (w = (t) => {
|
|
848
|
+
if (t.defaultPrevented) return;
|
|
849
|
+
const a = t.target;
|
|
850
|
+
if (a != null && a.closest(`.${u} input, .${u} textarea, .${u} select`)) return;
|
|
851
|
+
const r = ze(t);
|
|
852
|
+
if (!r) return;
|
|
853
|
+
const n = d.get(r) || O || e;
|
|
854
|
+
if (m(r, n), d.set(r, n), b = r, t.key === "Escape" && re(r)) {
|
|
855
|
+
t.preventDefault(), q(r, !0);
|
|
856
|
+
return;
|
|
857
|
+
}
|
|
858
|
+
if (et(t)) {
|
|
859
|
+
t.preventDefault(), t.stopPropagation(), xe(r);
|
|
860
|
+
return;
|
|
861
|
+
}
|
|
862
|
+
if (tt(t)) {
|
|
863
|
+
t.preventDefault(), t.stopPropagation();
|
|
864
|
+
const o = m(r, n);
|
|
865
|
+
o.profile = ae(o.profile), S(r);
|
|
866
|
+
return;
|
|
867
|
+
}
|
|
868
|
+
if (rt(t)) {
|
|
869
|
+
t.preventDefault(), t.stopPropagation();
|
|
870
|
+
const o = m(r, n);
|
|
871
|
+
o.enabled = !o.enabled, z(r), S(r);
|
|
872
|
+
}
|
|
873
|
+
}, document.addEventListener("keydown", w, !0)), A || (A = () => {
|
|
874
|
+
j(), h.forEach((t, a) => {
|
|
875
|
+
!a.isConnected || !t.isConnected || (G(t, a), Q(a, t));
|
|
876
|
+
});
|
|
877
|
+
}, window.addEventListener("scroll", A, !0), window.addEventListener("resize", A)), !$ && typeof MutationObserver != "undefined" && document.body && ($ = new MutationObserver((t) => {
|
|
878
|
+
He(t) && j();
|
|
879
|
+
}), $.observe(document.body, {
|
|
880
|
+
childList: !0,
|
|
881
|
+
subtree: !0
|
|
882
|
+
}));
|
|
883
|
+
}
|
|
884
|
+
function ot() {
|
|
885
|
+
L && (document.removeEventListener("focusin", L, !0), L = null), w && (document.removeEventListener("keydown", w, !0), w = null), A && (window.removeEventListener("scroll", A, !0), window.removeEventListener("resize", A), A = null), $ && ($.disconnect(), $ = null), h.forEach((e) => e.remove()), h.clear(), _.forEach((e) => me(e)), _.clear(), O = null, b = null;
|
|
886
|
+
}
|
|
887
|
+
function nt() {
|
|
888
|
+
if (typeof document == "undefined" || document.getElementById(le)) return;
|
|
889
|
+
const e = document.createElement("style");
|
|
890
|
+
e.id = le, e.textContent = `
|
|
891
|
+
.rte-toolbar-group-items.${x},
|
|
892
|
+
.editora-toolbar-group-items.${x},
|
|
893
|
+
.rte-toolbar-group-items.${E},
|
|
894
|
+
.editora-toolbar-group-items.${E} {
|
|
895
|
+
display: flex;
|
|
896
|
+
border: 1px solid #ccc;
|
|
897
|
+
border-radius: 3px;
|
|
898
|
+
background: #fff;
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
.rte-toolbar-group-items.${x} .rte-toolbar-button,
|
|
902
|
+
.editora-toolbar-group-items.${x} .editora-toolbar-button,
|
|
903
|
+
.rte-toolbar-group-items.${E} .rte-toolbar-button,
|
|
904
|
+
.editora-toolbar-group-items.${E} .editora-toolbar-button {
|
|
905
|
+
border: none;
|
|
906
|
+
border-right: 1px solid #ccc;
|
|
907
|
+
border-radius: 0;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
.rte-toolbar-group-items.${x} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
911
|
+
.editora-toolbar-group-items.${x} .editora-toolbar-item:last-child .editora-toolbar-button,
|
|
912
|
+
.rte-toolbar-group-items.${E} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
913
|
+
.editora-toolbar-group-items.${E} .editora-toolbar-item:last-child .editora-toolbar-button {
|
|
914
|
+
border-right: none;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
.rte-toolbar-button[data-command="toggleSmartPasteEnabled"].active,
|
|
918
|
+
.editora-toolbar-button[data-command="toggleSmartPasteEnabled"].active {
|
|
919
|
+
background-color: #ccc;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
${k} .rte-toolbar-group-items.${x},
|
|
923
|
+
${k} .editora-toolbar-group-items.${x},
|
|
924
|
+
${k} .rte-toolbar-group-items.${E},
|
|
925
|
+
${k} .editora-toolbar-group-items.${E},
|
|
926
|
+
.${u}.rte-smart-paste-theme-dark {
|
|
927
|
+
border-color: #566275;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
${k} .rte-toolbar-group-items.${x} .rte-toolbar-button svg,
|
|
931
|
+
${k} .editora-toolbar-group-items.${x} .editora-toolbar-button svg,
|
|
932
|
+
${k} .rte-toolbar-group-items.${E} .rte-toolbar-button svg,
|
|
933
|
+
${k} .editora-toolbar-group-items.${E} .editora-toolbar-button svg {
|
|
934
|
+
fill: none;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
${k} .rte-toolbar-group-items.${x} .rte-toolbar-button,
|
|
938
|
+
${k} .editora-toolbar-group-items.${x} .editora-toolbar-button
|
|
939
|
+
{
|
|
940
|
+
border-color: #566275;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
.${u} {
|
|
944
|
+
position: fixed;
|
|
945
|
+
z-index: 12000;
|
|
946
|
+
display: none;
|
|
947
|
+
width: min(360px, calc(100vw - 20px));
|
|
948
|
+
max-height: calc(100vh - 20px);
|
|
949
|
+
border: 1px solid #d1d5db;
|
|
950
|
+
border-radius: 14px;
|
|
951
|
+
background: #ffffff;
|
|
952
|
+
color: #111827;
|
|
953
|
+
box-shadow: 0 18px 45px rgba(15, 23, 42, 0.25);
|
|
954
|
+
overflow: hidden;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
.${u}.show {
|
|
958
|
+
display: flex;
|
|
959
|
+
flex-direction: column;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
.${u}.rte-smart-paste-theme-dark {
|
|
963
|
+
border-color: #334155;
|
|
964
|
+
background: #0f172a;
|
|
965
|
+
color: #e2e8f0;
|
|
966
|
+
box-shadow: 0 20px 46px rgba(2, 6, 23, 0.68);
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
.rte-smart-paste-header {
|
|
970
|
+
display: flex;
|
|
971
|
+
align-items: center;
|
|
972
|
+
justify-content: space-between;
|
|
973
|
+
gap: 8px;
|
|
974
|
+
padding: 12px 14px;
|
|
975
|
+
border-bottom: 1px solid #e5e7eb;
|
|
976
|
+
background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-header {
|
|
980
|
+
border-color: #1e293b;
|
|
981
|
+
background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
.rte-smart-paste-title {
|
|
985
|
+
margin: 0;
|
|
986
|
+
font-size: 15px;
|
|
987
|
+
line-height: 1.2;
|
|
988
|
+
font-weight: 700;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
.rte-smart-paste-icon-btn {
|
|
992
|
+
width: 34px;
|
|
993
|
+
height: 34px;
|
|
994
|
+
border: 1px solid #cbd5e1;
|
|
995
|
+
border-radius: 6px;
|
|
996
|
+
background: #ffffff;
|
|
997
|
+
color: #0f172a;
|
|
998
|
+
font-size: 16px;
|
|
999
|
+
line-height: 1;
|
|
1000
|
+
font-weight: 600;
|
|
1001
|
+
padding: 0;
|
|
1002
|
+
display: inline-flex;
|
|
1003
|
+
align-items: center;
|
|
1004
|
+
justify-content: center;
|
|
1005
|
+
cursor: pointer;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
.rte-smart-paste-icon-btn:hover,
|
|
1009
|
+
.rte-smart-paste-icon-btn:focus-visible {
|
|
1010
|
+
outline: none;
|
|
1011
|
+
border-color: #3b82f6;
|
|
1012
|
+
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-icon-btn {
|
|
1016
|
+
background: #0f172a;
|
|
1017
|
+
border-color: #475569;
|
|
1018
|
+
color: #e2e8f0;
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-icon-btn:hover,
|
|
1022
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-icon-btn:focus-visible {
|
|
1023
|
+
border-color: #60a5fa;
|
|
1024
|
+
box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
.rte-smart-paste-body {
|
|
1028
|
+
display: flex;
|
|
1029
|
+
flex-direction: column;
|
|
1030
|
+
gap: 10px;
|
|
1031
|
+
padding: 12px;
|
|
1032
|
+
overflow: auto;
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
.rte-smart-paste-status {
|
|
1036
|
+
margin: 0;
|
|
1037
|
+
font-size: 12px;
|
|
1038
|
+
line-height: 1.35;
|
|
1039
|
+
color: #475569;
|
|
1040
|
+
font-weight: 600;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-status {
|
|
1044
|
+
color: #94a3b8;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
.rte-smart-paste-controls {
|
|
1048
|
+
display: flex;
|
|
1049
|
+
gap: 8px;
|
|
1050
|
+
flex-wrap: wrap;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
.rte-smart-paste-btn {
|
|
1054
|
+
border: 1px solid #cbd5e1;
|
|
1055
|
+
border-radius: 8px;
|
|
1056
|
+
height: 34px;
|
|
1057
|
+
padding: 0 10px;
|
|
1058
|
+
background: #ffffff;
|
|
1059
|
+
color: inherit;
|
|
1060
|
+
font-size: 12px;
|
|
1061
|
+
font-weight: 600;
|
|
1062
|
+
cursor: pointer;
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
.rte-smart-paste-btn:hover,
|
|
1066
|
+
.rte-smart-paste-btn:focus-visible {
|
|
1067
|
+
border-color: #94a3b8;
|
|
1068
|
+
background: #f8fafc;
|
|
1069
|
+
outline: none;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
.rte-smart-paste-btn-primary {
|
|
1073
|
+
border-color: #0284c7;
|
|
1074
|
+
background: #0ea5e9;
|
|
1075
|
+
color: #f8fafc;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
.rte-smart-paste-btn-primary:hover,
|
|
1079
|
+
.rte-smart-paste-btn-primary:focus-visible {
|
|
1080
|
+
border-color: #0369a1;
|
|
1081
|
+
background: #0284c7;
|
|
1082
|
+
color: #ffffff;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-btn {
|
|
1086
|
+
border-color: #334155;
|
|
1087
|
+
background: #111827;
|
|
1088
|
+
color: #e2e8f0;
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-btn:hover,
|
|
1092
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-btn:focus-visible {
|
|
1093
|
+
border-color: #475569;
|
|
1094
|
+
background: #1e293b;
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
.rte-smart-paste-profile {
|
|
1098
|
+
display: grid;
|
|
1099
|
+
gap: 6px;
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
.rte-smart-paste-profile-heading {
|
|
1103
|
+
margin: 0;
|
|
1104
|
+
font-size: 12px;
|
|
1105
|
+
line-height: 1.35;
|
|
1106
|
+
font-weight: 700;
|
|
1107
|
+
color: #334155;
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-profile-heading {
|
|
1111
|
+
color: #cbd5e1;
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
.rte-smart-paste-profile-grid {
|
|
1115
|
+
display: grid;
|
|
1116
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
1117
|
+
gap: 8px;
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
.rte-smart-paste-chip {
|
|
1121
|
+
height: 34px;
|
|
1122
|
+
border-radius: 9px;
|
|
1123
|
+
border: 1px solid #cbd5e1;
|
|
1124
|
+
background: #ffffff;
|
|
1125
|
+
color: inherit;
|
|
1126
|
+
font-size: 12px;
|
|
1127
|
+
font-weight: 600;
|
|
1128
|
+
cursor: pointer;
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
.rte-smart-paste-chip:hover,
|
|
1132
|
+
.rte-smart-paste-chip:focus-visible {
|
|
1133
|
+
border-color: #0284c7;
|
|
1134
|
+
outline: none;
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
.rte-smart-paste-chip.active {
|
|
1138
|
+
border-color: #0284c7;
|
|
1139
|
+
background: rgba(14, 165, 233, 0.14);
|
|
1140
|
+
color: #0c4a6e;
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-chip {
|
|
1144
|
+
border-color: #334155;
|
|
1145
|
+
background: #0b1220;
|
|
1146
|
+
color: #e2e8f0;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-chip.active {
|
|
1150
|
+
border-color: #38bdf8;
|
|
1151
|
+
background: rgba(14, 165, 233, 0.2);
|
|
1152
|
+
color: #e0f2fe;
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
.rte-smart-paste-metrics {
|
|
1156
|
+
border: 1px solid #e2e8f0;
|
|
1157
|
+
border-radius: 10px;
|
|
1158
|
+
padding: 10px;
|
|
1159
|
+
background: #f8fafc;
|
|
1160
|
+
display: grid;
|
|
1161
|
+
gap: 8px;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-metrics {
|
|
1165
|
+
border-color: #334155;
|
|
1166
|
+
background: #0b1220;
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
.rte-smart-paste-report-title {
|
|
1170
|
+
margin: 0;
|
|
1171
|
+
font-size: 12px;
|
|
1172
|
+
line-height: 1.3;
|
|
1173
|
+
font-weight: 700;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
.rte-smart-paste-empty {
|
|
1177
|
+
margin: 0;
|
|
1178
|
+
font-size: 12px;
|
|
1179
|
+
line-height: 1.35;
|
|
1180
|
+
color: #475569;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-empty {
|
|
1184
|
+
color: #94a3b8;
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
.rte-smart-paste-report {
|
|
1188
|
+
margin: 0;
|
|
1189
|
+
display: grid;
|
|
1190
|
+
gap: 6px;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
.rte-smart-paste-line {
|
|
1194
|
+
display: flex;
|
|
1195
|
+
justify-content: space-between;
|
|
1196
|
+
gap: 10px;
|
|
1197
|
+
font-size: 12px;
|
|
1198
|
+
line-height: 1.3;
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
.rte-smart-paste-line dt {
|
|
1202
|
+
margin: 0;
|
|
1203
|
+
color: #475569;
|
|
1204
|
+
font-weight: 600;
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
.rte-smart-paste-line dd {
|
|
1208
|
+
margin: 0;
|
|
1209
|
+
font-weight: 700;
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-line dt {
|
|
1213
|
+
color: #94a3b8;
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
.rte-smart-paste-shortcut {
|
|
1217
|
+
margin: 2px 0 0;
|
|
1218
|
+
font-size: 11px;
|
|
1219
|
+
color: #64748b;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
.${u}.rte-smart-paste-theme-dark .rte-smart-paste-shortcut {
|
|
1223
|
+
color: #94a3b8;
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
.rte-smart-paste-live {
|
|
1227
|
+
position: absolute;
|
|
1228
|
+
width: 1px;
|
|
1229
|
+
height: 1px;
|
|
1230
|
+
margin: -1px;
|
|
1231
|
+
padding: 0;
|
|
1232
|
+
overflow: hidden;
|
|
1233
|
+
clip: rect(0 0 0 0);
|
|
1234
|
+
border: 0;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
@media (max-width: 768px) {
|
|
1238
|
+
.${u} {
|
|
1239
|
+
left: 10px !important;
|
|
1240
|
+
right: 10px;
|
|
1241
|
+
top: 10px !important;
|
|
1242
|
+
width: auto !important;
|
|
1243
|
+
max-height: calc(100vh - 20px);
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
.rte-smart-paste-profile-grid {
|
|
1247
|
+
grid-template-columns: 1fr;
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
`, document.head.appendChild(e);
|
|
1251
|
+
}
|
|
1252
|
+
const st = (e = {}) => {
|
|
1253
|
+
const t = V(e), a = /* @__PURE__ */ new Set();
|
|
1254
|
+
return nt(), {
|
|
1255
|
+
name: "smartPaste",
|
|
1256
|
+
toolbar: [
|
|
1257
|
+
{
|
|
1258
|
+
id: "smartPasteGroup",
|
|
1259
|
+
label: "Smart Paste",
|
|
1260
|
+
type: "group",
|
|
1261
|
+
command: "smartPaste",
|
|
1262
|
+
items: [
|
|
1263
|
+
{
|
|
1264
|
+
id: "smartPaste",
|
|
1265
|
+
label: "Smart Paste Panel",
|
|
1266
|
+
command: "toggleSmartPastePanel",
|
|
1267
|
+
shortcut: "Mod-Alt-Shift-s",
|
|
1268
|
+
icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M8.5 4.5h7l3 3V18a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 6.5 18V7a2.5 2.5 0 0 1 2-2.45Z" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"/><path d="M15.5 4.5V8h3" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/><path d="M9.3 12h5.4M9.3 15h5.4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>'
|
|
1269
|
+
},
|
|
1270
|
+
{
|
|
1271
|
+
id: "smartPasteProfile",
|
|
1272
|
+
label: "Cycle Smart Paste Profile",
|
|
1273
|
+
command: "cycleSmartPasteProfile",
|
|
1274
|
+
shortcut: "Mod-Alt-Shift-v",
|
|
1275
|
+
icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M4.5 7.5h10" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><circle cx="17.5" cy="7.5" r="2" stroke="currentColor" stroke-width="1.6"/><path d="M4.5 12h5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><circle cx="12.5" cy="12" r="2" stroke="currentColor" stroke-width="1.6"/><path d="M4.5 16.5h12" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><circle cx="9.5" cy="16.5" r="2" stroke="currentColor" stroke-width="1.6"/></svg>'
|
|
1276
|
+
},
|
|
1277
|
+
{
|
|
1278
|
+
id: "smartPasteToggle",
|
|
1279
|
+
label: "Toggle Smart Paste",
|
|
1280
|
+
command: "toggleSmartPasteEnabled",
|
|
1281
|
+
shortcut: "Mod-Alt-Shift-g",
|
|
1282
|
+
icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><rect x="3.5" y="8" width="17" height="8" rx="4" stroke="currentColor" stroke-width="1.6"/><circle cx="8" cy="12" r="2.6" fill="currentColor"/><path d="M14.5 12h3" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>'
|
|
1283
|
+
}
|
|
1284
|
+
]
|
|
1285
|
+
}
|
|
1286
|
+
],
|
|
1287
|
+
commands: {
|
|
1288
|
+
smartPaste: (r, n) => {
|
|
1289
|
+
const o = T(n, !1, !1);
|
|
1290
|
+
if (!o) return !1;
|
|
1291
|
+
const s = d.get(o) || t;
|
|
1292
|
+
return m(o, s), d.set(o, s), b = o, ye(o), !0;
|
|
1293
|
+
},
|
|
1294
|
+
toggleSmartPastePanel: (r, n) => {
|
|
1295
|
+
const o = T(n, !1, !1);
|
|
1296
|
+
if (!o) return !1;
|
|
1297
|
+
const s = d.get(o) || t;
|
|
1298
|
+
return m(o, s), d.set(o, s), b = o, xe(o, typeof r == "boolean" ? r : void 0);
|
|
1299
|
+
},
|
|
1300
|
+
cycleSmartPasteProfile: (r, n) => {
|
|
1301
|
+
const o = T(n, !1, !1);
|
|
1302
|
+
if (!o) return !1;
|
|
1303
|
+
const s = d.get(o) || t, l = m(o, s);
|
|
1304
|
+
return d.set(o, s), l.profile = ae(l.profile), S(o), !0;
|
|
1305
|
+
},
|
|
1306
|
+
setSmartPasteProfile: (r, n) => {
|
|
1307
|
+
const o = T(n, !1, !1);
|
|
1308
|
+
if (!o) return !1;
|
|
1309
|
+
const s = d.get(o) || t, l = m(o, s);
|
|
1310
|
+
return d.set(o, s), l.profile = H(r), S(o), !0;
|
|
1311
|
+
},
|
|
1312
|
+
toggleSmartPasteEnabled: (r, n) => {
|
|
1313
|
+
const o = T(n, !1, !1);
|
|
1314
|
+
if (!o) return !1;
|
|
1315
|
+
const s = d.get(o) || t, l = m(o, s);
|
|
1316
|
+
return d.set(o, s), l.enabled = typeof r == "boolean" ? r : !l.enabled, z(o), S(o), !0;
|
|
1317
|
+
},
|
|
1318
|
+
setSmartPasteOptions: (r, n) => {
|
|
1319
|
+
var f, p, y, g, P, C;
|
|
1320
|
+
const o = T(n, !1, !1);
|
|
1321
|
+
if (!o || !r || typeof r != "object") return !1;
|
|
1322
|
+
const s = d.get(o) || t, l = ce(s), c = V({
|
|
1323
|
+
...l,
|
|
1324
|
+
...r,
|
|
1325
|
+
labels: {
|
|
1326
|
+
...s.labels,
|
|
1327
|
+
...r.labels || {}
|
|
1328
|
+
},
|
|
1329
|
+
profileOptions: {
|
|
1330
|
+
...l.profileOptions,
|
|
1331
|
+
...r.profileOptions || {},
|
|
1332
|
+
fidelity: {
|
|
1333
|
+
...((f = l.profileOptions) == null ? void 0 : f.fidelity) || {},
|
|
1334
|
+
...((p = r.profileOptions) == null ? void 0 : p.fidelity) || {}
|
|
1335
|
+
},
|
|
1336
|
+
balanced: {
|
|
1337
|
+
...((y = l.profileOptions) == null ? void 0 : y.balanced) || {},
|
|
1338
|
+
...((g = r.profileOptions) == null ? void 0 : g.balanced) || {}
|
|
1339
|
+
},
|
|
1340
|
+
plain: {
|
|
1341
|
+
...((P = l.profileOptions) == null ? void 0 : P.plain) || {},
|
|
1342
|
+
...((C = r.profileOptions) == null ? void 0 : C.plain) || {}
|
|
1343
|
+
}
|
|
1344
|
+
},
|
|
1345
|
+
normalizeText: r.normalizeText || s.normalizeText
|
|
1346
|
+
});
|
|
1347
|
+
d.set(o, c);
|
|
1348
|
+
const i = m(o, c);
|
|
1349
|
+
return typeof r.enabled == "boolean" && (i.enabled = r.enabled), r.defaultProfile && (i.profile = H(r.defaultProfile)), S(o), z(o), !0;
|
|
1350
|
+
},
|
|
1351
|
+
getSmartPasteState: (r, n) => {
|
|
1352
|
+
const o = T(n, !1, !1);
|
|
1353
|
+
if (!o) return !1;
|
|
1354
|
+
const s = d.get(o) || t, l = m(o, s), c = ve(l);
|
|
1355
|
+
if (typeof r == "function")
|
|
1356
|
+
try {
|
|
1357
|
+
r(c);
|
|
1358
|
+
} catch (i) {
|
|
1359
|
+
}
|
|
1360
|
+
return o.__smartPasteState = c, o.dispatchEvent(
|
|
1361
|
+
new CustomEvent("editora:smart-paste-state", {
|
|
1362
|
+
bubbles: !0,
|
|
1363
|
+
detail: c
|
|
1364
|
+
})
|
|
1365
|
+
), !0;
|
|
1366
|
+
}
|
|
1367
|
+
},
|
|
1368
|
+
keymap: {
|
|
1369
|
+
"Mod-Alt-Shift-s": "toggleSmartPastePanel",
|
|
1370
|
+
"Mod-Alt-Shift-S": "toggleSmartPastePanel",
|
|
1371
|
+
"Mod-Alt-Shift-v": "cycleSmartPasteProfile",
|
|
1372
|
+
"Mod-Alt-Shift-V": "cycleSmartPasteProfile",
|
|
1373
|
+
"Mod-Alt-Shift-g": "toggleSmartPasteEnabled",
|
|
1374
|
+
"Mod-Alt-Shift-G": "toggleSmartPasteEnabled"
|
|
1375
|
+
},
|
|
1376
|
+
init: function(n) {
|
|
1377
|
+
W += 1;
|
|
1378
|
+
const o = this && typeof this.__pluginConfig == "object" ? V({ ...ce(t), ...this.__pluginConfig }) : t;
|
|
1379
|
+
at(o);
|
|
1380
|
+
const s = T(
|
|
1381
|
+
n != null && n.editorElement ? { editorElement: n.editorElement } : void 0,
|
|
1382
|
+
!1,
|
|
1383
|
+
!1
|
|
1384
|
+
);
|
|
1385
|
+
if (!s) return;
|
|
1386
|
+
b = s, a.add(s);
|
|
1387
|
+
const l = m(s, o);
|
|
1388
|
+
l.enabled = o.enabled, l.profile = o.defaultProfile, d.set(s, o), z(s);
|
|
1389
|
+
},
|
|
1390
|
+
destroy: () => {
|
|
1391
|
+
a.forEach((r) => be(r)), a.clear(), W = Math.max(0, W - 1), !(W > 0) && ot();
|
|
1392
|
+
}
|
|
1393
|
+
};
|
|
1394
|
+
};
|
|
1395
|
+
export {
|
|
1396
|
+
st as SmartPastePlugin
|
|
1397
|
+
};
|
|
1398
|
+
//# sourceMappingURL=SmartPastePlugin.native-BOKKtF07.mjs.map
|