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