@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,1013 @@
|
|
|
1
|
+
const H = /* @__PURE__ */ new Set([
|
|
2
|
+
"the",
|
|
3
|
+
"a",
|
|
4
|
+
"an",
|
|
5
|
+
"and",
|
|
6
|
+
"or",
|
|
7
|
+
"but",
|
|
8
|
+
"in",
|
|
9
|
+
"on",
|
|
10
|
+
"at",
|
|
11
|
+
"to",
|
|
12
|
+
"for",
|
|
13
|
+
"of",
|
|
14
|
+
"with",
|
|
15
|
+
"by",
|
|
16
|
+
"from",
|
|
17
|
+
"is",
|
|
18
|
+
"are",
|
|
19
|
+
"be",
|
|
20
|
+
"was",
|
|
21
|
+
"were",
|
|
22
|
+
"have",
|
|
23
|
+
"has",
|
|
24
|
+
"had",
|
|
25
|
+
"do",
|
|
26
|
+
"does",
|
|
27
|
+
"did",
|
|
28
|
+
"will",
|
|
29
|
+
"would",
|
|
30
|
+
"could",
|
|
31
|
+
"should",
|
|
32
|
+
"may",
|
|
33
|
+
"might",
|
|
34
|
+
"must",
|
|
35
|
+
"can",
|
|
36
|
+
"this",
|
|
37
|
+
"that",
|
|
38
|
+
"these",
|
|
39
|
+
"those",
|
|
40
|
+
"what",
|
|
41
|
+
"which",
|
|
42
|
+
"who",
|
|
43
|
+
"whom",
|
|
44
|
+
"where",
|
|
45
|
+
"when",
|
|
46
|
+
"why",
|
|
47
|
+
"how",
|
|
48
|
+
"all",
|
|
49
|
+
"each",
|
|
50
|
+
"every",
|
|
51
|
+
"both",
|
|
52
|
+
"few",
|
|
53
|
+
"more",
|
|
54
|
+
"most",
|
|
55
|
+
"other",
|
|
56
|
+
"same",
|
|
57
|
+
"such",
|
|
58
|
+
"no",
|
|
59
|
+
"nor",
|
|
60
|
+
"not",
|
|
61
|
+
"only",
|
|
62
|
+
"own",
|
|
63
|
+
"so",
|
|
64
|
+
"than",
|
|
65
|
+
"too",
|
|
66
|
+
"very",
|
|
67
|
+
"just",
|
|
68
|
+
"as",
|
|
69
|
+
"if",
|
|
70
|
+
"because",
|
|
71
|
+
"while",
|
|
72
|
+
"although",
|
|
73
|
+
"though",
|
|
74
|
+
"it",
|
|
75
|
+
"its",
|
|
76
|
+
"their",
|
|
77
|
+
"them",
|
|
78
|
+
"they",
|
|
79
|
+
"you",
|
|
80
|
+
"he",
|
|
81
|
+
"she",
|
|
82
|
+
"we",
|
|
83
|
+
"me",
|
|
84
|
+
"him",
|
|
85
|
+
"her",
|
|
86
|
+
"us",
|
|
87
|
+
"our",
|
|
88
|
+
"i",
|
|
89
|
+
"my",
|
|
90
|
+
"your",
|
|
91
|
+
"his",
|
|
92
|
+
"hers",
|
|
93
|
+
"ours",
|
|
94
|
+
"yours",
|
|
95
|
+
"theirs",
|
|
96
|
+
"editor",
|
|
97
|
+
"document",
|
|
98
|
+
"text",
|
|
99
|
+
"word",
|
|
100
|
+
"paragraph",
|
|
101
|
+
"line",
|
|
102
|
+
"page",
|
|
103
|
+
"content",
|
|
104
|
+
"hello",
|
|
105
|
+
"world",
|
|
106
|
+
"test",
|
|
107
|
+
"example",
|
|
108
|
+
"sample",
|
|
109
|
+
"demo",
|
|
110
|
+
"lorem",
|
|
111
|
+
"ipsum"
|
|
112
|
+
]), E = /* @__PURE__ */ new Set(), C = /* @__PURE__ */ new Set();
|
|
113
|
+
let u = !1, d = null, f = null, a = null, s = null, g = null, v = !1, h = null, O = !1, b = 0;
|
|
114
|
+
const $ = {
|
|
115
|
+
characterData: !0,
|
|
116
|
+
childList: !0,
|
|
117
|
+
subtree: !0
|
|
118
|
+
}, D = "rte-spellcheck-styles", F = "__editoraCommandEditorRoot";
|
|
119
|
+
function q() {
|
|
120
|
+
if (typeof window > "u") return null;
|
|
121
|
+
const e = window[F];
|
|
122
|
+
if (!(e instanceof HTMLElement)) return null;
|
|
123
|
+
window[F] = null;
|
|
124
|
+
const r = e.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || (e.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") ? e : null);
|
|
125
|
+
if (r) {
|
|
126
|
+
const l = B(r);
|
|
127
|
+
if (l) return l;
|
|
128
|
+
if (r.getAttribute("contenteditable") === "true") return r;
|
|
129
|
+
}
|
|
130
|
+
if (e.getAttribute("contenteditable") === "true")
|
|
131
|
+
return e;
|
|
132
|
+
const t = e.closest('[contenteditable="true"]');
|
|
133
|
+
return t instanceof HTMLElement ? t : null;
|
|
134
|
+
}
|
|
135
|
+
function T() {
|
|
136
|
+
let e = document.getElementById(D);
|
|
137
|
+
e || (e = document.createElement("style"), e.id = D, document.head.appendChild(e)), e.textContent = `
|
|
138
|
+
.rte-spell-check-panel {
|
|
139
|
+
position: absolute;
|
|
140
|
+
top: 12px;
|
|
141
|
+
right: 12px;
|
|
142
|
+
width: min(360px, calc(100% - 24px));
|
|
143
|
+
max-height: min(560px, calc(100% - 24px));
|
|
144
|
+
overflow: hidden;
|
|
145
|
+
display: flex;
|
|
146
|
+
flex-direction: column;
|
|
147
|
+
border-radius: 12px;
|
|
148
|
+
border: 1px solid #d7dbe3;
|
|
149
|
+
background: #ffffff;
|
|
150
|
+
color: #1f2937;
|
|
151
|
+
box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
|
|
152
|
+
z-index: 1200;
|
|
153
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.rte-spell-check-panel,
|
|
157
|
+
.rte-spell-check-panel * {
|
|
158
|
+
box-sizing: border-box;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.editora-theme-dark .rte-spell-check-panel {
|
|
162
|
+
border-color: #4b5563;
|
|
163
|
+
background: #1f2937;
|
|
164
|
+
color: #e5e7eb;
|
|
165
|
+
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.rte-spellcheck-header {
|
|
169
|
+
display: flex;
|
|
170
|
+
align-items: center;
|
|
171
|
+
justify-content: space-between;
|
|
172
|
+
gap: 12px;
|
|
173
|
+
padding: 14px 16px 12px;
|
|
174
|
+
border-bottom: 1px solid #eceff5;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.editora-theme-dark .rte-spellcheck-header {
|
|
178
|
+
border-bottom-color: #374151;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.rte-spellcheck-title {
|
|
182
|
+
margin: 0;
|
|
183
|
+
font-size: 15px;
|
|
184
|
+
font-weight: 650;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.rte-spellcheck-subtitle {
|
|
188
|
+
margin: 2px 0 0;
|
|
189
|
+
font-size: 12px;
|
|
190
|
+
color: #64748b;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.editora-theme-dark .rte-spellcheck-subtitle {
|
|
194
|
+
color: #9ca3af;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.rte-spellcheck-close {
|
|
198
|
+
appearance: none;
|
|
199
|
+
border: none;
|
|
200
|
+
background: transparent;
|
|
201
|
+
font-size: 20px;
|
|
202
|
+
line-height: 1;
|
|
203
|
+
color: #6b7280;
|
|
204
|
+
cursor: pointer;
|
|
205
|
+
border-radius: 8px;
|
|
206
|
+
width: 30px;
|
|
207
|
+
height: 30px;
|
|
208
|
+
display: grid;
|
|
209
|
+
place-items: center;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.rte-spellcheck-close:hover {
|
|
213
|
+
background: rgba(15, 23, 42, 0.06);
|
|
214
|
+
color: #0f172a;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.editora-theme-dark .rte-spellcheck-close {
|
|
218
|
+
color: #9ca3af;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.editora-theme-dark .rte-spellcheck-close:hover {
|
|
222
|
+
background: rgba(255, 255, 255, 0.08);
|
|
223
|
+
color: #f3f4f6;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.rte-spellcheck-stats {
|
|
227
|
+
display: grid;
|
|
228
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
229
|
+
gap: 8px;
|
|
230
|
+
padding: 12px 16px;
|
|
231
|
+
border-bottom: 1px solid #eceff5;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.editora-theme-dark .rte-spellcheck-stats {
|
|
235
|
+
border-bottom-color: #374151;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.rte-spellcheck-stat {
|
|
239
|
+
border-radius: 10px;
|
|
240
|
+
background: #f8fafc;
|
|
241
|
+
border: 1px solid #e5e7eb;
|
|
242
|
+
padding: 8px 10px;
|
|
243
|
+
display: grid;
|
|
244
|
+
gap: 2px;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.editora-theme-dark .rte-spellcheck-stat {
|
|
248
|
+
background: #111827;
|
|
249
|
+
border-color: #374151;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.rte-spellcheck-stat-label {
|
|
253
|
+
font-size: 11px;
|
|
254
|
+
color: #64748b;
|
|
255
|
+
text-transform: uppercase;
|
|
256
|
+
letter-spacing: 0.04em;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.editora-theme-dark .rte-spellcheck-stat-label {
|
|
260
|
+
color: #9ca3af;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.rte-spellcheck-stat-value {
|
|
264
|
+
font-size: 16px;
|
|
265
|
+
font-weight: 700;
|
|
266
|
+
color: #111827;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.editora-theme-dark .rte-spellcheck-stat-value {
|
|
270
|
+
color: #f3f4f6;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.rte-spellcheck-list {
|
|
274
|
+
flex: 1 1 auto;
|
|
275
|
+
min-height: 0;
|
|
276
|
+
max-height: 100%;
|
|
277
|
+
overflow-y: auto;
|
|
278
|
+
overflow-x: hidden;
|
|
279
|
+
overscroll-behavior: contain;
|
|
280
|
+
padding: 10px 12px 12px;
|
|
281
|
+
display: grid;
|
|
282
|
+
gap: 8px;
|
|
283
|
+
scrollbar-width: thin;
|
|
284
|
+
scrollbar-color: #cbd5e1 #f1f5f9;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.rte-spellcheck-list::-webkit-scrollbar {
|
|
288
|
+
width: 10px;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.rte-spellcheck-list::-webkit-scrollbar-track {
|
|
292
|
+
background: #f1f5f9;
|
|
293
|
+
border-radius: 999px;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.rte-spellcheck-list::-webkit-scrollbar-thumb {
|
|
297
|
+
background: #cbd5e1;
|
|
298
|
+
border-radius: 999px;
|
|
299
|
+
border: 2px solid #f1f5f9;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.rte-spellcheck-list::-webkit-scrollbar-thumb:hover {
|
|
303
|
+
background: #94a3b8;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.rte-spellcheck-empty {
|
|
307
|
+
padding: 18px 14px;
|
|
308
|
+
text-align: center;
|
|
309
|
+
color: #64748b;
|
|
310
|
+
font-size: 13px;
|
|
311
|
+
border-radius: 10px;
|
|
312
|
+
border: 1px dashed #d1d5db;
|
|
313
|
+
background: #f8fafc;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.editora-theme-dark .rte-spellcheck-empty {
|
|
317
|
+
color: #9ca3af;
|
|
318
|
+
border-color: #4b5563;
|
|
319
|
+
background: #111827;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.editora-theme-dark .rte-spellcheck-list {
|
|
323
|
+
scrollbar-color: #4b5563 #1f2937;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.editora-theme-dark .rte-spellcheck-list::-webkit-scrollbar-track {
|
|
327
|
+
background: #1f2937;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.editora-theme-dark .rte-spellcheck-list::-webkit-scrollbar-thumb {
|
|
331
|
+
background: #4b5563;
|
|
332
|
+
border-color: #1f2937;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.editora-theme-dark .rte-spellcheck-list::-webkit-scrollbar-thumb:hover {
|
|
336
|
+
background: #64748b;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.rte-spellcheck-item {
|
|
340
|
+
border-radius: 10px;
|
|
341
|
+
border: 1px solid #e5e7eb;
|
|
342
|
+
background: #f8fafc;
|
|
343
|
+
overflow: visible;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.editora-theme-dark .rte-spellcheck-item {
|
|
347
|
+
border-color: #4b5563;
|
|
348
|
+
background: #111827;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.rte-spell-check-panel .rte-spellcheck-word-header {
|
|
352
|
+
all: unset;
|
|
353
|
+
width: 100%;
|
|
354
|
+
padding: 10px 11px;
|
|
355
|
+
display: flex;
|
|
356
|
+
align-items: center;
|
|
357
|
+
justify-content: space-between;
|
|
358
|
+
gap: 8px;
|
|
359
|
+
cursor: pointer;
|
|
360
|
+
text-align: left;
|
|
361
|
+
color: #111827;
|
|
362
|
+
font-size: 14px;
|
|
363
|
+
line-height: 1.35;
|
|
364
|
+
user-select: none;
|
|
365
|
+
opacity: 1;
|
|
366
|
+
visibility: visible;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.rte-spell-check-panel .rte-spellcheck-word {
|
|
370
|
+
font-weight: 700;
|
|
371
|
+
color: #c62828;
|
|
372
|
+
word-break: break-word;
|
|
373
|
+
flex: 1;
|
|
374
|
+
opacity: 1;
|
|
375
|
+
visibility: visible;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.editora-theme-dark .rte-spell-check-panel .rte-spellcheck-word-header {
|
|
379
|
+
color: #e5e7eb !important;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.editora-theme-dark .rte-spell-check-panel .rte-spellcheck-word {
|
|
383
|
+
color: #f87171 !important;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.rte-spell-check-panel .rte-spellcheck-caret {
|
|
387
|
+
color: #64748b;
|
|
388
|
+
font-size: 12px;
|
|
389
|
+
min-width: 12px;
|
|
390
|
+
text-align: right;
|
|
391
|
+
opacity: 1;
|
|
392
|
+
visibility: visible;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.rte-spell-check-panel .rte-spellcheck-suggestions {
|
|
396
|
+
display: none;
|
|
397
|
+
border-top: 1px solid #e5e7eb;
|
|
398
|
+
padding: 9px 11px 11px;
|
|
399
|
+
color: #334155;
|
|
400
|
+
font-size: 12px;
|
|
401
|
+
line-height: 1.4;
|
|
402
|
+
opacity: 1;
|
|
403
|
+
visibility: visible;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.editora-theme-dark .rte-spell-check-panel .rte-spellcheck-suggestions {
|
|
407
|
+
border-top-color: #374151;
|
|
408
|
+
color: #d1d5db !important;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
.rte-spell-check-panel .rte-spellcheck-suggestions.show {
|
|
412
|
+
display: block;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.rte-spell-check-panel .rte-spellcheck-actions {
|
|
416
|
+
margin-top: 8px;
|
|
417
|
+
display: flex;
|
|
418
|
+
flex-wrap: wrap;
|
|
419
|
+
gap: 6px;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.rte-spell-check-panel .rte-spellcheck-btn {
|
|
423
|
+
all: unset;
|
|
424
|
+
border-radius: 8px;
|
|
425
|
+
border: 1px solid #d1d5db;
|
|
426
|
+
background: #fff;
|
|
427
|
+
color: #1f2937;
|
|
428
|
+
font-size: 12px;
|
|
429
|
+
font-weight: 550;
|
|
430
|
+
padding: 5px 8px;
|
|
431
|
+
cursor: pointer;
|
|
432
|
+
transition: all 0.15s ease;
|
|
433
|
+
display: inline-flex;
|
|
434
|
+
align-items: center;
|
|
435
|
+
justify-content: center;
|
|
436
|
+
opacity: 1;
|
|
437
|
+
visibility: visible;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.rte-spell-check-panel .rte-spellcheck-btn:hover {
|
|
441
|
+
background: #f3f4f6;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
.rte-spell-check-panel .rte-spellcheck-btn.primary {
|
|
445
|
+
border-color: #2563eb;
|
|
446
|
+
background: #2563eb;
|
|
447
|
+
color: #fff;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.rte-spell-check-panel .rte-spellcheck-btn.primary:hover {
|
|
451
|
+
background: #1d4ed8;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
.editora-theme-dark .rte-spell-check-panel .rte-spellcheck-btn {
|
|
455
|
+
border-color: #4b5563;
|
|
456
|
+
background: #1f2937;
|
|
457
|
+
color: #f3f4f6 !important;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
.editora-theme-dark .rte-spell-check-panel .rte-spellcheck-btn:hover {
|
|
461
|
+
background: #374151;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.editora-theme-dark .rte-spell-check-panel .rte-spellcheck-btn.primary {
|
|
465
|
+
border-color: #60a5fa;
|
|
466
|
+
background: #2563eb;
|
|
467
|
+
color: #fff;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.rte-spellcheck-menu {
|
|
471
|
+
position: fixed;
|
|
472
|
+
background: #ffffff;
|
|
473
|
+
border: 1px solid #d1d5db;
|
|
474
|
+
border-radius: 10px;
|
|
475
|
+
box-shadow: 0 12px 30px rgba(15, 23, 42, 0.2);
|
|
476
|
+
z-index: 1300;
|
|
477
|
+
padding: 6px 0;
|
|
478
|
+
min-width: 180px;
|
|
479
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
480
|
+
font-size: 13px;
|
|
481
|
+
color: #111827;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
.rte-spellcheck-menu-item {
|
|
485
|
+
padding: 8px 14px;
|
|
486
|
+
cursor: pointer;
|
|
487
|
+
transition: background 0.15s ease;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
.rte-spellcheck-menu-item:hover {
|
|
491
|
+
background: #f3f4f6;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
.rte-spellcheck-menu-item.meta {
|
|
495
|
+
color: #64748b;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
.rte-spellcheck-menu-item.positive {
|
|
499
|
+
color: #1d4ed8;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
.editora-theme-dark .rte-spellcheck-menu {
|
|
503
|
+
background: #1f2937;
|
|
504
|
+
border-color: #4b5563;
|
|
505
|
+
color: #e5e7eb;
|
|
506
|
+
box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
.editora-theme-dark .rte-spellcheck-menu-item:hover {
|
|
510
|
+
background: #374151;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
.editora-theme-dark .rte-spellcheck-menu-item.meta {
|
|
514
|
+
color: #9ca3af;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
.editora-theme-dark .rte-spellcheck-menu-item.positive {
|
|
518
|
+
color: #93c5fd;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
:is([theme="dark"], [data-theme="dark"], .dark, .editora-theme-dark) .rte-spell-check-panel {
|
|
522
|
+
border-color: #4b5563;
|
|
523
|
+
background: #1f2937;
|
|
524
|
+
color: #e5e7eb;
|
|
525
|
+
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
:is([theme="dark"], [data-theme="dark"], .dark, .editora-theme-dark) .rte-spellcheck-header {
|
|
529
|
+
border-bottom-color: #374151;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
:is([theme="dark"], [data-theme="dark"], .dark, .editora-theme-dark) .rte-spellcheck-subtitle {
|
|
533
|
+
color: #9ca3af;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
:is([theme="dark"], [data-theme="dark"], .dark, .editora-theme-dark) .rte-spellcheck-item {
|
|
537
|
+
border-color: #4b5563;
|
|
538
|
+
background: #111827;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
:is([theme="dark"], [data-theme="dark"], .dark, .editora-theme-dark) .rte-spellcheck-list {
|
|
542
|
+
scrollbar-color: #4b5563 #1f2937;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
:is([theme="dark"], [data-theme="dark"], .dark, .editora-theme-dark) .rte-spellcheck-list::-webkit-scrollbar-track {
|
|
546
|
+
background: #1f2937;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
:is([theme="dark"], [data-theme="dark"], .dark, .editora-theme-dark) .rte-spellcheck-list::-webkit-scrollbar-thumb {
|
|
550
|
+
background: #4b5563;
|
|
551
|
+
border-color: #1f2937;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
:is([theme="dark"], [data-theme="dark"], .dark, .editora-theme-dark) .rte-spellcheck-list::-webkit-scrollbar-thumb:hover {
|
|
555
|
+
background: #64748b;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
:is([theme="dark"], [data-theme="dark"], .dark, .editora-theme-dark) .rte-spell-check-panel .rte-spellcheck-word-header {
|
|
559
|
+
color: #e5e7eb !important;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
:is([theme="dark"], [data-theme="dark"], .dark, .editora-theme-dark) .rte-spell-check-panel .rte-spellcheck-word {
|
|
563
|
+
color: #f87171 !important;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
:is([theme="dark"], [data-theme="dark"], .dark, .editora-theme-dark) .rte-spell-check-panel .rte-spellcheck-suggestions {
|
|
567
|
+
border-top-color: #374151;
|
|
568
|
+
color: #d1d5db !important;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
:is([theme="dark"], [data-theme="dark"], .dark, .editora-theme-dark) .rte-spell-check-panel .rte-spellcheck-btn {
|
|
572
|
+
border-color: #4b5563;
|
|
573
|
+
background: #1f2937;
|
|
574
|
+
color: #f3f4f6 !important;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
:is([theme="dark"], [data-theme="dark"], .dark, .editora-theme-dark) .rte-spell-check-panel .rte-spellcheck-btn:hover {
|
|
578
|
+
background: #374151;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
:is([theme="dark"], [data-theme="dark"], .dark, .editora-theme-dark) .rte-spell-check-panel .rte-spellcheck-btn.primary {
|
|
582
|
+
border-color: #60a5fa;
|
|
583
|
+
background: #2563eb;
|
|
584
|
+
color: #fff;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
:is([theme="dark"], [data-theme="dark"], .dark, .editora-theme-dark) .rte-spellcheck-menu {
|
|
588
|
+
background: #1f2937;
|
|
589
|
+
border-color: #4b5563;
|
|
590
|
+
color: #e5e7eb;
|
|
591
|
+
box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
:is([theme="dark"], [data-theme="dark"], .dark, .editora-theme-dark) .rte-spellcheck-menu-item:hover {
|
|
595
|
+
background: #374151;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
:is([theme="dark"], [data-theme="dark"], .dark, .editora-theme-dark) .rte-spellcheck-menu-item.meta {
|
|
599
|
+
color: #9ca3af;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
:is([theme="dark"], [data-theme="dark"], .dark, .editora-theme-dark) .rte-spellcheck-menu-item.positive {
|
|
603
|
+
color: #93c5fd;
|
|
604
|
+
}
|
|
605
|
+
`;
|
|
606
|
+
}
|
|
607
|
+
function k() {
|
|
608
|
+
if (s && document.contains(s))
|
|
609
|
+
return s;
|
|
610
|
+
const e = j();
|
|
611
|
+
return e && (s = e), e;
|
|
612
|
+
}
|
|
613
|
+
function z(e) {
|
|
614
|
+
if (!e) return;
|
|
615
|
+
const t = (e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement)?.closest('[contenteditable="true"]');
|
|
616
|
+
t && (s = t);
|
|
617
|
+
}
|
|
618
|
+
function B(e) {
|
|
619
|
+
if (!e) return null;
|
|
620
|
+
const r = e.querySelector('[contenteditable="true"]');
|
|
621
|
+
return r instanceof HTMLElement ? r : null;
|
|
622
|
+
}
|
|
623
|
+
function X() {
|
|
624
|
+
if (O) return;
|
|
625
|
+
const e = (r) => {
|
|
626
|
+
const t = r.target;
|
|
627
|
+
if (!t) return;
|
|
628
|
+
const l = t.closest(
|
|
629
|
+
'.editora-toolbar-button[data-command="toggleSpellCheck"], .rte-toolbar-button[data-command="toggleSpellCheck"]'
|
|
630
|
+
);
|
|
631
|
+
if (!l) return;
|
|
632
|
+
const o = l.closest("[data-editora-editor]"), c = B(o);
|
|
633
|
+
c && (h = c, s = c);
|
|
634
|
+
};
|
|
635
|
+
document.addEventListener("pointerdown", e, !0), O = !0;
|
|
636
|
+
}
|
|
637
|
+
function Z() {
|
|
638
|
+
const e = q();
|
|
639
|
+
if (e && document.contains(e))
|
|
640
|
+
return s = e, h = null, e;
|
|
641
|
+
if (h && document.contains(h)) {
|
|
642
|
+
const r = h;
|
|
643
|
+
return h = null, s = r, r;
|
|
644
|
+
}
|
|
645
|
+
return j();
|
|
646
|
+
}
|
|
647
|
+
function K() {
|
|
648
|
+
b += 1, b === 1 && d && d.disconnect();
|
|
649
|
+
}
|
|
650
|
+
function Q() {
|
|
651
|
+
if (b === 0 || (b -= 1, b > 0) || !d) return;
|
|
652
|
+
const e = k();
|
|
653
|
+
e && d.observe(e, $);
|
|
654
|
+
}
|
|
655
|
+
function L(e) {
|
|
656
|
+
K();
|
|
657
|
+
try {
|
|
658
|
+
return e();
|
|
659
|
+
} finally {
|
|
660
|
+
Q();
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
const ee = () => {
|
|
664
|
+
try {
|
|
665
|
+
const e = localStorage.getItem("rte-custom-dictionary");
|
|
666
|
+
e && JSON.parse(e).forEach((t) => E.add(t.toLowerCase()));
|
|
667
|
+
} catch (e) {
|
|
668
|
+
console.warn("Failed to load custom dictionary:", e);
|
|
669
|
+
}
|
|
670
|
+
}, te = () => {
|
|
671
|
+
try {
|
|
672
|
+
const e = Array.from(E);
|
|
673
|
+
localStorage.setItem("rte-custom-dictionary", JSON.stringify(e));
|
|
674
|
+
} catch (e) {
|
|
675
|
+
console.warn("Failed to save custom dictionary:", e);
|
|
676
|
+
}
|
|
677
|
+
};
|
|
678
|
+
function re(e, r) {
|
|
679
|
+
const t = [];
|
|
680
|
+
for (let l = 0; l <= r.length; l++) t[l] = [l];
|
|
681
|
+
for (let l = 0; l <= e.length; l++) t[0][l] = l;
|
|
682
|
+
for (let l = 1; l <= r.length; l++)
|
|
683
|
+
for (let o = 1; o <= e.length; o++)
|
|
684
|
+
r.charAt(l - 1) === e.charAt(o - 1) ? t[l][o] = t[l - 1][o - 1] : t[l][o] = Math.min(
|
|
685
|
+
t[l - 1][o - 1] + 1,
|
|
686
|
+
// substitution
|
|
687
|
+
t[l][o - 1] + 1,
|
|
688
|
+
// insertion
|
|
689
|
+
t[l - 1][o] + 1
|
|
690
|
+
// deletion
|
|
691
|
+
);
|
|
692
|
+
return t[r.length][e.length];
|
|
693
|
+
}
|
|
694
|
+
function oe(e) {
|
|
695
|
+
const r = e.toLowerCase();
|
|
696
|
+
return H.has(r) || E.has(r) || C.has(r);
|
|
697
|
+
}
|
|
698
|
+
function le(e, r = 5) {
|
|
699
|
+
const t = e.toLowerCase(), o = Array.from(H).map((c) => ({ word: c, distance: re(t, c) }));
|
|
700
|
+
return o.sort((c, n) => c.distance - n.distance), o.filter((c) => c.distance <= 3).slice(0, r).map((c) => c.word);
|
|
701
|
+
}
|
|
702
|
+
function ce(e) {
|
|
703
|
+
if (e.nodeType !== Node.ELEMENT_NODE) return !1;
|
|
704
|
+
const r = e;
|
|
705
|
+
return !!(r.closest('code, pre, [contenteditable="false"], .rte-widget, .rte-template, .rte-comment, .rte-merge-tag') || r.hasAttribute("data-comment-id") || r.hasAttribute("data-template") || r.hasAttribute("data-merge-tag"));
|
|
706
|
+
}
|
|
707
|
+
function ne(e) {
|
|
708
|
+
const r = [], t = /([\p{L}\p{M}\p{N}\p{Emoji_Presentation}\u200d'-]+|[\uD800-\uDBFF][\uDC00-\uDFFF])/gu;
|
|
709
|
+
let l;
|
|
710
|
+
for (; (l = t.exec(e.data)) !== null; ) {
|
|
711
|
+
const o = l[0], c = l.index, n = c + o.length;
|
|
712
|
+
/https?:\/\//.test(o) || /@/.test(o) || /\{\{.*\}\}/.test(o) || /^\d+$/.test(o) || oe(o) || /[a-z][A-Z]/.test(o) || /-/.test(o) || o[0] === o[0].toUpperCase() && o.length > 1 || r.push({
|
|
713
|
+
id: `${o}-${c}`,
|
|
714
|
+
node: e,
|
|
715
|
+
startOffset: c,
|
|
716
|
+
endOffset: n,
|
|
717
|
+
word: o,
|
|
718
|
+
suggestions: le(o),
|
|
719
|
+
ignored: !1
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
return r;
|
|
723
|
+
}
|
|
724
|
+
const j = () => {
|
|
725
|
+
const e = q();
|
|
726
|
+
if (e && document.contains(e))
|
|
727
|
+
return s = e, e;
|
|
728
|
+
const r = window.getSelection();
|
|
729
|
+
if (r && r.rangeCount > 0) {
|
|
730
|
+
let l = r.getRangeAt(0).startContainer;
|
|
731
|
+
for (; l && l !== document.body; ) {
|
|
732
|
+
if (l.nodeType === Node.ELEMENT_NODE) {
|
|
733
|
+
const o = l;
|
|
734
|
+
if (o.getAttribute("contenteditable") === "true")
|
|
735
|
+
return o;
|
|
736
|
+
}
|
|
737
|
+
l = l.parentNode;
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
const t = document.activeElement;
|
|
741
|
+
if (t) {
|
|
742
|
+
if (t.getAttribute("contenteditable") === "true")
|
|
743
|
+
return t;
|
|
744
|
+
const l = t.closest('[contenteditable="true"]');
|
|
745
|
+
if (l) return l;
|
|
746
|
+
const o = t.closest("[data-editora-editor]");
|
|
747
|
+
if (o) {
|
|
748
|
+
const c = o.querySelector('[contenteditable="true"]');
|
|
749
|
+
if (c) return c;
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
return document.querySelector('[contenteditable="true"]');
|
|
753
|
+
};
|
|
754
|
+
function N() {
|
|
755
|
+
const e = k();
|
|
756
|
+
if (!e) return [];
|
|
757
|
+
const r = [], t = document.createTreeWalker(
|
|
758
|
+
e,
|
|
759
|
+
NodeFilter.SHOW_TEXT,
|
|
760
|
+
{
|
|
761
|
+
acceptNode: (o) => !o.textContent?.trim() || o.parentNode && ce(o.parentNode) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT
|
|
762
|
+
}
|
|
763
|
+
);
|
|
764
|
+
let l = t.nextNode();
|
|
765
|
+
for (; l; )
|
|
766
|
+
r.push(...ne(l)), l = t.nextNode();
|
|
767
|
+
return r;
|
|
768
|
+
}
|
|
769
|
+
function m(e) {
|
|
770
|
+
const r = k();
|
|
771
|
+
r && (e || (e = N()), L(() => {
|
|
772
|
+
r.querySelectorAll(".rte-misspelled").forEach((t) => {
|
|
773
|
+
const l = t.parentNode;
|
|
774
|
+
if (l) {
|
|
775
|
+
for (; t.firstChild; )
|
|
776
|
+
l.insertBefore(t.firstChild, t);
|
|
777
|
+
l.removeChild(t);
|
|
778
|
+
}
|
|
779
|
+
}), e.forEach((t) => {
|
|
780
|
+
if (C.has(t.word.toLowerCase())) return;
|
|
781
|
+
const l = t.node.data.length;
|
|
782
|
+
if (!(t.startOffset < 0 || t.endOffset > l || t.startOffset >= t.endOffset))
|
|
783
|
+
try {
|
|
784
|
+
const o = document.createRange();
|
|
785
|
+
o.setStart(t.node, t.startOffset), o.setEnd(t.node, t.endOffset);
|
|
786
|
+
const c = document.createElement("span");
|
|
787
|
+
c.className = "rte-misspelled", c.setAttribute("data-word", t.word), c.setAttribute("data-suggestions", t.suggestions.join(",")), c.setAttribute("title", `Suggestions: ${t.suggestions.join(", ")}`), c.style.borderBottom = "2px wavy red", c.style.cursor = "pointer", o.surroundContents(c);
|
|
788
|
+
} catch {
|
|
789
|
+
}
|
|
790
|
+
});
|
|
791
|
+
}), y(e));
|
|
792
|
+
}
|
|
793
|
+
function S() {
|
|
794
|
+
const e = k();
|
|
795
|
+
e && L(() => {
|
|
796
|
+
e.querySelectorAll(".rte-misspelled").forEach((r) => {
|
|
797
|
+
const t = r.parentNode;
|
|
798
|
+
if (t) {
|
|
799
|
+
for (; r.firstChild; )
|
|
800
|
+
t.insertBefore(r.firstChild, r);
|
|
801
|
+
t.removeChild(r);
|
|
802
|
+
}
|
|
803
|
+
});
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
function ae(e, r) {
|
|
807
|
+
L(() => {
|
|
808
|
+
const t = document.createRange();
|
|
809
|
+
t.setStart(e.node, e.startOffset), t.setEnd(e.node, e.endOffset);
|
|
810
|
+
const l = document.createTextNode(r);
|
|
811
|
+
t.deleteContents(), t.insertNode(l);
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
function P(e) {
|
|
815
|
+
C.add(e.toLowerCase()), S(), m();
|
|
816
|
+
}
|
|
817
|
+
function W(e) {
|
|
818
|
+
E.add(e.toLowerCase()), te(), S(), m();
|
|
819
|
+
}
|
|
820
|
+
function se(e) {
|
|
821
|
+
const r = k();
|
|
822
|
+
if (!r) return { total: 0, misspelled: 0, accuracy: 100 };
|
|
823
|
+
e || (e = N());
|
|
824
|
+
const t = e.filter((n) => !C.has(n.word.toLowerCase())).length, c = ((r.textContent || "").match(/[\p{L}\p{M}\p{N}]+/gu) || []).length;
|
|
825
|
+
return {
|
|
826
|
+
total: c,
|
|
827
|
+
misspelled: t,
|
|
828
|
+
accuracy: c > 0 ? (c - t) / c * 100 : 100
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
function ie(e, r) {
|
|
832
|
+
const t = document.createTextNode(r);
|
|
833
|
+
e.replaceWith(t);
|
|
834
|
+
}
|
|
835
|
+
function de(e) {
|
|
836
|
+
e.classList.remove("rte-misspelled"), e.removeAttribute("data-word"), e.removeAttribute("data-suggestions"), e.removeAttribute("title"), e.style.borderBottom = "", e.style.cursor = "";
|
|
837
|
+
}
|
|
838
|
+
function pe(e, r, t, l, o) {
|
|
839
|
+
z(o), document.querySelectorAll(".rte-spellcheck-menu").forEach((p) => p.remove());
|
|
840
|
+
const c = document.createElement("div");
|
|
841
|
+
if (c.className = "rte-spellcheck-menu", l.slice(0, 5).forEach((p) => {
|
|
842
|
+
const w = document.createElement("div");
|
|
843
|
+
w.className = "rte-spellcheck-menu-item", w.textContent = p, w.onclick = () => {
|
|
844
|
+
ie(o, p), window.setTimeout(() => {
|
|
845
|
+
u && (m(), y());
|
|
846
|
+
}, 0), c.remove();
|
|
847
|
+
}, c.appendChild(w);
|
|
848
|
+
}), l.length > 0) {
|
|
849
|
+
const p = document.createElement("div");
|
|
850
|
+
p.style.cssText = "height: 1px; background: #ddd; margin: 4px 0;", c.appendChild(p);
|
|
851
|
+
}
|
|
852
|
+
const n = document.createElement("div");
|
|
853
|
+
n.className = "rte-spellcheck-menu-item meta", n.textContent = "Ignore Once", n.onclick = () => {
|
|
854
|
+
de(o), c.remove();
|
|
855
|
+
}, c.appendChild(n);
|
|
856
|
+
const i = document.createElement("div");
|
|
857
|
+
i.className = "rte-spellcheck-menu-item meta", i.textContent = "Ignore All", i.onclick = () => {
|
|
858
|
+
P(t), c.remove();
|
|
859
|
+
}, c.appendChild(i);
|
|
860
|
+
const x = document.createElement("div");
|
|
861
|
+
x.className = "rte-spellcheck-menu-item positive", x.textContent = "Add to Dictionary", x.onclick = () => {
|
|
862
|
+
W(t), c.remove();
|
|
863
|
+
}, c.appendChild(x), document.body.appendChild(c);
|
|
864
|
+
const A = c.getBoundingClientRect(), U = window.innerWidth - A.width - 8, Y = window.innerHeight - A.height - 8;
|
|
865
|
+
c.style.left = `${Math.max(8, Math.min(e, U))}px`, c.style.top = `${Math.max(8, Math.min(r, Y))}px`;
|
|
866
|
+
const M = (p) => {
|
|
867
|
+
c.contains(p.target) || (c.remove(), document.removeEventListener("mousedown", M));
|
|
868
|
+
};
|
|
869
|
+
setTimeout(() => document.addEventListener("mousedown", M), 0);
|
|
870
|
+
}
|
|
871
|
+
function _() {
|
|
872
|
+
v || (g = (e) => {
|
|
873
|
+
const r = e.target;
|
|
874
|
+
if (r && r.classList.contains("rte-misspelled")) {
|
|
875
|
+
e.preventDefault(), z(r);
|
|
876
|
+
const t = r.getAttribute("data-word"), l = (r.getAttribute("data-suggestions") || "").split(",").filter((o) => o);
|
|
877
|
+
pe(e.clientX, e.clientY, t, l, r);
|
|
878
|
+
}
|
|
879
|
+
}, document.addEventListener("contextmenu", g), v = !0);
|
|
880
|
+
}
|
|
881
|
+
function he() {
|
|
882
|
+
!v || !g || (document.removeEventListener("contextmenu", g), g = null, v = !1);
|
|
883
|
+
}
|
|
884
|
+
function ue(e) {
|
|
885
|
+
return e.closest("[data-editora-editor]") || e.parentElement || e;
|
|
886
|
+
}
|
|
887
|
+
function I() {
|
|
888
|
+
const e = k();
|
|
889
|
+
if (!e)
|
|
890
|
+
throw new Error("Spell check panel requested without active editor");
|
|
891
|
+
const r = ue(e);
|
|
892
|
+
T();
|
|
893
|
+
const t = document.createElement("div");
|
|
894
|
+
return t.className = "rte-spell-check-panel", window.getComputedStyle(r).position === "static" && (r.style.position = "relative"), r.appendChild(t), t;
|
|
895
|
+
}
|
|
896
|
+
function y(e) {
|
|
897
|
+
if (!a) return;
|
|
898
|
+
const r = e || N(), t = se(r);
|
|
899
|
+
a.innerHTML = `
|
|
900
|
+
<div class="rte-spellcheck-header">
|
|
901
|
+
<div>
|
|
902
|
+
<h3 class="rte-spellcheck-title">Spell Check</h3>
|
|
903
|
+
<p class="rte-spellcheck-subtitle">Review suggestions and resolve issues quickly</p>
|
|
904
|
+
</div>
|
|
905
|
+
<button class="rte-spellcheck-close" aria-label="Close spell check panel">✕</button>
|
|
906
|
+
</div>
|
|
907
|
+
|
|
908
|
+
<div class="rte-spellcheck-stats">
|
|
909
|
+
<div class="rte-spellcheck-stat">
|
|
910
|
+
<span class="rte-spellcheck-stat-label">Total</span>
|
|
911
|
+
<strong class="rte-spellcheck-stat-value">${t.total}</strong>
|
|
912
|
+
</div>
|
|
913
|
+
<div class="rte-spellcheck-stat">
|
|
914
|
+
<span class="rte-spellcheck-stat-label">Misspelled</span>
|
|
915
|
+
<strong class="rte-spellcheck-stat-value">${t.misspelled}</strong>
|
|
916
|
+
</div>
|
|
917
|
+
<div class="rte-spellcheck-stat">
|
|
918
|
+
<span class="rte-spellcheck-stat-label">Accuracy</span>
|
|
919
|
+
<strong class="rte-spellcheck-stat-value">${t.accuracy.toFixed(1)}%</strong>
|
|
920
|
+
</div>
|
|
921
|
+
</div>
|
|
922
|
+
|
|
923
|
+
<div class="rte-spellcheck-list">
|
|
924
|
+
${r.length === 0 ? '<div class="rte-spellcheck-empty">No spelling errors found in this editor.</div>' : r.map((o, c) => `
|
|
925
|
+
<div class="rte-spellcheck-item" data-word="${o.word}" data-index="${c}">
|
|
926
|
+
<button class="rte-spellcheck-word-header" type="button">
|
|
927
|
+
<span class="rte-spellcheck-word">${o.word}</span>
|
|
928
|
+
<span class="rte-spellcheck-caret">▶</span>
|
|
929
|
+
</button>
|
|
930
|
+
<div class="rte-spellcheck-suggestions">
|
|
931
|
+
${o.suggestions.length > 0 ? `<div class="rte-spellcheck-actions">
|
|
932
|
+
${o.suggestions.map((n) => `<button class="rte-spellcheck-btn primary suggestion-btn" data-suggestion="${n}" type="button">${n}</button>`).join("")}
|
|
933
|
+
</div>` : '<div class="rte-spellcheck-subtitle">No suggestions available</div>'}
|
|
934
|
+
<div class="rte-spellcheck-actions">
|
|
935
|
+
<button class="rte-spellcheck-btn ignore-btn" type="button">Ignore</button>
|
|
936
|
+
<button class="rte-spellcheck-btn add-btn" type="button">Add to Dictionary</button>
|
|
937
|
+
</div>
|
|
938
|
+
</div>
|
|
939
|
+
</div>
|
|
940
|
+
`).join("")}
|
|
941
|
+
</div>
|
|
942
|
+
`, a.querySelector(".rte-spellcheck-close")?.addEventListener("click", (o) => {
|
|
943
|
+
o.preventDefault(), o.stopPropagation(), J();
|
|
944
|
+
}), a.querySelectorAll(".rte-spellcheck-word-header").forEach((o) => {
|
|
945
|
+
o.addEventListener("click", () => {
|
|
946
|
+
const n = o.closest(".rte-spellcheck-item")?.querySelector(".rte-spellcheck-suggestions"), i = o.querySelector(".rte-spellcheck-caret");
|
|
947
|
+
n && i && (n.classList.contains("show") ? (n.classList.remove("show"), i.textContent = "▶") : (n.classList.add("show"), i.textContent = "▼"));
|
|
948
|
+
});
|
|
949
|
+
}), a.querySelectorAll(".suggestion-btn").forEach((o) => {
|
|
950
|
+
o.addEventListener("click", () => {
|
|
951
|
+
const c = o.getAttribute("data-suggestion"), n = o.closest(".rte-spellcheck-item");
|
|
952
|
+
n?.getAttribute("data-word");
|
|
953
|
+
const i = parseInt(n?.getAttribute("data-index") || "0");
|
|
954
|
+
r[i] && (ae(r[i], c), m());
|
|
955
|
+
});
|
|
956
|
+
}), a.querySelectorAll(".ignore-btn").forEach((o) => {
|
|
957
|
+
o.addEventListener("click", () => {
|
|
958
|
+
const n = o.closest(".rte-spellcheck-item")?.getAttribute("data-word");
|
|
959
|
+
P(n);
|
|
960
|
+
});
|
|
961
|
+
}), a.querySelectorAll(".add-btn").forEach((o) => {
|
|
962
|
+
o.addEventListener("click", () => {
|
|
963
|
+
const n = o.closest(".rte-spellcheck-item")?.getAttribute("data-word");
|
|
964
|
+
W(n);
|
|
965
|
+
});
|
|
966
|
+
});
|
|
967
|
+
}
|
|
968
|
+
function R() {
|
|
969
|
+
const e = k();
|
|
970
|
+
e && (d && d.disconnect(), d = new MutationObserver((r) => {
|
|
971
|
+
b > 0 || r.some((t) => t.type === "characterData" || t.type === "childList") && (f && clearTimeout(f), f = window.setTimeout(() => {
|
|
972
|
+
u && m();
|
|
973
|
+
}, 350));
|
|
974
|
+
}), d.observe(e, {
|
|
975
|
+
...$
|
|
976
|
+
}));
|
|
977
|
+
}
|
|
978
|
+
function V() {
|
|
979
|
+
d && (d.disconnect(), d = null), f && (clearTimeout(f), f = null);
|
|
980
|
+
}
|
|
981
|
+
function G() {
|
|
982
|
+
document.querySelectorAll(".rte-spellcheck-menu").forEach((e) => e.remove());
|
|
983
|
+
}
|
|
984
|
+
function J() {
|
|
985
|
+
return u && (S(), V(), he(), G(), a && (a.remove(), a = null), s = null, h = null, u = !1), !1;
|
|
986
|
+
}
|
|
987
|
+
function me() {
|
|
988
|
+
const e = Z();
|
|
989
|
+
return e ? u && s && s !== e ? (S(), V(), G(), a && (a.remove(), a = null), s = e, T(), _(), m(), R(), a = I(), y(), !0) : u ? J() : (s = e, u = !0, T(), _(), m(), R(), a && (a.remove(), a = null), a = I(), y(), !0) : !1;
|
|
990
|
+
}
|
|
991
|
+
const ke = () => ({
|
|
992
|
+
name: "spellCheck",
|
|
993
|
+
init: () => {
|
|
994
|
+
ee(), X();
|
|
995
|
+
},
|
|
996
|
+
toolbar: [
|
|
997
|
+
{
|
|
998
|
+
label: "Spell Check",
|
|
999
|
+
command: "toggleSpellCheck",
|
|
1000
|
+
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="M3 12.5L3.84375 9.5M3.84375 9.5L5 5.38889C5 5.38889 5.25 4.5 6 4.5C6.75 4.5 7 5.38889 7 5.38889L8.15625 9.5M3.84375 9.5H8.15625M9 12.5L8.15625 9.5M13 16.8333L15.4615 19.5L21 13.5M12 8.5H15C16.1046 8.5 17 7.60457 17 6.5C17 5.39543 16.1046 4.5 15 4.5H12V8.5ZM12 8.5H16C17.1046 8.5 18 9.39543 18 10.5C18 11.6046 17.1046 12.5 16 12.5H12V8.5Z" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>',
|
|
1001
|
+
shortcut: "F7"
|
|
1002
|
+
}
|
|
1003
|
+
],
|
|
1004
|
+
commands: {
|
|
1005
|
+
toggleSpellCheck: () => (me(), !0)
|
|
1006
|
+
},
|
|
1007
|
+
keymap: {
|
|
1008
|
+
F7: "toggleSpellCheck"
|
|
1009
|
+
}
|
|
1010
|
+
});
|
|
1011
|
+
export {
|
|
1012
|
+
ke as SpellCheckPlugin
|
|
1013
|
+
};
|