@editora/core 1.0.1 → 1.0.2
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 +9 -0
- package/dist/A11yCheckerPlugin.native-CZKpi3uF.mjs +475 -0
- package/dist/A11yCheckerPlugin.native-CZKpi3uF.mjs.map +1 -0
- package/dist/AnchorPlugin.native-7es9PVZ9.mjs +340 -0
- package/dist/AnchorPlugin.native-7es9PVZ9.mjs.map +1 -0
- package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs +449 -0
- package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs.map +1 -0
- package/dist/BlockquotePlugin.native-JFmOLsxN.mjs +48 -0
- package/dist/BlockquotePlugin.native-JFmOLsxN.mjs.map +1 -0
- package/dist/BoldPlugin.native-BAzzoqU5.mjs +45 -0
- package/dist/BoldPlugin.native-BAzzoqU5.mjs.map +1 -0
- package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs +79 -0
- package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs.map +1 -0
- package/dist/ChecklistPlugin.native-Dccs3nLe.mjs +153 -0
- package/dist/ChecklistPlugin.native-Dccs3nLe.mjs.map +1 -0
- package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs +27 -0
- package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs.map +1 -0
- package/dist/CodePlugin.native-DD9xFIid.mjs +1679 -0
- package/dist/CodePlugin.native-DD9xFIid.mjs.map +1 -0
- package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs +326 -0
- package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs.map +1 -0
- package/dist/CommentsPlugin.native-2zQV8Ia4.mjs +473 -0
- package/dist/CommentsPlugin.native-2zQV8Ia4.mjs.map +1 -0
- package/dist/DirectionPlugin.native-Be7wCzkI.mjs +59 -0
- package/dist/DirectionPlugin.native-Be7wCzkI.mjs.map +1 -0
- package/dist/DocumentManagerPlugin.native-BvZL5CSG.mjs +116 -0
- package/dist/DocumentManagerPlugin.native-BvZL5CSG.mjs.map +1 -0
- package/dist/EmbedIframePlugin.native-ifr9KLdN.mjs +461 -0
- package/dist/EmbedIframePlugin.native-ifr9KLdN.mjs.map +1 -0
- package/dist/EmojisPlugin.native-D6mJSnSR.mjs +1033 -0
- package/dist/EmojisPlugin.native-D6mJSnSR.mjs.map +1 -0
- package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs +106 -0
- package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs.map +1 -0
- package/dist/FontSizePlugin.native-DkLMLPue.mjs +186 -0
- package/dist/FontSizePlugin.native-DkLMLPue.mjs.map +1 -0
- package/dist/FootnotePlugin.native-BciVc9W6.mjs +128 -0
- package/dist/FootnotePlugin.native-BciVc9W6.mjs.map +1 -0
- package/dist/FullscreenPlugin.native-ChXyxeNw.mjs +77 -0
- package/dist/FullscreenPlugin.native-ChXyxeNw.mjs.map +1 -0
- package/dist/HeadingPlugin.native-DrLYwQnQ.mjs +64 -0
- package/dist/HeadingPlugin.native-DrLYwQnQ.mjs.map +1 -0
- package/dist/HistoryPlugin.native-DoDRifCf.mjs +89 -0
- package/dist/HistoryPlugin.native-DoDRifCf.mjs.map +1 -0
- package/dist/IndentPlugin.native-CbFugPoi.mjs +133 -0
- package/dist/IndentPlugin.native-CbFugPoi.mjs.map +1 -0
- package/dist/ItalicPlugin.native-CQjjDyUL.mjs +43 -0
- package/dist/ItalicPlugin.native-CQjjDyUL.mjs.map +1 -0
- package/dist/LineHeightPlugin.native-CWQT2FIa.mjs +73 -0
- package/dist/LineHeightPlugin.native-CWQT2FIa.mjs.map +1 -0
- package/dist/LinkPlugin.native-BdAOV-iu.mjs +206 -0
- package/dist/LinkPlugin.native-BdAOV-iu.mjs.map +1 -0
- package/dist/ListPlugin.native-CLFU5AUQ.mjs +59 -0
- package/dist/ListPlugin.native-CLFU5AUQ.mjs.map +1 -0
- package/dist/MathPlugin.native-DE_ii-LA.mjs +182 -0
- package/dist/MathPlugin.native-DE_ii-LA.mjs.map +1 -0
- package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs +533 -0
- package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs.map +1 -0
- package/dist/MergeTagPlugin.native-CrxyThyn.mjs +178 -0
- package/dist/MergeTagPlugin.native-CrxyThyn.mjs.map +1 -0
- package/dist/PageBreakPlugin.native-DDjcDyRW.mjs +172 -0
- package/dist/PageBreakPlugin.native-DDjcDyRW.mjs.map +1 -0
- package/dist/PreviewPlugin.native-DBvfpmIv.mjs +322 -0
- package/dist/PreviewPlugin.native-DBvfpmIv.mjs.map +1 -0
- package/dist/PrintPlugin.native-BUpm52VJ.mjs +311 -0
- package/dist/PrintPlugin.native-BUpm52VJ.mjs.map +1 -0
- package/dist/SpecialCharactersPlugin.native-x7a2SWXc.mjs +731 -0
- package/dist/SpecialCharactersPlugin.native-x7a2SWXc.mjs.map +1 -0
- package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs +465 -0
- package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs.map +1 -0
- package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs +43 -0
- package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs.map +1 -0
- package/dist/TablePlugin.native-EEWXn1-s.mjs +491 -0
- package/dist/TablePlugin.native-EEWXn1-s.mjs.map +1 -0
- package/dist/TemplatePlugin.native-BlSn1c9h.mjs +564 -0
- package/dist/TemplatePlugin.native-BlSn1c9h.mjs.map +1 -0
- package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs +97 -0
- package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs.map +1 -0
- package/dist/TextColorPlugin.native-D6SmTglm.mjs +432 -0
- package/dist/TextColorPlugin.native-D6SmTglm.mjs.map +1 -0
- package/dist/UnderlinePlugin.native-QpIcK4L2.mjs +35 -0
- package/dist/UnderlinePlugin.native-QpIcK4L2.mjs.map +1 -0
- package/dist/documentManager-irzj9n3V.mjs +37627 -0
- package/dist/documentManager-irzj9n3V.mjs.map +1 -0
- package/dist/editorContainerHelpers-C7kdWnS0.mjs +27 -0
- package/dist/editorContainerHelpers-C7kdWnS0.mjs.map +1 -0
- package/dist/editora.min.js +14 -12
- package/dist/editora.min.js.map +1 -1
- package/dist/editora.umd.js +14 -12
- package/dist/editora.umd.js.map +1 -1
- package/dist/index-BF5RBhL9.js +4 -0
- package/dist/index-BF5RBhL9.js.map +1 -0
- package/dist/{index-BS4zT-KN.mjs → index-BPsf460l.mjs} +286 -162
- package/dist/index-BPsf460l.mjs.map +1 -0
- package/dist/index.cjs.js +3 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es-CuicffkQ.mjs +6665 -0
- package/dist/index.es-CuicffkQ.mjs.map +1 -0
- package/dist/index.esm.js +117 -112
- package/dist/index.esm.js.map +1 -1
- package/dist/plugin-loader.js +55 -0
- package/dist/plugin-loader.js.map +1 -0
- package/dist/purify.es-CKpwg8Tk.mjs +471 -0
- package/dist/purify.es-CKpwg8Tk.mjs.map +1 -0
- package/dist/webcomponent-core.js +1243 -0
- package/dist/webcomponent-core.js.map +1 -0
- package/dist/webcomponent-core.min.css +1 -0
- package/dist/webcomponent-core.min.js +597 -0
- package/dist/webcomponent-core.min.js.map +1 -0
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +3 -3
- package/dist/webcomponent.js +1286 -0
- package/dist/webcomponent.js.map +1 -0
- package/dist/webcomponent.min.css +1 -0
- package/dist/webcomponent.min.js +337 -334
- package/dist/webcomponent.min.js.map +1 -1
- package/package.json +16 -4
- package/dist/index-BK2lHfHK.js +0 -2
- package/dist/index-BK2lHfHK.js.map +0 -1
- package/dist/index-BS4zT-KN.mjs.map +0 -1
- package/dist/webcomponent.umd.js +0 -4073
- package/dist/webcomponent.umd.js.map +0 -1
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
let c = !1;
|
|
2
|
+
const g = () => {
|
|
3
|
+
if (typeof document == "undefined") 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 == "undefined" || 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
|
+
};
|
|
322
|
+
//# sourceMappingURL=PreviewPlugin.native-DBvfpmIv.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreviewPlugin.native-DBvfpmIv.mjs","sources":["../../plugins/preview/src/PreviewPlugin.native.ts"],"sourcesContent":["import { Plugin } from '@editora/core';\n\n/**\n * Preview Plugin - Native Implementation\n * \n * Features:\n * - In-page modal preview dialog\n * - Read-only content display\n * - Clean, sanitized HTML output\n * - Responsive design\n * - Escape key to close\n */\n\n// Module-level flag to prevent multiple dialogs\nlet isPreviewDialogOpen = false;\n\n/**\n * Inject preview dialog styles into document head\n */\nconst injectStyles = (): void => {\n if (typeof document === 'undefined') return;\n \n const styleId = 'rte-preview-plugin-styles';\n if (document.getElementById(styleId)) return;\n \n const style = document.createElement('style');\n style.id = styleId;\n style.textContent = `\n /* Preview Editor Dialog Styles */\n .rte-preview-editor-overlay {\n position: fixed !important;\n top: 0 !important;\n left: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n width: 100vw !important;\n height: 100vh !important;\n background-color: rgba(0, 0, 0, 0.6) !important;\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n z-index: 10000 !important;\n padding: 20px !important;\n box-sizing: border-box !important;\n margin: 0 !important;\n }\n\n .rte-preview-editor-modal {\n background: white;\n border-radius: 8px;\n box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);\n width: 100%;\n max-width: 1200px;\n max-height: 90vh;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n position: relative;\n }\n\n .rte-preview-editor-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 16px 20px;\n border-bottom: 1px solid #e1e5e9;\n background: #f8f9fa;\n border-radius: 8px 8px 0 0;\n }\n\n .rte-preview-editor-header h2 {\n margin: 0;\n font-size: 18px;\n font-weight: 600;\n color: #1a1a1a;\n }\n\n .rte-preview-editor-header-actions {\n display: flex;\n gap: 8px;\n }\n\n .rte-preview-editor-close-btn {\n background: none;\n border: none;\n cursor: pointer;\n padding: 4px;\n border-radius: 4px;\n color: #666;\n font-size: 16px;\n line-height: 1;\n transition: all 0.2s ease;\n }\n\n .rte-preview-editor-close-btn:hover {\n background: #e1e5e9;\n color: #1a1a1a;\n }\n\n .rte-preview-editor-body {\n flex: 1;\n overflow: auto;\n display: flex;\n flex-direction: column;\n padding: 25px;\n }\n\n .rte-preview-editor-content {\n flex: 1;\n display: flex;\n flex-direction: column;\n }\n\n .rte-preview-editor-light-editor {\n flex: 1;\n overflow: auto;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;\n font-size: 16px;\n line-height: 1.6;\n color: #1a1a1a;\n padding: 20px;\n background: #fafafa;\n border: 1px solid #e1e5e9;\n border-radius: 4px;\n min-height: 400px;\n }\n\n .rte-preview-editor-light-editor h1,\n .rte-preview-editor-light-editor h2,\n .rte-preview-editor-light-editor h3,\n .rte-preview-editor-light-editor h4,\n .rte-preview-editor-light-editor h5,\n .rte-preview-editor-light-editor h6 {\n margin-top: 1.5em;\n margin-bottom: 0.5em;\n font-weight: 600;\n }\n\n .rte-preview-editor-light-editor h1 {\n font-size: 2em;\n }\n\n .rte-preview-editor-light-editor h2 {\n font-size: 1.5em;\n }\n\n .rte-preview-editor-light-editor h3 {\n font-size: 1.25em;\n }\n\n .rte-preview-editor-light-editor p {\n margin: 1em 0;\n }\n\n .rte-preview-editor-light-editor ul,\n .rte-preview-editor-light-editor ol {\n padding-left: 2em;\n margin: 1em 0;\n }\n\n .rte-preview-editor-light-editor li {\n margin: 0.5em 0;\n }\n\n .rte-preview-editor-light-editor table {\n border-collapse: collapse;\n width: 100%;\n margin: 1em 0;\n }\n\n .rte-preview-editor-light-editor table td,\n .rte-preview-editor-light-editor table th {\n border: 1px solid #ddd;\n padding: 0.5em;\n }\n\n .rte-preview-editor-light-editor table th {\n background: #f5f5f5;\n font-weight: 600;\n }\n\n .rte-preview-editor-light-editor blockquote {\n border-left: 4px solid #ddd;\n margin: 1em 0;\n padding-left: 1em;\n color: #666;\n }\n\n .rte-preview-editor-light-editor code {\n background: #f5f5f5;\n padding: 2px 6px;\n border-radius: 3px;\n font-family: 'Monaco', 'Menlo', 'Courier New', monospace;\n font-size: 0.9em;\n }\n\n .rte-preview-editor-light-editor pre {\n background: #f5f5f5;\n padding: 1em;\n border-radius: 4px;\n overflow-x: auto;\n margin: 1em 0;\n }\n\n .rte-preview-editor-light-editor pre code {\n background: none;\n padding: 0;\n }\n\n .rte-preview-editor-light-editor img {\n max-width: 100%;\n height: auto;\n }\n\n .rte-preview-editor-light-editor a {\n color: #007acc;\n text-decoration: underline;\n }\n\n .rte-preview-editor-light-editor a:hover {\n color: #0056b3;\n }\n\n /* Responsive design */\n @media (max-width: 768px) {\n .rte-preview-editor-overlay {\n padding: 10px;\n }\n\n .rte-preview-editor-modal {\n max-height: 95vh;\n }\n\n .rte-preview-editor-header {\n padding: 12px 16px;\n }\n\n .rte-preview-editor-body {\n padding: 16px;\n }\n\n .rte-preview-editor-light-editor {\n padding: 12px;\n font-size: 14px;\n }\n }\n `;\n \n document.head.appendChild(style);\n};\n\n/**\n * Find the active editor based on current selection or focus\n */\nconst findActiveEditor = (): HTMLElement | null => {\n // Try to find editor from current selection\n const selection = window.getSelection();\n if (selection && selection.rangeCount > 0) {\n let node: Node | null = selection.getRangeAt(0).startContainer;\n while (node && node !== document.body) {\n if (node.nodeType === Node.ELEMENT_NODE) {\n const element = node as HTMLElement;\n if (element.getAttribute('contenteditable') === 'true') {\n return element;\n }\n }\n node = node.parentNode;\n }\n }\n \n // Try to find focused editor\n const activeElement = document.activeElement;\n if (activeElement) {\n if (activeElement.getAttribute('contenteditable') === 'true') {\n return activeElement as HTMLElement;\n }\n const editor = activeElement.closest('[contenteditable=\"true\"]');\n if (editor) return editor as HTMLElement;\n }\n \n // Fallback to first editor\n return document.querySelector('[contenteditable=\"true\"]');\n};\n\n/**\n * Serialize editor content to clean HTML\n */\nconst serializeEditorContent = (): string => {\n const editorElement = findActiveEditor();\n if (!editorElement) return '';\n\n // Clone the content to avoid modifying the original\n const clonedContent = editorElement.cloneNode(true) as HTMLElement;\n\n // Remove RTE-specific elements that shouldn't be in the preview\n const elementsToRemove = [\n '.rte-floating-toolbar',\n '.rte-selection-marker',\n '.rte-toolbar',\n '.rte-resize-handle',\n '[data-rte-internal]'\n ];\n \n elementsToRemove.forEach(selector => {\n clonedContent.querySelectorAll(selector).forEach(el => el.remove());\n });\n\n // Return the clean HTML\n return clonedContent.innerHTML;\n};\n\n/**\n * Sanitize HTML to prevent XSS attacks\n */\nconst sanitizeHTML = (html: string): string => {\n const tempDiv = document.createElement('div');\n tempDiv.innerHTML = html;\n\n // Remove dangerous elements\n const dangerousElements = tempDiv.querySelectorAll(\n 'script, iframe[src^=\"javascript:\"], object, embed, form[action^=\"javascript:\"]'\n );\n dangerousElements.forEach(el => el.remove());\n\n // Remove dangerous attributes\n const allElements = tempDiv.querySelectorAll('*');\n allElements.forEach(el => {\n // Remove event handlers (onclick, onload, etc.)\n Array.from(el.attributes).forEach(attr => {\n if (attr.name.startsWith('on')) {\n el.removeAttribute(attr.name);\n }\n // Remove javascript: URLs\n if ((attr.name === 'href' || attr.name === 'src') && \n attr.value.startsWith('javascript:')) {\n el.removeAttribute(attr.name);\n }\n });\n });\n\n return tempDiv.innerHTML;\n};\n\n/**\n * Show the preview dialog\n */\nconst showPreviewDialog = (): void => {\n if (typeof window === 'undefined' || isPreviewDialogOpen) return;\n \n isPreviewDialogOpen = true;\n injectStyles();\n\n // Serialize and sanitize content\n const rawHtml = serializeEditorContent();\n const cleanHtml = sanitizeHTML(rawHtml);\n\n // Create dialog overlay\n const overlay = document.createElement('div');\n overlay.className = 'rte-preview-editor-overlay';\n overlay.setAttribute('role', 'dialog');\n overlay.setAttribute('aria-modal', 'true');\n overlay.setAttribute('aria-labelledby', 'preview-editor-title');\n\n // Create modal\n const modal = document.createElement('div');\n modal.className = 'rte-preview-editor-modal';\n\n // Create header\n const header = document.createElement('div');\n header.className = 'rte-preview-editor-header';\n header.innerHTML = `\n <h2 id=\"preview-editor-title\">Preview Editor</h2>\n <div class=\"rte-preview-editor-header-actions\">\n <button class=\"rte-preview-editor-close-btn\" aria-label=\"Close preview editor\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\">\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n </button>\n </div>\n `;\n\n // Create body\n const body = document.createElement('div');\n body.className = 'rte-preview-editor-body';\n\n const content = document.createElement('div');\n content.className = 'rte-preview-editor-content';\n\n const editor = document.createElement('div');\n editor.className = 'rte-preview-editor-light-editor';\n editor.innerHTML = cleanHtml;\n\n content.appendChild(editor);\n body.appendChild(content);\n\n // Assemble modal\n modal.appendChild(header);\n modal.appendChild(body);\n overlay.appendChild(modal);\n\n // Close dialog function\n const closeDialog = () => {\n if (overlay.parentNode) {\n overlay.parentNode.removeChild(overlay);\n }\n isPreviewDialogOpen = false;\n document.removeEventListener('keydown', handleEscape);\n };\n\n // Handle escape key\n const handleEscape = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n e.preventDefault();\n e.stopPropagation();\n closeDialog();\n }\n };\n\n // Event listeners\n const closeBtn = header.querySelector('.rte-preview-editor-close-btn');\n if (closeBtn) {\n closeBtn.addEventListener('click', (e) => {\n e.preventDefault();\n e.stopPropagation();\n closeDialog();\n });\n }\n\n // Close on overlay click (but not modal click)\n overlay.addEventListener('click', (e) => {\n if (e.target === overlay) {\n closeDialog();\n }\n });\n\n // Add escape key listener\n document.addEventListener('keydown', handleEscape);\n\n // Add to DOM\n document.body.appendChild(overlay);\n};\n\nexport const PreviewPlugin = (): Plugin => ({\n name: 'preview',\n \n toolbar: [\n {\n label: 'Preview',\n command: 'togglePreview',\n 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>'\n }\n ],\n \n commands: {\n togglePreview: () => {\n showPreviewDialog();\n return true;\n }\n },\n \n keymap: {}\n});\n"],"names":["isPreviewDialogOpen","injectStyles","styleId","style","findActiveEditor","selection","node","element","activeElement","editor","serializeEditorContent","editorElement","clonedContent","selector","el","sanitizeHTML","html","tempDiv","attr","showPreviewDialog","rawHtml","cleanHtml","overlay","modal","header","body","content","closeDialog","handleEscape","e","closeBtn","PreviewPlugin"],"mappings":"AAcA,IAAIA,IAAsB;AAK1B,MAAMC,IAAe,MAAY;AAC/B,MAAI,OAAO,YAAa,YAAa;AAErC,QAAMC,IAAU;AAChB,MAAI,SAAS,eAAeA,CAAO,EAAG;AAEtC,QAAMC,IAAQ,SAAS,cAAc,OAAO;AAC5C,EAAAA,EAAM,KAAKD,GACXC,EAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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S,iBAAiB,SAAS,CAACD,MAAM;AACxC,IAAAA,EAAE,eAAA,GACFA,EAAE,gBAAA,GACFF,EAAA;AAAA,EACF,CAAC,GAIHL,EAAQ,iBAAiB,SAAS,CAACO,MAAM;AACvC,IAAIA,EAAE,WAAWP,KACfK,EAAA;AAAA,EAEJ,CAAC,GAGD,SAAS,iBAAiB,WAAWC,CAAY,GAGjD,SAAS,KAAK,YAAYN,CAAO;AACnC,GAEaS,IAAgB,OAAe;AAAA,EAC1C,MAAM;AAAA,EAEN,SAAS;AAAA,IACP;AAAA,MACE,OAAO;AAAA,MACP,SAAS;AAAA,MACT,MAAM;AAAA,IAAA;AAAA,EACR;AAAA,EAGF,UAAU;AAAA,IACR,eAAe,OACbZ,EAAA,GACO;AAAA,EACT;AAAA,EAGF,QAAQ,CAAA;AACV;"}
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
const g = () => `
|
|
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
|
+
`, p = () => {
|
|
242
|
+
var d;
|
|
243
|
+
if (typeof window == "undefined") return !1;
|
|
244
|
+
const a = (() => {
|
|
245
|
+
const i = window.getSelection();
|
|
246
|
+
if (i && i.rangeCount > 0) {
|
|
247
|
+
let t = i.getRangeAt(0).startContainer;
|
|
248
|
+
for (; t && t !== document.body; ) {
|
|
249
|
+
if (t.nodeType === Node.ELEMENT_NODE) {
|
|
250
|
+
const l = t;
|
|
251
|
+
if (l.getAttribute("contenteditable") === "true")
|
|
252
|
+
return l;
|
|
253
|
+
}
|
|
254
|
+
t = t.parentNode;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
const r = document.activeElement;
|
|
258
|
+
if (r) {
|
|
259
|
+
if (r.getAttribute("contenteditable") === "true")
|
|
260
|
+
return r;
|
|
261
|
+
const t = r.closest('[contenteditable="true"]');
|
|
262
|
+
if (t) return t;
|
|
263
|
+
}
|
|
264
|
+
return document.querySelector('[contenteditable="true"]');
|
|
265
|
+
})();
|
|
266
|
+
if (!a)
|
|
267
|
+
return console.warn("Editor content not found"), !1;
|
|
268
|
+
const c = a.cloneNode(!0), n = document.createElement("article");
|
|
269
|
+
n.className = "rte-document rte-print", n.appendChild(c);
|
|
270
|
+
const s = `
|
|
271
|
+
<!DOCTYPE html>
|
|
272
|
+
<html>
|
|
273
|
+
<head>
|
|
274
|
+
<meta charset="UTF-8">
|
|
275
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
276
|
+
<title>Print Document</title>
|
|
277
|
+
<style>${g()}</style>
|
|
278
|
+
</head>
|
|
279
|
+
<body>
|
|
280
|
+
${n.outerHTML}
|
|
281
|
+
</body>
|
|
282
|
+
</html>
|
|
283
|
+
`, e = document.createElement("iframe");
|
|
284
|
+
e.style.position = "absolute", e.style.left = "-9999px", e.style.top = "-9999px", e.style.width = "0", e.style.height = "0", document.body.appendChild(e);
|
|
285
|
+
const o = e.contentDocument || ((d = e.contentWindow) == null ? void 0 : d.document);
|
|
286
|
+
return o ? (o.open(), o.write(s), o.close(), setTimeout(() => {
|
|
287
|
+
e.contentWindow && (e.contentWindow.print(), setTimeout(() => {
|
|
288
|
+
document.body.removeChild(e);
|
|
289
|
+
}, 100));
|
|
290
|
+
}, 250), !0) : (console.error("Could not access print frame document"), document.body.removeChild(e), !1);
|
|
291
|
+
}, b = () => ({
|
|
292
|
+
name: "print",
|
|
293
|
+
toolbar: [
|
|
294
|
+
{
|
|
295
|
+
label: "Print",
|
|
296
|
+
command: "print",
|
|
297
|
+
icon: '<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" 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="M7 18H6.2C5.0799 18 4.51984 18 4.09202 17.782C3.71569 17.5903 3.40973 17.2843 3.21799 16.908C3 16.4802 3 15.9201 3 14.8V10.2C3 9.0799 3 8.51984 3.21799 8.09202C3.40973 7.71569 3.71569 7.40973 4.09202 7.21799C4.51984 7 5.0799 7 6.2 7H7M17 18H17.8C18.9201 18 19.4802 18 19.908 17.782C20.2843 17.5903 20.5903 17.2843 20.782 16.908C21 16.4802 21 15.9201 21 14.8V10.2C21 9.07989 21 8.51984 20.782 8.09202C20.5903 7.71569 20.2843 7.40973 19.908 7.21799C19.4802 7 18.9201 7 17.8 7H17M7 11H7.01M17 7V5.4V4.6C17 4.03995 17 3.75992 16.891 3.54601C16.7951 3.35785 16.6422 3.20487 16.454 3.10899C16.2401 3 15.9601 3 15.4 3H8.6C8.03995 3 7.75992 3 7.54601 3.10899C7.35785 3.20487 7.20487 3.35785 7.10899 3.54601C7 3.75992 7 4.03995 7 4.6V5.4V7M17 7H7M8.6 21H15.4C15.9601 21 16.2401 21 16.454 20.891C16.6422 20.7951 16.7951 20.6422 16.891 20.454C17 20.2401 17 19.9601 17 19.4V16.6C17 16.0399 17 15.7599 16.891 15.546C16.7951 15.3578 16.6422 15.2049 16.454 15.109C16.2401 15 15.9601 15 15.4 15H8.6C8.03995 15 7.75992 15 7.54601 15.109C7.35785 15.2049 7.20487 15.3578 7.10899 15.546C7 15.7599 7 16.0399 7 16.6V19.4C7 19.9601 7 20.2401 7.10899 20.454C7.20487 20.6422 7.35785 20.7951 7.54601 20.891C7.75992 21 8.03995 21 8.6 21Z" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>',
|
|
298
|
+
shortcut: "Mod-p"
|
|
299
|
+
}
|
|
300
|
+
],
|
|
301
|
+
commands: {
|
|
302
|
+
print: p
|
|
303
|
+
},
|
|
304
|
+
keymap: {
|
|
305
|
+
"Mod-p": () => (p(), !0)
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
export {
|
|
309
|
+
b as PrintPlugin
|
|
310
|
+
};
|
|
311
|
+
//# sourceMappingURL=PrintPlugin.native-BUpm52VJ.mjs.map
|