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