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