@editora/plugins 1.0.2 → 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 +30 -5
- package/dist/a11y-checker.cjs.js +109 -0
- package/dist/a11y-checker.esm.js +509 -0
- package/dist/anchor.cjs.js +176 -0
- package/dist/anchor.esm.js +400 -0
- package/dist/background-color.cjs.js +218 -0
- package/dist/background-color.esm.js +482 -0
- package/dist/blockquote.cjs.js +1 -0
- package/dist/blockquote.esm.js +47 -0
- package/dist/bold.cjs.js +1 -0
- package/dist/bold.esm.js +44 -0
- package/dist/capitalization.cjs.js +1 -0
- package/dist/capitalization.esm.js +78 -0
- package/dist/checklist.cjs.js +1 -0
- package/dist/checklist.esm.js +305 -0
- package/dist/clear-formatting.cjs.js +1 -0
- package/dist/clear-formatting.esm.js +138 -0
- package/dist/code-sample.cjs.js +161 -0
- package/dist/code-sample.esm.js +381 -0
- package/dist/code.cjs.js +598 -0
- package/dist/code.esm.js +2034 -0
- package/dist/colorSelectionApply-C0iOfMWb.js +1 -0
- package/dist/colorSelectionApply-D8r_gV32.mjs +63 -0
- package/dist/comments.cjs.js +354 -0
- package/dist/comments.esm.js +692 -0
- package/dist/direction.cjs.js +1 -0
- package/dist/direction.esm.js +129 -0
- package/dist/document-manager.cjs.js +1 -0
- package/dist/document-manager.esm.js +6 -0
- package/dist/{documentManager-CYC9totK.mjs → documentManager-DRUc1-Cs.mjs} +3 -3
- package/dist/{documentManager-BGlu3WRB.js → documentManager-_tQQfQi9.js} +3 -3
- package/dist/editorContainerHelpers-C7kdWnS0.mjs +26 -0
- package/dist/editorContainerHelpers-CFbfiOJI.js +1 -0
- package/dist/embed-iframe.cjs.js +361 -0
- package/dist/embed-iframe.esm.js +556 -0
- package/dist/emojis.cjs.js +284 -0
- package/dist/emojis.esm.js +1080 -0
- package/dist/font-family.cjs.js +1 -0
- package/dist/font-family.esm.js +152 -0
- package/dist/font-size.cjs.js +1 -0
- package/dist/font-size.esm.js +278 -0
- package/dist/footnote.cjs.js +85 -0
- package/dist/footnote.esm.js +397 -0
- package/dist/fullscreen.cjs.js +1 -0
- package/dist/fullscreen.esm.js +73 -0
- package/dist/heading.cjs.js +1 -0
- package/dist/heading.esm.js +63 -0
- package/dist/history.cjs.js +1 -0
- package/dist/history.esm.js +246 -0
- package/dist/indent.cjs.js +1 -0
- package/dist/indent.esm.js +146 -0
- package/dist/index-Bskk414V.mjs +145 -0
- package/dist/index-D3pJyAsj.js +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/{index.es-B-to-4j4.js → index.es-Cz1qItab.js} +1 -1
- package/dist/{index.es-BbXJ7tyO.mjs → index.es-DEcRmSTY.mjs} +1 -1
- package/dist/index.esm.js +89 -49
- package/dist/italic.cjs.js +1 -0
- package/dist/italic.esm.js +40 -0
- package/dist/line-height.cjs.js +1 -0
- package/dist/line-height.esm.js +145 -0
- package/dist/link.cjs.js +138 -0
- package/dist/link.esm.js +276 -0
- package/dist/list.cjs.js +1 -0
- package/dist/list.esm.js +102 -0
- package/dist/lite.cjs.js +1 -0
- package/dist/lite.esm.js +61 -0
- package/dist/math.cjs.js +45 -0
- package/dist/math.esm.js +249 -0
- package/dist/media-manager.cjs.js +619 -0
- package/dist/media-manager.esm.js +994 -0
- package/dist/merge-tag.cjs.js +93 -0
- package/dist/merge-tag.esm.js +412 -0
- package/dist/page-break.cjs.js +72 -0
- package/dist/page-break.esm.js +295 -0
- package/dist/plugins.css +1 -1
- package/dist/preview.cjs.js +230 -0
- package/dist/preview.esm.js +321 -0
- package/dist/print.cjs.js +254 -0
- package/dist/print.esm.js +309 -0
- package/dist/purify.es-DHhaBdbu.mjs +470 -0
- package/dist/purify.es-T2a3nLiC.js +3 -0
- package/dist/shared-config.cjs.js +1 -0
- package/dist/shared-config.esm.js +30 -0
- package/dist/special-characters.cjs.js +257 -0
- package/dist/special-characters.esm.js +772 -0
- package/dist/spell-check.cjs.js +512 -0
- package/dist/spell-check.esm.js +1013 -0
- package/dist/strikethrough.cjs.js +1 -0
- package/dist/strikethrough.esm.js +71 -0
- package/dist/table.cjs.js +35 -0
- package/dist/table.esm.js +477 -0
- package/dist/template.cjs.js +356 -0
- package/dist/template.esm.js +560 -0
- package/dist/text-alignment.cjs.js +1 -0
- package/dist/text-alignment.esm.js +105 -0
- package/dist/text-color.cjs.js +300 -0
- package/dist/text-color.esm.js +507 -0
- package/dist/underline.cjs.js +1 -0
- package/dist/underline.esm.js +34 -0
- package/index.d.ts +62 -0
- package/package.json +218 -6
- package/LICENSE +0 -21
- package/dist/index-BbORIHoM.mjs +0 -11763
- package/dist/index-C-OCBS_6.js +0 -3753
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
let c = !1;
|
|
2
|
+
const g = () => {
|
|
3
|
+
if (typeof document > "u") return;
|
|
4
|
+
const r = "rte-preview-plugin-styles";
|
|
5
|
+
if (document.getElementById(r)) return;
|
|
6
|
+
const t = document.createElement("style");
|
|
7
|
+
t.id = r, t.textContent = `
|
|
8
|
+
/* Preview Editor Dialog Styles */
|
|
9
|
+
.rte-preview-editor-overlay {
|
|
10
|
+
position: fixed !important;
|
|
11
|
+
top: 0 !important;
|
|
12
|
+
left: 0 !important;
|
|
13
|
+
right: 0 !important;
|
|
14
|
+
bottom: 0 !important;
|
|
15
|
+
width: 100vw !important;
|
|
16
|
+
height: 100vh !important;
|
|
17
|
+
background-color: rgba(0, 0, 0, 0.6) !important;
|
|
18
|
+
display: flex !important;
|
|
19
|
+
align-items: center !important;
|
|
20
|
+
justify-content: center !important;
|
|
21
|
+
z-index: 10000 !important;
|
|
22
|
+
padding: 20px !important;
|
|
23
|
+
box-sizing: border-box !important;
|
|
24
|
+
margin: 0 !important;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.rte-preview-editor-modal {
|
|
28
|
+
background: white;
|
|
29
|
+
border-radius: 8px;
|
|
30
|
+
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
|
31
|
+
width: 100%;
|
|
32
|
+
max-width: 1200px;
|
|
33
|
+
max-height: 90vh;
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
position: relative;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.rte-preview-editor-header {
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: space-between;
|
|
44
|
+
padding: 16px 20px;
|
|
45
|
+
border-bottom: 1px solid #e1e5e9;
|
|
46
|
+
background: #f8f9fa;
|
|
47
|
+
border-radius: 8px 8px 0 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.rte-preview-editor-header h2 {
|
|
51
|
+
margin: 0;
|
|
52
|
+
font-size: 18px;
|
|
53
|
+
font-weight: 600;
|
|
54
|
+
color: #1a1a1a;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.rte-preview-editor-header-actions {
|
|
58
|
+
display: flex;
|
|
59
|
+
gap: 8px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.rte-preview-editor-close-btn {
|
|
63
|
+
background: none;
|
|
64
|
+
border: none;
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
padding: 4px;
|
|
67
|
+
border-radius: 4px;
|
|
68
|
+
color: #666;
|
|
69
|
+
font-size: 16px;
|
|
70
|
+
line-height: 1;
|
|
71
|
+
transition: all 0.2s ease;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.rte-preview-editor-close-btn:hover {
|
|
75
|
+
background: #e1e5e9;
|
|
76
|
+
color: #1a1a1a;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.rte-preview-editor-body {
|
|
80
|
+
flex: 1;
|
|
81
|
+
overflow: auto;
|
|
82
|
+
display: flex;
|
|
83
|
+
flex-direction: column;
|
|
84
|
+
padding: 25px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.rte-preview-editor-content {
|
|
88
|
+
flex: 1;
|
|
89
|
+
display: flex;
|
|
90
|
+
flex-direction: column;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.rte-preview-editor-light-editor {
|
|
94
|
+
flex: 1;
|
|
95
|
+
overflow: auto;
|
|
96
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
97
|
+
font-size: 16px;
|
|
98
|
+
line-height: 1.6;
|
|
99
|
+
color: #1a1a1a;
|
|
100
|
+
padding: 20px;
|
|
101
|
+
background: #fafafa;
|
|
102
|
+
border: 1px solid #e1e5e9;
|
|
103
|
+
border-radius: 4px;
|
|
104
|
+
min-height: 400px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.rte-preview-editor-light-editor h1,
|
|
108
|
+
.rte-preview-editor-light-editor h2,
|
|
109
|
+
.rte-preview-editor-light-editor h3,
|
|
110
|
+
.rte-preview-editor-light-editor h4,
|
|
111
|
+
.rte-preview-editor-light-editor h5,
|
|
112
|
+
.rte-preview-editor-light-editor h6 {
|
|
113
|
+
margin-top: 1.5em;
|
|
114
|
+
margin-bottom: 0.5em;
|
|
115
|
+
font-weight: 600;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.rte-preview-editor-light-editor h1 {
|
|
119
|
+
font-size: 2em;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.rte-preview-editor-light-editor h2 {
|
|
123
|
+
font-size: 1.5em;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.rte-preview-editor-light-editor h3 {
|
|
127
|
+
font-size: 1.25em;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.rte-preview-editor-light-editor p {
|
|
131
|
+
margin: 1em 0;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.rte-preview-editor-light-editor ul,
|
|
135
|
+
.rte-preview-editor-light-editor ol {
|
|
136
|
+
padding-left: 2em;
|
|
137
|
+
margin: 1em 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.rte-preview-editor-light-editor li {
|
|
141
|
+
margin: 0.5em 0;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.rte-preview-editor-light-editor table {
|
|
145
|
+
border-collapse: collapse;
|
|
146
|
+
width: 100%;
|
|
147
|
+
margin: 1em 0;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.rte-preview-editor-light-editor table td,
|
|
151
|
+
.rte-preview-editor-light-editor table th {
|
|
152
|
+
border: 1px solid #ddd;
|
|
153
|
+
padding: 0.5em;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.rte-preview-editor-light-editor table th {
|
|
157
|
+
background: #f5f5f5;
|
|
158
|
+
font-weight: 600;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.rte-preview-editor-light-editor blockquote {
|
|
162
|
+
border-left: 4px solid #ddd;
|
|
163
|
+
margin: 1em 0;
|
|
164
|
+
padding-left: 1em;
|
|
165
|
+
color: #666;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.rte-preview-editor-light-editor code {
|
|
169
|
+
background: #f5f5f5;
|
|
170
|
+
padding: 2px 6px;
|
|
171
|
+
border-radius: 3px;
|
|
172
|
+
font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
|
|
173
|
+
font-size: 0.9em;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.rte-preview-editor-light-editor pre {
|
|
177
|
+
background: #f5f5f5;
|
|
178
|
+
padding: 1em;
|
|
179
|
+
border-radius: 4px;
|
|
180
|
+
overflow-x: auto;
|
|
181
|
+
margin: 1em 0;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.rte-preview-editor-light-editor pre code {
|
|
185
|
+
background: none;
|
|
186
|
+
padding: 0;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.rte-preview-editor-light-editor img {
|
|
190
|
+
max-width: 100%;
|
|
191
|
+
height: auto;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.rte-preview-editor-light-editor a {
|
|
195
|
+
color: #007acc;
|
|
196
|
+
text-decoration: underline;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.rte-preview-editor-light-editor a:hover {
|
|
200
|
+
color: #0056b3;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/* Responsive design */
|
|
204
|
+
@media (max-width: 768px) {
|
|
205
|
+
.rte-preview-editor-overlay {
|
|
206
|
+
padding: 10px;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.rte-preview-editor-modal {
|
|
210
|
+
max-height: 95vh;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.rte-preview-editor-header {
|
|
214
|
+
padding: 12px 16px;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.rte-preview-editor-body {
|
|
218
|
+
padding: 16px;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.rte-preview-editor-light-editor {
|
|
222
|
+
padding: 12px;
|
|
223
|
+
font-size: 14px;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
`, document.head.appendChild(t);
|
|
227
|
+
}, v = () => {
|
|
228
|
+
const r = window.getSelection();
|
|
229
|
+
if (r && r.rangeCount > 0) {
|
|
230
|
+
let e = r.getRangeAt(0).startContainer;
|
|
231
|
+
for (; e && e !== document.body; ) {
|
|
232
|
+
if (e.nodeType === Node.ELEMENT_NODE) {
|
|
233
|
+
const o = e;
|
|
234
|
+
if (o.getAttribute("contenteditable") === "true")
|
|
235
|
+
return o;
|
|
236
|
+
}
|
|
237
|
+
e = e.parentNode;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
const t = document.activeElement;
|
|
241
|
+
if (t) {
|
|
242
|
+
if (t.getAttribute("contenteditable") === "true")
|
|
243
|
+
return t;
|
|
244
|
+
const e = t.closest('[contenteditable="true"]');
|
|
245
|
+
if (e) return e;
|
|
246
|
+
}
|
|
247
|
+
return document.querySelector('[contenteditable="true"]');
|
|
248
|
+
}, h = () => {
|
|
249
|
+
const r = v();
|
|
250
|
+
if (!r) return "";
|
|
251
|
+
const t = r.cloneNode(!0);
|
|
252
|
+
return [
|
|
253
|
+
".rte-floating-toolbar",
|
|
254
|
+
".rte-selection-marker",
|
|
255
|
+
".rte-toolbar",
|
|
256
|
+
".rte-resize-handle",
|
|
257
|
+
"[data-rte-internal]"
|
|
258
|
+
].forEach((o) => {
|
|
259
|
+
t.querySelectorAll(o).forEach((i) => i.remove());
|
|
260
|
+
}), t.innerHTML;
|
|
261
|
+
}, w = (r) => {
|
|
262
|
+
const t = document.createElement("div");
|
|
263
|
+
return t.innerHTML = r, t.querySelectorAll(
|
|
264
|
+
'script, iframe[src^="javascript:"], object, embed, form[action^="javascript:"]'
|
|
265
|
+
).forEach((i) => i.remove()), t.querySelectorAll("*").forEach((i) => {
|
|
266
|
+
Array.from(i.attributes).forEach((n) => {
|
|
267
|
+
n.name.startsWith("on") && i.removeAttribute(n.name), (n.name === "href" || n.name === "src") && n.value.startsWith("javascript:") && i.removeAttribute(n.name);
|
|
268
|
+
});
|
|
269
|
+
}), t.innerHTML;
|
|
270
|
+
}, u = () => {
|
|
271
|
+
if (typeof window > "u" || c) return;
|
|
272
|
+
c = !0, g();
|
|
273
|
+
const r = h(), t = w(r), e = document.createElement("div");
|
|
274
|
+
e.className = "rte-preview-editor-overlay", e.setAttribute("role", "dialog"), e.setAttribute("aria-modal", "true"), e.setAttribute("aria-labelledby", "preview-editor-title");
|
|
275
|
+
const o = document.createElement("div");
|
|
276
|
+
o.className = "rte-preview-editor-modal";
|
|
277
|
+
const i = document.createElement("div");
|
|
278
|
+
i.className = "rte-preview-editor-header", i.innerHTML = `
|
|
279
|
+
<h2 id="preview-editor-title">Preview Editor</h2>
|
|
280
|
+
<div class="rte-preview-editor-header-actions">
|
|
281
|
+
<button class="rte-preview-editor-close-btn" aria-label="Close preview editor">
|
|
282
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
283
|
+
<line x1="18" y1="6" x2="6" y2="18" />
|
|
284
|
+
<line x1="6" y1="6" x2="18" y2="18" />
|
|
285
|
+
</svg>
|
|
286
|
+
</button>
|
|
287
|
+
</div>
|
|
288
|
+
`;
|
|
289
|
+
const n = document.createElement("div");
|
|
290
|
+
n.className = "rte-preview-editor-body";
|
|
291
|
+
const a = document.createElement("div");
|
|
292
|
+
a.className = "rte-preview-editor-content";
|
|
293
|
+
const l = document.createElement("div");
|
|
294
|
+
l.className = "rte-preview-editor-light-editor", l.innerHTML = t, a.appendChild(l), n.appendChild(a), o.appendChild(i), o.appendChild(n), e.appendChild(o);
|
|
295
|
+
const p = () => {
|
|
296
|
+
e.parentNode && e.parentNode.removeChild(e), c = !1, document.removeEventListener("keydown", s);
|
|
297
|
+
}, s = (d) => {
|
|
298
|
+
d.key === "Escape" && (d.preventDefault(), d.stopPropagation(), p());
|
|
299
|
+
}, m = i.querySelector(".rte-preview-editor-close-btn");
|
|
300
|
+
m && m.addEventListener("click", (d) => {
|
|
301
|
+
d.preventDefault(), d.stopPropagation(), p();
|
|
302
|
+
}), e.addEventListener("click", (d) => {
|
|
303
|
+
d.target === e && p();
|
|
304
|
+
}), document.addEventListener("keydown", s), document.body.appendChild(e);
|
|
305
|
+
}, f = () => ({
|
|
306
|
+
name: "preview",
|
|
307
|
+
toolbar: [
|
|
308
|
+
{
|
|
309
|
+
label: "Preview",
|
|
310
|
+
command: "togglePreview",
|
|
311
|
+
icon: '<svg fill="#000000" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px" viewBox="0 0 92 92" enable-background="new 0 0 92 92" xml:space="preserve"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path id="XMLID_1239_" d="M91.3,43.8C90.6,42.8,74.4,19,46,19C17.6,19,1.4,42.8,0.7,43.8c-0.9,1.3-0.9,3.1,0,4.5 C1.4,49.2,17.6,73,46,73c28.4,0,44.6-23.8,45.3-24.8C92.2,46.9,92.2,45.1,91.3,43.8z M46,65C26.7,65,13.5,51.4,9,46 c4.5-5.5,17.6-19,37-19c19.3,0,32.5,13.6,37,19C78.4,51.5,65.3,65,46,65z M48.3,29.6c-4.4-0.6-8.7,0.5-12.3,3.2c0,0,0,0,0,0 c-7.3,5.5-8.8,15.9-3.3,23.2c2.7,3.6,6.5,5.8,10.9,6.5c0.8,0.1,1.6,0.2,2.3,0.2c3.6,0,7-1.2,9.9-3.3c7.3-5.5,8.8-15.9,3.3-23.2 C56.6,32.5,52.7,30.2,48.3,29.6z M52.3,54.5c-2.2,1.7-5,2.4-7.8,2c-2.8-0.4-5.3-1.9-7-4.1C34.1,47.7,35,41,39.7,37.5 c2.2-1.7,5-2.4,7.8-2c2.8,0.4,5.3,1.9,7,4.1C57.9,44.3,57,51,52.3,54.5z M51.9,40c0.8,0.7,1.2,1.8,1.2,2.8c0,1-0.4,2.1-1.2,2.8 c-0.7,0.7-1.8,1.2-2.8,1.2c-1.1,0-2.1-0.4-2.8-1.2c-0.8-0.8-1.2-1.8-1.2-2.8c0-1.1,0.4-2.1,1.2-2.8c0.7-0.8,1.8-1.2,2.8-1.2 C50.2,38.9,51.2,39.3,51.9,40z"></path> </g></svg>'
|
|
312
|
+
}
|
|
313
|
+
],
|
|
314
|
+
commands: {
|
|
315
|
+
togglePreview: () => (u(), !0)
|
|
316
|
+
},
|
|
317
|
+
keymap: {}
|
|
318
|
+
});
|
|
319
|
+
export {
|
|
320
|
+
f as PreviewPlugin
|
|
321
|
+
};
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=()=>`
|
|
2
|
+
* {
|
|
3
|
+
margin: 0;
|
|
4
|
+
padding: 0;
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
html, body {
|
|
9
|
+
background: white;
|
|
10
|
+
color: black;
|
|
11
|
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
12
|
+
line-height: 1.5;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.rte-print {
|
|
16
|
+
background: white;
|
|
17
|
+
color: black;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* Page break handling */
|
|
21
|
+
.rte-page-break {
|
|
22
|
+
page-break-after: always;
|
|
23
|
+
display: block;
|
|
24
|
+
height: 0;
|
|
25
|
+
margin: 0;
|
|
26
|
+
border: none;
|
|
27
|
+
background: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.rte-page-break::before {
|
|
31
|
+
display: none;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* Code block formatting */
|
|
35
|
+
.rte-code-block,
|
|
36
|
+
pre {
|
|
37
|
+
background: #f5f5f5;
|
|
38
|
+
border: 1px solid #ddd;
|
|
39
|
+
border-radius: 4px;
|
|
40
|
+
padding: 12px;
|
|
41
|
+
margin: 12px 0;
|
|
42
|
+
overflow-x: auto;
|
|
43
|
+
page-break-inside: avoid;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.rte-code-block code,
|
|
47
|
+
pre code {
|
|
48
|
+
font-family: 'Courier New', Courier, monospace;
|
|
49
|
+
font-size: 12px;
|
|
50
|
+
line-height: 1.4;
|
|
51
|
+
white-space: pre-wrap;
|
|
52
|
+
word-break: break-word;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* Footnotes */
|
|
56
|
+
.rte-footnotes {
|
|
57
|
+
border-top: 1px solid #ccc;
|
|
58
|
+
margin-top: 40px;
|
|
59
|
+
padding-top: 12px;
|
|
60
|
+
page-break-inside: avoid;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.rte-footnotes ol {
|
|
64
|
+
margin-left: 20px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.rte-footnotes li {
|
|
68
|
+
margin: 8px 0;
|
|
69
|
+
font-size: 0.9em;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.rte-footnote-ref {
|
|
73
|
+
vertical-align: super;
|
|
74
|
+
font-size: 0.8em;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.rte-footnote-backref {
|
|
78
|
+
margin-left: 4px;
|
|
79
|
+
text-decoration: none;
|
|
80
|
+
color: #666;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* Anchors - preserve IDs but hide visual markers */
|
|
84
|
+
.rte-anchor {
|
|
85
|
+
display: none;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* Lists and tables */
|
|
89
|
+
ul, ol {
|
|
90
|
+
margin: 12px 0;
|
|
91
|
+
padding-left: 40px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
li {
|
|
95
|
+
margin: 4px 0;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
table {
|
|
99
|
+
border-collapse: collapse;
|
|
100
|
+
width: 100%;
|
|
101
|
+
margin: 12px 0;
|
|
102
|
+
page-break-inside: avoid;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
th, td {
|
|
106
|
+
border: 1px solid #ddd;
|
|
107
|
+
padding: 8px;
|
|
108
|
+
text-align: left;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
th {
|
|
112
|
+
background: #f5f5f5;
|
|
113
|
+
font-weight: bold;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* Heading hierarchy */
|
|
117
|
+
h1 {
|
|
118
|
+
font-size: 2em;
|
|
119
|
+
margin: 20px 0 12px;
|
|
120
|
+
page-break-after: avoid;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
h2 {
|
|
124
|
+
font-size: 1.5em;
|
|
125
|
+
margin: 16px 0 10px;
|
|
126
|
+
page-break-after: avoid;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
h3 {
|
|
130
|
+
font-size: 1.25em;
|
|
131
|
+
margin: 14px 0 8px;
|
|
132
|
+
page-break-after: avoid;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
h4 {
|
|
136
|
+
font-size: 1.1em;
|
|
137
|
+
margin: 12px 0 6px;
|
|
138
|
+
page-break-after: avoid;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
h5 {
|
|
142
|
+
font-size: 1em;
|
|
143
|
+
margin: 12px 0 6px;
|
|
144
|
+
page-break-after: avoid;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
h6 {
|
|
148
|
+
font-size: 0.9em;
|
|
149
|
+
margin: 12px 0 6px;
|
|
150
|
+
page-break-after: avoid;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
p {
|
|
154
|
+
margin: 8px 0;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/* Emphasis and strong */
|
|
158
|
+
strong, b {
|
|
159
|
+
font-weight: bold;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
em, i {
|
|
163
|
+
font-style: italic;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
u {
|
|
167
|
+
text-decoration: underline;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/* Block elements */
|
|
171
|
+
blockquote {
|
|
172
|
+
border-left: 4px solid #ddd;
|
|
173
|
+
margin: 12px 0;
|
|
174
|
+
padding-left: 16px;
|
|
175
|
+
color: #666;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
hr {
|
|
179
|
+
border: none;
|
|
180
|
+
border-top: 1px solid #ddd;
|
|
181
|
+
margin: 16px 0;
|
|
182
|
+
page-break-after: avoid;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/* Images */
|
|
186
|
+
img {
|
|
187
|
+
max-width: 100%;
|
|
188
|
+
height: auto;
|
|
189
|
+
page-break-inside: avoid;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/* Links */
|
|
193
|
+
a {
|
|
194
|
+
color: #0066cc;
|
|
195
|
+
text-decoration: underline;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/* Merge tags */
|
|
199
|
+
.rte-merge-tag {
|
|
200
|
+
background-color: #e3f2fd;
|
|
201
|
+
border: 1px solid #bbdefb;
|
|
202
|
+
border-radius: 3px;
|
|
203
|
+
padding: 2px 6px;
|
|
204
|
+
margin: 0 2px;
|
|
205
|
+
display: inline-block;
|
|
206
|
+
white-space: nowrap;
|
|
207
|
+
font-weight: 500;
|
|
208
|
+
color: #1976d2;
|
|
209
|
+
font-size: 0.9em;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/* Hide selection */
|
|
213
|
+
::selection {
|
|
214
|
+
background: transparent;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/* Print-specific rules */
|
|
218
|
+
@media print {
|
|
219
|
+
body {
|
|
220
|
+
margin: 0;
|
|
221
|
+
padding: 0;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.rte-page-break {
|
|
225
|
+
page-break-after: always;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
h1, h2, h3, h4, h5, h6 {
|
|
229
|
+
page-break-after: avoid;
|
|
230
|
+
page-break-inside: avoid;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
table, figure, img, pre {
|
|
234
|
+
page-break-inside: avoid;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
ul, ol, blockquote {
|
|
238
|
+
page-break-inside: avoid;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
`,l=()=>{if(typeof window>"u")return!1;const a=(()=>{const i=window.getSelection();if(i&&i.rangeCount>0){let t=i.getRangeAt(0).startContainer;for(;t&&t!==document.body;){if(t.nodeType===Node.ELEMENT_NODE){const d=t;if(d.getAttribute("contenteditable")==="true")return d}t=t.parentNode}}const n=document.activeElement;if(n){if(n.getAttribute("contenteditable")==="true")return n;const t=n.closest('[contenteditable="true"]');if(t)return t}return document.querySelector('[contenteditable="true"]')})();if(!a)return console.warn("Editor content not found"),!1;const c=a.cloneNode(!0),r=document.createElement("article");r.className="rte-document rte-print",r.appendChild(c);const p=`
|
|
242
|
+
<!DOCTYPE html>
|
|
243
|
+
<html>
|
|
244
|
+
<head>
|
|
245
|
+
<meta charset="UTF-8">
|
|
246
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
247
|
+
<title>Print Document</title>
|
|
248
|
+
<style>${s()}</style>
|
|
249
|
+
</head>
|
|
250
|
+
<body>
|
|
251
|
+
${r.outerHTML}
|
|
252
|
+
</body>
|
|
253
|
+
</html>
|
|
254
|
+
`,e=document.createElement("iframe");e.style.position="absolute",e.style.left="-9999px",e.style.top="-9999px",e.style.width="0",e.style.height="0",document.body.appendChild(e);const o=e.contentDocument||e.contentWindow?.document;return o?(o.open(),o.write(p),o.close(),setTimeout(()=>{e.contentWindow&&(e.contentWindow.print(),setTimeout(()=>{document.body.removeChild(e)},100))},250),!0):(console.error("Could not access print frame document"),document.body.removeChild(e),!1)},g=()=>({name:"print",toolbar:[{label:"Print",command:"print",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>',shortcut:"Mod-p"}],commands:{print:l},keymap:{"Mod-p":()=>(l(),!0)}});exports.PrintPlugin=g;
|