@editora/core 1.0.8 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +6 -1
  2. package/dist/{ApprovalWorkflowPlugin.native-C3jtAYjG.mjs → ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs} +136 -133
  3. package/dist/BlockquotePlugin.native-57_Xcjl1.mjs +212 -0
  4. package/dist/{BlocksLibraryPlugin.native-HMWKxWNs.mjs → BlocksLibraryPlugin.native-5sdsXsiE.mjs} +90 -87
  5. package/dist/{BoldPlugin.native-BAzzoqU5.mjs → BoldPlugin.native-CSh_LiIJ.mjs} +11 -7
  6. package/dist/CapitalizationPlugin.native-DLV4oPmB.mjs +159 -0
  7. package/dist/ChecklistPlugin.native-BS-kMz9O.mjs +371 -0
  8. package/dist/{CitationsPlugin.native-BnU0qCwR.mjs → CitationsPlugin.native-DQgoCd1B.mjs} +132 -129
  9. package/dist/ClearFormattingPlugin.native-DIS6AN2t.mjs +172 -0
  10. package/dist/CodePlugin.native-C5l1IeSS.mjs +4570 -0
  11. package/dist/{ContentRulesPlugin.native-nBLQ8QFZ.mjs → ContentRulesPlugin.native-vPx5nC73.mjs} +105 -102
  12. package/dist/{DataBindingPlugin.native-jQ1JPRTp.mjs → DataBindingPlugin.native-BoXwghTz.mjs} +49 -46
  13. package/dist/DirectionPlugin.native-Bl-QLFzO.mjs +153 -0
  14. package/dist/{DocSchemaPlugin.native-CHOge18O.mjs → DocSchemaPlugin.native-DUSVRHqT.mjs} +55 -52
  15. package/dist/{EmbedIframePlugin.native-DKJx2OS7.mjs → EmbedIframePlugin.native-BF_-LjTq.mjs} +287 -115
  16. package/dist/HeadingPlugin.native-DZdvubrQ.mjs +249 -0
  17. package/dist/{HistoryPlugin.native-TDnVMsEO.mjs → HistoryPlugin.native-D2wl32jV.mjs} +88 -103
  18. package/dist/{ItalicPlugin.native-CQjjDyUL.mjs → ItalicPlugin.native-CmnlwFHB.mjs} +15 -11
  19. package/dist/MathPlugin.native-NwWPHVmj.mjs +369 -0
  20. package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-eOsTJFpw.mjs} +204 -202
  21. package/dist/MergeTagPlugin.native-BzRVoD9-.mjs +580 -0
  22. package/dist/{PIIRedactionPlugin.native-DcsjmtV1.mjs → PIIRedactionPlugin.native-g7j4jOmm.mjs} +158 -155
  23. package/dist/{SlashCommandsPlugin.native-CmxvMEaE.mjs → SlashCommandsPlugin.native-BiN6ODw5.mjs} +2 -2
  24. package/dist/{SmartPastePlugin.native-BOKKtF07.mjs → SmartPastePlugin.native-CZAEHkyt.mjs} +127 -124
  25. package/dist/{SpecialCharactersPlugin.native-CZDato89.mjs → SpecialCharactersPlugin.native-DaG4b19I.mjs} +100 -76
  26. package/dist/{StrikethroughPlugin.native-0Be7j49s.mjs → StrikethroughPlugin.native-V0TL4F48.mjs} +12 -26
  27. package/dist/TemplatePlugin.native-DLjFUaPW.mjs +1150 -0
  28. package/dist/{TranslationWorkflowPlugin.native-Bz6jDGvj.mjs → TranslationWorkflowPlugin.native-DdF16tgT.mjs} +104 -101
  29. package/dist/{UnderlinePlugin.native-QpIcK4L2.mjs → UnderlinePlugin.native-DZzg23rv.mjs} +8 -4
  30. package/dist/editora.min.js +1 -1
  31. package/dist/editora.umd.js +1 -1
  32. package/dist/index-CPMGUZfB.js +10 -0
  33. package/dist/{index-DqC57IEH.mjs → index-DBoj6QfW.mjs} +17 -15
  34. package/dist/index.cjs.js +1 -1
  35. package/dist/index.esm.js +2 -2
  36. package/dist/inlineFormatting-DJ0-NZtx.mjs +97 -0
  37. package/dist/plugin-loader.js +37 -37
  38. package/dist/webcomponent-core.js +18 -16
  39. package/dist/webcomponent-core.min.css +1 -1
  40. package/dist/webcomponent-core.min.js +139 -62
  41. package/dist/webcomponent.cjs.js +1 -1
  42. package/dist/webcomponent.esm.js +1 -1
  43. package/dist/webcomponent.js +50 -48
  44. package/dist/webcomponent.min.css +1 -1
  45. package/dist/webcomponent.min.js +1174 -1071
  46. package/package.json +11 -5
  47. package/LICENSE +0 -21
  48. package/dist/BlockquotePlugin.native-JFmOLsxN.mjs +0 -48
  49. package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs +0 -79
  50. package/dist/ChecklistPlugin.native-nuSSEFNI.mjs +0 -309
  51. package/dist/ClearFormattingPlugin.native-Bq_XcTh2.mjs +0 -140
  52. package/dist/CodePlugin.native-DlpTPdkd.mjs +0 -2691
  53. package/dist/DirectionPlugin.native-CDnbdNyl.mjs +0 -130
  54. package/dist/HeadingPlugin.native-DrLYwQnQ.mjs +0 -64
  55. package/dist/MathPlugin.native-f_mDp8VL.mjs +0 -292
  56. package/dist/MergeTagPlugin.native-C3eOfEgw.mjs +0 -559
  57. package/dist/TemplatePlugin.native-CrpfKRJ8.mjs +0 -602
  58. package/dist/index-D1LOqg5C.js +0 -10
