@editora/core 1.0.23 → 1.0.24

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.
Files changed (64) hide show
  1. package/dist/{A11yCheckerPlugin.native-qW_njhLY.mjs → A11yCheckerPlugin.native-BBCsR5Ur.mjs} +7 -5
  2. package/dist/{AnchorPlugin.native-Drmxhy98.mjs → AnchorPlugin.native-Dk9R26cF.mjs} +20 -19
  3. package/dist/{ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs → ApprovalWorkflowPlugin.native-AeJsehXM.mjs} +56 -55
  4. package/dist/{BackgroundColorPlugin.native-H3XyYD7_.mjs → BackgroundColorPlugin.native-DCAd94kp.mjs} +103 -98
  5. package/dist/{BlocksLibraryPlugin.native-CownM6Rk.mjs → BlocksLibraryPlugin.native-D9OPcnQV.mjs} +42 -43
  6. package/dist/{CitationsPlugin.native-C_7wWQ-k.mjs → CitationsPlugin.native-BFChgCSV.mjs} +51 -51
  7. package/dist/{CodePlugin.native-CAHk9ecG.mjs → CodePlugin.native-BRBEIqY7.mjs} +167 -113
  8. package/dist/{CodePlugin.native-DZgIez08.mjs → CodePlugin.native-CPfKDrkr.mjs} +1383 -1094
  9. package/dist/{CodeSamplePlugin.native-svbAFWh_.mjs → CodeSamplePlugin.native-Bai8bgl3.mjs} +5 -5
  10. package/dist/{CommentsPlugin.native-DncTHiEe.mjs → CommentsPlugin.native-DHCDUm9f.mjs} +161 -141
  11. package/dist/{ConditionalContentPlugin.native-Bf7XgRSW.mjs → ConditionalContentPlugin.native-B3R6xcqn.mjs} +3 -3
  12. package/dist/{ContentRulesPlugin.native-vPx5nC73.mjs → ContentRulesPlugin.native-BISqhQKJ.mjs} +52 -52
  13. package/dist/{DataBindingPlugin.native-B7lpI_0c.mjs → DataBindingPlugin.native-DbaDeXNp.mjs} +37 -37
  14. package/dist/{DocumentManagerPlugin.native-B8K-Oqom.mjs → DocumentManagerPlugin.native-tZqIa9o5.mjs} +21 -20
  15. package/dist/{EmbedIframePlugin.native-BfZ_HGlV.mjs → EmbedIframePlugin.native-qHMf1Jtg.mjs} +7 -7
  16. package/dist/{EmojisPlugin.native-D92aaOKi.mjs → EmojisPlugin.native-B64efKg5.mjs} +4 -4
  17. package/dist/{FormatPainterPlugin.native-BhjzsiVq.mjs → FormatPainterPlugin.native-CAc1N6xU.mjs} +183 -161
  18. package/dist/{HeadingPlugin.native-DZdvubrQ.mjs → HeadingPlugin.native-C3YiGERx.mjs} +85 -72
  19. package/dist/HistoryPlugin.native-C8GyxsgC.mjs +330 -0
  20. package/dist/{LinkPlugin.native-BsQXYsK6.mjs → LinkPlugin.native-Dt_p6Ukb.mjs} +4 -4
  21. package/dist/ListPlugin.native-UYaoRiub.mjs +239 -0
  22. package/dist/{MathPlugin.native-Byo3WL0f.mjs → MathPlugin.native-Cq9WQ7cq.mjs} +148 -130
  23. package/dist/MediaManagerPlugin.native-BjrEarV6.mjs +1161 -0
  24. package/dist/{MediaManagerPlugin.native-BT1NZIJS.mjs → MediaManagerPlugin.native-CRi24Mrb.mjs} +340 -281
  25. package/dist/{MentionPlugin.native-S_lwGZQO.mjs → MentionPlugin.native-Zb1dwdxU.mjs} +304 -300
  26. package/dist/{MergeTagPlugin.native-7-6F3S1Y.mjs → MergeTagPlugin.native-BXkVPvCo.mjs} +6 -4
  27. package/dist/{PIIRedactionPlugin.native-g7j4jOmm.mjs → PIIRedactionPlugin.native-Cm0bpzQb.mjs} +2 -2
  28. package/dist/{PreviewPlugin.native-Dv5OsffK.mjs → PreviewPlugin.native-CrfiwP2J.mjs} +2 -2
  29. package/dist/{SlashCommandsPlugin.native-BDIIwGNs.mjs → SlashCommandsPlugin.native-BzGTRmMB.mjs} +264 -240
  30. package/dist/{SmartPastePlugin.native-BATLCds5.mjs → SmartPastePlugin.native-DnOJhDsf.mjs} +2 -2
  31. package/dist/{SpecialCharactersPlugin.native-CdZoc1GB.mjs → SpecialCharactersPlugin.native-B0XaCfjZ.mjs} +4 -4
  32. package/dist/{SpellCheckPlugin.native-BGm2qPfn.mjs → SpellCheckPlugin.native-BE7os1Xj.mjs} +302 -265
  33. package/dist/{TablePlugin.native-C1YZ372P.mjs → TablePlugin.native-CWxEFpV8.mjs} +159 -136
  34. package/dist/{TemplatePlugin.native-Dwk8TgxI.mjs → TemplatePlugin.native-OD8Wc1R7.mjs} +6 -4
  35. package/dist/{TextColorPlugin.native-KMZ2uzlq.mjs → TextColorPlugin.native-C2IjioNM.mjs} +75 -71
  36. package/dist/{TranslationWorkflowPlugin.native-CZtG--06.mjs → TranslationWorkflowPlugin.native-BGXVJD9f.mjs} +101 -98
  37. package/dist/{VersionDiffPlugin.native-Ca1fMWUJ.mjs → VersionDiffPlugin.native-DJZIzFSK.mjs} +11 -11
  38. package/dist/anchoredPopover-QN4jNbW1.mjs +134 -0
  39. package/dist/confirmDialog-BP8hZPpX.mjs +112 -0
  40. package/dist/dialogHelpers-Dzn8DHoF.mjs +194 -0
  41. package/dist/{documentManager-BWK_-KJp.mjs → documentManager-8gnG-uG_.mjs} +1728 -1715
  42. package/dist/editora.min.js +21 -21
  43. package/dist/editora.umd.js +10 -10
  44. package/dist/{index-C1sO7DAC.js → index--wO0CZVN.js} +6 -6
  45. package/dist/{index-DGMYWPLx.mjs → index-BICrB5kg.mjs} +397 -326
  46. package/dist/index.cjs.js +1 -1
  47. package/dist/index.esm.js +2 -2
  48. package/dist/katex-DLIObQUm.mjs +11683 -0
  49. package/dist/katex.min--Ws3c9be.mjs +6 -0
  50. package/dist/notify-DCQGpmq-.mjs +60 -0
  51. package/dist/plugin-loader.js +54 -54
  52. package/dist/webcomponent-core.js +305 -234
  53. package/dist/webcomponent-core.min.css +1 -1
  54. package/dist/webcomponent-core.min.js +153 -80
  55. package/dist/webcomponent.cjs.js +1 -1
  56. package/dist/webcomponent.esm.js +1 -1
  57. package/dist/webcomponent.js +631 -560
  58. package/dist/webcomponent.min.css +1 -1
  59. package/dist/webcomponent.min.js +1677 -1328
  60. package/package.json +1 -1
  61. package/dist/HistoryPlugin.native-DPvhks6h.mjs +0 -246
  62. package/dist/ListPlugin.native-Bt0LANbO.mjs +0 -139
  63. package/dist/anchoredPopover-DJFD2oAP.mjs +0 -116
  64. package/dist/dialogHelpers-DBf7WqYH.mjs +0 -40
