@editora/core 1.0.3 → 1.0.4
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 +34 -0
- package/dist/{A11yCheckerPlugin.native-CZKpi3uF.mjs → A11yCheckerPlugin.native-BRdGYMju.mjs} +225 -173
- package/dist/AnchorPlugin.native-C1Rw5m04.mjs +404 -0
- package/dist/BackgroundColorPlugin.native-BE-p9DRd.mjs +489 -0
- package/dist/ChecklistPlugin.native-nuSSEFNI.mjs +309 -0
- package/dist/ClearFormattingPlugin.native-Bq_XcTh2.mjs +140 -0
- package/dist/{CodePlugin.native-CK9d8rmt.mjs → CodePlugin.native-0Zari_zp.mjs} +329 -310
- package/dist/CodeSamplePlugin.native-B-KS1pOl.mjs +384 -0
- package/dist/CommentsPlugin.native-tMnWn8a2.mjs +723 -0
- package/dist/DirectionPlugin.native-CDnbdNyl.mjs +130 -0
- package/dist/{EmbedIframePlugin.native-ifr9KLdN.mjs → EmbedIframePlugin.native-CSWIB1jm.mjs} +154 -50
- package/dist/{EmojisPlugin.native-D6mJSnSR.mjs → EmojisPlugin.native-DxTm_DL-.mjs} +156 -103
- package/dist/FontFamilyPlugin.native-j8hMTbg4.mjs +158 -0
- package/dist/FontSizePlugin.native-B_jCh7dY.mjs +286 -0
- package/dist/FootnotePlugin.native-D730OGRm.mjs +425 -0
- package/dist/HistoryPlugin.native-DCrPdeSW.mjs +257 -0
- package/dist/IndentPlugin.native-BHixp8sP.mjs +150 -0
- package/dist/LineHeightPlugin.native-CM7iXdQj.mjs +151 -0
- package/dist/{LinkPlugin.native-BdAOV-iu.mjs → LinkPlugin.native-CS2g-G18.mjs} +128 -53
- package/dist/{ListPlugin.native-CLFU5AUQ.mjs → ListPlugin.native-V7EZC1lM.mjs} +59 -12
- package/dist/MathPlugin.native-KUxz0o8C.mjs +251 -0
- package/dist/MediaManagerPlugin.native-CgP5iInD.mjs +970 -0
- package/dist/MergeTagPlugin.native-CU9LtsfD.mjs +416 -0
- package/dist/PageBreakPlugin.native-CGiQxXqR.mjs +297 -0
- package/dist/{PrintPlugin.native-BUpm52VJ.mjs → PrintPlugin.native-7qt5v7L5.mjs} +10 -10
- package/dist/{SpecialCharactersPlugin.native-x7a2SWXc.mjs → SpecialCharactersPlugin.native-DANrbExJ.mjs} +143 -97
- package/dist/SpellCheckPlugin.native-C8bPvRHy.mjs +1019 -0
- package/dist/StrikethroughPlugin.native-0Be7j49s.mjs +73 -0
- package/dist/{TablePlugin.native-EEWXn1-s.mjs → TablePlugin.native-DrHX-efe.mjs} +149 -145
- package/dist/TemplatePlugin.native-4lKEm-WY.mjs +578 -0
- package/dist/TextAlignmentPlugin.native-sM_1s00t.mjs +108 -0
- package/dist/{TextColorPlugin.native-D6SmTglm.mjs → TextColorPlugin.native-Clgtb50j.mjs} +173 -92
- package/dist/colorSelectionApply-CK1My9N2.mjs +67 -0
- package/dist/core.css +1 -1
- package/dist/editora.min.js +31 -29
- package/dist/editora.umd.js +31 -29
- package/dist/index-CqWQFb3D.js +10 -0
- package/dist/index-OwnkG39N.mjs +2227 -0
- package/dist/index.cjs.js +14 -18
- package/dist/index.esm.js +204 -521
- package/dist/plugin-loader.js +26 -26
- package/dist/webcomponent-core.js +1286 -295
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +100 -75
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +1252 -261
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +3616 -2109
- package/index.d.ts +355 -0
- package/package.json +19 -17
- package/dist/A11yCheckerPlugin.native-CZKpi3uF.mjs.map +0 -1
- package/dist/AnchorPlugin.native-7es9PVZ9.mjs +0 -340
- package/dist/AnchorPlugin.native-7es9PVZ9.mjs.map +0 -1
- package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs +0 -449
- package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs.map +0 -1
- package/dist/BlockquotePlugin.native-JFmOLsxN.mjs.map +0 -1
- package/dist/BoldPlugin.native-BAzzoqU5.mjs.map +0 -1
- package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs.map +0 -1
- package/dist/ChecklistPlugin.native-Dccs3nLe.mjs +0 -153
- package/dist/ChecklistPlugin.native-Dccs3nLe.mjs.map +0 -1
- package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs +0 -27
- package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs.map +0 -1
- package/dist/CodePlugin.native-CK9d8rmt.mjs.map +0 -1
- package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs +0 -326
- package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs.map +0 -1
- package/dist/CommentsPlugin.native-2zQV8Ia4.mjs +0 -473
- package/dist/CommentsPlugin.native-2zQV8Ia4.mjs.map +0 -1
- package/dist/DirectionPlugin.native-Be7wCzkI.mjs +0 -59
- package/dist/DirectionPlugin.native-Be7wCzkI.mjs.map +0 -1
- package/dist/DocumentManagerPlugin.native-BvZL5CSG.mjs.map +0 -1
- package/dist/EmbedIframePlugin.native-ifr9KLdN.mjs.map +0 -1
- package/dist/EmojisPlugin.native-D6mJSnSR.mjs.map +0 -1
- package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs +0 -106
- package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs.map +0 -1
- package/dist/FontSizePlugin.native-DkLMLPue.mjs +0 -186
- package/dist/FontSizePlugin.native-DkLMLPue.mjs.map +0 -1
- package/dist/FootnotePlugin.native-BciVc9W6.mjs +0 -128
- package/dist/FootnotePlugin.native-BciVc9W6.mjs.map +0 -1
- package/dist/FullscreenPlugin.native-ChXyxeNw.mjs.map +0 -1
- package/dist/HeadingPlugin.native-DrLYwQnQ.mjs.map +0 -1
- package/dist/HistoryPlugin.native-DoDRifCf.mjs +0 -89
- package/dist/HistoryPlugin.native-DoDRifCf.mjs.map +0 -1
- package/dist/IndentPlugin.native-CbFugPoi.mjs +0 -133
- package/dist/IndentPlugin.native-CbFugPoi.mjs.map +0 -1
- package/dist/ItalicPlugin.native-CQjjDyUL.mjs.map +0 -1
- package/dist/LineHeightPlugin.native-CWQT2FIa.mjs +0 -73
- package/dist/LineHeightPlugin.native-CWQT2FIa.mjs.map +0 -1
- package/dist/LinkPlugin.native-BdAOV-iu.mjs.map +0 -1
- package/dist/ListPlugin.native-CLFU5AUQ.mjs.map +0 -1
- package/dist/MathPlugin.native-DE_ii-LA.mjs +0 -182
- package/dist/MathPlugin.native-DE_ii-LA.mjs.map +0 -1
- package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs +0 -533
- package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs.map +0 -1
- package/dist/MergeTagPlugin.native-CrxyThyn.mjs +0 -178
- package/dist/MergeTagPlugin.native-CrxyThyn.mjs.map +0 -1
- package/dist/PageBreakPlugin.native-DDjcDyRW.mjs +0 -172
- package/dist/PageBreakPlugin.native-DDjcDyRW.mjs.map +0 -1
- package/dist/PreviewPlugin.native-DBvfpmIv.mjs.map +0 -1
- package/dist/PrintPlugin.native-BUpm52VJ.mjs.map +0 -1
- package/dist/SpecialCharactersPlugin.native-x7a2SWXc.mjs.map +0 -1
- package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs +0 -465
- package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs.map +0 -1
- package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs +0 -43
- package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs.map +0 -1
- package/dist/TablePlugin.native-EEWXn1-s.mjs.map +0 -1
- package/dist/TemplatePlugin.native-BlSn1c9h.mjs +0 -564
- package/dist/TemplatePlugin.native-BlSn1c9h.mjs.map +0 -1
- package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs +0 -97
- package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs.map +0 -1
- package/dist/TextColorPlugin.native-D6SmTglm.mjs.map +0 -1
- package/dist/UnderlinePlugin.native-QpIcK4L2.mjs.map +0 -1
- package/dist/documentManager-irzj9n3V.mjs.map +0 -1
- package/dist/editorContainerHelpers-C7kdWnS0.mjs.map +0 -1
- package/dist/editora.min.js.map +0 -1
- package/dist/editora.umd.js.map +0 -1
- package/dist/index-BF5RBhL9.js +0 -4
- package/dist/index-BF5RBhL9.js.map +0 -1
- package/dist/index-BPsf460l.mjs +0 -1243
- package/dist/index-BPsf460l.mjs.map +0 -1
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.es-CuicffkQ.mjs.map +0 -1
- package/dist/index.esm.js.map +0 -1
- package/dist/plugin-loader.js.map +0 -1
- package/dist/purify.es-CKpwg8Tk.mjs.map +0 -1
- package/dist/webcomponent-core.js.map +0 -1
- package/dist/webcomponent-core.min.js.map +0 -1
- package/dist/webcomponent.cjs.js.map +0 -1
- package/dist/webcomponent.esm.js.map +0 -1
- package/dist/webcomponent.js.map +0 -1
- package/dist/webcomponent.min.js.map +0 -1
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
const A = ".rte-content, .editora-content";
|
|
2
|
+
const y = "__editoraCommandEditorRoot", d = /* @__PURE__ */ new Map(), E = {};
|
|
3
|
+
let T = !1, c = null;
|
|
4
|
+
function N(t) {
|
|
5
|
+
if (!t) return null;
|
|
6
|
+
const e = t.querySelector('[contenteditable="true"]');
|
|
7
|
+
return e instanceof HTMLElement ? e : null;
|
|
8
|
+
}
|
|
9
|
+
function z() {
|
|
10
|
+
if (typeof window == "undefined") return null;
|
|
11
|
+
const t = window[y];
|
|
12
|
+
if (!(t instanceof HTMLElement)) return null;
|
|
13
|
+
window[y] = null;
|
|
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
|
+
if (e) {
|
|
16
|
+
const o = N(e);
|
|
17
|
+
if (o) return o;
|
|
18
|
+
if (e.getAttribute("contenteditable") === "true") return e;
|
|
19
|
+
}
|
|
20
|
+
if (t.getAttribute("contenteditable") === "true")
|
|
21
|
+
return t;
|
|
22
|
+
const n = t.closest('[contenteditable="true"]');
|
|
23
|
+
return n instanceof HTMLElement ? n : null;
|
|
24
|
+
}
|
|
25
|
+
function F(t) {
|
|
26
|
+
return t ? t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement : null;
|
|
27
|
+
}
|
|
28
|
+
function f(t) {
|
|
29
|
+
const e = F(t);
|
|
30
|
+
if (!e) return null;
|
|
31
|
+
const n = e.closest(A);
|
|
32
|
+
if (n) return n;
|
|
33
|
+
const o = e.closest('[contenteditable="true"]');
|
|
34
|
+
if (!o) return null;
|
|
35
|
+
let r = o, i = r.parentElement;
|
|
36
|
+
for (; i; )
|
|
37
|
+
i.getAttribute("contenteditable") === "true" && (r = i), i = i.parentElement;
|
|
38
|
+
return r;
|
|
39
|
+
}
|
|
40
|
+
function l() {
|
|
41
|
+
const t = z();
|
|
42
|
+
if (t && document.contains(t))
|
|
43
|
+
return t;
|
|
44
|
+
const e = window.getSelection();
|
|
45
|
+
if (e && e.rangeCount > 0) {
|
|
46
|
+
const i = f(e.getRangeAt(0).startContainer);
|
|
47
|
+
if (i) return i;
|
|
48
|
+
}
|
|
49
|
+
const n = document.activeElement;
|
|
50
|
+
if (n) {
|
|
51
|
+
const i = f(n);
|
|
52
|
+
if (i) return i;
|
|
53
|
+
}
|
|
54
|
+
if (c != null && c.isConnected) return c;
|
|
55
|
+
const o = Array.from(d.keys()).find((i) => i.isConnected);
|
|
56
|
+
if (o) return o;
|
|
57
|
+
const r = document.querySelector(A);
|
|
58
|
+
return r || document.querySelector('[contenteditable="true"]');
|
|
59
|
+
}
|
|
60
|
+
function L() {
|
|
61
|
+
for (const t of d.keys())
|
|
62
|
+
t.isConnected || (d.delete(t), c === t && (c = null));
|
|
63
|
+
}
|
|
64
|
+
function M(t) {
|
|
65
|
+
L();
|
|
66
|
+
let e = d.get(t);
|
|
67
|
+
return e || (e = { undoStack: [], redoStack: [] }, d.set(t, e)), e;
|
|
68
|
+
}
|
|
69
|
+
function s(t) {
|
|
70
|
+
t && t.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
71
|
+
}
|
|
72
|
+
function h(t) {
|
|
73
|
+
return t ? t.innerHTML : "";
|
|
74
|
+
}
|
|
75
|
+
function m(t, e) {
|
|
76
|
+
if (!t) return;
|
|
77
|
+
const n = M(t);
|
|
78
|
+
n.undoStack.push(e), n.redoStack.length = 0, n.undoStack.length > 100 && n.undoStack.splice(0, n.undoStack.length - 100), c = t;
|
|
79
|
+
}
|
|
80
|
+
function x(t, e = "undo") {
|
|
81
|
+
if (L(), t != null && t.isConnected)
|
|
82
|
+
return t;
|
|
83
|
+
const n = l();
|
|
84
|
+
if (n != null && n.isConnected)
|
|
85
|
+
return n;
|
|
86
|
+
if (c != null && c.isConnected)
|
|
87
|
+
return c;
|
|
88
|
+
const o = (r) => e === "undo" ? r.undoStack.length > 0 : r.redoStack.length > 0;
|
|
89
|
+
for (const [r, i] of d.entries())
|
|
90
|
+
if (r.isConnected && o(i))
|
|
91
|
+
return r;
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
function H(t) {
|
|
95
|
+
const e = {};
|
|
96
|
+
for (const r of t.getAttributeNames()) {
|
|
97
|
+
const i = t.getAttribute(r);
|
|
98
|
+
i !== null && (e[r] = i);
|
|
99
|
+
}
|
|
100
|
+
const n = t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement || t instanceof HTMLSelectElement, o = t instanceof HTMLInputElement;
|
|
101
|
+
return {
|
|
102
|
+
attributes: e,
|
|
103
|
+
innerHTML: t.innerHTML,
|
|
104
|
+
value: n ? t.value : null,
|
|
105
|
+
checked: o ? t.checked : null
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function w(t, e) {
|
|
109
|
+
const n = new Set(t.getAttributeNames());
|
|
110
|
+
Object.keys(e.attributes).forEach((o) => n.delete(o)), n.forEach((o) => t.removeAttribute(o)), Object.entries(e.attributes).forEach(([o, r]) => {
|
|
111
|
+
t.setAttribute(o, r);
|
|
112
|
+
}), 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
|
+
}
|
|
114
|
+
function u(t, e) {
|
|
115
|
+
if (E[t] = e, typeof window == "undefined") return;
|
|
116
|
+
const n = window.registerEditorCommand;
|
|
117
|
+
typeof n == "function" ? n(t, e) : (window.registerEditorCommand = (o, r) => {
|
|
118
|
+
E[o] = r;
|
|
119
|
+
}, window.registerEditorCommand(t, e));
|
|
120
|
+
}
|
|
121
|
+
const S = (t, ...e) => {
|
|
122
|
+
const n = E[t];
|
|
123
|
+
return n ? n(...e) : !1;
|
|
124
|
+
};
|
|
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 v(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 && s(n), { executed: r, changed: a };
|
|
139
|
+
}
|
|
140
|
+
const k = () => {
|
|
141
|
+
const t = l();
|
|
142
|
+
return v("undo", t).changed ? !0 : b(t);
|
|
143
|
+
}, O = () => {
|
|
144
|
+
const t = l();
|
|
145
|
+
return v("redo", t).changed ? !0 : p(t);
|
|
146
|
+
}, D = (t, e, n) => {
|
|
147
|
+
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, {
|
|
150
|
+
undo: () => {
|
|
151
|
+
t.isConnected && (r && i !== null ? t.setAttribute(e, i) : t.removeAttribute(e));
|
|
152
|
+
},
|
|
153
|
+
redo: () => {
|
|
154
|
+
t.isConnected && t.setAttribute(e, n);
|
|
155
|
+
}
|
|
156
|
+
}), s(o);
|
|
157
|
+
}, _ = (t, e) => {
|
|
158
|
+
var r;
|
|
159
|
+
if (!(t instanceof HTMLElement)) return;
|
|
160
|
+
const n = f(t), o = (r = t.textContent) != null ? r : "";
|
|
161
|
+
t.textContent = e, m(n, {
|
|
162
|
+
undo: () => {
|
|
163
|
+
t.isConnected && (t.textContent = o);
|
|
164
|
+
},
|
|
165
|
+
redo: () => {
|
|
166
|
+
t.isConnected && (t.textContent = e);
|
|
167
|
+
}
|
|
168
|
+
}), s(n);
|
|
169
|
+
}, R = (t) => {
|
|
170
|
+
var a;
|
|
171
|
+
const e = t == null ? void 0 : t.element;
|
|
172
|
+
if (!(e instanceof HTMLElement)) return;
|
|
173
|
+
const n = f(e), o = (a = window.a11yRuleRegistry) == null ? void 0 : a.find((g) => g.id === t.rule);
|
|
174
|
+
if (!o || typeof o.fix != "function") return;
|
|
175
|
+
const r = H(e);
|
|
176
|
+
o.fix(t);
|
|
177
|
+
const i = H(e);
|
|
178
|
+
m(n, {
|
|
179
|
+
undo: () => {
|
|
180
|
+
e.isConnected && w(e, r);
|
|
181
|
+
},
|
|
182
|
+
redo: () => {
|
|
183
|
+
e.isConnected && w(e, i);
|
|
184
|
+
}
|
|
185
|
+
}), s(n);
|
|
186
|
+
}, I = (t, e, n) => {
|
|
187
|
+
if (!(t instanceof HTMLElement)) return !1;
|
|
188
|
+
const o = typeof n == "string" ? n : t.innerHTML;
|
|
189
|
+
return e === o ? !1 : (m(t, {
|
|
190
|
+
undo: () => {
|
|
191
|
+
t.isConnected && (t.innerHTML = e);
|
|
192
|
+
},
|
|
193
|
+
redo: () => {
|
|
194
|
+
t.isConnected && (t.innerHTML = o);
|
|
195
|
+
}
|
|
196
|
+
}), !0);
|
|
197
|
+
}, b = (t) => {
|
|
198
|
+
const e = x(t, "undo");
|
|
199
|
+
if (!e) return !1;
|
|
200
|
+
const n = M(e), o = n.undoStack.pop();
|
|
201
|
+
return o ? (o.undo(), n.redoStack.push(o), c = e, s(e), !0) : !1;
|
|
202
|
+
}, p = (t) => {
|
|
203
|
+
const e = x(t, "redo");
|
|
204
|
+
if (!e) return !1;
|
|
205
|
+
const n = M(e), o = n.redoStack.pop();
|
|
206
|
+
return o ? (o.redo(), n.undoStack.push(o), c = e, s(e), !0) : !1;
|
|
207
|
+
};
|
|
208
|
+
typeof window != "undefined" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", C, { once: !0 }) : C());
|
|
209
|
+
const Y = () => (C(), {
|
|
210
|
+
name: "history",
|
|
211
|
+
toolbar: [
|
|
212
|
+
{
|
|
213
|
+
label: "Undo",
|
|
214
|
+
command: "undo",
|
|
215
|
+
type: "button",
|
|
216
|
+
icon: '<svg width="24" height="24" focusable="false"><path d="M6.4 8H12c3.7 0 6.2 2 6.8 5.1.6 2.7-.4 5.6-2.3 6.8a1 1 0 0 1-1-1.8c1.1-.6 1.8-2.7 1.4-4.6-.5-2.1-2.1-3.5-4.9-3.5H6.4l3.3 3.3a1 1 0 1 1-1.4 1.4l-5-5a1 1 0 0 1 0-1.4l5-5a1 1 0 0 1 1.4 1.4L6.4 8Z" fill-rule="nonzero"></path></svg>',
|
|
217
|
+
shortcut: "Mod-z"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
label: "Redo",
|
|
221
|
+
command: "redo",
|
|
222
|
+
type: "button",
|
|
223
|
+
icon: '<svg width="24" height="24" focusable="false"><path d="M17.6 10H12c-2.8 0-4.4 1.4-4.9 3.5-.4 2 .3 4 1.4 4.6a1 1 0 1 1-1 1.8c-2-1.2-2.9-4.1-2.3-6.8.6-3 3-5.1 6.8-5.1h5.6l-3.3-3.3a1 1 0 1 1 1.4-1.4l5 5a1 1 0 0 1 0 1.4l-5 5a1 1 0 0 1-1.4-1.4l3.3-3.3Z" fill-rule="nonzero"></path></svg>',
|
|
224
|
+
shortcut: "Mod-y"
|
|
225
|
+
}
|
|
226
|
+
],
|
|
227
|
+
commands: {
|
|
228
|
+
undo: k,
|
|
229
|
+
redo: O,
|
|
230
|
+
setAttribute: D,
|
|
231
|
+
setText: _,
|
|
232
|
+
autoFixA11y: R,
|
|
233
|
+
recordDomTransaction: I,
|
|
234
|
+
undoDom: b,
|
|
235
|
+
redoDom: p
|
|
236
|
+
},
|
|
237
|
+
keymap: {
|
|
238
|
+
"Mod-z": "undo",
|
|
239
|
+
"Mod-Z": "undo",
|
|
240
|
+
"Mod-y": "redo",
|
|
241
|
+
"Mod-Y": "redo",
|
|
242
|
+
"Mod-Shift-z": "redo",
|
|
243
|
+
"Mod-Shift-Z": "redo"
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
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
|
|
256
|
+
};
|
|
257
|
+
//# sourceMappingURL=HistoryPlugin.native-DCrPdeSW.mjs.map
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
const s = (e) => ["P", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "LI", "BLOCKQUOTE", "PRE"].includes(e.tagName) && e.getAttribute("contenteditable") !== "true", m = () => {
|
|
2
|
+
const e = window.getSelection();
|
|
3
|
+
if (e && e.rangeCount > 0) {
|
|
4
|
+
let t = e.getRangeAt(0).startContainer;
|
|
5
|
+
for (; t && t !== document.body; ) {
|
|
6
|
+
if (t.nodeType === Node.ELEMENT_NODE) {
|
|
7
|
+
const o = t;
|
|
8
|
+
if (o.getAttribute("contenteditable") === "true")
|
|
9
|
+
return o;
|
|
10
|
+
}
|
|
11
|
+
t = t.parentNode;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const n = document.activeElement;
|
|
15
|
+
if (n) {
|
|
16
|
+
if (n.getAttribute("contenteditable") === "true")
|
|
17
|
+
return n;
|
|
18
|
+
const t = n.closest('[contenteditable="true"]');
|
|
19
|
+
if (t) return t;
|
|
20
|
+
}
|
|
21
|
+
return document.querySelector('[contenteditable="true"]');
|
|
22
|
+
}, l = (e) => {
|
|
23
|
+
let n = e;
|
|
24
|
+
if (n.nodeType === Node.ELEMENT_NODE) {
|
|
25
|
+
const t = n;
|
|
26
|
+
if (s(t))
|
|
27
|
+
return t;
|
|
28
|
+
}
|
|
29
|
+
for (; n; ) {
|
|
30
|
+
if (n.nodeType === Node.ELEMENT_NODE) {
|
|
31
|
+
const t = n;
|
|
32
|
+
if (s(t))
|
|
33
|
+
return t;
|
|
34
|
+
if (t.getAttribute("contenteditable") === "true")
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
n = n.parentNode;
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}, E = (e, n) => {
|
|
41
|
+
const t = [], o = /* @__PURE__ */ new Set(), c = (r) => {
|
|
42
|
+
!r || o.has(r) || n.contains(r) && s(r) && (o.add(r), t.push(r));
|
|
43
|
+
};
|
|
44
|
+
if (e.collapsed)
|
|
45
|
+
return c(l(e.startContainer)), t;
|
|
46
|
+
const i = document.createTreeWalker(
|
|
47
|
+
n,
|
|
48
|
+
NodeFilter.SHOW_ELEMENT,
|
|
49
|
+
{
|
|
50
|
+
acceptNode: (r) => {
|
|
51
|
+
const a = r;
|
|
52
|
+
if (!s(a)) return NodeFilter.FILTER_SKIP;
|
|
53
|
+
if (typeof e.intersectsNode == "function")
|
|
54
|
+
return e.intersectsNode(a) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
55
|
+
const u = document.createRange();
|
|
56
|
+
return u.selectNodeContents(a), e.compareBoundaryPoints(Range.END_TO_START, u) > 0 && e.compareBoundaryPoints(Range.START_TO_END, u) < 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
let d = i.nextNode();
|
|
61
|
+
for (; d; )
|
|
62
|
+
c(d), d = i.nextNode();
|
|
63
|
+
return t.length === 0 && c(l(e.commonAncestorContainer)), t;
|
|
64
|
+
}, T = (e) => {
|
|
65
|
+
const n = window.getComputedStyle(e), t = n.paddingLeft;
|
|
66
|
+
if (t.endsWith("px"))
|
|
67
|
+
return parseFloat(t);
|
|
68
|
+
if (t.endsWith("em")) {
|
|
69
|
+
const o = parseFloat(n.fontSize);
|
|
70
|
+
return parseFloat(t) * o;
|
|
71
|
+
}
|
|
72
|
+
return 0;
|
|
73
|
+
}, p = (e, n) => {
|
|
74
|
+
if (n === e.innerHTML) return;
|
|
75
|
+
const t = window.execEditorCommand || window.executeEditorCommand;
|
|
76
|
+
if (typeof t == "function")
|
|
77
|
+
try {
|
|
78
|
+
t("recordDomTransaction", e, n, e.innerHTML);
|
|
79
|
+
} catch (o) {
|
|
80
|
+
}
|
|
81
|
+
}, h = () => {
|
|
82
|
+
const e = m();
|
|
83
|
+
if (!e) return !1;
|
|
84
|
+
const n = window.getSelection();
|
|
85
|
+
if (!n || n.rangeCount === 0) return !1;
|
|
86
|
+
const t = n.getRangeAt(0);
|
|
87
|
+
if (!e.contains(t.commonAncestorContainer)) return !1;
|
|
88
|
+
const o = E(t, e);
|
|
89
|
+
if (o.length === 0) return !1;
|
|
90
|
+
const c = e.innerHTML;
|
|
91
|
+
return o.forEach((i) => {
|
|
92
|
+
const r = T(i) + 40;
|
|
93
|
+
i.style.paddingLeft = `${r}px`;
|
|
94
|
+
}), p(e, c), e.dispatchEvent(new Event("input", { bubbles: !0 })), !0;
|
|
95
|
+
}, N = () => {
|
|
96
|
+
const e = m();
|
|
97
|
+
if (!e) return !1;
|
|
98
|
+
const n = window.getSelection();
|
|
99
|
+
if (!n || n.rangeCount === 0) return !1;
|
|
100
|
+
const t = n.getRangeAt(0);
|
|
101
|
+
if (!e.contains(t.commonAncestorContainer)) return !1;
|
|
102
|
+
const o = E(t, e);
|
|
103
|
+
if (o.length === 0) return !1;
|
|
104
|
+
const c = e.innerHTML;
|
|
105
|
+
return o.forEach((i) => {
|
|
106
|
+
const d = T(i), r = Math.max(0, d - 40);
|
|
107
|
+
i.style.paddingLeft = `${r}px`;
|
|
108
|
+
}), p(e, c), e.dispatchEvent(new Event("input", { bubbles: !0 })), !0;
|
|
109
|
+
}, f = (e, n) => {
|
|
110
|
+
var t;
|
|
111
|
+
typeof window != "undefined" && ((t = window.registerEditorCommand) == null || t.call(window, e, n));
|
|
112
|
+
}, g = () => {
|
|
113
|
+
f("increaseIndent", h), f("decreaseIndent", N);
|
|
114
|
+
};
|
|
115
|
+
typeof window != "undefined" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", g) : g());
|
|
116
|
+
const b = () => ({
|
|
117
|
+
name: "indent",
|
|
118
|
+
toolbar: [
|
|
119
|
+
{
|
|
120
|
+
label: "Increase Indent",
|
|
121
|
+
command: "increaseIndent",
|
|
122
|
+
type: "button",
|
|
123
|
+
icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M3 4h18v2H3V4zm0 14h18v2H3v-2zm8-7h10v2H11v-2zm0 4h10v2H11v-2zM3 8l4 4-4 4V8z"/></svg>',
|
|
124
|
+
shortcut: "Mod-]"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
label: "Decrease Indent",
|
|
128
|
+
command: "decreaseIndent",
|
|
129
|
+
type: "button",
|
|
130
|
+
icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M3 4h18v2H3V4zm0 14h18v2H3v-2zm8-7h10v2H11v-2zm0 4h10v2H11v-2zM7 8v8l-4-4 4-4z"/></svg>',
|
|
131
|
+
shortcut: "Mod-["
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
commands: {
|
|
135
|
+
increaseIndent: h,
|
|
136
|
+
decreaseIndent: N
|
|
137
|
+
},
|
|
138
|
+
keymap: {
|
|
139
|
+
"Mod-]": "increaseIndent",
|
|
140
|
+
"Mod-[": "decreaseIndent",
|
|
141
|
+
Tab: "increaseIndent",
|
|
142
|
+
"Shift-Tab": "decreaseIndent"
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
export {
|
|
146
|
+
b as IndentPlugin,
|
|
147
|
+
N as decreaseIndent,
|
|
148
|
+
h as increaseIndent
|
|
149
|
+
};
|
|
150
|
+
//# sourceMappingURL=IndentPlugin.native-BHixp8sP.mjs.map
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
const g = [
|
|
2
|
+
{ label: "1.0", value: "1.0" },
|
|
3
|
+
{ label: "1.15", value: "1.15" },
|
|
4
|
+
{ label: "1.5", value: "1.5" },
|
|
5
|
+
{ label: "2.0", value: "2.0" },
|
|
6
|
+
{ label: "2.5", value: "2.5" },
|
|
7
|
+
{ label: "3.0", value: "3.0" }
|
|
8
|
+
], m = /* @__PURE__ */ new Set([
|
|
9
|
+
"P",
|
|
10
|
+
"DIV",
|
|
11
|
+
"H1",
|
|
12
|
+
"H2",
|
|
13
|
+
"H3",
|
|
14
|
+
"H4",
|
|
15
|
+
"H5",
|
|
16
|
+
"H6",
|
|
17
|
+
"LI",
|
|
18
|
+
"BLOCKQUOTE",
|
|
19
|
+
"PRE"
|
|
20
|
+
]), d = (e) => m.has(e.tagName) && e.getAttribute("contenteditable") !== "true", E = () => {
|
|
21
|
+
const e = window.getSelection();
|
|
22
|
+
if (e && e.rangeCount > 0) {
|
|
23
|
+
let n = e.getRangeAt(0).startContainer;
|
|
24
|
+
for (; n && n !== document.body; ) {
|
|
25
|
+
if (n.nodeType === Node.ELEMENT_NODE) {
|
|
26
|
+
const o = n;
|
|
27
|
+
if (o.getAttribute("contenteditable") === "true")
|
|
28
|
+
return o;
|
|
29
|
+
}
|
|
30
|
+
n = n.parentNode;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const t = document.activeElement;
|
|
34
|
+
if (t) {
|
|
35
|
+
if (t.getAttribute("contenteditable") === "true")
|
|
36
|
+
return t;
|
|
37
|
+
const n = t.closest('[contenteditable="true"]');
|
|
38
|
+
if (n) return n;
|
|
39
|
+
}
|
|
40
|
+
return document.querySelector('[contenteditable="true"]');
|
|
41
|
+
}, u = (e) => {
|
|
42
|
+
let t = e;
|
|
43
|
+
for (; t; ) {
|
|
44
|
+
if (t.nodeType === Node.ELEMENT_NODE) {
|
|
45
|
+
const n = t;
|
|
46
|
+
if (d(n))
|
|
47
|
+
return n;
|
|
48
|
+
if (n.getAttribute("contenteditable") === "true") break;
|
|
49
|
+
}
|
|
50
|
+
t = t.parentNode;
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}, H = (e, t) => {
|
|
54
|
+
const n = [], o = /* @__PURE__ */ new Set(), r = (i) => {
|
|
55
|
+
!i || o.has(i) || t.contains(i) && d(i) && (o.add(i), n.push(i));
|
|
56
|
+
};
|
|
57
|
+
if (e.collapsed)
|
|
58
|
+
return r(u(e.startContainer)), n;
|
|
59
|
+
const s = document.createTreeWalker(
|
|
60
|
+
t,
|
|
61
|
+
NodeFilter.SHOW_ELEMENT,
|
|
62
|
+
{
|
|
63
|
+
acceptNode: (i) => {
|
|
64
|
+
const c = i;
|
|
65
|
+
if (!d(c)) return NodeFilter.FILTER_SKIP;
|
|
66
|
+
if (typeof e.intersectsNode == "function")
|
|
67
|
+
return e.intersectsNode(c) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
68
|
+
const l = document.createRange();
|
|
69
|
+
return l.selectNodeContents(c), e.compareBoundaryPoints(Range.END_TO_START, l) > 0 && e.compareBoundaryPoints(Range.START_TO_END, l) < 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
let a = s.nextNode();
|
|
74
|
+
for (; a; )
|
|
75
|
+
r(a), a = s.nextNode();
|
|
76
|
+
return n.length === 0 && r(u(e.commonAncestorContainer)), n;
|
|
77
|
+
}, L = (e) => {
|
|
78
|
+
e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
79
|
+
}, b = (e, t) => {
|
|
80
|
+
if (t === e.innerHTML) return;
|
|
81
|
+
const n = window.execEditorCommand || window.executeEditorCommand;
|
|
82
|
+
if (typeof n == "function")
|
|
83
|
+
try {
|
|
84
|
+
n("recordDomTransaction", e, t, e.innerHTML);
|
|
85
|
+
} catch (o) {
|
|
86
|
+
}
|
|
87
|
+
}, h = (e) => {
|
|
88
|
+
if (!e) return !1;
|
|
89
|
+
try {
|
|
90
|
+
const t = E();
|
|
91
|
+
if (!t) return !1;
|
|
92
|
+
const n = window.getSelection();
|
|
93
|
+
if (!n || n.rangeCount === 0) return !1;
|
|
94
|
+
const o = n.getRangeAt(0);
|
|
95
|
+
if (!t.contains(o.commonAncestorContainer)) return !1;
|
|
96
|
+
const r = H(o, t);
|
|
97
|
+
if (r.length === 0) return !1;
|
|
98
|
+
const s = t.innerHTML;
|
|
99
|
+
return r.forEach((a) => {
|
|
100
|
+
a.style.lineHeight = e;
|
|
101
|
+
}), b(t, s), L(t), !0;
|
|
102
|
+
} catch (t) {
|
|
103
|
+
return console.error("Failed to set line height:", t), !1;
|
|
104
|
+
}
|
|
105
|
+
}, p = (e, t) => {
|
|
106
|
+
var n;
|
|
107
|
+
typeof window != "undefined" && ((n = window.registerEditorCommand) == null || n.call(window, e, t));
|
|
108
|
+
}, f = () => {
|
|
109
|
+
p("setLineHeight", h);
|
|
110
|
+
};
|
|
111
|
+
typeof window != "undefined" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", f) : f());
|
|
112
|
+
const N = () => ({
|
|
113
|
+
name: "lineHeight",
|
|
114
|
+
marks: {
|
|
115
|
+
lineHeight: {
|
|
116
|
+
attrs: {
|
|
117
|
+
height: { default: null }
|
|
118
|
+
},
|
|
119
|
+
parseDOM: [
|
|
120
|
+
{
|
|
121
|
+
tag: 'span[style*="line-height"]',
|
|
122
|
+
getAttrs: (e) => {
|
|
123
|
+
const n = e.style.lineHeight;
|
|
124
|
+
return n ? { height: n } : !1;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
],
|
|
128
|
+
toDOM: (e) => {
|
|
129
|
+
var t;
|
|
130
|
+
return ["span", { style: `line-height: ${(t = e.attrs) == null ? void 0 : t.height}` }, 0];
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
toolbar: [
|
|
135
|
+
{
|
|
136
|
+
label: "Line Height",
|
|
137
|
+
command: "setLineHeight",
|
|
138
|
+
type: "inline-menu",
|
|
139
|
+
options: g,
|
|
140
|
+
icon: '<svg width="24" height="24" focusable="false"><path d="M21 5a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zm0 4a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zm0 4a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zm0 4a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zM7 3.6l3.7 3.7a1 1 0 0 1-1.3 1.5h-.1L8 7.3v9.2l1.3-1.3a1 1 0 0 1 1.3 0h.1c.4.4.4 1 0 1.3v.1L7 20.4l-3.7-3.7a1 1 0 0 1 1.3-1.5h.1L6 16.7V7.4L4.7 8.7a1 1 0 0 1-1.3 0h-.1a1 1 0 0 1 0-1.3v-.1L7 3.6z"></path></svg>'
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
commands: {
|
|
144
|
+
setLineHeight: h
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
export {
|
|
148
|
+
N as LineHeightPlugin,
|
|
149
|
+
h as setLineHeight
|
|
150
|
+
};
|
|
151
|
+
//# sourceMappingURL=LineHeightPlugin.native-CM7iXdQj.mjs.map
|