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