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