@@ -1,19 +1,19 @@
1
- const g = '.rte-content, .editora-content, [contenteditable="true"]', st = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", b = "p,div,li,h1,h2,h3,h4,h5,h6,blockquote,pre,td,th", _ = "ul,ol", y = "b,strong,i,em,u,s,strike,font,span", w = "td,th", m = "data-editora-format-painter-bookmark", O = ["link", "address", "comments", "citations", "track-changes"], L = [
1
+ const h = '.rte-content, .editora-content, [contenteditable="true"]', lt = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", b = "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", m = "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
- ], at = [
7
+ ], ct = [
8
8
  "textAlign",
9
9
  "lineHeight",
10
10
  "marginLeft",
11
11
  "marginRight"
12
- ], lt = ["listStyleType"], ct = [
12
+ ], ut = ["listStyleType"], ft = [
13
13
  "borderCollapse",
14
14
  "borderSpacing",
15
15
  "width"
16
- ], ut = [
16
+ ], dt = [
17
17
  "backgroundColor",
18
18
  "textAlign",
19
19
  "verticalAlign",
@@ -52,124 +52,124 @@ const g = '.rte-content, .editora-content, [contenteditable="true"]', st = "[dat
52
52
  tablecells: "table",
53
53
  textcolor: "color",
54
54
  texttransform: "texttransform"
55
- }, ft = '<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, p = {
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 ne = (t = {}) => {
60
+ const ie = (t = {}) => {
61
61
  var n, r;
62
62
  const e = {
63
63
  ignoredFormats: (n = t.ignoredFormats) != null ? n : O,
64
64
  keepActiveAfterMouseApply: (r = t.keepActiveAfterMouseApply) != null ? r : !1
65
65
  };
66
- return p = e, {
66
+ return C = e, {
67
67
  name: "formatPainter",
68
68
  toolbar: [
69
69
  {
70
70
  label: "Format Painter",
71
71
  command: "toggleFormatPainter",
72
- icon: ft,
72
+ icon: mt,
73
73
  shortcut: "Ctrl+Alt+C / Ctrl+Alt+V"
74
74
  }
75
75
  ],
76
76
  commands: {
77
77
  retrieveFormats: (o, i) => Y(i, e),
78
- paintFormats: (o, i) => J(i, e),
79
- toggleFormatPainter: (o, i) => dt(i, e),
80
- cancelFormatPainter: (o, i) => G(i)
78
+ paintFormats: (o, i) => j(i, e),
79
+ toggleFormatPainter: (o, i) => Et(i, e),
80
+ cancelFormatPainter: (o, i) => J(i)
81
81
  },
82
82
  initialize: () => {
83
- mt();
83
+ ht();
84
84
  }
85
85
  };
86
86
  };
87
- function Y(t, e = p) {
88
- const n = C(t);
87
+ function Y(t, e = C) {
88
+ const n = T(t);
89
89
  if (!n) return !1;
90
90
  const r = U(n, e);
91
91
  if (!r) return !1;
92
92
  const o = E(n);
93
93
  return o.options = e, o.snapshot = r, I = r, M(n, !1), !0;
94
94
  }
95
- function J(t, e = p) {
96
- const n = C(t);
95
+ function j(t, e = C) {
96
+ const n = T(t);
97
97
  if (!n) return !1;
98
98
  const r = E(n);
99
99
  r.options = e;
100
100
  const o = r.snapshot || I;
101
101
  return o ? Q(n, o) : !1;
102
102
  }
103
- function dt(t, e = p) {
104
- const n = C(t);
103
+ function Et(t, e = C) {
104
+ const n = T(t);
105
105
  if (!n) return !1;
106
106
  const r = E(n);
107
107
  if (r.options = e, r.active)
108
- return h(n, !1), !0;
108
+ return g(n, !1), !0;
109
109
  const o = U(n, e);
110
- return o ? (r.snapshot = o, I = o, h(n, !0), !0) : !1;
110
+ return o ? (r.snapshot = o, I = o, g(n, !0), !0) : !1;
111
111
  }
112
- function G(t) {
113
- const e = C(t);
114
- return e ? (h(e, !1), !0) : (document.querySelectorAll(`${g}.rte-format-painter-active`).forEach((n) => {
115
- h(n, !1);
112
+ function J(t) {
113
+ const e = T(t);
114
+ return e ? (g(e, !1), !0) : (document.querySelectorAll(`${h}.rte-format-painter-active`).forEach((n) => {
115
+ g(n, !1);
116
116
  }), !0);
117
117
  }
118
- function mt() {
119
- P || typeof document == "undefined" || (P = !0, document.addEventListener("keydown", Et, !0), document.addEventListener("mouseup", gt, !0));
118
+ function ht() {
119
+ P || typeof document == "undefined" || (P = !0, document.addEventListener("keydown", gt, !0), document.addEventListener("mouseup", pt, !0));
120
120
  }
121
- function Et(t) {
121
+ function gt(t) {
122
122
  const e = t.key.toLowerCase(), n = t.ctrlKey || t.metaKey;
123
123
  if (t.key === "Escape") {
124
- G();
124
+ J();
125
125
  return;
126
126
  }
127
127
  if (!n || !t.altKey || t.shiftKey) return;
128
- const r = j() || C();
128
+ const r = G() || T();
129
129
  if (r) {
130
130
  if (e === "c") {
131
131
  Y({ contentElement: r }, E(r).options) && t.preventDefault();
132
132
  return;
133
133
  }
134
- e === "v" && J({ contentElement: r }, E(r).options) && t.preventDefault();
134
+ e === "v" && j({ contentElement: r }, E(r).options) && t.preventDefault();
135
135
  }
136
136
  }
137
- function gt(t) {
137
+ function pt(t) {
138
138
  const e = t.target;
139
139
  if (e != null && e.closest(".rte-toolbar-wrapper, .editora-toolbar-container")) return;
140
- const n = e == null ? void 0 : e.closest(g);
140
+ const n = e == null ? void 0 : e.closest(h);
141
141
  if (!(n instanceof HTMLElement)) return;
142
142
  const r = E(n);
143
143
  if (!r.active || !r.snapshot) return;
144
144
  const o = window.getSelection();
145
145
  if (!o || o.rangeCount === 0 || o.getRangeAt(0).collapsed) return;
146
- Q(n, r.snapshot) && !r.options.keepActiveAfterMouseApply && h(n, !1);
146
+ Q(n, r.snapshot) && !r.options.keepActiveAfterMouseApply && g(n, !1);
147
147
  }
148
148
  function E(t) {
149
149
  let e = v.get(t);
150
- return e || (e = { snapshot: null, active: !1, options: p }, v.set(t, e)), e;
150
+ return e || (e = { snapshot: null, active: !1, options: C }, v.set(t, e)), e;
151
151
  }
152
- function C(t) {
152
+ function T(t) {
153
153
  var o;
154
154
  if ((t == null ? void 0 : t.contentElement) instanceof HTMLElement) return t.contentElement;
155
- const e = D((o = t == null ? void 0 : t.editorElement) != null ? o : null);
155
+ const e = H((o = t == null ? void 0 : t.editorElement) != null ? o : null);
156
156
  if (e) return e;
157
- const n = typeof window != "undefined" ? window.__editoraCommandEditorRoot : null, r = D(n);
158
- return r || j() || ht();
157
+ const n = typeof window != "undefined" ? window.__editoraCommandEditorRoot : null, r = H(n);
158
+ return r || G() || Ct();
159
159
  }
160
- function D(t) {
161
- return t ? t.matches(g) ? t : t.querySelector(g) : null;
160
+ function H(t) {
161
+ return t ? t.matches(h) ? t : t.querySelector(h) : null;
162
162
  }
163
- function j() {
163
+ function G() {
164
164
  const t = window.getSelection();
165
165
  if (!t || t.rangeCount === 0) return null;
166
- const e = t.getRangeAt(0), n = d(e.commonAncestorContainer), r = n == null ? void 0 : n.closest(g);
166
+ const e = t.getRangeAt(0), n = d(e.commonAncestorContainer), r = n == null ? void 0 : n.closest(h);
167
167
  return r instanceof HTMLElement ? r : null;
168
168
  }
169
- function ht() {
169
+ function Ct() {
170
170
  const t = document.activeElement;
171
171
  if (!(t instanceof HTMLElement)) return null;
172
- const e = t.closest(g);
172
+ const e = t.closest(h);
173
173
  return e instanceof HTMLElement ? e : null;
174
174
  }
175
175
  function d(t) {
@@ -178,22 +178,22 @@ function d(t) {
178
178
  function U(t, e) {
179
179
  const n = window.getSelection(), r = n && n.rangeCount > 0 ? n.getRangeAt(0) : null, o = r ? r.collapsed ? r.startContainer : r.commonAncestorContainer : null, i = d(o) || t;
180
180
  if (!t.contains(i)) return null;
181
- const s = ee(e.ignoredFormats), a = nt(i, t), l = i.closest("li"), u = l == null ? void 0 : l.closest(_), f = i.closest(w), it = f == null ? void 0 : f.closest("table");
181
+ const s = oe(e.ignoredFormats), a = ot(i, t), l = i.closest("li"), u = l == null ? void 0 : l.closest(_), f = i.closest(R), at = f == null ? void 0 : f.closest("table");
182
182
  return {
183
- inline: pt(r, i, t, s),
184
- block: !c(s, "block") && a ? Nt(a, s) : null,
185
- list: !c(s, "list") && u ? bt(u, l) : null,
186
- table: c(s, "table") ? null : kt(it, f, s),
183
+ inline: Tt(r, i, t, s),
184
+ block: !c(s, "block") && a ? bt(a, s) : null,
185
+ list: !c(s, "list") && u ? kt(u, l) : null,
186
+ table: c(s, "table") ? null : At(at, f, s),
187
187
  ignoredFormats: s
188
188
  };
189
189
  }
190
- function pt(t, e, n, r) {
190
+ function Tt(t, e, n, r) {
191
191
  if (!t || t.collapsed)
192
- return H(e, r);
193
- const i = Ct(t, e, n).map((s) => H(s, r));
194
- return Tt(i);
192
+ return D(e, r);
193
+ const i = Nt(t, e, n).map((s) => D(s, r));
194
+ return St(i);
195
195
  }
196
- function Ct(t, e, n) {
196
+ function Nt(t, e, n) {
197
197
  const r = [], o = document.createTreeWalker(
198
198
  t.commonAncestorContainer,
199
199
  NodeFilter.SHOW_TEXT,
@@ -208,17 +208,17 @@ function Ct(t, e, n) {
208
208
  }
209
209
  return r.length > 0 ? r : [e];
210
210
  }
211
- function H(t, e) {
211
+ function D(t, e) {
212
212
  const n = window.getComputedStyle(t), r = {};
213
- c(e, "bold") || (r.bold = St(t, n)), c(e, "italic") || (r.italic = At(t, n)), c(e, "underline") || (r.underline = $(t, n, "underline")), c(e, "strikethrough") || (r.strikethrough = $(t, n, "line-through"));
213
+ 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"));
214
214
  const o = {};
215
215
  return L.forEach((i) => {
216
216
  if (c(e, i)) return;
217
217
  const s = n[i];
218
- yt(i, s) && (o[i] = s);
218
+ wt(i, s) && (o[i] = s);
219
219
  }), { marks: r, styles: o };
220
220
  }
221
- function Tt(t) {
221
+ function St(t) {
222
222
  const e = {};
223
223
  ["bold", "italic", "underline", "strikethrough"].forEach((o) => {
224
224
  const i = t.map((s) => s.marks[o]).filter((s) => s != null);
@@ -230,40 +230,40 @@ function Tt(t) {
230
230
  i.length === t.length && i.every((s) => s === i[0]) && (r[o] = i[0]);
231
231
  }), { marks: e, styles: r };
232
232
  }
233
- function Nt(t, e) {
233
+ function bt(t, e) {
234
234
  const n = window.getComputedStyle(t), r = {};
235
- at.forEach((s) => {
235
+ ct.forEach((s) => {
236
236
  if (c(e, s)) return;
237
237
  const l = t.style[s] || n[s];
238
- Lt(s, l) && (r[s] = l);
238
+ Rt(s, l) && (r[s] = l);
239
239
  });
240
240
  const o = {}, i = t.getAttribute("dir") || t.style.direction;
241
241
  return (i === "ltr" || i === "rtl" || i === "auto") && (o.dir = i), {
242
- tagName: rt(t),
242
+ tagName: it(t),
243
243
  styles: r,
244
244
  attrs: o
245
245
  };
246
246
  }
247
- function bt(t, e) {
247
+ function kt(t, e) {
248
248
  const n = {};
249
- lt.forEach((i) => {
249
+ ut.forEach((i) => {
250
250
  const s = t.style[i] || window.getComputedStyle(t)[i];
251
251
  s && s !== "disc" && s !== "decimal" && (n[i] = s);
252
252
  });
253
253
  const r = {};
254
- N(t, r, "data-type"), N(t, r, "type");
254
+ S(t, r, "data-type"), S(t, r, "type");
255
255
  const o = {};
256
- return e && (N(e, o, "data-type"), N(e, o, "data-checked")), {
256
+ return e && (S(e, o, "data-type"), S(e, o, "data-checked")), {
257
257
  tagName: t.tagName.toLowerCase() === "ol" ? "ol" : "ul",
258
258
  styles: n,
259
259
  attrs: r,
260
260
  itemAttrs: o
261
261
  };
262
262
  }
263
- function kt(t, e, n) {
263
+ function At(t, e, n) {
264
264
  return !t && !e ? null : {
265
- table: t ? W(t, ct, n) : null,
266
- cell: e ? W(e, ut, n) : null
265
+ table: t ? W(t, ft, n) : null,
266
+ cell: e ? W(e, dt, n) : null
267
267
  };
268
268
  }
269
269
  function W(t, e, n) {
@@ -271,28 +271,28 @@ function W(t, e, n) {
271
271
  return e.forEach((i) => {
272
272
  if (c(n, i)) return;
273
273
  const a = t.style[i] || r[i];
274
- Rt(i, a) && (o[i] = a);
274
+ Ft(i, a) && (o[i] = a);
275
275
  }), { styles: o, attrs: {} };
276
276
  }
277
- function St(t, e) {
277
+ function yt(t, e) {
278
278
  if (t.closest("b,strong")) return !0;
279
279
  const n = e.fontWeight;
280
280
  return /^(bold|bolder|[5-9]\d{2,})$/.test(n);
281
281
  }
282
- function At(t, e) {
282
+ function Lt(t, e) {
283
283
  return !!t.closest("i,em") || e.fontStyle === "italic";
284
284
  }
285
285
  function $(t, e, n) {
286
286
  const r = n === "underline" ? "u" : "s,strike";
287
287
  return !!t.closest(r) || e.textDecorationLine.includes(n);
288
288
  }
289
- function yt(t, e) {
289
+ function wt(t, e) {
290
290
  return !(!e || t === "backgroundColor" && (e === "rgba(0, 0, 0, 0)" || e === "transparent") || t === "textTransform" && e === "none");
291
291
  }
292
- function Lt(t, e) {
292
+ function Rt(t, e) {
293
293
  return !(!e || t === "textAlign" && e === "start" || t === "lineHeight" && e === "normal" || (t === "marginLeft" || t === "marginRight") && e === "0px");
294
294
  }
295
- function Rt(t, e) {
295
+ function Ft(t, e) {
296
296
  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");
297
297
  }
298
298
  function Q(t, e) {
@@ -300,26 +300,26 @@ function Q(t, e) {
300
300
  if (!n || n.rangeCount === 0) return !1;
301
301
  const r = n.getRangeAt(0);
302
302
  if (!t.contains(r.startContainer) || !t.contains(r.endContainer)) return !1;
303
- const o = t.innerHTML, i = !r.collapsed, s = Jt(t);
304
- Ft(t, r, e.table), wt(t, r, e), s == null || s();
303
+ const o = t.innerHTML, i = !r.collapsed, s = Ut(t);
304
+ _t(t, r, e.table), Mt(t, r, e), s == null || s();
305
305
  const a = window.getSelection(), l = a && a.rangeCount > 0 ? a.getRangeAt(0) : null;
306
- i && a && l && t.contains(l.startContainer) && t.contains(l.endContainer) && Mt(l, a, e), Ut(t), Qt(t);
306
+ i && a && l && t.contains(l.startContainer) && t.contains(l.endContainer) && Ot(l, a, e), ee(t), ne(t);
307
307
  const u = t.innerHTML;
308
- return o === u ? !1 : (te(t, o, u), t.dispatchEvent(new Event("input", { bubbles: !0 })), !0);
308
+ return o === u ? !1 : (re(t, o, u), t.dispatchEvent(new Event("input", { bubbles: !0 })), !0);
309
309
  }
310
- function wt(t, e, n) {
311
- const r = Xt(t, e);
312
- n.list && zt(r, n.list), n.block && r.forEach((o) => {
310
+ function Mt(t, e, n) {
311
+ const r = Jt(t, e);
312
+ n.list && Vt(r, n.list), n.block && r.forEach((o) => {
313
313
  const i = o.isConnected ? o : null;
314
314
  if (!i) return;
315
- const s = Vt(i, n.block.tagName);
316
- k(s, n.block.styles), n.block.attrs.dir ? s.setAttribute("dir", n.block.attrs.dir) : s.removeAttribute("dir");
315
+ const s = Yt(i, n.block.tagName);
316
+ k(s, Xt(s, n.block.styles)), n.block.attrs.dir ? s.setAttribute("dir", n.block.attrs.dir) : s.removeAttribute("dir");
317
317
  });
318
318
  }
319
- function Ft(t, e, n) {
319
+ function _t(t, e, n) {
320
320
  var i;
321
321
  if (!n) return;
322
- const r = Kt(t, e);
322
+ const r = Zt(t, e);
323
323
  if (n.cell && r.forEach((s) => {
324
324
  k(s, n.cell.styles);
325
325
  }), !n.table) return;
@@ -335,34 +335,50 @@ function Ft(t, e, n) {
335
335
  k(s, n.table.styles);
336
336
  });
337
337
  }
338
- function Mt(t, e, n) {
339
- vt(t);
340
- const r = n.inline, o = t.cloneContents();
341
- if (Yt(o)) {
342
- _t(t, e, n);
338
+ function tt(t) {
339
+ var n;
340
+ let e = t instanceof HTMLElement ? t : (n = t == null ? void 0 : t.parentElement) != null ? n : null;
341
+ for (; e && e.matches(p); ) e = e.parentElement;
342
+ return e;
343
+ }
344
+ function et(t, e) {
345
+ if (!e) return t;
346
+ const n = window.getComputedStyle(e), r = {};
347
+ return Object.entries(t.styles).forEach(([o, i]) => {
348
+ n[o] !== i && (r[o] = i);
349
+ }), { ...t, styles: r };
350
+ }
351
+ function Ot(t, e, n) {
352
+ Ht(t);
353
+ const r = et(n.inline, tt(t.commonAncestorContainer)), o = t.cloneContents();
354
+ if (Gt(o)) {
355
+ It(t, e, n);
343
356
  return;
344
357
  }
345
358
  const i = t.extractContents();
346
- qt(i, n);
359
+ Kt(i, n);
347
360
  const s = document.createDocumentFragment(), a = K("start"), l = K("end");
348
- s.appendChild(a), s.appendChild(et(i, r)), s.appendChild(l), t.insertNode(s), Dt(a, l, n);
361
+ s.appendChild(a), s.appendChild(rt(i, r)), s.appendChild(l), t.insertNode(s), Wt(a, l, n);
349
362
  const u = document.createRange();
350
363
  u.setStartAfter(a), u.setEndBefore(l), e.removeAllRanges(), e.addRange(u);
351
364
  }
352
- function _t(t, e, n) {
353
- const r = Ot(t), o = [];
365
+ function It(t, e, n) {
366
+ const r = xt(t), o = [];
354
367
  if (r.forEach((s) => {
355
368
  var u;
356
- let a = It(s, t);
357
- if (!a || !a.data.trim() || $t(a)) return;
358
- a = xt(a, n);
359
- const l = et(document.createTextNode(a.data), n.inline);
369
+ let a = Bt(s, t);
370
+ if (!a || !a.data.trim() || zt(a)) return;
371
+ a = vt(a, n);
372
+ const l = rt(
373
+ document.createTextNode(a.data),
374
+ et(n.inline, tt(a))
375
+ );
360
376
  (u = a.parentNode) == null || u.replaceChild(l, a), o.push(l);
361
377
  }), o.length === 0) return;
362
378
  const i = document.createRange();
363
379
  i.setStartBefore(o[0]), i.setEndAfter(o[o.length - 1]), e.removeAllRanges(), e.addRange(i);
364
380
  }
365
- function Ot(t) {
381
+ function xt(t) {
366
382
  if (t.startContainer === t.endContainer && t.startContainer.nodeType === Node.TEXT_NODE)
367
383
  return [t.startContainer];
368
384
  const e = [], n = document.createTreeWalker(t.commonAncestorContainer, NodeFilter.SHOW_TEXT, {
@@ -373,21 +389,21 @@ function Ot(t) {
373
389
  e.push(r), r = n.nextNode();
374
390
  return e;
375
391
  }
376
- function It(t, e) {
392
+ function Bt(t, e) {
377
393
  const n = t.data.length;
378
394
  let r = 0, o = n;
379
395
  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;
380
396
  let i = t;
381
397
  return o < i.data.length && i.splitText(o), r > 0 && (i = i.splitText(r)), i;
382
398
  }
383
- function xt(t, e) {
399
+ function vt(t, e) {
384
400
  const n = t;
385
401
  let r = n.parentElement;
386
- for (; r && r.matches(y) && !x(r, e) && tt(r, e); )
387
- Bt(r, n), r = n.parentElement;
402
+ for (; r && r.matches(p) && !x(r, e) && nt(r, e); )
403
+ Pt(r, n), r = n.parentElement;
388
404
  return n;
389
405
  }
390
- function Bt(t, e) {
406
+ function Pt(t, e) {
391
407
  const n = t.parentNode;
392
408
  if (!n || e.parentNode !== t) return;
393
409
  const r = t.cloneNode(!1), o = t.cloneNode(!1);
@@ -400,25 +416,25 @@ function Bt(t, e) {
400
416
  function q(t) {
401
417
  return Array.from(t.childNodes).some((e) => e.nodeType !== Node.TEXT_NODE ? !0 : !!(e.textContent || "").trim());
402
418
  }
403
- function vt(t) {
419
+ function Ht(t) {
404
420
  let e = d(t.startContainer), n = d(t.endContainer);
405
- for (; e && e === n && e.matches(y); ) {
406
- if (!Pt(t, e)) return;
421
+ for (; e && e === n && e.matches(p); ) {
422
+ if (!Dt(t, e)) return;
407
423
  t.selectNode(e), e = e.parentElement, n = d(t.endContainer);
408
424
  }
409
425
  }
410
- function Pt(t, e) {
426
+ function Dt(t, e) {
411
427
  const n = document.createRange();
412
428
  return n.selectNodeContents(e), t.compareBoundaryPoints(Range.START_TO_START, n) === 0 && t.compareBoundaryPoints(Range.END_TO_END, n) === 0;
413
429
  }
414
- function Dt(t, e, n) {
430
+ function Wt(t, e, n) {
415
431
  let r = d(t.parentNode);
416
432
  for (; r && r.contains(e); ) {
417
433
  const o = r.parentElement;
418
- r.matches(y) && !x(r, n) && Ht(r, t, e) && tt(r, n) && S(r), r = o;
434
+ r.matches(p) && !x(r, n) && $t(r, t, e) && nt(r, n) && A(r), r = o;
419
435
  }
420
436
  }
421
- function Ht(t, e, n) {
437
+ function $t(t, e, n) {
422
438
  let r = "before";
423
439
  for (const o of Array.from(t.childNodes)) {
424
440
  if (o === e) {
@@ -429,23 +445,23 @@ function Ht(t, e, n) {
429
445
  r = "after";
430
446
  continue;
431
447
  }
432
- if (r !== "inside" && !Wt(o))
448
+ if (r !== "inside" && !qt(o))
433
449
  return !1;
434
450
  }
435
451
  return r === "after";
436
452
  }
437
- function Wt(t) {
438
- return t.nodeType === Node.TEXT_NODE ? !(t.textContent || "").replace(/\uFEFF/g, "").trim() : t.nodeType === Node.COMMENT_NODE ? ot(t) : t.nodeType !== Node.ELEMENT_NODE ? !0 : t.hasAttribute(m);
453
+ function qt(t) {
454
+ 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(m);
439
455
  }
440
- function tt(t, e) {
456
+ function nt(t, e) {
441
457
  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;
442
458
  }
443
- function $t(t) {
459
+ function zt(t) {
444
460
  if (t.nodeType !== Node.TEXT_NODE || (t.textContent || "").trim()) return !1;
445
461
  const e = t.parentElement;
446
462
  return !!(e != null && e.matches(_));
447
463
  }
448
- function et(t, e) {
464
+ function rt(t, e) {
449
465
  let n = t;
450
466
  const r = Object.entries(e.styles);
451
467
  if (r.length > 0) {
@@ -454,59 +470,65 @@ function et(t, e) {
454
470
  o.style.setProperty(B(i), s);
455
471
  }), o.appendChild(n), n = o;
456
472
  }
457
- return e.marks.strikethrough && (n = T("s", n)), e.marks.underline && (n = T("u", n)), e.marks.italic && (n = T("i", n)), e.marks.bold && (n = T("b", n)), n;
473
+ return e.marks.strikethrough && (n = N("s", n)), e.marks.underline && (n = N("u", n)), e.marks.italic && (n = N("i", n)), e.marks.bold && (n = N("b", n)), n;
458
474
  }
459
- function T(t, e) {
475
+ function N(t, e) {
460
476
  const n = document.createElement(t);
461
477
  return n.appendChild(e), n;
462
478
  }
463
- function qt(t, e) {
464
- Array.from(t.querySelectorAll(y)).forEach((n) => {
479
+ function Kt(t, e) {
480
+ Array.from(t.querySelectorAll(p)).forEach((n) => {
465
481
  if (n instanceof HTMLElement && !x(n, e)) {
466
482
  if (n.matches("span")) {
467
483
  if (L.forEach((r) => {
468
484
  c(e.ignoredFormats, r) || n.style.removeProperty(B(r));
469
485
  }), n.getAttribute("style") || n.attributes.length > 0) return;
470
- S(n);
486
+ A(n);
471
487
  return;
472
488
  }
473
- 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") || S(n);
489
+ 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);
474
490
  }
475
491
  });
476
492
  }
477
493
  function x(t, e) {
478
- return !!(t.matches("a") && c(e.ignoredFormats, "link") || R(t, "comment") && c(e.ignoredFormats, "comments") || R(t, "citation") && c(e.ignoredFormats, "citations") || R(t, "track") && c(e.ignoredFormats, "trackchanges"));
494
+ 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"));
479
495
  }
480
- function R(t, e) {
496
+ function w(t, e) {
481
497
  const n = e.toLowerCase();
482
498
  return t.className.toString().toLowerCase().includes(n) ? !0 : Array.from(t.attributes).some((o) => {
483
- const i = A(o.name), s = o.value.toLowerCase();
499
+ const i = y(o.name), s = o.value.toLowerCase();
484
500
  return i.includes(n) || s.includes(n);
485
501
  });
486
502
  }
487
- function zt(t, e) {
503
+ function Vt(t, e) {
488
504
  t.filter((r) => r.tagName.toLowerCase() === "li").forEach((r) => {
489
505
  const o = r.closest(_);
490
506
  if (!o) return;
491
- const i = Zt(o, e.tagName);
507
+ const i = jt(o, e.tagName);
492
508
  k(i, e.styles), Z(i, e.attrs), Z(r, e.itemAttrs);
493
509
  });
494
510
  }
495
- function Kt(t, e) {
511
+ function Zt(t, e) {
496
512
  var o;
497
- const n = Array.from(t.querySelectorAll(w)).filter((i) => i instanceof HTMLElement && e.intersectsNode(i));
513
+ const n = Array.from(t.querySelectorAll(R)).filter((i) => i instanceof HTMLElement && e.intersectsNode(i));
498
514
  if (n.length > 0) return n;
499
- const r = (o = d(e.startContainer)) == null ? void 0 : o.closest(w);
515
+ const r = (o = d(e.startContainer)) == null ? void 0 : o.closest(R);
500
516
  return r instanceof HTMLElement && t.contains(r) ? [r] : [];
501
517
  }
518
+ function Xt(t, e) {
519
+ const n = window.getComputedStyle(t), r = {};
520
+ return Object.entries(e).forEach(([o, i]) => {
521
+ n[o] !== i && (r[o] = i);
522
+ }), r;
523
+ }
502
524
  function k(t, e) {
503
525
  Object.entries(e).forEach(([n, r]) => {
504
526
  t.style.setProperty(B(n), r);
505
527
  });
506
528
  }
507
- function Vt(t, e) {
529
+ function Yt(t, e) {
508
530
  var o, i;
509
- const n = rt(t);
531
+ const n = it(t);
510
532
  if (n === e || n === "li" || n === "td" || n === "th") return t;
511
533
  if (e === "blockquote") {
512
534
  const s = document.createElement("blockquote");
@@ -518,36 +540,36 @@ function Vt(t, e) {
518
540
  for (; t.firstChild; ) r.appendChild(t.firstChild);
519
541
  return F(t, r), (i = t.parentNode) == null || i.replaceChild(r, t), r;
520
542
  }
521
- function Zt(t, e) {
543
+ function jt(t, e) {
522
544
  var r;
523
545
  if (t.tagName.toLowerCase() === e) return t;
524
546
  const n = document.createElement(e);
525
547
  for (; t.firstChild; ) n.appendChild(t.firstChild);
526
548
  return F(t, n), (r = t.parentNode) == null || r.replaceChild(n, t), n;
527
549
  }
528
- function Xt(t, e) {
550
+ function Jt(t, e) {
529
551
  const n = Array.from(t.querySelectorAll(b)).filter((o) => o instanceof HTMLElement && e.intersectsNode(o));
530
552
  if (n.length > 0)
531
553
  return n.filter((o) => !n.some((i) => i !== o && i.contains(o)));
532
- const r = nt(d(e.startContainer), t);
554
+ const r = ot(d(e.startContainer), t);
533
555
  return r ? [r] : [];
534
556
  }
535
- function nt(t, e) {
557
+ function ot(t, e) {
536
558
  const n = t == null ? void 0 : t.closest(b);
537
559
  return n instanceof HTMLElement && e.contains(n) ? n : null;
538
560
  }
539
- function rt(t) {
561
+ function it(t) {
540
562
  const e = t.tagName.toLowerCase();
541
563
  return e === "blockquote" || /^h[1-6]$/.test(e) || e === "pre" || e === "li" || e === "td" || e === "th" ? e : "p";
542
564
  }
543
- function Yt(t) {
565
+ function Gt(t) {
544
566
  return Array.from(t.childNodes).some((e) => {
545
567
  if (e.nodeType !== Node.ELEMENT_NODE) return !1;
546
568
  const n = e;
547
569
  return n.matches(b) || !!n.querySelector(b);
548
570
  });
549
571
  }
550
- function Jt(t) {
572
+ function Ut(t) {
551
573
  const e = window.getSelection();
552
574
  if (!e || e.rangeCount === 0) return null;
553
575
  const n = e.getRangeAt(0);
@@ -571,13 +593,13 @@ function z(t) {
571
593
  function K(t) {
572
594
  return document.createComment(`${m}:inline:${t}`);
573
595
  }
574
- function ot(t) {
575
- return Gt(t) || jt(t);
596
+ function st(t) {
597
+ return Qt(t) || te(t);
576
598
  }
577
- function Gt(t) {
599
+ function Qt(t) {
578
600
  return t.nodeType === Node.COMMENT_NODE && (t.nodeValue === `${m}:selection:start` || t.nodeValue === `${m}:selection:end`);
579
601
  }
580
- function jt(t) {
602
+ function te(t) {
581
603
  return t.nodeType === Node.COMMENT_NODE && (t.nodeValue === `${m}:inline:start` || t.nodeValue === `${m}:inline:end`);
582
604
  }
583
605
  function V(t, e) {
@@ -589,20 +611,20 @@ function V(t, e) {
589
611
  }
590
612
  return null;
591
613
  }
592
- function Ut(t) {
614
+ function ee(t) {
593
615
  t.querySelectorAll(`[${m}]`).forEach((o) => o.remove());
594
616
  const e = document.createTreeWalker(t, NodeFilter.SHOW_COMMENT), n = [];
595
617
  let r = e.nextNode();
596
618
  for (; r; )
597
- ot(r) && n.push(r), r = e.nextNode();
619
+ st(r) && n.push(r), r = e.nextNode();
598
620
  n.forEach((o) => o.remove());
599
621
  }
600
- function Qt(t) {
622
+ function ne(t) {
601
623
  t.querySelectorAll("span").forEach((e) => {
602
- e instanceof HTMLElement && (e.attributes.length > 0 || S(e));
624
+ e instanceof HTMLElement && (e.attributes.length > 0 || A(e));
603
625
  });
604
626
  }
605
- function S(t) {
627
+ function A(t) {
606
628
  const e = t.parentNode;
607
629
  if (e) {
608
630
  for (; t.firstChild; )
@@ -610,7 +632,7 @@ function S(t) {
610
632
  e.removeChild(t);
611
633
  }
612
634
  }
613
- function N(t, e, n) {
635
+ function S(t, e, n) {
614
636
  const r = t.getAttribute(n);
615
637
  r != null && (e[n] = r);
616
638
  }
@@ -624,7 +646,7 @@ function F(t, e) {
624
646
  n.name !== "style" && e.setAttribute(n.name, n.value);
625
647
  });
626
648
  }
627
- function h(t, e) {
649
+ function g(t, e) {
628
650
  const n = E(t);
629
651
  if (n.active === e && t.classList.contains("rte-format-painter-active") === e) {
630
652
  M(t, e);
@@ -633,7 +655,7 @@ function h(t, e) {
633
655
  n.active = e, t.classList.toggle("rte-format-painter-active", e), M(t, e);
634
656
  }
635
657
  function M(t, e) {
636
- const n = t.closest(st) || document;
658
+ const n = t.closest(lt) || document;
637
659
  n.querySelectorAll(
638
660
  '[data-command="toggleFormatPainter"], [data-command="formatPainter"]'
639
661
  ).forEach((o) => {
@@ -645,7 +667,7 @@ function M(t, e) {
645
667
  })
646
668
  );
647
669
  }
648
- function te(t, e, n) {
670
+ function re(t, e, n) {
649
671
  if (e === n) return;
650
672
  const r = window.execEditorCommand || window.executeEditorCommand;
651
673
  if (typeof r == "function")
@@ -658,20 +680,20 @@ function te(t, e, n) {
658
680
  }
659
681
  }
660
682
  }
661
- function ee(t) {
662
- return (t != null ? t : O).map(A).map((e) => X[e] || e).filter(Boolean);
683
+ function oe(t) {
684
+ return (t != null ? t : O).map(y).map((e) => X[e] || e).filter(Boolean);
663
685
  }
664
686
  function c(t, e) {
665
- const n = X[A(e)] || A(e);
687
+ const n = X[y(e)] || y(e);
666
688
  return t.includes(n);
667
689
  }
668
- function A(t) {
690
+ function y(t) {
669
691
  return t.toLowerCase().replace(/[^a-z0-9]/g, "");
670
692
  }
671
693
  function B(t) {
672
694
  return t.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
673
695
  }
674
696
  export {
675
- ne as FormatPainterPlugin
697
+ ie as FormatPainterPlugin
676
698
  };
677
- //# sourceMappingURL=FormatPainterPlugin.native-BhjzsiVq.mjs.map
699
+ //# sourceMappingURL=FormatPainterPlugin.native-CAc1N6xU.mjs.map