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