vdc-editor 0.1.165 → 0.1.166
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/lib/BulkSpellChecker-Dbt8ssiI.mjs +657 -0
- package/lib/BulkSpellChecker-Dbt8ssiI.mjs.map +1 -0
- package/lib/index-ffOpj55k.mjs +56613 -0
- package/lib/index-ffOpj55k.mjs.map +1 -0
- package/lib/vdc-editor.mjs +1 -1
- package/lib/vdc-editor.umd.js +1 -1
- package/lib/vdc-editor.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,657 @@
|
|
|
1
|
+
import { c as Q, a as V, C as me, P as _e, b as xe, D as ke, d as Ce, _ as Ee, e as ve, o as be, f as ye, S as te, g as Se, h as we, i as Te, j as Ie, k as Re, l as Oe, m as We, n as Ne } from "./index-ffOpj55k.mjs";
|
|
2
|
+
import { defineComponent as L, createElementBlock as S, openBlock as g, createVNode as y, createElementVNode as f, unref as u, ref as $, onMounted as se, nextTick as re, createCommentVNode as le, normalizeClass as D, withModifiers as Z, toDisplayString as G, Fragment as F, renderList as q, createTextVNode as j, createBlock as P, createStaticVNode as Me, withCtx as M, normalizeProps as Ae, guardReactiveProps as He, renderSlot as $e, reactive as ie, computed as ne, watch as ce, onUnmounted as oe, normalizeStyle as Le } from "vue";
|
|
3
|
+
const K = {
|
|
4
|
+
SPACING: 1,
|
|
5
|
+
SPELLING: 2
|
|
6
|
+
}, De = {
|
|
7
|
+
NOTHING_TO_CHANGE: "NOTHING_TO_CHANGE"
|
|
8
|
+
}, O = {
|
|
9
|
+
LOADING: "loading",
|
|
10
|
+
HAS_ERROR: "hasError",
|
|
11
|
+
NO_ERROR: "noError",
|
|
12
|
+
FAIL: "fail"
|
|
13
|
+
}, A = {
|
|
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 Pe = 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 Be = 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 je = Q("CircleCheckIcon", [
|
|
47
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
48
|
+
["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
|
|
49
|
+
]), Ge = { class: "min-h-[188px] flex flex-col items-center justify-center gap-y-2 text-sm" }, ze = /* @__PURE__ */ L({
|
|
50
|
+
__name: "BulkSpellCheckerFail",
|
|
51
|
+
setup(s) {
|
|
52
|
+
return (t, l) => (g(), S("div", Ge, [
|
|
53
|
+
y(u(Be), { 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
|
+
}), Fe = { class: "min-h-[188px] flex flex-col items-center justify-center gap-y-2 text-sm" }, Ve = /* @__PURE__ */ L({
|
|
59
|
+
__name: "BulkSpellCheckerNotWrongWord",
|
|
60
|
+
setup(s) {
|
|
61
|
+
return (t, l) => (g(), S("div", Fe, [
|
|
62
|
+
y(u(je), { class: "h-12 w-12 text-blue-500" }),
|
|
63
|
+
l[0] || (l[0] = f("div", null, "맞춤법 오류가 없습니다", -1))
|
|
64
|
+
]));
|
|
65
|
+
}
|
|
66
|
+
}), Ke = { class: "relative" }, Ye = ["innerHTML"], Ue = { class: "border-b border-gray-500" }, Xe = /* @__PURE__ */ L({
|
|
67
|
+
__name: "BulkSpellCheckerHelpText",
|
|
68
|
+
props: {
|
|
69
|
+
text: {}
|
|
70
|
+
},
|
|
71
|
+
setup(s) {
|
|
72
|
+
const t = $(!1), l = $(!1), i = $(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(), S("div", Ke, [
|
|
79
|
+
f("div", {
|
|
80
|
+
ref_key: "helpRef",
|
|
81
|
+
ref: i,
|
|
82
|
+
class: D(["text-gray-700 transition-all", u(t) ? "max-h-none" : "max-h-[32px] overflow-hidden"]),
|
|
83
|
+
innerHTML: d.text
|
|
84
|
+
}, null, 10, Ye),
|
|
85
|
+
u(l) ? (g(), S("div", {
|
|
86
|
+
key: 0,
|
|
87
|
+
class: D([
|
|
88
|
+
"",
|
|
89
|
+
u(V)(
|
|
90
|
+
"w-32 flex items-end justify-end bg-gradient-to-l from-white via-white to-transparent",
|
|
91
|
+
u(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", Ue, G(u(t) ? "접기" : "자세히"), 1),
|
|
100
|
+
y(u(me), {
|
|
101
|
+
class: D(["w-4 h-4 transition-transform", u(t) ? "rotate-180" : ""])
|
|
102
|
+
}, null, 8, ["class"])
|
|
103
|
+
])
|
|
104
|
+
], 2)) : le("", !0)
|
|
105
|
+
]));
|
|
106
|
+
}
|
|
107
|
+
}), ee = new _e("bulk-spellcheck-highlight");
|
|
108
|
+
function qe(s, t, l = `
|
|
109
|
+
`) {
|
|
110
|
+
return new xe({
|
|
111
|
+
key: ee,
|
|
112
|
+
props: {
|
|
113
|
+
decorations(i) {
|
|
114
|
+
const p = [], d = {
|
|
115
|
+
[K.SPACING]: "bulk-highlight text-blue-500 border-b-2 border-blue-500",
|
|
116
|
+
[K.SPELLING]: "bulk-highlight text-red-500 border-b-2 border-red-500"
|
|
117
|
+
};
|
|
118
|
+
return t.forEach((x) => {
|
|
119
|
+
var R, k;
|
|
120
|
+
const a = B(s, x.startIndex, l), r = B(s, x.endIndex - 1, l) + 1, c = (k = (R = x.errorHelpDtos) == null ? void 0 : R[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)), E = Math.max(0, Math.min(r, i.doc.content.size));
|
|
121
|
+
C < E && p.push(Ce.inline(C, E, { class: _ }));
|
|
122
|
+
}), ke.create(i.doc, p);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function J(s, t) {
|
|
128
|
+
if (s.unregisterPlugin(ee), !t.length) return;
|
|
129
|
+
const l = qe(s, t);
|
|
130
|
+
s.registerPlugin(l);
|
|
131
|
+
}
|
|
132
|
+
function Je(s) {
|
|
133
|
+
s && s.unregisterPlugin(ee);
|
|
134
|
+
}
|
|
135
|
+
function ae(s, t = `
|
|
136
|
+
`) {
|
|
137
|
+
const l = [];
|
|
138
|
+
let i = 0, p = !0;
|
|
139
|
+
return s.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 B(s, t, l = `
|
|
157
|
+
`) {
|
|
158
|
+
const i = ae(s, l);
|
|
159
|
+
if (t < 0 && (t = 0), t >= i.length)
|
|
160
|
+
return s.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 s.state.doc.content.size;
|
|
166
|
+
}
|
|
167
|
+
return p;
|
|
168
|
+
}
|
|
169
|
+
const Qe = { class: "max-h-[450px] pr-1 overflow-y-auto" }, Ze = ["onClick"], et = { class: "flex items-center mb-2" }, tt = { class: "flex items-center gap-2" }, nt = { class: "break-all whitespace-normal" }, ot = { class: "flex items-center mb-2" }, st = {
|
|
170
|
+
key: 0,
|
|
171
|
+
class: "flex-1 space-y-1"
|
|
172
|
+
}, rt = { class: "text-sm" }, lt = ["onClick"], it = { key: 1 }, ct = { class: "flex" }, at = { class: "flex-1" }, ut = /* @__PURE__ */ L({
|
|
173
|
+
__name: "BulkSpellCheckerWrongWordList",
|
|
174
|
+
props: {
|
|
175
|
+
editorsState: {}
|
|
176
|
+
},
|
|
177
|
+
setup(s) {
|
|
178
|
+
const t = s;
|
|
179
|
+
function l(a) {
|
|
180
|
+
return {
|
|
181
|
+
[K.SPACING]: "bg-blue-500",
|
|
182
|
+
[K.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 === A.EDITOR_COMMENT) {
|
|
192
|
+
(r = t.editorsState[A.EDITOR_CONTENT].editor) == null || r.commands.setTextSelection(0);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (a === A.EDITOR_CONTENT) {
|
|
196
|
+
(c = t.editorsState[A.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 _ = B(r, c.startIndex), C = B(r, c.endIndex - 1) + 1;
|
|
204
|
+
r.chain().setTextSelection({ from: _, to: C }).focus().run();
|
|
205
|
+
const E = Math.max(0, Math.floor((_ + C) / 2)), k = r.view.domAtPos(E).node;
|
|
206
|
+
let h = null;
|
|
207
|
+
k instanceof Element ? h = k : k instanceof Text ? h = k.parentElement : h = (k == null ? void 0 : k.parentElement) ?? r.view.dom, h != null && h.scrollIntoView && h.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
208
|
+
}
|
|
209
|
+
function x(a, r, c, _) {
|
|
210
|
+
var m;
|
|
211
|
+
if (!a) return;
|
|
212
|
+
const C = B(a, c.startIndex), E = B(a, c.endIndex - 1) + 1, R = a.state.tr.insertText(_, C, E);
|
|
213
|
+
a.view.dispatch(R), a.view.focus();
|
|
214
|
+
const k = _.length - (((m = c.wrongWord) == null ? void 0 : m.length) ?? 0), h = c.startIndex, e = c.endIndex;
|
|
215
|
+
for (let v = r.length - 1; v >= 0; v--) {
|
|
216
|
+
const w = r[v];
|
|
217
|
+
if (w.startIndex >= h && w.startIndex < e) {
|
|
218
|
+
r.splice(v, 1);
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
w.startIndex > h && (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 = Xe;
|
|
228
|
+
return g(), S("div", Qe, [
|
|
229
|
+
(g(!0), S(F, null, q(a.editorsState, (_, C) => (g(), S(F, { key: C }, [
|
|
230
|
+
(g(!0), S(F, null, q(_.wrongWords, (E, R) => {
|
|
231
|
+
var k, h;
|
|
232
|
+
return g(), S("div", {
|
|
233
|
+
key: R,
|
|
234
|
+
class: "border-b border-gray-100 pb-5 mb-5 cursor-pointer",
|
|
235
|
+
onClick: (e) => d(C, a.editorsState[C].editor, E)
|
|
236
|
+
}, [
|
|
237
|
+
f("div", et, [
|
|
238
|
+
r[0] || (r[0] = f("span", { class: "w-16 font-medium" }, "입력 내용", -1)),
|
|
239
|
+
f("div", tt, [
|
|
240
|
+
f("span", {
|
|
241
|
+
class: D(["w-1.5 h-1.5 rounded-full", l((k = E.errorHelpDtos[0]) == null ? void 0 : k.errorType)])
|
|
242
|
+
}, null, 2),
|
|
243
|
+
f("span", nt, G(E.wrongWord), 1)
|
|
244
|
+
])
|
|
245
|
+
]),
|
|
246
|
+
f("div", ot, [
|
|
247
|
+
r[3] || (r[3] = f("span", { class: "w-16 font-medium" }, "대치어", -1)),
|
|
248
|
+
E.correctWord.length ? (g(), S("div", st, [
|
|
249
|
+
(g(!0), S(F, null, q(E.correctWord, (e, n) => (g(), S("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", rt, G(e), 1),
|
|
254
|
+
f("button", {
|
|
255
|
+
class: "flex items-center gap-1 text-blue-500",
|
|
256
|
+
onClick: Z((m) => x(_.editor, _.wrongWords, E, e), ["stop"])
|
|
257
|
+
}, [
|
|
258
|
+
y(u(Pe), { class: "w-4 h-4" }),
|
|
259
|
+
r[1] || (r[1] = j()),
|
|
260
|
+
r[2] || (r[2] = f("span", null, "바꾸기", -1))
|
|
261
|
+
], 8, lt)
|
|
262
|
+
]))), 128))
|
|
263
|
+
])) : (g(), S("div", it, G(i(_.editor)), 1))
|
|
264
|
+
]),
|
|
265
|
+
f("div", ct, [
|
|
266
|
+
r[4] || (r[4] = f("span", { class: "w-16 font-medium" }, "도움말", -1)),
|
|
267
|
+
f("div", at, [
|
|
268
|
+
y(c, {
|
|
269
|
+
text: (h = E.errorHelpDtos[0]) == null ? void 0 : h.errorMessage
|
|
270
|
+
}, null, 8, ["text"])
|
|
271
|
+
])
|
|
272
|
+
])
|
|
273
|
+
], 8, Ze);
|
|
274
|
+
}), 128))
|
|
275
|
+
], 64))), 128))
|
|
276
|
+
]);
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
}), dt = {
|
|
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
|
+
}, pt = {
|
|
289
|
+
key: 1,
|
|
290
|
+
class: "opacity-25",
|
|
291
|
+
cx: "12",
|
|
292
|
+
cy: "12",
|
|
293
|
+
r: "10",
|
|
294
|
+
stroke: "currentColor",
|
|
295
|
+
"stroke-width": "4"
|
|
296
|
+
}, ft = /* @__PURE__ */ L({
|
|
297
|
+
__name: "SpinnerIcon",
|
|
298
|
+
props: {
|
|
299
|
+
fillWhite: { type: Boolean, default: !1 },
|
|
300
|
+
class: { default: "" }
|
|
301
|
+
},
|
|
302
|
+
setup(s) {
|
|
303
|
+
const t = s;
|
|
304
|
+
return (l, i) => (g(), S("svg", {
|
|
305
|
+
class: D(u(V)("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(), S("circle", dt)) : (g(), S("circle", pt)),
|
|
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
|
+
}), gt = {}, ht = { class: "min-h-[188px] flex flex-col items-center justify-center gap-y-2 text-sm" };
|
|
318
|
+
function mt(s, t) {
|
|
319
|
+
const l = ft;
|
|
320
|
+
return g(), S("div", ht, [
|
|
321
|
+
y(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 _t = /* @__PURE__ */ Ee(gt, [["render", mt]]), xt = { class: "text-xs py-4 px-6" }, kt = { class: "flex items-center justify-between mt-3" }, Ct = { class: "flex gap-x-1" }, Et = /* @__PURE__ */ L({
|
|
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(s, { emit: t }) {
|
|
337
|
+
const l = t;
|
|
338
|
+
return (i, p) => {
|
|
339
|
+
const d = _t, x = ut, a = Ve, r = ze, c = ve;
|
|
340
|
+
return g(), S("div", xt, [
|
|
341
|
+
i.spellCheckStatus === u(O).LOADING ? (g(), P(d, { key: 0 })) : i.spellCheckStatus === u(O).HAS_ERROR ? (g(), P(x, {
|
|
342
|
+
key: 1,
|
|
343
|
+
editorsState: i.editorsState
|
|
344
|
+
}, null, 8, ["editorsState"])) : i.spellCheckStatus === u(O).NO_ERROR ? (g(), P(a, { key: 2 })) : i.spellCheckStatus === u(O).FAIL ? (g(), P(r, { key: 3 })) : le("", !0),
|
|
345
|
+
f("div", kt, [
|
|
346
|
+
p[4] || (p[4] = Me('<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", Ct, [
|
|
348
|
+
y(c, {
|
|
349
|
+
variant: "outline",
|
|
350
|
+
class: D(
|
|
351
|
+
u(V)(
|
|
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 === u(O).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: M(() => p[2] || (p[2] = [
|
|
359
|
+
j("다시 검사하기")
|
|
360
|
+
])),
|
|
361
|
+
_: 1
|
|
362
|
+
}, 8, ["class"]),
|
|
363
|
+
y(c, {
|
|
364
|
+
class: D(
|
|
365
|
+
u(V)(
|
|
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 !== u(O).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: M(() => p[3] || (p[3] = [
|
|
373
|
+
j("모두 바꾸기")
|
|
374
|
+
])),
|
|
375
|
+
_: 1
|
|
376
|
+
}, 8, ["class"])
|
|
377
|
+
])
|
|
378
|
+
])
|
|
379
|
+
]);
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
}), vt = /* @__PURE__ */ L({
|
|
383
|
+
__name: "DialogTrigger",
|
|
384
|
+
props: {
|
|
385
|
+
asChild: { type: Boolean },
|
|
386
|
+
as: {}
|
|
387
|
+
},
|
|
388
|
+
setup(s) {
|
|
389
|
+
const t = s;
|
|
390
|
+
return (l, i) => (g(), P(u(be), Ae(He(t)), {
|
|
391
|
+
default: M(() => [
|
|
392
|
+
$e(l.$slots, "default")
|
|
393
|
+
]),
|
|
394
|
+
_: 3
|
|
395
|
+
}, 16));
|
|
396
|
+
}
|
|
397
|
+
}), bt = () => {
|
|
398
|
+
const s = ie({
|
|
399
|
+
[A.EDITOR_COMMENT]: {
|
|
400
|
+
editor: null,
|
|
401
|
+
wrongWords: []
|
|
402
|
+
},
|
|
403
|
+
[A.EDITOR_CONTENT]: {
|
|
404
|
+
editor: null,
|
|
405
|
+
wrongWords: []
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
function t(e, n) {
|
|
409
|
+
s[e].editor = n;
|
|
410
|
+
}
|
|
411
|
+
const l = $(O.NO_ERROR);
|
|
412
|
+
function i() {
|
|
413
|
+
Object.values(s).forEach((e) => {
|
|
414
|
+
e.wrongWords = [];
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
function p(e, n) {
|
|
418
|
+
return e ? O.FAIL : n ? O.HAS_ERROR : O.NO_ERROR;
|
|
419
|
+
}
|
|
420
|
+
async function d() {
|
|
421
|
+
var m, v;
|
|
422
|
+
l.value = O.LOADING;
|
|
423
|
+
let e = !1, n = !1;
|
|
424
|
+
for (const [w, { editor: W }] of Object.entries(s)) {
|
|
425
|
+
if (!W) continue;
|
|
426
|
+
const N = (m = W == null ? void 0 : W.extensionManager.extensions.find((I) => I.name === "spellchecker")) == null ? void 0 : m.options.proofreader.api, H = W.getText({ blockSeparator: `
|
|
427
|
+
` });
|
|
428
|
+
if (!(!N || !H))
|
|
429
|
+
try {
|
|
430
|
+
const { data: I } = await ye.post(N, {
|
|
431
|
+
value: H
|
|
432
|
+
});
|
|
433
|
+
if (!I.success && I.code !== De.NOTHING_TO_CHANGE) {
|
|
434
|
+
n = !0, s[w].wrongWords = [];
|
|
435
|
+
continue;
|
|
436
|
+
}
|
|
437
|
+
if ((v = I.data) != null && v.wrongWordResponseDto) {
|
|
438
|
+
e = !0, s[w].wrongWords = I.data.wrongWordResponseDto;
|
|
439
|
+
continue;
|
|
440
|
+
}
|
|
441
|
+
s[w].wrongWords = [];
|
|
442
|
+
} catch (I) {
|
|
443
|
+
console.error("handleRunSpellCheck error: ", I), n = !0;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
l.value = p(n, e);
|
|
447
|
+
}
|
|
448
|
+
const x = ne(() => Object.values(s).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(s).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: m }] of Object.entries(s))
|
|
458
|
+
n && J(n, m);
|
|
459
|
+
}
|
|
460
|
+
function c() {
|
|
461
|
+
for (const [e, { editor: n }] of Object.entries(s))
|
|
462
|
+
n && Je(n);
|
|
463
|
+
}
|
|
464
|
+
async function _() {
|
|
465
|
+
await d(), r();
|
|
466
|
+
}
|
|
467
|
+
let C = !0;
|
|
468
|
+
function E(e) {
|
|
469
|
+
if (C = e, !!e)
|
|
470
|
+
for (const [n, { editor: m }] of Object.entries(s))
|
|
471
|
+
m && (m.extensionStorage.spellchecker.spellchecker.setEnabledProofreadText(!1), m.view.dispatch(m.state.tr.setMeta(te.IS_ACTIVE_SPELLCHECK, !1)));
|
|
472
|
+
}
|
|
473
|
+
function R() {
|
|
474
|
+
if (C)
|
|
475
|
+
for (const [e, { editor: n }] of Object.entries(s))
|
|
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, m = `
|
|
479
|
+
`) {
|
|
480
|
+
if (!e || !n.length) return;
|
|
481
|
+
const v = ae(e, m);
|
|
482
|
+
function w(o) {
|
|
483
|
+
if (o < 0 && (o = 0), o >= v.length) return e.state.doc.content.size;
|
|
484
|
+
if (v[o] != null) return v[o];
|
|
485
|
+
for (let b = o; b < v.length; b++) if (v[b] != null) return v[b];
|
|
486
|
+
for (let b = o - 1; b >= 0; b--) if (v[b] != null) return v[b];
|
|
487
|
+
return e.state.doc.content.size;
|
|
488
|
+
}
|
|
489
|
+
const N = n.map((o) => {
|
|
490
|
+
var z;
|
|
491
|
+
const b = w(o.startIndex), Y = w(Math.max(0, o.endIndex - 1)) + 1, U = ((z = o.correctWord) == null ? void 0 : z[0]) ?? o.wrongWord;
|
|
492
|
+
return { item: o, from: b, to: Y, replacement: U };
|
|
493
|
+
}).filter((o) => typeof o.from == "number" && typeof o.to == "number" && o.from < o.to);
|
|
494
|
+
if (!N.length) return;
|
|
495
|
+
N.sort((o, b) => b.from - o.from);
|
|
496
|
+
const H = e.state.tr;
|
|
497
|
+
let I = Number.POSITIVE_INFINITY;
|
|
498
|
+
const T = /* @__PURE__ */ new Set();
|
|
499
|
+
for (const o of N)
|
|
500
|
+
o.to > I || (H.insertText(o.replacement, o.from, o.to), T.add(o.item), I = o.from);
|
|
501
|
+
T.size > 0 && (e.view.dispatch(H), e.view.focus()), T.size > 0 && (n = n.filter((o) => ![...T].some((b) => b === o))), J(e, n);
|
|
502
|
+
}
|
|
503
|
+
function h() {
|
|
504
|
+
for (const [e, { editor: n, wrongWords: m }] of Object.entries(s))
|
|
505
|
+
n && k(n, m);
|
|
506
|
+
}
|
|
507
|
+
return {
|
|
508
|
+
editorsState: s,
|
|
509
|
+
spellCheckStatus: l,
|
|
510
|
+
countTotalWrongWords: x,
|
|
511
|
+
allWrongWordsMissSuggestions: a,
|
|
512
|
+
setEditor: t,
|
|
513
|
+
resetAllEditorWrongWords: i,
|
|
514
|
+
disableSpellCheckRealTime: E,
|
|
515
|
+
resetEnableSpellCheckRealTime: R,
|
|
516
|
+
applyAllEditorHighlightErrors: r,
|
|
517
|
+
clearAllEditorHighlightErrors: c,
|
|
518
|
+
reRunSpellCheckAndHighlight: _,
|
|
519
|
+
handleRunSpellCheck: d,
|
|
520
|
+
replaceAllEditorErrors: h
|
|
521
|
+
};
|
|
522
|
+
}, wt = /* @__PURE__ */ L({
|
|
523
|
+
__name: "BulkSpellChecker",
|
|
524
|
+
props: {
|
|
525
|
+
editor: {},
|
|
526
|
+
editorComment: {},
|
|
527
|
+
isEnableSpellCheckRealTime: { type: Boolean }
|
|
528
|
+
},
|
|
529
|
+
setup(s) {
|
|
530
|
+
const t = s, {
|
|
531
|
+
editorsState: l,
|
|
532
|
+
countTotalWrongWords: i,
|
|
533
|
+
spellCheckStatus: p,
|
|
534
|
+
allWrongWordsMissSuggestions: d,
|
|
535
|
+
setEditor: x,
|
|
536
|
+
disableSpellCheckRealTime: a,
|
|
537
|
+
resetEnableSpellCheckRealTime: r,
|
|
538
|
+
handleRunSpellCheck: c,
|
|
539
|
+
resetAllEditorWrongWords: _,
|
|
540
|
+
applyAllEditorHighlightErrors: C,
|
|
541
|
+
clearAllEditorHighlightErrors: E,
|
|
542
|
+
reRunSpellCheckAndHighlight: R,
|
|
543
|
+
replaceAllEditorErrors: k
|
|
544
|
+
} = bt(), h = $(!1), e = ie({ x: 0, y: 0 }), n = $(!1), m = { x: 0, y: 0 }, v = (T) => {
|
|
545
|
+
n.value = !0, m.x = T.clientX - e.x, m.y = T.clientY - e.y, document.addEventListener("mousemove", w), document.addEventListener("mouseup", W);
|
|
546
|
+
}, w = (T) => {
|
|
547
|
+
n.value && (e.x = T.clientX - m.x, e.y = T.clientY - m.y);
|
|
548
|
+
}, W = () => {
|
|
549
|
+
n.value = !1, document.removeEventListener("mousemove", w), document.removeEventListener("mouseup", W);
|
|
550
|
+
};
|
|
551
|
+
oe(() => {
|
|
552
|
+
document.removeEventListener("mousemove", w), document.removeEventListener("mouseup", W);
|
|
553
|
+
});
|
|
554
|
+
const N = $(null), H = $({ top: 0, right: 0 }), I = () => {
|
|
555
|
+
if (N.value) {
|
|
556
|
+
const T = N.value.getBoundingClientRect();
|
|
557
|
+
H.value = {
|
|
558
|
+
top: T.bottom + window.scrollY + 5,
|
|
559
|
+
right: window.innerWidth - T.right - window.scrollX
|
|
560
|
+
}, e.x = 0, e.y = 0;
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
return se(async () => {
|
|
564
|
+
t.editorComment && x(A.EDITOR_COMMENT, t.editorComment), x(A.EDITOR_CONTENT, t.editor);
|
|
565
|
+
}), oe(() => {
|
|
566
|
+
x(A.EDITOR_COMMENT, null), x(A.EDITOR_CONTENT, null);
|
|
567
|
+
}), ce(h, async (T) => {
|
|
568
|
+
T ? (await re(), I(), a(t.isEnableSpellCheckRealTime), await c(), C()) : (_(), r(), E());
|
|
569
|
+
}), (T, o) => {
|
|
570
|
+
const b = we, Y = vt, U = Oe, z = Re, ue = We, de = Ie, pe = Ne, fe = Et, ge = Te, he = Se;
|
|
571
|
+
return g(), P(he, { open: u(h) }, {
|
|
572
|
+
default: M(() => [
|
|
573
|
+
y(Y, { "as-child": "" }, {
|
|
574
|
+
default: M(() => [
|
|
575
|
+
f("button", {
|
|
576
|
+
ref_key: "triggerRef",
|
|
577
|
+
ref: N,
|
|
578
|
+
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",
|
|
579
|
+
onClick: o[0] || (o[0] = (X) => h.value = !u(h))
|
|
580
|
+
}, [
|
|
581
|
+
y(b, { name: "checkUnderline" }),
|
|
582
|
+
o[4] || (o[4] = j("맞춤법 일괄 교정 "))
|
|
583
|
+
], 512)
|
|
584
|
+
]),
|
|
585
|
+
_: 1
|
|
586
|
+
}),
|
|
587
|
+
y(ge, {
|
|
588
|
+
"is-overlay-transparent": "",
|
|
589
|
+
class: "p-0 gap-0 !animate-none !transition-none",
|
|
590
|
+
"as-child": ""
|
|
591
|
+
}, {
|
|
592
|
+
default: M(() => [
|
|
593
|
+
f("div", {
|
|
594
|
+
class: "z-[70]",
|
|
595
|
+
style: Le({
|
|
596
|
+
transform: `translate(${u(e).x}px, ${u(e).y}px)`,
|
|
597
|
+
top: `${u(H).top}px`,
|
|
598
|
+
right: `${u(H).right}px`,
|
|
599
|
+
left: "auto"
|
|
600
|
+
})
|
|
601
|
+
}, [
|
|
602
|
+
y(de, {
|
|
603
|
+
class: "bg-[#EFF6FF] py-3.5 px-6 rounded-t-[5px] cursor-move text-blue-500 flex-row items-center justify-between",
|
|
604
|
+
onMousedown: Z(v, ["prevent"])
|
|
605
|
+
}, {
|
|
606
|
+
default: M(() => [
|
|
607
|
+
y(z, { class: "text-base space-x-2" }, {
|
|
608
|
+
default: M(() => [
|
|
609
|
+
o[5] || (o[5] = f("span", null, "맞춤법/문법 오류", -1)),
|
|
610
|
+
y(U, { class: "text-sm bg-blue-500 hover:bg-blue-500 px-2" }, {
|
|
611
|
+
default: M(() => [
|
|
612
|
+
j(G(u(i)) + "개", 1)
|
|
613
|
+
]),
|
|
614
|
+
_: 1
|
|
615
|
+
})
|
|
616
|
+
]),
|
|
617
|
+
_: 1
|
|
618
|
+
}),
|
|
619
|
+
y(ue, {
|
|
620
|
+
onClick: o[1] || (o[1] = (X) => h.value = !1),
|
|
621
|
+
class: "text-xs flex items-center gap-x-1"
|
|
622
|
+
}, {
|
|
623
|
+
default: M(() => [
|
|
624
|
+
y(b, {
|
|
625
|
+
name: "Close",
|
|
626
|
+
class: "w-4 h-4"
|
|
627
|
+
}),
|
|
628
|
+
o[6] || (o[6] = j("닫기 "))
|
|
629
|
+
]),
|
|
630
|
+
_: 1
|
|
631
|
+
})
|
|
632
|
+
]),
|
|
633
|
+
_: 1
|
|
634
|
+
}),
|
|
635
|
+
y(pe),
|
|
636
|
+
y(fe, {
|
|
637
|
+
editorsState: u(l),
|
|
638
|
+
spellCheckStatus: u(p),
|
|
639
|
+
allWrongWordsMissSuggestions: u(d),
|
|
640
|
+
onCloseModal: o[2] || (o[2] = (X) => h.value = !1),
|
|
641
|
+
onRunSpellcheck: u(R),
|
|
642
|
+
onReplaceAllEditorErrors: o[3] || (o[3] = (X) => (u(k)(), h.value = !1))
|
|
643
|
+
}, null, 8, ["editorsState", "spellCheckStatus", "allWrongWordsMissSuggestions", "onRunSpellcheck"])
|
|
644
|
+
], 4)
|
|
645
|
+
]),
|
|
646
|
+
_: 1
|
|
647
|
+
})
|
|
648
|
+
]),
|
|
649
|
+
_: 1
|
|
650
|
+
}, 8, ["open"]);
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
});
|
|
654
|
+
export {
|
|
655
|
+
wt as default
|
|
656
|
+
};
|
|
657
|
+
//# sourceMappingURL=BulkSpellChecker-Dbt8ssiI.mjs.map
|