vdc-editor 0.1.193 → 0.1.195

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vdc-editor",
3
- "version": "0.1.193",
3
+ "version": "0.1.195",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "A modern WYSIWYG rich-text editor using tiptap + Vue.js for SBS",
@@ -1,674 +0,0 @@
1
- import { c as Q, a as U, C as ke, P as Ce, b as be, D as ve, d as ye, _ as Ee, e as Se, o as we, f as Te, S as te, g as Ie, h as Re, i as Oe, j as Ne, k as We, l as Me, m as Ae, n as $e } from "./index-DTJg9eJF.mjs";
2
- import { defineComponent as P, createElementBlock as b, openBlock as g, createVNode as S, createElementVNode as f, unref as s, ref as D, onMounted as se, nextTick as re, createCommentVNode as le, normalizeClass as j, withModifiers as Z, toDisplayString as G, Fragment as Y, renderList as q, createTextVNode as F, createBlock as B, createStaticVNode as He, withCtx as $, normalizeProps as Le, guardReactiveProps as De, renderSlot as Pe, reactive as ie, computed as ne, watch as ce, onUnmounted as oe, resolveDynamicComponent as Be, normalizeStyle as je } from "vue";
3
- const X = {
4
- SPACING: 1,
5
- SPELLING: 2
6
- }, ze = {
7
- NOTHING_TO_CHANGE: "NOTHING_TO_CHANGE"
8
- }, W = {
9
- LOADING: "loading",
10
- HAS_ERROR: "hasError",
11
- NO_ERROR: "noError",
12
- FAIL: "fail"
13
- }, H = {
14
- EDITOR_COMMENT: "editorComment",
15
- EDITOR_CONTENT: "editorContent"
16
- };
17
- /**
18
- * @license lucide-vue-next v0.439.0 - ISC
19
- *
20
- * This source code is licensed under the ISC license.
21
- * See the LICENSE file in the root directory of this source tree.
22
- */
23
- const Ge = Q("ArrowLeftRightIcon", [
24
- ["path", { d: "M8 3 4 7l4 4", key: "9rb6wj" }],
25
- ["path", { d: "M4 7h16", key: "6tx8e3" }],
26
- ["path", { d: "m16 21 4-4-4-4", key: "siv7j2" }],
27
- ["path", { d: "M20 17H4", key: "h6l3hr" }]
28
- ]);
29
- /**
30
- * @license lucide-vue-next v0.439.0 - ISC
31
- *
32
- * This source code is licensed under the ISC license.
33
- * See the LICENSE file in the root directory of this source tree.
34
- */
35
- const Fe = Q("CircleAlertIcon", [
36
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
37
- ["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
38
- ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
39
- ]);
40
- /**
41
- * @license lucide-vue-next v0.439.0 - ISC
42
- *
43
- * This source code is licensed under the ISC license.
44
- * See the LICENSE file in the root directory of this source tree.
45
- */
46
- const Ve = Q("CircleCheckIcon", [
47
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
48
- ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
49
- ]), Ke = { class: "min-h-[188px] flex flex-col items-center justify-center gap-y-2 text-sm" }, Ye = /* @__PURE__ */ P({
50
- __name: "BulkSpellCheckerFail",
51
- setup(o) {
52
- return (t, l) => (g(), b("div", Ke, [
53
- S(s(Fe), { class: "h-12 w-12 text-red-500" }),
54
- l[0] || (l[0] = f("div", null, "맞춤법 검사에 실패했습니다", -1)),
55
- l[1] || (l[1] = f("p", { class: "text-xs font-normal text-gray-600" }, "다시 검사하기 버튼을 눌러 재시도 해주세요", -1))
56
- ]));
57
- }
58
- }), Ue = { class: "min-h-[188px] flex flex-col items-center justify-center gap-y-2 text-sm" }, Xe = /* @__PURE__ */ P({
59
- __name: "BulkSpellCheckerNotWrongWord",
60
- setup(o) {
61
- return (t, l) => (g(), b("div", Ue, [
62
- S(s(Ve), { class: "h-12 w-12 text-blue-500" }),
63
- l[0] || (l[0] = f("div", null, "맞춤법 오류가 없습니다", -1))
64
- ]));
65
- }
66
- }), qe = { class: "relative" }, Je = ["innerHTML"], Qe = { class: "border-b border-gray-500" }, Ze = /* @__PURE__ */ P({
67
- __name: "BulkSpellCheckerHelpText",
68
- props: {
69
- text: {}
70
- },
71
- setup(o) {
72
- const t = D(!1), l = D(!1), i = D(null);
73
- function p() {
74
- t.value = !t.value;
75
- }
76
- return se(async () => {
77
- await re(), i.value && i.value.scrollHeight > 32 && (l.value = !0);
78
- }), (d, x) => (g(), b("div", qe, [
79
- f("div", {
80
- ref_key: "helpRef",
81
- ref: i,
82
- class: j(["text-gray-700 transition-all", s(t) ? "max-h-none" : "max-h-[32px] overflow-hidden"]),
83
- innerHTML: d.text
84
- }, null, 10, Je),
85
- s(l) ? (g(), b("div", {
86
- key: 0,
87
- class: j([
88
- "",
89
- s(U)(
90
- "w-32 flex items-end justify-end bg-gradient-to-l from-white via-white to-transparent",
91
- s(t) ? "ml-auto opacity-60" : "absolute bottom-0 right-0"
92
- )
93
- ])
94
- }, [
95
- f("button", {
96
- class: "flex items-center gap-1",
97
- onClick: Z(p, ["stop"])
98
- }, [
99
- f("span", Qe, G(s(t) ? "접기" : "자세히"), 1),
100
- S(s(ke), {
101
- class: j(["w-4 h-4 transition-transform", s(t) ? "rotate-180" : ""])
102
- }, null, 8, ["class"])
103
- ])
104
- ], 2)) : le("", !0)
105
- ]));
106
- }
107
- }), ee = new Ce("bulk-spellcheck-highlight");
108
- function et(o, t, l = `
109
- `) {
110
- return new be({
111
- key: ee,
112
- props: {
113
- decorations(i) {
114
- const p = [], d = {
115
- [X.SPACING]: "bulk-highlight text-blue-500 border-b-2 border-blue-500",
116
- [X.SPELLING]: "bulk-highlight text-red-500 border-b-2 border-red-500"
117
- };
118
- return t.forEach((x) => {
119
- var N, k;
120
- const a = z(o, x.startIndex, l), r = z(o, x.endIndex - 1, l) + 1, c = (k = (N = x.errorHelpDtos) == null ? void 0 : N[0]) == null ? void 0 : k.errorType, _ = d[c ?? -1] || "bulk-highlight text-green-500 border-b-2 border-green-500", C = Math.max(0, Math.min(a, i.doc.content.size)), v = Math.max(0, Math.min(r, i.doc.content.size));
121
- C < v && p.push(ye.inline(C, v, { class: _ }));
122
- }), ve.create(i.doc, p);
123
- }
124
- }
125
- });
126
- }
127
- function J(o, t) {
128
- if (o.unregisterPlugin(ee), !t.length) return;
129
- const l = et(o, t);
130
- o.registerPlugin(l);
131
- }
132
- function tt(o) {
133
- o && o.unregisterPlugin(ee);
134
- }
135
- function ae(o, t = `
136
- `) {
137
- const l = [];
138
- let i = 0, p = !0;
139
- return o.state.doc.descendants((d, x) => {
140
- if (d.isText && d.text)
141
- for (let c = 0; c < d.text.length; c++)
142
- l[i++] = x + c;
143
- const a = d.type && d.type.name;
144
- if ((a === "hardBreak" || a === "hard_break" || a === "br") && t.length > 0)
145
- for (let c = 0; c < t.length; c++)
146
- l[i++] = x;
147
- if (d.isBlock) {
148
- if (!p && t.length > 0)
149
- for (let c = 0; c < t.length; c++)
150
- l[i++] = x;
151
- p = !1;
152
- }
153
- return !0;
154
- }), l;
155
- }
156
- function z(o, t, l = `
157
- `) {
158
- const i = ae(o, l);
159
- if (t < 0 && (t = 0), t >= i.length)
160
- return o.state.doc.content.size;
161
- const p = i[t];
162
- if (p == null) {
163
- for (let d = t; d < i.length; d++) if (i[d] != null) return i[d];
164
- for (let d = t - 1; d >= 0; d--) if (i[d] != null) return i[d];
165
- return o.state.doc.content.size;
166
- }
167
- return p;
168
- }
169
- const nt = { class: "max-h-[450px] pr-1 overflow-y-auto" }, ot = ["onClick"], st = { class: "flex items-center mb-2" }, rt = { class: "flex items-center gap-2" }, lt = { class: "break-all whitespace-normal" }, it = { class: "flex items-center mb-2" }, ct = {
170
- key: 0,
171
- class: "flex-1 space-y-1"
172
- }, at = { class: "text-sm" }, ut = ["onClick"], dt = { key: 1 }, pt = { class: "flex" }, ft = { class: "flex-1" }, gt = /* @__PURE__ */ P({
173
- __name: "BulkSpellCheckerWrongWordList",
174
- props: {
175
- editorsState: {}
176
- },
177
- setup(o) {
178
- const t = o;
179
- function l(a) {
180
- return {
181
- [X.SPACING]: "bg-blue-500",
182
- [X.SPELLING]: "bg-red-500"
183
- }[a ?? -1] || "bg-green-500";
184
- }
185
- function i(a) {
186
- var r, c, _, C;
187
- return ((C = (_ = (c = (r = a == null ? void 0 : a.extensionStorage) == null ? void 0 : r.spellchecker) == null ? void 0 : c.spellchecker) == null ? void 0 : _.uiStrings) == null ? void 0 : C.uiStrings) || "No suggestions found";
188
- }
189
- function p(a) {
190
- var r, c;
191
- if (a === H.EDITOR_COMMENT) {
192
- (r = t.editorsState[H.EDITOR_CONTENT].editor) == null || r.commands.setTextSelection(0);
193
- return;
194
- }
195
- if (a === H.EDITOR_CONTENT) {
196
- (c = t.editorsState[H.EDITOR_COMMENT].editor) == null || c.commands.setTextSelection(0);
197
- return;
198
- }
199
- }
200
- function d(a, r, c) {
201
- if (!r) return;
202
- p(a);
203
- const _ = z(r, c.startIndex), C = z(r, c.endIndex - 1) + 1;
204
- r.chain().setTextSelection({ from: _, to: C }).focus().run();
205
- const v = Math.max(0, Math.floor((_ + C) / 2)), k = r.view.domAtPos(v).node;
206
- let m = null;
207
- k instanceof Element ? m = k : k instanceof Text ? m = k.parentElement : m = (k == null ? void 0 : k.parentElement) ?? r.view.dom, m != null && m.scrollIntoView && m.scrollIntoView({ behavior: "smooth", block: "center" });
208
- }
209
- function x(a, r, c, _) {
210
- var h;
211
- if (!a) return;
212
- const C = z(a, c.startIndex), v = z(a, c.endIndex - 1) + 1, N = a.state.tr.insertText(_, C, v);
213
- a.view.dispatch(N), a.view.focus();
214
- const k = _.length - (((h = c.wrongWord) == null ? void 0 : h.length) ?? 0), m = c.startIndex, e = c.endIndex;
215
- for (let y = r.length - 1; y >= 0; y--) {
216
- const w = r[y];
217
- if (w.startIndex >= m && w.startIndex < e) {
218
- r.splice(y, 1);
219
- continue;
220
- }
221
- w.startIndex > m && (w.startIndex += k, w.endIndex += k);
222
- }
223
- const n = r.indexOf(c);
224
- n !== -1 && r.splice(n, 1), J(a, r);
225
- }
226
- return (a, r) => {
227
- const c = Ze;
228
- return g(), b("div", nt, [
229
- (g(!0), b(Y, null, q(a.editorsState, (_, C) => (g(), b(Y, { key: C }, [
230
- (g(!0), b(Y, null, q(_.wrongWords, (v, N) => {
231
- var k, m;
232
- return g(), b("div", {
233
- key: N,
234
- class: "border-b border-gray-100 pb-5 mb-5 cursor-pointer",
235
- onClick: (e) => d(C, a.editorsState[C].editor, v)
236
- }, [
237
- f("div", st, [
238
- r[0] || (r[0] = f("span", { class: "w-16 font-medium" }, "입력 내용", -1)),
239
- f("div", rt, [
240
- f("span", {
241
- class: j(["w-1.5 h-1.5 rounded-full", l((k = v.errorHelpDtos[0]) == null ? void 0 : k.errorType)])
242
- }, null, 2),
243
- f("span", lt, G(v.wrongWord), 1)
244
- ])
245
- ]),
246
- f("div", it, [
247
- r[3] || (r[3] = f("span", { class: "w-16 font-medium" }, "대치어", -1)),
248
- v.correctWord.length ? (g(), b("div", ct, [
249
- (g(!0), b(Y, null, q(v.correctWord, (e, n) => (g(), b("div", {
250
- key: n,
251
- class: "font-semibold px-3 py-1.5 rounded bg-gray-100 flex items-center justify-between"
252
- }, [
253
- f("div", at, G(e), 1),
254
- f("button", {
255
- class: "flex items-center gap-1 text-blue-500",
256
- onClick: Z((h) => x(_.editor, _.wrongWords, v, e), ["stop"])
257
- }, [
258
- S(s(Ge), { class: "w-4 h-4" }),
259
- r[1] || (r[1] = F()),
260
- r[2] || (r[2] = f("span", null, "바꾸기", -1))
261
- ], 8, ut)
262
- ]))), 128))
263
- ])) : (g(), b("div", dt, G(i(_.editor)), 1))
264
- ]),
265
- f("div", pt, [
266
- r[4] || (r[4] = f("span", { class: "w-16 font-medium" }, "도움말", -1)),
267
- f("div", ft, [
268
- S(c, {
269
- text: (m = v.errorHelpDtos[0]) == null ? void 0 : m.errorMessage
270
- }, null, 8, ["text"])
271
- ])
272
- ])
273
- ], 8, ot);
274
- }), 128))
275
- ], 64))), 128))
276
- ]);
277
- };
278
- }
279
- }), mt = {
280
- key: 0,
281
- class: "opacity-25",
282
- cx: "12",
283
- cy: "12",
284
- r: "10",
285
- fill: "#ffffff",
286
- stroke: "currentColor",
287
- "stroke-width": "4"
288
- }, ht = {
289
- key: 1,
290
- class: "opacity-25",
291
- cx: "12",
292
- cy: "12",
293
- r: "10",
294
- stroke: "currentColor",
295
- "stroke-width": "4"
296
- }, _t = /* @__PURE__ */ P({
297
- __name: "SpinnerIcon",
298
- props: {
299
- fillWhite: { type: Boolean, default: !1 },
300
- class: { default: "" }
301
- },
302
- setup(o) {
303
- const t = o;
304
- return (l, i) => (g(), b("svg", {
305
- class: j(s(U)("animate-spin h-5 w-5 mr-0.5", t.class)),
306
- viewBox: "0 0 24 24",
307
- "aria-hidden": "true"
308
- }, [
309
- l.fillWhite ? (g(), b("circle", mt)) : (g(), b("circle", ht)),
310
- i[0] || (i[0] = f("path", {
311
- class: "opacity-100",
312
- fill: "currentColor",
313
- d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
314
- }, null, -1))
315
- ], 2));
316
- }
317
- }), xt = {}, kt = { class: "min-h-[188px] flex flex-col items-center justify-center gap-y-2 text-sm" };
318
- function Ct(o, t) {
319
- const l = _t;
320
- return g(), b("div", kt, [
321
- S(l, {
322
- "fill-white": "",
323
- class: "h-10 w-10 text-blue-500"
324
- }),
325
- t[0] || (t[0] = f("div", null, "맞춤법 검사 중입니다", -1))
326
- ]);
327
- }
328
- const bt = /* @__PURE__ */ Ee(xt, [["render", Ct]]), vt = { class: "text-xs py-4 px-6" }, yt = { class: "flex items-center justify-between mt-3" }, Et = { class: "flex gap-x-1" }, St = /* @__PURE__ */ P({
329
- __name: "BulkSpellCheckerContent",
330
- props: {
331
- editorsState: {},
332
- spellCheckStatus: {},
333
- allWrongWordsMissSuggestions: { type: Boolean }
334
- },
335
- emits: ["close-modal", "run-spellcheck", "replace-all-editor-errors"],
336
- setup(o, { emit: t }) {
337
- const l = t;
338
- return (i, p) => {
339
- const d = bt, x = gt, a = Xe, r = Ye, c = Se;
340
- return g(), b("div", vt, [
341
- i.spellCheckStatus === s(W).LOADING ? (g(), B(d, { key: 0 })) : i.spellCheckStatus === s(W).HAS_ERROR ? (g(), B(x, {
342
- key: 1,
343
- editorsState: i.editorsState
344
- }, null, 8, ["editorsState"])) : i.spellCheckStatus === s(W).NO_ERROR ? (g(), B(a, { key: 2 })) : i.spellCheckStatus === s(W).FAIL ? (g(), B(r, { key: 3 })) : le("", !0),
345
- f("div", yt, [
346
- p[4] || (p[4] = He('<ul class="flex items-cente gap-x-4"><li class="flex items-center gap-x-1"><span class="w-1.5 h-1.5 rounded-full bg-red-500"></span>맞춤법</li><li class="flex items-center gap-x-1"><span class="w-1.5 h-1.5 rounded-full bg-blue-500"></span>띄어쓰기</li><li class="flex items-center gap-x-1"><span class="w-1.5 h-1.5 rounded-full bg-green-500"></span>통합교정</li></ul>', 1)),
347
- f("div", Et, [
348
- S(c, {
349
- variant: "outline",
350
- class: j(
351
- s(U)(
352
- "border-blue-500 text-blue-500 text-xs px-3 py-2 h-auto hover:bg-white/80 hover:opacity-80 hover:text-blue-500",
353
- i.spellCheckStatus === s(W).LOADING && "text-gray-300 bg-gray-100 border-gray-100 pointer-events-none"
354
- )
355
- ),
356
- onClick: p[0] || (p[0] = (_) => l("run-spellcheck"))
357
- }, {
358
- default: $(() => p[2] || (p[2] = [
359
- F("다시 검사하기")
360
- ])),
361
- _: 1
362
- }, 8, ["class"]),
363
- S(c, {
364
- class: j(
365
- s(U)(
366
- "border-blue-500 text-white text-xs px-3 py-2 h-auto bg-blue-500 hover:bg-blue-500/80",
367
- (i.spellCheckStatus !== s(W).HAS_ERROR || i.allWrongWordsMissSuggestions) && "text-gray-300 bg-gray-100 hover:bg-gray-100 pointer-events-none"
368
- )
369
- ),
370
- onClick: p[1] || (p[1] = (_) => l("replace-all-editor-errors"))
371
- }, {
372
- default: $(() => p[3] || (p[3] = [
373
- F("모두 바꾸기")
374
- ])),
375
- _: 1
376
- }, 8, ["class"])
377
- ])
378
- ])
379
- ]);
380
- };
381
- }
382
- }), wt = /* @__PURE__ */ P({
383
- __name: "DialogTrigger",
384
- props: {
385
- asChild: { type: Boolean },
386
- as: {}
387
- },
388
- setup(o) {
389
- const t = o;
390
- return (l, i) => (g(), B(s(we), Le(De(t)), {
391
- default: $(() => [
392
- Pe(l.$slots, "default")
393
- ]),
394
- _: 3
395
- }, 16));
396
- }
397
- }), Tt = () => {
398
- const o = ie({
399
- [H.EDITOR_COMMENT]: {
400
- editor: null,
401
- wrongWords: []
402
- },
403
- [H.EDITOR_CONTENT]: {
404
- editor: null,
405
- wrongWords: []
406
- }
407
- });
408
- function t(e, n) {
409
- o[e].editor = n;
410
- }
411
- const l = D(W.NO_ERROR);
412
- function i() {
413
- Object.values(o).forEach((e) => {
414
- e.wrongWords = [];
415
- });
416
- }
417
- function p(e, n) {
418
- return e ? W.FAIL : n ? W.HAS_ERROR : W.NO_ERROR;
419
- }
420
- async function d() {
421
- var h, y;
422
- l.value = W.LOADING;
423
- let e = !1, n = !1;
424
- for (const [w, { editor: M }] of Object.entries(o)) {
425
- if (!M) continue;
426
- const A = (h = M == null ? void 0 : M.extensionManager.extensions.find((O) => O.name === "spellchecker")) == null ? void 0 : h.options.proofreader.api, L = M.getText({ blockSeparator: `
427
- ` });
428
- if (!(!A || !L))
429
- try {
430
- const { data: O } = await Te.post(A, {
431
- value: L
432
- });
433
- if (!O.success && O.code !== ze.NOTHING_TO_CHANGE) {
434
- n = !0, o[w].wrongWords = [];
435
- continue;
436
- }
437
- if ((y = O.data) != null && y.wrongWordResponseDto) {
438
- e = !0, o[w].wrongWords = O.data.wrongWordResponseDto;
439
- continue;
440
- }
441
- o[w].wrongWords = [];
442
- } catch (O) {
443
- console.error("handleRunSpellCheck error: ", O), n = !0;
444
- }
445
- }
446
- l.value = p(n, e);
447
- }
448
- const x = ne(() => Object.values(o).reduce((e, { wrongWords: n }) => e + n.length, 0));
449
- ce(x, (e) => {
450
- e === 0 && (l.value = p(!1, !1));
451
- });
452
- const a = ne(() => {
453
- const e = Object.values(o).flatMap((n) => n.wrongWords);
454
- return e.length === 0 ? !1 : e.every((n) => !Array.isArray(n.correctWord) || n.correctWord.length === 0);
455
- });
456
- function r() {
457
- for (const [e, { editor: n, wrongWords: h }] of Object.entries(o))
458
- n && J(n, h);
459
- }
460
- function c() {
461
- for (const [e, { editor: n }] of Object.entries(o))
462
- n && tt(n);
463
- }
464
- async function _() {
465
- await d(), r();
466
- }
467
- let C = !0;
468
- function v(e) {
469
- if (C = e, !!e)
470
- for (const [n, { editor: h }] of Object.entries(o))
471
- h && (h.extensionStorage.spellchecker.spellchecker.setEnabledProofreadText(!1), h.view.dispatch(h.state.tr.setMeta(te.IS_ACTIVE_SPELLCHECK, !1)));
472
- }
473
- function N() {
474
- if (C)
475
- for (const [e, { editor: n }] of Object.entries(o))
476
- n && (n.extensionStorage.spellchecker.spellchecker.setEnabledProofreadText(!0), n.view.dispatch(n.state.tr.setMeta(te.IS_ACTIVE_SPELLCHECK, !0)));
477
- }
478
- function k(e, n, h = `
479
- `) {
480
- if (!e || !n.length) return;
481
- const y = ae(e, h);
482
- function w(u) {
483
- if (u < 0 && (u = 0), u >= y.length) return e.state.doc.content.size;
484
- if (y[u] != null) return y[u];
485
- for (let E = u; E < y.length; E++) if (y[E] != null) return y[E];
486
- for (let E = u - 1; E >= 0; E--) if (y[E] != null) return y[E];
487
- return e.state.doc.content.size;
488
- }
489
- const A = n.map((u) => {
490
- var V;
491
- const E = w(u.startIndex), T = w(Math.max(0, u.endIndex - 1)) + 1, I = ((V = u.correctWord) == null ? void 0 : V[0]) ?? u.wrongWord;
492
- return { item: u, from: E, to: T, replacement: I };
493
- }).filter((u) => typeof u.from == "number" && typeof u.to == "number" && u.from < u.to);
494
- if (!A.length) return;
495
- A.sort((u, E) => E.from - u.from);
496
- const L = e.state.tr;
497
- let O = Number.POSITIVE_INFINITY;
498
- const R = /* @__PURE__ */ new Set();
499
- for (const u of A)
500
- u.to > O || (L.insertText(u.replacement, u.from, u.to), R.add(u.item), O = u.from);
501
- R.size > 0 && (e.view.dispatch(L), e.view.focus()), R.size > 0 && (n = n.filter((u) => ![...R].some((E) => E === u))), J(e, n);
502
- }
503
- function m() {
504
- for (const [e, { editor: n, wrongWords: h }] of Object.entries(o))
505
- n && k(n, h);
506
- }
507
- return {
508
- editorsState: o,
509
- spellCheckStatus: l,
510
- countTotalWrongWords: x,
511
- allWrongWordsMissSuggestions: a,
512
- setEditor: t,
513
- resetAllEditorWrongWords: i,
514
- disableSpellCheckRealTime: v,
515
- resetEnableSpellCheckRealTime: N,
516
- applyAllEditorHighlightErrors: r,
517
- clearAllEditorHighlightErrors: c,
518
- reRunSpellCheckAndHighlight: _,
519
- handleRunSpellCheck: d,
520
- replaceAllEditorErrors: m
521
- };
522
- }, Ot = /* @__PURE__ */ P({
523
- __name: "BulkSpellChecker",
524
- props: {
525
- editor: {},
526
- editorComment: {},
527
- isEnableSpellCheckRealTime: { type: Boolean }
528
- },
529
- setup(o) {
530
- var u, E;
531
- const t = o, {
532
- editorsState: l,
533
- countTotalWrongWords: i,
534
- spellCheckStatus: p,
535
- allWrongWordsMissSuggestions: d,
536
- setEditor: x,
537
- disableSpellCheckRealTime: a,
538
- resetEnableSpellCheckRealTime: r,
539
- handleRunSpellCheck: c,
540
- resetAllEditorWrongWords: _,
541
- applyAllEditorHighlightErrors: C,
542
- clearAllEditorHighlightErrors: v,
543
- reRunSpellCheckAndHighlight: N,
544
- replaceAllEditorErrors: k
545
- } = Tt(), m = D(!1), e = ie({ x: 0, y: 0 }), n = D(!1), h = { x: 0, y: 0 }, y = (T) => {
546
- n.value = !0, h.x = T.clientX - e.x, h.y = T.clientY - e.y, document.addEventListener("mousemove", w), document.addEventListener("mouseup", M);
547
- }, w = (T) => {
548
- n.value && (e.x = T.clientX - h.x, e.y = T.clientY - h.y);
549
- }, M = () => {
550
- n.value = !1, document.removeEventListener("mousemove", w), document.removeEventListener("mouseup", M);
551
- };
552
- oe(() => {
553
- document.removeEventListener("mousemove", w), document.removeEventListener("mouseup", M);
554
- });
555
- const A = D(null), L = D({ top: 0, right: 0 }), O = () => {
556
- if (A.value) {
557
- const T = A.value.getBoundingClientRect();
558
- L.value = {
559
- top: T.bottom + window.scrollY + 5,
560
- right: window.innerWidth - T.right - window.scrollX
561
- }, e.x = 0, e.y = 0;
562
- }
563
- };
564
- se(async () => {
565
- t.editorComment && x(H.EDITOR_COMMENT, t.editorComment), x(H.EDITOR_CONTENT, t.editor);
566
- }), oe(() => {
567
- x(H.EDITOR_COMMENT, null), x(H.EDITOR_CONTENT, null);
568
- }), ce(m, async (T) => {
569
- T ? (await re(), O(), a(t.isEnableSpellCheckRealTime), await c(), C()) : (_(), r(), v());
570
- });
571
- const R = (E = (u = t.editor) == null ? void 0 : u.extensionManager.extensions.find((T) => T.name === "spellchecker")) == null ? void 0 : E.options.bulkSpellCheckerButton;
572
- return (T, I) => {
573
- const V = Re, ue = wt, de = Me, pe = We, fe = Ae, ge = Ne, me = $e, he = St, _e = Oe, xe = Ie;
574
- return g(), B(xe, { open: s(m) }, {
575
- default: $(() => [
576
- S(ue, { "as-child": "" }, {
577
- default: $(() => [
578
- f("div", {
579
- ref_key: "triggerRef",
580
- ref: A
581
- }, [
582
- s(R) ? (g(), B(Be(s(R).component), {
583
- key: 1,
584
- buttonName: s(R).props.buttonName,
585
- icon: s(R).props.icon,
586
- type: s(R).props.type,
587
- disabled: s(R).props.disabled,
588
- iconPosition: s(R).props.iconPosition,
589
- buttonSize: s(R).props.buttonSize,
590
- iconClass: s(R).props.iconClass,
591
- onClick: I[1] || (I[1] = (K) => m.value = !s(m))
592
- }, null, 8, ["buttonName", "icon", "type", "disabled", "iconPosition", "buttonSize", "iconClass"])) : (g(), b("button", {
593
- key: 0,
594
- class: "border-blue-500 text-white text-xs text-nowrap px-3 py-2 h-auto bg-blue-500 hover:bg-blue-500/80 flex items-center rounded",
595
- onClick: I[0] || (I[0] = (K) => m.value = !s(m))
596
- }, [
597
- S(V, { name: "checkUnderline" }),
598
- I[5] || (I[5] = F("맞춤법 일괄 교정 "))
599
- ]))
600
- ], 512)
601
- ]),
602
- _: 1
603
- }),
604
- S(_e, {
605
- "is-overlay-transparent": "",
606
- class: "p-0 gap-0 !animate-none !transition-none",
607
- "as-child": ""
608
- }, {
609
- default: $(() => [
610
- f("div", {
611
- class: "z-[70]",
612
- style: je({
613
- transform: `translate(${s(e).x}px, ${s(e).y}px)`,
614
- top: `${s(L).top}px`,
615
- right: `${s(L).right}px`,
616
- left: "auto"
617
- })
618
- }, [
619
- S(ge, {
620
- class: "bg-[#EFF6FF] py-3.5 px-6 rounded-t-[5px] cursor-move text-blue-500 flex-row items-center justify-between",
621
- onMousedown: Z(y, ["prevent"])
622
- }, {
623
- default: $(() => [
624
- S(pe, { class: "text-base space-x-2" }, {
625
- default: $(() => [
626
- I[6] || (I[6] = f("span", null, "맞춤법/문법 오류", -1)),
627
- S(de, { class: "text-sm bg-blue-500 hover:bg-blue-500 px-2" }, {
628
- default: $(() => [
629
- F(G(s(i)) + "개", 1)
630
- ]),
631
- _: 1
632
- })
633
- ]),
634
- _: 1
635
- }),
636
- S(fe, {
637
- onClick: I[2] || (I[2] = (K) => m.value = !1),
638
- class: "text-xs flex items-center gap-x-1"
639
- }, {
640
- default: $(() => [
641
- S(V, {
642
- name: "Close",
643
- class: "w-4 h-4"
644
- }),
645
- F(G(T.$t("editor.close")), 1)
646
- ]),
647
- _: 1
648
- })
649
- ]),
650
- _: 1
651
- }),
652
- S(me),
653
- S(he, {
654
- editorsState: s(l),
655
- spellCheckStatus: s(p),
656
- allWrongWordsMissSuggestions: s(d),
657
- onCloseModal: I[3] || (I[3] = (K) => m.value = !1),
658
- onRunSpellcheck: s(N),
659
- onReplaceAllEditorErrors: I[4] || (I[4] = (K) => (s(k)(), m.value = !1))
660
- }, null, 8, ["editorsState", "spellCheckStatus", "allWrongWordsMissSuggestions", "onRunSpellcheck"])
661
- ], 4)
662
- ]),
663
- _: 1
664
- })
665
- ]),
666
- _: 1
667
- }, 8, ["open"]);
668
- };
669
- }
670
- });
671
- export {
672
- Ot as default
673
- };
674
- //# sourceMappingURL=BulkSpellChecker-CbU_sVqs.mjs.map