@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,297 @@
|
|
|
1
|
+
const u = '.rte-page-break[data-type="page-break"]', g = ".rte-content, .editora-content";
|
|
2
|
+
let p = null, m = !1;
|
|
3
|
+
const v = /* @__PURE__ */ new Set([
|
|
4
|
+
"DIV",
|
|
5
|
+
"P",
|
|
6
|
+
"BLOCKQUOTE",
|
|
7
|
+
"PRE",
|
|
8
|
+
"H1",
|
|
9
|
+
"H2",
|
|
10
|
+
"H3",
|
|
11
|
+
"H4",
|
|
12
|
+
"H5",
|
|
13
|
+
"H6",
|
|
14
|
+
"LI",
|
|
15
|
+
"TD",
|
|
16
|
+
"TH"
|
|
17
|
+
]), x = () => {
|
|
18
|
+
p || typeof document == "undefined" || (p = document.createElement("style"), p.textContent = `
|
|
19
|
+
.rte-page-break {
|
|
20
|
+
display: block;
|
|
21
|
+
position: relative;
|
|
22
|
+
height: 12px;
|
|
23
|
+
margin: 8px 0;
|
|
24
|
+
background: linear-gradient(90deg, #ccc 0%, transparent 100%);
|
|
25
|
+
border-top: 2px dashed #999;
|
|
26
|
+
border-bottom: none;
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
user-select: none;
|
|
29
|
+
transition: all 0.2s ease;
|
|
30
|
+
outline: none;
|
|
31
|
+
-webkit-user-select: none;
|
|
32
|
+
-moz-user-select: none;
|
|
33
|
+
-ms-user-select: none;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.rte-page-break::before {
|
|
37
|
+
content: '⎙ PAGE BREAK';
|
|
38
|
+
position: absolute;
|
|
39
|
+
top: -12px;
|
|
40
|
+
left: 0;
|
|
41
|
+
font-size: 10px;
|
|
42
|
+
font-weight: bold;
|
|
43
|
+
color: #666;
|
|
44
|
+
background: white;
|
|
45
|
+
padding: 2px 6px;
|
|
46
|
+
letter-spacing: 0.5px;
|
|
47
|
+
opacity: 0.7;
|
|
48
|
+
pointer-events: none;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.rte-page-break:hover {
|
|
52
|
+
background: linear-gradient(90deg, #999 0%, transparent 100%);
|
|
53
|
+
border-top-color: #666;
|
|
54
|
+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.rte-page-break:hover::before {
|
|
58
|
+
opacity: 1;
|
|
59
|
+
color: #333;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.rte-page-break:focus,
|
|
63
|
+
.rte-page-break:focus-visible,
|
|
64
|
+
.rte-page-break-selected {
|
|
65
|
+
outline: 2px solid #0066cc;
|
|
66
|
+
outline-offset: -2px;
|
|
67
|
+
border-top-color: #0066cc;
|
|
68
|
+
background: linear-gradient(90deg, #0066cc 0%, transparent 100%);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.rte-page-break * {
|
|
72
|
+
user-select: none;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@media print {
|
|
76
|
+
.rte-page-break {
|
|
77
|
+
display: block;
|
|
78
|
+
height: 0;
|
|
79
|
+
margin: 0;
|
|
80
|
+
background: none;
|
|
81
|
+
border: none;
|
|
82
|
+
page-break-after: always;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.rte-page-break::before {
|
|
86
|
+
display: none;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
`, document.head.appendChild(p));
|
|
90
|
+
}, N = () => {
|
|
91
|
+
const e = window.getSelection();
|
|
92
|
+
if (!e || e.rangeCount === 0) return null;
|
|
93
|
+
const n = e.getRangeAt(0), t = n.startContainer.nodeType === Node.ELEMENT_NODE ? n.startContainer : n.startContainer.parentElement;
|
|
94
|
+
return (t == null ? void 0 : t.closest(g)) || null;
|
|
95
|
+
}, h = () => {
|
|
96
|
+
const e = N();
|
|
97
|
+
if (e) return e;
|
|
98
|
+
const n = document.activeElement, t = n == null ? void 0 : n.closest(g);
|
|
99
|
+
return t || document.querySelector(g);
|
|
100
|
+
}, C = (e, n) => {
|
|
101
|
+
let t = e;
|
|
102
|
+
for (; t && t !== n; ) {
|
|
103
|
+
if (t.nodeType === Node.ELEMENT_NODE) {
|
|
104
|
+
const r = t;
|
|
105
|
+
if (v.has(r.tagName))
|
|
106
|
+
return r;
|
|
107
|
+
}
|
|
108
|
+
t = t.parentNode;
|
|
109
|
+
}
|
|
110
|
+
return null;
|
|
111
|
+
}, w = () => {
|
|
112
|
+
const e = document.createElement("div");
|
|
113
|
+
return e.className = "rte-page-break", e.setAttribute("data-page-break", "true"), e.setAttribute("data-type", "page-break"), e.setAttribute("contenteditable", "false"), e.setAttribute("tabindex", "0"), e.setAttribute("role", "separator"), e.setAttribute("aria-label", "Page break"), e;
|
|
114
|
+
}, S = (e) => {
|
|
115
|
+
let n = e.nextElementSibling;
|
|
116
|
+
for (; n && n.matches(u); ) {
|
|
117
|
+
const r = n;
|
|
118
|
+
n = n.nextElementSibling, r.remove();
|
|
119
|
+
}
|
|
120
|
+
let t = e.previousElementSibling;
|
|
121
|
+
for (; t && t.matches(u); ) {
|
|
122
|
+
const r = t;
|
|
123
|
+
t = t.previousElementSibling, r.remove();
|
|
124
|
+
}
|
|
125
|
+
}, k = (e) => {
|
|
126
|
+
var r;
|
|
127
|
+
const n = e.nextElementSibling;
|
|
128
|
+
if (n && !n.matches(u))
|
|
129
|
+
return n;
|
|
130
|
+
const t = document.createElement("p");
|
|
131
|
+
return t.innerHTML = "<br>", (r = e.parentNode) == null || r.insertBefore(t, e.nextSibling), t;
|
|
132
|
+
}, d = (e) => {
|
|
133
|
+
const n = window.getSelection();
|
|
134
|
+
if (!n) return;
|
|
135
|
+
const t = document.createRange();
|
|
136
|
+
e.nodeType, Node.TEXT_NODE, t.setStart(e, 0), t.collapse(!0), n.removeAllRanges(), n.addRange(t);
|
|
137
|
+
}, b = (e) => {
|
|
138
|
+
const n = window.getSelection();
|
|
139
|
+
if (!n) return;
|
|
140
|
+
const t = document.createRange();
|
|
141
|
+
if (e.nodeType === Node.TEXT_NODE) {
|
|
142
|
+
const r = e;
|
|
143
|
+
t.setStart(r, r.data.length);
|
|
144
|
+
} else
|
|
145
|
+
t.selectNodeContents(e), t.collapse(!1);
|
|
146
|
+
n.removeAllRanges(), n.addRange(t);
|
|
147
|
+
}, f = (e, n) => {
|
|
148
|
+
let t = e;
|
|
149
|
+
for (; t; ) {
|
|
150
|
+
if (!(t instanceof HTMLElement && t.matches(u)))
|
|
151
|
+
return t;
|
|
152
|
+
t = n === "previous" ? t.previousSibling : t.nextSibling;
|
|
153
|
+
}
|
|
154
|
+
return null;
|
|
155
|
+
}, A = (e) => {
|
|
156
|
+
const n = window.getSelection();
|
|
157
|
+
if (!n || !e.parentNode) return;
|
|
158
|
+
const t = e.parentNode, r = Array.from(t.childNodes).indexOf(e);
|
|
159
|
+
if (r < 0) return;
|
|
160
|
+
const o = document.createRange();
|
|
161
|
+
o.setStart(t, r), o.setEnd(t, r + 1), n.removeAllRanges(), n.addRange(o), e.focus({ preventScroll: !0 });
|
|
162
|
+
}, L = (e) => {
|
|
163
|
+
if (e.collapsed || e.startContainer !== e.endContainer || e.endOffset !== e.startOffset + 1 || !(e.startContainer instanceof Element || e.startContainer instanceof DocumentFragment)) return null;
|
|
164
|
+
const n = e.startContainer.childNodes[e.startOffset];
|
|
165
|
+
return n instanceof HTMLElement && n.matches(u) ? n : null;
|
|
166
|
+
}, T = (e, n, t) => {
|
|
167
|
+
if (!e.collapsed) return null;
|
|
168
|
+
const { startContainer: r, startOffset: o } = e, i = (a) => a instanceof HTMLElement && a.matches(u) ? a : null, s = (a) => {
|
|
169
|
+
if (r.nodeType === Node.ELEMENT_NODE) {
|
|
170
|
+
const c = r;
|
|
171
|
+
if (a === "previous") {
|
|
172
|
+
if (o > 0)
|
|
173
|
+
return c.childNodes[o - 1] || null;
|
|
174
|
+
} else if (o < c.childNodes.length)
|
|
175
|
+
return c.childNodes[o] || null;
|
|
176
|
+
}
|
|
177
|
+
if (r.nodeType === Node.TEXT_NODE && (a === "previous" && o < r.data.length || a === "next" && o > 0))
|
|
178
|
+
return null;
|
|
179
|
+
let l = r;
|
|
180
|
+
for (; l && l !== n; ) {
|
|
181
|
+
const c = a === "previous" ? l.previousSibling : l.nextSibling;
|
|
182
|
+
if (c) return c;
|
|
183
|
+
l = l.parentNode;
|
|
184
|
+
}
|
|
185
|
+
return null;
|
|
186
|
+
};
|
|
187
|
+
if (r.nodeType === Node.ELEMENT_NODE) {
|
|
188
|
+
const a = r;
|
|
189
|
+
return t === "Backspace" && o > 0 ? i(a.childNodes[o - 1] || null) : t === "Delete" ? i(a.childNodes[o] || null) : null;
|
|
190
|
+
}
|
|
191
|
+
if (r.nodeType === Node.TEXT_NODE) {
|
|
192
|
+
const a = r;
|
|
193
|
+
if (t === "Backspace" && o === 0) {
|
|
194
|
+
const l = i(a.previousSibling);
|
|
195
|
+
return l || i(s("previous"));
|
|
196
|
+
}
|
|
197
|
+
if (t === "Delete" && o === a.data.length) {
|
|
198
|
+
const l = i(a.nextSibling);
|
|
199
|
+
return l || i(s("next"));
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return i(s(t === "Backspace" ? "previous" : "next"));
|
|
203
|
+
}, E = (e, n) => {
|
|
204
|
+
const t = e.closest(g), r = e.previousSibling, o = e.nextSibling;
|
|
205
|
+
e.remove();
|
|
206
|
+
const i = f(r, "previous"), s = f(o, "next");
|
|
207
|
+
if (n === "Backspace") {
|
|
208
|
+
if (i)
|
|
209
|
+
b(i);
|
|
210
|
+
else if (s)
|
|
211
|
+
d(s);
|
|
212
|
+
else if (t) {
|
|
213
|
+
const a = document.createElement("p");
|
|
214
|
+
a.innerHTML = "<br>", t.appendChild(a), d(a);
|
|
215
|
+
}
|
|
216
|
+
} else if (s)
|
|
217
|
+
d(s);
|
|
218
|
+
else if (i)
|
|
219
|
+
b(i);
|
|
220
|
+
else if (t) {
|
|
221
|
+
const a = document.createElement("p");
|
|
222
|
+
a.innerHTML = "<br>", t.appendChild(a), d(a);
|
|
223
|
+
}
|
|
224
|
+
return t && t.dispatchEvent(new Event("input", { bubbles: !0 })), !0;
|
|
225
|
+
}, R = () => {
|
|
226
|
+
const e = h();
|
|
227
|
+
if (!e) return !1;
|
|
228
|
+
const n = window.getSelection();
|
|
229
|
+
if (!n) return !1;
|
|
230
|
+
let t;
|
|
231
|
+
n.rangeCount > 0 && e.contains(n.getRangeAt(0).commonAncestorContainer) ? t = n.getRangeAt(0) : (t = document.createRange(), t.selectNodeContents(e), t.collapse(!1), n.removeAllRanges(), n.addRange(t));
|
|
232
|
+
const r = C(t.endContainer, e) || C(t.startContainer, e), o = w();
|
|
233
|
+
r && r.parentNode ? r.parentNode.insertBefore(o, r.nextSibling) : e.appendChild(o), S(o);
|
|
234
|
+
const i = k(o);
|
|
235
|
+
return d(i), e.dispatchEvent(new Event("input", { bubbles: !0 })), !0;
|
|
236
|
+
}, B = () => {
|
|
237
|
+
m || typeof document == "undefined" || (m = !0, document.addEventListener("click", (e) => {
|
|
238
|
+
const n = e.target, t = n == null ? void 0 : n.closest(u);
|
|
239
|
+
t && (e.preventDefault(), e.stopPropagation(), A(t));
|
|
240
|
+
}), document.addEventListener("keydown", (e) => {
|
|
241
|
+
const n = e.key;
|
|
242
|
+
if (!["Backspace", "Delete", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(n))
|
|
243
|
+
return;
|
|
244
|
+
const t = window.getSelection();
|
|
245
|
+
if (!t || t.rangeCount === 0) return;
|
|
246
|
+
const r = t.getRangeAt(0), o = h();
|
|
247
|
+
if (!o || !o.contains(r.commonAncestorContainer)) return;
|
|
248
|
+
const i = L(r);
|
|
249
|
+
if (i) {
|
|
250
|
+
if (n === "Backspace" || n === "Delete") {
|
|
251
|
+
e.preventDefault(), e.stopPropagation(), E(i, n);
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
if (n === "ArrowRight" || n === "ArrowDown") {
|
|
255
|
+
e.preventDefault();
|
|
256
|
+
const s = f(i.nextSibling, "next") || k(i);
|
|
257
|
+
d(s);
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (n === "ArrowLeft" || n === "ArrowUp") {
|
|
261
|
+
e.preventDefault();
|
|
262
|
+
const s = f(i.previousSibling, "previous");
|
|
263
|
+
s ? b(s) : d(o);
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
if (n === "Backspace" || n === "Delete") {
|
|
268
|
+
const s = T(
|
|
269
|
+
r,
|
|
270
|
+
o,
|
|
271
|
+
n
|
|
272
|
+
);
|
|
273
|
+
if (!s) return;
|
|
274
|
+
e.preventDefault(), e.stopPropagation(), E(s, n);
|
|
275
|
+
}
|
|
276
|
+
}));
|
|
277
|
+
}, D = () => (x(), B(), {
|
|
278
|
+
name: "pageBreak",
|
|
279
|
+
toolbar: [
|
|
280
|
+
{
|
|
281
|
+
label: "Page Break",
|
|
282
|
+
command: "insertPageBreak",
|
|
283
|
+
icon: '<svg fill="#000000" width="24px" height="24px" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"><path d="M1,6 L3,6 C3.55228475,6 4,6.44771525 4,7 C4,7.55228475 3.55228475,8 3,8 L1,8 C0.44771525,8 0,7.55228475 0,7 C0,6.44771525 0.44771525,6 1,6 Z M11,6 L13,6 C13.5522847,6 14,6.44771525 14,7 C14,7.55228475 13.5522847,8 13,8 L11,8 C10.4477153,8 10,7.55228475 10,7 C10,6.44771525 10.4477153,6 11,6 Z M6,6 L8,6 C8.55228475,6 9,6.44771525 9,7 C9,7.55228475 8.55228475,8 8,8 L6,8 C5.44771525,8 5,7.55228475 5,7 C5,6.44771525 5.44771525,6 6,6 Z M0,1 C0,0.44771525 0.44771525,-2.26485497e-13 1,-2.26485497e-13 C1.55228475,-2.26485497e-13 2,0.44771525 2,1 L2,3.0142458 L12,3.0142458 L12,1 C12,0.44771525 12.4477153,-2.26485497e-13 13,-2.26485497e-13 C13.5522847,-2.26485497e-13 14,0.44771525 14,1 L14,3.0142458 C14,4.1188153 13.1045695,5.0142458 12,5.0142458 L2,5.0142458 C0.8954305,5.0142458 0,4.1188153 0,3.0142458 L0,1 Z M0,13.0142458 L0,11 C0,9.8954305 0.8954305,9 2,9 L12,9 C13.1045695,9 14,9.8954305 14,11 L14,13.0142458 C14,13.5665305 13.5522847,14.0142458 13,14.0142458 C12.4477153,14.0142458 12,13.5665305 12,13.0142458 L12,11 L2,11 L2,13.0142458 C2,13.5665305 1.55228475,14.0142458 1,14.0142458 C0.44771525,14.0142458 0,13.5665305 0,13.0142458 Z"></path></g></svg>',
|
|
284
|
+
shortcut: "Mod-Enter"
|
|
285
|
+
}
|
|
286
|
+
],
|
|
287
|
+
commands: {
|
|
288
|
+
insertPageBreak: R
|
|
289
|
+
},
|
|
290
|
+
keymap: {
|
|
291
|
+
"Mod-Enter": "insertPageBreak"
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
export {
|
|
295
|
+
D as PageBreakPlugin
|
|
296
|
+
};
|
|
297
|
+
//# sourceMappingURL=PageBreakPlugin.native-CGiQxXqR.mjs.map
|
|
@@ -254,19 +254,19 @@ const g = () => `
|
|
|
254
254
|
t = t.parentNode;
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
|
-
const
|
|
258
|
-
if (
|
|
259
|
-
if (
|
|
260
|
-
return
|
|
261
|
-
const t =
|
|
257
|
+
const n = document.activeElement;
|
|
258
|
+
if (n) {
|
|
259
|
+
if (n.getAttribute("contenteditable") === "true")
|
|
260
|
+
return n;
|
|
261
|
+
const t = n.closest('[contenteditable="true"]');
|
|
262
262
|
if (t) return t;
|
|
263
263
|
}
|
|
264
264
|
return document.querySelector('[contenteditable="true"]');
|
|
265
265
|
})();
|
|
266
266
|
if (!a)
|
|
267
267
|
return console.warn("Editor content not found"), !1;
|
|
268
|
-
const c = a.cloneNode(!0),
|
|
269
|
-
|
|
268
|
+
const c = a.cloneNode(!0), r = document.createElement("article");
|
|
269
|
+
r.className = "rte-document rte-print", r.appendChild(c);
|
|
270
270
|
const s = `
|
|
271
271
|
<!DOCTYPE html>
|
|
272
272
|
<html>
|
|
@@ -277,7 +277,7 @@ const g = () => `
|
|
|
277
277
|
<style>${g()}</style>
|
|
278
278
|
</head>
|
|
279
279
|
<body>
|
|
280
|
-
${
|
|
280
|
+
${r.outerHTML}
|
|
281
281
|
</body>
|
|
282
282
|
</html>
|
|
283
283
|
`, e = document.createElement("iframe");
|
|
@@ -294,7 +294,7 @@ const g = () => `
|
|
|
294
294
|
{
|
|
295
295
|
label: "Print",
|
|
296
296
|
command: "print",
|
|
297
|
-
icon: '<svg width="
|
|
297
|
+
icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M7 9V4h10v5M6 18h12v-4H6v4Zm0 0v2h12v-2M6 9H5a2 2 0 0 0-2 2v3h3m12-5h1a2 2 0 0 1 2 2v3h-3" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>',
|
|
298
298
|
shortcut: "Mod-p"
|
|
299
299
|
}
|
|
300
300
|
],
|
|
@@ -308,4 +308,4 @@ const g = () => `
|
|
|
308
308
|
export {
|
|
309
309
|
b as PrintPlugin
|
|
310
310
|
};
|
|
311
|
-
//# sourceMappingURL=PrintPlugin.native-
|
|
311
|
+
//# sourceMappingURL=PrintPlugin.native-7qt5v7L5.mjs.map
|