@@ -0,0 +1,249 @@
1
+ const f = '.rte-content, .editora-content, [contenteditable="true"]', y = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", g = /* @__PURE__ */ new Set(["P", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "PRE"]), E = "p,div,h1,h2,h3,h4,h5,h6,ul,ol,blockquote,pre,table", B = /* @__PURE__ */ new Set(["p", "h1", "h2", "h3", "h4", "h5", "h6"]);
2
+ function H(e) {
3
+ return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
4
+ }
5
+ function S(e) {
6
+ const n = e == null ? void 0 : e.contentElement;
7
+ if (n instanceof HTMLElement) return n;
8
+ const t = e == null ? void 0 : e.editorElement;
9
+ if (t instanceof HTMLElement) {
10
+ const a = t.querySelector(f);
11
+ if (a instanceof HTMLElement) return a;
12
+ if (t.getAttribute("contenteditable") === "true") return t;
13
+ }
14
+ const r = window.getSelection();
15
+ if (r && r.rangeCount > 0) {
16
+ const a = H(r.getRangeAt(0).startContainer), i = a == null ? void 0 : a.closest(f);
17
+ if (i instanceof HTMLElement) return i;
18
+ const c = a == null ? void 0 : a.closest(y), u = c == null ? void 0 : c.querySelector(f);
19
+ if (u instanceof HTMLElement) return u;
20
+ }
21
+ const s = document.activeElement, o = s == null ? void 0 : s.closest(f);
22
+ return o instanceof HTMLElement ? o : document.querySelector(f);
23
+ }
24
+ function N(e) {
25
+ const n = window.getSelection();
26
+ if (!n || n.rangeCount === 0) return null;
27
+ const t = n.getRangeAt(0);
28
+ return !e.contains(t.startContainer) || !e.contains(t.endContainer) ? null : t;
29
+ }
30
+ function T(e, n) {
31
+ let t = H(n);
32
+ if (!t || t === e || !e.contains(t)) return null;
33
+ for (; t.parentElement && t.parentElement !== e; )
34
+ t = t.parentElement;
35
+ if (t.parentElement !== e) return null;
36
+ if (t.matches(E)) return t;
37
+ const r = t.closest(E);
38
+ return r instanceof HTMLElement && r.parentElement === e ? r : t;
39
+ }
40
+ function C(e, n) {
41
+ if (typeof e.intersectsNode == "function")
42
+ try {
43
+ return e.intersectsNode(n);
44
+ } catch (r) {
45
+ return !1;
46
+ }
47
+ const t = document.createRange();
48
+ return t.selectNode(n), e.compareBoundaryPoints(Range.END_TO_START, t) < 0 && e.compareBoundaryPoints(Range.START_TO_END, t) > 0;
49
+ }
50
+ function w(e, n) {
51
+ const t = T(e, n.startContainer), r = T(e, n.endContainer);
52
+ if (!t) return [];
53
+ if (!r || t === r) return [t];
54
+ const o = Array.from(e.children).filter(
55
+ (a) => a instanceof HTMLElement
56
+ ).filter((a) => C(n, a));
57
+ return o.length > 0 ? o : [t];
58
+ }
59
+ function A(e, n) {
60
+ Array.from(e.attributes).forEach((t) => {
61
+ n.setAttribute(t.name, t.value);
62
+ });
63
+ }
64
+ function p(e, n) {
65
+ for (; e.firstChild; )
66
+ n.appendChild(e.firstChild);
67
+ }
68
+ function I(e) {
69
+ return e.tagName !== "P" || e.attributes.length > 0 || (e.textContent || "").trim() !== "" ? !1 : !e.querySelector("img, video, table, iframe, hr, pre, ul, ol");
70
+ }
71
+ function d(e, n) {
72
+ const t = document.createElement(e);
73
+ return n && A(n, t), t;
74
+ }
75
+ function v(e, n) {
76
+ const t = d(n, e);
77
+ return p(e, t), t.innerHTML.trim() || (t.innerHTML = "<br>"), t;
78
+ }
79
+ function R(e) {
80
+ const n = e.cloneNode(!1);
81
+ return n instanceof HTMLElement ? n : document.createElement(e.tagName.toLowerCase());
82
+ }
83
+ function L(e, n, t) {
84
+ const r = e.parentNode;
85
+ if (!r) return [];
86
+ const s = document.createDocumentFragment(), o = [];
87
+ let a = null;
88
+ const i = () => {
89
+ a && a.children.length > 0 && s.appendChild(a), a = null;
90
+ };
91
+ return Array.from(e.children).forEach((c) => {
92
+ if (c instanceof HTMLLIElement) {
93
+ if (n.has(c)) {
94
+ i();
95
+ const u = v(c, t);
96
+ s.appendChild(u), o.push(u);
97
+ return;
98
+ }
99
+ a || (a = R(e)), a.appendChild(c);
100
+ }
101
+ }), i(), r.insertBefore(s, e), r.removeChild(e), o;
102
+ }
103
+ function _(e, n) {
104
+ var r;
105
+ if (e.tagName.toLowerCase() === n) return [e];
106
+ const t = d(n, e);
107
+ return p(e, t), t.innerHTML.trim() || (t.innerHTML = "<br>"), (r = e.parentNode) == null || r.replaceChild(t, e), [t];
108
+ }
109
+ function O(e, n) {
110
+ const t = e.parentNode;
111
+ if (!t) return [];
112
+ const r = document.createDocumentFragment(), s = [];
113
+ return Array.from(e.childNodes).forEach((o) => {
114
+ if (o instanceof HTMLElement && I(o)) {
115
+ o.remove();
116
+ return;
117
+ }
118
+ if (o instanceof HTMLUListElement || o instanceof HTMLOListElement) {
119
+ Array.from(o.children).forEach((i) => {
120
+ if (!(i instanceof HTMLLIElement)) return;
121
+ const c = v(i, n);
122
+ r.appendChild(c), s.push(c);
123
+ }), o.remove();
124
+ return;
125
+ }
126
+ if (o instanceof HTMLElement && g.has(o.tagName)) {
127
+ const i = d(n, o);
128
+ p(o, i), r.appendChild(i), s.push(i);
129
+ return;
130
+ }
131
+ if (o.nodeType === Node.TEXT_NODE && (o.textContent || "").trim() === "") {
132
+ o.remove();
133
+ return;
134
+ }
135
+ const a = d(n, e);
136
+ a.appendChild(o), r.appendChild(a), s.push(a);
137
+ }), t.insertBefore(r, e), t.removeChild(e), s;
138
+ }
139
+ function b(e) {
140
+ const n = window.getSelection();
141
+ if (!n) return;
142
+ const t = document.createRange(), r = e instanceof HTMLElement && e.querySelector("p,li,h1,h2,h3,h4,h5,h6") || e;
143
+ t.selectNodeContents(r), t.collapse(!0), n.removeAllRanges(), n.addRange(t);
144
+ }
145
+ function k(e) {
146
+ e.dispatchEvent(new Event("input", { bubbles: !0 }));
147
+ }
148
+ function D(e, n, t) {
149
+ const r = window.execEditorCommand;
150
+ if (typeof r == "function") {
151
+ r("recordDomTransaction", e, n, t);
152
+ return;
153
+ }
154
+ const s = window.executeEditorCommand;
155
+ typeof s == "function" && s("recordDomTransaction", { editor: e, beforeHTML: n, afterHTML: t });
156
+ }
157
+ function P(e, n) {
158
+ const t = /* @__PURE__ */ new Map();
159
+ return Array.from(e.querySelectorAll("li")).filter(
160
+ (s) => s instanceof HTMLLIElement && C(n, s)
161
+ ).forEach((s) => {
162
+ var a;
163
+ const o = s.parentElement;
164
+ (o instanceof HTMLUListElement || o instanceof HTMLOListElement) && o.parentElement === e && (t.has(o) || t.set(o, /* @__PURE__ */ new Set()), (a = t.get(o)) == null || a.add(s));
165
+ }), t;
166
+ }
167
+ function m(e, n) {
168
+ const t = e.toLowerCase();
169
+ if (!B.has(t)) return !1;
170
+ const r = S(n);
171
+ if (!r) return !1;
172
+ const s = N(r);
173
+ if (!s) return !1;
174
+ const o = r.innerHTML, a = [], i = P(r, s);
175
+ i.size > 0 ? i.forEach((u, l) => {
176
+ a.push(...L(l, u, t));
177
+ }) : w(r, s).forEach((l) => {
178
+ if (l instanceof HTMLUListElement || l instanceof HTMLOListElement) {
179
+ const h = new Set(Array.from(l.children).filter(
180
+ (M) => M instanceof HTMLLIElement
181
+ ));
182
+ a.push(...L(l, h, t));
183
+ return;
184
+ }
185
+ if (g.has(l.tagName)) {
186
+ const h = l.querySelector(":scope > ul, :scope > ol, :scope > blockquote, :scope > table");
187
+ a.push(
188
+ ...h ? O(l, t) : _(l, t)
189
+ );
190
+ }
191
+ });
192
+ const c = r.innerHTML;
193
+ return o === c || a.length === 0 ? !1 : (D(r, o, c), k(r), b(a[0]), !0);
194
+ }
195
+ const q = () => ({
196
+ name: "heading",
197
+ // Toolbar button configuration with dropdown
198
+ toolbar: [
199
+ {
200
+ label: "P",
201
+ command: "setBlockType",
202
+ type: "dropdown",
203
+ options: [
204
+ { value: "p", label: "P" },
205
+ { value: "h1", label: "H1" },
206
+ { value: "h2", label: "H2" },
207
+ { value: "h3", label: "H3" },
208
+ { value: "h4", label: "H4" },
209
+ { value: "h5", label: "H5" },
210
+ { value: "h6", label: "H6" }
211
+ ],
212
+ icon: '<svg width="24" height="24" focusable="false"><path d="M16.1 8.6 14.2 4l-1.4.5 2.8 7.4c.1.4.5.6.9.6h.1c.4-.1.6-.5.6-.9l1.8-4.8-1.4-.5-1.5 2.3ZM4 11.5h6V10H4v1.5ZM18.5 3v1L17 7l.9.9L20.7 3h-2.2ZM5.5 12h1v7h1v-7h1v-.5h-3V12Zm4 0h1v7h1v-7h1v-.5h-3V12Zm10 1.5a2 2 0 0 0-2-2h-1v7.5h1v-2.7h1a2 2 0 0 0 2-2v-.8Zm-2 1.3h-1v-2.3h1a.8.8 0 1 1 0 1.6v.7Z" fill-rule="evenodd"></path></svg>'
213
+ }
214
+ ],
215
+ // Native command implementations
216
+ commands: {
217
+ /**
218
+ * Set block type to specific heading level or paragraph
219
+ */
220
+ setBlockType: (e, n) => e ? m(e, n) : !1,
221
+ /**
222
+ * Set heading level 1
223
+ */
224
+ setHeading1: (e, n) => m("h1", n),
225
+ /**
226
+ * Set heading level 2
227
+ */
228
+ setHeading2: (e, n) => m("h2", n),
229
+ /**
230
+ * Set heading level 3
231
+ */
232
+ setHeading3: (e, n) => m("h3", n),
233
+ /**
234
+ * Set to paragraph
235
+ */
236
+ setParagraph: (e, n) => m("p", n)
237
+ },
238
+ // Keyboard shortcuts
239
+ keymap: {
240
+ "Mod-Alt-1": "setHeading1",
241
+ "Mod-Alt-2": "setHeading2",
242
+ "Mod-Alt-3": "setHeading3",
243
+ "Mod-Alt-0": "setParagraph"
244
+ }
245
+ });
246
+ export {
247
+ q as HeadingPlugin
248
+ };
249
+ //# sourceMappingURL=HeadingPlugin.native-DZdvubrQ.mjs.map
@@ -1,19 +1,19 @@
1
- const A = ".rte-content, .editora-content";
2
- const y = "__editoraCommandEditorRoot", s = /* @__PURE__ */ new Map(), E = {};
1
+ const S = ".rte-content, .editora-content";
2
+ const y = "__editoraCommandEditorRoot", d = /* @__PURE__ */ new Map(), l = {};
3
3
  let T = !1, c = null;
