@opentiny/tiny-robot 0.5.2-alpha.8 → 1.0.0-beta.0
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/anchor/index.js +32 -32
- package/dist/container/index.js +16 -15
- package/dist/dropdown-menu/index.js +141 -97
- package/dist/extension-manager/index.js +1004 -0
- package/dist/floating-ui.dom.js +970 -0
- package/dist/index.d.ts +692 -126
- package/dist/index.js +103 -89
- package/dist/index4.js +2 -2
- package/dist/index6.js +408 -399
- package/dist/index7.js +271 -180
- package/dist/index8.js +87 -102
- package/dist/layout/index.js +1 -1
- package/dist/model-selector/index.js +1009 -0
- package/dist/sender/index.js +1127 -2060
- 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 +4 -4
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, o) => (
|
|
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
|
-
x: e,
|
|
38
|
-
y: e
|
|
39
|
-
}), $n = {
|
|
40
|
-
left: "right",
|
|
41
|
-
right: "left",
|
|
42
|
-
bottom: "top",
|
|
43
|
-
top: "bottom"
|
|
44
|
-
};
|
|
45
|
-
function jn(e, t, o) {
|
|
46
|
-
return me(e, je(t, o));
|
|
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 It(e) {
|
|
58
|
-
return e === "x" ? "y" : "x";
|
|
59
|
-
}
|
|
60
|
-
function $t(e) {
|
|
61
|
-
return e === "y" ? "height" : "width";
|
|
62
|
-
}
|
|
38
|
+
}), Dt = /* @__PURE__ */ Z(Pt, [["__scopeId", "data-v-b42c4fae"]]);
|
|
63
39
|
function re(e) {
|
|
64
|
-
const t = e[0];
|
|
65
|
-
return t === "t" || t === "b" ? "y" : "x";
|
|
66
|
-
}
|
|
67
|
-
function jt(e) {
|
|
68
|
-
return It(re(e));
|
|
69
|
-
}
|
|
70
|
-
function Nn(e, t, o) {
|
|
71
|
-
o === void 0 && (o = !1);
|
|
72
|
-
const s = Ve(e), r = jt(e), n = $t(r);
|
|
73
|
-
let l = r === "x" ? s === (o ? "end" : "start") ? "right" : "left" : s === "start" ? "bottom" : "top";
|
|
74
|
-
return t.reference[n] > t.floating[n] && (l = We(l)), [l, We(l)];
|
|
75
|
-
}
|
|
76
|
-
function Wn(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"], Kn = ["top", "bottom"], qn = ["bottom", "top"];
|
|
84
|
-
function Hn(e, t, o) {
|
|
85
|
-
switch (e) {
|
|
86
|
-
case "top":
|
|
87
|
-
case "bottom":
|
|
88
|
-
return o ? t ? Tt : vt : t ? vt : Tt;
|
|
89
|
-
case "left":
|
|
90
|
-
case "right":
|
|
91
|
-
return t ? Kn : qn;
|
|
92
|
-
default:
|
|
93
|
-
return [];
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
function zn(e, t, o, s) {
|
|
97
|
-
const r = Ve(e);
|
|
98
|
-
let n = Hn(Ee(e), o === "start", s);
|
|
99
|
-
return r && (n = n.map((l) => l + "-" + r), t && (n = n.concat(n.map(ot)))), n;
|
|
100
|
-
}
|
|
101
|
-
function We(e) {
|
|
102
|
-
const t = Ee(e);
|
|
103
|
-
return $n[t] + e.slice(t.length);
|
|
104
|
-
}
|
|
105
|
-
function Fn(e) {
|
|
106
|
-
var t, o, s, r;
|
|
107
|
-
return {
|
|
108
|
-
top: (t = e.top) != null ? t : 0,
|
|
109
|
-
right: (o = e.right) != null ? o : 0,
|
|
110
|
-
bottom: (s = e.bottom) != null ? s : 0,
|
|
111
|
-
left: (r = e.left) != null ? r : 0
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
function Vn(e) {
|
|
115
|
-
return typeof e != "number" ? Fn(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: o,
|
|
126
|
-
width: s,
|
|
127
|
-
height: r
|
|
128
|
-
} = e;
|
|
129
|
-
return {
|
|
130
|
-
width: s,
|
|
131
|
-
height: r,
|
|
132
|
-
top: o,
|
|
133
|
-
left: t,
|
|
134
|
-
right: t + s,
|
|
135
|
-
bottom: o + r,
|
|
136
|
-
x: t,
|
|
137
|
-
y: o
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
function Et(e, t, o) {
|
|
141
|
-
let {
|
|
142
|
-
reference: s,
|
|
143
|
-
floating: r
|
|
144
|
-
} = e;
|
|
145
|
-
const n = re(t), l = jt(t), i = $t(l), a = Ee(t), c = n === "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 C = Ve(t);
|
|
179
|
-
return C && (h[l] += g * (C === "end" ? 1 : -1) * (o && c ? -1 : 1)), h;
|
|
180
|
-
}
|
|
181
|
-
async function Gn(e, t) {
|
|
182
|
-
var o;
|
|
183
|
-
t === void 0 && (t = {});
|
|
184
|
-
const {
|
|
185
|
-
x: s,
|
|
186
|
-
y: r,
|
|
187
|
-
platform: n,
|
|
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), C = Vn(h), b = i[g ? u === "floating" ? "reference" : "floating" : u], m = Ke(await n.getClippingRect({
|
|
198
|
-
element: (o = await (n.isElement == null ? void 0 : n.isElement(b))) == null || o ? b : b.contextElement || await (n.getDocumentElement == null ? void 0 : n.getDocumentElement(i.floating)),
|
|
199
|
-
boundary: c,
|
|
200
|
-
rootBoundary: d,
|
|
201
|
-
strategy: a
|
|
202
|
-
})), x = u === "floating" ? {
|
|
203
|
-
x: s,
|
|
204
|
-
y: r,
|
|
205
|
-
width: l.floating.width,
|
|
206
|
-
height: l.floating.height
|
|
207
|
-
} : l.reference, p = await (n.getOffsetParent == null ? void 0 : n.getOffsetParent(i.floating)), f = await (n.isElement == null ? void 0 : n.isElement(p)) && await (n.getScale == null ? void 0 : n.getScale(p)) || {
|
|
208
|
-
x: 1,
|
|
209
|
-
y: 1
|
|
210
|
-
}, v = Ke(n.convertOffsetParentRelativeRectToViewportRelativeRect ? await n.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
211
|
-
elements: i,
|
|
212
|
-
rect: x,
|
|
213
|
-
offsetParent: p,
|
|
214
|
-
strategy: a
|
|
215
|
-
}) : x);
|
|
216
|
-
return {
|
|
217
|
-
top: (m.top - v.top + C.top) / f.y,
|
|
218
|
-
bottom: (v.bottom - m.bottom + C.bottom) / f.y,
|
|
219
|
-
left: (m.left - v.left + C.left) / f.x,
|
|
220
|
-
right: (v.right - m.right + C.right) / f.x
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
const Un = 50, Xn = async (e, t, o) => {
|
|
224
|
-
const {
|
|
225
|
-
placement: s = "bottom",
|
|
226
|
-
strategy: r = "absolute",
|
|
227
|
-
middleware: n = [],
|
|
228
|
-
platform: l
|
|
229
|
-
} = o, i = l.detectOverflow ? l : {
|
|
230
|
-
...l,
|
|
231
|
-
detectOverflow: Gn
|
|
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 C = {};
|
|
242
|
-
for (let w = 0; w < n.length; w++) {
|
|
243
|
-
const b = n[w];
|
|
244
|
-
if (!b)
|
|
245
|
-
continue;
|
|
246
|
-
const {
|
|
247
|
-
name: m,
|
|
248
|
-
fn: x
|
|
249
|
-
} = b, {
|
|
250
|
-
x: p,
|
|
251
|
-
y: f,
|
|
252
|
-
data: v,
|
|
253
|
-
reset: E
|
|
254
|
-
} = await x({
|
|
255
|
-
x: d,
|
|
256
|
-
y: u,
|
|
257
|
-
initialPlacement: s,
|
|
258
|
-
placement: g,
|
|
259
|
-
strategy: r,
|
|
260
|
-
middlewareData: C,
|
|
261
|
-
rects: c,
|
|
262
|
-
platform: i,
|
|
263
|
-
elements: {
|
|
264
|
-
reference: e,
|
|
265
|
-
floating: t
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
d = p ?? d, u = f ?? u, C[m] = {
|
|
269
|
-
...C[m],
|
|
270
|
-
...v
|
|
271
|
-
}, E && h < Un && (h++, typeof E == "object" && (E.placement && (g = E.placement), E.rects && (c = E.rects === !0 ? await l.getElementRects({
|
|
272
|
-
reference: e,
|
|
273
|
-
floating: t,
|
|
274
|
-
strategy: r
|
|
275
|
-
}) : E.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: C
|
|
286
|
-
};
|
|
287
|
-
}, Yn = function(e) {
|
|
288
|
-
return e === void 0 && (e = {}), {
|
|
289
|
-
name: "flip",
|
|
290
|
-
options: e,
|
|
291
|
-
async fn(t) {
|
|
292
|
-
var o, s;
|
|
293
|
-
const {
|
|
294
|
-
placement: r,
|
|
295
|
-
middlewareData: n,
|
|
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: C = "none",
|
|
306
|
-
flipAlignment: w = !0,
|
|
307
|
-
...b
|
|
308
|
-
} = Fe(e, t);
|
|
309
|
-
if ((o = n.arrow) != null && o.alignmentOffset)
|
|
310
|
-
return {};
|
|
311
|
-
const m = Ee(r), x = re(i), p = Ee(i) === i, f = await (a.isRTL == null ? void 0 : a.isRTL(c.floating)), v = g || (p || !w ? [We(i)] : Wn(i)), E = C !== "none";
|
|
312
|
-
!g && E && v.push(...zn(i, w, C, f));
|
|
313
|
-
const T = [i, ...v], A = await a.detectOverflow(t, b), y = [];
|
|
314
|
-
let L = ((s = n.flip) == null ? void 0 : s.overflows) || [];
|
|
315
|
-
if (d && y.push(A[m]), u) {
|
|
316
|
-
const G = Nn(r, l, f);
|
|
317
|
-
y.push(A[G[0]], A[G[1]]);
|
|
318
|
-
}
|
|
319
|
-
if (L = [...L, {
|
|
320
|
-
placement: r,
|
|
321
|
-
overflows: y
|
|
322
|
-
}], !y.every((G) => G <= 0)) {
|
|
323
|
-
var I, N;
|
|
324
|
-
const G = (((I = n.flip) == null ? void 0 : I.index) || 0) + 1, Je = T[G];
|
|
325
|
-
if (Je && (!(u === "alignment" ? x !== re(Je) : !1) || // We leave the current main axis only if every placement on that axis
|
|
326
|
-
// overflows the main axis.
|
|
327
|
-
L.every((H) => re(H.placement) === x ? H.overflows[0] > 0 : !0)))
|
|
328
|
-
return {
|
|
329
|
-
data: {
|
|
330
|
-
index: G,
|
|
331
|
-
overflows: L
|
|
332
|
-
},
|
|
333
|
-
reset: {
|
|
334
|
-
placement: Je
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
let _e = (N = L.filter((de) => de.overflows[0] <= 0).sort((de, H) => de.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 de = (Se = L.filter((H) => {
|
|
343
|
-
if (E) {
|
|
344
|
-
const se = re(H.placement);
|
|
345
|
-
return se === x || // Create a bias to the `y` side axis due to horizontal
|
|
346
|
-
// reading directions favoring greater width.
|
|
347
|
-
se === "y";
|
|
348
|
-
}
|
|
349
|
-
return !0;
|
|
350
|
-
}).map((H) => [H.placement, H.overflows.filter((se) => se > 0).reduce((se, rn) => se + rn, 0)]).sort((H, se) => H[1] - se[1])[0]) == null ? void 0 : Se[0];
|
|
351
|
-
de && (_e = de);
|
|
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
|
-
}, Zn = /* @__PURE__ */ new Set(["left", "top"]);
|
|
369
|
-
async function Jn(e, t) {
|
|
370
|
-
const {
|
|
371
|
-
placement: o,
|
|
372
|
-
platform: s,
|
|
373
|
-
elements: r
|
|
374
|
-
} = e, n = await (s.isRTL == null ? void 0 : s.isRTL(r.floating)), l = Ee(o), i = Ve(o), a = re(o) === "y", c = Zn.has(l) ? -1 : 1, d = n && a ? -1 : 1, u = Fe(t, e);
|
|
375
|
-
let {
|
|
376
|
-
mainAxis: g,
|
|
377
|
-
crossAxis: h,
|
|
378
|
-
alignmentAxis: C
|
|
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 C == "number" && (h = i === "end" ? C * -1 : C), a ? {
|
|
389
|
-
x: h * d,
|
|
390
|
-
y: g * c
|
|
391
|
-
} : {
|
|
392
|
-
x: g * c,
|
|
393
|
-
y: h * d
|
|
394
|
-
};
|
|
395
|
-
}
|
|
396
|
-
const Qn = function(e) {
|
|
397
|
-
return e === void 0 && (e = 0), {
|
|
398
|
-
name: "offset",
|
|
399
|
-
options: e,
|
|
400
|
-
async fn(t) {
|
|
401
|
-
var o, s;
|
|
402
|
-
const {
|
|
403
|
-
x: r,
|
|
404
|
-
y: n,
|
|
405
|
-
placement: l,
|
|
406
|
-
middlewareData: i
|
|
407
|
-
} = t, a = await Jn(t, e);
|
|
408
|
-
return l === ((o = i.offset) == null ? void 0 : o.placement) && (s = i.arrow) != null && s.alignmentOffset ? {} : {
|
|
409
|
-
x: r + a.x,
|
|
410
|
-
y: n + a.y,
|
|
411
|
-
data: {
|
|
412
|
-
...a,
|
|
413
|
-
placement: l
|
|
414
|
-
}
|
|
415
|
-
};
|
|
416
|
-
}
|
|
417
|
-
};
|
|
418
|
-
}, eo = function(e) {
|
|
419
|
-
return e === void 0 && (e = {}), {
|
|
420
|
-
name: "shift",
|
|
421
|
-
options: e,
|
|
422
|
-
async fn(t) {
|
|
423
|
-
const {
|
|
424
|
-
x: o,
|
|
425
|
-
y: s,
|
|
426
|
-
placement: r,
|
|
427
|
-
platform: n
|
|
428
|
-
} = t, {
|
|
429
|
-
mainAxis: l = !0,
|
|
430
|
-
crossAxis: i = !1,
|
|
431
|
-
limiter: a = {
|
|
432
|
-
fn: (x) => {
|
|
433
|
-
let {
|
|
434
|
-
x: p,
|
|
435
|
-
y: f
|
|
436
|
-
} = x;
|
|
437
|
-
return {
|
|
438
|
-
x: p,
|
|
439
|
-
y: f
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
},
|
|
443
|
-
...c
|
|
444
|
-
} = Fe(e, t), d = {
|
|
445
|
-
x: o,
|
|
446
|
-
y: s
|
|
447
|
-
}, u = await n.detectOverflow(t, c), g = re(r), h = It(g);
|
|
448
|
-
let C = d[h], w = d[g];
|
|
449
|
-
const b = (x, p) => jn(p + u[x === "y" ? "top" : "left"], p, p - u[x === "y" ? "bottom" : "right"]);
|
|
450
|
-
l && (C = b(h, C)), i && (w = b(g, w));
|
|
451
|
-
const m = a.fn({
|
|
452
|
-
...t,
|
|
453
|
-
[h]: C,
|
|
454
|
-
[g]: w
|
|
455
|
-
});
|
|
456
|
-
return {
|
|
457
|
-
...m,
|
|
458
|
-
data: {
|
|
459
|
-
x: m.x - o,
|
|
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 oe(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 Q(e) {
|
|
488
|
-
return Ge() ? e instanceof Element || e instanceof W(e).Element : !1;
|
|
489
|
-
}
|
|
490
|
-
function ce(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: o,
|
|
500
|
-
overflowY: s,
|
|
501
|
-
display: r
|
|
502
|
-
} = ee(e);
|
|
503
|
-
return /auto|scroll|overlay|hidden|clip/.test(t + s + o) && r !== "inline" && r !== "contents";
|
|
504
|
-
}
|
|
505
|
-
function to(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 no = /transform|translate|scale|rotate|perspective|filter/, oo = /paint|layout|strict|content/, fe = (e) => !!e && e !== "none";
|
|
521
|
-
let Qe;
|
|
522
|
-
function dt(e) {
|
|
523
|
-
const t = Q(e) ? ee(e) : e;
|
|
524
|
-
return fe(t.transform) || fe(t.translate) || fe(t.scale) || fe(t.rotate) || fe(t.perspective) || !ft() && (fe(t.backdropFilter) || fe(t.filter)) || no.test(t.willChange || "") || oo.test(t.contain || "");
|
|
525
|
-
}
|
|
526
|
-
function so(e) {
|
|
527
|
-
let t = xe(e);
|
|
528
|
-
for (; ce(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 ee(e) {
|
|
544
|
-
return W(e).getComputedStyle(e);
|
|
545
|
-
}
|
|
546
|
-
function Ye(e) {
|
|
547
|
-
return Q(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
|
-
oe(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 : ce(t) && Ue(t) ? t : Wt(t);
|
|
570
|
-
}
|
|
571
|
-
function Re(e, t, o) {
|
|
572
|
-
var s;
|
|
573
|
-
t === void 0 && (t = []), o === void 0 && (o = !0);
|
|
574
|
-
const r = Wt(e), n = r === ((s = e.ownerDocument) == null ? void 0 : s.body), l = W(r);
|
|
575
|
-
if (n) {
|
|
576
|
-
const i = st(l);
|
|
577
|
-
return t.concat(l, l.visualViewport || [], Ue(r) ? r : [], i && o ? Re(i) : []);
|
|
578
|
-
} else
|
|
579
|
-
return t.concat(r, Re(r, [], o));
|
|
580
|
-
}
|
|
581
|
-
function st(e) {
|
|
582
|
-
return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
|
|
583
|
-
}
|
|
584
|
-
function Kt(e) {
|
|
585
|
-
const t = ee(e);
|
|
586
|
-
let o = parseFloat(t.width) || 0, s = parseFloat(t.height) || 0;
|
|
587
|
-
const r = ce(e), n = r ? e.offsetWidth : o, l = r ? e.offsetHeight : s, i = Ne(o) !== n || Ne(s) !== l;
|
|
588
|
-
return i && (o = n, s = l), {
|
|
589
|
-
width: o,
|
|
590
|
-
height: s,
|
|
591
|
-
$: i
|
|
592
|
-
};
|
|
593
|
-
}
|
|
594
|
-
function pt(e) {
|
|
595
|
-
return Q(e) ? e : e.contextElement;
|
|
596
|
-
}
|
|
597
|
-
function Te(e) {
|
|
598
|
-
const t = pt(e);
|
|
599
|
-
if (!ce(t))
|
|
600
|
-
return ne(1);
|
|
601
|
-
const o = t.getBoundingClientRect(), {
|
|
602
|
-
width: s,
|
|
603
|
-
height: r,
|
|
604
|
-
$: n
|
|
605
|
-
} = Kt(t);
|
|
606
|
-
let l = (n ? Ne(o.width) : o.width) / s, i = (n ? Ne(o.height) : o.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 ro = /* @__PURE__ */ ne(0);
|
|
613
|
-
function qt(e) {
|
|
614
|
-
const t = W(e);
|
|
615
|
-
return !ft() || !t.visualViewport ? ro : {
|
|
616
|
-
x: t.visualViewport.offsetLeft,
|
|
617
|
-
y: t.visualViewport.offsetTop
|
|
618
|
-
};
|
|
619
|
-
}
|
|
620
|
-
function io(e, t, o) {
|
|
621
|
-
return t === void 0 && (t = !1), !!o && t && o === W(e);
|
|
622
|
-
}
|
|
623
|
-
function ye(e, t, o, s) {
|
|
624
|
-
t === void 0 && (t = !1), o === void 0 && (o = !1);
|
|
625
|
-
const r = e.getBoundingClientRect(), n = pt(e);
|
|
626
|
-
let l = ne(1);
|
|
627
|
-
t && (s ? Q(s) && (l = Te(s)) : l = Te(e));
|
|
628
|
-
const i = io(n, o, s) ? qt(n) : ne(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 (n && s) {
|
|
631
|
-
const g = W(n), h = Q(s) ? W(s) : s;
|
|
632
|
-
let C = g, w = st(C);
|
|
633
|
-
for (; w && h !== C; ) {
|
|
634
|
-
const b = Te(w), m = w.getBoundingClientRect(), x = ee(w), p = m.left + (w.clientLeft + parseFloat(x.paddingLeft)) * b.x, f = m.top + (w.clientTop + parseFloat(x.paddingTop)) * b.y;
|
|
635
|
-
a *= b.x, c *= b.y, d *= b.x, u *= b.y, a += p, c += f, C = W(w), w = st(C);
|
|
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 o = Ye(e).scrollLeft;
|
|
647
|
-
return t ? t.left + o : ye(oe(e)).left + o;
|
|
648
|
-
}
|
|
649
|
-
function Ht(e, t) {
|
|
650
|
-
const o = e.getBoundingClientRect(), s = o.left + t.scrollLeft - Ze(e, o), r = o.top + t.scrollTop;
|
|
651
|
-
return {
|
|
652
|
-
x: s,
|
|
653
|
-
y: r
|
|
654
|
-
};
|
|
655
|
-
}
|
|
656
|
-
function lo(e) {
|
|
657
|
-
let {
|
|
658
|
-
elements: t,
|
|
659
|
-
rect: o,
|
|
660
|
-
offsetParent: s,
|
|
661
|
-
strategy: r
|
|
662
|
-
} = e;
|
|
663
|
-
const n = r === "fixed", l = oe(s), i = t ? Xe(t.floating) : !1;
|
|
664
|
-
if (s === l || i && n)
|
|
665
|
-
return o;
|
|
666
|
-
let a = {
|
|
667
|
-
scrollLeft: 0,
|
|
668
|
-
scrollTop: 0
|
|
669
|
-
}, c = ne(1);
|
|
670
|
-
const d = ne(0), u = ce(s);
|
|
671
|
-
if ((u || !n) && ((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 && !n ? Ht(l, a) : ne(0);
|
|
676
|
-
return {
|
|
677
|
-
width: o.width * c.x,
|
|
678
|
-
height: o.height * c.y,
|
|
679
|
-
x: o.x * c.x - a.scrollLeft * c.x + d.x + g.x,
|
|
680
|
-
y: o.y * c.y - a.scrollTop * c.y + d.y + g.y
|
|
681
|
-
};
|
|
682
|
-
}
|
|
683
|
-
function ao(e) {
|
|
684
|
-
return e.getClientRects ? Array.from(e.getClientRects()) : [];
|
|
685
|
-
}
|
|
686
|
-
function co(e) {
|
|
687
|
-
const t = Ye(e), o = e.ownerDocument.body, s = me(e.scrollWidth, e.clientWidth, o.scrollWidth, o.clientWidth), r = me(e.scrollHeight, e.clientHeight, o.scrollHeight, o.clientHeight);
|
|
688
|
-
let n = -t.scrollLeft + Ze(e);
|
|
689
|
-
const l = -t.scrollTop;
|
|
690
|
-
return ee(o).direction === "rtl" && (n += me(e.clientWidth, o.clientWidth) - s), {
|
|
691
|
-
width: s,
|
|
692
|
-
height: r,
|
|
693
|
-
x: n,
|
|
694
|
-
y: l
|
|
695
|
-
};
|
|
696
|
-
}
|
|
697
|
-
const uo = 25;
|
|
698
|
-
function fo(e, t, o) {
|
|
699
|
-
o === void 0 && (o = "viewport");
|
|
700
|
-
const s = o === "layoutViewport", r = W(e), n = oe(e), l = r.visualViewport;
|
|
701
|
-
let i = n.clientWidth, a = n.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(n) <= 0) {
|
|
707
|
-
const g = n.ownerDocument, h = g.body, C = getComputedStyle(h), w = g.compatMode === "CSS1Compat" && parseFloat(C.marginLeft) + parseFloat(C.marginRight) || 0, b = Math.abs(n.clientWidth - h.clientWidth - w), m = getComputedStyle(n).scrollbarGutter === "stable both-edges" ? b / 2 : b;
|
|
708
|
-
m <= uo && (i -= m);
|
|
709
|
-
}
|
|
710
|
-
return {
|
|
711
|
-
width: i,
|
|
712
|
-
height: a,
|
|
713
|
-
x: c,
|
|
714
|
-
y: d
|
|
715
|
-
};
|
|
716
|
-
}
|
|
717
|
-
function po(e, t) {
|
|
718
|
-
const o = ye(e, !0, t === "fixed"), s = o.top + e.clientTop, r = o.left + e.clientLeft, n = Te(e), l = e.clientWidth * n.x, i = e.clientHeight * n.y, a = r * n.x, c = s * n.y;
|
|
719
|
-
return {
|
|
720
|
-
width: l,
|
|
721
|
-
height: i,
|
|
722
|
-
x: a,
|
|
723
|
-
y: c
|
|
724
|
-
};
|
|
725
|
-
}
|
|
726
|
-
function Ct(e, t, o) {
|
|
727
|
-
let s;
|
|
728
|
-
if (t === "viewport" || t === "layoutViewport")
|
|
729
|
-
s = fo(e, o, t);
|
|
730
|
-
else if (t === "document")
|
|
731
|
-
s = co(oe(e));
|
|
732
|
-
else if (Q(t))
|
|
733
|
-
s = po(t, o);
|
|
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 mo(e, t) {
|
|
746
|
-
const o = t.get(e);
|
|
747
|
-
if (o)
|
|
748
|
-
return o;
|
|
749
|
-
let s = Re(e, [], !1).filter((i) => Q(i) && Ae(i) !== "body"), r = null;
|
|
750
|
-
const n = ee(e).position === "fixed";
|
|
751
|
-
let l = n ? xe(e) : e;
|
|
752
|
-
for (; Q(l) && !Me(l); ) {
|
|
753
|
-
const i = ee(l), a = dt(l), c = r ? r.position : n ? "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 ho(e) {
|
|
759
|
-
let {
|
|
760
|
-
element: t,
|
|
761
|
-
boundary: o,
|
|
762
|
-
rootBoundary: s,
|
|
763
|
-
strategy: r
|
|
764
|
-
} = e;
|
|
765
|
-
const l = [...o === "clippingAncestors" ? Xe(t) ? [] : mo(t, this._c) : [].concat(o), 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 = me(h.top, a), c = je(h.right, c), d = je(h.bottom, d), u = me(h.left, u);
|
|
770
|
-
}
|
|
771
|
-
return {
|
|
772
|
-
width: c - u,
|
|
773
|
-
height: d - a,
|
|
774
|
-
x: u,
|
|
775
|
-
y: a
|
|
776
|
-
};
|
|
777
|
-
}
|
|
778
|
-
function go(e) {
|
|
779
|
-
const {
|
|
780
|
-
width: t,
|
|
781
|
-
height: o
|
|
782
|
-
} = Kt(e);
|
|
783
|
-
return {
|
|
784
|
-
width: t,
|
|
785
|
-
height: o
|
|
786
|
-
};
|
|
787
|
-
}
|
|
788
|
-
function xo(e, t, o) {
|
|
789
|
-
const s = ce(t), r = oe(t), n = o === "fixed", l = ye(e, !0, n, t);
|
|
790
|
-
let i = {
|
|
791
|
-
scrollLeft: 0,
|
|
792
|
-
scrollTop: 0
|
|
793
|
-
};
|
|
794
|
-
const a = ne(0);
|
|
795
|
-
if ((s || !n) && ((Ae(t) !== "body" || Ue(r)) && (i = Ye(t)), s)) {
|
|
796
|
-
const g = ye(t, !0, n, 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 && !n ? Ht(r, i) : ne(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 ee(e).position === "static";
|
|
810
|
-
}
|
|
811
|
-
function At(e, t) {
|
|
812
|
-
if (!ce(e) || ee(e).position === "fixed")
|
|
813
|
-
return null;
|
|
814
|
-
if (t)
|
|
815
|
-
return t(e);
|
|
816
|
-
let o = e.offsetParent;
|
|
817
|
-
return oe(e) === o && (o = o.ownerDocument.body), o;
|
|
818
|
-
}
|
|
819
|
-
function zt(e, t) {
|
|
820
|
-
const o = W(e);
|
|
821
|
-
if (Xe(e))
|
|
822
|
-
return o;
|
|
823
|
-
if (!ce(e)) {
|
|
824
|
-
let r = xe(e);
|
|
825
|
-
for (; r && !Me(r); ) {
|
|
826
|
-
if (Q(r) && !et(r))
|
|
827
|
-
return r;
|
|
828
|
-
r = xe(r);
|
|
829
|
-
}
|
|
830
|
-
return o;
|
|
831
|
-
}
|
|
832
|
-
let s = At(e, t);
|
|
833
|
-
for (; s && to(s) && et(s); )
|
|
834
|
-
s = At(s, t);
|
|
835
|
-
return s && Me(s) && et(s) && !dt(s) ? o : s || so(e) || o;
|
|
836
|
-
}
|
|
837
|
-
const yo = async function(e) {
|
|
838
|
-
const t = this.getOffsetParent || zt, o = this.getDimensions, s = await o(e.floating);
|
|
839
|
-
return {
|
|
840
|
-
reference: xo(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 bo(e) {
|
|
850
|
-
return ee(e).direction === "rtl";
|
|
851
|
-
}
|
|
852
|
-
const vo = {
|
|
853
|
-
convertOffsetParentRelativeRectToViewportRelativeRect: lo,
|
|
854
|
-
getDocumentElement: oe,
|
|
855
|
-
getClippingRect: ho,
|
|
856
|
-
getOffsetParent: zt,
|
|
857
|
-
getElementRects: yo,
|
|
858
|
-
getClientRects: ao,
|
|
859
|
-
getDimensions: go,
|
|
860
|
-
getScale: Te,
|
|
861
|
-
isElement: Q,
|
|
862
|
-
isRTL: bo
|
|
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 To(e, t, o) {
|
|
868
|
-
let s = null, r;
|
|
869
|
-
const n = oe(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: C,
|
|
879
|
-
width: w,
|
|
880
|
-
height: b
|
|
881
|
-
} = g;
|
|
882
|
-
if (d || t(), !w || !b)
|
|
883
|
-
return;
|
|
884
|
-
const m = Oe(C), x = Oe(n.clientWidth - (h + w)), p = Oe(n.clientHeight - (C + b)), f = Oe(h), E = {
|
|
885
|
-
rootMargin: -m + "px " + -x + "px " + -p + "px " + -f + "px",
|
|
886
|
-
threshold: me(0, je(1, u)) || 1
|
|
887
|
-
};
|
|
888
|
-
let T = !0;
|
|
889
|
-
function A(y) {
|
|
890
|
-
const L = y[0].intersectionRatio;
|
|
891
|
-
if (!Ft(g, e.getBoundingClientRect()))
|
|
892
|
-
return i();
|
|
893
|
-
if (L !== u) {
|
|
894
|
-
if (!T)
|
|
895
|
-
return i();
|
|
896
|
-
L ? i(!1, L) : r = setTimeout(() => {
|
|
897
|
-
i(!1, 1e-7);
|
|
898
|
-
}, 1e3);
|
|
899
|
-
}
|
|
900
|
-
T = !1;
|
|
901
|
-
}
|
|
902
|
-
try {
|
|
903
|
-
s = new IntersectionObserver(A, {
|
|
904
|
-
...E,
|
|
905
|
-
// Handle <iframe>s
|
|
906
|
-
root: n.ownerDocument
|
|
907
|
-
});
|
|
908
|
-
} catch {
|
|
909
|
-
s = new IntersectionObserver(A, E);
|
|
910
|
-
}
|
|
911
|
-
s.observe(e);
|
|
912
|
-
}
|
|
913
|
-
const a = W(e), c = () => i(o);
|
|
914
|
-
return a.addEventListener("resize", c), i(!0), () => {
|
|
915
|
-
a.removeEventListener("resize", c), l();
|
|
916
|
-
};
|
|
917
|
-
}
|
|
918
|
-
function mt(e, t, o, s) {
|
|
919
|
-
s === void 0 && (s = {});
|
|
920
|
-
const {
|
|
921
|
-
ancestorScroll: r = !0,
|
|
922
|
-
ancestorResize: n = !0,
|
|
923
|
-
elementResize: l = typeof ResizeObserver == "function",
|
|
924
|
-
layoutShift: i = typeof IntersectionObserver == "function",
|
|
925
|
-
animationFrame: a = !1
|
|
926
|
-
} = s, c = pt(e), d = r || n ? [...c ? Re(c) : [], ...t ? Re(t) : []] : [];
|
|
927
|
-
d.forEach((m) => {
|
|
928
|
-
r && m.addEventListener("scroll", o), n && m.addEventListener("resize", o);
|
|
929
|
-
});
|
|
930
|
-
const u = c && i ? To(c, o, n) : null;
|
|
931
|
-
let g = -1, h = null;
|
|
932
|
-
l && (h = new ResizeObserver((m) => {
|
|
933
|
-
let [x] = m;
|
|
934
|
-
x && x.target === c && h && t && (h.unobserve(t), cancelAnimationFrame(g), g = requestAnimationFrame(() => {
|
|
935
|
-
var p;
|
|
936
|
-
(p = h) == null || p.observe(t);
|
|
937
|
-
})), o();
|
|
938
|
-
}), c && !a && h.observe(c), t && h.observe(t));
|
|
939
|
-
let C, w = a ? ye(e) : null;
|
|
940
|
-
a && b();
|
|
941
|
-
function b() {
|
|
942
|
-
const m = ye(e);
|
|
943
|
-
w && !Ft(w, m) && o(), w = m, C = requestAnimationFrame(b);
|
|
944
|
-
}
|
|
945
|
-
return o(), () => {
|
|
946
|
-
var m;
|
|
947
|
-
d.forEach((x) => {
|
|
948
|
-
r && x.removeEventListener("scroll", o), n && x.removeEventListener("resize", o);
|
|
949
|
-
}), u == null || u(), (m = h) == null || m.disconnect(), h = null, a && cancelAnimationFrame(C);
|
|
950
|
-
};
|
|
951
|
-
}
|
|
952
|
-
const ht = Qn, gt = eo, xt = Yn, yt = (e, t, o) => {
|
|
953
|
-
const s = /* @__PURE__ */ new Map(), r = o ?? {}, n = {
|
|
954
|
-
...vo,
|
|
955
|
-
...r.platform,
|
|
956
|
-
_c: s
|
|
957
|
-
};
|
|
958
|
-
return Xn(e, t, {
|
|
959
|
-
...r,
|
|
960
|
-
platform: n
|
|
961
|
-
});
|
|
962
|
-
};
|
|
963
|
-
function ve(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
|
|
46
|
+
const i = s.parent.textBetween(0, s.parentOffset, void 0, ""), n = i.lastIndexOf(t);
|
|
971
47
|
if (n === -1)
|
|
972
48
|
return null;
|
|
973
|
-
const
|
|
974
|
-
if (!o &&
|
|
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 插件 */
|
|
@@ -1014,7 +90,7 @@ const be = {
|
|
|
1014
90
|
TEMPLATE_BLOCK_KEYBOARD: "templateBlockKeyboard",
|
|
1015
91
|
/** Template Block 粘贴处理插件 */
|
|
1016
92
|
TEMPLATE_BLOCK_PASTE: "templateBlockPaste"
|
|
1017
|
-
},
|
|
93
|
+
}, G = {
|
|
1018
94
|
/** 文本类型 */
|
|
1019
95
|
TEXT: "text",
|
|
1020
96
|
/** 模板块类型(对应内部的 TemplateBlock 节点) */
|
|
@@ -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
|
-
},
|
|
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 o = e, s =
|
|
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 n({ event:
|
|
1068
|
-
return
|
|
143
|
+
function n({ event: u }) {
|
|
144
|
+
return I(u, "ARROW_UP") ? (s.value = Math.max(0, s.value - 1), a(), !0) : I(u, "ARROW_DOWN") ? (s.value = Math.min(o.items.length - 1, s.value + 1), a(), !0) : ie(u, ["ENTER", "TAB"]) ? (r(s.value), !0) : !1;
|
|
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
168
|
onKeyDown: n
|
|
1093
|
-
}), (
|
|
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
193
|
const o = t.toLowerCase();
|
|
1118
194
|
return e.filter((s) => {
|
|
1119
|
-
var
|
|
1120
|
-
return !!(s.label.toLowerCase().includes(o) || (
|
|
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: o, items: s, allowSpaces:
|
|
1125
|
-
let n = null,
|
|
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 Mo(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 (
|
|
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 (
|
|
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 (
|
|
287
|
+
update(l) {
|
|
288
|
+
const u = te.getState(l.state);
|
|
289
|
+
if (u != null && u.active && u.filteredItems.length > 0) {
|
|
1214
290
|
n ? n.updateProps({
|
|
1215
|
-
items:
|
|
1216
|
-
}) : (n = new
|
|
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
|
-
n && (
|
|
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: o.id ||
|
|
330
|
+
const { state: s, dispatch: i } = e, { tr: n } = s, a = s.schema.nodes.mention.create({
|
|
331
|
+
id: o.id || re("mention"),
|
|
1256
332
|
label: o.label,
|
|
1257
333
|
value: o.value || ""
|
|
1258
|
-
}),
|
|
1259
|
-
n.delete(t.from, t.to), n.insert(t.from, [
|
|
1260
|
-
const
|
|
1261
|
-
n.setSelection(
|
|
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);
|
|
1262
338
|
}
|
|
1263
|
-
const
|
|
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
|
}
|
|
@@ -1277,13 +353,13 @@ const Ro = {
|
|
|
1277
353
|
*/
|
|
1278
354
|
deleteMention: (e) => ({ tr: t, state: o }) => {
|
|
1279
355
|
let s = !1;
|
|
1280
|
-
return o.doc.descendants((
|
|
1281
|
-
if (
|
|
1282
|
-
return t.delete(n, n +
|
|
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 Ro = {
|
|
|
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 Ro = {
|
|
|
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 Ro = {
|
|
|
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 Ro = {
|
|
|
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,33 +458,33 @@ const Ro = {
|
|
|
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((n) => n.name ===
|
|
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
468
|
return e.state.doc.descendants((n) => {
|
|
1393
|
-
n.type.name ===
|
|
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((o, s,
|
|
1399
|
-
if (
|
|
1400
|
-
if (o.type.name ===
|
|
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
|
-
type:
|
|
478
|
+
type: G.MENTION,
|
|
1403
479
|
content: o.attrs.label,
|
|
1404
480
|
value: o.attrs.value || ""
|
|
1405
481
|
});
|
|
1406
|
-
else if (o.type.name ===
|
|
482
|
+
else if (o.type.name === T.TEXT) {
|
|
1407
483
|
const n = o.text || "";
|
|
1408
484
|
if (n) {
|
|
1409
|
-
const
|
|
1410
|
-
|
|
1411
|
-
type:
|
|
485
|
+
const a = t[t.length - 1];
|
|
486
|
+
a && a.type === G.TEXT ? a.content = (a.content || "") + n : t.push({
|
|
487
|
+
type: G.TEXT,
|
|
1412
488
|
content: n
|
|
1413
489
|
});
|
|
1414
490
|
}
|
|
@@ -1416,59 +492,59 @@ function Oo(e) {
|
|
|
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
505
|
const o = [];
|
|
1430
|
-
for (const
|
|
1431
|
-
if (!
|
|
1432
|
-
let
|
|
1433
|
-
const
|
|
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 (
|
|
511
|
+
const p = l.indexOf(u, r);
|
|
512
|
+
if (p === -1) break;
|
|
1437
513
|
o.push({
|
|
1438
|
-
start:
|
|
1439
|
-
end:
|
|
1440
|
-
}),
|
|
514
|
+
start: p,
|
|
515
|
+
end: p + a.length
|
|
516
|
+
}), r = p + 1;
|
|
1441
517
|
}
|
|
1442
518
|
}
|
|
1443
519
|
if (o.length === 0)
|
|
1444
520
|
return [{ text: e, isMatch: !1 }];
|
|
1445
|
-
o.sort((
|
|
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
|
|
530
|
+
const i = [];
|
|
1455
531
|
let n = 0;
|
|
1456
|
-
for (const
|
|
1457
|
-
n <
|
|
1458
|
-
text: e.substring(n,
|
|
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
|
-
}), n =
|
|
1464
|
-
return n < e.length &&
|
|
539
|
+
}), n = a.end;
|
|
540
|
+
return n < e.length && i.push({
|
|
1465
541
|
text: e.substring(n),
|
|
1466
542
|
isMatch: !1
|
|
1467
|
-
}),
|
|
1468
|
-
},
|
|
543
|
+
}), i;
|
|
544
|
+
}, Vt = (e, t) => !t || !e ? [{ text: e, isMatch: !1 }] : Ve(e, [t]), Gt = (e, t) => {
|
|
1469
545
|
const { content: o, highlights: s } = e;
|
|
1470
|
-
return typeof s == "function" ? s(o, t) : Array.isArray(s) ?
|
|
1471
|
-
},
|
|
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, o =
|
|
1486
|
-
var
|
|
1487
|
-
(
|
|
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);
|
|
1488
564
|
}, n = () => {
|
|
1489
|
-
var
|
|
1490
|
-
(
|
|
1491
|
-
},
|
|
1492
|
-
var
|
|
1493
|
-
const
|
|
1494
|
-
|
|
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
585
|
ref: o,
|
|
1510
586
|
class: "suggestion-list",
|
|
1511
|
-
style:
|
|
587
|
+
style: rt(t.popupStyle)
|
|
1512
588
|
}, [
|
|
1513
|
-
(
|
|
1514
|
-
key:
|
|
1515
|
-
class:
|
|
1516
|
-
onMouseenter: (
|
|
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),
|
|
1517
593
|
onMouseleave: n,
|
|
1518
|
-
onClick: (
|
|
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
615
|
const o = e.toLowerCase(), s = t.toLowerCase();
|
|
1540
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:
|
|
620
|
+
text: i,
|
|
1545
621
|
show: n,
|
|
1546
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
628
|
activeSuggestionKeys: o = ["Enter"],
|
|
1553
629
|
popupWidth: s = 400,
|
|
1554
|
-
showAutoComplete:
|
|
630
|
+
showAutoComplete: i = !0,
|
|
1555
631
|
filterFn: n,
|
|
1556
|
-
onSelect:
|
|
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 n ? n(
|
|
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 (
|
|
1630
|
-
const
|
|
1631
|
-
|
|
702
|
+
const m = document.createElement("span");
|
|
703
|
+
m.className = "suggestion-autocomplete", m.contentEditable = "false";
|
|
704
|
+
const k = document.createElement("span");
|
|
705
|
+
if (k.className = "autocomplete-text", k.textContent = d.autoCompleteText, m.appendChild(k), d.showTabIndicator) {
|
|
706
|
+
const $ = document.createElement("span");
|
|
707
|
+
$.className = "tab-hint", $.textContent = "TAB", m.appendChild($);
|
|
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 qo(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 qo(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
|
-
...
|
|
1675
|
-
autoCompleteText:
|
|
1676
|
-
showTabIndicator:
|
|
750
|
+
...k,
|
|
751
|
+
autoCompleteText: $.text,
|
|
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 qo(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 qo(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 qo(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 (
|
|
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 (o.includes(
|
|
1746
|
-
return
|
|
1747
|
-
if (
|
|
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 = Bt.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,26 +903,26 @@ const Xt = Bt.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
921
|
return e.state.doc.descendants((o, s) => {
|
|
1846
|
-
o.type.name ===
|
|
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
|
*/
|
|
@@ -1854,32 +930,32 @@ const Fo = {
|
|
|
1854
930
|
t.clearContent();
|
|
1855
931
|
const o = [];
|
|
1856
932
|
return e.forEach((s) => {
|
|
1857
|
-
s.type ===
|
|
1858
|
-
type:
|
|
933
|
+
s.type === G.TEXT ? s.content && o.push({
|
|
934
|
+
type: T.TEXT,
|
|
1859
935
|
text: s.content
|
|
1860
|
-
}) : s.type ===
|
|
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 ===
|
|
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
957
|
}), o.length > 0 && t.insertContent({
|
|
1882
|
-
type:
|
|
958
|
+
type: T.PARAGRAPH,
|
|
1883
959
|
content: o
|
|
1884
960
|
}), !0;
|
|
1885
961
|
},
|
|
@@ -1889,14 +965,14 @@ const Fo = {
|
|
|
1889
965
|
insertTemplate: (e) => ({ commands: t }) => {
|
|
1890
966
|
const o = e.content || "";
|
|
1891
967
|
return t.insertContent({
|
|
1892
|
-
type:
|
|
968
|
+
type: T.TEMPLATE_BLOCK,
|
|
1893
969
|
attrs: {
|
|
1894
|
-
id: e.id ||
|
|
970
|
+
id: e.id || re("template"),
|
|
1895
971
|
content: o
|
|
1896
972
|
},
|
|
1897
973
|
content: o ? [
|
|
1898
974
|
{
|
|
1899
|
-
type:
|
|
975
|
+
type: T.TEXT,
|
|
1900
976
|
text: o
|
|
1901
977
|
}
|
|
1902
978
|
] : []
|
|
@@ -1906,22 +982,22 @@ const Fo = {
|
|
|
1906
982
|
* 聚焦到第一个模板块
|
|
1907
983
|
*/
|
|
1908
984
|
focusFirstTemplate: () => ({ editor: e }) => {
|
|
1909
|
-
const t =
|
|
985
|
+
const t = tn(e);
|
|
1910
986
|
return setTimeout(() => {
|
|
1911
987
|
var n;
|
|
1912
|
-
const { state: o, view: s } = e,
|
|
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,40 +1005,40 @@ const Fo = {
|
|
|
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((o, s,
|
|
1947
|
-
if (
|
|
1948
|
-
if (o.type.name ===
|
|
1949
|
-
const n = (o.textContent || "").replace(new RegExp(
|
|
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
|
-
type:
|
|
1027
|
+
type: G.BLOCK,
|
|
1952
1028
|
content: n
|
|
1953
1029
|
});
|
|
1954
|
-
} else if (o.type.name ===
|
|
1955
|
-
const n = o.attrs.options.find((
|
|
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
|
-
type:
|
|
1958
|
-
content:
|
|
1033
|
+
type: G.SELECT,
|
|
1034
|
+
content: a
|
|
1959
1035
|
});
|
|
1960
|
-
} else if (o.type.name ===
|
|
1961
|
-
const n = (o.text || "").replace(new RegExp(
|
|
1036
|
+
} else if (o.type.name === T.TEXT) {
|
|
1037
|
+
const n = (o.text || "").replace(new RegExp(y, "g"), "");
|
|
1962
1038
|
if (n) {
|
|
1963
|
-
const
|
|
1964
|
-
|
|
1965
|
-
type:
|
|
1039
|
+
const a = t[t.length - 1];
|
|
1040
|
+
a && a.type === G.TEXT ? a.content += n : t.push({
|
|
1041
|
+
type: G.TEXT,
|
|
1966
1042
|
content: n
|
|
1967
1043
|
});
|
|
1968
1044
|
}
|
|
@@ -1970,31 +1046,31 @@ function Yt(e) {
|
|
|
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, o =
|
|
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 Vo = /* @__PURE__ */ V({
|
|
|
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
1084
|
let { tr: o } = e;
|
|
2009
|
-
return e.doc.descendants((s,
|
|
2010
|
-
if (s.type.name ===
|
|
2011
|
-
const { lastChild:
|
|
2012
|
-
if (
|
|
2013
|
-
const
|
|
2014
|
-
o.doc.textBetween(
|
|
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 (n.forEach((
|
|
2021
|
-
|
|
2022
|
-
}),
|
|
2023
|
-
const
|
|
2024
|
-
o.doc.textBetween(
|
|
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,
|
|
1103
|
+
}), t.length > 0 ? (t.sort((s, i) => {
|
|
2028
1104
|
const n = Array.isArray(s) ? s[1] : s;
|
|
2029
|
-
return (Array.isArray(
|
|
1105
|
+
return (Array.isArray(i) ? i[1] : i) - n;
|
|
2030
1106
|
}).forEach((s) => {
|
|
2031
|
-
Array.isArray(s) && s[0] === "remove" ? o = o.delete(s[1], s[1] + 1) : typeof s == "number" && (o = o.insertText(
|
|
1107
|
+
Array.isArray(s) && s[0] === "remove" ? o = o.delete(s[1], s[1] + 1) : typeof s == "number" && (o = o.insertText(y, s, s));
|
|
2032
1108
|
}), o) : null;
|
|
2033
1109
|
}
|
|
2034
|
-
function
|
|
2035
|
-
return new
|
|
2036
|
-
key: new
|
|
1110
|
+
function an() {
|
|
1111
|
+
return new Q({
|
|
1112
|
+
key: new J(ee.TEMPLATE_BLOCK_ZERO_WIDTH),
|
|
2037
1113
|
appendTransaction(e, t, o) {
|
|
2038
|
-
return e.some((
|
|
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: o, dispatch: s } = e, { selection:
|
|
2049
|
-
if (
|
|
2050
|
-
const
|
|
2051
|
-
if (
|
|
2052
|
-
if (
|
|
2053
|
-
const
|
|
2054
|
-
return s(o.tr.setSelection(
|
|
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(o.tr.setSelection(
|
|
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 (
|
|
2063
|
-
const
|
|
2064
|
-
if (
|
|
2065
|
-
if (
|
|
2066
|
-
const
|
|
2067
|
-
return s(o.tr.setSelection(
|
|
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(o.tr.setSelection(
|
|
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(o.tr.setSelection(
|
|
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 (
|
|
2085
|
-
const
|
|
2086
|
-
return s(o.tr.setSelection(
|
|
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 (
|
|
2089
|
-
const
|
|
2090
|
-
return s(o.tr.setSelection(
|
|
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 (
|
|
2095
|
-
const
|
|
2096
|
-
if (
|
|
2097
|
-
const
|
|
2098
|
-
if (n.pos === n.end() &&
|
|
2099
|
-
const
|
|
2100
|
-
return s(o.tr.insertText(
|
|
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 (n.pos === n.start() &&
|
|
2111
|
-
const
|
|
2112
|
-
return s(o.tr.setSelection(
|
|
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(o.tr.setSelection(
|
|
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(o.tr.setSelection(
|
|
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(o.tr.delete(
|
|
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 (
|
|
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 (
|
|
2170
|
-
const
|
|
2171
|
-
if (
|
|
2172
|
-
const
|
|
2173
|
-
if (n.pos === n.start() &&
|
|
2174
|
-
const
|
|
2175
|
-
return s(o.tr.insertText(
|
|
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 (n.pos === n.end() &&
|
|
2186
|
-
const
|
|
2187
|
-
return s(o.tr.setSelection(
|
|
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(o.tr.delete(
|
|
1281
|
+
return s(o.tr.delete(x, v)), t.preventDefault(), !0;
|
|
2206
1282
|
} else {
|
|
2207
|
-
const
|
|
2208
|
-
return s(o.tr.setSelection(
|
|
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(o.tr.setSelection(
|
|
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 (
|
|
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 Yo() {
|
|
|
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 n,
|
|
2249
|
-
const o = ((n = t.clipboardData) == null ? void 0 : n.types) || [], s = (
|
|
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");
|
|
2250
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 Jo = 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 }
|
|
@@ -2329,7 +1405,7 @@ const Jo = ct.create({
|
|
|
2329
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
1411
|
"data-content": o
|
|
@@ -2339,18 +1415,18 @@ const Jo = ct.create({
|
|
|
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,7 +1435,7 @@ function Qo() {
|
|
|
2359
1435
|
};
|
|
2360
1436
|
},
|
|
2361
1437
|
apply(e, t) {
|
|
2362
|
-
const o = e.getMeta(
|
|
1438
|
+
const o = e.getMeta(ae);
|
|
2363
1439
|
if (o) {
|
|
2364
1440
|
if (o.type === "open")
|
|
2365
1441
|
return {
|
|
@@ -2377,70 +1453,70 @@ function Qo() {
|
|
|
2377
1453
|
}
|
|
2378
1454
|
});
|
|
2379
1455
|
}
|
|
2380
|
-
function
|
|
2381
|
-
return new
|
|
2382
|
-
key: new
|
|
1456
|
+
function fn() {
|
|
1457
|
+
return new Q({
|
|
1458
|
+
key: new J(ee.TEMPLATE_SELECT_ZERO_WIDTH),
|
|
2383
1459
|
appendTransaction(e, t, o) {
|
|
2384
|
-
if (!e.some((
|
|
2385
|
-
const
|
|
1460
|
+
if (!e.some((a) => a.docChanged)) return null;
|
|
1461
|
+
const i = [];
|
|
2386
1462
|
let { tr: n } = o;
|
|
2387
|
-
return o.doc.descendants((
|
|
2388
|
-
if (
|
|
2389
|
-
const { lastChild:
|
|
2390
|
-
|
|
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
|
-
n = n.delete(
|
|
1468
|
+
}), i.length > 0 ? (i.forEach(([, a]) => {
|
|
1469
|
+
n = n.delete(a, a + 1);
|
|
2394
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: o, dispatch: s } = e, { selection:
|
|
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 (
|
|
2407
|
-
const
|
|
2408
|
-
if ((
|
|
2409
|
-
return s(o.tr.delete(n.pos -
|
|
2410
|
-
if (
|
|
2411
|
-
const
|
|
2412
|
-
if ((
|
|
2413
|
-
const
|
|
2414
|
-
return s(o.tr.delete(
|
|
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 (
|
|
1493
|
+
if ((l == null ? void 0 : l.type.name) === T.TEMPLATE_SELECT) {
|
|
1494
|
+
if (r != null && r.isText && r.text !== y)
|
|
2419
1495
|
return s(o.tr.delete(n.pos - 1, n.pos)), t.preventDefault(), !0;
|
|
2420
|
-
if ((
|
|
1496
|
+
if ((r == null ? void 0 : r.type.name) === T.TEMPLATE_BLOCK)
|
|
2421
1497
|
return !1;
|
|
2422
1498
|
}
|
|
2423
|
-
if (!
|
|
1499
|
+
if (!l && (r != null && r.isText) && r.text !== y)
|
|
2424
1500
|
return s(o.tr.delete(n.pos - 1, n.pos)), t.preventDefault(), !0;
|
|
2425
1501
|
}
|
|
2426
|
-
if (
|
|
2427
|
-
const
|
|
2428
|
-
if ((
|
|
2429
|
-
return s(o.tr.delete(n.pos, n.pos +
|
|
2430
|
-
if (
|
|
2431
|
-
const
|
|
2432
|
-
if ((
|
|
2433
|
-
const
|
|
2434
|
-
return s(o.tr.delete(n.pos,
|
|
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 (
|
|
1513
|
+
if ((l == null ? void 0 : l.type.name) === T.TEMPLATE_SELECT) {
|
|
1514
|
+
if (r != null && r.isText && r.text !== y)
|
|
2439
1515
|
return s(o.tr.delete(n.pos, n.pos + 1)), t.preventDefault(), !0;
|
|
2440
|
-
if ((
|
|
1516
|
+
if ((r == null ? void 0 : r.type.name) === T.TEMPLATE_BLOCK)
|
|
2441
1517
|
return !1;
|
|
2442
1518
|
}
|
|
2443
|
-
if (!
|
|
1519
|
+
if (!l && (r != null && r.isText) && r.text !== y)
|
|
2444
1520
|
return s(o.tr.delete(n.pos, n.pos + 1)), t.preventDefault(), !0;
|
|
2445
1521
|
}
|
|
2446
1522
|
return !1;
|
|
@@ -2448,9 +1524,9 @@ function ts() {
|
|
|
2448
1524
|
}
|
|
2449
1525
|
});
|
|
2450
1526
|
}
|
|
2451
|
-
function
|
|
2452
|
-
const s = (
|
|
2453
|
-
const n =
|
|
1527
|
+
function mn(e, t, o) {
|
|
1528
|
+
const s = (i) => {
|
|
1529
|
+
const n = i.target;
|
|
2454
1530
|
!e.contains(n) && !t.contains(n) && (o(), document.removeEventListener("click", s));
|
|
2455
1531
|
};
|
|
2456
1532
|
return setTimeout(() => {
|
|
@@ -2459,148 +1535,147 @@ function ns(e, t, o) {
|
|
|
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
1543
|
editor: {},
|
|
2468
|
-
|
|
1544
|
+
extension: {}
|
|
2469
1545
|
},
|
|
2470
1546
|
setup(e) {
|
|
2471
|
-
const t = e, o =
|
|
2472
|
-
let a = null,
|
|
2473
|
-
const
|
|
2474
|
-
|
|
2475
|
-
return
|
|
2476
|
-
}),
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
1547
|
+
const t = e, o = W(!1), s = W(-1), i = W(), n = W();
|
|
1548
|
+
let a = null, r = null;
|
|
1549
|
+
const l = Mt(i, t.extension.options.appendTo, { fallback: "body" }), u = M(() => {
|
|
1550
|
+
const x = l.value;
|
|
1551
|
+
return x instanceof HTMLElement && x !== document.body;
|
|
1552
|
+
}), p = M(() => t.node.attrs.options.find((x) => x.value === t.node.attrs.value)), f = M(() => {
|
|
1553
|
+
var x;
|
|
1554
|
+
return ((x = p.value) == null ? void 0 : x.label) || t.node.attrs.placeholder;
|
|
1555
|
+
}), E = M(() => !t.node.attrs.value), S = () => {
|
|
1556
|
+
o.value ? L() : j();
|
|
1557
|
+
}, j = async () => {
|
|
1558
|
+
var x;
|
|
1559
|
+
if (o.value = !0, (x = t.editor) != null && x.view) {
|
|
1560
|
+
const v = t.editor.view, m = v.state.tr;
|
|
1561
|
+
m.setMeta(ae, {
|
|
2483
1562
|
type: "open",
|
|
2484
1563
|
selectId: t.node.attrs.id
|
|
2485
|
-
}),
|
|
1564
|
+
}), v.dispatch(m);
|
|
2486
1565
|
}
|
|
2487
|
-
t.node.attrs.value ?
|
|
2488
|
-
},
|
|
2489
|
-
var
|
|
2490
|
-
if (
|
|
2491
|
-
const
|
|
2492
|
-
|
|
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 () => {
|
|
1568
|
+
var x;
|
|
1569
|
+
if (o.value = !1, s.value = -1, (x = t.editor) != null && x.view) {
|
|
1570
|
+
const v = t.editor.view, m = v.state.tr;
|
|
1571
|
+
m.setMeta(ae, {
|
|
2493
1572
|
type: "close"
|
|
2494
|
-
}),
|
|
1573
|
+
}), v.dispatch(m);
|
|
2495
1574
|
}
|
|
2496
|
-
a && (a(), a = null),
|
|
2497
|
-
},
|
|
2498
|
-
t.updateAttributes({ value:
|
|
2499
|
-
},
|
|
2500
|
-
!
|
|
2501
|
-
!
|
|
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, {
|
|
2502
1581
|
placement: "bottom-start",
|
|
2503
|
-
|
|
1582
|
+
// 自定义挂载目标使用 absolute 定位
|
|
1583
|
+
strategy: u.value ? "absolute" : "fixed",
|
|
2504
1584
|
// 使用 fixed 定位策略,相对于视口
|
|
2505
|
-
middleware: [
|
|
2506
|
-
}).then(({ x
|
|
2507
|
-
|
|
2508
|
-
left: `${
|
|
2509
|
-
top: `${
|
|
1585
|
+
middleware: [Ae(4), we(), ke({ padding: 8 })]
|
|
1586
|
+
}).then(({ x, y: v }) => {
|
|
1587
|
+
n.value && Object.assign(n.value.style, {
|
|
1588
|
+
left: `${x}px`,
|
|
1589
|
+
top: `${v}px`
|
|
2510
1590
|
});
|
|
2511
1591
|
});
|
|
2512
1592
|
}));
|
|
2513
|
-
},
|
|
2514
|
-
if (
|
|
2515
|
-
switch (
|
|
1593
|
+
}, g = (x) => {
|
|
1594
|
+
if (o.value)
|
|
1595
|
+
switch (x.key) {
|
|
2516
1596
|
case "ArrowUp":
|
|
2517
|
-
|
|
1597
|
+
x.preventDefault(), d();
|
|
2518
1598
|
break;
|
|
2519
1599
|
case "ArrowDown":
|
|
2520
|
-
|
|
1600
|
+
x.preventDefault(), c();
|
|
2521
1601
|
break;
|
|
2522
1602
|
case "Enter":
|
|
2523
|
-
|
|
1603
|
+
x.preventDefault(), _();
|
|
2524
1604
|
break;
|
|
2525
1605
|
case "Escape":
|
|
2526
|
-
|
|
1606
|
+
x.preventDefault(), L();
|
|
2527
1607
|
break;
|
|
2528
1608
|
}
|
|
2529
|
-
},
|
|
2530
|
-
|
|
2531
|
-
},
|
|
2532
|
-
|
|
2533
|
-
},
|
|
2534
|
-
|
|
2535
|
-
if (!
|
|
2536
|
-
const
|
|
2537
|
-
|
|
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");
|
|
1617
|
+
x && x.scrollIntoView({
|
|
2538
1618
|
block: "nearest",
|
|
2539
1619
|
behavior: "smooth"
|
|
2540
1620
|
});
|
|
2541
1621
|
});
|
|
2542
|
-
},
|
|
2543
|
-
|
|
1622
|
+
}, _ = () => {
|
|
1623
|
+
s.value >= 0 && s.value < t.node.attrs.options.length ? C(t.node.attrs.options[s.value]) : L();
|
|
2544
1624
|
};
|
|
2545
|
-
return
|
|
2546
|
-
document.addEventListener("keydown",
|
|
2547
|
-
}),
|
|
2548
|
-
document.removeEventListener("keydown",
|
|
2549
|
-
}), (
|
|
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), {
|
|
2550
1630
|
as: "span",
|
|
2551
1631
|
class: "template-select"
|
|
2552
1632
|
}, {
|
|
2553
|
-
default:
|
|
2554
|
-
|
|
1633
|
+
default: B(() => [
|
|
1634
|
+
v[0] || (v[0] = R("span", {
|
|
2555
1635
|
contenteditable: "false",
|
|
2556
1636
|
class: "template-select__prefix"
|
|
2557
1637
|
}, "", -1)),
|
|
2558
|
-
|
|
1638
|
+
R("span", {
|
|
2559
1639
|
ref_key: "triggerRef",
|
|
2560
|
-
ref:
|
|
2561
|
-
class:
|
|
2562
|
-
onMousedown:
|
|
1640
|
+
ref: i,
|
|
1641
|
+
class: V(["template-select__trigger", { "is-open": o.value }]),
|
|
1642
|
+
onMousedown: ye(S, ["prevent"])
|
|
2563
1643
|
}, [
|
|
2564
|
-
|
|
2565
|
-
class:
|
|
2566
|
-
},
|
|
2567
|
-
|
|
2568
|
-
|
|
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))
|
|
2569
1649
|
])
|
|
2570
1650
|
], 34),
|
|
2571
|
-
|
|
1651
|
+
v[1] || (v[1] = R("span", {
|
|
2572
1652
|
contenteditable: "false",
|
|
2573
1653
|
class: "template-select__suffix"
|
|
2574
1654
|
}, "", -1)),
|
|
2575
|
-
(
|
|
2576
|
-
|
|
1655
|
+
(w(), U(ct, { to: A(l) }, [
|
|
1656
|
+
o.value ? (w(), P("div", {
|
|
2577
1657
|
key: 0,
|
|
2578
1658
|
ref_key: "dropdownRef",
|
|
2579
|
-
ref:
|
|
2580
|
-
class:
|
|
1659
|
+
ref: n,
|
|
1660
|
+
class: V(["template-select__dropdown", { "is-absolute": u.value }])
|
|
2581
1661
|
}, [
|
|
2582
|
-
(
|
|
2583
|
-
key:
|
|
2584
|
-
class:
|
|
2585
|
-
"is-highlighted":
|
|
2586
|
-
"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
|
|
2587
1667
|
}]),
|
|
2588
|
-
onMousedown:
|
|
2589
|
-
onMouseenter: (
|
|
2590
|
-
},
|
|
2591
|
-
], 2)) :
|
|
1668
|
+
onMousedown: ye(($) => C(m), ["prevent"]),
|
|
1669
|
+
onMouseenter: ($) => s.value = k
|
|
1670
|
+
}, ne(m.label), 43, gn))), 128))
|
|
1671
|
+
], 2)) : N("", !0)
|
|
2592
1672
|
], 8, ["to"]))
|
|
2593
1673
|
]),
|
|
2594
1674
|
_: 1
|
|
2595
1675
|
}));
|
|
2596
1676
|
}
|
|
2597
|
-
}),
|
|
2598
|
-
name:
|
|
2599
|
-
addOptions() {
|
|
2600
|
-
return {
|
|
2601
|
-
appendTo: void 0
|
|
2602
|
-
};
|
|
2603
|
-
},
|
|
1677
|
+
}), bn = /* @__PURE__ */ Z(xn, [["__scopeId", "data-v-5bcba48f"]]), yn = Le.create({
|
|
1678
|
+
name: T.TEMPLATE_SELECT,
|
|
2604
1679
|
// 节点配置
|
|
2605
1680
|
group: "inline",
|
|
2606
1681
|
inline: !0,
|
|
@@ -2660,19 +1735,19 @@ const os = { class: "template-select__icon" }, ss = ["onMousedown", "onMouseente
|
|
|
2660
1735
|
const o = e.attrs.options.find(
|
|
2661
1736
|
(n) => n.value === e.attrs.value
|
|
2662
1737
|
), s = (o == null ? void 0 : o.label) || e.attrs.placeholder;
|
|
2663
|
-
let
|
|
1738
|
+
let i = "[]";
|
|
2664
1739
|
try {
|
|
2665
|
-
|
|
1740
|
+
i = JSON.stringify(e.attrs.options);
|
|
2666
1741
|
} catch (n) {
|
|
2667
1742
|
console.error("Failed to stringify template select options in renderHTML:", n);
|
|
2668
1743
|
}
|
|
2669
1744
|
return [
|
|
2670
1745
|
"span",
|
|
2671
|
-
|
|
1746
|
+
Me(t, {
|
|
2672
1747
|
"data-template-select": "",
|
|
2673
1748
|
"data-id": e.attrs.id,
|
|
2674
1749
|
"data-placeholder": e.attrs.placeholder,
|
|
2675
|
-
"data-options":
|
|
1750
|
+
"data-options": i,
|
|
2676
1751
|
"data-value": e.attrs.value || ""
|
|
2677
1752
|
}),
|
|
2678
1753
|
s
|
|
@@ -2680,125 +1755,117 @@ const os = { class: "template-select__icon" }, ss = ["onMousedown", "onMouseente
|
|
|
2680
1755
|
},
|
|
2681
1756
|
// 使用 Vue 组件渲染
|
|
2682
1757
|
addNodeView() {
|
|
2683
|
-
|
|
2684
|
-
return at(
|
|
2685
|
-
V({
|
|
2686
|
-
name: "TemplateSelectNodeView",
|
|
2687
|
-
setup(t) {
|
|
2688
|
-
return () => mn(is, { ...t, appendTo: e });
|
|
2689
|
-
}
|
|
2690
|
-
})
|
|
2691
|
-
);
|
|
1758
|
+
return _e(bn);
|
|
2692
1759
|
},
|
|
2693
1760
|
// 添加插件
|
|
2694
1761
|
addProseMirrorPlugins() {
|
|
2695
|
-
return [
|
|
1762
|
+
return [dn(), fn(), pn()];
|
|
2696
1763
|
}
|
|
2697
|
-
}),
|
|
2698
|
-
name:
|
|
1764
|
+
}), Xe = We.create({
|
|
1765
|
+
name: se.TEMPLATE,
|
|
2699
1766
|
addExtensions() {
|
|
2700
|
-
return [
|
|
1767
|
+
return [un.configure(this.options), yn.configure(this.options)];
|
|
2701
1768
|
},
|
|
2702
1769
|
// 添加命令(统一命令入口)
|
|
2703
1770
|
addCommands() {
|
|
2704
|
-
return
|
|
1771
|
+
return nn;
|
|
2705
1772
|
}
|
|
2706
1773
|
});
|
|
2707
|
-
function
|
|
2708
|
-
return
|
|
1774
|
+
function Tn(e, t) {
|
|
1775
|
+
return Xe.configure({
|
|
2709
1776
|
items: e,
|
|
2710
1777
|
...t
|
|
2711
1778
|
});
|
|
2712
1779
|
}
|
|
2713
|
-
function
|
|
1780
|
+
function Ze(e, t = "") {
|
|
2714
1781
|
let o = (
|
|
2715
1782
|
/** @type {Array<CategorizedUnicodeRange<T>>} */
|
|
2716
1783
|
[]
|
|
2717
|
-
), s = e.split(",").map((n) => n ? parseInt(n, 36) : 0),
|
|
1784
|
+
), s = e.split(",").map((n) => n ? parseInt(n, 36) : 0), i = 0;
|
|
2718
1785
|
for (let n = 0; n < s.length; n++)
|
|
2719
1786
|
n % 2 ? o.push([
|
|
2720
|
-
|
|
2721
|
-
|
|
1787
|
+
i,
|
|
1788
|
+
i + s[n],
|
|
2722
1789
|
/** @type {T} */
|
|
2723
1790
|
t ? parseInt(t[n >> 1], 36) : 0
|
|
2724
|
-
]) :
|
|
1791
|
+
]) : i = s[n];
|
|
2725
1792
|
return o;
|
|
2726
1793
|
}
|
|
2727
|
-
function
|
|
1794
|
+
function Ye(e, t, o = 0, s = t.length - 1) {
|
|
2728
1795
|
for (; o <= s; ) {
|
|
2729
|
-
let
|
|
2730
|
-
if (e < n[0]) s =
|
|
2731
|
-
else if (e > n[1]) o =
|
|
2732
|
-
else return
|
|
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;
|
|
2733
1800
|
}
|
|
2734
1801
|
return -1;
|
|
2735
1802
|
}
|
|
2736
|
-
const
|
|
1803
|
+
const Te = Ze(
|
|
2737
1804
|
/** @type {UnicodeDataEncoding} */
|
|
2738
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",
|
|
2739
1806
|
"262122424333333393233393339333333333393393b3b3b3b3b333b33b3bb33333b3b3333333b3b33bb3333b33b3bb33333b3bbb333b333b33333b3b3b3b3333b3b33b3bb39333b33b33b3b3b333b333333b3b333333b33b3b3333b3335dc333333b3b3b33323333b3bb3b33b3b3b3333b3333b3b333bb3b33b3b3b3b3b333b333b3323e2244234444444444444444444444444444444444444444443333333333b3b3bb33333b353b3b3b3b333b3b333b333333b3bb3b3b3bb333232333333333333333b3b3333bb3b393933b3b33bb3b393b3b3b3333b33b33b3bbb33b333b3333bb3933b3b3b333b3b3b3b3b33b3b3b33b3b3b33b3b33b33b3b3b33bb39b9b3b33b3b33b9333b393b3b33b33b3b3b3333393b3b3b33b39bb3b332333b333dd3b33332333323333333333333333333333344444444a44444434444444444444423232"
|
|
2740
|
-
),
|
|
1807
|
+
), vn = Ze(
|
|
2741
1808
|
/** @type {UnicodeDataEncoding} */
|
|
2742
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"
|
|
2743
|
-
),
|
|
2744
|
-
function*
|
|
1810
|
+
), Re = 65535;
|
|
1811
|
+
function* En(e) {
|
|
2745
1812
|
let t = e.codePointAt(0);
|
|
2746
1813
|
if (t == null) return;
|
|
2747
|
-
let o = t <=
|
|
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;
|
|
2748
1815
|
for (; o < s; ) {
|
|
2749
1816
|
t = /** @type {number} */
|
|
2750
|
-
e.codePointAt(o), n =
|
|
2751
|
-
let
|
|
2752
|
-
|
|
2753
|
-
segment: e.slice(
|
|
2754
|
-
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,
|
|
2755
1822
|
input: e,
|
|
2756
|
-
_hd:
|
|
2757
|
-
_catBegin:
|
|
2758
|
-
_catEnd:
|
|
2759
|
-
},
|
|
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;
|
|
2760
1827
|
}
|
|
2761
|
-
|
|
2762
|
-
segment: e.slice(
|
|
2763
|
-
index:
|
|
1828
|
+
p < s && (yield {
|
|
1829
|
+
segment: e.slice(p),
|
|
1830
|
+
index: p,
|
|
2764
1831
|
input: e,
|
|
2765
|
-
_hd:
|
|
2766
|
-
_catBegin:
|
|
2767
|
-
_catEnd:
|
|
1832
|
+
_hd: E,
|
|
1833
|
+
_catBegin: f,
|
|
1834
|
+
_catEnd: i
|
|
2768
1835
|
});
|
|
2769
1836
|
}
|
|
2770
|
-
function
|
|
1837
|
+
function _n(e) {
|
|
2771
1838
|
let t = 0;
|
|
2772
|
-
for (let o of
|
|
1839
|
+
for (let o of En(e)) t += 1;
|
|
2773
1840
|
return t;
|
|
2774
1841
|
}
|
|
2775
|
-
const
|
|
1842
|
+
const Je = new Uint8Array(6080), he = 128, ve = 12287, Qe = new Uint8Array(1536), ge = 40960, et = 44031, Sn = (() => {
|
|
2776
1843
|
let e = 0;
|
|
2777
1844
|
for (; ; ) {
|
|
2778
|
-
let [t, o, s] =
|
|
2779
|
-
if (t >
|
|
2780
|
-
if (e++, !(o <
|
|
2781
|
-
for (let
|
|
2782
|
-
let n,
|
|
2783
|
-
|
|
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;
|
|
2784
1851
|
}
|
|
2785
1852
|
}
|
|
2786
1853
|
return e;
|
|
2787
1854
|
})();
|
|
2788
|
-
function
|
|
2789
|
-
if (e <
|
|
1855
|
+
function Be(e) {
|
|
1856
|
+
if (e < he)
|
|
2790
1857
|
return e >= 32 ? 0 : e === 10 ? 6 : e === 13 ? 1 : 2;
|
|
2791
|
-
if (e <=
|
|
2792
|
-
let o =
|
|
1858
|
+
if (e <= ve) {
|
|
1859
|
+
let o = Je[e - he >> 1];
|
|
2793
1860
|
return (
|
|
2794
1861
|
/** @type {GraphemeCategoryNum} */
|
|
2795
1862
|
e & 1 ? o >> 4 : o & 15
|
|
2796
1863
|
);
|
|
2797
1864
|
}
|
|
2798
|
-
if (e <
|
|
1865
|
+
if (e < ge)
|
|
2799
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;
|
|
2800
|
-
if (e <=
|
|
2801
|
-
let o =
|
|
1867
|
+
if (e <= et) {
|
|
1868
|
+
let o = Qe[e - ge >> 1];
|
|
2802
1869
|
return (
|
|
2803
1870
|
/** @type {GraphemeCategoryNum} */
|
|
2804
1871
|
e & 1 ? o >> 4 : o & 15
|
|
@@ -2810,44 +1877,44 @@ function Lt(e) {
|
|
|
2810
1877
|
return e <= 55238 ? e >= 55216 ? 13 : 0 : e >= 55243 ? 12 : 0;
|
|
2811
1878
|
if (e < 65024)
|
|
2812
1879
|
return e === 64286 ? 3 : 0;
|
|
2813
|
-
let t =
|
|
2814
|
-
return t < 0 ? 0 :
|
|
1880
|
+
let t = Ye(e, Te, Sn);
|
|
1881
|
+
return t < 0 ? 0 : Te[t][2];
|
|
2815
1882
|
}
|
|
2816
|
-
function
|
|
2817
|
-
return
|
|
1883
|
+
function je(e) {
|
|
1884
|
+
return Ye(e, vn) >= 0;
|
|
2818
1885
|
}
|
|
2819
|
-
const
|
|
2820
|
-
function
|
|
1886
|
+
const $e = typeof Intl < "u" && typeof Intl.Segmenter == "function" ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : null;
|
|
1887
|
+
function tt(e) {
|
|
2821
1888
|
if (!e) return 0;
|
|
2822
|
-
if (
|
|
1889
|
+
if ($e) {
|
|
2823
1890
|
let t = 0;
|
|
2824
|
-
for (const o of
|
|
1891
|
+
for (const o of $e.segment(e))
|
|
2825
1892
|
t++;
|
|
2826
1893
|
return t;
|
|
2827
1894
|
}
|
|
2828
|
-
return
|
|
1895
|
+
return _n(e);
|
|
2829
1896
|
}
|
|
2830
|
-
function
|
|
2831
|
-
const o =
|
|
2832
|
-
var
|
|
2833
|
-
const
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
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,
|
|
2838
1905
|
// 提供 undo/redo 功能
|
|
2839
|
-
|
|
1906
|
+
Et.configure({
|
|
2840
1907
|
placeholder: () => s.value || "请输入内容..."
|
|
2841
1908
|
}),
|
|
2842
|
-
|
|
1909
|
+
_t.configure({
|
|
2843
1910
|
mode: "textSize",
|
|
2844
|
-
textCounter:
|
|
1911
|
+
textCounter: tt
|
|
2845
1912
|
})
|
|
2846
1913
|
];
|
|
2847
|
-
return (
|
|
2848
|
-
}, n =
|
|
1914
|
+
return (r = e.extensions) != null && r.length && a.push(...e.extensions), a;
|
|
1915
|
+
}, n = gt({
|
|
2849
1916
|
content: e.modelValue ?? e.defaultValue ?? "",
|
|
2850
|
-
extensions:
|
|
1917
|
+
extensions: i(),
|
|
2851
1918
|
autofocus: e.autofocus ? "end" : !1,
|
|
2852
1919
|
editorProps: {
|
|
2853
1920
|
attributes: {
|
|
@@ -2855,315 +1922,315 @@ function ps(e, t) {
|
|
|
2855
1922
|
enterkeyhint: e.enterkeyhint
|
|
2856
1923
|
},
|
|
2857
1924
|
// 处理粘贴事件 - 只粘贴纯文本
|
|
2858
|
-
handlePaste(
|
|
2859
|
-
var
|
|
2860
|
-
const
|
|
2861
|
-
if (!
|
|
2862
|
-
const
|
|
2863
|
-
return
|
|
2864
|
-
var
|
|
2865
|
-
(
|
|
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();
|
|
2866
1933
|
}), !0;
|
|
2867
1934
|
}
|
|
2868
1935
|
},
|
|
2869
|
-
onUpdate: (
|
|
2870
|
-
const
|
|
2871
|
-
t("update:modelValue",
|
|
1936
|
+
onUpdate: (a) => {
|
|
1937
|
+
const r = a.editor.getText();
|
|
1938
|
+
t("update:modelValue", r), t("input", r);
|
|
2872
1939
|
},
|
|
2873
|
-
onFocus: (
|
|
2874
|
-
t("focus",
|
|
1940
|
+
onFocus: (a) => {
|
|
1941
|
+
t("focus", a.event);
|
|
2875
1942
|
},
|
|
2876
|
-
onBlur: (
|
|
2877
|
-
t("blur",
|
|
1943
|
+
onBlur: (a) => {
|
|
1944
|
+
t("blur", a.event);
|
|
2878
1945
|
}
|
|
2879
1946
|
});
|
|
2880
1947
|
return K(
|
|
2881
1948
|
() => e.modelValue,
|
|
2882
|
-
(
|
|
2883
|
-
n.value &&
|
|
1949
|
+
(a) => {
|
|
1950
|
+
n.value && a !== n.value.getText() && n.value.commands.setContent(a ?? "", { emitUpdate: !1 });
|
|
2884
1951
|
}
|
|
2885
1952
|
), K(
|
|
2886
1953
|
() => e.placeholder,
|
|
2887
1954
|
() => {
|
|
2888
1955
|
if (n.value) {
|
|
2889
|
-
const { state:
|
|
2890
|
-
n.value.view.dispatch(
|
|
1956
|
+
const { state: a } = n.value, r = a.tr;
|
|
1957
|
+
n.value.view.dispatch(r);
|
|
2891
1958
|
}
|
|
2892
1959
|
}
|
|
2893
1960
|
), K(
|
|
2894
1961
|
() => e.enterkeyhint,
|
|
2895
|
-
(
|
|
1962
|
+
(a) => {
|
|
2896
1963
|
if (n.value) {
|
|
2897
|
-
const
|
|
2898
|
-
|
|
1964
|
+
const r = n.value.view.dom;
|
|
1965
|
+
a ? r.setAttribute("enterkeyhint", a) : r.removeAttribute("enterkeyhint");
|
|
2899
1966
|
}
|
|
2900
1967
|
}
|
|
2901
|
-
),
|
|
2902
|
-
var
|
|
2903
|
-
(
|
|
1968
|
+
), ut(() => {
|
|
1969
|
+
var a;
|
|
1970
|
+
(a = n.value) == null || a.destroy();
|
|
2904
1971
|
}), {
|
|
2905
1972
|
editor: n,
|
|
2906
1973
|
editorRef: o
|
|
2907
1974
|
};
|
|
2908
1975
|
}
|
|
2909
|
-
function
|
|
1976
|
+
function An(e) {
|
|
2910
1977
|
const { submitType: t } = e;
|
|
2911
1978
|
return {
|
|
2912
|
-
checkSubmitShortcut: (
|
|
2913
|
-
if (!
|
|
1979
|
+
checkSubmitShortcut: (i) => {
|
|
1980
|
+
if (!I(i, "ENTER")) return !1;
|
|
2914
1981
|
switch (t.value) {
|
|
2915
1982
|
case "enter":
|
|
2916
|
-
return !
|
|
1983
|
+
return !i.shiftKey && !i.ctrlKey && !i.metaKey;
|
|
2917
1984
|
case "ctrlEnter":
|
|
2918
|
-
return (
|
|
1985
|
+
return (i.ctrlKey || i.metaKey) && !i.shiftKey;
|
|
2919
1986
|
case "shiftEnter":
|
|
2920
|
-
return
|
|
1987
|
+
return i.shiftKey && !i.ctrlKey && !i.metaKey;
|
|
2921
1988
|
default:
|
|
2922
1989
|
return !1;
|
|
2923
1990
|
}
|
|
2924
1991
|
},
|
|
2925
|
-
checkNewlineShortcut: (
|
|
2926
|
-
if (!
|
|
1992
|
+
checkNewlineShortcut: (i) => {
|
|
1993
|
+
if (!I(i, "ENTER")) return !1;
|
|
2927
1994
|
switch (t.value) {
|
|
2928
1995
|
case "enter":
|
|
2929
|
-
return
|
|
1996
|
+
return i.shiftKey || i.ctrlKey || i.metaKey;
|
|
2930
1997
|
case "ctrlEnter":
|
|
2931
1998
|
case "shiftEnter":
|
|
2932
|
-
return !
|
|
1999
|
+
return !i.shiftKey && !i.ctrlKey && !i.metaKey;
|
|
2933
2000
|
default:
|
|
2934
2001
|
return !1;
|
|
2935
2002
|
}
|
|
2936
2003
|
}
|
|
2937
2004
|
};
|
|
2938
2005
|
}
|
|
2939
|
-
function
|
|
2940
|
-
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(
|
|
2941
2008
|
() => {
|
|
2942
|
-
|
|
2009
|
+
i.value = !1;
|
|
2943
2010
|
},
|
|
2944
2011
|
300,
|
|
2945
2012
|
{ immediate: !1 }
|
|
2946
|
-
),
|
|
2947
|
-
var
|
|
2948
|
-
return (
|
|
2949
|
-
}),
|
|
2950
|
-
if (n.value !== "single" ||
|
|
2951
|
-
const
|
|
2952
|
-
if (!
|
|
2953
|
-
const
|
|
2954
|
-
s.value === "single" ?
|
|
2955
|
-
},
|
|
2956
|
-
s.value !==
|
|
2957
|
-
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();
|
|
2958
2025
|
}));
|
|
2959
2026
|
};
|
|
2960
|
-
return
|
|
2027
|
+
return Ct(l, () => {
|
|
2961
2028
|
requestAnimationFrame(() => {
|
|
2962
|
-
|
|
2029
|
+
u();
|
|
2963
2030
|
});
|
|
2964
2031
|
}), K(
|
|
2965
2032
|
() => e.mode,
|
|
2966
|
-
(
|
|
2967
|
-
|
|
2033
|
+
(f) => {
|
|
2034
|
+
f && f !== s.value && (n.value = f, p(f));
|
|
2968
2035
|
}
|
|
2969
2036
|
), {
|
|
2970
2037
|
currentMode: s,
|
|
2971
|
-
isAutoSwitching:
|
|
2972
|
-
setMode:
|
|
2973
|
-
checkOverflow:
|
|
2038
|
+
isAutoSwitching: i,
|
|
2039
|
+
setMode: p,
|
|
2040
|
+
checkOverflow: u
|
|
2974
2041
|
};
|
|
2975
2042
|
}
|
|
2976
|
-
function
|
|
2977
|
-
const s =
|
|
2978
|
-
const
|
|
2979
|
-
if (
|
|
2980
|
-
const
|
|
2981
|
-
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;
|
|
2982
2049
|
}
|
|
2983
2050
|
return 26;
|
|
2984
|
-
}), n =
|
|
2051
|
+
}), n = M(() => o === !1 || o === void 0 ? null : o === !0 ? {
|
|
2985
2052
|
minRows: 1,
|
|
2986
2053
|
maxRows: 5
|
|
2987
2054
|
} : typeof o == "object" ? {
|
|
2988
2055
|
minRows: o.minRows,
|
|
2989
2056
|
maxRows: o.maxRows
|
|
2990
|
-
} : null),
|
|
2057
|
+
} : null), a = () => {
|
|
2991
2058
|
if (!t.value) return;
|
|
2992
|
-
const
|
|
2993
|
-
if (!
|
|
2059
|
+
const r = t.value.querySelector(".tr-sender-editor-scroll");
|
|
2060
|
+
if (!r) {
|
|
2994
2061
|
console.warn("⚠️ 找不到滚动容器 .tr-sender-editor-scroll");
|
|
2995
2062
|
return;
|
|
2996
2063
|
}
|
|
2997
|
-
const
|
|
2998
|
-
if (e.value === "multiple" &&
|
|
2999
|
-
const
|
|
3000
|
-
|
|
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";
|
|
3001
2068
|
} else
|
|
3002
|
-
|
|
2069
|
+
r.style.minHeight = "", r.style.maxHeight = "", r.style.overflowY = e.value === "single" ? "hidden" : "auto";
|
|
3003
2070
|
};
|
|
3004
2071
|
return K(
|
|
3005
2072
|
e,
|
|
3006
2073
|
() => {
|
|
3007
|
-
|
|
3008
|
-
|
|
2074
|
+
oe(() => {
|
|
2075
|
+
a();
|
|
3009
2076
|
});
|
|
3010
2077
|
},
|
|
3011
2078
|
{ immediate: !0 }
|
|
3012
2079
|
), K(
|
|
3013
2080
|
n,
|
|
3014
2081
|
() => {
|
|
3015
|
-
|
|
3016
|
-
|
|
2082
|
+
oe(() => {
|
|
2083
|
+
a();
|
|
3017
2084
|
});
|
|
3018
2085
|
},
|
|
3019
2086
|
{ immediate: !0 }
|
|
3020
2087
|
), {
|
|
3021
|
-
updateHeight:
|
|
2088
|
+
updateHeight: a
|
|
3022
2089
|
};
|
|
3023
2090
|
}
|
|
3024
|
-
const
|
|
3025
|
-
const o =
|
|
3026
|
-
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))
|
|
3027
2094
|
return {
|
|
3028
2095
|
source: e,
|
|
3029
2096
|
payload: o
|
|
3030
2097
|
};
|
|
3031
2098
|
};
|
|
3032
|
-
function
|
|
3033
|
-
const e =
|
|
3034
|
-
const
|
|
2099
|
+
function Pn() {
|
|
2100
|
+
const e = dt(/* @__PURE__ */ new Map()), t = M(() => {
|
|
2101
|
+
const i = [];
|
|
3035
2102
|
for (const n of e.values()) {
|
|
3036
|
-
const
|
|
3037
|
-
|
|
2103
|
+
const a = Mn(n.source, n.payload);
|
|
2104
|
+
a && i.push(a);
|
|
3038
2105
|
}
|
|
3039
|
-
return
|
|
2106
|
+
return i;
|
|
3040
2107
|
});
|
|
3041
2108
|
return {
|
|
3042
|
-
hasRegisteredContent:
|
|
3043
|
-
registerContent: (
|
|
3044
|
-
const
|
|
3045
|
-
return e.set(
|
|
3046
|
-
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);
|
|
3047
2114
|
};
|
|
3048
2115
|
},
|
|
3049
2116
|
externalPayloads: t
|
|
3050
2117
|
};
|
|
3051
2118
|
}
|
|
3052
|
-
function
|
|
3053
|
-
const { editor: o, editorRef: s } =
|
|
3054
|
-
var
|
|
3055
|
-
return !e.disabled && !e.loading &&
|
|
3056
|
-
}),
|
|
3057
|
-
if (!
|
|
3058
|
-
let
|
|
3059
|
-
if (o.value.extensionManager.extensions.some((
|
|
3060
|
-
const
|
|
3061
|
-
|
|
3062
|
-
} else if (o.value.extensionManager.extensions.some((
|
|
3063
|
-
const
|
|
3064
|
-
|
|
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);
|
|
3065
2132
|
}
|
|
3066
|
-
|
|
3067
|
-
const
|
|
3068
|
-
if (
|
|
3069
|
-
t("submit",
|
|
2133
|
+
k || (k = o.value.getText());
|
|
2134
|
+
const $ = r.value.slice();
|
|
2135
|
+
if ($.length === 0) {
|
|
2136
|
+
t("submit", k, m);
|
|
3070
2137
|
return;
|
|
3071
2138
|
}
|
|
3072
|
-
t("submit",
|
|
3073
|
-
externalPayloads:
|
|
2139
|
+
t("submit", k, m, {
|
|
2140
|
+
externalPayloads: $
|
|
3074
2141
|
});
|
|
3075
|
-
}, { currentMode:
|
|
3076
|
-
submitType:
|
|
2142
|
+
}, { currentMode: S, isAutoSwitching: j, setMode: L, checkOverflow: C } = wn(e, o, s), h = An({
|
|
2143
|
+
submitType: M(() => e.submitType ?? "enter")
|
|
3077
2144
|
});
|
|
3078
2145
|
K(
|
|
3079
2146
|
o,
|
|
3080
|
-
(
|
|
3081
|
-
|
|
2147
|
+
(m) => {
|
|
2148
|
+
m && m.setOptions({
|
|
3082
2149
|
editorProps: {
|
|
3083
|
-
...
|
|
3084
|
-
handleKeyDown: (
|
|
3085
|
-
const
|
|
3086
|
-
return
|
|
3087
|
-
|
|
3088
|
-
}, 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;
|
|
3089
2156
|
}
|
|
3090
2157
|
}
|
|
3091
2158
|
});
|
|
3092
2159
|
},
|
|
3093
2160
|
{ immediate: !0 }
|
|
3094
|
-
),
|
|
2161
|
+
), kn(S, s, e.autoSize), K(
|
|
3095
2162
|
() => {
|
|
3096
|
-
var
|
|
3097
|
-
return (
|
|
2163
|
+
var m;
|
|
2164
|
+
return (m = o.value) == null ? void 0 : m.state.doc.content;
|
|
3098
2165
|
},
|
|
3099
2166
|
() => {
|
|
3100
2167
|
setTimeout(() => {
|
|
3101
|
-
|
|
2168
|
+
C();
|
|
3102
2169
|
}, 0);
|
|
3103
2170
|
},
|
|
3104
2171
|
{ deep: !0 }
|
|
3105
2172
|
);
|
|
3106
|
-
const
|
|
3107
|
-
var
|
|
3108
|
-
(
|
|
3109
|
-
},
|
|
3110
|
-
var
|
|
3111
|
-
(
|
|
3112
|
-
},
|
|
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 = () => {
|
|
3113
2180
|
t("cancel");
|
|
3114
|
-
},
|
|
3115
|
-
var
|
|
3116
|
-
(
|
|
3117
|
-
},
|
|
3118
|
-
var
|
|
3119
|
-
(
|
|
3120
|
-
},
|
|
3121
|
-
var
|
|
3122
|
-
return ((
|
|
3123
|
-
},
|
|
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);
|
|
2187
|
+
}, x = () => {
|
|
2188
|
+
var m;
|
|
2189
|
+
return ((m = o.value) == null ? void 0 : m.getText()) || "";
|
|
2190
|
+
}, v = {
|
|
3124
2191
|
editor: o,
|
|
3125
2192
|
editorRef: s,
|
|
3126
|
-
mode:
|
|
3127
|
-
isAutoSwitching:
|
|
3128
|
-
loading:
|
|
3129
|
-
disabled:
|
|
3130
|
-
hasContent:
|
|
3131
|
-
hasEditorContent:
|
|
3132
|
-
canSubmit:
|
|
3133
|
-
isOverLimit:
|
|
3134
|
-
characterCount:
|
|
3135
|
-
maxLength:
|
|
3136
|
-
size:
|
|
3137
|
-
showWordLimit:
|
|
3138
|
-
clearable:
|
|
3139
|
-
defaultActions:
|
|
3140
|
-
submitType:
|
|
3141
|
-
stopText:
|
|
3142
|
-
submit:
|
|
3143
|
-
clear:
|
|
3144
|
-
cancel:
|
|
3145
|
-
focus:
|
|
3146
|
-
blur:
|
|
3147
|
-
setContent:
|
|
3148
|
-
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
|
|
3149
2216
|
};
|
|
3150
|
-
return
|
|
3151
|
-
context:
|
|
2217
|
+
return pt(mt, v), Lt(a), {
|
|
2218
|
+
context: v,
|
|
3152
2219
|
expose: {
|
|
3153
|
-
submit:
|
|
3154
|
-
clear:
|
|
3155
|
-
cancel:
|
|
3156
|
-
focus:
|
|
3157
|
-
blur:
|
|
3158
|
-
setContent:
|
|
3159
|
-
getContent:
|
|
2220
|
+
submit: E,
|
|
2221
|
+
clear: d,
|
|
2222
|
+
cancel: c,
|
|
2223
|
+
focus: g,
|
|
2224
|
+
blur: b,
|
|
2225
|
+
setContent: _,
|
|
2226
|
+
getContent: x,
|
|
3160
2227
|
editor: o
|
|
3161
2228
|
}
|
|
3162
2229
|
};
|
|
3163
2230
|
}
|
|
3164
|
-
function
|
|
3165
|
-
const e =
|
|
3166
|
-
return
|
|
2231
|
+
function Pe() {
|
|
2232
|
+
const e = ue();
|
|
2233
|
+
return M(() => ({
|
|
3167
2234
|
// 编辑器实例
|
|
3168
2235
|
editor: e.editor.value,
|
|
3169
2236
|
// 基础操作
|
|
@@ -3190,58 +2257,58 @@ function bt() {
|
|
|
3190
2257
|
hasContent: e.hasContent.value
|
|
3191
2258
|
}));
|
|
3192
2259
|
}
|
|
3193
|
-
const
|
|
2260
|
+
const On = { class: "tr-sender-editor-scroll" }, In = /* @__PURE__ */ X({
|
|
3194
2261
|
__name: "index",
|
|
3195
2262
|
setup(e) {
|
|
3196
|
-
const { editor: t, editorRef: o } =
|
|
3197
|
-
return (s,
|
|
2263
|
+
const { editor: t, editorRef: o } = ue();
|
|
2264
|
+
return (s, i) => (w(), P("div", {
|
|
3198
2265
|
ref_key: "editorRef",
|
|
3199
2266
|
ref: o,
|
|
3200
2267
|
class: "tr-sender-editor-wrapper"
|
|
3201
2268
|
}, [
|
|
3202
|
-
|
|
3203
|
-
|
|
2269
|
+
R("div", On, [
|
|
2270
|
+
A(t) ? (w(), U(A(xt), {
|
|
3204
2271
|
key: 0,
|
|
3205
|
-
editor:
|
|
2272
|
+
editor: A(t),
|
|
3206
2273
|
class: "tr-sender-editor-content"
|
|
3207
|
-
}, null, 8, ["editor"])) :
|
|
2274
|
+
}, null, 8, ["editor"])) : N("", !0)
|
|
3208
2275
|
])
|
|
3209
2276
|
], 512));
|
|
3210
2277
|
}
|
|
3211
|
-
}),
|
|
2278
|
+
}), nt = /* @__PURE__ */ Z(In, [["__scopeId", "data-v-7f5b51aa"]]), Rn = { class: "tr-sender-single-layout" }, Bn = {
|
|
3212
2279
|
key: 0,
|
|
3213
2280
|
class: "tr-sender-header"
|
|
3214
|
-
},
|
|
2281
|
+
}, jn = { class: "tr-sender-container" }, $n = { class: "tr-sender-main" }, Kn = {
|
|
3215
2282
|
key: 0,
|
|
3216
2283
|
class: "tr-sender-prefix"
|
|
3217
|
-
},
|
|
2284
|
+
}, qn = { class: "tr-sender-content" }, Nn = /* @__PURE__ */ X({
|
|
3218
2285
|
__name: "SingleLineLayout",
|
|
3219
2286
|
setup(e) {
|
|
3220
|
-
const { editor: t, hasContent: o, loading: s, showWordLimit:
|
|
3221
|
-
return (
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
])) :
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
])) :
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
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)
|
|
3233
2300
|
], !0)
|
|
3234
2301
|
])
|
|
3235
2302
|
]),
|
|
3236
|
-
|
|
3237
|
-
class:
|
|
2303
|
+
R("div", {
|
|
2304
|
+
class: V(["tr-sender-actions-inline", { "has-content": A(o) || A(s) }])
|
|
3238
2305
|
}, [
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
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"] ? {
|
|
3242
2309
|
name: "prepend",
|
|
3243
|
-
fn:
|
|
3244
|
-
|
|
2310
|
+
fn: B(() => [
|
|
2311
|
+
O(r.$slots, "actions-inline", z(F(A(a))), void 0, !0)
|
|
3245
2312
|
]),
|
|
3246
2313
|
key: "0"
|
|
3247
2314
|
} : void 0
|
|
@@ -3250,69 +2317,69 @@ const Ts = { class: "tr-sender-editor-scroll" }, Es = /* @__PURE__ */ V({
|
|
|
3250
2317
|
])
|
|
3251
2318
|
]));
|
|
3252
2319
|
}
|
|
3253
|
-
}),
|
|
2320
|
+
}), Hn = /* @__PURE__ */ Z(Nn, [["__scopeId", "data-v-7b0a576c"]]), Wn = {
|
|
3254
2321
|
key: 0,
|
|
3255
2322
|
class: "tr-sender-footer"
|
|
3256
|
-
},
|
|
2323
|
+
}, zn = { class: "tr-sender-footer-left" }, Fn = { class: "tr-sender-footer-right" }, Vn = /* @__PURE__ */ X({
|
|
3257
2324
|
__name: "index",
|
|
3258
2325
|
setup(e) {
|
|
3259
|
-
const { mode: t, showWordLimit: o, maxLength: s } =
|
|
3260
|
-
return (n,
|
|
3261
|
-
|
|
3262
|
-
|
|
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)
|
|
3263
2330
|
]),
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
2331
|
+
R("div", Fn, [
|
|
2332
|
+
A(o) && A(s) ? (w(), U(A(Ke), { key: 0 })) : N("", !0),
|
|
2333
|
+
Y(A(qe), null, me({ _: 2 }, [
|
|
3267
2334
|
n.$slots["footer-right"] ? {
|
|
3268
2335
|
name: "prepend",
|
|
3269
|
-
fn:
|
|
3270
|
-
|
|
2336
|
+
fn: B(() => [
|
|
2337
|
+
O(n.$slots, "footer-right", z(F(A(i))), void 0, !0)
|
|
3271
2338
|
]),
|
|
3272
2339
|
key: "0"
|
|
3273
2340
|
} : void 0
|
|
3274
2341
|
]), 1024)
|
|
3275
2342
|
])
|
|
3276
|
-
])) :
|
|
2343
|
+
])) : N("", !0);
|
|
3277
2344
|
}
|
|
3278
|
-
}),
|
|
2345
|
+
}), Gn = /* @__PURE__ */ Z(Vn, [["__scopeId", "data-v-ffcdce27"]]), Un = { class: "tr-sender-multi-layout" }, Xn = {
|
|
3279
2346
|
key: 0,
|
|
3280
2347
|
class: "tr-sender-header"
|
|
3281
|
-
},
|
|
2348
|
+
}, Zn = { class: "tr-sender-main" }, Yn = {
|
|
3282
2349
|
key: 0,
|
|
3283
2350
|
class: "tr-sender-prefix"
|
|
3284
|
-
},
|
|
2351
|
+
}, Jn = { class: "tr-sender-content" }, Qn = /* @__PURE__ */ X({
|
|
3285
2352
|
__name: "MultiLineLayout",
|
|
3286
2353
|
setup(e) {
|
|
3287
|
-
const t =
|
|
3288
|
-
return (s,
|
|
3289
|
-
s.$slots.header ? (
|
|
3290
|
-
|
|
3291
|
-
])) :
|
|
3292
|
-
|
|
3293
|
-
s.$slots.prefix ? (
|
|
3294
|
-
|
|
3295
|
-
])) :
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
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
|
|
3299
2366
|
}, () => [
|
|
3300
|
-
|
|
2367
|
+
Y(nt)
|
|
3301
2368
|
], !0)
|
|
3302
2369
|
])
|
|
3303
2370
|
]),
|
|
3304
|
-
|
|
3305
|
-
footer:
|
|
3306
|
-
|
|
2371
|
+
Y(Gn, null, {
|
|
2372
|
+
footer: B(() => [
|
|
2373
|
+
O(s.$slots, "footer", z(F(A(o))), void 0, !0)
|
|
3307
2374
|
]),
|
|
3308
|
-
"footer-right":
|
|
3309
|
-
|
|
2375
|
+
"footer-right": B(() => [
|
|
2376
|
+
O(s.$slots, "footer-right", z(F(A(o))), void 0, !0)
|
|
3310
2377
|
]),
|
|
3311
2378
|
_: 3
|
|
3312
2379
|
})
|
|
3313
2380
|
]));
|
|
3314
2381
|
}
|
|
3315
|
-
}),
|
|
2382
|
+
}), eo = /* @__PURE__ */ Z(Qn, [["__scopeId", "data-v-0b507198"]]), to = /* @__PURE__ */ X({
|
|
3316
2383
|
__name: "index",
|
|
3317
2384
|
props: {
|
|
3318
2385
|
modelValue: {},
|
|
@@ -3336,102 +2403,102 @@ const Ts = { class: "tr-sender-editor-scroll" }, Es = /* @__PURE__ */ V({
|
|
|
3336
2403
|
},
|
|
3337
2404
|
emits: ["update:modelValue", "submit", "focus", "blur", "clear", "cancel", "input"],
|
|
3338
2405
|
setup(e, { expose: t, emit: o }) {
|
|
3339
|
-
const s = e,
|
|
3340
|
-
return t(
|
|
3341
|
-
class:
|
|
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([
|
|
3342
2409
|
"tr-sender",
|
|
3343
|
-
`tr-sender--${
|
|
3344
|
-
`tr-sender--${
|
|
2410
|
+
`tr-sender--${A(n).mode.value}`,
|
|
2411
|
+
`tr-sender--${A(n).size.value}`,
|
|
3345
2412
|
{
|
|
3346
|
-
"is-auto-switching":
|
|
3347
|
-
"is-disabled":
|
|
2413
|
+
"is-auto-switching": A(n).isAutoSwitching.value,
|
|
2414
|
+
"is-disabled": A(n).disabled.value
|
|
3348
2415
|
}
|
|
3349
2416
|
])
|
|
3350
2417
|
}, [
|
|
3351
|
-
|
|
3352
|
-
|
|
2418
|
+
A(n).mode.value === "single" ? (w(), U(Hn, { key: 0 }, me({ _: 2 }, [
|
|
2419
|
+
r.$slots.header ? {
|
|
3353
2420
|
name: "header",
|
|
3354
|
-
fn:
|
|
3355
|
-
|
|
2421
|
+
fn: B(() => [
|
|
2422
|
+
O(r.$slots, "header", {}, void 0, !0)
|
|
3356
2423
|
]),
|
|
3357
2424
|
key: "0"
|
|
3358
2425
|
} : void 0,
|
|
3359
|
-
|
|
2426
|
+
r.$slots.prefix ? {
|
|
3360
2427
|
name: "prefix",
|
|
3361
|
-
fn:
|
|
3362
|
-
|
|
2428
|
+
fn: B(() => [
|
|
2429
|
+
O(r.$slots, "prefix", {}, void 0, !0)
|
|
3363
2430
|
]),
|
|
3364
2431
|
key: "1"
|
|
3365
2432
|
} : void 0,
|
|
3366
|
-
|
|
2433
|
+
r.$slots.content ? {
|
|
3367
2434
|
name: "content",
|
|
3368
|
-
fn:
|
|
3369
|
-
|
|
2435
|
+
fn: B((u) => [
|
|
2436
|
+
O(r.$slots, "content", z(F(u)), void 0, !0)
|
|
3370
2437
|
]),
|
|
3371
2438
|
key: "2"
|
|
3372
2439
|
} : void 0,
|
|
3373
|
-
|
|
2440
|
+
r.$slots["actions-inline"] ? {
|
|
3374
2441
|
name: "actions-inline",
|
|
3375
|
-
fn:
|
|
3376
|
-
|
|
2442
|
+
fn: B((u) => [
|
|
2443
|
+
O(r.$slots, "actions-inline", z(F(u)), void 0, !0)
|
|
3377
2444
|
]),
|
|
3378
2445
|
key: "3"
|
|
3379
2446
|
} : void 0
|
|
3380
|
-
]), 1024)) : (
|
|
3381
|
-
|
|
2447
|
+
]), 1024)) : (w(), U(eo, { key: 1 }, me({ _: 2 }, [
|
|
2448
|
+
r.$slots.header ? {
|
|
3382
2449
|
name: "header",
|
|
3383
|
-
fn:
|
|
3384
|
-
|
|
2450
|
+
fn: B(() => [
|
|
2451
|
+
O(r.$slots, "header", {}, void 0, !0)
|
|
3385
2452
|
]),
|
|
3386
2453
|
key: "0"
|
|
3387
2454
|
} : void 0,
|
|
3388
|
-
|
|
2455
|
+
r.$slots.prefix ? {
|
|
3389
2456
|
name: "prefix",
|
|
3390
|
-
fn:
|
|
3391
|
-
|
|
2457
|
+
fn: B(() => [
|
|
2458
|
+
O(r.$slots, "prefix", {}, void 0, !0)
|
|
3392
2459
|
]),
|
|
3393
2460
|
key: "1"
|
|
3394
2461
|
} : void 0,
|
|
3395
|
-
|
|
2462
|
+
r.$slots.content ? {
|
|
3396
2463
|
name: "content",
|
|
3397
|
-
fn:
|
|
3398
|
-
|
|
2464
|
+
fn: B((u) => [
|
|
2465
|
+
O(r.$slots, "content", z(F(u)), void 0, !0)
|
|
3399
2466
|
]),
|
|
3400
2467
|
key: "2"
|
|
3401
2468
|
} : void 0,
|
|
3402
|
-
|
|
2469
|
+
r.$slots.footer ? {
|
|
3403
2470
|
name: "footer",
|
|
3404
|
-
fn:
|
|
3405
|
-
|
|
2471
|
+
fn: B((u) => [
|
|
2472
|
+
O(r.$slots, "footer", z(F(u)), void 0, !0)
|
|
3406
2473
|
]),
|
|
3407
2474
|
key: "3"
|
|
3408
2475
|
} : void 0,
|
|
3409
|
-
|
|
2476
|
+
r.$slots["footer-right"] ? {
|
|
3410
2477
|
name: "footer-right",
|
|
3411
|
-
fn:
|
|
3412
|
-
|
|
2478
|
+
fn: B((u) => [
|
|
2479
|
+
O(r.$slots, "footer-right", z(F(u)), void 0, !0)
|
|
3413
2480
|
]),
|
|
3414
2481
|
key: "4"
|
|
3415
2482
|
} : void 0
|
|
3416
2483
|
]), 1024))
|
|
3417
2484
|
], 2));
|
|
3418
2485
|
}
|
|
3419
|
-
}),
|
|
3420
|
-
|
|
3421
|
-
const
|
|
3422
|
-
e.component(
|
|
3423
|
-
},
|
|
3424
|
-
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,
|
|
3425
2492
|
// 扩展类(用于继承)
|
|
3426
|
-
Mention:
|
|
3427
|
-
Suggestion:
|
|
3428
|
-
Template:
|
|
2493
|
+
Mention: Fe,
|
|
2494
|
+
Suggestion: Ge,
|
|
2495
|
+
Template: Xe,
|
|
3429
2496
|
// 便捷函数(用于简单场景)
|
|
3430
|
-
mention:
|
|
3431
|
-
suggestion:
|
|
3432
|
-
template:
|
|
2497
|
+
mention: Ft,
|
|
2498
|
+
suggestion: en,
|
|
2499
|
+
template: Tn
|
|
3433
2500
|
});
|
|
3434
2501
|
export {
|
|
3435
|
-
|
|
3436
|
-
|
|
2502
|
+
Eo as default,
|
|
2503
|
+
ue as useSenderContext
|
|
3437
2504
|
};
|