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