4
- function N(t) {
4
+ function R(t) {
5
5
  if (!t) return null;
6
6
  const e = t.querySelector('[contenteditable="true"]');
7
7
  return e instanceof HTMLElement ? e : null;
8
8
  }
9
- function z() {
9
+ function I() {
10
10
  if (typeof window == "undefined") return null;
11
11
  const t = window[y];
12
12
  if (!(t instanceof HTMLElement)) return null;
13
13
  window[y] = null;
14
14
  const e = t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || (t.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") ? t : null);
15
15
  if (e) {
16
- const o = N(e);
16
+ const o = R(e);
17
17
  if (o) return o;
18
18
  if (e.getAttribute("contenteditable") === "true") return e;
19
19
  }
@@ -22,13 +22,13 @@ function z() {
22
22
  const n = t.closest('[contenteditable="true"]');
23
23
  return n instanceof HTMLElement ? n : null;
24
24
  }
25
- function F(t) {
25
+ function N(t) {
26
26
  return t ? t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement : null;
27
27
  }
28
- function f(t) {
29
- const e = F(t);
28
+ function s(t) {
29
+ const e = N(t);
30
30
  if (!e) return null;
31
- const n = e.closest(A);
31
+ const n = e.closest(S);
32
32
  if (n) return n;
33
33
  const o = e.closest('[contenteditable="true"]');
34
34
  if (!o) return null;
@@ -37,61 +37,58 @@ function f(t) {
37
37
  i.getAttribute("contenteditable") === "true" && (r = i), i = i.parentElement;
38
38
  return r;
39
39
  }
40
- function l() {
41
- const t = z();
40
+ function E() {
41
+ const t = I();
42
42
  if (t && document.contains(t))
43
43
  return t;
44
44
  const e = window.getSelection();
45
45
  if (e && e.rangeCount > 0) {
46
- const i = f(e.getRangeAt(0).startContainer);
46
+ const i = s(e.getRangeAt(0).startContainer);
47
47
  if (i) return i;
48
48
  }
49
49
  const n = document.activeElement;
50
50
  if (n) {
51
- const i = f(n);
51
+ const i = s(n);
52
52
  if (i) return i;
53
53
  }
54
54
  if (c != null && c.isConnected) return c;
55
- const o = Array.from(s.keys()).find((i) => i.isConnected);
55
+ const o = Array.from(d.keys()).find((i) => i.isConnected);
56
56
  if (o) return o;
57
- const r = document.querySelector(A);
57
+ const r = document.querySelector(S);
58
58
  return r || document.querySelector('[contenteditable="true"]');
59
59
  }
60
- function L() {
61
- for (const t of s.keys())
62
- t.isConnected || (s.delete(t), c === t && (c = null));
60
+ function A() {
61
+ for (const t of d.keys())
62
+ t.isConnected || (d.delete(t), c === t && (c = null));
63
63
  }
64
- function M(t) {
65
- L();
66
- let e = s.get(t);
67
- return e || (e = { undoStack: [], redoStack: [] }, s.set(t, e)), e;
64
+ function C(t) {
65
+ A();
66
+ let e = d.get(t);
67
+ return e || (e = { undoStack: [], redoStack: [] }, d.set(t, e)), e;
68
68
  }
69
- function d(t) {
69
+ function a(t) {
70
70
  t && t.dispatchEvent(new Event("input", { bubbles: !0 }));
71
71
  }
72
- function h(t) {
73
- return t ? t.innerHTML : "";
74
- }
75
- function m(t, e) {
72
+ function f(t, e) {
76
73
  if (!t) return;
77
- const n = M(t);
74
+ const n = C(t);
78
75
  n.undoStack.push(e), n.redoStack.length = 0, n.undoStack.length > 100 && n.undoStack.splice(0, n.undoStack.length - 100), c = t;
79
76
  }
80
- function v(t, e = "undo") {
81
- if (L(), t != null && t.isConnected)
77
+ function h(t, e = "undo") {
78
+ if (A(), t != null && t.isConnected)
82
79
  return t;
83
- const n = l();
80
+ const n = E();
84
81
  if (n != null && n.isConnected)
85
82
  return n;
86
83
  if (c != null && c.isConnected)
87
84
  return c;
88
85
  const o = (r) => e === "undo" ? r.undoStack.length > 0 : r.redoStack.length > 0;
89
- for (const [r, i] of s.entries())
86
+ for (const [r, i] of d.entries())
90
87
  if (r.isConnected && o(i))
91
88
  return r;
92
89
  return null;
93
90
  }
94
- function H(t) {
91
+ function g(t) {
95
92
  const e = {};
96
93
  for (const r of t.getAttributeNames()) {
97
94
  const i = t.getAttribute(r);
@@ -112,81 +109,69 @@ function w(t, e) {
112
109
  }), t.innerHTML !== e.innerHTML && (t.innerHTML = e.innerHTML), e.value !== null && (t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement || t instanceof HTMLSelectElement) && (t.value = e.value), e.checked !== null && t instanceof HTMLInputElement && (t.checked = e.checked);
113
110
  }
114
111
  function u(t, e) {
115
- if (E[t] = e, typeof window == "undefined") return;
112
+ if (l[t] = e, typeof window == "undefined") return;
116
113
  const n = window.registerEditorCommand;
117
114
  typeof n == "function" ? n(t, e) : (window.registerEditorCommand = (o, r) => {
118
- E[o] = r;
115
+ l[o] = r;
119
116
  }, window.registerEditorCommand(t, e));
120
117
  }
121
- const S = (t, ...e) => {
122
- const n = E[t];
118
+ const H = (t, ...e) => {
119
+ const n = l[t];
123
120
  return n ? n(...e) : !1;
124
121
  };
125
- function C() {
126
- T || typeof window == "undefined" || (T = !0, window.execEditorCommand || (window.execEditorCommand = S), window.executeEditorCommand || (window.executeEditorCommand = S), u("undo", k), u("redo", O), u("setAttribute", D), u("setText", _), u("autoFixA11y", R), u("recordDomTransaction", I), u("undoDom", b), u("redoDom", p));
127
- }
128
- function x(t, e) {
129
- const n = e || l(), o = h(n);
130
- n == null || n.focus({ preventScroll: !0 });
131
- let r = !1;
132
- try {
133
- r = !!document.execCommand(t, !1);
134
- } catch (g) {
135
- r = !1;
136
- }
137
- const i = h(n), a = o !== i;
138
- return a && d(n), { executed: r, changed: a };
139
- }
140
- const k = () => {
141
- const t = l();
142
- return x("undo", t).changed ? !0 : b(t != null ? t : void 0);
143
- }, O = () => {
144
- const t = l();
145
- return x("redo", t).changed ? !0 : p(t != null ? t : void 0);
146
- }, D = (t, e, n) => {
122
+ function m() {
123
+ T || typeof window == "undefined" || (T = !0, window.execEditorCommand || (window.execEditorCommand = H), window.executeEditorCommand || (window.executeEditorCommand = H), u("undo", L), u("redo", x), u("setAttribute", k), u("setText", v), u("autoFixA11y", O), u("recordDomTransaction", D), u("undoDom", M), u("redoDom", b));
124
+ }
125
+ const L = () => {
126
+ const t = E();
127
+ return M(t != null ? t : void 0);
128
+ }, x = () => {
129
+ const t = E();
130
+ return b(t != null ? t : void 0);
131
+ }, k = (t, e, n) => {
147
132
  if (!(t instanceof HTMLElement)) return;
148
- const o = f(t), r = t.hasAttribute(e), i = t.getAttribute(e);
149
- t.setAttribute(e, n), m(o, {
133
+ const o = s(t), r = t.hasAttribute(e), i = t.getAttribute(e);
134
+ t.setAttribute(e, n), f(o, {
150
135
  undo: () => {
151
136
  t.isConnected && (r && i !== null ? t.setAttribute(e, i) : t.removeAttribute(e));
152
137
  },
153
138
  redo: () => {
154
139
  t.isConnected && t.setAttribute(e, n);
155
140
  }
156
- }), d(o);
157
- }, _ = (t, e) => {
141
+ }), a(o);
142
+ }, v = (t, e) => {
158
143
  var r;
159
144
  if (!(t instanceof HTMLElement)) return;
160
- const n = f(t), o = (r = t.textContent) != null ? r : "";
161
- t.textContent = e, m(n, {
145
+ const n = s(t), o = (r = t.textContent) != null ? r : "";
146
+ t.textContent = e, f(n, {
162
147
  undo: () => {
163
148
  t.isConnected && (t.textContent = o);
164
149
  },
165
150
  redo: () => {
166
151
  t.isConnected && (t.textContent = e);
167
152
  }
168
- }), d(n);
169
- }, R = (t) => {
170
- var a;
153
+ }), a(n);
154
+ }, O = (t) => {
155
+ var p;
171
156
  const e = t == null ? void 0 : t.element;
172
157
  if (!(e instanceof HTMLElement)) return;
173
- const n = f(e), o = (a = window.a11yRuleRegistry) == null ? void 0 : a.find((g) => g.id === t.rule);
158
+ const n = s(e), o = (p = window.a11yRuleRegistry) == null ? void 0 : p.find((_) => _.id === t.rule);
174
159
  if (!o || typeof o.fix != "function") return;
175
- const r = H(e);
160
+ const r = g(e);
176
161
  o.fix(t);
177
- const i = H(e);
178
- m(n, {
162
+ const i = g(e);
163
+ f(n, {
179
164
  undo: () => {
180
165
  e.isConnected && w(e, r);
181
166
  },
182
167
  redo: () => {
183
168
  e.isConnected && w(e, i);
184
169
  }
185
- }), d(n);
186
- }, I = (t, e, n) => {
170
+ }), a(n);
171
+ }, D = (t, e, n) => {
187
172
  if (!(t instanceof HTMLElement)) return !1;
188
173
  const o = typeof n == "string" ? n : t.innerHTML;
189
- return e === o ? !1 : (m(t, {
174
+ return e === o ? !1 : (f(t, {
190
175
  undo: () => {
191
176
  t.isConnected && (t.innerHTML = e);
192
177
  },
@@ -194,19 +179,19 @@ const k = () => {
194
179
  t.isConnected && (t.innerHTML = o);
195
180
  }
196
181
  }), !0);
197
- }, b = (t) => {
198
- const e = v(t, "undo");
182
+ }, M = (t) => {
183
+ const e = h(t, "undo");
199
184
  if (!e) return !1;
200
- const n = M(e), o = n.undoStack.pop();
201
- return o ? (o.undo(), n.redoStack.push(o), c = e, d(e), !0) : !1;
202
- }, p = (t) => {
203
- const e = v(t, "redo");
185
+ const n = C(e), o = n.undoStack.pop();
186
+ return o ? (o.undo(), n.redoStack.push(o), c = e, a(e), !0) : !1;
187
+ }, b = (t) => {
188
+ const e = h(t, "redo");
204
189
  if (!e) return !1;
205
- const n = M(e), o = n.redoStack.pop();
206
- return o ? (o.redo(), n.undoStack.push(o), c = e, d(e), !0) : !1;
190
+ const n = C(e), o = n.redoStack.pop();
191
+ return o ? (o.redo(), n.undoStack.push(o), c = e, a(e), !0) : !1;
207
192
  };
208
- typeof window != "undefined" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", C, { once: !0 }) : C());
209
- const Y = () => (C(), {
193
+ typeof window != "undefined" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", m, { once: !0 }) : m());
194
+ const z = () => (m(), {
210
195
  name: "history",
211
196
  toolbar: [
212
197
  {
@@ -225,14 +210,14 @@ const Y = () => (C(), {
225
210
  }
226
211
  ],
227
212
  commands: {
228
- undo: k,
229
- redo: O,
230
- setAttribute: D,
231
- setText: _,
232
- autoFixA11y: R,
233
- recordDomTransaction: I,
234
- undoDom: b,
235
- redoDom: p
213
+ undo: L,
214
+ redo: x,
215
+ setAttribute: k,
216
+ setText: v,
217
+ autoFixA11y: O,
218
+ recordDomTransaction: D,
219
+ undoDom: M,
220
+ redoDom: b
236
221
  },
237
222
  keymap: {
238
223
  "Mod-z": "undo",
@@ -244,14 +229,14 @@ const Y = () => (C(), {
244
229
  }
245
230
  });
246
231
  export {
247
- Y as HistoryPlugin,
248
- R as autoFixA11y,
249
- I as recordDomTransaction,
250
- O as redo,
251
- p as redoDom,
252
- D as setAttribute,
253
- _ as setText,
254
- k as undo,
255
- b as undoDom
232
+ z as HistoryPlugin,
233
+ O as autoFixA11y,
234
+ D as recordDomTransaction,
235
+ x as redo,
236
+ b as redoDom,
237
+ k as setAttribute,
238
+ v as setText,
239
+ L as undo,
240
+ M as undoDom
256
241
  };
257
- //# sourceMappingURL=HistoryPlugin.native-TDnVMsEO.mjs.map
242
+ //# sourceMappingURL=HistoryPlugin.native-D2wl32jV.mjs.map
@@ -1,11 +1,15 @@
1
- const i = () => (document.execCommand("italic", !1), !0), a = (o, l) => {
2
- var t;
3
- typeof window != "undefined" && ((t = window.registerEditorCommand) == null || t.call(window, o, l));
4
- }, e = () => {
5
- a("toggleItalic", i);
1
+ import { a as l } from "./inlineFormatting-DJ0-NZtx.mjs";
2
+ const a = (e, t) => l({
3
+ command: "italic",
4
+ context: t
5
+ }), n = (e, t) => {
6
+ var i;
7
+ typeof window != "undefined" && ((i = window.registerEditorCommand) == null || i.call(window, e, t));
8
+ }, o = () => {
9
+ n("toggleItalic", a);
6
10
  };
7
- typeof window != "undefined" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", e) : e());
8
- const n = () => ({
11
+ typeof window != "undefined" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", o) : o());
12
+ const c = () => ({
9
13
  name: "italic",
10
14
  marks: {
11
15
  italic: {
@@ -29,7 +33,7 @@ const n = () => ({
29
33
  }
30
34
  ],
31
35
  commands: {
32
- toggleItalic: i
36
+ toggleItalic: a
33
37
  },
34
38
  keymap: {
35
39
  "Mod-i": "toggleItalic",
@@ -37,7 +41,7 @@ const n = () => ({
37
41
  }
38
42
  });
39
43
  export {
40
- n as ItalicPlugin,
41
- i as toggleItalic
44
+ c as ItalicPlugin,
45
+ a as toggleItalic
42
46
  };
43
- //# sourceMappingURL=ItalicPlugin.native-CQjjDyUL.mjs.map
47
+ //# sourceMappingURL=ItalicPlugin.native-CmnlwFHB.mjs.map