@editora/plugins 1.0.21 → 1.0.23
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 +259 -645
- package/dist/{CodePlugin.native-D8gGxB8i.mjs → CodePlugin.native-DESvGCrJ.mjs} +61 -53
- package/dist/{CodePlugin.native-CKJo7IFG.js → CodePlugin.native-DJqwsRPZ.js} +11 -11
- package/dist/a11y-checker.cjs.js +3 -3
- package/dist/a11y-checker.esm.js +6 -4
- package/dist/anchor.cjs.js +4 -4
- package/dist/anchor.esm.js +19 -18
- package/dist/anchoredPopover-BNJ8e7j-.mjs +128 -0
- package/dist/anchoredPopover-Cygmit_o.js +1 -0
- package/dist/approval-workflow.cjs.js +7 -7
- package/dist/approval-workflow.esm.js +55 -54
- package/dist/background-color.cjs.js +2 -2
- package/dist/background-color.esm.js +72 -67
- package/dist/blocks-library.cjs.js +18 -19
- package/dist/blocks-library.esm.js +41 -42
- package/dist/citations.cjs.js +4 -4
- package/dist/citations.esm.js +50 -50
- package/dist/code-sample.cjs.js +10 -10
- package/dist/code-sample.esm.js +4 -4
- package/dist/code.cjs.js +1 -1
- package/dist/code.esm.js +1 -1
- package/dist/comments.cjs.js +23 -11
- package/dist/comments.esm.js +167 -149
- package/dist/conditional-content.cjs.js +2 -2
- package/dist/conditional-content.esm.js +2 -2
- package/dist/confirmDialog-6BPaNPis.mjs +106 -0
- package/dist/confirmDialog-C4UWENes.js +46 -0
- package/dist/content-rules.cjs.js +6 -6
- package/dist/content-rules.esm.js +51 -51
- package/dist/data-binding.cjs.js +2 -2
- package/dist/data-binding.esm.js +2 -2
- package/dist/dialogHelpers-BbwpIXD9.mjs +183 -0
- package/dist/dialogHelpers-BxSQ7A6M.js +12 -0
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +1 -1
- package/dist/{documentManager-BL98a7YZ.mjs → documentManager-BFjGIeI8.mjs} +793 -781
- package/dist/{documentManager-r8t7yZEd.js → documentManager-C9d17K5W.js} +10 -10
- package/dist/embed-iframe.cjs.js +6 -6
- package/dist/embed-iframe.esm.js +6 -6
- package/dist/emojis.cjs.js +5 -5
- package/dist/emojis.esm.js +3 -3
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +1 -1
- package/dist/format-painter.cjs.js +1 -1
- package/dist/format-painter.esm.js +172 -151
- package/dist/heading.cjs.js +1 -1
- package/dist/heading.esm.js +96 -83
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +176 -97
- package/dist/{index-D5xugkYA.js → index-CtR8olYy.js} +2 -2
- package/dist/{index-B-VitI3v.mjs → index-Du_Ljqfz.mjs} +36 -35
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/katex-Cc3-mvOY.js +257 -0
- package/dist/katex-DoRnZ_sp.mjs +11682 -0
- package/dist/katex.min--Ws3c9be.mjs +5 -0
- package/dist/katex.min-Dk2VscxB.js +2 -0
- package/dist/link.cjs.js +3 -3
- package/dist/link.esm.js +3 -3
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +140 -52
- package/dist/math.cjs.js +14 -14
- package/dist/math.esm.js +149 -136
- package/dist/media-manager.cjs.js +46 -46
- package/dist/media-manager.esm.js +320 -264
- package/dist/mentions.cjs.js +12 -12
- package/dist/mentions.esm.js +149 -143
- package/dist/merge-tag.cjs.js +5 -3
- package/dist/merge-tag.esm.js +5 -3
- package/dist/notify-BkbzMopb.js +32 -0
- package/dist/notify-zOp-mUOJ.mjs +59 -0
- package/dist/pii-redaction.cjs.js +1 -1
- package/dist/pii-redaction.esm.js +1 -1
- package/dist/preview.cjs.js +1 -1
- package/dist/preview.esm.js +1 -1
- package/dist/shared-config.cjs.js +1 -1
- package/dist/shared-config.esm.js +14 -14
- package/dist/slash-commands.cjs.js +5 -5
- package/dist/slash-commands.esm.js +259 -236
- package/dist/smart-paste.cjs.js +1 -1
- package/dist/smart-paste.esm.js +1 -1
- package/dist/special-characters.cjs.js +3 -3
- package/dist/special-characters.esm.js +3 -3
- package/dist/spell-check.cjs.js +9 -9
- package/dist/spell-check.esm.js +288 -251
- package/dist/table.cjs.js +14 -14
- package/dist/table.esm.js +175 -154
- package/dist/template.cjs.js +5 -3
- package/dist/template.esm.js +15 -13
- package/dist/text-color.cjs.js +4 -4
- package/dist/text-color.esm.js +38 -34
- package/dist/translation-workflow.cjs.js +9 -9
- package/dist/translation-workflow.esm.js +98 -95
- package/dist/version-diff.cjs.js +4 -4
- package/dist/version-diff.esm.js +36 -36
- package/package.json +6 -5
- package/dist/anchoredPopover-Bg-ey7Yo.js +0 -1
- package/dist/anchoredPopover-D_JbjvdA.mjs +0 -111
- package/dist/dialogHelpers-5d5BuOCW.mjs +0 -39
- package/dist/dialogHelpers-zU6zpMIA.js +0 -12
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
const E = '.rte-content, .editora-content, [contenteditable="true"]',
|
|
1
|
+
const E = '.rte-content, .editora-content, [contenteditable="true"]', lt = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", N = "p,div,li,h1,h2,h3,h4,h5,h6,blockquote,pre,td,th", _ = "ul,ol", p = "b,strong,i,em,u,s,strike,font,span", R = "td,th", d = "data-editora-format-painter-bookmark", O = ["link", "address", "comments", "citations", "track-changes"], L = [
|
|
2
2
|
"fontFamily",
|
|
3
3
|
"fontSize",
|
|
4
4
|
"color",
|
|
5
5
|
"backgroundColor",
|
|
6
6
|
"textTransform"
|
|
7
|
-
],
|
|
7
|
+
], ct = [
|
|
8
8
|
"textAlign",
|
|
9
9
|
"lineHeight",
|
|
10
10
|
"marginLeft",
|
|
11
11
|
"marginRight"
|
|
12
|
-
],
|
|
12
|
+
], ut = ["listStyleType"], ft = [
|
|
13
13
|
"borderCollapse",
|
|
14
14
|
"borderSpacing",
|
|
15
15
|
"width"
|
|
16
|
-
],
|
|
16
|
+
], dt = [
|
|
17
17
|
"backgroundColor",
|
|
18
18
|
"textAlign",
|
|
19
19
|
"verticalAlign",
|
|
@@ -52,55 +52,55 @@ const E = '.rte-content, .editora-content, [contenteditable="true"]', st = "[dat
|
|
|
52
52
|
tablecells: "table",
|
|
53
53
|
textcolor: "color",
|
|
54
54
|
texttransform: "texttransform"
|
|
55
|
-
},
|
|
56
|
-
let I = null, P = !1,
|
|
55
|
+
}, mt = '<svg width="24" height="24" focusable="false" viewBox="0 0 24 24"><path d="M17.8 3.2a2.8 2.8 0 0 1 4 4L14 15l-4-4 7.8-7.8Zm-1.4 4.2L19 10l1.4-1.4-2.6-2.6-1.4 1.4Zm-7.8 5 3 3-1.4 1.4c-.5.5-1.2.8-1.9.8H7.2l-1.6 1.6a2.7 2.7 0 0 1-3.8 0 1 1 0 0 1 0-1.4l6.8-5.4Zm-.2 3.2H9l-4.6 3.7c.2 0 .5-.2.7-.4l1.9-1.9c.2-.2.4-.3.7-.3h1.1c.2 0 .5-.1.6-.3l.2-.2-1.2-1.3ZM5.5 3l.7 1.8L8 5.5l-1.8.7L5.5 8l-.7-1.8L3 5.5l1.8-.7L5.5 3Zm3.8 4.4.5 1.2 1.2.5-1.2.5-.5 1.2-.5-1.2-1.2-.5 1.2-.5.5-1.2Z" fill-rule="evenodd"></path></svg>', v = /* @__PURE__ */ new WeakMap();
|
|
56
|
+
let I = null, P = !1, C = {
|
|
57
57
|
ignoredFormats: O,
|
|
58
58
|
keepActiveAfterMouseApply: !1
|
|
59
59
|
};
|
|
60
|
-
const
|
|
60
|
+
const ie = (t = {}) => {
|
|
61
61
|
const e = {
|
|
62
62
|
ignoredFormats: t.ignoredFormats ?? O,
|
|
63
63
|
keepActiveAfterMouseApply: t.keepActiveAfterMouseApply ?? !1
|
|
64
64
|
};
|
|
65
|
-
return
|
|
65
|
+
return C = e, {
|
|
66
66
|
name: "formatPainter",
|
|
67
67
|
toolbar: [
|
|
68
68
|
{
|
|
69
69
|
label: "Format Painter",
|
|
70
70
|
command: "toggleFormatPainter",
|
|
71
|
-
icon:
|
|
71
|
+
icon: mt,
|
|
72
72
|
shortcut: "Ctrl+Alt+C / Ctrl+Alt+V"
|
|
73
73
|
}
|
|
74
74
|
],
|
|
75
75
|
commands: {
|
|
76
76
|
retrieveFormats: (n, r) => Y(r, e),
|
|
77
|
-
paintFormats: (n, r) =>
|
|
78
|
-
toggleFormatPainter: (n, r) =>
|
|
79
|
-
cancelFormatPainter: (n, r) =>
|
|
77
|
+
paintFormats: (n, r) => j(r, e),
|
|
78
|
+
toggleFormatPainter: (n, r) => gt(r, e),
|
|
79
|
+
cancelFormatPainter: (n, r) => J(r)
|
|
80
80
|
},
|
|
81
81
|
initialize: () => {
|
|
82
|
-
|
|
82
|
+
Et();
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
85
|
};
|
|
86
|
-
function Y(t, e =
|
|
87
|
-
const n =
|
|
86
|
+
function Y(t, e = C) {
|
|
87
|
+
const n = T(t);
|
|
88
88
|
if (!n) return !1;
|
|
89
89
|
const r = U(n, e);
|
|
90
90
|
if (!r) return !1;
|
|
91
91
|
const o = g(n);
|
|
92
92
|
return o.options = e, o.snapshot = r, I = r, M(n, !1), !0;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
const n =
|
|
94
|
+
function j(t, e = C) {
|
|
95
|
+
const n = T(t);
|
|
96
96
|
if (!n) return !1;
|
|
97
97
|
const r = g(n);
|
|
98
98
|
r.options = e;
|
|
99
99
|
const o = r.snapshot || I;
|
|
100
100
|
return o ? Q(n, o) : !1;
|
|
101
101
|
}
|
|
102
|
-
function
|
|
103
|
-
const n =
|
|
102
|
+
function gt(t, e = C) {
|
|
103
|
+
const n = T(t);
|
|
104
104
|
if (!n) return !1;
|
|
105
105
|
const r = g(n);
|
|
106
106
|
if (r.options = e, r.active)
|
|
@@ -108,32 +108,32 @@ function dt(t, e = p) {
|
|
|
108
108
|
const o = U(n, e);
|
|
109
109
|
return o ? (r.snapshot = o, I = o, h(n, !0), !0) : !1;
|
|
110
110
|
}
|
|
111
|
-
function
|
|
112
|
-
const e =
|
|
111
|
+
function J(t) {
|
|
112
|
+
const e = T(t);
|
|
113
113
|
return e ? (h(e, !1), !0) : (document.querySelectorAll(`${E}.rte-format-painter-active`).forEach((n) => {
|
|
114
114
|
h(n, !1);
|
|
115
115
|
}), !0);
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
P || typeof document > "u" || (P = !0, document.addEventListener("keydown",
|
|
117
|
+
function Et() {
|
|
118
|
+
P || typeof document > "u" || (P = !0, document.addEventListener("keydown", ht, !0), document.addEventListener("mouseup", pt, !0));
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function ht(t) {
|
|
121
121
|
const e = t.key.toLowerCase(), n = t.ctrlKey || t.metaKey;
|
|
122
122
|
if (t.key === "Escape") {
|
|
123
|
-
|
|
123
|
+
J();
|
|
124
124
|
return;
|
|
125
125
|
}
|
|
126
126
|
if (!n || !t.altKey || t.shiftKey) return;
|
|
127
|
-
const r =
|
|
127
|
+
const r = G() || T();
|
|
128
128
|
if (r) {
|
|
129
129
|
if (e === "c") {
|
|
130
130
|
Y({ contentElement: r }, g(r).options) && t.preventDefault();
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
133
|
-
e === "v" &&
|
|
133
|
+
e === "v" && j({ contentElement: r }, g(r).options) && t.preventDefault();
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
|
-
function
|
|
136
|
+
function pt(t) {
|
|
137
137
|
const e = t.target;
|
|
138
138
|
if (e?.closest(".rte-toolbar-wrapper, .editora-toolbar-container")) return;
|
|
139
139
|
const n = e?.closest(E);
|
|
@@ -146,25 +146,25 @@ function Et(t) {
|
|
|
146
146
|
}
|
|
147
147
|
function g(t) {
|
|
148
148
|
let e = v.get(t);
|
|
149
|
-
return e || (e = { snapshot: null, active: !1, options:
|
|
149
|
+
return e || (e = { snapshot: null, active: !1, options: C }, v.set(t, e)), e;
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function T(t) {
|
|
152
152
|
if (t?.contentElement instanceof HTMLElement) return t.contentElement;
|
|
153
|
-
const e =
|
|
153
|
+
const e = H(t?.editorElement ?? null);
|
|
154
154
|
if (e) return e;
|
|
155
|
-
const n = typeof window < "u" ? window.__editoraCommandEditorRoot : null, r =
|
|
156
|
-
return r ||
|
|
155
|
+
const n = typeof window < "u" ? window.__editoraCommandEditorRoot : null, r = H(n);
|
|
156
|
+
return r || G() || Ct();
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function H(t) {
|
|
159
159
|
return t ? t.matches(E) ? t : t.querySelector(E) : null;
|
|
160
160
|
}
|
|
161
|
-
function
|
|
161
|
+
function G() {
|
|
162
162
|
const t = window.getSelection();
|
|
163
163
|
if (!t || t.rangeCount === 0) return null;
|
|
164
164
|
const e = t.getRangeAt(0), r = f(e.commonAncestorContainer)?.closest(E);
|
|
165
165
|
return r instanceof HTMLElement ? r : null;
|
|
166
166
|
}
|
|
167
|
-
function
|
|
167
|
+
function Ct() {
|
|
168
168
|
const t = document.activeElement;
|
|
169
169
|
if (!(t instanceof HTMLElement)) return null;
|
|
170
170
|
const e = t.closest(E);
|
|
@@ -176,22 +176,22 @@ function f(t) {
|
|
|
176
176
|
function U(t, e) {
|
|
177
177
|
const n = window.getSelection(), r = n && n.rangeCount > 0 ? n.getRangeAt(0) : null, o = r ? r.collapsed ? r.startContainer : r.commonAncestorContainer : null, i = f(o) || t;
|
|
178
178
|
if (!t.contains(i)) return null;
|
|
179
|
-
const s =
|
|
179
|
+
const s = oe(e.ignoredFormats), a = ot(i, t), l = i.closest("li"), u = l?.closest(_), m = i.closest(R), at = m?.closest("table");
|
|
180
180
|
return {
|
|
181
|
-
inline:
|
|
182
|
-
block: !c(s, "block") && a ?
|
|
183
|
-
list: !c(s, "list") && u ?
|
|
184
|
-
table: c(s, "table") ? null :
|
|
181
|
+
inline: Tt(r, i, t, s),
|
|
182
|
+
block: !c(s, "block") && a ? Nt(a, s) : null,
|
|
183
|
+
list: !c(s, "list") && u ? kt(u, l) : null,
|
|
184
|
+
table: c(s, "table") ? null : At(at, m, s),
|
|
185
185
|
ignoredFormats: s
|
|
186
186
|
};
|
|
187
187
|
}
|
|
188
|
-
function
|
|
188
|
+
function Tt(t, e, n, r) {
|
|
189
189
|
if (!t || t.collapsed)
|
|
190
|
-
return
|
|
191
|
-
const i =
|
|
192
|
-
return
|
|
190
|
+
return D(e, r);
|
|
191
|
+
const i = St(t, e, n).map((s) => D(s, r));
|
|
192
|
+
return bt(i);
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function St(t, e, n) {
|
|
195
195
|
const r = [], o = document.createTreeWalker(
|
|
196
196
|
t.commonAncestorContainer,
|
|
197
197
|
NodeFilter.SHOW_TEXT,
|
|
@@ -206,17 +206,17 @@ function Ct(t, e, n) {
|
|
|
206
206
|
}
|
|
207
207
|
return r.length > 0 ? r : [e];
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function D(t, e) {
|
|
210
210
|
const n = window.getComputedStyle(t), r = {};
|
|
211
|
-
c(e, "bold") || (r.bold =
|
|
211
|
+
c(e, "bold") || (r.bold = yt(t, n)), c(e, "italic") || (r.italic = Lt(t, n)), c(e, "underline") || (r.underline = $(t, n, "underline")), c(e, "strikethrough") || (r.strikethrough = $(t, n, "line-through"));
|
|
212
212
|
const o = {};
|
|
213
213
|
return L.forEach((i) => {
|
|
214
214
|
if (c(e, i)) return;
|
|
215
215
|
const s = n[i];
|
|
216
|
-
|
|
216
|
+
wt(i, s) && (o[i] = s);
|
|
217
217
|
}), { marks: r, styles: o };
|
|
218
218
|
}
|
|
219
|
-
function
|
|
219
|
+
function bt(t) {
|
|
220
220
|
const e = {};
|
|
221
221
|
["bold", "italic", "underline", "strikethrough"].forEach((o) => {
|
|
222
222
|
const i = t.map((s) => s.marks[o]).filter((s) => s != null);
|
|
@@ -228,23 +228,23 @@ function Tt(t) {
|
|
|
228
228
|
i.length === t.length && i.every((s) => s === i[0]) && (r[o] = i[0]);
|
|
229
229
|
}), { marks: e, styles: r };
|
|
230
230
|
}
|
|
231
|
-
function
|
|
231
|
+
function Nt(t, e) {
|
|
232
232
|
const n = window.getComputedStyle(t), r = {};
|
|
233
|
-
|
|
233
|
+
ct.forEach((s) => {
|
|
234
234
|
if (c(e, s)) return;
|
|
235
235
|
const l = t.style[s] || n[s];
|
|
236
|
-
|
|
236
|
+
Rt(s, l) && (r[s] = l);
|
|
237
237
|
});
|
|
238
238
|
const o = {}, i = t.getAttribute("dir") || t.style.direction;
|
|
239
239
|
return (i === "ltr" || i === "rtl" || i === "auto") && (o.dir = i), {
|
|
240
|
-
tagName:
|
|
240
|
+
tagName: it(t),
|
|
241
241
|
styles: r,
|
|
242
242
|
attrs: o
|
|
243
243
|
};
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function kt(t, e) {
|
|
246
246
|
const n = {};
|
|
247
|
-
|
|
247
|
+
ut.forEach((i) => {
|
|
248
248
|
const s = t.style[i] || window.getComputedStyle(t)[i];
|
|
249
249
|
s && s !== "disc" && s !== "decimal" && (n[i] = s);
|
|
250
250
|
});
|
|
@@ -258,10 +258,10 @@ function Nt(t, e) {
|
|
|
258
258
|
itemAttrs: o
|
|
259
259
|
};
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function At(t, e, n) {
|
|
262
262
|
return !t && !e ? null : {
|
|
263
|
-
table: t ? W(t,
|
|
264
|
-
cell: e ? W(e,
|
|
263
|
+
table: t ? W(t, ft, n) : null,
|
|
264
|
+
cell: e ? W(e, dt, n) : null
|
|
265
265
|
};
|
|
266
266
|
}
|
|
267
267
|
function W(t, e, n) {
|
|
@@ -269,28 +269,28 @@ function W(t, e, n) {
|
|
|
269
269
|
return e.forEach((i) => {
|
|
270
270
|
if (c(n, i)) return;
|
|
271
271
|
const a = t.style[i] || r[i];
|
|
272
|
-
|
|
272
|
+
Ft(i, a) && (o[i] = a);
|
|
273
273
|
}), { styles: o, attrs: {} };
|
|
274
274
|
}
|
|
275
|
-
function
|
|
275
|
+
function yt(t, e) {
|
|
276
276
|
if (t.closest("b,strong")) return !0;
|
|
277
277
|
const n = e.fontWeight;
|
|
278
278
|
return /^(bold|bolder|[5-9]\d{2,})$/.test(n);
|
|
279
279
|
}
|
|
280
|
-
function
|
|
280
|
+
function Lt(t, e) {
|
|
281
281
|
return !!t.closest("i,em") || e.fontStyle === "italic";
|
|
282
282
|
}
|
|
283
283
|
function $(t, e, n) {
|
|
284
284
|
const r = n === "underline" ? "u" : "s,strike";
|
|
285
285
|
return !!t.closest(r) || e.textDecorationLine.includes(n);
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function wt(t, e) {
|
|
288
288
|
return !(!e || t === "backgroundColor" && (e === "rgba(0, 0, 0, 0)" || e === "transparent") || t === "textTransform" && e === "none");
|
|
289
289
|
}
|
|
290
|
-
function
|
|
290
|
+
function Rt(t, e) {
|
|
291
291
|
return !(!e || t === "textAlign" && e === "start" || t === "lineHeight" && e === "normal" || (t === "marginLeft" || t === "marginRight") && e === "0px");
|
|
292
292
|
}
|
|
293
|
-
function
|
|
293
|
+
function Ft(t, e) {
|
|
294
294
|
return !(!e || (t === "backgroundColor" || t.endsWith("Color")) && (e === "rgba(0, 0, 0, 0)" || e === "transparent") || t === "textAlign" && e === "start" || t === "verticalAlign" && e === "middle" || t.endsWith("Width") && e === "0px" || t.endsWith("Style") && e === "none" || t.startsWith("padding") && e === "0px" || t === "borderSpacing" && e === "0px" || t === "width" && e === "auto");
|
|
295
295
|
}
|
|
296
296
|
function Q(t, e) {
|
|
@@ -298,27 +298,27 @@ function Q(t, e) {
|
|
|
298
298
|
if (!n || n.rangeCount === 0) return !1;
|
|
299
299
|
const r = n.getRangeAt(0);
|
|
300
300
|
if (!t.contains(r.startContainer) || !t.contains(r.endContainer)) return !1;
|
|
301
|
-
const o = t.innerHTML, i = !r.collapsed, s =
|
|
302
|
-
|
|
301
|
+
const o = t.innerHTML, i = !r.collapsed, s = Ut(t);
|
|
302
|
+
_t(t, r, e.table), Mt(t, r, e), s?.();
|
|
303
303
|
const a = window.getSelection(), l = a && a.rangeCount > 0 ? a.getRangeAt(0) : null;
|
|
304
|
-
i && a && l && t.contains(l.startContainer) && t.contains(l.endContainer) &&
|
|
304
|
+
i && a && l && t.contains(l.startContainer) && t.contains(l.endContainer) && Ot(l, a, e), ee(t), ne(t);
|
|
305
305
|
const u = t.innerHTML;
|
|
306
|
-
return o === u ? !1 : (
|
|
306
|
+
return o === u ? !1 : (re(t, o, u), t.dispatchEvent(new Event("input", { bubbles: !0 })), !0);
|
|
307
307
|
}
|
|
308
|
-
function
|
|
309
|
-
const r =
|
|
310
|
-
n.list &&
|
|
308
|
+
function Mt(t, e, n) {
|
|
309
|
+
const r = Jt(t, e);
|
|
310
|
+
n.list && Vt(r, n.list), n.block && r.forEach((o) => {
|
|
311
311
|
const i = o.isConnected ? o : null;
|
|
312
312
|
if (!i) return;
|
|
313
|
-
const s =
|
|
314
|
-
|
|
313
|
+
const s = Yt(i, n.block.tagName);
|
|
314
|
+
k(s, Xt(s, n.block.styles)), n.block.attrs.dir ? s.setAttribute("dir", n.block.attrs.dir) : s.removeAttribute("dir");
|
|
315
315
|
});
|
|
316
316
|
}
|
|
317
|
-
function
|
|
317
|
+
function _t(t, e, n) {
|
|
318
318
|
if (!n) return;
|
|
319
|
-
const r =
|
|
319
|
+
const r = Zt(t, e);
|
|
320
320
|
if (n.cell && r.forEach((i) => {
|
|
321
|
-
|
|
321
|
+
k(i, n.cell.styles);
|
|
322
322
|
}), !n.table) return;
|
|
323
323
|
const o = /* @__PURE__ */ new Set();
|
|
324
324
|
if (r.forEach((i) => {
|
|
@@ -329,36 +329,51 @@ function Ft(t, e, n) {
|
|
|
329
329
|
i instanceof HTMLElement && t.contains(i) && o.add(i);
|
|
330
330
|
}
|
|
331
331
|
o.forEach((i) => {
|
|
332
|
-
|
|
332
|
+
k(i, n.table.styles);
|
|
333
333
|
});
|
|
334
334
|
}
|
|
335
|
-
function
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
335
|
+
function tt(t) {
|
|
336
|
+
let e = t instanceof HTMLElement ? t : t?.parentElement ?? null;
|
|
337
|
+
for (; e && e.matches(p); ) e = e.parentElement;
|
|
338
|
+
return e;
|
|
339
|
+
}
|
|
340
|
+
function et(t, e) {
|
|
341
|
+
if (!e) return t;
|
|
342
|
+
const n = window.getComputedStyle(e), r = {};
|
|
343
|
+
return Object.entries(t.styles).forEach(([o, i]) => {
|
|
344
|
+
n[o] !== i && (r[o] = i);
|
|
345
|
+
}), { ...t, styles: r };
|
|
346
|
+
}
|
|
347
|
+
function Ot(t, e, n) {
|
|
348
|
+
Ht(t);
|
|
349
|
+
const r = et(n.inline, tt(t.commonAncestorContainer)), o = t.cloneContents();
|
|
350
|
+
if (Gt(o)) {
|
|
351
|
+
It(t, e, n);
|
|
340
352
|
return;
|
|
341
353
|
}
|
|
342
354
|
const i = t.extractContents();
|
|
343
|
-
|
|
355
|
+
Kt(i, n);
|
|
344
356
|
const s = document.createDocumentFragment(), a = K("start"), l = K("end");
|
|
345
|
-
s.appendChild(a), s.appendChild(
|
|
357
|
+
s.appendChild(a), s.appendChild(rt(i, r)), s.appendChild(l), t.insertNode(s), Wt(a, l, n);
|
|
346
358
|
const u = document.createRange();
|
|
347
359
|
u.setStartAfter(a), u.setEndBefore(l), e.removeAllRanges(), e.addRange(u);
|
|
348
360
|
}
|
|
349
|
-
function
|
|
350
|
-
const r =
|
|
361
|
+
function It(t, e, n) {
|
|
362
|
+
const r = xt(t), o = [];
|
|
351
363
|
if (r.forEach((s) => {
|
|
352
|
-
let a =
|
|
353
|
-
if (!a || !a.data.trim() ||
|
|
354
|
-
a =
|
|
355
|
-
const l =
|
|
364
|
+
let a = Bt(s, t);
|
|
365
|
+
if (!a || !a.data.trim() || zt(a)) return;
|
|
366
|
+
a = vt(a, n);
|
|
367
|
+
const l = rt(
|
|
368
|
+
document.createTextNode(a.data),
|
|
369
|
+
et(n.inline, tt(a))
|
|
370
|
+
);
|
|
356
371
|
a.parentNode?.replaceChild(l, a), o.push(l);
|
|
357
372
|
}), o.length === 0) return;
|
|
358
373
|
const i = document.createRange();
|
|
359
374
|
i.setStartBefore(o[0]), i.setEndAfter(o[o.length - 1]), e.removeAllRanges(), e.addRange(i);
|
|
360
375
|
}
|
|
361
|
-
function
|
|
376
|
+
function xt(t) {
|
|
362
377
|
if (t.startContainer === t.endContainer && t.startContainer.nodeType === Node.TEXT_NODE)
|
|
363
378
|
return [t.startContainer];
|
|
364
379
|
const e = [], n = document.createTreeWalker(t.commonAncestorContainer, NodeFilter.SHOW_TEXT, {
|
|
@@ -369,21 +384,21 @@ function Ot(t) {
|
|
|
369
384
|
e.push(r), r = n.nextNode();
|
|
370
385
|
return e;
|
|
371
386
|
}
|
|
372
|
-
function
|
|
387
|
+
function Bt(t, e) {
|
|
373
388
|
const n = t.data.length;
|
|
374
389
|
let r = 0, o = n;
|
|
375
390
|
if (t === e.startContainer && (r = Math.max(0, Math.min(e.startOffset, n))), t === e.endContainer && (o = Math.max(0, Math.min(e.endOffset, n))), r >= o) return null;
|
|
376
391
|
let i = t;
|
|
377
392
|
return o < i.data.length && i.splitText(o), r > 0 && (i = i.splitText(r)), i;
|
|
378
393
|
}
|
|
379
|
-
function
|
|
394
|
+
function vt(t, e) {
|
|
380
395
|
const n = t;
|
|
381
396
|
let r = n.parentElement;
|
|
382
|
-
for (; r && r.matches(
|
|
383
|
-
|
|
397
|
+
for (; r && r.matches(p) && !x(r, e) && nt(r, e); )
|
|
398
|
+
Pt(r, n), r = n.parentElement;
|
|
384
399
|
return n;
|
|
385
400
|
}
|
|
386
|
-
function
|
|
401
|
+
function Pt(t, e) {
|
|
387
402
|
const n = t.parentNode;
|
|
388
403
|
if (!n || e.parentNode !== t) return;
|
|
389
404
|
const r = t.cloneNode(!1), o = t.cloneNode(!1);
|
|
@@ -396,25 +411,25 @@ function Bt(t, e) {
|
|
|
396
411
|
function q(t) {
|
|
397
412
|
return Array.from(t.childNodes).some((e) => e.nodeType !== Node.TEXT_NODE ? !0 : !!(e.textContent || "").trim());
|
|
398
413
|
}
|
|
399
|
-
function
|
|
414
|
+
function Ht(t) {
|
|
400
415
|
let e = f(t.startContainer), n = f(t.endContainer);
|
|
401
|
-
for (; e && e === n && e.matches(
|
|
402
|
-
if (!
|
|
416
|
+
for (; e && e === n && e.matches(p); ) {
|
|
417
|
+
if (!Dt(t, e)) return;
|
|
403
418
|
t.selectNode(e), e = e.parentElement, n = f(t.endContainer);
|
|
404
419
|
}
|
|
405
420
|
}
|
|
406
|
-
function
|
|
421
|
+
function Dt(t, e) {
|
|
407
422
|
const n = document.createRange();
|
|
408
423
|
return n.selectNodeContents(e), t.compareBoundaryPoints(Range.START_TO_START, n) === 0 && t.compareBoundaryPoints(Range.END_TO_END, n) === 0;
|
|
409
424
|
}
|
|
410
|
-
function
|
|
425
|
+
function Wt(t, e, n) {
|
|
411
426
|
let r = f(t.parentNode);
|
|
412
427
|
for (; r && r.contains(e); ) {
|
|
413
428
|
const o = r.parentElement;
|
|
414
|
-
r.matches(
|
|
429
|
+
r.matches(p) && !x(r, n) && $t(r, t, e) && nt(r, n) && A(r), r = o;
|
|
415
430
|
}
|
|
416
431
|
}
|
|
417
|
-
function
|
|
432
|
+
function $t(t, e, n) {
|
|
418
433
|
let r = "before";
|
|
419
434
|
for (const o of Array.from(t.childNodes)) {
|
|
420
435
|
if (o === e) {
|
|
@@ -425,21 +440,21 @@ function Ht(t, e, n) {
|
|
|
425
440
|
r = "after";
|
|
426
441
|
continue;
|
|
427
442
|
}
|
|
428
|
-
if (r !== "inside" && !
|
|
443
|
+
if (r !== "inside" && !qt(o))
|
|
429
444
|
return !1;
|
|
430
445
|
}
|
|
431
446
|
return r === "after";
|
|
432
447
|
}
|
|
433
|
-
function
|
|
434
|
-
return t.nodeType === Node.TEXT_NODE ? !(t.textContent || "").replace(/\uFEFF/g, "").trim() : t.nodeType === Node.COMMENT_NODE ?
|
|
448
|
+
function qt(t) {
|
|
449
|
+
return t.nodeType === Node.TEXT_NODE ? !(t.textContent || "").replace(/\uFEFF/g, "").trim() : t.nodeType === Node.COMMENT_NODE ? st(t) : t.nodeType !== Node.ELEMENT_NODE ? !0 : t.hasAttribute(d);
|
|
435
450
|
}
|
|
436
|
-
function
|
|
451
|
+
function nt(t, e) {
|
|
437
452
|
return t.matches("span") ? L.some((n) => !c(e.ignoredFormats, n)) : t.matches("b,strong") ? !c(e.ignoredFormats, "bold") : t.matches("i,em") ? !c(e.ignoredFormats, "italic") : t.matches("u") ? !c(e.ignoredFormats, "underline") : t.matches("s,strike") ? !c(e.ignoredFormats, "strikethrough") : !0;
|
|
438
453
|
}
|
|
439
|
-
function
|
|
454
|
+
function zt(t) {
|
|
440
455
|
return t.nodeType !== Node.TEXT_NODE || (t.textContent || "").trim() ? !1 : !!t.parentElement?.matches(_);
|
|
441
456
|
}
|
|
442
|
-
function
|
|
457
|
+
function rt(t, e) {
|
|
443
458
|
let n = t;
|
|
444
459
|
const r = Object.entries(e.styles);
|
|
445
460
|
if (r.length > 0) {
|
|
@@ -448,57 +463,63 @@ function et(t, e) {
|
|
|
448
463
|
o.style.setProperty(B(i), s);
|
|
449
464
|
}), o.appendChild(n), n = o;
|
|
450
465
|
}
|
|
451
|
-
return e.marks.strikethrough && (n =
|
|
466
|
+
return e.marks.strikethrough && (n = S("s", n)), e.marks.underline && (n = S("u", n)), e.marks.italic && (n = S("i", n)), e.marks.bold && (n = S("b", n)), n;
|
|
452
467
|
}
|
|
453
|
-
function
|
|
468
|
+
function S(t, e) {
|
|
454
469
|
const n = document.createElement(t);
|
|
455
470
|
return n.appendChild(e), n;
|
|
456
471
|
}
|
|
457
|
-
function
|
|
458
|
-
Array.from(t.querySelectorAll(
|
|
472
|
+
function Kt(t, e) {
|
|
473
|
+
Array.from(t.querySelectorAll(p)).forEach((n) => {
|
|
459
474
|
if (n instanceof HTMLElement && !x(n, e)) {
|
|
460
475
|
if (n.matches("span")) {
|
|
461
476
|
if (L.forEach((r) => {
|
|
462
477
|
c(e.ignoredFormats, r) || n.style.removeProperty(B(r));
|
|
463
478
|
}), n.getAttribute("style") || n.attributes.length > 0) return;
|
|
464
|
-
|
|
479
|
+
A(n);
|
|
465
480
|
return;
|
|
466
481
|
}
|
|
467
|
-
n.matches("b,strong") && c(e.ignoredFormats, "bold") || n.matches("i,em") && c(e.ignoredFormats, "italic") || n.matches("u") && c(e.ignoredFormats, "underline") || n.matches("s,strike") && c(e.ignoredFormats, "strikethrough") ||
|
|
482
|
+
n.matches("b,strong") && c(e.ignoredFormats, "bold") || n.matches("i,em") && c(e.ignoredFormats, "italic") || n.matches("u") && c(e.ignoredFormats, "underline") || n.matches("s,strike") && c(e.ignoredFormats, "strikethrough") || A(n);
|
|
468
483
|
}
|
|
469
484
|
});
|
|
470
485
|
}
|
|
471
486
|
function x(t, e) {
|
|
472
|
-
return !!(t.matches("a") && c(e.ignoredFormats, "link") ||
|
|
487
|
+
return !!(t.matches("a") && c(e.ignoredFormats, "link") || w(t, "comment") && c(e.ignoredFormats, "comments") || w(t, "citation") && c(e.ignoredFormats, "citations") || w(t, "track") && c(e.ignoredFormats, "trackchanges"));
|
|
473
488
|
}
|
|
474
|
-
function
|
|
489
|
+
function w(t, e) {
|
|
475
490
|
const n = e.toLowerCase();
|
|
476
491
|
return t.className.toString().toLowerCase().includes(n) ? !0 : Array.from(t.attributes).some((o) => {
|
|
477
|
-
const i =
|
|
492
|
+
const i = y(o.name), s = o.value.toLowerCase();
|
|
478
493
|
return i.includes(n) || s.includes(n);
|
|
479
494
|
});
|
|
480
495
|
}
|
|
481
|
-
function
|
|
496
|
+
function Vt(t, e) {
|
|
482
497
|
t.filter((r) => r.tagName.toLowerCase() === "li").forEach((r) => {
|
|
483
498
|
const o = r.closest(_);
|
|
484
499
|
if (!o) return;
|
|
485
|
-
const i =
|
|
486
|
-
|
|
500
|
+
const i = jt(o, e.tagName);
|
|
501
|
+
k(i, e.styles), Z(i, e.attrs), Z(r, e.itemAttrs);
|
|
487
502
|
});
|
|
488
503
|
}
|
|
489
|
-
function
|
|
490
|
-
const n = Array.from(t.querySelectorAll(
|
|
504
|
+
function Zt(t, e) {
|
|
505
|
+
const n = Array.from(t.querySelectorAll(R)).filter((o) => o instanceof HTMLElement && e.intersectsNode(o));
|
|
491
506
|
if (n.length > 0) return n;
|
|
492
|
-
const r = f(e.startContainer)?.closest(
|
|
507
|
+
const r = f(e.startContainer)?.closest(R);
|
|
493
508
|
return r instanceof HTMLElement && t.contains(r) ? [r] : [];
|
|
494
509
|
}
|
|
495
|
-
function
|
|
510
|
+
function Xt(t, e) {
|
|
511
|
+
const n = window.getComputedStyle(t), r = {};
|
|
512
|
+
return Object.entries(e).forEach(([o, i]) => {
|
|
513
|
+
n[o] !== i && (r[o] = i);
|
|
514
|
+
}), r;
|
|
515
|
+
}
|
|
516
|
+
function k(t, e) {
|
|
496
517
|
Object.entries(e).forEach(([n, r]) => {
|
|
497
518
|
t.style.setProperty(B(n), r);
|
|
498
519
|
});
|
|
499
520
|
}
|
|
500
|
-
function
|
|
501
|
-
const n =
|
|
521
|
+
function Yt(t, e) {
|
|
522
|
+
const n = it(t);
|
|
502
523
|
if (n === e || n === "li" || n === "td" || n === "th") return t;
|
|
503
524
|
if (e === "blockquote") {
|
|
504
525
|
const o = document.createElement("blockquote");
|
|
@@ -510,35 +531,35 @@ function Vt(t, e) {
|
|
|
510
531
|
for (; t.firstChild; ) r.appendChild(t.firstChild);
|
|
511
532
|
return F(t, r), t.parentNode?.replaceChild(r, t), r;
|
|
512
533
|
}
|
|
513
|
-
function
|
|
534
|
+
function jt(t, e) {
|
|
514
535
|
if (t.tagName.toLowerCase() === e) return t;
|
|
515
536
|
const n = document.createElement(e);
|
|
516
537
|
for (; t.firstChild; ) n.appendChild(t.firstChild);
|
|
517
538
|
return F(t, n), t.parentNode?.replaceChild(n, t), n;
|
|
518
539
|
}
|
|
519
|
-
function
|
|
540
|
+
function Jt(t, e) {
|
|
520
541
|
const n = Array.from(t.querySelectorAll(N)).filter((o) => o instanceof HTMLElement && e.intersectsNode(o));
|
|
521
542
|
if (n.length > 0)
|
|
522
543
|
return n.filter((o) => !n.some((i) => i !== o && i.contains(o)));
|
|
523
|
-
const r =
|
|
544
|
+
const r = ot(f(e.startContainer), t);
|
|
524
545
|
return r ? [r] : [];
|
|
525
546
|
}
|
|
526
|
-
function
|
|
547
|
+
function ot(t, e) {
|
|
527
548
|
const n = t?.closest(N);
|
|
528
549
|
return n instanceof HTMLElement && e.contains(n) ? n : null;
|
|
529
550
|
}
|
|
530
|
-
function
|
|
551
|
+
function it(t) {
|
|
531
552
|
const e = t.tagName.toLowerCase();
|
|
532
553
|
return e === "blockquote" || /^h[1-6]$/.test(e) || e === "pre" || e === "li" || e === "td" || e === "th" ? e : "p";
|
|
533
554
|
}
|
|
534
|
-
function
|
|
555
|
+
function Gt(t) {
|
|
535
556
|
return Array.from(t.childNodes).some((e) => {
|
|
536
557
|
if (e.nodeType !== Node.ELEMENT_NODE) return !1;
|
|
537
558
|
const n = e;
|
|
538
559
|
return n.matches(N) || !!n.querySelector(N);
|
|
539
560
|
});
|
|
540
561
|
}
|
|
541
|
-
function
|
|
562
|
+
function Ut(t) {
|
|
542
563
|
const e = window.getSelection();
|
|
543
564
|
if (!e || e.rangeCount === 0) return null;
|
|
544
565
|
const n = e.getRangeAt(0);
|
|
@@ -562,13 +583,13 @@ function z(t) {
|
|
|
562
583
|
function K(t) {
|
|
563
584
|
return document.createComment(`${d}:inline:${t}`);
|
|
564
585
|
}
|
|
565
|
-
function
|
|
566
|
-
return
|
|
586
|
+
function st(t) {
|
|
587
|
+
return Qt(t) || te(t);
|
|
567
588
|
}
|
|
568
|
-
function
|
|
589
|
+
function Qt(t) {
|
|
569
590
|
return t.nodeType === Node.COMMENT_NODE && (t.nodeValue === `${d}:selection:start` || t.nodeValue === `${d}:selection:end`);
|
|
570
591
|
}
|
|
571
|
-
function
|
|
592
|
+
function te(t) {
|
|
572
593
|
return t.nodeType === Node.COMMENT_NODE && (t.nodeValue === `${d}:inline:start` || t.nodeValue === `${d}:inline:end`);
|
|
573
594
|
}
|
|
574
595
|
function V(t, e) {
|
|
@@ -580,20 +601,20 @@ function V(t, e) {
|
|
|
580
601
|
}
|
|
581
602
|
return null;
|
|
582
603
|
}
|
|
583
|
-
function
|
|
604
|
+
function ee(t) {
|
|
584
605
|
t.querySelectorAll(`[${d}]`).forEach((o) => o.remove());
|
|
585
606
|
const e = document.createTreeWalker(t, NodeFilter.SHOW_COMMENT), n = [];
|
|
586
607
|
let r = e.nextNode();
|
|
587
608
|
for (; r; )
|
|
588
|
-
|
|
609
|
+
st(r) && n.push(r), r = e.nextNode();
|
|
589
610
|
n.forEach((o) => o.remove());
|
|
590
611
|
}
|
|
591
|
-
function
|
|
612
|
+
function ne(t) {
|
|
592
613
|
t.querySelectorAll("span").forEach((e) => {
|
|
593
|
-
e instanceof HTMLElement && (e.attributes.length > 0 ||
|
|
614
|
+
e instanceof HTMLElement && (e.attributes.length > 0 || A(e));
|
|
594
615
|
});
|
|
595
616
|
}
|
|
596
|
-
function
|
|
617
|
+
function A(t) {
|
|
597
618
|
const e = t.parentNode;
|
|
598
619
|
if (e) {
|
|
599
620
|
for (; t.firstChild; )
|
|
@@ -624,7 +645,7 @@ function h(t, e) {
|
|
|
624
645
|
n.active = e, t.classList.toggle("rte-format-painter-active", e), M(t, e);
|
|
625
646
|
}
|
|
626
647
|
function M(t, e) {
|
|
627
|
-
const n = t.closest(
|
|
648
|
+
const n = t.closest(lt) || document;
|
|
628
649
|
n.querySelectorAll(
|
|
629
650
|
'[data-command="toggleFormatPainter"], [data-command="formatPainter"]'
|
|
630
651
|
).forEach((o) => {
|
|
@@ -636,7 +657,7 @@ function M(t, e) {
|
|
|
636
657
|
})
|
|
637
658
|
);
|
|
638
659
|
}
|
|
639
|
-
function
|
|
660
|
+
function re(t, e, n) {
|
|
640
661
|
if (e === n) return;
|
|
641
662
|
const r = window.execEditorCommand || window.executeEditorCommand;
|
|
642
663
|
if (typeof r == "function")
|
|
@@ -649,19 +670,19 @@ function te(t, e, n) {
|
|
|
649
670
|
}
|
|
650
671
|
}
|
|
651
672
|
}
|
|
652
|
-
function
|
|
653
|
-
return (t ?? O).map(
|
|
673
|
+
function oe(t) {
|
|
674
|
+
return (t ?? O).map(y).map((e) => X[e] || e).filter(Boolean);
|
|
654
675
|
}
|
|
655
676
|
function c(t, e) {
|
|
656
|
-
const n = X[
|
|
677
|
+
const n = X[y(e)] || y(e);
|
|
657
678
|
return t.includes(n);
|
|
658
679
|
}
|
|
659
|
-
function
|
|
680
|
+
function y(t) {
|
|
660
681
|
return t.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
661
682
|
}
|
|
662
683
|
function B(t) {
|
|
663
684
|
return t.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
|
|
664
685
|
}
|
|
665
686
|
export {
|
|
666
|
-
|
|
687
|
+
ie as FormatPainterPlugin
|
|
667
688
|
};
|