@opentiny/tiny-robot 0.5.2-alpha.1 → 0.5.2-alpha.14

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.
@@ -1,992 +1,68 @@
1
- import { defineComponent as Z, openBlock as M, createBlock as U, unref as k, withCtx as j, createTextVNode as ln, toDisplayString as pe, ref as F, watch as K, createElementBlock as P, Fragment as Ie, renderList as Be, withModifiers as nt, normalizeClass as Q, createCommentVNode as q, createElementVNode as B, nextTick as me, isRef as ke, Transition as an, normalizeStyle as cn, createVNode as se, toRaw as un, computed as R, onMounted as dn, onUnmounted as fn, Teleport as pn, toRef as De, onBeforeUnmount as mn, shallowReactive as hn, toValue as gn, provide as xn, renderSlot as D, createSlots as $e, normalizeProps as he, guardReactiveProps as ge } from "vue";
2
- import { a as yn, u as Pe, W as Rt, D as Pt } from "../index2.js";
3
- import { NodeViewWrapper as lt, VueRenderer as Ot, VueNodeViewRenderer as at, NodeViewContent as bn, useEditor as vn, EditorContent as Tn } from "@tiptap/vue-3";
4
- import En from "@tiptap/extension-document";
5
- import wn from "@tiptap/extension-paragraph";
6
- import Cn from "@tiptap/extension-text";
7
- import An from "@tiptap/extension-history";
8
- import Sn from "@tiptap/extension-placeholder";
9
- import _n from "@tiptap/extension-character-count";
10
- import { h as Ln, j as kn, p as Mn } from "../index4.js";
11
- import { PluginKey as re, Plugin as ie, TextSelection as O } from "@tiptap/pm/state";
12
- import { DecorationSet as Le, Decoration as Dt } from "@tiptap/pm/view";
13
- import { _ as J } from "../_plugin-vue_export-helper.js";
14
- import { IconAssociate as Rn, IconArrowDown as Pn } from "@opentiny/tiny-robot-svgs";
15
- import { s as On } from "../useSenderContentRegistration.js";
16
- import { Node as ct, mergeAttributes as ut, Extension as It } from "@tiptap/core";
17
- const Dn = /* @__PURE__ */ Z({
1
+ import { defineComponent as X, openBlock as w, createBlock as U, unref as A, withCtx as B, createTextVNode as ot, toDisplayString as ne, ref as W, watch as K, createElementBlock as P, Fragment as fe, renderList as pe, withModifiers as ye, normalizeClass as V, createCommentVNode as N, createElementVNode as R, nextTick as oe, isRef as ce, Transition as st, normalizeStyle as rt, createVNode as Y, toRaw as it, computed as M, onMounted as at, onUnmounted as lt, Teleport as ct, toRef as de, onBeforeUnmount as ut, shallowReactive as dt, toValue as ft, provide as pt, renderSlot as O, createSlots as me, normalizeProps as z, guardReactiveProps as F } from "vue";
2
+ import { a as mt, u as ue, W as Ke, D as qe } from "../index2.js";
3
+ import { NodeViewWrapper as Ee, VueRenderer as Ne, VueNodeViewRenderer as _e, NodeViewContent as ht, useEditor as gt, EditorContent as xt } from "@tiptap/vue-3";
4
+ import bt from "@tiptap/extension-document";
5
+ import yt from "@tiptap/extension-paragraph";
6
+ import Tt from "@tiptap/extension-text";
7
+ import vt from "@tiptap/extension-history";
8
+ import Et from "@tiptap/extension-placeholder";
9
+ import _t from "@tiptap/extension-character-count";
10
+ import { h as St, j as Ct, p as At } from "../index4.js";
11
+ import { PluginKey as J, Plugin as Q, TextSelection as D } from "@tiptap/pm/state";
12
+ import { DecorationSet as le, Decoration as He } from "@tiptap/pm/view";
13
+ import { a as Se, c as Ce, o as Ae, f as we, s as ke } from "../floating-ui.dom.js";
14
+ import { _ as Z } from "../_plugin-vue_export-helper.js";
15
+ import { IconAssociate as wt, IconArrowDown as kt } from "@opentiny/tiny-robot-svgs";
16
+ import { s as Lt } from "../useSenderContentRegistration.js";
17
+ import { Node as Le, mergeAttributes as Me, Extension as We } from "@tiptap/core";
18
+ import { u as Mt } from "../useTeleportTarget.js";
19
+ const Pt = /* @__PURE__ */ X({
18
20
  __name: "mention-view",
19
21
  props: {
20
22
  node: {},
21
23
  extension: {}
22
24
  },
23
25
  setup(e) {
24
- return (t, n) => (M(), U(k(lt), {
26
+ return (t, o) => (w(), U(A(Ee), {
25
27
  as: "span",
26
28
  class: "mention",
27
29
  "data-id": e.node.attrs.id,
28
30
  "data-value": e.node.attrs.value
29
31
  }, {
30
- default: j(() => [
31
- ln(pe(e.extension.options.char) + pe(e.node.attrs.label), 1)
32
+ default: B(() => [
33
+ ot(ne(e.extension.options.char) + ne(e.node.attrs.label), 1)
32
34
  ]),
33
35
  _: 1
34
36
  }, 8, ["data-id", "data-value"]));
35
37
  }
36
- }), In = /* @__PURE__ */ J(Dn, [["__scopeId", "data-v-b42c4fae"]]), je = Math.min, fe = Math.max, Ne = Math.round, Oe = Math.floor, ee = (e) => ({
37
- x: e,
38
- y: e
39
- }), Bn = {
40
- left: "right",
41
- right: "left",
42
- bottom: "top",
43
- top: "bottom"
44
- };
45
- function $n(e, t, n) {
46
- return fe(e, je(t, n));
47
- }
48
- function Fe(e, t) {
49
- return typeof e == "function" ? e(t) : e;
50
- }
51
- function Ee(e) {
52
- return e.split("-")[0];
53
- }
54
- function Ve(e) {
55
- return e.split("-")[1];
56
- }
57
- function Bt(e) {
58
- return e === "x" ? "y" : "x";
59
- }
60
- function $t(e) {
61
- return e === "y" ? "height" : "width";
62
- }
63
- function oe(e) {
64
- const t = e[0];
65
- return t === "t" || t === "b" ? "y" : "x";
66
- }
67
- function jt(e) {
68
- return Bt(oe(e));
69
- }
70
- function jn(e, t, n) {
71
- n === void 0 && (n = !1);
72
- const s = Ve(e), r = jt(e), o = $t(r);
73
- let l = r === "x" ? s === (n ? "end" : "start") ? "right" : "left" : s === "start" ? "bottom" : "top";
74
- return t.reference[o] > t.floating[o] && (l = We(l)), [l, We(l)];
75
- }
76
- function Nn(e) {
77
- const t = We(e);
78
- return [ot(e), t, ot(t)];
79
- }
80
- function ot(e) {
81
- return e.includes("start") ? e.replace("start", "end") : e.replace("end", "start");
82
- }
83
- const vt = ["left", "right"], Tt = ["right", "left"], Wn = ["top", "bottom"], Kn = ["bottom", "top"];
84
- function qn(e, t, n) {
85
- switch (e) {
86
- case "top":
87
- case "bottom":
88
- return n ? t ? Tt : vt : t ? vt : Tt;
89
- case "left":
90
- case "right":
91
- return t ? Wn : Kn;
92
- default:
93
- return [];
94
- }
95
- }
96
- function Hn(e, t, n, s) {
97
- const r = Ve(e);
98
- let o = qn(Ee(e), n === "start", s);
99
- return r && (o = o.map((l) => l + "-" + r), t && (o = o.concat(o.map(ot)))), o;
100
- }
101
- function We(e) {
102
- const t = Ee(e);
103
- return Bn[t] + e.slice(t.length);
104
- }
105
- function zn(e) {
106
- var t, n, s, r;
107
- return {
108
- top: (t = e.top) != null ? t : 0,
109
- right: (n = e.right) != null ? n : 0,
110
- bottom: (s = e.bottom) != null ? s : 0,
111
- left: (r = e.left) != null ? r : 0
112
- };
113
- }
114
- function Fn(e) {
115
- return typeof e != "number" ? zn(e) : {
116
- top: e,
117
- right: e,
118
- bottom: e,
119
- left: e
120
- };
121
- }
122
- function Ke(e) {
123
- const {
124
- x: t,
125
- y: n,
126
- width: s,
127
- height: r
128
- } = e;
129
- return {
130
- width: s,
131
- height: r,
132
- top: n,
133
- left: t,
134
- right: t + s,
135
- bottom: n + r,
136
- x: t,
137
- y: n
138
- };
139
- }
140
- function Et(e, t, n) {
141
- let {
142
- reference: s,
143
- floating: r
144
- } = e;
145
- const o = oe(t), l = jt(t), i = $t(l), a = Ee(t), c = o === "y", d = s.x + s.width / 2 - r.width / 2, u = s.y + s.height / 2 - r.height / 2, g = s[i] / 2 - r[i] / 2;
146
- let h;
147
- switch (a) {
148
- case "top":
149
- h = {
150
- x: d,
151
- y: s.y - r.height
152
- };
153
- break;
154
- case "bottom":
155
- h = {
156
- x: d,
157
- y: s.y + s.height
158
- };
159
- break;
160
- case "right":
161
- h = {
162
- x: s.x + s.width,
163
- y: u
164
- };
165
- break;
166
- case "left":
167
- h = {
168
- x: s.x - r.width,
169
- y: u
170
- };
171
- break;
172
- default:
173
- h = {
174
- x: s.x,
175
- y: s.y
176
- };
177
- }
178
- const E = Ve(t);
179
- return E && (h[l] += g * (E === "end" ? 1 : -1) * (n && c ? -1 : 1)), h;
180
- }
181
- async function Vn(e, t) {
182
- var n;
183
- t === void 0 && (t = {});
184
- const {
185
- x: s,
186
- y: r,
187
- platform: o,
188
- rects: l,
189
- elements: i,
190
- strategy: a
191
- } = e, {
192
- boundary: c = "clippingAncestors",
193
- rootBoundary: d = "viewport",
194
- elementContext: u = "floating",
195
- altBoundary: g = !1,
196
- padding: h = 0
197
- } = Fe(t, e), E = Fn(h), T = i[g ? u === "floating" ? "reference" : "floating" : u], m = Ke(await o.getClippingRect({
198
- element: (n = await (o.isElement == null ? void 0 : o.isElement(T))) == null || n ? T : T.contextElement || await (o.getDocumentElement == null ? void 0 : o.getDocumentElement(i.floating)),
199
- boundary: c,
200
- rootBoundary: d,
201
- strategy: a
202
- })), y = u === "floating" ? {
203
- x: s,
204
- y: r,
205
- width: l.floating.width,
206
- height: l.floating.height
207
- } : l.reference, p = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(i.floating)), f = await (o.isElement == null ? void 0 : o.isElement(p)) && await (o.getScale == null ? void 0 : o.getScale(p)) || {
208
- x: 1,
209
- y: 1
210
- }, x = Ke(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
211
- elements: i,
212
- rect: y,
213
- offsetParent: p,
214
- strategy: a
215
- }) : y);
216
- return {
217
- top: (m.top - x.top + E.top) / f.y,
218
- bottom: (x.bottom - m.bottom + E.bottom) / f.y,
219
- left: (m.left - x.left + E.left) / f.x,
220
- right: (x.right - m.right + E.right) / f.x
221
- };
222
- }
223
- const Gn = 50, Un = async (e, t, n) => {
224
- const {
225
- placement: s = "bottom",
226
- strategy: r = "absolute",
227
- middleware: o = [],
228
- platform: l
229
- } = n, i = l.detectOverflow ? l : {
230
- ...l,
231
- detectOverflow: Vn
232
- }, a = await (l.isRTL == null ? void 0 : l.isRTL(t));
233
- let c = await l.getElementRects({
234
- reference: e,
235
- floating: t,
236
- strategy: r
237
- }), {
238
- x: d,
239
- y: u
240
- } = Et(c, s, a), g = s, h = 0;
241
- const E = {};
242
- for (let w = 0; w < o.length; w++) {
243
- const T = o[w];
244
- if (!T)
245
- continue;
246
- const {
247
- name: m,
248
- fn: y
249
- } = T, {
250
- x: p,
251
- y: f,
252
- data: x,
253
- reset: v
254
- } = await y({
255
- x: d,
256
- y: u,
257
- initialPlacement: s,
258
- placement: g,
259
- strategy: r,
260
- middlewareData: E,
261
- rects: c,
262
- platform: i,
263
- elements: {
264
- reference: e,
265
- floating: t
266
- }
267
- });
268
- d = p ?? d, u = f ?? u, E[m] = {
269
- ...E[m],
270
- ...x
271
- }, v && h < Gn && (h++, typeof v == "object" && (v.placement && (g = v.placement), v.rects && (c = v.rects === !0 ? await l.getElementRects({
272
- reference: e,
273
- floating: t,
274
- strategy: r
275
- }) : v.rects), {
276
- x: d,
277
- y: u
278
- } = Et(c, g, a)), w = -1);
279
- }
280
- return {
281
- x: d,
282
- y: u,
283
- placement: g,
284
- strategy: r,
285
- middlewareData: E
286
- };
287
- }, Xn = function(e) {
288
- return e === void 0 && (e = {}), {
289
- name: "flip",
290
- options: e,
291
- async fn(t) {
292
- var n, s;
293
- const {
294
- placement: r,
295
- middlewareData: o,
296
- rects: l,
297
- initialPlacement: i,
298
- platform: a,
299
- elements: c
300
- } = t, {
301
- mainAxis: d = !0,
302
- crossAxis: u = !0,
303
- fallbackPlacements: g,
304
- fallbackStrategy: h = "bestFit",
305
- fallbackAxisSideDirection: E = "none",
306
- flipAlignment: w = !0,
307
- ...T
308
- } = Fe(e, t);
309
- if ((n = o.arrow) != null && n.alignmentOffset)
310
- return {};
311
- const m = Ee(r), y = oe(i), p = Ee(i) === i, f = await (a.isRTL == null ? void 0 : a.isRTL(c.floating)), x = g || (p || !w ? [We(i)] : Nn(i)), v = E !== "none";
312
- !g && v && x.push(...Hn(i, w, E, f));
313
- const S = [i, ...x], _ = await a.detectOverflow(t, T), b = [];
314
- let L = ((s = o.flip) == null ? void 0 : s.overflows) || [];
315
- if (d && b.push(_[m]), u) {
316
- const V = jn(r, l, f);
317
- b.push(_[V[0]], _[V[1]]);
318
- }
319
- if (L = [...L, {
320
- placement: r,
321
- overflows: b
322
- }], !b.every((V) => V <= 0)) {
323
- var $, N;
324
- const V = ((($ = o.flip) == null ? void 0 : $.index) || 0) + 1, Je = S[V];
325
- if (Je && (!(u === "alignment" ? y !== oe(Je) : !1) || // We leave the current main axis only if every placement on that axis
326
- // overflows the main axis.
327
- L.every((H) => oe(H.placement) === y ? H.overflows[0] > 0 : !0)))
328
- return {
329
- data: {
330
- index: V,
331
- overflows: L
332
- },
333
- reset: {
334
- placement: Je
335
- }
336
- };
337
- let _e = (N = L.filter((ce) => ce.overflows[0] <= 0).sort((ce, H) => ce.overflows[1] - H.overflows[1])[0]) == null ? void 0 : N.placement;
338
- if (!_e)
339
- switch (h) {
340
- case "bestFit": {
341
- var Se;
342
- const ce = (Se = L.filter((H) => {
343
- if (v) {
344
- const ne = oe(H.placement);
345
- return ne === y || // Create a bias to the `y` side axis due to horizontal
346
- // reading directions favoring greater width.
347
- ne === "y";
348
- }
349
- return !0;
350
- }).map((H) => [H.placement, H.overflows.filter((ne) => ne > 0).reduce((ne, rn) => ne + rn, 0)]).sort((H, ne) => H[1] - ne[1])[0]) == null ? void 0 : Se[0];
351
- ce && (_e = ce);
352
- break;
353
- }
354
- case "initialPlacement":
355
- _e = i;
356
- break;
357
- }
358
- if (r !== _e)
359
- return {
360
- reset: {
361
- placement: _e
362
- }
363
- };
364
- }
365
- return {};
366
- }
367
- };
368
- }, Yn = /* @__PURE__ */ new Set(["left", "top"]);
369
- async function Zn(e, t) {
370
- const {
371
- placement: n,
372
- platform: s,
373
- elements: r
374
- } = e, o = await (s.isRTL == null ? void 0 : s.isRTL(r.floating)), l = Ee(n), i = Ve(n), a = oe(n) === "y", c = Yn.has(l) ? -1 : 1, d = o && a ? -1 : 1, u = Fe(t, e);
375
- let {
376
- mainAxis: g,
377
- crossAxis: h,
378
- alignmentAxis: E
379
- } = typeof u == "number" ? {
380
- mainAxis: u,
381
- crossAxis: 0,
382
- alignmentAxis: null
383
- } : {
384
- mainAxis: u.mainAxis || 0,
385
- crossAxis: u.crossAxis || 0,
386
- alignmentAxis: u.alignmentAxis
387
- };
388
- return i && typeof E == "number" && (h = i === "end" ? E * -1 : E), a ? {
389
- x: h * d,
390
- y: g * c
391
- } : {
392
- x: g * c,
393
- y: h * d
394
- };
395
- }
396
- const Jn = function(e) {
397
- return e === void 0 && (e = 0), {
398
- name: "offset",
399
- options: e,
400
- async fn(t) {
401
- var n, s;
402
- const {
403
- x: r,
404
- y: o,
405
- placement: l,
406
- middlewareData: i
407
- } = t, a = await Zn(t, e);
408
- return l === ((n = i.offset) == null ? void 0 : n.placement) && (s = i.arrow) != null && s.alignmentOffset ? {} : {
409
- x: r + a.x,
410
- y: o + a.y,
411
- data: {
412
- ...a,
413
- placement: l
414
- }
415
- };
416
- }
417
- };
418
- }, Qn = function(e) {
419
- return e === void 0 && (e = {}), {
420
- name: "shift",
421
- options: e,
422
- async fn(t) {
423
- const {
424
- x: n,
425
- y: s,
426
- placement: r,
427
- platform: o
428
- } = t, {
429
- mainAxis: l = !0,
430
- crossAxis: i = !1,
431
- limiter: a = {
432
- fn: (y) => {
433
- let {
434
- x: p,
435
- y: f
436
- } = y;
437
- return {
438
- x: p,
439
- y: f
440
- };
441
- }
442
- },
443
- ...c
444
- } = Fe(e, t), d = {
445
- x: n,
446
- y: s
447
- }, u = await o.detectOverflow(t, c), g = oe(r), h = Bt(g);
448
- let E = d[h], w = d[g];
449
- const T = (y, p) => $n(p + u[y === "y" ? "top" : "left"], p, p - u[y === "y" ? "bottom" : "right"]);
450
- l && (E = T(h, E)), i && (w = T(g, w));
451
- const m = a.fn({
452
- ...t,
453
- [h]: E,
454
- [g]: w
455
- });
456
- return {
457
- ...m,
458
- data: {
459
- x: m.x - n,
460
- y: m.y - s,
461
- enabled: {
462
- [h]: l,
463
- [g]: i
464
- }
465
- }
466
- };
467
- }
468
- };
469
- };
470
- function Ge() {
471
- return typeof window < "u";
472
- }
473
- function Ae(e) {
474
- return Nt(e) ? (e.nodeName || "").toLowerCase() : "#document";
475
- }
476
- function W(e) {
477
- var t;
478
- return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
479
- }
480
- function te(e) {
481
- var t;
482
- return (t = (Nt(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
483
- }
484
- function Nt(e) {
485
- return Ge() ? e instanceof Node || e instanceof W(e).Node : !1;
486
- }
487
- function X(e) {
488
- return Ge() ? e instanceof Element || e instanceof W(e).Element : !1;
489
- }
490
- function le(e) {
491
- return Ge() ? e instanceof HTMLElement || e instanceof W(e).HTMLElement : !1;
492
- }
493
- function wt(e) {
494
- return !Ge() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof W(e).ShadowRoot;
495
- }
496
- function Ue(e) {
497
- const {
498
- overflow: t,
499
- overflowX: n,
500
- overflowY: s,
501
- display: r
502
- } = Y(e);
503
- return /auto|scroll|overlay|hidden|clip/.test(t + s + n) && r !== "inline" && r !== "contents";
504
- }
505
- function eo(e) {
506
- return /^(table|td|th)$/.test(Ae(e));
507
- }
508
- function Xe(e) {
509
- try {
510
- if (e.matches(":popover-open"))
511
- return !0;
512
- } catch {
513
- }
514
- try {
515
- return e.matches(":modal");
516
- } catch {
517
- return !1;
518
- }
519
- }
520
- const to = /transform|translate|scale|rotate|perspective|filter/, no = /paint|layout|strict|content/, ue = (e) => !!e && e !== "none";
521
- let Qe;
522
- function dt(e) {
523
- const t = X(e) ? Y(e) : e;
524
- return ue(t.transform) || ue(t.translate) || ue(t.scale) || ue(t.rotate) || ue(t.perspective) || !ft() && (ue(t.backdropFilter) || ue(t.filter)) || to.test(t.willChange || "") || no.test(t.contain || "");
525
- }
526
- function oo(e) {
527
- let t = xe(e);
528
- for (; le(t) && !Me(t); ) {
529
- if (dt(t))
530
- return t;
531
- if (Xe(t))
532
- return null;
533
- t = xe(t);
534
- }
535
- return null;
536
- }
537
- function ft() {
538
- return Qe == null && (Qe = typeof CSS < "u" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none")), Qe;
539
- }
540
- function Me(e) {
541
- return /^(html|body|#document)$/.test(Ae(e));
542
- }
543
- function Y(e) {
544
- return W(e).getComputedStyle(e);
545
- }
546
- function Ye(e) {
547
- return X(e) ? {
548
- scrollLeft: e.scrollLeft,
549
- scrollTop: e.scrollTop
550
- } : {
551
- scrollLeft: e.scrollX,
552
- scrollTop: e.scrollY
553
- };
554
- }
555
- function xe(e) {
556
- if (Ae(e) === "html")
557
- return e;
558
- const t = (
559
- // Step into the shadow DOM of the parent of a slotted node.
560
- e.assignedSlot || // DOM Element detected.
561
- e.parentNode || // ShadowRoot detected.
562
- wt(e) && e.host || // Fallback.
563
- te(e)
564
- );
565
- return wt(t) ? t.host : t;
566
- }
567
- function Wt(e) {
568
- const t = xe(e);
569
- return Me(t) ? (e.ownerDocument || e).body : le(t) && Ue(t) ? t : Wt(t);
570
- }
571
- function Re(e, t, n) {
572
- var s;
573
- t === void 0 && (t = []), n === void 0 && (n = !0);
574
- const r = Wt(e), o = r === ((s = e.ownerDocument) == null ? void 0 : s.body), l = W(r);
575
- if (o) {
576
- const i = st(l);
577
- return t.concat(l, l.visualViewport || [], Ue(r) ? r : [], i && n ? Re(i) : []);
578
- } else
579
- return t.concat(r, Re(r, [], n));
580
- }
581
- function st(e) {
582
- return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
583
- }
584
- function Kt(e) {
585
- const t = Y(e);
586
- let n = parseFloat(t.width) || 0, s = parseFloat(t.height) || 0;
587
- const r = le(e), o = r ? e.offsetWidth : n, l = r ? e.offsetHeight : s, i = Ne(n) !== o || Ne(s) !== l;
588
- return i && (n = o, s = l), {
589
- width: n,
590
- height: s,
591
- $: i
592
- };
593
- }
594
- function pt(e) {
595
- return X(e) ? e : e.contextElement;
596
- }
597
- function Te(e) {
598
- const t = pt(e);
599
- if (!le(t))
600
- return ee(1);
601
- const n = t.getBoundingClientRect(), {
602
- width: s,
603
- height: r,
604
- $: o
605
- } = Kt(t);
606
- let l = (o ? Ne(n.width) : n.width) / s, i = (o ? Ne(n.height) : n.height) / r;
607
- return (!l || !Number.isFinite(l)) && (l = 1), (!i || !Number.isFinite(i)) && (i = 1), {
608
- x: l,
609
- y: i
610
- };
611
- }
612
- const so = /* @__PURE__ */ ee(0);
613
- function qt(e) {
614
- const t = W(e);
615
- return !ft() || !t.visualViewport ? so : {
616
- x: t.visualViewport.offsetLeft,
617
- y: t.visualViewport.offsetTop
618
- };
619
- }
620
- function ro(e, t, n) {
621
- return t === void 0 && (t = !1), !!n && t && n === W(e);
622
- }
623
- function ye(e, t, n, s) {
624
- t === void 0 && (t = !1), n === void 0 && (n = !1);
625
- const r = e.getBoundingClientRect(), o = pt(e);
626
- let l = ee(1);
627
- t && (s ? X(s) && (l = Te(s)) : l = Te(e));
628
- const i = ro(o, n, s) ? qt(o) : ee(0);
629
- let a = (r.left + i.x) / l.x, c = (r.top + i.y) / l.y, d = r.width / l.x, u = r.height / l.y;
630
- if (o && s) {
631
- const g = W(o), h = X(s) ? W(s) : s;
632
- let E = g, w = st(E);
633
- for (; w && h !== E; ) {
634
- const T = Te(w), m = w.getBoundingClientRect(), y = Y(w), p = m.left + (w.clientLeft + parseFloat(y.paddingLeft)) * T.x, f = m.top + (w.clientTop + parseFloat(y.paddingTop)) * T.y;
635
- a *= T.x, c *= T.y, d *= T.x, u *= T.y, a += p, c += f, E = W(w), w = st(E);
636
- }
637
- }
638
- return Ke({
639
- width: d,
640
- height: u,
641
- x: a,
642
- y: c
643
- });
644
- }
645
- function Ze(e, t) {
646
- const n = Ye(e).scrollLeft;
647
- return t ? t.left + n : ye(te(e)).left + n;
648
- }
649
- function Ht(e, t) {
650
- const n = e.getBoundingClientRect(), s = n.left + t.scrollLeft - Ze(e, n), r = n.top + t.scrollTop;
651
- return {
652
- x: s,
653
- y: r
654
- };
655
- }
656
- function io(e) {
657
- let {
658
- elements: t,
659
- rect: n,
660
- offsetParent: s,
661
- strategy: r
662
- } = e;
663
- const o = r === "fixed", l = te(s), i = t ? Xe(t.floating) : !1;
664
- if (s === l || i && o)
665
- return n;
666
- let a = {
667
- scrollLeft: 0,
668
- scrollTop: 0
669
- }, c = ee(1);
670
- const d = ee(0), u = le(s);
671
- if ((u || !o) && ((Ae(s) !== "body" || Ue(l)) && (a = Ye(s)), u)) {
672
- const h = ye(s);
673
- c = Te(s), d.x = h.x + s.clientLeft, d.y = h.y + s.clientTop;
674
- }
675
- const g = l && !u && !o ? Ht(l, a) : ee(0);
676
- return {
677
- width: n.width * c.x,
678
- height: n.height * c.y,
679
- x: n.x * c.x - a.scrollLeft * c.x + d.x + g.x,
680
- y: n.y * c.y - a.scrollTop * c.y + d.y + g.y
681
- };
682
- }
683
- function lo(e) {
684
- return e.getClientRects ? Array.from(e.getClientRects()) : [];
685
- }
686
- function ao(e) {
687
- const t = Ye(e), n = e.ownerDocument.body, s = fe(e.scrollWidth, e.clientWidth, n.scrollWidth, n.clientWidth), r = fe(e.scrollHeight, e.clientHeight, n.scrollHeight, n.clientHeight);
688
- let o = -t.scrollLeft + Ze(e);
689
- const l = -t.scrollTop;
690
- return Y(n).direction === "rtl" && (o += fe(e.clientWidth, n.clientWidth) - s), {
691
- width: s,
692
- height: r,
693
- x: o,
694
- y: l
695
- };
696
- }
697
- const co = 25;
698
- function uo(e, t, n) {
699
- n === void 0 && (n = "viewport");
700
- const s = n === "layoutViewport", r = W(e), o = te(e), l = r.visualViewport;
701
- let i = o.clientWidth, a = o.clientHeight, c = 0, d = 0;
702
- if (l) {
703
- const g = !ft() || t === "fixed";
704
- s ? g || (c = -l.offsetLeft, d = -l.offsetTop) : (i = l.width, a = l.height, g && (c = l.offsetLeft, d = l.offsetTop));
705
- }
706
- if (Ze(o) <= 0) {
707
- const g = o.ownerDocument, h = g.body, E = getComputedStyle(h), w = g.compatMode === "CSS1Compat" && parseFloat(E.marginLeft) + parseFloat(E.marginRight) || 0, T = Math.abs(o.clientWidth - h.clientWidth - w), m = getComputedStyle(o).scrollbarGutter === "stable both-edges" ? T / 2 : T;
708
- m <= co && (i -= m);
709
- }
710
- return {
711
- width: i,
712
- height: a,
713
- x: c,
714
- y: d
715
- };
716
- }
717
- function fo(e, t) {
718
- const n = ye(e, !0, t === "fixed"), s = n.top + e.clientTop, r = n.left + e.clientLeft, o = Te(e), l = e.clientWidth * o.x, i = e.clientHeight * o.y, a = r * o.x, c = s * o.y;
719
- return {
720
- width: l,
721
- height: i,
722
- x: a,
723
- y: c
724
- };
725
- }
726
- function Ct(e, t, n) {
727
- let s;
728
- if (t === "viewport" || t === "layoutViewport")
729
- s = uo(e, n, t);
730
- else if (t === "document")
731
- s = ao(te(e));
732
- else if (X(t))
733
- s = fo(t, n);
734
- else {
735
- const r = qt(e);
736
- s = {
737
- x: t.x - r.x,
738
- y: t.y - r.y,
739
- width: t.width,
740
- height: t.height
741
- };
742
- }
743
- return Ke(s);
744
- }
745
- function po(e, t) {
746
- const n = t.get(e);
747
- if (n)
748
- return n;
749
- let s = Re(e, [], !1).filter((i) => X(i) && Ae(i) !== "body"), r = null;
750
- const o = Y(e).position === "fixed";
751
- let l = o ? xe(e) : e;
752
- for (; X(l) && !Me(l); ) {
753
- const i = Y(l), a = dt(l), c = r ? r.position : o ? "fixed" : "";
754
- !a && (c === "fixed" || c === "absolute" && i.position === "static") ? s = s.filter((u) => u !== l) : r = i, l = xe(l);
755
- }
756
- return t.set(e, s), s;
757
- }
758
- function mo(e) {
759
- let {
760
- element: t,
761
- boundary: n,
762
- rootBoundary: s,
763
- strategy: r
764
- } = e;
765
- const l = [...n === "clippingAncestors" ? Xe(t) ? [] : po(t, this._c) : [].concat(n), s], i = Ct(t, l[0], r);
766
- let a = i.top, c = i.right, d = i.bottom, u = i.left;
767
- for (let g = 1; g < l.length; g++) {
768
- const h = Ct(t, l[g], r);
769
- a = fe(h.top, a), c = je(h.right, c), d = je(h.bottom, d), u = fe(h.left, u);
770
- }
771
- return {
772
- width: c - u,
773
- height: d - a,
774
- x: u,
775
- y: a
776
- };
777
- }
778
- function ho(e) {
779
- const {
780
- width: t,
781
- height: n
782
- } = Kt(e);
783
- return {
784
- width: t,
785
- height: n
786
- };
787
- }
788
- function go(e, t, n) {
789
- const s = le(t), r = te(t), o = n === "fixed", l = ye(e, !0, o, t);
790
- let i = {
791
- scrollLeft: 0,
792
- scrollTop: 0
793
- };
794
- const a = ee(0);
795
- if ((s || !o) && ((Ae(t) !== "body" || Ue(r)) && (i = Ye(t)), s)) {
796
- const g = ye(t, !0, o, t);
797
- a.x = g.x + t.clientLeft, a.y = g.y + t.clientTop;
798
- }
799
- !s && r && (a.x = Ze(r));
800
- const c = r && !s && !o ? Ht(r, i) : ee(0), d = l.left + i.scrollLeft - a.x - c.x, u = l.top + i.scrollTop - a.y - c.y;
801
- return {
802
- x: d,
803
- y: u,
804
- width: l.width,
805
- height: l.height
806
- };
807
- }
808
- function et(e) {
809
- return Y(e).position === "static";
810
- }
811
- function At(e, t) {
812
- if (!le(e) || Y(e).position === "fixed")
813
- return null;
814
- if (t)
815
- return t(e);
816
- let n = e.offsetParent;
817
- return te(e) === n && (n = n.ownerDocument.body), n;
818
- }
819
- function zt(e, t) {
820
- const n = W(e);
821
- if (Xe(e))
822
- return n;
823
- if (!le(e)) {
824
- let r = xe(e);
825
- for (; r && !Me(r); ) {
826
- if (X(r) && !et(r))
827
- return r;
828
- r = xe(r);
829
- }
830
- return n;
831
- }
832
- let s = At(e, t);
833
- for (; s && eo(s) && et(s); )
834
- s = At(s, t);
835
- return s && Me(s) && et(s) && !dt(s) ? n : s || oo(e) || n;
836
- }
837
- const xo = async function(e) {
838
- const t = this.getOffsetParent || zt, n = this.getDimensions, s = await n(e.floating);
839
- return {
840
- reference: go(e.reference, await t(e.floating), e.strategy),
841
- floating: {
842
- x: 0,
843
- y: 0,
844
- width: s.width,
845
- height: s.height
846
- }
847
- };
848
- };
849
- function yo(e) {
850
- return Y(e).direction === "rtl";
851
- }
852
- const bo = {
853
- convertOffsetParentRelativeRectToViewportRelativeRect: io,
854
- getDocumentElement: te,
855
- getClippingRect: mo,
856
- getOffsetParent: zt,
857
- getElementRects: xo,
858
- getClientRects: lo,
859
- getDimensions: ho,
860
- getScale: Te,
861
- isElement: X,
862
- isRTL: yo
863
- };
864
- function Ft(e, t) {
865
- return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
866
- }
867
- function vo(e, t, n) {
868
- let s = null, r;
869
- const o = te(e);
870
- function l() {
871
- var d;
872
- clearTimeout(r), (d = s) == null || d.disconnect(), s = null;
873
- }
874
- function i(d, u) {
875
- d === void 0 && (d = !1), u === void 0 && (u = 1), l();
876
- const g = e.getBoundingClientRect(), {
877
- left: h,
878
- top: E,
879
- width: w,
880
- height: T
881
- } = g;
882
- if (d || t(), !w || !T)
883
- return;
884
- const m = Oe(E), y = Oe(o.clientWidth - (h + w)), p = Oe(o.clientHeight - (E + T)), f = Oe(h), v = {
885
- rootMargin: -m + "px " + -y + "px " + -p + "px " + -f + "px",
886
- threshold: fe(0, je(1, u)) || 1
887
- };
888
- let S = !0;
889
- function _(b) {
890
- const L = b[0].intersectionRatio;
891
- if (!Ft(g, e.getBoundingClientRect()))
892
- return i();
893
- if (L !== u) {
894
- if (!S)
895
- return i();
896
- L ? i(!1, L) : r = setTimeout(() => {
897
- i(!1, 1e-7);
898
- }, 1e3);
899
- }
900
- S = !1;
901
- }
902
- try {
903
- s = new IntersectionObserver(_, {
904
- ...v,
905
- // Handle <iframe>s
906
- root: o.ownerDocument
907
- });
908
- } catch {
909
- s = new IntersectionObserver(_, v);
910
- }
911
- s.observe(e);
912
- }
913
- const a = W(e), c = () => i(n);
914
- return a.addEventListener("resize", c), i(!0), () => {
915
- a.removeEventListener("resize", c), l();
916
- };
917
- }
918
- function mt(e, t, n, s) {
919
- s === void 0 && (s = {});
920
- const {
921
- ancestorScroll: r = !0,
922
- ancestorResize: o = !0,
923
- elementResize: l = typeof ResizeObserver == "function",
924
- layoutShift: i = typeof IntersectionObserver == "function",
925
- animationFrame: a = !1
926
- } = s, c = pt(e), d = r || o ? [...c ? Re(c) : [], ...t ? Re(t) : []] : [];
927
- d.forEach((m) => {
928
- r && m.addEventListener("scroll", n), o && m.addEventListener("resize", n);
929
- });
930
- const u = c && i ? vo(c, n, o) : null;
931
- let g = -1, h = null;
932
- l && (h = new ResizeObserver((m) => {
933
- let [y] = m;
934
- y && y.target === c && h && t && (h.unobserve(t), cancelAnimationFrame(g), g = requestAnimationFrame(() => {
935
- var p;
936
- (p = h) == null || p.observe(t);
937
- })), n();
938
- }), c && !a && h.observe(c), t && h.observe(t));
939
- let E, w = a ? ye(e) : null;
940
- a && T();
941
- function T() {
942
- const m = ye(e);
943
- w && !Ft(w, m) && n(), w = m, E = requestAnimationFrame(T);
944
- }
945
- return n(), () => {
946
- var m;
947
- d.forEach((y) => {
948
- r && y.removeEventListener("scroll", n), o && y.removeEventListener("resize", n);
949
- }), u == null || u(), (m = h) == null || m.disconnect(), h = null, a && cancelAnimationFrame(E);
950
- };
951
- }
952
- const ht = Jn, gt = Qn, xt = Xn, yt = (e, t, n) => {
953
- const s = /* @__PURE__ */ new Map(), r = n ?? {}, o = {
954
- ...bo,
955
- ...r.platform,
956
- _c: s
957
- };
958
- return Un(e, t, {
959
- ...r,
960
- platform: o
961
- });
962
- };
963
- function ve(e) {
38
+ }), Dt = /* @__PURE__ */ Z(Pt, [["__scopeId", "data-v-b42c4fae"]]);
39
+ function re(e) {
964
40
  return `${e}_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
965
41
  }
966
- function To(e, t, n = !1) {
42
+ function Ot(e, t, o = !1) {
967
43
  const { $from: s } = e;
968
44
  if (!e.empty || !s.parent.isTextblock)
969
45
  return null;
970
- const r = s.parent.textBetween(0, s.parentOffset, void 0, ""), o = r.lastIndexOf(t);
971
- if (o === -1)
46
+ const i = s.parent.textBetween(0, s.parentOffset, void 0, ""), n = i.lastIndexOf(t);
47
+ if (n === -1)
972
48
  return null;
973
- const l = r.slice(o + t.length);
974
- if (!n && l.includes(" "))
49
+ const a = i.slice(n + t.length);
50
+ if (!o && a.includes(" "))
975
51
  return null;
976
- const i = s.start() + o, a = s.pos;
52
+ const r = s.start() + n, l = s.pos;
977
53
  return {
978
- range: { from: i, to: a },
979
- query: l
54
+ range: { from: r, to: l },
55
+ query: a
980
56
  };
981
57
  }
982
- const be = {
58
+ const se = {
983
59
  /** Template 扩展(包含 TemplateBlock 和 TemplateSelect 子扩展) */
984
60
  TEMPLATE: "template",
985
61
  /** Mention 扩展 */
986
62
  MENTION: "mention",
987
63
  /** Suggestion 扩展 */
988
64
  SUGGESTION: "suggestion"
989
- }, A = {
65
+ }, T = {
990
66
  /** TemplateBlock 节点类型(可编辑块) */
991
67
  TEMPLATE_BLOCK: "templateBlock",
992
68
  /** TemplateSelect 节点类型(下拉选择) */
@@ -997,7 +73,7 @@ const be = {
997
73
  PARAGRAPH: "paragraph",
998
74
  /** Text 节点类型(ProseMirror 内置) */
999
75
  TEXT: "text"
1000
- }, ae = {
76
+ }, ee = {
1001
77
  /** Mention 插件 */
1002
78
  MENTION: "mention",
1003
79
  /** Suggestion 插件 */
@@ -1023,7 +99,7 @@ const be = {
1023
99
  SELECT: "select",
1024
100
  /** Mention 类型 */
1025
101
  MENTION: "mention"
1026
- }, Vt = {
102
+ }, ze = {
1027
103
  /** Enter 键 */
1028
104
  ENTER: "Enter",
1029
105
  /** Escape 键 */
@@ -1044,87 +120,87 @@ const be = {
1044
120
  ARROW_RIGHT: "ArrowRight",
1045
121
  /** 空格键 */
1046
122
  SPACE: " "
1047
- }, I = (e, t) => e.key === Vt[t], we = (e, t) => t.some((n) => e.key === Vt[n]), Eo = ["onMousedown", "onMouseenter"], wo = {
123
+ }, I = (e, t) => e.key === ze[t], ie = (e, t) => t.some((o) => e.key === ze[o]), It = ["onMousedown", "onMouseenter"], Rt = {
1048
124
  key: 0,
1049
125
  class: "mention-icon"
1050
- }, Co = { class: "mention-label" }, Ao = {
126
+ }, Bt = { class: "mention-label" }, jt = {
1051
127
  key: 0,
1052
128
  class: "mention-empty"
1053
- }, So = /* @__PURE__ */ Z({
129
+ }, $t = /* @__PURE__ */ X({
1054
130
  __name: "mention-list",
1055
131
  props: {
1056
132
  items: {},
1057
133
  command: { type: Function }
1058
134
  },
1059
135
  setup(e, { expose: t }) {
1060
- const n = e, s = F(0), r = F(null);
136
+ const o = e, s = W(0), i = W(null);
1061
137
  K(
1062
- () => n.items,
138
+ () => o.items,
1063
139
  () => {
1064
140
  s.value = 0;
1065
141
  }
1066
142
  );
1067
- function o({ event: c }) {
1068
- return I(c, "ARROW_UP") ? (s.value = Math.max(0, s.value - 1), l(), !0) : I(c, "ARROW_DOWN") ? (s.value = Math.min(n.items.length - 1, s.value + 1), l(), !0) : we(c, ["ENTER", "TAB"]) ? (i(s.value), !0) : !1;
143
+ function n({ event: u }) {
144
+ return I(u, "ARROW_UP") ? (s.value = Math.max(0, s.value - 1), a(), !0) : I(u, "ARROW_DOWN") ? (s.value = Math.min(o.items.length - 1, s.value + 1), a(), !0) : ie(u, ["ENTER", "TAB"]) ? (r(s.value), !0) : !1;
1069
145
  }
1070
- function l() {
1071
- me(() => {
1072
- var d;
1073
- const c = (d = r.value) == null ? void 0 : d.querySelector(".mention-item.is-selected");
1074
- c && c.scrollIntoView({
146
+ function a() {
147
+ oe(() => {
148
+ var p;
149
+ const u = (p = i.value) == null ? void 0 : p.querySelector(".mention-item.is-selected");
150
+ u && u.scrollIntoView({
1075
151
  block: "nearest",
1076
152
  behavior: "smooth"
1077
153
  });
1078
154
  });
1079
155
  }
1080
- function i(c) {
1081
- const d = n.items[c];
1082
- d && n.command({
1083
- id: d.id,
1084
- label: d.label,
1085
- value: d.value
156
+ function r(u) {
157
+ const p = o.items[u];
158
+ p && o.command({
159
+ id: p.id,
160
+ label: p.label,
161
+ value: p.value
1086
162
  });
1087
163
  }
1088
- function a(c) {
1089
- s.value = c;
164
+ function l(u) {
165
+ s.value = u;
1090
166
  }
1091
167
  return t({
1092
- onKeyDown: o
1093
- }), (c, d) => (M(), P("div", {
168
+ onKeyDown: n
169
+ }), (u, p) => (w(), P("div", {
1094
170
  ref_key: "listRef",
1095
- ref: r,
171
+ ref: i,
1096
172
  class: "mention-list"
1097
173
  }, [
1098
- (M(!0), P(Ie, null, Be(e.items, (u, g) => (M(), P("button", {
1099
- key: u.id,
174
+ (w(!0), P(fe, null, pe(e.items, (f, E) => (w(), P("button", {
175
+ key: f.id,
1100
176
  type: "button",
1101
- class: Q(["mention-item", { "is-selected": g === s.value }]),
1102
- onMousedown: nt((h) => i(g), ["prevent"]),
1103
- onMouseenter: (h) => a(g)
177
+ class: V(["mention-item", { "is-selected": E === s.value }]),
178
+ onMousedown: ye((S) => r(E), ["prevent"]),
179
+ onMouseenter: (S) => l(E)
1104
180
  }, [
1105
- u.icon ? (M(), P("span", wo, pe(u.icon), 1)) : q("", !0),
1106
- B("span", Co, pe(u.label), 1)
1107
- ], 42, Eo))), 128)),
1108
- e.items.length === 0 ? (M(), P("div", Ao, [...d[0] || (d[0] = [
1109
- B("span", null, "未找到匹配的提及项", -1)
1110
- ])])) : q("", !0)
181
+ f.icon ? (w(), P("span", Rt, ne(f.icon), 1)) : N("", !0),
182
+ R("span", Bt, ne(f.label), 1)
183
+ ], 42, It))), 128)),
184
+ e.items.length === 0 ? (w(), P("div", jt, [...p[0] || (p[0] = [
185
+ R("span", null, "未找到匹配的提及项", -1)
186
+ ])])) : N("", !0)
1111
187
  ], 512));
1112
188
  }
1113
- }), _o = /* @__PURE__ */ J(So, [["__scopeId", "data-v-aaa34d1a"]]), de = new re(ae.MENTION);
1114
- function Lo(e, t) {
189
+ }), Kt = /* @__PURE__ */ Z($t, [["__scopeId", "data-v-aaa34d1a"]]), te = new J(ee.MENTION);
190
+ function qt(e, t) {
1115
191
  if (!t)
1116
192
  return e;
1117
- const n = t.toLowerCase();
193
+ const o = t.toLowerCase();
1118
194
  return e.filter((s) => {
1119
- var r;
1120
- return !!(s.label.toLowerCase().includes(n) || (r = s.value) != null && r.toLowerCase().includes(n));
195
+ var i;
196
+ return !!(s.label.toLowerCase().includes(o) || (i = s.value) != null && i.toLowerCase().includes(o));
1121
197
  });
1122
198
  }
1123
- function ko(e) {
1124
- const { editor: t, char: n, items: s, allowSpaces: r } = e;
1125
- let o = null, l = null, i = null;
1126
- return new ie({
1127
- key: de,
199
+ function Nt(e) {
200
+ const { editor: t, char: o, items: s, allowSpaces: i } = e;
201
+ let n = null, a = null, r = null;
202
+ return new Q({
203
+ key: te,
1128
204
  state: {
1129
205
  init() {
1130
206
  return {
@@ -1134,140 +210,140 @@ function ko(e) {
1134
210
  filteredItems: []
1135
211
  };
1136
212
  },
1137
- apply(a, c) {
1138
- const d = a.getMeta(de);
1139
- if (d && d.type === "close")
213
+ apply(l, u) {
214
+ const p = l.getMeta(te);
215
+ if (p && p.type === "close")
1140
216
  return {
1141
217
  active: !1,
1142
218
  range: null,
1143
219
  query: "",
1144
220
  filteredItems: []
1145
221
  };
1146
- if (!a.docChanged && !a.selectionSet)
1147
- return c;
1148
- const u = To(a.selection, n, r);
1149
- if (!u)
222
+ if (!l.docChanged && !l.selectionSet)
223
+ return u;
224
+ const f = Ot(l.selection, o, i);
225
+ if (!f)
1150
226
  return {
1151
227
  active: !1,
1152
228
  range: null,
1153
229
  query: "",
1154
230
  filteredItems: []
1155
231
  };
1156
- const g = ke(s) ? s.value : s, h = Lo(g, u.query);
232
+ const E = ce(s) ? s.value : s, S = qt(E, f.query);
1157
233
  return {
1158
- active: h.length > 0,
1159
- range: u.range,
1160
- query: u.query,
1161
- filteredItems: h
234
+ active: S.length > 0,
235
+ range: f.range,
236
+ query: f.query,
237
+ filteredItems: S
1162
238
  };
1163
239
  }
1164
240
  },
1165
241
  props: {
1166
242
  // 装饰器:高亮触发区域
1167
- decorations(a) {
1168
- const c = this.getState(a);
1169
- if (!(c != null && c.active) || !c.range)
1170
- return Le.empty;
1171
- const d = Dt.inline(c.range.from, c.range.to, {
243
+ decorations(l) {
244
+ const u = this.getState(l);
245
+ if (!(u != null && u.active) || !u.range)
246
+ return le.empty;
247
+ const p = He.inline(u.range.from, u.range.to, {
1172
248
  class: "mention-trigger"
1173
249
  });
1174
- return Le.create(a.doc, [d]);
250
+ return le.create(l.doc, [p]);
1175
251
  },
1176
252
  // 键盘处理
1177
- handleKeyDown(a, c) {
1178
- var u, g, h, E;
1179
- const d = de.getState(a.state);
1180
- if (I(c, "BACKSPACE")) {
1181
- const { selection: w } = a.state, { $from: T } = w;
1182
- if (T.nodeBefore && T.nodeBefore.type.name === A.MENTION) {
1183
- c.preventDefault();
1184
- const { tr: m } = a.state, y = T.pos - T.nodeBefore.nodeSize;
1185
- return m.delete(y, T.pos), m.insertText(n, y), m.setSelection(O.create(m.doc, y + 1)), a.dispatch(m), a.focus(), !0;
253
+ handleKeyDown(l, u) {
254
+ var f, E, S, j;
255
+ const p = te.getState(l.state);
256
+ if (I(u, "BACKSPACE")) {
257
+ const { selection: L } = l.state, { $from: C } = L;
258
+ if (C.nodeBefore && C.nodeBefore.type.name === T.MENTION) {
259
+ u.preventDefault();
260
+ const { tr: h } = l.state, g = C.pos - C.nodeBefore.nodeSize;
261
+ return h.delete(g, C.pos), h.insertText(o, g), h.setSelection(D.create(h.doc, g + 1)), l.dispatch(h), l.focus(), !0;
1186
262
  }
1187
263
  }
1188
- if (!(d != null && d.active))
264
+ if (!(p != null && p.active))
1189
265
  return !1;
1190
- if (I(c, "ESCAPE")) {
1191
- c.preventDefault();
1192
- const w = a.state.tr;
1193
- return w.setMeta(de, {
266
+ if (I(u, "ESCAPE")) {
267
+ u.preventDefault();
268
+ const L = l.state.tr;
269
+ return L.setMeta(te, {
1194
270
  type: "close"
1195
- }), a.dispatch(w), o && (i == null || i(), i = null, o.destroy(), o = null), l && (l.remove(), l = null), !0;
271
+ }), l.dispatch(L), n && (r == null || r(), r = null, n.destroy(), n = null), a && (a.remove(), a = null), !0;
1196
272
  }
1197
- if (we(c, ["ENTER", "TAB"])) {
1198
- if (c.preventDefault(), (g = (u = o == null ? void 0 : o.ref) == null ? void 0 : u.onKeyDown) == null ? void 0 : g.call(u, { event: c }))
273
+ if (ie(u, ["ENTER", "TAB"])) {
274
+ if (u.preventDefault(), (E = (f = n == null ? void 0 : n.ref) == null ? void 0 : f.onKeyDown) == null ? void 0 : E.call(f, { event: u }))
1199
275
  return !0;
1200
- if (d.filteredItems.length > 0 && d.range) {
1201
- const T = d.filteredItems[0];
1202
- return St(a, d.range, T), !0;
276
+ if (p.filteredItems.length > 0 && p.range) {
277
+ const C = p.filteredItems[0];
278
+ return Ie(l, p.range, C), !0;
1203
279
  }
1204
280
  return !0;
1205
281
  }
1206
- return we(c, ["ARROW_UP", "ARROW_DOWN"]) && ((E = (h = o == null ? void 0 : o.ref) == null ? void 0 : h.onKeyDown) == null ? void 0 : E.call(h, { event: c })) || !1;
282
+ return ie(u, ["ARROW_UP", "ARROW_DOWN"]) && ((j = (S = n == null ? void 0 : n.ref) == null ? void 0 : S.onKeyDown) == null ? void 0 : j.call(S, { event: u })) || !1;
1207
283
  }
1208
284
  },
1209
285
  view() {
1210
286
  return {
1211
- update(a) {
1212
- const c = de.getState(a.state);
1213
- if (c != null && c.active && c.filteredItems.length > 0) {
1214
- o ? o.updateProps({
1215
- items: c.filteredItems
1216
- }) : (o = new Ot(_o, {
287
+ update(l) {
288
+ const u = te.getState(l.state);
289
+ if (u != null && u.active && u.filteredItems.length > 0) {
290
+ n ? n.updateProps({
291
+ items: u.filteredItems
292
+ }) : (n = new Ne(Kt, {
1217
293
  props: {
1218
- items: c.filteredItems,
1219
- command: (u) => {
1220
- const g = {
1221
- id: u.id,
1222
- label: u.label,
1223
- value: u.value || ""
294
+ items: u.filteredItems,
295
+ command: (f) => {
296
+ const E = {
297
+ id: f.id,
298
+ label: f.label,
299
+ value: f.value || ""
1224
300
  };
1225
- c.range && St(a, c.range, g);
301
+ u.range && Ie(l, u.range, E);
1226
302
  }
1227
303
  },
1228
304
  editor: t
1229
- }), l = o.element, l.style.position = "absolute", l.style.zIndex = "1000", document.body.appendChild(l));
1230
- const d = a.dom.querySelector(".mention-trigger");
1231
- d && l && (i == null || i(), i = mt(d, l, () => {
1232
- yt(d, l, {
305
+ }), a = n.element, a.style.position = "absolute", a.style.zIndex = "1000", document.body.appendChild(a));
306
+ const p = l.dom.querySelector(".mention-trigger");
307
+ p && a && (r == null || r(), r = Se(p, a, () => {
308
+ Ce(p, a, {
1233
309
  placement: "bottom-start",
1234
- middleware: [ht(8), xt(), gt({ padding: 8 })]
1235
- }).then((u) => {
1236
- l && Object.assign(l.style, {
1237
- left: `${u.x}px`,
1238
- top: `${u.y}px`
310
+ middleware: [Ae(8), we(), ke({ padding: 8 })]
311
+ }).then((f) => {
312
+ a && Object.assign(a.style, {
313
+ left: `${f.x}px`,
314
+ top: `${f.y}px`
1239
315
  });
1240
316
  });
1241
317
  }));
1242
318
  } else
1243
- o && (i == null || i(), i = null, o.destroy(), o = null), l && (l.remove(), l = null);
319
+ n && (r == null || r(), r = null, n.destroy(), n = null), a && (a.remove(), a = null);
1244
320
  },
1245
321
  destroy() {
1246
- i == null || i(), o == null || o.destroy(), l == null || l.remove();
322
+ r == null || r(), n == null || n.destroy(), a == null || a.remove();
1247
323
  }
1248
324
  };
1249
325
  }
1250
326
  });
1251
327
  }
1252
- function St(e, t, n) {
328
+ function Ie(e, t, o) {
1253
329
  e.focus();
1254
- const { state: s, dispatch: r } = e, { tr: o } = s, l = s.schema.nodes.mention.create({
1255
- id: n.id || ve("mention"),
1256
- label: n.label,
1257
- value: n.value || ""
1258
- }), i = s.schema.text(" ");
1259
- o.delete(t.from, t.to), o.insert(t.from, [l, i]);
1260
- const a = t.from + 2;
1261
- o.setSelection(O.create(o.doc, a)), o.scrollIntoView(), r(o);
1262
- }
1263
- const Mo = {
330
+ const { state: s, dispatch: i } = e, { tr: n } = s, a = s.schema.nodes.mention.create({
331
+ id: o.id || re("mention"),
332
+ label: o.label,
333
+ value: o.value || ""
334
+ }), r = s.schema.text(" ");
335
+ n.delete(t.from, t.to), n.insert(t.from, [a, r]);
336
+ const l = t.from + 2;
337
+ n.setSelection(D.create(n.doc, l)), n.scrollIntoView(), i(n);
338
+ }
339
+ const Ht = {
1264
340
  /**
1265
341
  * 插入 mention 节点
1266
342
  */
1267
343
  insertMention: (e) => ({ commands: t }) => t.insertContent({
1268
- type: A.MENTION,
344
+ type: T.MENTION,
1269
345
  attrs: {
1270
- id: e.id || ve("mention"),
346
+ id: e.id || re("mention"),
1271
347
  label: e.label || "",
1272
348
  value: e.value
1273
349
  }
@@ -1275,15 +351,15 @@ const Mo = {
1275
351
  /**
1276
352
  * 删除 mention 节点
1277
353
  */
1278
- deleteMention: (e) => ({ tr: t, state: n }) => {
354
+ deleteMention: (e) => ({ tr: t, state: o }) => {
1279
355
  let s = !1;
1280
- return n.doc.descendants((r, o) => {
1281
- if (r.type.name === A.MENTION && r.attrs.id === e)
1282
- return t.delete(o, o + r.nodeSize), s = !0, !1;
356
+ return o.doc.descendants((i, n) => {
357
+ if (i.type.name === T.MENTION && i.attrs.id === e)
358
+ return t.delete(n, n + i.nodeSize), s = !0, !1;
1283
359
  }), s;
1284
360
  }
1285
- }, Gt = ct.create({
1286
- name: be.MENTION,
361
+ }, Fe = Le.create({
362
+ name: se.MENTION,
1287
363
  // 节点配置
1288
364
  group: "inline",
1289
365
  inline: !0,
@@ -1329,7 +405,7 @@ const Mo = {
1329
405
  renderHTML({ node: e, HTMLAttributes: t }) {
1330
406
  return [
1331
407
  "span",
1332
- ut(this.options.HTMLAttributes || {}, t, {
408
+ Me(this.options.HTMLAttributes || {}, t, {
1333
409
  "data-mention": "",
1334
410
  "data-id": e.attrs.id,
1335
411
  "data-label": e.attrs.label,
@@ -1340,7 +416,7 @@ const Mo = {
1340
416
  },
1341
417
  // 使用 Vue 组件渲染
1342
418
  addNodeView() {
1343
- return at(In);
419
+ return _e(Dt);
1344
420
  },
1345
421
  // 添加 storage 用于存储实例状态
1346
422
  addStorage() {
@@ -1350,11 +426,11 @@ const Mo = {
1350
426
  },
1351
427
  onCreate() {
1352
428
  const { items: e } = this.options;
1353
- ke(e) && (this.storage.watchStopHandle = K(
429
+ ce(e) && (this.storage.watchStopHandle = K(
1354
430
  e,
1355
431
  () => {
1356
432
  const t = this.editor.state.tr;
1357
- t.setMeta(de, { type: "mention-update" }), this.editor.view.dispatch(t);
433
+ t.setMeta(te, { type: "mention-update" }), this.editor.view.dispatch(t);
1358
434
  },
1359
435
  { deep: !0 }
1360
436
  ));
@@ -1365,7 +441,7 @@ const Mo = {
1365
441
  // 添加 Suggestion 插件
1366
442
  addProseMirrorPlugins() {
1367
443
  return [
1368
- ko({
444
+ Nt({
1369
445
  editor: this.editor,
1370
446
  char: this.options.char,
1371
447
  items: this.options.items,
@@ -1382,93 +458,93 @@ const Mo = {
1382
458
  },
1383
459
  // 自定义命令
1384
460
  addCommands() {
1385
- return Mo;
461
+ return Ht;
1386
462
  }
1387
463
  });
1388
- function Ro(e) {
1389
- var r;
1390
- const t = e.extensionManager.extensions.find((o) => o.name === be.MENTION), n = ((r = t == null ? void 0 : t.options) == null ? void 0 : r.char) || "@";
464
+ function Wt(e) {
465
+ var i;
466
+ const t = e.extensionManager.extensions.find((n) => n.name === se.MENTION), o = ((i = t == null ? void 0 : t.options) == null ? void 0 : i.char) || "@";
1391
467
  let s = "";
1392
- return e.state.doc.descendants((o) => {
1393
- o.type.name === A.MENTION ? s += `${n}${o.attrs.label}` : o.type.name === A.TEXT && (s += o.text || "");
468
+ return e.state.doc.descendants((n) => {
469
+ n.type.name === T.MENTION ? s += `${o}${n.attrs.label}` : n.type.name === T.TEXT && (s += n.text || "");
1394
470
  }), s.trim();
1395
471
  }
1396
- function Po(e) {
472
+ function zt(e) {
1397
473
  const t = [];
1398
- return e.state.doc.descendants((n, s, r) => {
1399
- if (r && r.type.name === A.PARAGRAPH) {
1400
- if (n.type.name === A.MENTION)
474
+ return e.state.doc.descendants((o, s, i) => {
475
+ if (i && i.type.name === T.PARAGRAPH) {
476
+ if (o.type.name === T.MENTION)
1401
477
  t.push({
1402
478
  type: G.MENTION,
1403
- content: n.attrs.label,
1404
- value: n.attrs.value || ""
479
+ content: o.attrs.label,
480
+ value: o.attrs.value || ""
1405
481
  });
1406
- else if (n.type.name === A.TEXT) {
1407
- const o = n.text || "";
1408
- if (o) {
1409
- const l = t[t.length - 1];
1410
- l && l.type === G.TEXT ? l.content = (l.content || "") + o : t.push({
482
+ else if (o.type.name === T.TEXT) {
483
+ const n = o.text || "";
484
+ if (n) {
485
+ const a = t[t.length - 1];
486
+ a && a.type === G.TEXT ? a.content = (a.content || "") + n : t.push({
1411
487
  type: G.TEXT,
1412
- content: o
488
+ content: n
1413
489
  });
1414
490
  }
1415
491
  }
1416
492
  }
1417
493
  }), t;
1418
494
  }
1419
- function Oo(e, t = "@", n) {
1420
- return Gt.configure({
495
+ function Ft(e, t = "@", o) {
496
+ return Fe.configure({
1421
497
  items: e,
1422
498
  char: t,
1423
- ...n
499
+ ...o
1424
500
  });
1425
501
  }
1426
- const Ut = (e, t) => {
502
+ const Ve = (e, t) => {
1427
503
  if (!t.length)
1428
504
  return [{ text: e, isMatch: !1 }];
1429
- const n = [];
1430
- for (const l of t) {
1431
- if (!l) continue;
1432
- let i = 0;
1433
- const a = e.toLowerCase(), c = l.toLowerCase();
505
+ const o = [];
506
+ for (const a of t) {
507
+ if (!a) continue;
508
+ let r = 0;
509
+ const l = e.toLowerCase(), u = a.toLowerCase();
1434
510
  for (; ; ) {
1435
- const d = a.indexOf(c, i);
1436
- if (d === -1) break;
1437
- n.push({
1438
- start: d,
1439
- end: d + l.length
1440
- }), i = d + 1;
511
+ const p = l.indexOf(u, r);
512
+ if (p === -1) break;
513
+ o.push({
514
+ start: p,
515
+ end: p + a.length
516
+ }), r = p + 1;
1441
517
  }
1442
518
  }
1443
- if (n.length === 0)
519
+ if (o.length === 0)
1444
520
  return [{ text: e, isMatch: !1 }];
1445
- n.sort((l, i) => l.start - i.start);
521
+ o.sort((a, r) => a.start - r.start);
1446
522
  const s = [];
1447
- for (const l of n)
523
+ for (const a of o)
1448
524
  if (s.length === 0)
1449
- s.push(l);
525
+ s.push(a);
1450
526
  else {
1451
- const i = s[s.length - 1];
1452
- l.start <= i.end ? i.end = Math.max(i.end, l.end) : s.push(l);
527
+ const r = s[s.length - 1];
528
+ a.start <= r.end ? r.end = Math.max(r.end, a.end) : s.push(a);
1453
529
  }
1454
- const r = [];
1455
- let o = 0;
1456
- for (const l of s)
1457
- o < l.start && r.push({
1458
- text: e.substring(o, l.start),
530
+ const i = [];
531
+ let n = 0;
532
+ for (const a of s)
533
+ n < a.start && i.push({
534
+ text: e.substring(n, a.start),
1459
535
  isMatch: !1
1460
- }), r.push({
1461
- text: e.substring(l.start, l.end),
536
+ }), i.push({
537
+ text: e.substring(a.start, a.end),
1462
538
  isMatch: !0
1463
- }), o = l.end;
1464
- return o < e.length && r.push({
1465
- text: e.substring(o),
539
+ }), n = a.end;
540
+ return n < e.length && i.push({
541
+ text: e.substring(n),
1466
542
  isMatch: !1
1467
- }), r;
1468
- }, Do = (e, t) => !t || !e ? [{ text: e, isMatch: !1 }] : Ut(e, [t]), Io = (e, t) => {
1469
- const { content: n, highlights: s } = e;
1470
- return typeof s == "function" ? s(n, t) : Array.isArray(s) ? Ut(n, s) : Do(n, t);
1471
- }, Bo = ["onMouseenter", "onClick"], $o = { class: "suggestion-list__text" }, jo = /* @__PURE__ */ Z({
543
+ }), i;
544
+ }, Vt = (e, t) => !t || !e ? [{ text: e, isMatch: !1 }] : Ve(e, [t]), Gt = (e, t) => {
545
+ const { content: o, highlights: s } = e;
546
+ return typeof s == "function" ? s(o, t) : Array.isArray(s) ? Ve(o, s) : Vt(o, t);
547
+ }, Ut = ["onMouseenter", "onClick"], Xt = { class: "suggestion-list__text" }, Zt = /* @__PURE__ */ X({
1472
548
  __name: "suggestion-list",
1473
549
  props: {
1474
550
  show: { type: Boolean },
@@ -1482,165 +558,165 @@ const Ut = (e, t) => {
1482
558
  onMouseLeave: { type: Function }
1483
559
  },
1484
560
  setup(e) {
1485
- const t = e, n = F(null), s = (i) => i === t.activeKeyboardIndex || i === t.activeMouseIndex, r = (i) => {
1486
- var a;
1487
- (a = t.onMouseEnter) == null || a.call(t, i);
1488
- }, o = () => {
1489
- var i;
1490
- (i = t.onMouseLeave) == null || i.call(t);
1491
- }, l = (i) => {
1492
- var c;
1493
- const a = t.suggestions[i];
1494
- a && ((c = t.onSelect) == null || c.call(t, un(a)));
561
+ const t = e, o = W(null), s = (r) => r === t.activeKeyboardIndex || r === t.activeMouseIndex, i = (r) => {
562
+ var l;
563
+ (l = t.onMouseEnter) == null || l.call(t, r);
564
+ }, n = () => {
565
+ var r;
566
+ (r = t.onMouseLeave) == null || r.call(t);
567
+ }, a = (r) => {
568
+ var u;
569
+ const l = t.suggestions[r];
570
+ l && ((u = t.onSelect) == null || u.call(t, it(l)));
1495
571
  };
1496
572
  return K(
1497
573
  () => t.activeKeyboardIndex,
1498
- (i) => {
1499
- if (i !== -1 && n.value) {
1500
- const a = n.value.children[i];
1501
- a && a.scrollIntoView({ block: "nearest" });
574
+ (r) => {
575
+ if (r !== -1 && o.value) {
576
+ const l = o.value.children[r];
577
+ l && l.scrollIntoView({ block: "nearest" });
1502
578
  }
1503
579
  }
1504
- ), (i, a) => (M(), U(an, { name: "suggestion-slide-up" }, {
1505
- default: j(() => [
1506
- t.show && t.suggestions.length ? (M(), P("div", {
580
+ ), (r, l) => (w(), U(st, { name: "suggestion-slide-up" }, {
581
+ default: B(() => [
582
+ t.show && t.suggestions.length ? (w(), P("div", {
1507
583
  key: 0,
1508
584
  ref_key: "suggestionsListRef",
1509
- ref: n,
585
+ ref: o,
1510
586
  class: "suggestion-list",
1511
- style: cn(t.popupStyle)
587
+ style: rt(t.popupStyle)
1512
588
  }, [
1513
- (M(!0), P(Ie, null, Be(t.suggestions, (c, d) => (M(), P("div", {
1514
- key: d,
1515
- class: Q(["suggestion-list__item", { highlighted: s(d) }]),
1516
- onMouseenter: (u) => r(d),
1517
- onMouseleave: o,
1518
- onClick: (u) => l(d)
589
+ (w(!0), P(fe, null, pe(t.suggestions, (u, p) => (w(), P("div", {
590
+ key: p,
591
+ class: V(["suggestion-list__item", { highlighted: s(p) }]),
592
+ onMouseenter: (f) => i(p),
593
+ onMouseleave: n,
594
+ onClick: (f) => a(p)
1519
595
  }, [
1520
- se(k(Rn), { class: "suggestion-list__icon" }),
1521
- B("span", $o, [
1522
- (M(!0), P(Ie, null, Be(k(Io)(c, t.inputValue), (u, g) => (M(), P("span", {
1523
- key: g,
1524
- class: Q({
1525
- "suggestion-list__text--match": u.isMatch,
1526
- "suggestion-list__text--normal": !u.isMatch
596
+ Y(A(wt), { class: "suggestion-list__icon" }),
597
+ R("span", Xt, [
598
+ (w(!0), P(fe, null, pe(A(Gt)(u, t.inputValue), (f, E) => (w(), P("span", {
599
+ key: E,
600
+ class: V({
601
+ "suggestion-list__text--match": f.isMatch,
602
+ "suggestion-list__text--normal": !f.isMatch
1527
603
  })
1528
- }, pe(u.text), 3))), 128))
604
+ }, ne(f.text), 3))), 128))
1529
605
  ])
1530
- ], 42, Bo))), 128))
1531
- ], 4)) : q("", !0)
606
+ ], 42, Ut))), 128))
607
+ ], 4)) : N("", !0)
1532
608
  ]),
1533
609
  _: 1
1534
610
  }));
1535
611
  }
1536
- }), No = /* @__PURE__ */ J(jo, [["__scopeId", "data-v-76a6f35e"]]), Wo = (e, t) => {
612
+ }), Yt = /* @__PURE__ */ Z(Zt, [["__scopeId", "data-v-76a6f35e"]]), Jt = (e, t) => {
1537
613
  if (!e || !t)
1538
614
  return { text: "", show: !1, showTab: !1 };
1539
- const n = e.toLowerCase(), s = t.toLowerCase();
1540
- if (!n.startsWith(s))
615
+ const o = e.toLowerCase(), s = t.toLowerCase();
616
+ if (!o.startsWith(s))
1541
617
  return { text: "", show: !1, showTab: !1 };
1542
- const r = e.substring(t.length), o = r.length > 0;
618
+ const i = e.substring(t.length), n = i.length > 0;
1543
619
  return {
1544
- text: r,
1545
- show: o,
1546
- showTab: o
620
+ text: i,
621
+ show: n,
622
+ showTab: n
1547
623
  };
1548
- }, z = new re(ae.SUGGESTION);
1549
- function Ko(e) {
624
+ }, H = new J(ee.SUGGESTION);
625
+ function Qt(e) {
1550
626
  const {
1551
627
  editor: t,
1552
- activeSuggestionKeys: n = ["Enter"],
628
+ activeSuggestionKeys: o = ["Enter"],
1553
629
  popupWidth: s = 400,
1554
- showAutoComplete: r = !0,
1555
- filterFn: o,
1556
- onSelect: l
630
+ showAutoComplete: i = !0,
631
+ filterFn: n,
632
+ onSelect: a
1557
633
  } = e;
1558
- let i = null, a = null, c = null, d = !1;
1559
- function u() {
1560
- const p = t.extensionManager.extensions.find(
1561
- (v) => v.name === be.SUGGESTION
1562
- ), f = p == null ? void 0 : p.options, x = (f == null ? void 0 : f.items) || (f == null ? void 0 : f.suggestions) || [];
1563
- return x && typeof x == "object" && "value" in x ? x.value : x;
634
+ let r = null, l = null, u = null, p = !1;
635
+ function f() {
636
+ const d = t.extensionManager.extensions.find(
637
+ (_) => _.name === se.SUGGESTION
638
+ ), c = d == null ? void 0 : d.options, b = (c == null ? void 0 : c.items) || (c == null ? void 0 : c.suggestions) || [];
639
+ return b && typeof b == "object" && "value" in b ? b.value : b;
1564
640
  }
1565
- function g(p) {
1566
- const f = u();
1567
- return o ? o(f, p) : f;
641
+ function E(d) {
642
+ const c = f();
643
+ return n ? n(c, d) : c;
1568
644
  }
1569
- function h(p) {
1570
- return p;
645
+ function S(d) {
646
+ return d;
1571
647
  }
1572
- function E(p, f, x) {
1573
- if (p === -1 || !x[p])
648
+ function j(d, c, b) {
649
+ if (d === -1 || !b[d])
1574
650
  return { text: "", show: !1, showTab: !1 };
1575
- const v = x[p];
1576
- return Wo(v.content, f);
651
+ const _ = b[d];
652
+ return Jt(_.content, c);
1577
653
  }
1578
- function w(p, f, x) {
1579
- if (!f) return;
1580
- (l == null ? void 0 : l(x)) !== !1 && t.commands.setContent(x.content), t.commands.focus();
654
+ function L(d, c, b) {
655
+ if (!c) return;
656
+ (a == null ? void 0 : a(b)) !== !1 && t.commands.setContent(b.content), t.commands.focus();
1581
657
  }
1582
- function T(p, f) {
1583
- const x = f.filteredSuggestions[f.selectedIndex];
1584
- x && w(p, f.range, x);
1585
- const v = p.state.tr;
1586
- v.setMeta(z, { type: "close" }), p.dispatch(v);
658
+ function C(d, c) {
659
+ const b = c.filteredSuggestions[c.selectedIndex];
660
+ b && L(d, c.range, b);
661
+ const _ = d.state.tr;
662
+ _.setMeta(H, { type: "close" }), d.dispatch(_);
1587
663
  }
1588
- function m(p, f) {
1589
- c == null || c();
1590
- const v = p.dom.closest(".tr-sender") || p.dom, S = () => {
664
+ function h(d, c) {
665
+ u == null || u();
666
+ const _ = d.dom.closest(".tr-sender") || d.dom, x = () => {
1591
667
  if (typeof s == "number")
1592
668
  return `${s}px`;
1593
669
  if (typeof s == "string") {
1594
670
  if (s.endsWith("%")) {
1595
- const _ = parseFloat(s) / 100;
1596
- return `${v.offsetWidth * _}px`;
671
+ const v = parseFloat(s) / 100;
672
+ return `${_.offsetWidth * v}px`;
1597
673
  }
1598
674
  return s;
1599
675
  }
1600
676
  return "400px";
1601
677
  };
1602
- c = mt(v, f, () => {
1603
- yt(v, f, {
678
+ u = Se(_, c, () => {
679
+ Ce(_, c, {
1604
680
  placement: "top-start",
1605
681
  middleware: [
1606
- ht(8),
1607
- xt({
682
+ Ae(8),
683
+ we({
1608
684
  fallbackPlacements: ["bottom-start", "top-start"]
1609
685
  }),
1610
- gt({ padding: 8 })
686
+ ke({ padding: 8 })
1611
687
  ]
1612
- }).then(({ x: _, y: b }) => {
1613
- f.style.position = "absolute", f.style.left = `${_}px`, f.style.top = `${b}px`, f.style.zIndex = "2000", f.style.width = S();
688
+ }).then(({ x: v, y: m }) => {
689
+ c.style.position = "absolute", c.style.left = `${v}px`, c.style.top = `${m}px`, c.style.zIndex = "2000", c.style.width = x();
1614
690
  });
1615
691
  });
1616
692
  }
1617
- function y(p) {
1618
- if (!r || !p.active || !p.autoCompleteText || !p.range)
1619
- return Le.empty;
1620
- const f = t.state.doc, { selection: x } = t.state, v = x.$head.pos;
1621
- if (!(v >= f.content.size - 1))
1622
- return Le.empty;
1623
- const _ = Dt.widget(
1624
- v,
693
+ function g(d) {
694
+ if (!i || !d.active || !d.autoCompleteText || !d.range)
695
+ return le.empty;
696
+ const c = t.state.doc, { selection: b } = t.state, _ = b.$head.pos;
697
+ if (!(_ >= c.content.size - 1))
698
+ return le.empty;
699
+ const v = He.widget(
700
+ _,
1625
701
  () => {
1626
- const b = document.createElement("span");
1627
- b.className = "suggestion-autocomplete", b.contentEditable = "false";
1628
- const L = document.createElement("span");
1629
- if (L.className = "autocomplete-text", L.textContent = p.autoCompleteText, b.appendChild(L), p.showTabIndicator) {
702
+ const m = document.createElement("span");
703
+ m.className = "suggestion-autocomplete", m.contentEditable = "false";
704
+ const k = document.createElement("span");
705
+ if (k.className = "autocomplete-text", k.textContent = d.autoCompleteText, m.appendChild(k), d.showTabIndicator) {
1630
706
  const $ = document.createElement("span");
1631
- $.className = "tab-hint", $.textContent = "TAB", b.appendChild($);
707
+ $.className = "tab-hint", $.textContent = "TAB", m.appendChild($);
1632
708
  }
1633
- return b;
709
+ return m;
1634
710
  },
1635
711
  {
1636
712
  side: 1
1637
713
  // 显示在光标右侧
1638
714
  }
1639
715
  );
1640
- return Le.create(f, [_]);
716
+ return le.create(c, [v]);
1641
717
  }
1642
- return new ie({
1643
- key: z,
718
+ return new Q({
719
+ key: H,
1644
720
  state: {
1645
721
  init() {
1646
722
  return {
@@ -1653,12 +729,12 @@ function Ko(e) {
1653
729
  showTabIndicator: !1
1654
730
  };
1655
731
  },
1656
- apply(p, f) {
1657
- const x = p.getMeta(z);
1658
- if (x) {
1659
- if (x.type === "close")
1660
- return d = !0, setTimeout(() => {
1661
- d = !1;
732
+ apply(d, c) {
733
+ const b = d.getMeta(H);
734
+ if (b) {
735
+ if (b.type === "close")
736
+ return p = !0, setTimeout(() => {
737
+ p = !1;
1662
738
  }, 0), {
1663
739
  active: !1,
1664
740
  range: null,
@@ -1668,19 +744,19 @@ function Ko(e) {
1668
744
  autoCompleteText: "",
1669
745
  showTabIndicator: !1
1670
746
  };
1671
- if (x.type === "updateIndex") {
1672
- const L = { ...f, selectedIndex: x.index }, $ = E(x.index, f.query, f.filteredSuggestions);
747
+ if (b.type === "updateIndex") {
748
+ const k = { ...c, selectedIndex: b.index }, $ = j(b.index, c.query, c.filteredSuggestions);
1673
749
  return {
1674
- ...L,
750
+ ...k,
1675
751
  autoCompleteText: $.text,
1676
752
  showTabIndicator: $.showTab
1677
753
  };
1678
754
  }
1679
755
  }
1680
- if (d || !p.docChanged && !p.selectionSet)
1681
- return f;
1682
- const v = p.doc.textContent.trim(), S = v;
1683
- if (!v)
756
+ if (p || !d.docChanged && !d.selectionSet)
757
+ return c;
758
+ const _ = d.doc.textContent.trim(), x = _;
759
+ if (!_)
1684
760
  return {
1685
761
  active: !1,
1686
762
  range: null,
@@ -1690,8 +766,8 @@ function Ko(e) {
1690
766
  autoCompleteText: "",
1691
767
  showTabIndicator: !1
1692
768
  };
1693
- const _ = g(S);
1694
- if (_.length === 0)
769
+ const v = E(x);
770
+ if (v.length === 0)
1695
771
  return {
1696
772
  active: !1,
1697
773
  range: null,
@@ -1701,23 +777,23 @@ function Ko(e) {
1701
777
  autoCompleteText: "",
1702
778
  showTabIndicator: !1
1703
779
  };
1704
- const b = E(0, S, _);
780
+ const m = j(0, x, v);
1705
781
  return {
1706
782
  active: !0,
1707
- range: { from: 0, to: p.doc.content.size },
1708
- query: S,
1709
- filteredSuggestions: _,
783
+ range: { from: 0, to: d.doc.content.size },
784
+ query: x,
785
+ filteredSuggestions: v,
1710
786
  selectedIndex: 0,
1711
- autoCompleteText: b.text,
1712
- showTabIndicator: b.showTab
787
+ autoCompleteText: m.text,
788
+ showTabIndicator: m.showTab
1713
789
  };
1714
790
  }
1715
791
  },
1716
792
  props: {
1717
- decorations(p) {
1718
- const f = this.getState(p);
1719
- return y(
1720
- f || {
793
+ decorations(d) {
794
+ const c = this.getState(d);
795
+ return g(
796
+ c || {
1721
797
  active: !1,
1722
798
  range: null,
1723
799
  autoCompleteText: "",
@@ -1725,79 +801,79 @@ function Ko(e) {
1725
801
  }
1726
802
  );
1727
803
  },
1728
- handleKeyDown(p, f) {
1729
- const x = z.getState(p.state);
1730
- if (!(x != null && x.active))
804
+ handleKeyDown(d, c) {
805
+ const b = H.getState(d.state);
806
+ if (!(b != null && b.active))
1731
807
  return !1;
1732
- if (I(f, "TAB") && x.autoCompleteText)
1733
- return f.preventDefault(), T(p, x), !0;
1734
- if (we(f, ["ARROW_UP", "ARROW_DOWN"])) {
1735
- f.preventDefault();
1736
- const v = I(f, "ARROW_DOWN") ? 1 : -1, S = x.filteredSuggestions.length;
1737
- let _ = x.selectedIndex + v;
1738
- _ < 0 ? _ = S - 1 : _ >= S && (_ = 0);
1739
- const b = p.state.tr;
1740
- return b.setMeta(z, {
808
+ if (I(c, "TAB") && b.autoCompleteText)
809
+ return c.preventDefault(), C(d, b), !0;
810
+ if (ie(c, ["ARROW_UP", "ARROW_DOWN"])) {
811
+ c.preventDefault();
812
+ const _ = I(c, "ARROW_DOWN") ? 1 : -1, x = b.filteredSuggestions.length;
813
+ let v = b.selectedIndex + _;
814
+ v < 0 ? v = x - 1 : v >= x && (v = 0);
815
+ const m = d.state.tr;
816
+ return m.setMeta(H, {
1741
817
  type: "updateIndex",
1742
- index: _
1743
- }), p.dispatch(b), !0;
818
+ index: v
819
+ }), d.dispatch(m), !0;
1744
820
  }
1745
- if (n.includes(f.key))
1746
- return f.preventDefault(), T(p, x), !0;
1747
- if (I(f, "ESCAPE")) {
1748
- f.preventDefault();
1749
- const v = p.state.tr;
1750
- return v.setMeta(z, { type: "close" }), p.dispatch(v), !0;
821
+ if (o.includes(c.key))
822
+ return c.preventDefault(), C(d, b), !0;
823
+ if (I(c, "ESCAPE")) {
824
+ c.preventDefault();
825
+ const _ = d.state.tr;
826
+ return _.setMeta(H, { type: "close" }), d.dispatch(_), !0;
1751
827
  }
1752
828
  return !1;
1753
829
  }
1754
830
  },
1755
831
  view() {
1756
832
  return {
1757
- update(p) {
1758
- const f = z.getState(p.state);
1759
- f != null && f.active && f.filteredSuggestions.length > 0 ? (i ? i.updateProps({
1760
- show: f.active && f.filteredSuggestions.length > 0,
1761
- suggestions: f.filteredSuggestions,
833
+ update(d) {
834
+ const c = H.getState(d.state);
835
+ c != null && c.active && c.filteredSuggestions.length > 0 ? (r ? r.updateProps({
836
+ show: c.active && c.filteredSuggestions.length > 0,
837
+ suggestions: c.filteredSuggestions,
1762
838
  popupStyle: {
1763
839
  // 宽度在 computePosition 回调中动态设置,这里只设置 maxWidth
1764
840
  maxWidth: "100%"
1765
841
  },
1766
- activeKeyboardIndex: f.selectedIndex,
1767
- inputValue: f.query
1768
- }) : (i = new Ot(No, {
842
+ activeKeyboardIndex: c.selectedIndex,
843
+ inputValue: c.query
844
+ }) : (r = new Ne(Yt, {
1769
845
  props: {
1770
- show: f.active && f.filteredSuggestions.length > 0,
1771
- suggestions: f.filteredSuggestions,
846
+ show: c.active && c.filteredSuggestions.length > 0,
847
+ suggestions: c.filteredSuggestions,
1772
848
  popupStyle: {
1773
849
  // 宽度在 computePosition 回调中动态设置,这里只设置 maxWidth
1774
850
  maxWidth: "100%"
1775
851
  },
1776
- activeKeyboardIndex: f.selectedIndex,
852
+ activeKeyboardIndex: c.selectedIndex,
1777
853
  activeMouseIndex: -1,
1778
- inputValue: f.query,
1779
- onSelect: (x) => {
1780
- w(p, f.range, x);
1781
- const v = p.state.tr;
1782
- v.setMeta(z, { type: "close" }), p.dispatch(v);
854
+ inputValue: c.query,
855
+ onSelect: (b) => {
856
+ L(d, c.range, b);
857
+ const _ = d.state.tr;
858
+ _.setMeta(H, { type: "close" }), d.dispatch(_);
1783
859
  },
1784
- onMouseEnter: (x) => {
1785
- const v = p.state.tr;
1786
- v.setMeta(z, { type: "updateIndex", index: x }), p.dispatch(v);
860
+ onMouseEnter: (b) => {
861
+ const _ = d.state.tr;
862
+ _.setMeta(H, { type: "updateIndex", index: b }), d.dispatch(_);
1787
863
  }
1788
864
  },
1789
865
  editor: t
1790
- }), a = i.element, document.body.appendChild(a)), a && m(p, a)) : (i && (c == null || c(), c = null, i.destroy(), i = null), a && (a.remove(), a = null));
866
+ }), l = r.element, document.body.appendChild(l)), l && h(d, l)) : (r && (u == null || u(), u = null, r.destroy(), r = null), l && (l.remove(), l = null));
1791
867
  },
1792
868
  destroy() {
1793
- c == null || c(), i == null || i.destroy(), a == null || a.remove();
869
+ u == null || u(), r == null || r.destroy(), l == null || l.remove();
1794
870
  }
1795
871
  };
1796
872
  }
1797
873
  });
1798
874
  }
1799
- const Xt = It.create({
1800
- name: be.SUGGESTION,
875
+ const Ge = We.create({
876
+ name: se.SUGGESTION,
1801
877
  addOptions() {
1802
878
  return {
1803
879
  items: [],
@@ -1813,11 +889,11 @@ const Xt = It.create({
1813
889
  };
1814
890
  },
1815
891
  onCreate() {
1816
- ke(this.options.items) && (this.storage.watchStopHandle = K(
892
+ ce(this.options.items) && (this.storage.watchStopHandle = K(
1817
893
  this.options.items,
1818
894
  () => {
1819
895
  const e = this.editor.state.tr;
1820
- e.setMeta(z, { type: "update" }), this.editor.view.dispatch(e);
896
+ e.setMeta(H, { type: "update" }), this.editor.view.dispatch(e);
1821
897
  },
1822
898
  { deep: !0 }
1823
899
  ));
@@ -1827,77 +903,77 @@ const Xt = It.create({
1827
903
  },
1828
904
  addProseMirrorPlugins() {
1829
905
  return [
1830
- Ko({
906
+ Qt({
1831
907
  editor: this.editor,
1832
908
  ...this.options
1833
909
  })
1834
910
  ];
1835
911
  }
1836
912
  });
1837
- function qo(e, t) {
1838
- return Xt.configure({
913
+ function en(e, t) {
914
+ return Ge.configure({
1839
915
  items: e,
1840
916
  ...t
1841
917
  });
1842
918
  }
1843
- function Ho(e) {
919
+ function tn(e) {
1844
920
  const t = [];
1845
- return e.state.doc.descendants((n, s) => {
1846
- n.type.name === A.TEMPLATE_BLOCK && t.push({ node: n, pos: s });
921
+ return e.state.doc.descendants((o, s) => {
922
+ o.type.name === T.TEMPLATE_BLOCK && t.push({ node: o, pos: s });
1847
923
  }), t;
1848
924
  }
1849
- const zo = {
925
+ const nn = {
1850
926
  /**
1851
927
  * 设置模板数据(批量)
1852
928
  */
1853
929
  setTemplateData: (e) => ({ commands: t }) => {
1854
930
  t.clearContent();
1855
- const n = [];
931
+ const o = [];
1856
932
  return e.forEach((s) => {
1857
- s.type === G.TEXT ? s.content && n.push({
1858
- type: A.TEXT,
933
+ s.type === G.TEXT ? s.content && o.push({
934
+ type: T.TEXT,
1859
935
  text: s.content
1860
- }) : s.type === G.BLOCK ? n.push({
1861
- type: A.TEMPLATE_BLOCK,
936
+ }) : s.type === G.BLOCK ? o.push({
937
+ type: T.TEMPLATE_BLOCK,
1862
938
  attrs: {
1863
- id: s.id || ve("template"),
939
+ id: s.id || re("template"),
1864
940
  content: s.content
1865
941
  },
1866
942
  content: s.content ? [
1867
943
  {
1868
- type: A.TEXT,
944
+ type: T.TEXT,
1869
945
  text: s.content
1870
946
  }
1871
947
  ] : []
1872
- }) : s.type === G.SELECT && n.push({
1873
- type: A.TEMPLATE_SELECT,
948
+ }) : s.type === G.SELECT && o.push({
949
+ type: T.TEMPLATE_SELECT,
1874
950
  attrs: {
1875
- id: s.id || ve("select"),
951
+ id: s.id || re("select"),
1876
952
  placeholder: s.placeholder,
1877
953
  options: s.options,
1878
954
  value: s.value || null
1879
955
  }
1880
956
  });
1881
- }), n.length > 0 && t.insertContent({
1882
- type: A.PARAGRAPH,
1883
- content: n
957
+ }), o.length > 0 && t.insertContent({
958
+ type: T.PARAGRAPH,
959
+ content: o
1884
960
  }), !0;
1885
961
  },
1886
962
  /**
1887
963
  * 插入模板块
1888
964
  */
1889
965
  insertTemplate: (e) => ({ commands: t }) => {
1890
- const n = e.content || "";
966
+ const o = e.content || "";
1891
967
  return t.insertContent({
1892
- type: A.TEMPLATE_BLOCK,
968
+ type: T.TEMPLATE_BLOCK,
1893
969
  attrs: {
1894
- id: e.id || ve("template"),
1895
- content: n
970
+ id: e.id || re("template"),
971
+ content: o
1896
972
  },
1897
- content: n ? [
973
+ content: o ? [
1898
974
  {
1899
- type: A.TEXT,
1900
- text: n
975
+ type: T.TEXT,
976
+ text: o
1901
977
  }
1902
978
  ] : []
1903
979
  });
@@ -1906,22 +982,22 @@ const zo = {
1906
982
  * 聚焦到第一个模板块
1907
983
  */
1908
984
  focusFirstTemplate: () => ({ editor: e }) => {
1909
- const t = Ho(e);
985
+ const t = tn(e);
1910
986
  return setTimeout(() => {
1911
- var o;
1912
- const { state: n, view: s } = e, r = n.tr;
987
+ var n;
988
+ const { state: o, view: s } = e, i = o.tr;
1913
989
  try {
1914
- let l;
990
+ let a;
1915
991
  if (t.length === 0)
1916
- l = n.doc.content.size - 1;
992
+ a = o.doc.content.size - 1;
1917
993
  else {
1918
- const { node: a, pos: c } = t[0], d = ((o = a.textContent) == null ? void 0 : o.length) || 0;
1919
- l = c + 1 + d;
994
+ const { node: l, pos: u } = t[0], p = ((n = l.textContent) == null ? void 0 : n.length) || 0;
995
+ a = u + 1 + p;
1920
996
  }
1921
- const i = O.create(n.doc, l);
1922
- r.setSelection(i), s.dispatch(r), s.focus();
1923
- } catch (l) {
1924
- console.error("[focusFirstTemplate] 设置光标失败", l);
997
+ const r = D.create(o.doc, a);
998
+ i.setSelection(r), s.dispatch(i), s.focus();
999
+ } catch (a) {
1000
+ console.error("[focusFirstTemplate] 设置光标失败", a);
1925
1001
  }
1926
1002
  }, 0), !0;
1927
1003
  },
@@ -1929,72 +1005,72 @@ const zo = {
1929
1005
  * 插入选择器
1930
1006
  */
1931
1007
  insertTemplateSelect: (e) => ({ commands: t }) => t.insertContent({
1932
- type: A.TEMPLATE_SELECT,
1008
+ type: T.TEMPLATE_SELECT,
1933
1009
  attrs: {
1934
- id: e.id || ve("select"),
1010
+ id: e.id || re("select"),
1935
1011
  placeholder: e.placeholder || "Please select",
1936
1012
  options: e.options || [],
1937
1013
  value: e.value || null
1938
1014
  }
1939
1015
  })
1940
- }, C = "​";
1941
- function tt(e) {
1942
- return Yt(e).map((n) => n.content).join("");
1016
+ }, y = "​";
1017
+ function be(e) {
1018
+ return Ue(e).map((o) => o.content).join("");
1943
1019
  }
1944
- function Yt(e) {
1020
+ function Ue(e) {
1945
1021
  const t = [];
1946
- return e.state.doc.descendants((n, s, r) => {
1947
- if (r && r.type.name === A.PARAGRAPH) {
1948
- if (n.type.name === A.TEMPLATE_BLOCK) {
1949
- const o = (n.textContent || "").replace(new RegExp(C, "g"), "");
1022
+ return e.state.doc.descendants((o, s, i) => {
1023
+ if (i && i.type.name === T.PARAGRAPH) {
1024
+ if (o.type.name === T.TEMPLATE_BLOCK) {
1025
+ const n = (o.textContent || "").replace(new RegExp(y, "g"), "");
1950
1026
  t.push({
1951
1027
  type: G.BLOCK,
1952
- content: o
1028
+ content: n
1953
1029
  });
1954
- } else if (n.type.name === A.TEMPLATE_SELECT) {
1955
- const o = n.attrs.options.find((i) => i.value === n.attrs.value), l = (o == null ? void 0 : o.value) || "";
1030
+ } else if (o.type.name === T.TEMPLATE_SELECT) {
1031
+ const n = o.attrs.options.find((r) => r.value === o.attrs.value), a = (n == null ? void 0 : n.value) || "";
1956
1032
  t.push({
1957
1033
  type: G.SELECT,
1958
- content: l
1034
+ content: a
1959
1035
  });
1960
- } else if (n.type.name === A.TEXT) {
1961
- const o = (n.text || "").replace(new RegExp(C, "g"), "");
1962
- if (o) {
1963
- const l = t[t.length - 1];
1964
- l && l.type === G.TEXT ? l.content += o : t.push({
1036
+ } else if (o.type.name === T.TEXT) {
1037
+ const n = (o.text || "").replace(new RegExp(y, "g"), "");
1038
+ if (n) {
1039
+ const a = t[t.length - 1];
1040
+ a && a.type === G.TEXT ? a.content += n : t.push({
1965
1041
  type: G.TEXT,
1966
- content: o
1042
+ content: n
1967
1043
  });
1968
1044
  }
1969
1045
  }
1970
1046
  }
1971
1047
  }), t;
1972
1048
  }
1973
- const Fo = /* @__PURE__ */ Z({
1049
+ const on = /* @__PURE__ */ X({
1974
1050
  __name: "template-block-view",
1975
1051
  props: {
1976
1052
  node: {}
1977
1053
  },
1978
1054
  setup(e) {
1979
- const t = e, n = R(() => {
1055
+ const t = e, o = M(() => {
1980
1056
  const s = t.node.textContent || "";
1981
- return s.length === 0 || s === C;
1057
+ return s.length === 0 || s === y;
1982
1058
  });
1983
- return (s, r) => (M(), U(k(lt), {
1059
+ return (s, i) => (w(), U(A(Ee), {
1984
1060
  as: "span",
1985
- class: Q(["template-block", { "is-empty": n.value }]),
1061
+ class: V(["template-block", { "is-empty": o.value }]),
1986
1062
  "data-id": e.node.attrs.id
1987
1063
  }, {
1988
- default: j(() => [
1989
- r[0] || (r[0] = B("span", {
1064
+ default: B(() => [
1065
+ i[0] || (i[0] = R("span", {
1990
1066
  contenteditable: "false",
1991
1067
  class: "template-block__prefix"
1992
1068
  }, " ", -1)),
1993
- se(k(bn), {
1069
+ Y(A(ht), {
1994
1070
  as: "span",
1995
1071
  class: "template-block__content"
1996
1072
  }),
1997
- r[1] || (r[1] = B("span", {
1073
+ i[1] || (i[1] = R("span", {
1998
1074
  contenteditable: "false",
1999
1075
  class: "template-block__suffix"
2000
1076
  }, " ", -1))
@@ -2002,237 +1078,237 @@ const Fo = /* @__PURE__ */ Z({
2002
1078
  _: 1
2003
1079
  }, 8, ["class", "data-id"]));
2004
1080
  }
2005
- }), Vo = /* @__PURE__ */ J(Fo, [["__scopeId", "data-v-aa55b9db"]]);
2006
- function Go(e) {
1081
+ }), sn = /* @__PURE__ */ Z(on, [["__scopeId", "data-v-aa55b9db"]]);
1082
+ function rn(e) {
2007
1083
  const t = [];
2008
- let { tr: n } = e;
2009
- return e.doc.descendants((s, r, o) => {
2010
- if (s.type.name === A.PARAGRAPH && s.childCount > 0) {
2011
- const { lastChild: l, firstChild: i } = s;
2012
- if (i && i.type.name === A.TEMPLATE_BLOCK && t.push(r + 1), l && l.type.name === A.TEMPLATE_BLOCK) {
2013
- const a = r + s.nodeSize - 1;
2014
- n.doc.textBetween(a - 1, a, "", "") !== C && t.push(a);
1084
+ let { tr: o } = e;
1085
+ return e.doc.descendants((s, i, n) => {
1086
+ if (s.type.name === T.PARAGRAPH && s.childCount > 0) {
1087
+ const { lastChild: a, firstChild: r } = s;
1088
+ if (r && r.type.name === T.TEMPLATE_BLOCK && t.push(i + 1), a && a.type.name === T.TEMPLATE_BLOCK) {
1089
+ const l = i + s.nodeSize - 1;
1090
+ o.doc.textBetween(l - 1, l, "", "") !== y && t.push(l);
2015
1091
  }
2016
- l === i && l && l.isText && l.text === C && t.push(["remove", r + 1]);
1092
+ a === r && a && a.isText && a.text === y && t.push(["remove", i + 1]);
2017
1093
  }
2018
- if (s.type.name === A.TEMPLATE_BLOCK && s.content.size === 0 && t.push(r + 1), s.type.name === A.TEMPLATE_BLOCK && o) {
2019
- let l = -1;
2020
- if (o.forEach((i, a, c) => {
2021
- i === s && (l = c);
2022
- }), l > -1 && l < o.childCount - 1 && o.child(l + 1).type.name === A.TEMPLATE_BLOCK) {
2023
- const a = r + s.nodeSize;
2024
- n.doc.textBetween(a, a + 1, "", "") !== C && t.push(a);
1094
+ if (s.type.name === T.TEMPLATE_BLOCK && s.content.size === 0 && t.push(i + 1), s.type.name === T.TEMPLATE_BLOCK && n) {
1095
+ let a = -1;
1096
+ if (n.forEach((r, l, u) => {
1097
+ r === s && (a = u);
1098
+ }), a > -1 && a < n.childCount - 1 && n.child(a + 1).type.name === T.TEMPLATE_BLOCK) {
1099
+ const l = i + s.nodeSize;
1100
+ o.doc.textBetween(l, l + 1, "", "") !== y && t.push(l);
2025
1101
  }
2026
1102
  }
2027
- }), t.length > 0 ? (t.sort((s, r) => {
2028
- const o = Array.isArray(s) ? s[1] : s;
2029
- return (Array.isArray(r) ? r[1] : r) - o;
1103
+ }), t.length > 0 ? (t.sort((s, i) => {
1104
+ const n = Array.isArray(s) ? s[1] : s;
1105
+ return (Array.isArray(i) ? i[1] : i) - n;
2030
1106
  }).forEach((s) => {
2031
- Array.isArray(s) && s[0] === "remove" ? n = n.delete(s[1], s[1] + 1) : typeof s == "number" && (n = n.insertText(C, s, s));
2032
- }), n) : null;
2033
- }
2034
- function Uo() {
2035
- return new ie({
2036
- key: new re(ae.TEMPLATE_BLOCK_ZERO_WIDTH),
2037
- appendTransaction(e, t, n) {
2038
- return e.some((r) => r.docChanged) ? Go(n) : null;
1107
+ Array.isArray(s) && s[0] === "remove" ? o = o.delete(s[1], s[1] + 1) : typeof s == "number" && (o = o.insertText(y, s, s));
1108
+ }), o) : null;
1109
+ }
1110
+ function an() {
1111
+ return new Q({
1112
+ key: new J(ee.TEMPLATE_BLOCK_ZERO_WIDTH),
1113
+ appendTransaction(e, t, o) {
1114
+ return e.some((i) => i.docChanged) ? rn(o) : null;
2039
1115
  }
2040
1116
  });
2041
1117
  }
2042
- function Xo() {
2043
- return new ie({
2044
- key: new re(ae.TEMPLATE_BLOCK_KEYBOARD),
1118
+ function ln() {
1119
+ return new Q({
1120
+ key: new J(ee.TEMPLATE_BLOCK_KEYBOARD),
2045
1121
  props: {
2046
1122
  handleKeyDown(e, t) {
2047
- var i, a, c, d, u, g, h, E, w;
2048
- const { state: n, dispatch: s } = e, { selection: r } = n, { $from: o } = r;
2049
- if (I(t, "ARROW_LEFT") && o.nodeBefore && o.nodeBefore.isText && o.nodeBefore.text && o.nodeBefore.text === C) {
2050
- const T = o.parent, m = o.index();
2051
- if (m >= 2) {
2052
- if (T.child(m - 2).type.name === A.TEMPLATE_BLOCK) {
2053
- const p = o.pos - 2;
2054
- return s(n.tr.setSelection(O.create(n.doc, p))), t.preventDefault(), !0;
1123
+ var r, l, u, p, f, E, S, j, L;
1124
+ const { state: o, dispatch: s } = e, { selection: i } = o, { $from: n } = i;
1125
+ if (I(t, "ARROW_LEFT") && n.nodeBefore && n.nodeBefore.isText && n.nodeBefore.text && n.nodeBefore.text === y) {
1126
+ const C = n.parent, h = n.index();
1127
+ if (h >= 2) {
1128
+ if (C.child(h - 2).type.name === T.TEMPLATE_BLOCK) {
1129
+ const d = n.pos - 2;
1130
+ return s(o.tr.setSelection(D.create(o.doc, d))), t.preventDefault(), !0;
2055
1131
  }
2056
- } else if (m === 1 && o.pos !== 0) {
2057
- const y = o.before() - 1;
2058
- if (y >= 0)
2059
- return s(n.tr.setSelection(O.create(n.doc, y))), t.preventDefault(), !0;
1132
+ } else if (h === 1 && n.pos !== 0) {
1133
+ const g = n.before() - 1;
1134
+ if (g >= 0)
1135
+ return s(o.tr.setSelection(D.create(o.doc, g))), t.preventDefault(), !0;
2060
1136
  }
2061
1137
  }
2062
- if (I(t, "ARROW_RIGHT") && o.nodeAfter && o.nodeAfter.isText && o.nodeAfter.text === C) {
2063
- const T = o.parent, m = o.index();
2064
- if (m < T.childCount - 1) {
2065
- if (T.child(m + 1).type.name === A.TEMPLATE_BLOCK) {
2066
- const p = o.pos + 2;
2067
- return s(n.tr.setSelection(O.create(n.doc, p))), t.preventDefault(), !0;
1138
+ if (I(t, "ARROW_RIGHT") && n.nodeAfter && n.nodeAfter.isText && n.nodeAfter.text === y) {
1139
+ const C = n.parent, h = n.index();
1140
+ if (h < C.childCount - 1) {
1141
+ if (C.child(h + 1).type.name === T.TEMPLATE_BLOCK) {
1142
+ const d = n.pos + 2;
1143
+ return s(o.tr.setSelection(D.create(o.doc, d))), t.preventDefault(), !0;
2068
1144
  }
2069
- } else if (m === T.childCount - 1 && n.doc.lastChild !== o.node()) {
2070
- const y = o.after() + 1;
2071
- return s(n.tr.setSelection(O.create(n.doc, y))), t.preventDefault(), !0;
1145
+ } else if (h === C.childCount - 1 && o.doc.lastChild !== n.node()) {
1146
+ const g = n.after() + 1;
1147
+ return s(o.tr.setSelection(D.create(o.doc, g))), t.preventDefault(), !0;
2072
1148
  }
2073
1149
  }
2074
- const l = o.node();
2075
- if (l.type.name === A.TEMPLATE_BLOCK) {
2076
- const T = l.textContent || "";
2077
- if (T === "" || T === C) {
2078
- if (we(t, ["ARROW_LEFT", "ARROW_RIGHT"])) {
2079
- const m = I(t, "ARROW_LEFT") ? o.before() : o.after();
2080
- if (r.from !== m)
2081
- return s(n.tr.setSelection(O.create(n.doc, m))), t.preventDefault(), !0;
1150
+ const a = n.node();
1151
+ if (a.type.name === T.TEMPLATE_BLOCK) {
1152
+ const C = a.textContent || "";
1153
+ if (C === "" || C === y) {
1154
+ if (ie(t, ["ARROW_LEFT", "ARROW_RIGHT"])) {
1155
+ const h = I(t, "ARROW_LEFT") ? n.before() : n.after();
1156
+ if (i.from !== h)
1157
+ return s(o.tr.setSelection(D.create(o.doc, h))), t.preventDefault(), !0;
2082
1158
  }
2083
1159
  } else {
2084
- if (I(t, "ARROW_LEFT") && o.pos === o.start()) {
2085
- const m = o.before();
2086
- return s(n.tr.setSelection(O.create(n.doc, m))), t.preventDefault(), !0;
1160
+ if (I(t, "ARROW_LEFT") && n.pos === n.start()) {
1161
+ const h = n.before();
1162
+ return s(o.tr.setSelection(D.create(o.doc, h))), t.preventDefault(), !0;
2087
1163
  }
2088
- if (I(t, "ARROW_RIGHT") && o.pos === o.end()) {
2089
- const m = o.after();
2090
- return s(n.tr.setSelection(O.create(n.doc, m))), t.preventDefault(), !0;
1164
+ if (I(t, "ARROW_RIGHT") && n.pos === n.end()) {
1165
+ const h = n.after();
1166
+ return s(o.tr.setSelection(D.create(o.doc, h))), t.preventDefault(), !0;
2091
1167
  }
2092
1168
  }
2093
1169
  }
2094
- if (I(t, "BACKSPACE") && r.empty) {
2095
- const T = o.node(), m = o.nodeBefore;
2096
- if (T.type.name === A.TEMPLATE_BLOCK) {
2097
- const y = T.textContent || "";
2098
- if (o.pos === o.end() && y.length === 1 && y !== C) {
2099
- const p = o.pos - 1;
2100
- return s(n.tr.insertText(C, p, p + 1)), t.preventDefault(), !0;
1170
+ if (I(t, "BACKSPACE") && i.empty) {
1171
+ const C = n.node(), h = n.nodeBefore;
1172
+ if (C.type.name === T.TEMPLATE_BLOCK) {
1173
+ const g = C.textContent || "";
1174
+ if (n.pos === n.end() && g.length === 1 && g !== y) {
1175
+ const d = n.pos - 1;
1176
+ return s(o.tr.insertText(y, d, d + 1)), t.preventDefault(), !0;
2101
1177
  }
2102
- if (y === C) {
2103
- const p = o.before(), f = n.tr.setSelection(O.create(n.doc, p));
2104
- return s(f), t.preventDefault(), !0;
1178
+ if (g === y) {
1179
+ const d = n.before(), c = o.tr.setSelection(D.create(o.doc, d));
1180
+ return s(c), t.preventDefault(), !0;
2105
1181
  }
2106
- if (y === "") {
2107
- const p = o.before(), f = n.tr.setSelection(O.create(n.doc, p));
2108
- return s(f), t.preventDefault(), !0;
1182
+ if (g === "") {
1183
+ const d = n.before(), c = o.tr.setSelection(D.create(o.doc, d));
1184
+ return s(c), t.preventDefault(), !0;
2109
1185
  }
2110
- if (o.pos === o.start() && y.length > 0 && y !== C) {
2111
- const p = o.before();
2112
- return s(n.tr.setSelection(O.create(n.doc, p))), t.preventDefault(), !0;
1186
+ if (n.pos === n.start() && g.length > 0 && g !== y) {
1187
+ const d = n.before();
1188
+ return s(o.tr.setSelection(D.create(o.doc, d))), t.preventDefault(), !0;
2113
1189
  }
2114
1190
  return !1;
2115
1191
  }
2116
- if (m && m.isText && ((i = m.text) == null ? void 0 : i.length) === 1 && m.text !== C && o.nodeAfter && o.nodeAfter.type.name === A.TEMPLATE_BLOCK) {
2117
- const y = o.pos - m.nodeSize, p = o.pos;
2118
- let f = n.tr.delete(y, p);
2119
- return f = f.insertText(C, y, y), s(f), t.preventDefault(), !0;
1192
+ if (h && h.isText && ((r = h.text) == null ? void 0 : r.length) === 1 && h.text !== y && n.nodeAfter && n.nodeAfter.type.name === T.TEMPLATE_BLOCK) {
1193
+ const g = n.pos - h.nodeSize, d = n.pos;
1194
+ let c = o.tr.delete(g, d);
1195
+ return c = c.insertText(y, g, g), s(c), t.preventDefault(), !0;
2120
1196
  }
2121
- if (m && m.type.name === A.TEMPLATE_BLOCK) {
2122
- const y = m.textContent || "";
2123
- if (y.length === 0 || y === C) {
2124
- const f = o.parent, x = o.index(), v = o.nodeAfter;
2125
- let S = o.pos - m.nodeSize, _ = o.pos;
2126
- if (x > 1) {
2127
- const b = f.child(x - 2);
2128
- b && b.isText && b.text === C && (S = S - 1);
1197
+ if (h && h.type.name === T.TEMPLATE_BLOCK) {
1198
+ const g = h.textContent || "";
1199
+ if (g.length === 0 || g === y) {
1200
+ const c = n.parent, b = n.index(), _ = n.nodeAfter;
1201
+ let x = n.pos - h.nodeSize, v = n.pos;
1202
+ if (b > 1) {
1203
+ const m = c.child(b - 2);
1204
+ m && m.isText && m.text === y && (x = x - 1);
2129
1205
  }
2130
- return v && v.isText && ((a = v.text) != null && a.startsWith(C)) && (_ = _ + 1), s(n.tr.delete(S, _)), t.preventDefault(), !0;
1206
+ return _ && _.isText && ((l = _.text) != null && l.startsWith(y)) && (v = v + 1), s(o.tr.delete(x, v)), t.preventDefault(), !0;
2131
1207
  } else {
2132
- const f = o.pos - 1;
2133
- return s(n.tr.setSelection(O.create(n.doc, f))), t.preventDefault(), !0;
1208
+ const c = n.pos - 1;
1209
+ return s(o.tr.setSelection(D.create(o.doc, c))), t.preventDefault(), !0;
2134
1210
  }
2135
1211
  }
2136
- if (m && m.isText) {
2137
- const y = o.parent, p = o.index();
2138
- if (m.text === C) {
2139
- if (p > 1) {
2140
- const f = y.child(p - 2);
2141
- if (f.type.name === A.TEMPLATE_BLOCK) {
2142
- const x = f.textContent || "";
2143
- if (x.length === 0 || x === C) {
2144
- const S = o.pos - m.nodeSize - f.nodeSize, _ = o.nodeAfter;
2145
- let b = o.pos;
2146
- return _ && _.isText && _.text === C && (b = b + 1), s(n.tr.delete(S, b)), t.preventDefault(), !0;
1212
+ if (h && h.isText) {
1213
+ const g = n.parent, d = n.index();
1214
+ if (h.text === y) {
1215
+ if (d > 1) {
1216
+ const c = g.child(d - 2);
1217
+ if (c.type.name === T.TEMPLATE_BLOCK) {
1218
+ const b = c.textContent || "";
1219
+ if (b.length === 0 || b === y) {
1220
+ const x = n.pos - h.nodeSize - c.nodeSize, v = n.nodeAfter;
1221
+ let m = n.pos;
1222
+ return v && v.isText && v.text === y && (m = m + 1), s(o.tr.delete(x, m)), t.preventDefault(), !0;
2147
1223
  } else {
2148
- const S = o.pos - 2;
2149
- if (S >= 0)
2150
- return s(n.tr.setSelection(O.create(n.doc, S))), t.preventDefault(), !0;
1224
+ const x = n.pos - 2;
1225
+ if (x >= 0)
1226
+ return s(o.tr.setSelection(D.create(o.doc, x))), t.preventDefault(), !0;
2151
1227
  }
2152
1228
  }
2153
1229
  }
2154
- } else if (p === 1 && o.pos !== 1 && m.text === C) {
2155
- const f = r.from - 1 - 2;
2156
- if (f >= 0)
2157
- return s(n.tr.delete(f, r.to)), t.preventDefault(), !0;
1230
+ } else if (d === 1 && n.pos !== 1 && h.text === y) {
1231
+ const c = i.from - 1 - 2;
1232
+ if (c >= 0)
1233
+ return s(o.tr.delete(c, i.to)), t.preventDefault(), !0;
2158
1234
  }
2159
1235
  }
2160
1236
  }
2161
- if (I(t, "BACKSPACE") && !r.empty) {
2162
- let T = r.from, m = r.to;
2163
- const y = o.nodeBefore, p = o.nodeAfter;
2164
- if (y && y.isText && ((c = y.text) != null && c.endsWith(C)) && (T -= 1), p && p.isText && ((d = p.text) != null && d.startsWith(C)) && (m += 1), T !== r.from || m !== r.to) {
2165
- const f = n.tr.delete(T, m);
2166
- return s(f), t.preventDefault(), !0;
1237
+ if (I(t, "BACKSPACE") && !i.empty) {
1238
+ let C = i.from, h = i.to;
1239
+ const g = n.nodeBefore, d = n.nodeAfter;
1240
+ if (g && g.isText && ((u = g.text) != null && u.endsWith(y)) && (C -= 1), d && d.isText && ((p = d.text) != null && p.startsWith(y)) && (h += 1), C !== i.from || h !== i.to) {
1241
+ const c = o.tr.delete(C, h);
1242
+ return s(c), t.preventDefault(), !0;
2167
1243
  }
2168
1244
  }
2169
- if (I(t, "DELETE") && r.empty) {
2170
- const T = o.node(), m = o.nodeAfter;
2171
- if (T.type.name === A.TEMPLATE_BLOCK) {
2172
- const y = T.textContent || "";
2173
- if (o.pos === o.start() && y.length === 1 && y !== C) {
2174
- const p = o.pos;
2175
- return s(n.tr.insertText(C, p, p + 1)), t.preventDefault(), !0;
1245
+ if (I(t, "DELETE") && i.empty) {
1246
+ const C = n.node(), h = n.nodeAfter;
1247
+ if (C.type.name === T.TEMPLATE_BLOCK) {
1248
+ const g = C.textContent || "";
1249
+ if (n.pos === n.start() && g.length === 1 && g !== y) {
1250
+ const d = n.pos;
1251
+ return s(o.tr.insertText(y, d, d + 1)), t.preventDefault(), !0;
2176
1252
  }
2177
- if (y === C) {
2178
- const p = o.after(), f = n.tr.setSelection(O.create(n.doc, p));
2179
- return s(f), t.preventDefault(), !0;
1253
+ if (g === y) {
1254
+ const d = n.after(), c = o.tr.setSelection(D.create(o.doc, d));
1255
+ return s(c), t.preventDefault(), !0;
2180
1256
  }
2181
- if (y === "") {
2182
- const p = o.after(), f = n.tr.setSelection(O.create(n.doc, p));
2183
- return s(f), t.preventDefault(), !0;
1257
+ if (g === "") {
1258
+ const d = n.after(), c = o.tr.setSelection(D.create(o.doc, d));
1259
+ return s(c), t.preventDefault(), !0;
2184
1260
  }
2185
- if (o.pos === o.end() && y.length > 0 && y !== C) {
2186
- const p = o.after();
2187
- return s(n.tr.setSelection(O.create(n.doc, p))), t.preventDefault(), !0;
1261
+ if (n.pos === n.end() && g.length > 0 && g !== y) {
1262
+ const d = n.after();
1263
+ return s(o.tr.setSelection(D.create(o.doc, d))), t.preventDefault(), !0;
2188
1264
  }
2189
1265
  return !1;
2190
1266
  }
2191
- if (m && m.isText && ((u = m.text) == null ? void 0 : u.length) === 1 && m.text !== C && o.nodeBefore && o.nodeBefore.type.name === A.TEMPLATE_BLOCK) {
2192
- const y = o.pos, p = o.pos + m.nodeSize;
2193
- let f = n.tr.delete(y, p);
2194
- return f = f.insertText(C, y, y), s(f), t.preventDefault(), !0;
1267
+ if (h && h.isText && ((f = h.text) == null ? void 0 : f.length) === 1 && h.text !== y && n.nodeBefore && n.nodeBefore.type.name === T.TEMPLATE_BLOCK) {
1268
+ const g = n.pos, d = n.pos + h.nodeSize;
1269
+ let c = o.tr.delete(g, d);
1270
+ return c = c.insertText(y, g, g), s(c), t.preventDefault(), !0;
2195
1271
  }
2196
- if (m && m.type.name === A.TEMPLATE_BLOCK) {
2197
- const y = m.textContent || "";
2198
- if (y.length === 0 || y === C) {
2199
- const f = o.parent, x = o.index(), v = o.nodeBefore;
2200
- let S = o.pos, _ = o.pos + m.nodeSize;
2201
- if (v && v.isText && v.text === C && (S = S - 1), x < f.childCount - 1) {
2202
- const b = f.child(x + 1);
2203
- b && b.isText && b.text === C && (_ = _ + 1);
1272
+ if (h && h.type.name === T.TEMPLATE_BLOCK) {
1273
+ const g = h.textContent || "";
1274
+ if (g.length === 0 || g === y) {
1275
+ const c = n.parent, b = n.index(), _ = n.nodeBefore;
1276
+ let x = n.pos, v = n.pos + h.nodeSize;
1277
+ if (_ && _.isText && _.text === y && (x = x - 1), b < c.childCount - 1) {
1278
+ const m = c.child(b + 1);
1279
+ m && m.isText && m.text === y && (v = v + 1);
2204
1280
  }
2205
- return s(n.tr.delete(S, _)), t.preventDefault(), !0;
1281
+ return s(o.tr.delete(x, v)), t.preventDefault(), !0;
2206
1282
  } else {
2207
- const f = o.pos + 1;
2208
- return s(n.tr.setSelection(O.create(n.doc, f))), t.preventDefault(), !0;
1283
+ const c = n.pos + 1;
1284
+ return s(o.tr.setSelection(D.create(o.doc, c))), t.preventDefault(), !0;
2209
1285
  }
2210
1286
  }
2211
- if (m && m.isText) {
2212
- const y = o.parent, p = o.index();
2213
- if (p < y.childCount - 1) {
2214
- const f = y.child(p + 1);
2215
- if (f.type.name === A.TEMPLATE_BLOCK) {
2216
- const x = f.textContent || "";
2217
- if (x.length === 0 || x === C) {
2218
- let S = o.pos;
2219
- const _ = o.pos + m.nodeSize + f.nodeSize, b = o.nodeBefore;
2220
- return b && b.isText && ((g = b.text) != null && g.endsWith(C)) && (S = S - 1), s(n.tr.delete(S, _)), t.preventDefault(), !0;
1287
+ if (h && h.isText) {
1288
+ const g = n.parent, d = n.index();
1289
+ if (d < g.childCount - 1) {
1290
+ const c = g.child(d + 1);
1291
+ if (c.type.name === T.TEMPLATE_BLOCK) {
1292
+ const b = c.textContent || "";
1293
+ if (b.length === 0 || b === y) {
1294
+ let x = n.pos;
1295
+ const v = n.pos + h.nodeSize + c.nodeSize, m = n.nodeBefore;
1296
+ return m && m.isText && ((E = m.text) != null && E.endsWith(y)) && (x = x - 1), s(o.tr.delete(x, v)), t.preventDefault(), !0;
2221
1297
  }
2222
- if (m.text === C || (h = m.text) != null && h.startsWith(C)) {
2223
- const S = o.pos + 2;
2224
- return s(n.tr.setSelection(O.create(n.doc, S))), t.preventDefault(), !0;
1298
+ if (h.text === y || (S = h.text) != null && S.startsWith(y)) {
1299
+ const x = n.pos + 2;
1300
+ return s(o.tr.setSelection(D.create(o.doc, x))), t.preventDefault(), !0;
2225
1301
  }
2226
1302
  }
2227
1303
  }
2228
1304
  }
2229
1305
  }
2230
- if (I(t, "DELETE") && !r.empty) {
2231
- let T = r.from, m = r.to;
2232
- const y = o.nodeBefore, p = o.nodeAfter;
2233
- if (y && y.isText && ((E = y.text) != null && E.endsWith(C)) && (T -= 1), p && p.isText && ((w = p.text) != null && w.startsWith(C)) && (m += 1), T !== r.from || m !== r.to) {
2234
- const f = n.tr.delete(T, m);
2235
- return s(f), t.preventDefault(), !0;
1306
+ if (I(t, "DELETE") && !i.empty) {
1307
+ let C = i.from, h = i.to;
1308
+ const g = n.nodeBefore, d = n.nodeAfter;
1309
+ if (g && g.isText && ((j = g.text) != null && j.endsWith(y)) && (C -= 1), d && d.isText && ((L = d.text) != null && L.startsWith(y)) && (h += 1), C !== i.from || h !== i.to) {
1310
+ const c = o.tr.delete(C, h);
1311
+ return s(c), t.preventDefault(), !0;
2236
1312
  }
2237
1313
  }
2238
1314
  return !1;
@@ -2240,43 +1316,43 @@ function Xo() {
2240
1316
  }
2241
1317
  });
2242
1318
  }
2243
- function Yo() {
2244
- return new ie({
2245
- key: new re(ae.TEMPLATE_BLOCK_PASTE),
1319
+ function cn() {
1320
+ return new Q({
1321
+ key: new J(ee.TEMPLATE_BLOCK_PASTE),
2246
1322
  props: {
2247
1323
  handlePaste(e, t) {
2248
- var o, l, i;
2249
- const n = ((o = t.clipboardData) == null ? void 0 : o.types) || [], s = (l = t.clipboardData) == null ? void 0 : l.getData("text/html");
2250
- if (n.includes("text/html") && (s != null && s.includes("data-template")) || n.includes("application/x-prosemirror-slice"))
1324
+ var n, a, r;
1325
+ const o = ((n = t.clipboardData) == null ? void 0 : n.types) || [], s = (a = t.clipboardData) == null ? void 0 : a.getData("text/html");
1326
+ if (o.includes("text/html") && (s != null && s.includes("data-template")) || o.includes("application/x-prosemirror-slice"))
2251
1327
  return !1;
2252
- const r = (i = t.clipboardData) == null ? void 0 : i.getData("text/plain");
2253
- if (r) {
2254
- const { state: a, dispatch: c } = e, d = a.selection.$from;
2255
- let u = a.tr;
2256
- d.nodeBefore && d.nodeBefore.isText && d.nodeBefore.text === C && (u = u.delete(d.pos - d.nodeBefore.nodeSize, d.pos)), d.nodeAfter && d.nodeAfter.isText && d.nodeAfter.text === C && (u = u.delete(d.pos, d.pos + d.nodeAfter.nodeSize));
2257
- const g = r.split(`
1328
+ const i = (r = t.clipboardData) == null ? void 0 : r.getData("text/plain");
1329
+ if (i) {
1330
+ const { state: l, dispatch: u } = e, p = l.selection.$from;
1331
+ let f = l.tr;
1332
+ p.nodeBefore && p.nodeBefore.isText && p.nodeBefore.text === y && (f = f.delete(p.pos - p.nodeBefore.nodeSize, p.pos)), p.nodeAfter && p.nodeAfter.isText && p.nodeAfter.text === y && (f = f.delete(p.pos, p.pos + p.nodeAfter.nodeSize));
1333
+ const E = i.split(`
2258
1334
  `);
2259
- let h;
2260
- if (g.length === 1)
2261
- u = u.insertText(g[0], u.selection.from, u.selection.to), h = u.selection.$to.pos;
1335
+ let S;
1336
+ if (E.length === 1)
1337
+ f = f.insertText(E[0], f.selection.from, f.selection.to), S = f.selection.$to.pos;
2262
1338
  else {
2263
- u = u.insertText(g[0], u.selection.from, u.selection.to);
2264
- let E = u.selection.$to.pos;
2265
- for (let w = 1; w < g.length; w++) {
2266
- const T = a.schema.nodes.paragraph.create({}, g[w] ? a.schema.text(g[w]) : null);
2267
- u = u.insert(E, T), E += T.nodeSize;
1339
+ f = f.insertText(E[0], f.selection.from, f.selection.to);
1340
+ let j = f.selection.$to.pos;
1341
+ for (let L = 1; L < E.length; L++) {
1342
+ const C = l.schema.nodes.paragraph.create({}, E[L] ? l.schema.text(E[L]) : null);
1343
+ f = f.insert(j, C), j += C.nodeSize;
2268
1344
  }
2269
- h = E;
1345
+ S = j;
2270
1346
  }
2271
- return u = u.setSelection(O.create(u.doc, h)), u = u.scrollIntoView(), c(u), t.preventDefault(), !0;
1347
+ return f = f.setSelection(D.create(f.doc, S)), f = f.scrollIntoView(), u(f), t.preventDefault(), !0;
2272
1348
  }
2273
1349
  return !1;
2274
1350
  }
2275
1351
  }
2276
1352
  });
2277
1353
  }
2278
- const Zo = ct.create({
2279
- name: A.TEMPLATE_BLOCK,
1354
+ const un = Le.create({
1355
+ name: T.TEMPLATE_BLOCK,
2280
1356
  // 节点配置
2281
1357
  group: "inline",
2282
1358
  inline: !0,
@@ -2288,10 +1364,10 @@ const Zo = ct.create({
2288
1364
  draggable: !1,
2289
1365
  onCreate() {
2290
1366
  const { items: e } = this.options;
2291
- e && ke(e) && K(
1367
+ e && ce(e) && K(
2292
1368
  e,
2293
1369
  () => {
2294
- const t = ke(e) ? e.value : e;
1370
+ const t = ce(e) ? e.value : e;
2295
1371
  t != null && (this.editor.commands.setTemplateData(t), this.editor.commands.focusFirstTemplate());
2296
1372
  },
2297
1373
  { deep: !0, immediate: !0 }
@@ -2326,31 +1402,31 @@ const Zo = ct.create({
2326
1402
  },
2327
1403
  // HTML 渲染
2328
1404
  renderHTML({ node: e, HTMLAttributes: t }) {
2329
- const n = e.textContent || "";
1405
+ const o = e.textContent || "";
2330
1406
  return [
2331
1407
  "span",
2332
- ut(this.options.HTMLAttributes || {}, t, {
1408
+ Me(this.options.HTMLAttributes || {}, t, {
2333
1409
  "data-template": "",
2334
1410
  "data-id": e.attrs.id,
2335
- "data-content": n
1411
+ "data-content": o
2336
1412
  }),
2337
- n
1413
+ o
2338
1414
  ];
2339
1415
  },
2340
1416
  // 使用 Vue 组件渲染
2341
1417
  addNodeView() {
2342
- return at(Vo);
1418
+ return _e(sn);
2343
1419
  },
2344
1420
  // 添加插件
2345
1421
  addProseMirrorPlugins() {
2346
- return [Uo(), Xo(), Yo()];
1422
+ return [an(), ln(), cn()];
2347
1423
  }
2348
- }), Ce = new re(
2349
- ae.TEMPLATE_SELECT_DROPDOWN
1424
+ }), ae = new J(
1425
+ ee.TEMPLATE_SELECT_DROPDOWN
2350
1426
  );
2351
- function Jo() {
2352
- return new ie({
2353
- key: Ce,
1427
+ function dn() {
1428
+ return new Q({
1429
+ key: ae,
2354
1430
  state: {
2355
1431
  init() {
2356
1432
  return {
@@ -2359,14 +1435,14 @@ function Jo() {
2359
1435
  };
2360
1436
  },
2361
1437
  apply(e, t) {
2362
- const n = e.getMeta(Ce);
2363
- if (n) {
2364
- if (n.type === "open")
1438
+ const o = e.getMeta(ae);
1439
+ if (o) {
1440
+ if (o.type === "open")
2365
1441
  return {
2366
1442
  isOpen: !0,
2367
- selectId: n.selectId
1443
+ selectId: o.selectId
2368
1444
  };
2369
- if (n.type === "close")
1445
+ if (o.type === "close")
2370
1446
  return {
2371
1447
  isOpen: !1,
2372
1448
  selectId: null
@@ -2377,81 +1453,81 @@ function Jo() {
2377
1453
  }
2378
1454
  });
2379
1455
  }
2380
- function Qo() {
2381
- return new ie({
2382
- key: new re(ae.TEMPLATE_SELECT_ZERO_WIDTH),
2383
- appendTransaction(e, t, n) {
2384
- if (!e.some((l) => l.docChanged)) return null;
2385
- const r = [];
2386
- let { tr: o } = n;
2387
- return n.doc.descendants((l, i) => {
2388
- if (l.type.name === A.PARAGRAPH && l.childCount > 0) {
2389
- const { lastChild: a, firstChild: c } = l;
2390
- a === c && a && a.isText && a.text === C && r.push(["remove", i + 1]);
1456
+ function fn() {
1457
+ return new Q({
1458
+ key: new J(ee.TEMPLATE_SELECT_ZERO_WIDTH),
1459
+ appendTransaction(e, t, o) {
1460
+ if (!e.some((a) => a.docChanged)) return null;
1461
+ const i = [];
1462
+ let { tr: n } = o;
1463
+ return o.doc.descendants((a, r) => {
1464
+ if (a.type.name === T.PARAGRAPH && a.childCount > 0) {
1465
+ const { lastChild: l, firstChild: u } = a;
1466
+ l === u && l && l.isText && l.text === y && i.push(["remove", r + 1]);
2391
1467
  }
2392
- }), r.length > 0 ? (r.forEach(([, l]) => {
2393
- o = o.delete(l, l + 1);
2394
- }), o) : null;
1468
+ }), i.length > 0 ? (i.forEach(([, a]) => {
1469
+ n = n.delete(a, a + 1);
1470
+ }), n) : null;
2395
1471
  }
2396
1472
  });
2397
1473
  }
2398
- function es() {
2399
- return new ie({
2400
- key: new re(ae.TEMPLATE_SELECT_KEYBOARD),
1474
+ function pn() {
1475
+ return new Q({
1476
+ key: new J(ee.TEMPLATE_SELECT_KEYBOARD),
2401
1477
  props: {
2402
1478
  handleKeyDown(e, t) {
2403
- const { state: n, dispatch: s } = e, { selection: r } = n, { $from: o } = r, l = Ce.getState(e.state);
2404
- if (l != null && l.isOpen && we(t, ["ENTER", "ARROW_UP", "ARROW_DOWN", "ESCAPE"]))
1479
+ const { state: o, dispatch: s } = e, { selection: i } = o, { $from: n } = i, a = ae.getState(e.state);
1480
+ if (a != null && a.isOpen && ie(t, ["ENTER", "ARROW_UP", "ARROW_DOWN", "ESCAPE"]))
2405
1481
  return !0;
2406
- if (I(t, "BACKSPACE") && r.empty) {
2407
- const i = o.nodeBefore, a = o.nodeAfter;
2408
- if ((i == null ? void 0 : i.type.name) === A.TEMPLATE_SELECT)
2409
- return s(n.tr.delete(o.pos - i.nodeSize, o.pos)), t.preventDefault(), !0;
2410
- if (i != null && i.isText && i.text === C) {
2411
- const c = o.pos - 1, u = n.doc.resolve(c).nodeBefore;
2412
- if ((u == null ? void 0 : u.type.name) === A.TEMPLATE_SELECT) {
2413
- const g = c - u.nodeSize, h = o.pos;
2414
- return s(n.tr.delete(g, h)), t.preventDefault(), !0;
1482
+ if (I(t, "BACKSPACE") && i.empty) {
1483
+ const r = n.nodeBefore, l = n.nodeAfter;
1484
+ if ((r == null ? void 0 : r.type.name) === T.TEMPLATE_SELECT)
1485
+ return s(o.tr.delete(n.pos - r.nodeSize, n.pos)), t.preventDefault(), !0;
1486
+ if (r != null && r.isText && r.text === y) {
1487
+ const u = n.pos - 1, f = o.doc.resolve(u).nodeBefore;
1488
+ if ((f == null ? void 0 : f.type.name) === T.TEMPLATE_SELECT) {
1489
+ const E = u - f.nodeSize, S = n.pos;
1490
+ return s(o.tr.delete(E, S)), t.preventDefault(), !0;
2415
1491
  }
2416
1492
  }
2417
- if ((a == null ? void 0 : a.type.name) === A.TEMPLATE_SELECT) {
2418
- if (i != null && i.isText && i.text !== C)
2419
- return s(n.tr.delete(o.pos - 1, o.pos)), t.preventDefault(), !0;
2420
- if ((i == null ? void 0 : i.type.name) === A.TEMPLATE_BLOCK)
1493
+ if ((l == null ? void 0 : l.type.name) === T.TEMPLATE_SELECT) {
1494
+ if (r != null && r.isText && r.text !== y)
1495
+ return s(o.tr.delete(n.pos - 1, n.pos)), t.preventDefault(), !0;
1496
+ if ((r == null ? void 0 : r.type.name) === T.TEMPLATE_BLOCK)
2421
1497
  return !1;
2422
1498
  }
2423
- if (!a && (i != null && i.isText) && i.text !== C)
2424
- return s(n.tr.delete(o.pos - 1, o.pos)), t.preventDefault(), !0;
1499
+ if (!l && (r != null && r.isText) && r.text !== y)
1500
+ return s(o.tr.delete(n.pos - 1, n.pos)), t.preventDefault(), !0;
2425
1501
  }
2426
- if (I(t, "DELETE") && r.empty) {
2427
- const i = o.nodeAfter, a = o.nodeBefore;
2428
- if ((i == null ? void 0 : i.type.name) === A.TEMPLATE_SELECT)
2429
- return s(n.tr.delete(o.pos, o.pos + i.nodeSize)), t.preventDefault(), !0;
2430
- if (i != null && i.isText && i.text === C) {
2431
- const c = o.pos + 1, u = n.doc.resolve(c).nodeAfter;
2432
- if ((u == null ? void 0 : u.type.name) === A.TEMPLATE_SELECT) {
2433
- const g = c + u.nodeSize;
2434
- return s(n.tr.delete(o.pos, g)), t.preventDefault(), !0;
1502
+ if (I(t, "DELETE") && i.empty) {
1503
+ const r = n.nodeAfter, l = n.nodeBefore;
1504
+ if ((r == null ? void 0 : r.type.name) === T.TEMPLATE_SELECT)
1505
+ return s(o.tr.delete(n.pos, n.pos + r.nodeSize)), t.preventDefault(), !0;
1506
+ if (r != null && r.isText && r.text === y) {
1507
+ const u = n.pos + 1, f = o.doc.resolve(u).nodeAfter;
1508
+ if ((f == null ? void 0 : f.type.name) === T.TEMPLATE_SELECT) {
1509
+ const E = u + f.nodeSize;
1510
+ return s(o.tr.delete(n.pos, E)), t.preventDefault(), !0;
2435
1511
  }
2436
1512
  }
2437
- if ((a == null ? void 0 : a.type.name) === A.TEMPLATE_SELECT) {
2438
- if (i != null && i.isText && i.text !== C)
2439
- return s(n.tr.delete(o.pos, o.pos + 1)), t.preventDefault(), !0;
2440
- if ((i == null ? void 0 : i.type.name) === A.TEMPLATE_BLOCK)
1513
+ if ((l == null ? void 0 : l.type.name) === T.TEMPLATE_SELECT) {
1514
+ if (r != null && r.isText && r.text !== y)
1515
+ return s(o.tr.delete(n.pos, n.pos + 1)), t.preventDefault(), !0;
1516
+ if ((r == null ? void 0 : r.type.name) === T.TEMPLATE_BLOCK)
2441
1517
  return !1;
2442
1518
  }
2443
- if (!a && (i != null && i.isText) && i.text !== C)
2444
- return s(n.tr.delete(o.pos, o.pos + 1)), t.preventDefault(), !0;
1519
+ if (!l && (r != null && r.isText) && r.text !== y)
1520
+ return s(o.tr.delete(n.pos, n.pos + 1)), t.preventDefault(), !0;
2445
1521
  }
2446
1522
  return !1;
2447
1523
  }
2448
1524
  }
2449
1525
  });
2450
1526
  }
2451
- function ts(e, t, n) {
2452
- const s = (r) => {
2453
- const o = r.target;
2454
- !e.contains(o) && !t.contains(o) && (n(), document.removeEventListener("click", s));
1527
+ function mn(e, t, o) {
1528
+ const s = (i) => {
1529
+ const n = i.target;
1530
+ !e.contains(n) && !t.contains(n) && (o(), document.removeEventListener("click", s));
2455
1531
  };
2456
1532
  return setTimeout(() => {
2457
1533
  document.addEventListener("click", s);
@@ -2459,142 +1535,147 @@ function ts(e, t, n) {
2459
1535
  document.removeEventListener("click", s);
2460
1536
  };
2461
1537
  }
2462
- const ns = { class: "template-select__icon" }, os = ["onMousedown", "onMouseenter"], ss = /* @__PURE__ */ Z({
1538
+ const hn = { class: "template-select__icon" }, gn = ["onMousedown", "onMouseenter"], xn = /* @__PURE__ */ X({
2463
1539
  __name: "template-select-view",
2464
1540
  props: {
2465
1541
  node: {},
2466
1542
  updateAttributes: { type: Function },
2467
- editor: {}
1543
+ editor: {},
1544
+ extension: {}
2468
1545
  },
2469
1546
  setup(e) {
2470
- const t = e, n = F(!1), s = F(-1), r = F(), o = F();
2471
- let l = null, i = null;
2472
- const a = R(() => t.node.attrs.options.find((x) => x.value === t.node.attrs.value)), c = R(() => {
1547
+ const t = e, o = W(!1), s = W(-1), i = W(), n = W();
1548
+ let a = null, r = null;
1549
+ const l = Mt(i, t.extension.options.appendTo, { fallback: "body" }), u = M(() => {
1550
+ const x = l.value;
1551
+ return x instanceof HTMLElement && x !== document.body;
1552
+ }), p = M(() => t.node.attrs.options.find((x) => x.value === t.node.attrs.value)), f = M(() => {
2473
1553
  var x;
2474
- return ((x = a.value) == null ? void 0 : x.label) || t.node.attrs.placeholder;
2475
- }), d = R(() => !t.node.attrs.value), u = () => {
2476
- n.value ? h() : g();
2477
- }, g = async () => {
1554
+ return ((x = p.value) == null ? void 0 : x.label) || t.node.attrs.placeholder;
1555
+ }), E = M(() => !t.node.attrs.value), S = () => {
1556
+ o.value ? L() : j();
1557
+ }, j = async () => {
2478
1558
  var x;
2479
- if (n.value = !0, (x = t.editor) != null && x.view) {
2480
- const v = t.editor.view, S = v.state.tr;
2481
- S.setMeta(Ce, {
1559
+ if (o.value = !0, (x = t.editor) != null && x.view) {
1560
+ const v = t.editor.view, m = v.state.tr;
1561
+ m.setMeta(ae, {
2482
1562
  type: "open",
2483
1563
  selectId: t.node.attrs.id
2484
- }), v.dispatch(S);
1564
+ }), v.dispatch(m);
2485
1565
  }
2486
- t.node.attrs.value ? s.value = t.node.attrs.options.findIndex((v) => v.value === t.node.attrs.value) : s.value = -1, await me(), w(), r.value && o.value && (l = ts(r.value, o.value, h));
2487
- }, h = async () => {
1566
+ t.node.attrs.value ? s.value = t.node.attrs.options.findIndex((v) => v.value === t.node.attrs.value) : s.value = -1, await oe(), h(), i.value && n.value && (a = mn(i.value, n.value, L));
1567
+ }, L = async () => {
2488
1568
  var x;
2489
- if (n.value = !1, s.value = -1, (x = t.editor) != null && x.view) {
2490
- const v = t.editor.view, S = v.state.tr;
2491
- S.setMeta(Ce, {
1569
+ if (o.value = !1, s.value = -1, (x = t.editor) != null && x.view) {
1570
+ const v = t.editor.view, m = v.state.tr;
1571
+ m.setMeta(ae, {
2492
1572
  type: "close"
2493
- }), v.dispatch(S);
1573
+ }), v.dispatch(m);
2494
1574
  }
2495
- l && (l(), l = null), i && (i(), i = null);
2496
- }, E = (x) => {
2497
- t.updateAttributes({ value: x.value }), h();
2498
- }, w = () => {
2499
- !r.value || !o.value || (i && (i(), i = null), i = mt(r.value, o.value, () => {
2500
- !r.value || !o.value || yt(r.value, o.value, {
1575
+ a && (a(), a = null), r && (r(), r = null);
1576
+ }, C = (x) => {
1577
+ t.updateAttributes({ value: x.value }), L();
1578
+ }, h = () => {
1579
+ !i.value || !n.value || (r && (r(), r = null), r = Se(i.value, n.value, () => {
1580
+ !i.value || !n.value || Ce(i.value, n.value, {
2501
1581
  placement: "bottom-start",
2502
- strategy: "fixed",
1582
+ // 自定义挂载目标使用 absolute 定位
1583
+ strategy: u.value ? "absolute" : "fixed",
2503
1584
  // 使用 fixed 定位策略,相对于视口
2504
- middleware: [ht(4), xt(), gt({ padding: 8 })]
1585
+ middleware: [Ae(4), we(), ke({ padding: 8 })]
2505
1586
  }).then(({ x, y: v }) => {
2506
- o.value && Object.assign(o.value.style, {
1587
+ n.value && Object.assign(n.value.style, {
2507
1588
  left: `${x}px`,
2508
1589
  top: `${v}px`
2509
1590
  });
2510
1591
  });
2511
1592
  }));
2512
- }, T = (x) => {
2513
- if (n.value)
1593
+ }, g = (x) => {
1594
+ if (o.value)
2514
1595
  switch (x.key) {
2515
1596
  case "ArrowUp":
2516
- x.preventDefault(), m();
1597
+ x.preventDefault(), d();
2517
1598
  break;
2518
1599
  case "ArrowDown":
2519
- x.preventDefault(), y();
1600
+ x.preventDefault(), c();
2520
1601
  break;
2521
1602
  case "Enter":
2522
- x.preventDefault(), f();
1603
+ x.preventDefault(), _();
2523
1604
  break;
2524
1605
  case "Escape":
2525
- x.preventDefault(), h();
1606
+ x.preventDefault(), L();
2526
1607
  break;
2527
1608
  }
2528
- }, m = () => {
2529
- s.value === -1 || s.value <= 0 ? s.value = t.node.attrs.options.length - 1 : s.value -= 1, p();
2530
- }, y = () => {
2531
- s.value === -1 || s.value >= t.node.attrs.options.length - 1 ? s.value = 0 : s.value += 1, p();
2532
- }, p = () => {
2533
- me(() => {
2534
- if (!o.value) return;
2535
- const x = o.value.querySelector(".template-select__option.is-highlighted");
1609
+ }, d = () => {
1610
+ s.value === -1 || s.value <= 0 ? s.value = t.node.attrs.options.length - 1 : s.value -= 1, b();
1611
+ }, c = () => {
1612
+ s.value === -1 || s.value >= t.node.attrs.options.length - 1 ? s.value = 0 : s.value += 1, b();
1613
+ }, b = () => {
1614
+ oe(() => {
1615
+ if (!n.value) return;
1616
+ const x = n.value.querySelector(".template-select__option.is-highlighted");
2536
1617
  x && x.scrollIntoView({
2537
1618
  block: "nearest",
2538
1619
  behavior: "smooth"
2539
1620
  });
2540
1621
  });
2541
- }, f = () => {
2542
- s.value >= 0 && s.value < t.node.attrs.options.length ? E(t.node.attrs.options[s.value]) : h();
1622
+ }, _ = () => {
1623
+ s.value >= 0 && s.value < t.node.attrs.options.length ? C(t.node.attrs.options[s.value]) : L();
2543
1624
  };
2544
- return dn(() => {
2545
- document.addEventListener("keydown", T);
2546
- }), fn(() => {
2547
- document.removeEventListener("keydown", T), l && l(), i && i();
2548
- }), (x, v) => (M(), U(k(lt), {
1625
+ return at(() => {
1626
+ document.addEventListener("keydown", g);
1627
+ }), lt(() => {
1628
+ document.removeEventListener("keydown", g), a && a(), r && r();
1629
+ }), (x, v) => (w(), U(A(Ee), {
2549
1630
  as: "span",
2550
1631
  class: "template-select"
2551
1632
  }, {
2552
- default: j(() => [
2553
- v[0] || (v[0] = B("span", {
1633
+ default: B(() => [
1634
+ v[0] || (v[0] = R("span", {
2554
1635
  contenteditable: "false",
2555
1636
  class: "template-select__prefix"
2556
1637
  }, "​", -1)),
2557
- B("span", {
1638
+ R("span", {
2558
1639
  ref_key: "triggerRef",
2559
- ref: r,
2560
- class: Q(["template-select__trigger", { "is-open": n.value }]),
2561
- onMousedown: nt(u, ["prevent"])
1640
+ ref: i,
1641
+ class: V(["template-select__trigger", { "is-open": o.value }]),
1642
+ onMousedown: ye(S, ["prevent"])
2562
1643
  }, [
2563
- B("span", {
2564
- class: Q(["template-select__text", { "is-placeholder": d.value }])
2565
- }, pe(c.value), 3),
2566
- B("span", ns, [
2567
- se(k(Pn))
1644
+ R("span", {
1645
+ class: V(["template-select__text", { "is-placeholder": E.value }])
1646
+ }, ne(f.value), 3),
1647
+ R("span", hn, [
1648
+ Y(A(kt))
2568
1649
  ])
2569
1650
  ], 34),
2570
- v[1] || (v[1] = B("span", {
1651
+ v[1] || (v[1] = R("span", {
2571
1652
  contenteditable: "false",
2572
1653
  class: "template-select__suffix"
2573
1654
  }, "​", -1)),
2574
- (M(), U(pn, { to: "body" }, [
2575
- n.value ? (M(), P("div", {
1655
+ (w(), U(ct, { to: A(l) }, [
1656
+ o.value ? (w(), P("div", {
2576
1657
  key: 0,
2577
1658
  ref_key: "dropdownRef",
2578
- ref: o,
2579
- class: "template-select__dropdown"
1659
+ ref: n,
1660
+ class: V(["template-select__dropdown", { "is-absolute": u.value }])
2580
1661
  }, [
2581
- (M(!0), P(Ie, null, Be(e.node.attrs.options, (S, _) => (M(), P("div", {
2582
- key: S.value,
2583
- class: Q(["template-select__option", {
2584
- "is-highlighted": _ === s.value,
2585
- "is-selected": S.value === e.node.attrs.value
1662
+ (w(!0), P(fe, null, pe(e.node.attrs.options, (m, k) => (w(), P("div", {
1663
+ key: m.value,
1664
+ class: V(["template-select__option", {
1665
+ "is-highlighted": k === s.value,
1666
+ "is-selected": m.value === e.node.attrs.value
2586
1667
  }]),
2587
- onMousedown: nt((b) => E(S), ["prevent"]),
2588
- onMouseenter: (b) => s.value = _
2589
- }, pe(S.label), 43, os))), 128))
2590
- ], 512)) : q("", !0)
2591
- ]))
1668
+ onMousedown: ye(($) => C(m), ["prevent"]),
1669
+ onMouseenter: ($) => s.value = k
1670
+ }, ne(m.label), 43, gn))), 128))
1671
+ ], 2)) : N("", !0)
1672
+ ], 8, ["to"]))
2592
1673
  ]),
2593
1674
  _: 1
2594
1675
  }));
2595
1676
  }
2596
- }), rs = /* @__PURE__ */ J(ss, [["__scopeId", "data-v-dbb18436"]]), is = ct.create({
2597
- name: A.TEMPLATE_SELECT,
1677
+ }), bn = /* @__PURE__ */ Z(xn, [["__scopeId", "data-v-5bcba48f"]]), yn = Le.create({
1678
+ name: T.TEMPLATE_SELECT,
2598
1679
  // 节点配置
2599
1680
  group: "inline",
2600
1681
  inline: !0,
@@ -2622,8 +1703,8 @@ const ns = { class: "template-select__icon" }, os = ["onMousedown", "onMouseente
2622
1703
  if (!t) return [];
2623
1704
  try {
2624
1705
  return JSON.parse(t);
2625
- } catch (n) {
2626
- return console.warn("Failed to parse template select options:", n), [];
1706
+ } catch (o) {
1707
+ return console.warn("Failed to parse template select options:", o), [];
2627
1708
  }
2628
1709
  },
2629
1710
  renderHTML: (e) => {
@@ -2651,22 +1732,22 @@ const ns = { class: "template-select__icon" }, os = ["onMousedown", "onMouseente
2651
1732
  },
2652
1733
  // HTML 渲染
2653
1734
  renderHTML({ node: e, HTMLAttributes: t }) {
2654
- const n = e.attrs.options.find(
2655
- (o) => o.value === e.attrs.value
2656
- ), s = (n == null ? void 0 : n.label) || e.attrs.placeholder;
2657
- let r = "[]";
1735
+ const o = e.attrs.options.find(
1736
+ (n) => n.value === e.attrs.value
1737
+ ), s = (o == null ? void 0 : o.label) || e.attrs.placeholder;
1738
+ let i = "[]";
2658
1739
  try {
2659
- r = JSON.stringify(e.attrs.options);
2660
- } catch (o) {
2661
- console.error("Failed to stringify template select options in renderHTML:", o);
1740
+ i = JSON.stringify(e.attrs.options);
1741
+ } catch (n) {
1742
+ console.error("Failed to stringify template select options in renderHTML:", n);
2662
1743
  }
2663
1744
  return [
2664
1745
  "span",
2665
- ut(t, {
1746
+ Me(t, {
2666
1747
  "data-template-select": "",
2667
1748
  "data-id": e.attrs.id,
2668
1749
  "data-placeholder": e.attrs.placeholder,
2669
- "data-options": r,
1750
+ "data-options": i,
2670
1751
  "data-value": e.attrs.value || ""
2671
1752
  }),
2672
1753
  s
@@ -2674,120 +1755,120 @@ const ns = { class: "template-select__icon" }, os = ["onMousedown", "onMouseente
2674
1755
  },
2675
1756
  // 使用 Vue 组件渲染
2676
1757
  addNodeView() {
2677
- return at(rs);
1758
+ return _e(bn);
2678
1759
  },
2679
1760
  // 添加插件
2680
1761
  addProseMirrorPlugins() {
2681
- return [Jo(), Qo(), es()];
1762
+ return [dn(), fn(), pn()];
2682
1763
  }
2683
- }), Zt = It.create({
2684
- name: be.TEMPLATE,
1764
+ }), Xe = We.create({
1765
+ name: se.TEMPLATE,
2685
1766
  addExtensions() {
2686
- return [Zo.configure(this.options), is];
1767
+ return [un.configure(this.options), yn.configure(this.options)];
2687
1768
  },
2688
1769
  // 添加命令(统一命令入口)
2689
1770
  addCommands() {
2690
- return zo;
1771
+ return nn;
2691
1772
  }
2692
1773
  });
2693
- function ls(e, t) {
2694
- return Zt.configure({
1774
+ function Tn(e, t) {
1775
+ return Xe.configure({
2695
1776
  items: e,
2696
1777
  ...t
2697
1778
  });
2698
1779
  }
2699
- function Jt(e, t = "") {
2700
- let n = (
1780
+ function Ze(e, t = "") {
1781
+ let o = (
2701
1782
  /** @type {Array<CategorizedUnicodeRange<T>>} */
2702
1783
  []
2703
- ), s = e.split(",").map((o) => o ? parseInt(o, 36) : 0), r = 0;
2704
- for (let o = 0; o < s.length; o++)
2705
- o % 2 ? n.push([
2706
- r,
2707
- r + s[o],
1784
+ ), s = e.split(",").map((n) => n ? parseInt(n, 36) : 0), i = 0;
1785
+ for (let n = 0; n < s.length; n++)
1786
+ n % 2 ? o.push([
1787
+ i,
1788
+ i + s[n],
2708
1789
  /** @type {T} */
2709
- t ? parseInt(t[o >> 1], 36) : 0
2710
- ]) : r = s[o];
2711
- return n;
2712
- }
2713
- function Qt(e, t, n = 0, s = t.length - 1) {
2714
- for (; n <= s; ) {
2715
- let r = n + s >>> 1, o = t[r];
2716
- if (e < o[0]) s = r - 1;
2717
- else if (e > o[1]) n = r + 1;
2718
- else return r;
1790
+ t ? parseInt(t[n >> 1], 36) : 0
1791
+ ]) : i = s[n];
1792
+ return o;
1793
+ }
1794
+ function Ye(e, t, o = 0, s = t.length - 1) {
1795
+ for (; o <= s; ) {
1796
+ let i = o + s >>> 1, n = t[i];
1797
+ if (e < n[0]) s = i - 1;
1798
+ else if (e > n[1]) o = i + 1;
1799
+ else return i;
2719
1800
  }
2720
1801
  return -1;
2721
1802
  }
2722
- const rt = Jt(
1803
+ const Te = Ze(
2723
1804
  /** @type {UnicodeDataEncoding} */
2724
1805
  ",9,a,,b,1,d,,e,h,3j,w,4p,,4t,,4u,,lc,33,w3,6,13l,18,14v,,14x,1,150,1,153,,16o,5,174,a,17g,,18r,k,19s,,1cm,6,1ct,,1cv,5,1d3,1,1d6,3,1e7,,1e9,,1f4,q,1ie,a,1kb,8,1kt,,1li,3,1ln,8,1lx,2,1m1,4,1nd,2,1ow,1,1p3,8,1qi,n,1r6,,1r7,v,1s3,,1tm,,1tn,,1to,,1tq,2,1tt,7,1u1,3,1u5,,1u6,1,1u9,6,1uq,1,1vl,,1vm,1,1x8,,1xa,,1xb,1,1xd,3,1xj,1,1xn,1,1xp,,1xz,,1ya,1,1z2,,1z5,1,1z7,,20s,,20u,2,20x,1,213,1,217,2,21d,,228,1,22d,,22p,1,22r,,24c,,24e,2,24h,4,24n,1,24p,,24r,1,24t,,25e,1,262,5,269,,26a,1,27w,,27y,1,280,,281,3,287,1,28b,1,28d,,28l,2,28y,1,29u,,2bi,,2bj,,2bk,,2bl,1,2bq,2,2bu,2,2bx,,2c7,,2dc,,2dd,2,2dg,,2f0,,2f2,2,2f5,3,2fa,2,2fe,3,2fp,1,2g2,1,2gx,,2gy,1,2ik,,2im,,2in,1,2ip,,2iq,,2ir,1,2iu,2,2iy,3,2j9,1,2jm,1,2k3,,2kg,1,2ki,1,2m3,1,2m6,,2m7,1,2m9,3,2me,2,2mi,2,2ml,,2mm,,2mv,,2n6,1,2o1,,2o2,1,2q2,,2q7,,2q8,1,2qa,2,2qe,,2qg,6,2qn,,2r6,1,2sx,,2sz,,2t0,6,2tj,7,2wh,,2wj,,2wk,8,2x4,6,2zc,1,305,,307,,309,,30e,1,31t,d,327,,328,4,32e,1,32l,a,32x,z,346,,371,3,375,,376,5,37d,1,37f,1,37h,1,386,1,388,1,38e,2,38x,3,39e,,39g,,39h,1,39p,,3a5,,3cw,2n,3fk,1z,3hk,2f,3tp,2,4k2,3,4ky,2,4lu,1,4mq,1,4ok,1,4om,,4on,6,4ou,7,4p2,,4p3,1,4p5,a,4pp,,4qz,2,4r2,,4r3,,4ud,1,4vd,,4yo,2,4yr,3,4yv,1,4yx,2,4z4,1,4z6,,4z7,5,4zd,2,55j,1,55l,1,55n,,579,,57a,,57b,,57c,6,57k,,57m,,57p,7,57x,5,583,9,58f,,59s,u,5c0,3,5c4,,5dg,9,5dq,3,5du,2,5ez,8,5fk,1,5fm,,5gh,,5gi,3,5gm,1,5go,5,5ie,,5if,,5ig,1,5ii,2,5il,,5im,,5in,4,5k4,7,5kc,7,5kk,1,5km,1,5ow,2,5p0,c,5pd,,5pe,6,5pp,,5pw,,5pz,,5q0,1,5vk,1r,6bv,,6bw,,6bx,,6by,1,6co,6,6d8,,6dl,,6e8,f,6hc,w,6jm,,6k9,,6ms,5,6nd,1,6xm,1,6y0,,70o,,72n,,73d,a,73s,2,79e,,7fu,1,7g6,,7gg,,7i3,3,7i8,5,7if,b,7is,35,7m8,39,7pk,a,7pw,,7py,,7q5,,7q9,,7qg,,7qr,1,7r8,,7rb,,7rg,,7ri,,7rn,2,7rr,,7s3,4,7th,2,7tt,,7u8,,7un,,850,1,8hx,2,8ij,1,8k0,,8k5,,8vj,2,8zj,,928,v,wvj,3,wvo,9,wwu,1,wz4,1,x6q,,x6u,,x6z,,x7n,1,x7p,1,x7r,,x7w,,xa8,1,xbo,f,xc4,1,xcw,h,xdr,,xeu,7,xfr,a,xg2,,xg3,,xgg,s,xhc,2,xhf,,xir,,xis,1,xiu,3,xiy,1,xj0,1,xj2,1,xj4,,xk5,,xm1,5,xm7,1,xm9,1,xmb,1,xmd,1,xmr,,xn0,,xn1,,xoc,,xps,,xpu,2,xpz,1,xq6,1,xq9,,xrf,,xrg,1,xri,1,xrp,,xrq,,xyb,1,xyd,,xye,1,xyg,,xyh,1,xyk,,xyl,,1e68,f,1e74,f,1edb,,1ehq,1,1ek0,b,1eyl,,1f4w,,1f92,4,1gjl,2,1gjp,1,1gjw,3,1gl4,2,1glb,,1gpx,1,1h5w,3,1h7t,4,1hgr,1,1hj0,3,1hl2,a,1hmq,3,1hq8,,1hq9,,1hqa,,1hrs,e,1htc,,1htf,1,1htr,2,1htu,,1hv4,2,1hv7,3,1hvb,1,1hvd,1,1hvh,,1hvm,,1hvx,,1hxc,2,1hyf,4,1hyk,,1hyl,7,1hz9,1,1i0j,,1i0w,1,1i0y,,1i2b,2,1i2e,8,1i2n,,1i2o,,1i2q,1,1i2x,3,1i32,,1i33,,1i5o,2,1i5r,2,1i5u,1,1i5w,3,1i66,,1i69,,1ian,,1iao,2,1iar,7,1ibk,1,1ibm,1,1id7,1,1ida,,1idb,,1idc,,1idd,3,1idj,1,1idn,1,1idp,,1idz,,1iea,1,1iee,6,1ieo,4,1igo,,1igp,1,1igr,5,1igy,,1ih1,,1ih3,2,1ih6,,1ih8,1,1iha,2,1ihd,,1ihe,,1iht,1,1ik5,2,1ik8,7,1ikg,1,1iki,2,1ikl,,1ikm,,1ila,,1ink,,1inl,1,1inn,5,1int,,1inu,,1inv,1,1inx,,1iny,,1inz,1,1io1,,1io2,1,1iun,,1iuo,1,1iuq,3,1iuw,3,1iv0,1,1iv2,,1iv3,1,1ivw,1,1iy8,2,1iyb,7,1iyj,1,1iyl,,1iym,,1iyn,1,1j1n,,1j1o,,1j1p,,1j1q,1,1j1s,7,1j4t,,1j4u,,1j4v,,1j4y,3,1j52,,1j53,4,1jcc,2,1jcf,8,1jco,,1jcp,1,1jjk,,1jjl,4,1jjr,1,1jjv,3,1jjz,,1jk0,,1jk1,,1jk2,,1jk3,,1jo1,2,1jo4,3,1joa,1,1joc,3,1jog,,1jok,,1jpd,9,1jqr,5,1jqx,,1jqy,,1jqz,3,1jrb,,1jrl,5,1jrr,1,1jrt,2,1jt0,5,1jt6,c,1jtj,,1jtk,1,1k4v,,1k4w,6,1k54,5,1k5a,,1k5b,,1k7m,l,1k89,,1k8a,6,1k8h,,1k8i,1,1k8k,,1k8l,1,1kc1,5,1kca,,1kcc,1,1kcf,6,1kcm,,1kcn,,1kei,4,1keo,1,1ker,1,1ket,,1keu,,1kev,,1koj,1,1kol,1,1kow,1,1koy,,1koz,,1kqc,1,1kqe,4,1kqm,1,1kqo,2,1kre,,1ovk,f,1ow0,,1ow7,e,1xr2,b,1xre,2,1xrh,2,1zow,4,1zqo,6,206b,,206f,3,20jz,,20k1,1i,20lr,3,20o4,,20og,1,2ftp,1,2fts,3,2jgg,19,2jhs,m,2jxh,4,2jxp,5,2jxv,7,2jy3,7,2jyd,6,2jze,3,2k3m,2,2lmo,1i,2lob,1d,2lpx,,2lqc,,2lqz,4,2lr5,e,2mtc,6,2mtk,g,2mu3,6,2mub,1,2mue,4,2mxb,,2n1s,6,2nce,,2ne4,3,2nsc,3,2nzi,1,2ok0,6,2on8,6,2pz4,73,2q6l,2,2q7j,,2q98,5,2q9q,1,2qa6,,2qa9,9,2qb1,1k,2qcm,p,2qdd,e,2qe2,,2qen,,2qeq,8,2qf0,3,2qfd,c1,2qrf,4,2qrk,8t,2r0m,7d,2r9c,3j,2rg4,b,2rit,16,2rkc,3,2rm0,7,2rmi,5,2rns,7,2rou,29,2rrg,1a,2rss,9,2rt3,c8,2scg,sd,jny8,v,jnz4,2n,jo1s,3j,jo5c,6n,joc0,2rz",
2725
1806
  "262122424333333393233393339333333333393393b3b3b3b3b333b33b3bb33333b3b3333333b3b33bb3333b33b3bb33333b3bbb333b333b33333b3b3b3b3333b3b33b3bb39333b33b33b3b3b333b333333b3b333333b33b3b3333b3335dc333333b3b3b33323333b3bb3b33b3b3b3333b3333b3b333bb3b33b3b3b3b3b333b333b3323e2244234444444444444444444444444444444444444444443333333333b3b3bb33333b353b3b3b3b333b3b333b333333b3bb3b3b3bb333232333333333333333b3b3333bb3b393933b3b33bb3b393b3b3b3333b33b33b3bbb33b333b3333bb3933b3b3b333b3b3b3b3b33b3b3b33b3b3b33b3b33b33b3b3b33bb39b9b3b33b3b33b9333b393b3b33b33b3b3b3333393b3b3b33b39bb3b332333b333dd3b33332333323333333333333333333333344444444a44444434444444444444423232"
2726
- ), as = Jt(
1807
+ ), vn = Ze(
2727
1808
  /** @type {UnicodeDataEncoding} */
2728
1809
  "1sl,10,1ug,7,1vc,7,1w5,j,1wq,6,1wy,,1x2,3,1y4,1,1y7,,1yo,1,239,j,23u,6,242,1,245,4,261,,26t,j,27e,6,27m,1,27p,4,28s,1,28v,,29d,,2dx,j,2ei,f,2fs,2,2l1,11"
2729
- ), _t = 65535;
2730
- function* cs(e) {
1810
+ ), Re = 65535;
1811
+ function* En(e) {
2731
1812
  let t = e.codePointAt(0);
2732
1813
  if (t == null) return;
2733
- let n = t <= _t ? 1 : 2, s = e.length, r = Lt(t), o = 0, l = 0, i = !1, a = !1, c = !1, d = 0, u = r, g = t;
2734
- for (; n < s; ) {
1814
+ let o = t <= Re ? 1 : 2, s = e.length, i = Be(t), n = 0, a = 0, r = !1, l = !1, u = !1, p = 0, f = i, E = t;
1815
+ for (; o < s; ) {
2735
1816
  t = /** @type {number} */
2736
- e.codePointAt(n), o = Lt(t);
2737
- let h = !0;
2738
- r === 1 ? h = o !== 6 : r === 2 || r === 6 || o === 1 || o === 2 || o === 6 ? h = !0 : o === 3 || o === 14 || o === 11 || r === 9 ? h = !1 : r === 14 && o === 4 ? h = !i : r === 10 && o === 10 ? h = l++ % 2 === 1 : r === 5 ? h = !(o === 5 || o === 13 || o === 7 || o === 8) : ((r === 7 || r === 13) && (o === 13 || o === 12) || (r === 8 || r === 12) && o === 12 || o === 0 && a && c && kt(t)) && (h = !1), h ? (yield {
2739
- segment: e.slice(d, n),
2740
- index: d,
1817
+ e.codePointAt(o), n = Be(t);
1818
+ let S = !0;
1819
+ i === 1 ? S = n !== 6 : i === 2 || i === 6 || n === 1 || n === 2 || n === 6 ? S = !0 : n === 3 || n === 14 || n === 11 || i === 9 ? S = !1 : i === 14 && n === 4 ? S = !r : i === 10 && n === 10 ? S = a++ % 2 === 1 : i === 5 ? S = !(n === 5 || n === 13 || n === 7 || n === 8) : ((i === 7 || i === 13) && (n === 13 || n === 12) || (i === 8 || i === 12) && n === 12 || n === 0 && l && u && je(t)) && (S = !1), S ? (yield {
1820
+ segment: e.slice(p, o),
1821
+ index: p,
2741
1822
  input: e,
2742
- _hd: g,
2743
- _catBegin: u,
2744
- _catEnd: r
2745
- }, i = !1, l = 0, d = n, u = o, g = t) : o === 14 && (r === 3 || r === 4) ? i = !0 : t >= 2325 && (!a && r === 0 && (a = kt(g)), a && o === 3 ? c = c || t === 2381 || t === 2509 || t === 2637 || t === 2765 || t === 2893 || t === 3149 || t === 3405 : c = !1), n += t <= _t ? 1 : 2, r = o;
1823
+ _hd: E,
1824
+ _catBegin: f,
1825
+ _catEnd: i
1826
+ }, r = !1, a = 0, p = o, f = n, E = t) : n === 14 && (i === 3 || i === 4) ? r = !0 : t >= 2325 && (!l && i === 0 && (l = je(E)), l && n === 3 ? u = u || t === 2381 || t === 2509 || t === 2637 || t === 2765 || t === 2893 || t === 3149 || t === 3405 : u = !1), o += t <= Re ? 1 : 2, i = n;
2746
1827
  }
2747
- d < s && (yield {
2748
- segment: e.slice(d),
2749
- index: d,
1828
+ p < s && (yield {
1829
+ segment: e.slice(p),
1830
+ index: p,
2750
1831
  input: e,
2751
- _hd: g,
2752
- _catBegin: u,
2753
- _catEnd: r
1832
+ _hd: E,
1833
+ _catBegin: f,
1834
+ _catEnd: i
2754
1835
  });
2755
1836
  }
2756
- function us(e) {
1837
+ function _n(e) {
2757
1838
  let t = 0;
2758
- for (let n of cs(e)) t += 1;
1839
+ for (let o of En(e)) t += 1;
2759
1840
  return t;
2760
1841
  }
2761
- const en = new Uint8Array(6080), qe = 128, it = 12287, tn = new Uint8Array(1536), He = 40960, nn = 44031, ds = (() => {
1842
+ const Je = new Uint8Array(6080), he = 128, ve = 12287, Qe = new Uint8Array(1536), ge = 40960, et = 44031, Sn = (() => {
2762
1843
  let e = 0;
2763
1844
  for (; ; ) {
2764
- let [t, n, s] = rt[e];
2765
- if (t > nn) break;
2766
- if (e++, !(n < qe || t > it && n < He))
2767
- for (let r = t; r <= n; r++) {
2768
- let o, l = 0;
2769
- r <= it ? (o = en, l = r - qe >> 1) : (o = tn, l = r - He >> 1), o[l] = r & 1 ? o[l] & 15 | s << 4 : o[l] & 240 | s;
1845
+ let [t, o, s] = Te[e];
1846
+ if (t > et) break;
1847
+ if (e++, !(o < he || t > ve && o < ge))
1848
+ for (let i = t; i <= o; i++) {
1849
+ let n, a = 0;
1850
+ i <= ve ? (n = Je, a = i - he >> 1) : (n = Qe, a = i - ge >> 1), n[a] = i & 1 ? n[a] & 15 | s << 4 : n[a] & 240 | s;
2770
1851
  }
2771
1852
  }
2772
1853
  return e;
2773
1854
  })();
2774
- function Lt(e) {
2775
- if (e < qe)
1855
+ function Be(e) {
1856
+ if (e < he)
2776
1857
  return e >= 32 ? 0 : e === 10 ? 6 : e === 13 ? 1 : 2;
2777
- if (e <= it) {
2778
- let n = en[e - qe >> 1];
1858
+ if (e <= ve) {
1859
+ let o = Je[e - he >> 1];
2779
1860
  return (
2780
1861
  /** @type {GraphemeCategoryNum} */
2781
- e & 1 ? n >> 4 : n & 15
1862
+ e & 1 ? o >> 4 : o & 15
2782
1863
  );
2783
1864
  }
2784
- if (e < He)
1865
+ if (e < ge)
2785
1866
  return e < 12336 ? e >= 12330 ? 3 : 0 : e < 12443 ? e === 12336 || e === 12349 ? 4 : e >= 12441 ? 3 : 0 : e === 12951 || e === 12953 ? 4 : 0;
2786
- if (e <= nn) {
2787
- let n = tn[e - He >> 1];
1867
+ if (e <= et) {
1868
+ let o = Qe[e - ge >> 1];
2788
1869
  return (
2789
1870
  /** @type {GraphemeCategoryNum} */
2790
- e & 1 ? n >> 4 : n & 15
1871
+ e & 1 ? o >> 4 : o & 15
2791
1872
  );
2792
1873
  }
2793
1874
  if (e <= 55203)
@@ -2796,44 +1877,44 @@ function Lt(e) {
2796
1877
  return e <= 55238 ? e >= 55216 ? 13 : 0 : e >= 55243 ? 12 : 0;
2797
1878
  if (e < 65024)
2798
1879
  return e === 64286 ? 3 : 0;
2799
- let t = Qt(e, rt, ds);
2800
- return t < 0 ? 0 : rt[t][2];
1880
+ let t = Ye(e, Te, Sn);
1881
+ return t < 0 ? 0 : Te[t][2];
2801
1882
  }
2802
- function kt(e) {
2803
- return Qt(e, as) >= 0;
1883
+ function je(e) {
1884
+ return Ye(e, vn) >= 0;
2804
1885
  }
2805
- const Mt = typeof Intl < "u" && typeof Intl.Segmenter == "function" ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : null;
2806
- function on(e) {
1886
+ const $e = typeof Intl < "u" && typeof Intl.Segmenter == "function" ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : null;
1887
+ function tt(e) {
2807
1888
  if (!e) return 0;
2808
- if (Mt) {
1889
+ if ($e) {
2809
1890
  let t = 0;
2810
- for (const n of Mt.segment(e))
1891
+ for (const o of $e.segment(e))
2811
1892
  t++;
2812
1893
  return t;
2813
1894
  }
2814
- return us(e);
1895
+ return _n(e);
2815
1896
  }
2816
- function fs(e, t) {
2817
- const n = F(null), s = De(e, "placeholder"), r = () => {
2818
- var i;
2819
- const l = [
2820
- En,
2821
- wn,
2822
- Cn,
2823
- An,
1897
+ function Cn(e, t) {
1898
+ const o = W(null), s = de(e, "placeholder"), i = () => {
1899
+ var r;
1900
+ const a = [
1901
+ bt,
1902
+ yt,
1903
+ Tt,
1904
+ vt,
2824
1905
  // 提供 undo/redo 功能
2825
- Sn.configure({
1906
+ Et.configure({
2826
1907
  placeholder: () => s.value || "请输入内容..."
2827
1908
  }),
2828
- _n.configure({
1909
+ _t.configure({
2829
1910
  mode: "textSize",
2830
- textCounter: on
1911
+ textCounter: tt
2831
1912
  })
2832
1913
  ];
2833
- return (i = e.extensions) != null && i.length && l.push(...e.extensions), l;
2834
- }, o = vn({
1914
+ return (r = e.extensions) != null && r.length && a.push(...e.extensions), a;
1915
+ }, n = gt({
2835
1916
  content: e.modelValue ?? e.defaultValue ?? "",
2836
- extensions: r(),
1917
+ extensions: i(),
2837
1918
  autofocus: e.autofocus ? "end" : !1,
2838
1919
  editorProps: {
2839
1920
  attributes: {
@@ -2841,315 +1922,315 @@ function fs(e, t) {
2841
1922
  enterkeyhint: e.enterkeyhint
2842
1923
  },
2843
1924
  // 处理粘贴事件 - 只粘贴纯文本
2844
- handlePaste(l, i) {
2845
- var g;
2846
- const a = (g = i.clipboardData) == null ? void 0 : g.getData("text/plain");
2847
- if (!a) return !1;
2848
- const c = e.mode === "single" ? a.replace(/\r?\n/g, " ") : a, { state: d } = l, { tr: u } = d;
2849
- return u.insertText(c), l.dispatch(u), me(() => {
2850
- var h;
2851
- (h = o.value) == null || h.commands.scrollIntoView();
1925
+ handlePaste(a, r) {
1926
+ var E;
1927
+ const l = (E = r.clipboardData) == null ? void 0 : E.getData("text/plain");
1928
+ if (!l) return !1;
1929
+ const u = e.mode === "single" ? l.replace(/\r?\n/g, " ") : l, { state: p } = a, { tr: f } = p;
1930
+ return f.insertText(u), a.dispatch(f), oe(() => {
1931
+ var S;
1932
+ (S = n.value) == null || S.commands.scrollIntoView();
2852
1933
  }), !0;
2853
1934
  }
2854
1935
  },
2855
- onUpdate: (l) => {
2856
- const i = l.editor.getText();
2857
- t("update:modelValue", i), t("input", i);
1936
+ onUpdate: (a) => {
1937
+ const r = a.editor.getText();
1938
+ t("update:modelValue", r), t("input", r);
2858
1939
  },
2859
- onFocus: (l) => {
2860
- t("focus", l.event);
1940
+ onFocus: (a) => {
1941
+ t("focus", a.event);
2861
1942
  },
2862
- onBlur: (l) => {
2863
- t("blur", l.event);
1943
+ onBlur: (a) => {
1944
+ t("blur", a.event);
2864
1945
  }
2865
1946
  });
2866
1947
  return K(
2867
1948
  () => e.modelValue,
2868
- (l) => {
2869
- o.value && l !== o.value.getText() && o.value.commands.setContent(l ?? "", { emitUpdate: !1 });
1949
+ (a) => {
1950
+ n.value && a !== n.value.getText() && n.value.commands.setContent(a ?? "", { emitUpdate: !1 });
2870
1951
  }
2871
1952
  ), K(
2872
1953
  () => e.placeholder,
2873
1954
  () => {
2874
- if (o.value) {
2875
- const { state: l } = o.value, i = l.tr;
2876
- o.value.view.dispatch(i);
1955
+ if (n.value) {
1956
+ const { state: a } = n.value, r = a.tr;
1957
+ n.value.view.dispatch(r);
2877
1958
  }
2878
1959
  }
2879
1960
  ), K(
2880
1961
  () => e.enterkeyhint,
2881
- (l) => {
2882
- if (o.value) {
2883
- const i = o.value.view.dom;
2884
- l ? i.setAttribute("enterkeyhint", l) : i.removeAttribute("enterkeyhint");
1962
+ (a) => {
1963
+ if (n.value) {
1964
+ const r = n.value.view.dom;
1965
+ a ? r.setAttribute("enterkeyhint", a) : r.removeAttribute("enterkeyhint");
2885
1966
  }
2886
1967
  }
2887
- ), mn(() => {
2888
- var l;
2889
- (l = o.value) == null || l.destroy();
1968
+ ), ut(() => {
1969
+ var a;
1970
+ (a = n.value) == null || a.destroy();
2890
1971
  }), {
2891
- editor: o,
2892
- editorRef: n
1972
+ editor: n,
1973
+ editorRef: o
2893
1974
  };
2894
1975
  }
2895
- function ps(e) {
1976
+ function An(e) {
2896
1977
  const { submitType: t } = e;
2897
1978
  return {
2898
- checkSubmitShortcut: (r) => {
2899
- if (!I(r, "ENTER")) return !1;
1979
+ checkSubmitShortcut: (i) => {
1980
+ if (!I(i, "ENTER")) return !1;
2900
1981
  switch (t.value) {
2901
1982
  case "enter":
2902
- return !r.shiftKey && !r.ctrlKey && !r.metaKey;
1983
+ return !i.shiftKey && !i.ctrlKey && !i.metaKey;
2903
1984
  case "ctrlEnter":
2904
- return (r.ctrlKey || r.metaKey) && !r.shiftKey;
1985
+ return (i.ctrlKey || i.metaKey) && !i.shiftKey;
2905
1986
  case "shiftEnter":
2906
- return r.shiftKey && !r.ctrlKey && !r.metaKey;
1987
+ return i.shiftKey && !i.ctrlKey && !i.metaKey;
2907
1988
  default:
2908
1989
  return !1;
2909
1990
  }
2910
1991
  },
2911
- checkNewlineShortcut: (r) => {
2912
- if (!I(r, "ENTER")) return !1;
1992
+ checkNewlineShortcut: (i) => {
1993
+ if (!I(i, "ENTER")) return !1;
2913
1994
  switch (t.value) {
2914
1995
  case "enter":
2915
- return r.shiftKey || r.ctrlKey || r.metaKey;
1996
+ return i.shiftKey || i.ctrlKey || i.metaKey;
2916
1997
  case "ctrlEnter":
2917
1998
  case "shiftEnter":
2918
- return !r.shiftKey && !r.ctrlKey && !r.metaKey;
1999
+ return !i.shiftKey && !i.ctrlKey && !i.metaKey;
2919
2000
  default:
2920
2001
  return !1;
2921
2002
  }
2922
2003
  }
2923
2004
  };
2924
2005
  }
2925
- function ms(e, t, n) {
2926
- const s = F(e.mode || "single"), r = F(!1), o = F(e.mode || "single"), { start: l, stop: i } = Ln(
2006
+ function wn(e, t, o) {
2007
+ const s = W(e.mode || "single"), i = W(!1), n = W(e.mode || "single"), { start: a, stop: r } = St(
2927
2008
  () => {
2928
- r.value = !1;
2009
+ i.value = !1;
2929
2010
  },
2930
2011
  300,
2931
2012
  { immediate: !1 }
2932
- ), a = R(() => {
2933
- var u;
2934
- return (u = n.value) == null ? void 0 : u.closest(".tr-sender-main");
2935
- }), c = () => {
2936
- if (o.value !== "single" || r.value || !t.value || !n.value) return;
2937
- const u = n.value.querySelector(".ProseMirror");
2938
- if (!u) return;
2939
- const g = t.value.getText();
2940
- s.value === "single" ? u.scrollWidth > u.clientWidth && d("multiple") : g.length || d("single");
2941
- }, d = (u) => {
2942
- s.value !== u && (r.value = !0, s.value = u, me(() => {
2943
- t.value && t.value.commands.focus("end"), i(), l();
2013
+ ), l = M(() => {
2014
+ var f;
2015
+ return (f = o.value) == null ? void 0 : f.closest(".tr-sender-main");
2016
+ }), u = () => {
2017
+ if (n.value !== "single" || i.value || !t.value || !o.value) return;
2018
+ const f = o.value.querySelector(".ProseMirror");
2019
+ if (!f) return;
2020
+ const E = t.value.getText();
2021
+ s.value === "single" ? f.scrollWidth > f.clientWidth && p("multiple") : E.length || p("single");
2022
+ }, p = (f) => {
2023
+ s.value !== f && (i.value = !0, s.value = f, oe(() => {
2024
+ t.value && t.value.commands.focus("end"), r(), a();
2944
2025
  }));
2945
2026
  };
2946
- return kn(a, () => {
2027
+ return Ct(l, () => {
2947
2028
  requestAnimationFrame(() => {
2948
- c();
2029
+ u();
2949
2030
  });
2950
2031
  }), K(
2951
2032
  () => e.mode,
2952
- (u) => {
2953
- u && u !== s.value && (o.value = u, d(u));
2033
+ (f) => {
2034
+ f && f !== s.value && (n.value = f, p(f));
2954
2035
  }
2955
2036
  ), {
2956
2037
  currentMode: s,
2957
- isAutoSwitching: r,
2958
- setMode: d,
2959
- checkOverflow: c
2038
+ isAutoSwitching: i,
2039
+ setMode: p,
2040
+ checkOverflow: u
2960
2041
  };
2961
2042
  }
2962
- function hs(e, t, n) {
2963
- const s = Mn("--tr-sender-line-height", t), r = R(() => {
2964
- const i = s.value;
2965
- if (i) {
2966
- const a = parseFloat(i);
2967
- return isNaN(a) ? 26 : a;
2043
+ function kn(e, t, o) {
2044
+ const s = At("--tr-sender-line-height", t), i = M(() => {
2045
+ const r = s.value;
2046
+ if (r) {
2047
+ const l = parseFloat(r);
2048
+ return isNaN(l) ? 26 : l;
2968
2049
  }
2969
2050
  return 26;
2970
- }), o = R(() => n === !1 || n === void 0 ? null : n === !0 ? {
2051
+ }), n = M(() => o === !1 || o === void 0 ? null : o === !0 ? {
2971
2052
  minRows: 1,
2972
2053
  maxRows: 5
2973
- } : typeof n == "object" ? {
2974
- minRows: n.minRows,
2975
- maxRows: n.maxRows
2976
- } : null), l = () => {
2054
+ } : typeof o == "object" ? {
2055
+ minRows: o.minRows,
2056
+ maxRows: o.maxRows
2057
+ } : null), a = () => {
2977
2058
  if (!t.value) return;
2978
- const i = t.value.querySelector(".tr-sender-editor-scroll");
2979
- if (!i) {
2059
+ const r = t.value.querySelector(".tr-sender-editor-scroll");
2060
+ if (!r) {
2980
2061
  console.warn("⚠️ 找不到滚动容器 .tr-sender-editor-scroll");
2981
2062
  return;
2982
2063
  }
2983
- const a = o.value;
2984
- if (e.value === "multiple" && a) {
2985
- const c = r.value * a.minRows, d = r.value * a.maxRows;
2986
- i.style.minHeight = `${c}px`, i.style.maxHeight = `${d}px`, i.style.overflowY = "auto";
2064
+ const l = n.value;
2065
+ if (e.value === "multiple" && l) {
2066
+ const u = i.value * l.minRows, p = i.value * l.maxRows;
2067
+ r.style.minHeight = `${u}px`, r.style.maxHeight = `${p}px`, r.style.overflowY = "auto";
2987
2068
  } else
2988
- i.style.minHeight = "", i.style.maxHeight = "", i.style.overflowY = e.value === "single" ? "hidden" : "auto";
2069
+ r.style.minHeight = "", r.style.maxHeight = "", r.style.overflowY = e.value === "single" ? "hidden" : "auto";
2989
2070
  };
2990
2071
  return K(
2991
2072
  e,
2992
2073
  () => {
2993
- me(() => {
2994
- l();
2074
+ oe(() => {
2075
+ a();
2995
2076
  });
2996
2077
  },
2997
2078
  { immediate: !0 }
2998
2079
  ), K(
2999
- o,
2080
+ n,
3000
2081
  () => {
3001
- me(() => {
3002
- l();
2082
+ oe(() => {
2083
+ a();
3003
2084
  });
3004
2085
  },
3005
2086
  { immediate: !0 }
3006
2087
  ), {
3007
- updateHeight: l
2088
+ updateHeight: a
3008
2089
  };
3009
2090
  }
3010
- const gs = (e) => e == null ? !1 : typeof e == "string" ? e.trim().length > 0 : typeof e == "number" ? Number.isFinite(e) : Array.isArray(e) ? e.length > 0 : typeof e == "object" ? Object.keys(e).length > 0 : !!e, xs = (e, t) => {
3011
- const n = gn(t);
3012
- if (gs(n))
2091
+ const Ln = (e) => e == null ? !1 : typeof e == "string" ? e.trim().length > 0 : typeof e == "number" ? Number.isFinite(e) : Array.isArray(e) ? e.length > 0 : typeof e == "object" ? Object.keys(e).length > 0 : !!e, Mn = (e, t) => {
2092
+ const o = ft(t);
2093
+ if (Ln(o))
3013
2094
  return {
3014
2095
  source: e,
3015
- payload: n
2096
+ payload: o
3016
2097
  };
3017
2098
  };
3018
- function ys() {
3019
- const e = hn(/* @__PURE__ */ new Map()), t = R(() => {
3020
- const r = [];
3021
- for (const o of e.values()) {
3022
- const l = xs(o.source, o.payload);
3023
- l && r.push(l);
2099
+ function Pn() {
2100
+ const e = dt(/* @__PURE__ */ new Map()), t = M(() => {
2101
+ const i = [];
2102
+ for (const n of e.values()) {
2103
+ const a = Mn(n.source, n.payload);
2104
+ a && i.push(a);
3024
2105
  }
3025
- return r;
2106
+ return i;
3026
2107
  });
3027
2108
  return {
3028
- hasRegisteredContent: R(() => t.value.length > 0),
3029
- registerContent: (r, o) => {
3030
- const l = Symbol("sender-content");
3031
- return e.set(l, { source: r, payload: o }), () => {
3032
- e.delete(l);
2109
+ hasRegisteredContent: M(() => t.value.length > 0),
2110
+ registerContent: (i, n) => {
2111
+ const a = Symbol("sender-content");
2112
+ return e.set(a, { source: i, payload: n }), () => {
2113
+ e.delete(a);
3033
2114
  };
3034
2115
  },
3035
2116
  externalPayloads: t
3036
2117
  };
3037
2118
  }
3038
- function bs(e, t) {
3039
- const { editor: n, editorRef: s } = fs(e, t), r = R(() => n.value ? tt(n.value).trim().length > 0 : !1), { hasRegisteredContent: o, registerContent: l, externalPayloads: i } = ys(), a = R(() => r.value || o.value || !!e.hasExternalContent), c = R(() => n.value ? on(tt(n.value)) : 0), d = R(() => e.maxLength ? c.value > e.maxLength : !1), u = R(() => {
3040
- var b, L;
3041
- return !e.disabled && !e.loading && a.value && !d.value && !((L = (b = e.defaultActions) == null ? void 0 : b.submit) != null && L.disabled);
3042
- }), g = () => {
3043
- if (!u.value || !n.value) return;
3044
- let b, L = "";
3045
- if (n.value.extensionManager.extensions.some((N) => N.name === be.TEMPLATE)) {
3046
- const N = Yt(n.value);
3047
- N.length > 0 && (b = N), L = tt(n.value);
3048
- } else if (n.value.extensionManager.extensions.some((N) => N.name === be.MENTION)) {
3049
- const N = Po(n.value);
3050
- N.length > 0 && (b = N), L = Ro(n.value);
2119
+ function Dn(e, t) {
2120
+ const { editor: o, editorRef: s } = Cn(e, t), i = M(() => o.value ? be(o.value).trim().length > 0 : !1), { hasRegisteredContent: n, registerContent: a, externalPayloads: r } = Pn(), l = M(() => i.value || n.value || !!e.hasExternalContent), u = M(() => o.value ? tt(be(o.value)) : 0), p = M(() => e.maxLength ? u.value > e.maxLength : !1), f = M(() => {
2121
+ var m, k;
2122
+ return !e.disabled && !e.loading && l.value && !p.value && !((k = (m = e.defaultActions) == null ? void 0 : m.submit) != null && k.disabled);
2123
+ }), E = () => {
2124
+ if (!f.value || !o.value) return;
2125
+ let m, k = "";
2126
+ if (o.value.extensionManager.extensions.some((q) => q.name === se.TEMPLATE)) {
2127
+ const q = Ue(o.value);
2128
+ q.length > 0 && (m = q), k = be(o.value);
2129
+ } else if (o.value.extensionManager.extensions.some((q) => q.name === se.MENTION)) {
2130
+ const q = zt(o.value);
2131
+ q.length > 0 && (m = q), k = Wt(o.value);
3051
2132
  }
3052
- L || (L = n.value.getText());
3053
- const $ = i.value.slice();
2133
+ k || (k = o.value.getText());
2134
+ const $ = r.value.slice();
3054
2135
  if ($.length === 0) {
3055
- t("submit", L, b);
2136
+ t("submit", k, m);
3056
2137
  return;
3057
2138
  }
3058
- t("submit", L, b, {
2139
+ t("submit", k, m, {
3059
2140
  externalPayloads: $
3060
2141
  });
3061
- }, { currentMode: h, isAutoSwitching: E, setMode: w, checkOverflow: T } = ms(e, n, s), m = ps({
3062
- submitType: R(() => e.submitType ?? "enter")
2142
+ }, { currentMode: S, isAutoSwitching: j, setMode: L, checkOverflow: C } = wn(e, o, s), h = An({
2143
+ submitType: M(() => e.submitType ?? "enter")
3063
2144
  });
3064
2145
  K(
3065
- n,
3066
- (b) => {
3067
- b && b.setOptions({
2146
+ o,
2147
+ (m) => {
2148
+ m && m.setOptions({
3068
2149
  editorProps: {
3069
- ...b.options.editorProps,
3070
- handleKeyDown: (L, $) => {
3071
- const N = de.getState(L.state), Se = z.getState(L.state), V = Ce.getState(L.state);
3072
- return N && N.active || Se && Se.active || V && V.isOpen ? !1 : m.checkSubmitShortcut($) ? ($.preventDefault(), g(), !0) : m.checkNewlineShortcut($) ? ($.preventDefault(), h.value === "single" ? (w("multiple"), setTimeout(() => {
3073
- b.commands.splitBlock(), b.commands.focus();
3074
- }, 0)) : b.commands.splitBlock(), !0) : !1;
2150
+ ...m.options.editorProps,
2151
+ handleKeyDown: (k, $) => {
2152
+ const q = te.getState(k.state), De = H.getState(k.state), Oe = ae.getState(k.state);
2153
+ return q && q.active || De && De.active || Oe && Oe.isOpen ? !1 : h.checkSubmitShortcut($) ? ($.preventDefault(), E(), !0) : h.checkNewlineShortcut($) ? ($.preventDefault(), S.value === "single" ? (L("multiple"), setTimeout(() => {
2154
+ m.commands.splitBlock(), m.commands.focus();
2155
+ }, 0)) : m.commands.splitBlock(), !0) : !1;
3075
2156
  }
3076
2157
  }
3077
2158
  });
3078
2159
  },
3079
2160
  { immediate: !0 }
3080
- ), hs(h, s, e.autoSize), K(
2161
+ ), kn(S, s, e.autoSize), K(
3081
2162
  () => {
3082
- var b;
3083
- return (b = n.value) == null ? void 0 : b.state.doc.content;
2163
+ var m;
2164
+ return (m = o.value) == null ? void 0 : m.state.doc.content;
3084
2165
  },
3085
2166
  () => {
3086
2167
  setTimeout(() => {
3087
- T();
2168
+ C();
3088
2169
  }, 0);
3089
2170
  },
3090
2171
  { deep: !0 }
3091
2172
  );
3092
- const y = () => {
3093
- var b;
3094
- (b = n.value) == null || b.commands.focus();
3095
- }, p = () => {
3096
- var b, L;
3097
- (b = n.value) == null || b.commands.clearContent(), (L = n.value) == null || L.commands.focus(), t("clear");
3098
- }, f = () => {
2173
+ const g = () => {
2174
+ var m;
2175
+ (m = o.value) == null || m.commands.focus();
2176
+ }, d = () => {
2177
+ var m, k;
2178
+ (m = o.value) == null || m.commands.clearContent(), (k = o.value) == null || k.commands.focus(), t("clear");
2179
+ }, c = () => {
3099
2180
  t("cancel");
2181
+ }, b = () => {
2182
+ var m;
2183
+ (m = o.value) == null || m.commands.blur();
2184
+ }, _ = (m) => {
2185
+ var k;
2186
+ (k = o.value) == null || k.commands.setContent(m);
3100
2187
  }, x = () => {
3101
- var b;
3102
- (b = n.value) == null || b.commands.blur();
3103
- }, v = (b) => {
3104
- var L;
3105
- (L = n.value) == null || L.commands.setContent(b);
3106
- }, S = () => {
3107
- var b;
3108
- return ((b = n.value) == null ? void 0 : b.getText()) || "";
3109
- }, _ = {
3110
- editor: n,
2188
+ var m;
2189
+ return ((m = o.value) == null ? void 0 : m.getText()) || "";
2190
+ }, v = {
2191
+ editor: o,
3111
2192
  editorRef: s,
3112
- mode: h,
3113
- isAutoSwitching: E,
3114
- loading: R(() => e.loading ?? !1),
3115
- disabled: R(() => e.disabled ?? !1),
3116
- hasContent: a,
3117
- hasEditorContent: r,
3118
- canSubmit: u,
3119
- isOverLimit: d,
3120
- characterCount: c,
3121
- maxLength: De(e, "maxLength"),
3122
- size: R(() => e.size ?? "normal"),
3123
- showWordLimit: R(() => e.showWordLimit ?? !1),
3124
- clearable: R(() => e.clearable ?? !1),
3125
- defaultActions: De(e, "defaultActions"),
3126
- submitType: R(() => e.submitType ?? "enter"),
3127
- stopText: De(e, "stopText"),
3128
- submit: g,
3129
- clear: p,
3130
- cancel: f,
3131
- focus: y,
3132
- blur: x,
3133
- setContent: v,
3134
- getContent: S
2193
+ mode: S,
2194
+ isAutoSwitching: j,
2195
+ loading: M(() => e.loading ?? !1),
2196
+ disabled: M(() => e.disabled ?? !1),
2197
+ hasContent: l,
2198
+ hasEditorContent: i,
2199
+ canSubmit: f,
2200
+ isOverLimit: p,
2201
+ characterCount: u,
2202
+ maxLength: de(e, "maxLength"),
2203
+ size: M(() => e.size ?? "normal"),
2204
+ showWordLimit: M(() => e.showWordLimit ?? !1),
2205
+ clearable: M(() => e.clearable ?? !1),
2206
+ defaultActions: de(e, "defaultActions"),
2207
+ submitType: M(() => e.submitType ?? "enter"),
2208
+ stopText: de(e, "stopText"),
2209
+ submit: E,
2210
+ clear: d,
2211
+ cancel: c,
2212
+ focus: g,
2213
+ blur: b,
2214
+ setContent: _,
2215
+ getContent: x
3135
2216
  };
3136
- return xn(yn, _), On(l), {
3137
- context: _,
2217
+ return pt(mt, v), Lt(a), {
2218
+ context: v,
3138
2219
  expose: {
3139
- submit: g,
3140
- clear: p,
3141
- cancel: f,
3142
- focus: y,
3143
- blur: x,
3144
- setContent: v,
3145
- getContent: S,
3146
- editor: n
2220
+ submit: E,
2221
+ clear: d,
2222
+ cancel: c,
2223
+ focus: g,
2224
+ blur: b,
2225
+ setContent: _,
2226
+ getContent: x,
2227
+ editor: o
3147
2228
  }
3148
2229
  };
3149
2230
  }
3150
- function bt() {
3151
- const e = Pe();
3152
- return R(() => ({
2231
+ function Pe() {
2232
+ const e = ue();
2233
+ return M(() => ({
3153
2234
  // 编辑器实例
3154
2235
  editor: e.editor.value,
3155
2236
  // 基础操作
@@ -3157,14 +2238,14 @@ function bt() {
3157
2238
  blur: e.blur,
3158
2239
  // 内容操作(为增强按钮设计)
3159
2240
  insert: (t) => {
3160
- var n;
3161
- (n = e.editor.value) == null || n.commands.insertContent(t + " "), e.focus();
2241
+ var o;
2242
+ (o = e.editor.value) == null || o.commands.insertContent(t + " "), e.focus();
3162
2243
  },
3163
2244
  append: (t) => {
3164
- const n = e.editor.value;
3165
- if (n) {
3166
- const s = n.state.doc.content.size;
3167
- n.chain().focus().insertContentAt(s, t).run();
2245
+ const o = e.editor.value;
2246
+ if (o) {
2247
+ const s = o.state.doc.content.size;
2248
+ o.chain().focus().insertContentAt(s, t).run();
3168
2249
  }
3169
2250
  },
3170
2251
  replace: (t) => {
@@ -3176,58 +2257,58 @@ function bt() {
3176
2257
  hasContent: e.hasContent.value
3177
2258
  }));
3178
2259
  }
3179
- const vs = { class: "tr-sender-editor-scroll" }, Ts = /* @__PURE__ */ Z({
2260
+ const On = { class: "tr-sender-editor-scroll" }, In = /* @__PURE__ */ X({
3180
2261
  __name: "index",
3181
2262
  setup(e) {
3182
- const { editor: t, editorRef: n } = Pe();
3183
- return (s, r) => (M(), P("div", {
2263
+ const { editor: t, editorRef: o } = ue();
2264
+ return (s, i) => (w(), P("div", {
3184
2265
  ref_key: "editorRef",
3185
- ref: n,
2266
+ ref: o,
3186
2267
  class: "tr-sender-editor-wrapper"
3187
2268
  }, [
3188
- B("div", vs, [
3189
- k(t) ? (M(), U(k(Tn), {
2269
+ R("div", On, [
2270
+ A(t) ? (w(), U(A(xt), {
3190
2271
  key: 0,
3191
- editor: k(t),
2272
+ editor: A(t),
3192
2273
  class: "tr-sender-editor-content"
3193
- }, null, 8, ["editor"])) : q("", !0)
2274
+ }, null, 8, ["editor"])) : N("", !0)
3194
2275
  ])
3195
2276
  ], 512));
3196
2277
  }
3197
- }), sn = /* @__PURE__ */ J(Ts, [["__scopeId", "data-v-7f5b51aa"]]), Es = { class: "tr-sender-single-layout" }, ws = {
2278
+ }), nt = /* @__PURE__ */ Z(In, [["__scopeId", "data-v-7f5b51aa"]]), Rn = { class: "tr-sender-single-layout" }, Bn = {
3198
2279
  key: 0,
3199
2280
  class: "tr-sender-header"
3200
- }, Cs = { class: "tr-sender-container" }, As = { class: "tr-sender-main" }, Ss = {
2281
+ }, jn = { class: "tr-sender-container" }, $n = { class: "tr-sender-main" }, Kn = {
3201
2282
  key: 0,
3202
2283
  class: "tr-sender-prefix"
3203
- }, _s = { class: "tr-sender-content" }, Ls = /* @__PURE__ */ Z({
2284
+ }, qn = { class: "tr-sender-content" }, Nn = /* @__PURE__ */ X({
3204
2285
  __name: "SingleLineLayout",
3205
2286
  setup(e) {
3206
- const { editor: t, hasContent: n, loading: s, showWordLimit: r, maxLength: o } = Pe(), l = bt();
3207
- return (i, a) => (M(), P("div", Es, [
3208
- i.$slots.header ? (M(), P("div", ws, [
3209
- D(i.$slots, "header", {}, void 0, !0)
3210
- ])) : q("", !0),
3211
- B("div", Cs, [
3212
- B("div", As, [
3213
- i.$slots.prefix ? (M(), P("div", Ss, [
3214
- D(i.$slots, "prefix", {}, void 0, !0)
3215
- ])) : q("", !0),
3216
- B("div", _s, [
3217
- D(i.$slots, "content", { editor: k(t) }, () => [
3218
- se(sn)
2287
+ const { editor: t, hasContent: o, loading: s, showWordLimit: i, maxLength: n } = ue(), a = Pe();
2288
+ return (r, l) => (w(), P("div", Rn, [
2289
+ r.$slots.header ? (w(), P("div", Bn, [
2290
+ O(r.$slots, "header", {}, void 0, !0)
2291
+ ])) : N("", !0),
2292
+ R("div", jn, [
2293
+ R("div", $n, [
2294
+ r.$slots.prefix ? (w(), P("div", Kn, [
2295
+ O(r.$slots, "prefix", {}, void 0, !0)
2296
+ ])) : N("", !0),
2297
+ R("div", qn, [
2298
+ O(r.$slots, "content", { editor: A(t) }, () => [
2299
+ Y(nt)
3219
2300
  ], !0)
3220
2301
  ])
3221
2302
  ]),
3222
- B("div", {
3223
- class: Q(["tr-sender-actions-inline", { "has-content": k(n) || k(s) }])
2303
+ R("div", {
2304
+ class: V(["tr-sender-actions-inline", { "has-content": A(o) || A(s) }])
3224
2305
  }, [
3225
- k(r) && k(o) ? (M(), U(k(Rt), { key: 0 })) : q("", !0),
3226
- se(k(Pt), null, $e({ _: 2 }, [
3227
- i.$slots["actions-inline"] ? {
2306
+ A(i) && A(n) ? (w(), U(A(Ke), { key: 0 })) : N("", !0),
2307
+ Y(A(qe), null, me({ _: 2 }, [
2308
+ r.$slots["actions-inline"] ? {
3228
2309
  name: "prepend",
3229
- fn: j(() => [
3230
- D(i.$slots, "actions-inline", he(ge(k(l))), void 0, !0)
2310
+ fn: B(() => [
2311
+ O(r.$slots, "actions-inline", z(F(A(a))), void 0, !0)
3231
2312
  ]),
3232
2313
  key: "0"
3233
2314
  } : void 0
@@ -3236,69 +2317,69 @@ const vs = { class: "tr-sender-editor-scroll" }, Ts = /* @__PURE__ */ Z({
3236
2317
  ])
3237
2318
  ]));
3238
2319
  }
3239
- }), ks = /* @__PURE__ */ J(Ls, [["__scopeId", "data-v-7b0a576c"]]), Ms = {
2320
+ }), Hn = /* @__PURE__ */ Z(Nn, [["__scopeId", "data-v-7b0a576c"]]), Wn = {
3240
2321
  key: 0,
3241
2322
  class: "tr-sender-footer"
3242
- }, Rs = { class: "tr-sender-footer-left" }, Ps = { class: "tr-sender-footer-right" }, Os = /* @__PURE__ */ Z({
2323
+ }, zn = { class: "tr-sender-footer-left" }, Fn = { class: "tr-sender-footer-right" }, Vn = /* @__PURE__ */ X({
3243
2324
  __name: "index",
3244
2325
  setup(e) {
3245
- const { mode: t, showWordLimit: n, maxLength: s } = Pe(), r = bt();
3246
- return (o, l) => k(t) === "multiple" ? (M(), P("div", Ms, [
3247
- B("div", Rs, [
3248
- D(o.$slots, "footer", he(ge(k(r))), void 0, !0)
2326
+ const { mode: t, showWordLimit: o, maxLength: s } = ue(), i = Pe();
2327
+ return (n, a) => A(t) === "multiple" ? (w(), P("div", Wn, [
2328
+ R("div", zn, [
2329
+ O(n.$slots, "footer", z(F(A(i))), void 0, !0)
3249
2330
  ]),
3250
- B("div", Ps, [
3251
- k(n) && k(s) ? (M(), U(k(Rt), { key: 0 })) : q("", !0),
3252
- se(k(Pt), null, $e({ _: 2 }, [
3253
- o.$slots["footer-right"] ? {
2331
+ R("div", Fn, [
2332
+ A(o) && A(s) ? (w(), U(A(Ke), { key: 0 })) : N("", !0),
2333
+ Y(A(qe), null, me({ _: 2 }, [
2334
+ n.$slots["footer-right"] ? {
3254
2335
  name: "prepend",
3255
- fn: j(() => [
3256
- D(o.$slots, "footer-right", he(ge(k(r))), void 0, !0)
2336
+ fn: B(() => [
2337
+ O(n.$slots, "footer-right", z(F(A(i))), void 0, !0)
3257
2338
  ]),
3258
2339
  key: "0"
3259
2340
  } : void 0
3260
2341
  ]), 1024)
3261
2342
  ])
3262
- ])) : q("", !0);
2343
+ ])) : N("", !0);
3263
2344
  }
3264
- }), Ds = /* @__PURE__ */ J(Os, [["__scopeId", "data-v-ffcdce27"]]), Is = { class: "tr-sender-multi-layout" }, Bs = {
2345
+ }), Gn = /* @__PURE__ */ Z(Vn, [["__scopeId", "data-v-ffcdce27"]]), Un = { class: "tr-sender-multi-layout" }, Xn = {
3265
2346
  key: 0,
3266
2347
  class: "tr-sender-header"
3267
- }, $s = { class: "tr-sender-main" }, js = {
2348
+ }, Zn = { class: "tr-sender-main" }, Yn = {
3268
2349
  key: 0,
3269
2350
  class: "tr-sender-prefix"
3270
- }, Ns = { class: "tr-sender-content" }, Ws = /* @__PURE__ */ Z({
2351
+ }, Jn = { class: "tr-sender-content" }, Qn = /* @__PURE__ */ X({
3271
2352
  __name: "MultiLineLayout",
3272
2353
  setup(e) {
3273
- const t = Pe(), n = bt();
3274
- return (s, r) => (M(), P("div", Is, [
3275
- s.$slots.header ? (M(), P("div", Bs, [
3276
- D(s.$slots, "header", {}, void 0, !0)
3277
- ])) : q("", !0),
3278
- B("div", $s, [
3279
- s.$slots.prefix ? (M(), P("div", js, [
3280
- D(s.$slots, "prefix", {}, void 0, !0)
3281
- ])) : q("", !0),
3282
- B("div", Ns, [
3283
- D(s.$slots, "content", {
3284
- editor: k(t).editor
2354
+ const t = ue(), o = Pe();
2355
+ return (s, i) => (w(), P("div", Un, [
2356
+ s.$slots.header ? (w(), P("div", Xn, [
2357
+ O(s.$slots, "header", {}, void 0, !0)
2358
+ ])) : N("", !0),
2359
+ R("div", Zn, [
2360
+ s.$slots.prefix ? (w(), P("div", Yn, [
2361
+ O(s.$slots, "prefix", {}, void 0, !0)
2362
+ ])) : N("", !0),
2363
+ R("div", Jn, [
2364
+ O(s.$slots, "content", {
2365
+ editor: A(t).editor
3285
2366
  }, () => [
3286
- se(sn)
2367
+ Y(nt)
3287
2368
  ], !0)
3288
2369
  ])
3289
2370
  ]),
3290
- se(Ds, null, {
3291
- footer: j(() => [
3292
- D(s.$slots, "footer", he(ge(k(n))), void 0, !0)
2371
+ Y(Gn, null, {
2372
+ footer: B(() => [
2373
+ O(s.$slots, "footer", z(F(A(o))), void 0, !0)
3293
2374
  ]),
3294
- "footer-right": j(() => [
3295
- D(s.$slots, "footer-right", he(ge(k(n))), void 0, !0)
2375
+ "footer-right": B(() => [
2376
+ O(s.$slots, "footer-right", z(F(A(o))), void 0, !0)
3296
2377
  ]),
3297
2378
  _: 3
3298
2379
  })
3299
2380
  ]));
3300
2381
  }
3301
- }), Ks = /* @__PURE__ */ J(Ws, [["__scopeId", "data-v-0b507198"]]), qs = /* @__PURE__ */ Z({
2382
+ }), eo = /* @__PURE__ */ Z(Qn, [["__scopeId", "data-v-0b507198"]]), to = /* @__PURE__ */ X({
3302
2383
  __name: "index",
3303
2384
  props: {
3304
2385
  modelValue: {},
@@ -3321,103 +2402,103 @@ const vs = { class: "tr-sender-editor-scroll" }, Ts = /* @__PURE__ */ Z({
3321
2402
  submitType: { default: "enter" }
3322
2403
  },
3323
2404
  emits: ["update:modelValue", "submit", "focus", "blur", "clear", "cancel", "input"],
3324
- setup(e, { expose: t, emit: n }) {
3325
- const s = e, r = n, { context: o, expose: l } = bs(s, r);
3326
- return t(l), (i, a) => (M(), P("div", {
3327
- class: Q([
2405
+ setup(e, { expose: t, emit: o }) {
2406
+ const s = e, i = o, { context: n, expose: a } = Dn(s, i);
2407
+ return t(a), (r, l) => (w(), P("div", {
2408
+ class: V([
3328
2409
  "tr-sender",
3329
- `tr-sender--${k(o).mode.value}`,
3330
- `tr-sender--${k(o).size.value}`,
2410
+ `tr-sender--${A(n).mode.value}`,
2411
+ `tr-sender--${A(n).size.value}`,
3331
2412
  {
3332
- "is-auto-switching": k(o).isAutoSwitching.value,
3333
- "is-disabled": k(o).disabled.value
2413
+ "is-auto-switching": A(n).isAutoSwitching.value,
2414
+ "is-disabled": A(n).disabled.value
3334
2415
  }
3335
2416
  ])
3336
2417
  }, [
3337
- k(o).mode.value === "single" ? (M(), U(ks, { key: 0 }, $e({ _: 2 }, [
3338
- i.$slots.header ? {
2418
+ A(n).mode.value === "single" ? (w(), U(Hn, { key: 0 }, me({ _: 2 }, [
2419
+ r.$slots.header ? {
3339
2420
  name: "header",
3340
- fn: j(() => [
3341
- D(i.$slots, "header", {}, void 0, !0)
2421
+ fn: B(() => [
2422
+ O(r.$slots, "header", {}, void 0, !0)
3342
2423
  ]),
3343
2424
  key: "0"
3344
2425
  } : void 0,
3345
- i.$slots.prefix ? {
2426
+ r.$slots.prefix ? {
3346
2427
  name: "prefix",
3347
- fn: j(() => [
3348
- D(i.$slots, "prefix", {}, void 0, !0)
2428
+ fn: B(() => [
2429
+ O(r.$slots, "prefix", {}, void 0, !0)
3349
2430
  ]),
3350
2431
  key: "1"
3351
2432
  } : void 0,
3352
- i.$slots.content ? {
2433
+ r.$slots.content ? {
3353
2434
  name: "content",
3354
- fn: j((c) => [
3355
- D(i.$slots, "content", he(ge(c)), void 0, !0)
2435
+ fn: B((u) => [
2436
+ O(r.$slots, "content", z(F(u)), void 0, !0)
3356
2437
  ]),
3357
2438
  key: "2"
3358
2439
  } : void 0,
3359
- i.$slots["actions-inline"] ? {
2440
+ r.$slots["actions-inline"] ? {
3360
2441
  name: "actions-inline",
3361
- fn: j(() => [
3362
- D(i.$slots, "actions-inline", {}, void 0, !0)
2442
+ fn: B((u) => [
2443
+ O(r.$slots, "actions-inline", z(F(u)), void 0, !0)
3363
2444
  ]),
3364
2445
  key: "3"
3365
2446
  } : void 0
3366
- ]), 1024)) : (M(), U(Ks, { key: 1 }, $e({ _: 2 }, [
3367
- i.$slots.header ? {
2447
+ ]), 1024)) : (w(), U(eo, { key: 1 }, me({ _: 2 }, [
2448
+ r.$slots.header ? {
3368
2449
  name: "header",
3369
- fn: j(() => [
3370
- D(i.$slots, "header", {}, void 0, !0)
2450
+ fn: B(() => [
2451
+ O(r.$slots, "header", {}, void 0, !0)
3371
2452
  ]),
3372
2453
  key: "0"
3373
2454
  } : void 0,
3374
- i.$slots.prefix ? {
2455
+ r.$slots.prefix ? {
3375
2456
  name: "prefix",
3376
- fn: j(() => [
3377
- D(i.$slots, "prefix", {}, void 0, !0)
2457
+ fn: B(() => [
2458
+ O(r.$slots, "prefix", {}, void 0, !0)
3378
2459
  ]),
3379
2460
  key: "1"
3380
2461
  } : void 0,
3381
- i.$slots.content ? {
2462
+ r.$slots.content ? {
3382
2463
  name: "content",
3383
- fn: j((c) => [
3384
- D(i.$slots, "content", he(ge(c)), void 0, !0)
2464
+ fn: B((u) => [
2465
+ O(r.$slots, "content", z(F(u)), void 0, !0)
3385
2466
  ]),
3386
2467
  key: "2"
3387
2468
  } : void 0,
3388
- i.$slots.footer ? {
2469
+ r.$slots.footer ? {
3389
2470
  name: "footer",
3390
- fn: j(() => [
3391
- D(i.$slots, "footer", {}, void 0, !0)
2471
+ fn: B((u) => [
2472
+ O(r.$slots, "footer", z(F(u)), void 0, !0)
3392
2473
  ]),
3393
2474
  key: "3"
3394
2475
  } : void 0,
3395
- i.$slots["footer-right"] ? {
2476
+ r.$slots["footer-right"] ? {
3396
2477
  name: "footer-right",
3397
- fn: j(() => [
3398
- D(i.$slots, "footer-right", {}, void 0, !0)
2478
+ fn: B((u) => [
2479
+ O(r.$slots, "footer-right", z(F(u)), void 0, !0)
3399
2480
  ]),
3400
2481
  key: "4"
3401
2482
  } : void 0
3402
2483
  ]), 1024))
3403
2484
  ], 2));
3404
2485
  }
3405
- }), ze = /* @__PURE__ */ J(qs, [["__scopeId", "data-v-a15c5d11"]]);
3406
- ze.name = "TrSender";
3407
- const Hs = function(e) {
3408
- e.component(ze.name, ze);
3409
- }, ir = Object.assign(ze, {
3410
- install: Hs,
2486
+ }), xe = /* @__PURE__ */ Z(to, [["__scopeId", "data-v-796349fa"]]);
2487
+ xe.name = "TrSender";
2488
+ const no = function(e) {
2489
+ e.component(xe.name, xe);
2490
+ }, Eo = Object.assign(xe, {
2491
+ install: no,
3411
2492
  // 扩展类(用于继承)
3412
- Mention: Gt,
3413
- Suggestion: Xt,
3414
- Template: Zt,
2493
+ Mention: Fe,
2494
+ Suggestion: Ge,
2495
+ Template: Xe,
3415
2496
  // 便捷函数(用于简单场景)
3416
- mention: Oo,
3417
- suggestion: qo,
3418
- template: ls
2497
+ mention: Ft,
2498
+ suggestion: en,
2499
+ template: Tn
3419
2500
  });
3420
2501
  export {
3421
- ir as default,
3422
- Pe as useSenderContext
2502
+ Eo as default,
2503
+ ue as useSenderContext
3423
2504
  };