@opentiny/tiny-robot 0.5.2-beta.0 → 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extension-manager/index.js +176 -178
- package/dist/index.d.ts +70 -73
- package/dist/index3.js +95 -92
- package/dist/model-selector/index.js +483 -477
- package/dist/sender/index.js +111 -111
- package/dist/style.css +1 -1
- package/package.json +3 -3
package/dist/sender/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as X, openBlock as w, createBlock as U, unref as A, withCtx as B, createTextVNode as ot, toDisplayString as ne, ref as W, watch as K, createElementBlock as P, Fragment as fe, renderList as pe, withModifiers as ye, normalizeClass as V, createCommentVNode as N, createElementVNode as R, nextTick as oe, isRef as ce, Transition as st, normalizeStyle as rt, createVNode as Y, toRaw as it, computed as M, onMounted as at, onUnmounted as lt, Teleport as ct, toRef as de, onBeforeUnmount as ut, shallowReactive as dt, toValue as ft, provide as pt, renderSlot as O, createSlots as me, normalizeProps as z, guardReactiveProps as F } from "vue";
|
|
2
2
|
import { a as mt, u as ue, W as Ke, D as qe } from "../index2.js";
|
|
3
3
|
import { NodeViewWrapper as Ee, VueRenderer as Ne, VueNodeViewRenderer as _e, NodeViewContent as ht, useEditor as gt, EditorContent as xt } from "@tiptap/vue-3";
|
|
4
4
|
import bt from "@tiptap/extension-document";
|
|
@@ -8,34 +8,34 @@ import vt from "@tiptap/extension-history";
|
|
|
8
8
|
import Et from "@tiptap/extension-placeholder";
|
|
9
9
|
import _t from "@tiptap/extension-character-count";
|
|
10
10
|
import { h as St, j as Ct, p as At } from "../index4.js";
|
|
11
|
-
import { PluginKey as
|
|
11
|
+
import { PluginKey as J, Plugin as Q, TextSelection as D } from "@tiptap/pm/state";
|
|
12
12
|
import { DecorationSet as le, Decoration as He } from "@tiptap/pm/view";
|
|
13
13
|
import { a as Se, c as Ce, o as Ae, f as we, s as ke } from "../floating-ui.dom.js";
|
|
14
|
-
import { _ as
|
|
14
|
+
import { _ as Z } from "../_plugin-vue_export-helper.js";
|
|
15
15
|
import { IconAssociate as wt, IconArrowDown as kt } from "@opentiny/tiny-robot-svgs";
|
|
16
16
|
import { s as Lt } from "../useSenderContentRegistration.js";
|
|
17
17
|
import { Node as Le, mergeAttributes as Me, Extension as We } from "@tiptap/core";
|
|
18
18
|
import { u as Mt } from "../useTeleportTarget.js";
|
|
19
|
-
const Pt = /* @__PURE__ */
|
|
19
|
+
const Pt = /* @__PURE__ */ X({
|
|
20
20
|
__name: "mention-view",
|
|
21
21
|
props: {
|
|
22
22
|
node: {},
|
|
23
23
|
extension: {}
|
|
24
24
|
},
|
|
25
25
|
setup(e) {
|
|
26
|
-
return (t, o) => (w(),
|
|
26
|
+
return (t, o) => (w(), U(A(Ee), {
|
|
27
27
|
as: "span",
|
|
28
28
|
class: "mention",
|
|
29
29
|
"data-id": e.node.attrs.id,
|
|
30
30
|
"data-value": e.node.attrs.value
|
|
31
31
|
}, {
|
|
32
32
|
default: B(() => [
|
|
33
|
-
ot(
|
|
33
|
+
ot(ne(e.extension.options.char) + ne(e.node.attrs.label), 1)
|
|
34
34
|
]),
|
|
35
35
|
_: 1
|
|
36
36
|
}, 8, ["data-id", "data-value"]));
|
|
37
37
|
}
|
|
38
|
-
}), Dt = /* @__PURE__ */
|
|
38
|
+
}), Dt = /* @__PURE__ */ Z(Pt, [["__scopeId", "data-v-b42c4fae"]]);
|
|
39
39
|
function re(e) {
|
|
40
40
|
return `${e}_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
|
|
41
41
|
}
|
|
@@ -73,7 +73,7 @@ const se = {
|
|
|
73
73
|
PARAGRAPH: "paragraph",
|
|
74
74
|
/** Text 节点类型(ProseMirror 内置) */
|
|
75
75
|
TEXT: "text"
|
|
76
|
-
},
|
|
76
|
+
}, ee = {
|
|
77
77
|
/** Mention 插件 */
|
|
78
78
|
MENTION: "mention",
|
|
79
79
|
/** Suggestion 插件 */
|
|
@@ -90,7 +90,7 @@ const se = {
|
|
|
90
90
|
TEMPLATE_BLOCK_KEYBOARD: "templateBlockKeyboard",
|
|
91
91
|
/** Template Block 粘贴处理插件 */
|
|
92
92
|
TEMPLATE_BLOCK_PASTE: "templateBlockPaste"
|
|
93
|
-
},
|
|
93
|
+
}, G = {
|
|
94
94
|
/** 文本类型 */
|
|
95
95
|
TEXT: "text",
|
|
96
96
|
/** 模板块类型(对应内部的 TemplateBlock 节点) */
|
|
@@ -126,7 +126,7 @@ const se = {
|
|
|
126
126
|
}, Bt = { class: "mention-label" }, jt = {
|
|
127
127
|
key: 0,
|
|
128
128
|
class: "mention-empty"
|
|
129
|
-
}, $t = /* @__PURE__ */
|
|
129
|
+
}, $t = /* @__PURE__ */ X({
|
|
130
130
|
__name: "mention-list",
|
|
131
131
|
props: {
|
|
132
132
|
items: {},
|
|
@@ -144,7 +144,7 @@ const se = {
|
|
|
144
144
|
return I(u, "ARROW_UP") ? (s.value = Math.max(0, s.value - 1), a(), !0) : I(u, "ARROW_DOWN") ? (s.value = Math.min(o.items.length - 1, s.value + 1), a(), !0) : ie(u, ["ENTER", "TAB"]) ? (r(s.value), !0) : !1;
|
|
145
145
|
}
|
|
146
146
|
function a() {
|
|
147
|
-
|
|
147
|
+
oe(() => {
|
|
148
148
|
var p;
|
|
149
149
|
const u = (p = i.value) == null ? void 0 : p.querySelector(".mention-item.is-selected");
|
|
150
150
|
u && u.scrollIntoView({
|
|
@@ -174,19 +174,19 @@ const se = {
|
|
|
174
174
|
(w(!0), P(fe, null, pe(e.items, (f, E) => (w(), P("button", {
|
|
175
175
|
key: f.id,
|
|
176
176
|
type: "button",
|
|
177
|
-
class:
|
|
177
|
+
class: V(["mention-item", { "is-selected": E === s.value }]),
|
|
178
178
|
onMousedown: ye((S) => r(E), ["prevent"]),
|
|
179
179
|
onMouseenter: (S) => l(E)
|
|
180
180
|
}, [
|
|
181
|
-
f.icon ? (w(), P("span", Rt,
|
|
182
|
-
R("span", Bt,
|
|
181
|
+
f.icon ? (w(), P("span", Rt, ne(f.icon), 1)) : N("", !0),
|
|
182
|
+
R("span", Bt, ne(f.label), 1)
|
|
183
183
|
], 42, It))), 128)),
|
|
184
184
|
e.items.length === 0 ? (w(), P("div", jt, [...p[0] || (p[0] = [
|
|
185
185
|
R("span", null, "未找到匹配的提及项", -1)
|
|
186
186
|
])])) : N("", !0)
|
|
187
187
|
], 512));
|
|
188
188
|
}
|
|
189
|
-
}), Kt = /* @__PURE__ */
|
|
189
|
+
}), Kt = /* @__PURE__ */ Z($t, [["__scopeId", "data-v-aaa34d1a"]]), te = new J(ee.MENTION);
|
|
190
190
|
function qt(e, t) {
|
|
191
191
|
if (!t)
|
|
192
192
|
return e;
|
|
@@ -199,8 +199,8 @@ function qt(e, t) {
|
|
|
199
199
|
function Nt(e) {
|
|
200
200
|
const { editor: t, char: o, items: s, allowSpaces: i } = e;
|
|
201
201
|
let n = null, a = null, r = null;
|
|
202
|
-
return new
|
|
203
|
-
key:
|
|
202
|
+
return new Q({
|
|
203
|
+
key: te,
|
|
204
204
|
state: {
|
|
205
205
|
init() {
|
|
206
206
|
return {
|
|
@@ -211,7 +211,7 @@ function Nt(e) {
|
|
|
211
211
|
};
|
|
212
212
|
},
|
|
213
213
|
apply(l, u) {
|
|
214
|
-
const p = l.getMeta(
|
|
214
|
+
const p = l.getMeta(te);
|
|
215
215
|
if (p && p.type === "close")
|
|
216
216
|
return {
|
|
217
217
|
active: !1,
|
|
@@ -252,7 +252,7 @@ function Nt(e) {
|
|
|
252
252
|
// 键盘处理
|
|
253
253
|
handleKeyDown(l, u) {
|
|
254
254
|
var f, E, S, j;
|
|
255
|
-
const p =
|
|
255
|
+
const p = te.getState(l.state);
|
|
256
256
|
if (I(u, "BACKSPACE")) {
|
|
257
257
|
const { selection: L } = l.state, { $from: C } = L;
|
|
258
258
|
if (C.nodeBefore && C.nodeBefore.type.name === T.MENTION) {
|
|
@@ -266,7 +266,7 @@ function Nt(e) {
|
|
|
266
266
|
if (I(u, "ESCAPE")) {
|
|
267
267
|
u.preventDefault();
|
|
268
268
|
const L = l.state.tr;
|
|
269
|
-
return L.setMeta(
|
|
269
|
+
return L.setMeta(te, {
|
|
270
270
|
type: "close"
|
|
271
271
|
}), l.dispatch(L), n && (r == null || r(), r = null, n.destroy(), n = null), a && (a.remove(), a = null), !0;
|
|
272
272
|
}
|
|
@@ -285,7 +285,7 @@ function Nt(e) {
|
|
|
285
285
|
view() {
|
|
286
286
|
return {
|
|
287
287
|
update(l) {
|
|
288
|
-
const u =
|
|
288
|
+
const u = te.getState(l.state);
|
|
289
289
|
if (u != null && u.active && u.filteredItems.length > 0) {
|
|
290
290
|
n ? n.updateProps({
|
|
291
291
|
items: u.filteredItems
|
|
@@ -430,7 +430,7 @@ const Ht = {
|
|
|
430
430
|
e,
|
|
431
431
|
() => {
|
|
432
432
|
const t = this.editor.state.tr;
|
|
433
|
-
t.setMeta(
|
|
433
|
+
t.setMeta(te, { type: "mention-update" }), this.editor.view.dispatch(t);
|
|
434
434
|
},
|
|
435
435
|
{ deep: !0 }
|
|
436
436
|
));
|
|
@@ -475,7 +475,7 @@ function zt(e) {
|
|
|
475
475
|
if (i && i.type.name === T.PARAGRAPH) {
|
|
476
476
|
if (o.type.name === T.MENTION)
|
|
477
477
|
t.push({
|
|
478
|
-
type:
|
|
478
|
+
type: G.MENTION,
|
|
479
479
|
content: o.attrs.label,
|
|
480
480
|
value: o.attrs.value || ""
|
|
481
481
|
});
|
|
@@ -483,8 +483,8 @@ function zt(e) {
|
|
|
483
483
|
const n = o.text || "";
|
|
484
484
|
if (n) {
|
|
485
485
|
const a = t[t.length - 1];
|
|
486
|
-
a && a.type ===
|
|
487
|
-
type:
|
|
486
|
+
a && a.type === G.TEXT ? a.content = (a.content || "") + n : t.push({
|
|
487
|
+
type: G.TEXT,
|
|
488
488
|
content: n
|
|
489
489
|
});
|
|
490
490
|
}
|
|
@@ -544,7 +544,7 @@ const Ve = (e, t) => {
|
|
|
544
544
|
}, Vt = (e, t) => !t || !e ? [{ text: e, isMatch: !1 }] : Ve(e, [t]), Gt = (e, t) => {
|
|
545
545
|
const { content: o, highlights: s } = e;
|
|
546
546
|
return typeof s == "function" ? s(o, t) : Array.isArray(s) ? Ve(o, s) : Vt(o, t);
|
|
547
|
-
}, Ut = ["onMouseenter", "onClick"], Xt = { class: "suggestion-list__text" }, Zt = /* @__PURE__ */
|
|
547
|
+
}, Ut = ["onMouseenter", "onClick"], Xt = { class: "suggestion-list__text" }, Zt = /* @__PURE__ */ X({
|
|
548
548
|
__name: "suggestion-list",
|
|
549
549
|
props: {
|
|
550
550
|
show: { type: Boolean },
|
|
@@ -577,7 +577,7 @@ const Ve = (e, t) => {
|
|
|
577
577
|
l && l.scrollIntoView({ block: "nearest" });
|
|
578
578
|
}
|
|
579
579
|
}
|
|
580
|
-
), (r, l) => (w(),
|
|
580
|
+
), (r, l) => (w(), U(st, { name: "suggestion-slide-up" }, {
|
|
581
581
|
default: B(() => [
|
|
582
582
|
t.show && t.suggestions.length ? (w(), P("div", {
|
|
583
583
|
key: 0,
|
|
@@ -588,20 +588,20 @@ const Ve = (e, t) => {
|
|
|
588
588
|
}, [
|
|
589
589
|
(w(!0), P(fe, null, pe(t.suggestions, (u, p) => (w(), P("div", {
|
|
590
590
|
key: p,
|
|
591
|
-
class:
|
|
591
|
+
class: V(["suggestion-list__item", { highlighted: s(p) }]),
|
|
592
592
|
onMouseenter: (f) => i(p),
|
|
593
593
|
onMouseleave: n,
|
|
594
594
|
onClick: (f) => a(p)
|
|
595
595
|
}, [
|
|
596
|
-
|
|
596
|
+
Y(A(wt), { class: "suggestion-list__icon" }),
|
|
597
597
|
R("span", Xt, [
|
|
598
598
|
(w(!0), P(fe, null, pe(A(Gt)(u, t.inputValue), (f, E) => (w(), P("span", {
|
|
599
599
|
key: E,
|
|
600
|
-
class:
|
|
600
|
+
class: V({
|
|
601
601
|
"suggestion-list__text--match": f.isMatch,
|
|
602
602
|
"suggestion-list__text--normal": !f.isMatch
|
|
603
603
|
})
|
|
604
|
-
},
|
|
604
|
+
}, ne(f.text), 3))), 128))
|
|
605
605
|
])
|
|
606
606
|
], 42, Ut))), 128))
|
|
607
607
|
], 4)) : N("", !0)
|
|
@@ -609,7 +609,7 @@ const Ve = (e, t) => {
|
|
|
609
609
|
_: 1
|
|
610
610
|
}));
|
|
611
611
|
}
|
|
612
|
-
}), Yt = /* @__PURE__ */
|
|
612
|
+
}), Yt = /* @__PURE__ */ Z(Zt, [["__scopeId", "data-v-76a6f35e"]]), Jt = (e, t) => {
|
|
613
613
|
if (!e || !t)
|
|
614
614
|
return { text: "", show: !1, showTab: !1 };
|
|
615
615
|
const o = e.toLowerCase(), s = t.toLowerCase();
|
|
@@ -621,7 +621,7 @@ const Ve = (e, t) => {
|
|
|
621
621
|
show: n,
|
|
622
622
|
showTab: n
|
|
623
623
|
};
|
|
624
|
-
}, H = new
|
|
624
|
+
}, H = new J(ee.SUGGESTION);
|
|
625
625
|
function Qt(e) {
|
|
626
626
|
const {
|
|
627
627
|
editor: t,
|
|
@@ -715,7 +715,7 @@ function Qt(e) {
|
|
|
715
715
|
);
|
|
716
716
|
return le.create(c, [v]);
|
|
717
717
|
}
|
|
718
|
-
return new
|
|
718
|
+
return new Q({
|
|
719
719
|
key: H,
|
|
720
720
|
state: {
|
|
721
721
|
init() {
|
|
@@ -930,10 +930,10 @@ const nn = {
|
|
|
930
930
|
t.clearContent();
|
|
931
931
|
const o = [];
|
|
932
932
|
return e.forEach((s) => {
|
|
933
|
-
s.type ===
|
|
933
|
+
s.type === G.TEXT ? s.content && o.push({
|
|
934
934
|
type: T.TEXT,
|
|
935
935
|
text: s.content
|
|
936
|
-
}) : s.type ===
|
|
936
|
+
}) : s.type === G.BLOCK ? o.push({
|
|
937
937
|
type: T.TEMPLATE_BLOCK,
|
|
938
938
|
attrs: {
|
|
939
939
|
id: s.id || re("template"),
|
|
@@ -945,7 +945,7 @@ const nn = {
|
|
|
945
945
|
text: s.content
|
|
946
946
|
}
|
|
947
947
|
] : []
|
|
948
|
-
}) : s.type ===
|
|
948
|
+
}) : s.type === G.SELECT && o.push({
|
|
949
949
|
type: T.TEMPLATE_SELECT,
|
|
950
950
|
attrs: {
|
|
951
951
|
id: s.id || re("select"),
|
|
@@ -1024,21 +1024,21 @@ function Ue(e) {
|
|
|
1024
1024
|
if (o.type.name === T.TEMPLATE_BLOCK) {
|
|
1025
1025
|
const n = (o.textContent || "").replace(new RegExp(y, "g"), "");
|
|
1026
1026
|
t.push({
|
|
1027
|
-
type:
|
|
1027
|
+
type: G.BLOCK,
|
|
1028
1028
|
content: n
|
|
1029
1029
|
});
|
|
1030
1030
|
} else if (o.type.name === T.TEMPLATE_SELECT) {
|
|
1031
1031
|
const n = o.attrs.options.find((r) => r.value === o.attrs.value), a = (n == null ? void 0 : n.value) || "";
|
|
1032
1032
|
t.push({
|
|
1033
|
-
type:
|
|
1033
|
+
type: G.SELECT,
|
|
1034
1034
|
content: a
|
|
1035
1035
|
});
|
|
1036
1036
|
} else if (o.type.name === T.TEXT) {
|
|
1037
1037
|
const n = (o.text || "").replace(new RegExp(y, "g"), "");
|
|
1038
1038
|
if (n) {
|
|
1039
1039
|
const a = t[t.length - 1];
|
|
1040
|
-
a && a.type ===
|
|
1041
|
-
type:
|
|
1040
|
+
a && a.type === G.TEXT ? a.content += n : t.push({
|
|
1041
|
+
type: G.TEXT,
|
|
1042
1042
|
content: n
|
|
1043
1043
|
});
|
|
1044
1044
|
}
|
|
@@ -1046,7 +1046,7 @@ function Ue(e) {
|
|
|
1046
1046
|
}
|
|
1047
1047
|
}), t;
|
|
1048
1048
|
}
|
|
1049
|
-
const on = /* @__PURE__ */
|
|
1049
|
+
const on = /* @__PURE__ */ X({
|
|
1050
1050
|
__name: "template-block-view",
|
|
1051
1051
|
props: {
|
|
1052
1052
|
node: {}
|
|
@@ -1056,9 +1056,9 @@ const on = /* @__PURE__ */ G({
|
|
|
1056
1056
|
const s = t.node.textContent || "";
|
|
1057
1057
|
return s.length === 0 || s === y;
|
|
1058
1058
|
});
|
|
1059
|
-
return (s, i) => (w(),
|
|
1059
|
+
return (s, i) => (w(), U(A(Ee), {
|
|
1060
1060
|
as: "span",
|
|
1061
|
-
class:
|
|
1061
|
+
class: V(["template-block", { "is-empty": o.value }]),
|
|
1062
1062
|
"data-id": e.node.attrs.id
|
|
1063
1063
|
}, {
|
|
1064
1064
|
default: B(() => [
|
|
@@ -1066,7 +1066,7 @@ const on = /* @__PURE__ */ G({
|
|
|
1066
1066
|
contenteditable: "false",
|
|
1067
1067
|
class: "template-block__prefix"
|
|
1068
1068
|
}, " ", -1)),
|
|
1069
|
-
|
|
1069
|
+
Y(A(ht), {
|
|
1070
1070
|
as: "span",
|
|
1071
1071
|
class: "template-block__content"
|
|
1072
1072
|
}),
|
|
@@ -1078,7 +1078,7 @@ const on = /* @__PURE__ */ G({
|
|
|
1078
1078
|
_: 1
|
|
1079
1079
|
}, 8, ["class", "data-id"]));
|
|
1080
1080
|
}
|
|
1081
|
-
}), sn = /* @__PURE__ */
|
|
1081
|
+
}), sn = /* @__PURE__ */ Z(on, [["__scopeId", "data-v-aa55b9db"]]);
|
|
1082
1082
|
function rn(e) {
|
|
1083
1083
|
const t = [];
|
|
1084
1084
|
let { tr: o } = e;
|
|
@@ -1108,16 +1108,16 @@ function rn(e) {
|
|
|
1108
1108
|
}), o) : null;
|
|
1109
1109
|
}
|
|
1110
1110
|
function an() {
|
|
1111
|
-
return new
|
|
1112
|
-
key: new
|
|
1111
|
+
return new Q({
|
|
1112
|
+
key: new J(ee.TEMPLATE_BLOCK_ZERO_WIDTH),
|
|
1113
1113
|
appendTransaction(e, t, o) {
|
|
1114
1114
|
return e.some((i) => i.docChanged) ? rn(o) : null;
|
|
1115
1115
|
}
|
|
1116
1116
|
});
|
|
1117
1117
|
}
|
|
1118
1118
|
function ln() {
|
|
1119
|
-
return new
|
|
1120
|
-
key: new
|
|
1119
|
+
return new Q({
|
|
1120
|
+
key: new J(ee.TEMPLATE_BLOCK_KEYBOARD),
|
|
1121
1121
|
props: {
|
|
1122
1122
|
handleKeyDown(e, t) {
|
|
1123
1123
|
var r, l, u, p, f, E, S, j, L;
|
|
@@ -1317,8 +1317,8 @@ function ln() {
|
|
|
1317
1317
|
});
|
|
1318
1318
|
}
|
|
1319
1319
|
function cn() {
|
|
1320
|
-
return new
|
|
1321
|
-
key: new
|
|
1320
|
+
return new Q({
|
|
1321
|
+
key: new J(ee.TEMPLATE_BLOCK_PASTE),
|
|
1322
1322
|
props: {
|
|
1323
1323
|
handlePaste(e, t) {
|
|
1324
1324
|
var n, a, r;
|
|
@@ -1421,11 +1421,11 @@ const un = Le.create({
|
|
|
1421
1421
|
addProseMirrorPlugins() {
|
|
1422
1422
|
return [an(), ln(), cn()];
|
|
1423
1423
|
}
|
|
1424
|
-
}), ae = new
|
|
1425
|
-
|
|
1424
|
+
}), ae = new J(
|
|
1425
|
+
ee.TEMPLATE_SELECT_DROPDOWN
|
|
1426
1426
|
);
|
|
1427
1427
|
function dn() {
|
|
1428
|
-
return new
|
|
1428
|
+
return new Q({
|
|
1429
1429
|
key: ae,
|
|
1430
1430
|
state: {
|
|
1431
1431
|
init() {
|
|
@@ -1454,8 +1454,8 @@ function dn() {
|
|
|
1454
1454
|
});
|
|
1455
1455
|
}
|
|
1456
1456
|
function fn() {
|
|
1457
|
-
return new
|
|
1458
|
-
key: new
|
|
1457
|
+
return new Q({
|
|
1458
|
+
key: new J(ee.TEMPLATE_SELECT_ZERO_WIDTH),
|
|
1459
1459
|
appendTransaction(e, t, o) {
|
|
1460
1460
|
if (!e.some((a) => a.docChanged)) return null;
|
|
1461
1461
|
const i = [];
|
|
@@ -1472,8 +1472,8 @@ function fn() {
|
|
|
1472
1472
|
});
|
|
1473
1473
|
}
|
|
1474
1474
|
function pn() {
|
|
1475
|
-
return new
|
|
1476
|
-
key: new
|
|
1475
|
+
return new Q({
|
|
1476
|
+
key: new J(ee.TEMPLATE_SELECT_KEYBOARD),
|
|
1477
1477
|
props: {
|
|
1478
1478
|
handleKeyDown(e, t) {
|
|
1479
1479
|
const { state: o, dispatch: s } = e, { selection: i } = o, { $from: n } = i, a = ae.getState(e.state);
|
|
@@ -1535,7 +1535,7 @@ function mn(e, t, o) {
|
|
|
1535
1535
|
document.removeEventListener("click", s);
|
|
1536
1536
|
};
|
|
1537
1537
|
}
|
|
1538
|
-
const hn = { class: "template-select__icon" }, gn = ["onMousedown", "onMouseenter"], xn = /* @__PURE__ */
|
|
1538
|
+
const hn = { class: "template-select__icon" }, gn = ["onMousedown", "onMouseenter"], xn = /* @__PURE__ */ X({
|
|
1539
1539
|
__name: "template-select-view",
|
|
1540
1540
|
props: {
|
|
1541
1541
|
node: {},
|
|
@@ -1563,7 +1563,7 @@ const hn = { class: "template-select__icon" }, gn = ["onMousedown", "onMouseente
|
|
|
1563
1563
|
selectId: t.node.attrs.id
|
|
1564
1564
|
}), v.dispatch(m);
|
|
1565
1565
|
}
|
|
1566
|
-
t.node.attrs.value ? s.value = t.node.attrs.options.findIndex((v) => v.value === t.node.attrs.value) : s.value = -1, await
|
|
1566
|
+
t.node.attrs.value ? s.value = t.node.attrs.options.findIndex((v) => v.value === t.node.attrs.value) : s.value = -1, await oe(), h(), i.value && n.value && (a = mn(i.value, n.value, L));
|
|
1567
1567
|
}, L = async () => {
|
|
1568
1568
|
var x;
|
|
1569
1569
|
if (o.value = !1, s.value = -1, (x = t.editor) != null && x.view) {
|
|
@@ -1611,7 +1611,7 @@ const hn = { class: "template-select__icon" }, gn = ["onMousedown", "onMouseente
|
|
|
1611
1611
|
}, c = () => {
|
|
1612
1612
|
s.value === -1 || s.value >= t.node.attrs.options.length - 1 ? s.value = 0 : s.value += 1, b();
|
|
1613
1613
|
}, b = () => {
|
|
1614
|
-
|
|
1614
|
+
oe(() => {
|
|
1615
1615
|
if (!n.value) return;
|
|
1616
1616
|
const x = n.value.querySelector(".template-select__option.is-highlighted");
|
|
1617
1617
|
x && x.scrollIntoView({
|
|
@@ -1626,7 +1626,7 @@ const hn = { class: "template-select__icon" }, gn = ["onMousedown", "onMouseente
|
|
|
1626
1626
|
document.addEventListener("keydown", g);
|
|
1627
1627
|
}), lt(() => {
|
|
1628
1628
|
document.removeEventListener("keydown", g), a && a(), r && r();
|
|
1629
|
-
}), (x, v) => (w(),
|
|
1629
|
+
}), (x, v) => (w(), U(A(Ee), {
|
|
1630
1630
|
as: "span",
|
|
1631
1631
|
class: "template-select"
|
|
1632
1632
|
}, {
|
|
@@ -1638,43 +1638,43 @@ const hn = { class: "template-select__icon" }, gn = ["onMousedown", "onMouseente
|
|
|
1638
1638
|
R("span", {
|
|
1639
1639
|
ref_key: "triggerRef",
|
|
1640
1640
|
ref: i,
|
|
1641
|
-
class:
|
|
1641
|
+
class: V(["template-select__trigger", { "is-open": o.value }]),
|
|
1642
1642
|
onMousedown: ye(S, ["prevent"])
|
|
1643
1643
|
}, [
|
|
1644
1644
|
R("span", {
|
|
1645
|
-
class:
|
|
1646
|
-
},
|
|
1645
|
+
class: V(["template-select__text", { "is-placeholder": E.value }])
|
|
1646
|
+
}, ne(f.value), 3),
|
|
1647
1647
|
R("span", hn, [
|
|
1648
|
-
|
|
1648
|
+
Y(A(kt))
|
|
1649
1649
|
])
|
|
1650
1650
|
], 34),
|
|
1651
1651
|
v[1] || (v[1] = R("span", {
|
|
1652
1652
|
contenteditable: "false",
|
|
1653
1653
|
class: "template-select__suffix"
|
|
1654
1654
|
}, "", -1)),
|
|
1655
|
-
(w(),
|
|
1655
|
+
(w(), U(ct, { to: A(l) }, [
|
|
1656
1656
|
o.value ? (w(), P("div", {
|
|
1657
1657
|
key: 0,
|
|
1658
1658
|
ref_key: "dropdownRef",
|
|
1659
1659
|
ref: n,
|
|
1660
|
-
class:
|
|
1660
|
+
class: V(["template-select__dropdown", { "is-absolute": u.value }])
|
|
1661
1661
|
}, [
|
|
1662
1662
|
(w(!0), P(fe, null, pe(e.node.attrs.options, (m, k) => (w(), P("div", {
|
|
1663
1663
|
key: m.value,
|
|
1664
|
-
class:
|
|
1664
|
+
class: V(["template-select__option", {
|
|
1665
1665
|
"is-highlighted": k === s.value,
|
|
1666
1666
|
"is-selected": m.value === e.node.attrs.value
|
|
1667
1667
|
}]),
|
|
1668
1668
|
onMousedown: ye(($) => C(m), ["prevent"]),
|
|
1669
1669
|
onMouseenter: ($) => s.value = k
|
|
1670
|
-
},
|
|
1670
|
+
}, ne(m.label), 43, gn))), 128))
|
|
1671
1671
|
], 2)) : N("", !0)
|
|
1672
1672
|
], 8, ["to"]))
|
|
1673
1673
|
]),
|
|
1674
1674
|
_: 1
|
|
1675
1675
|
}));
|
|
1676
1676
|
}
|
|
1677
|
-
}), bn = /* @__PURE__ */
|
|
1677
|
+
}), bn = /* @__PURE__ */ Z(xn, [["__scopeId", "data-v-5bcba48f"]]), yn = Le.create({
|
|
1678
1678
|
name: T.TEMPLATE_SELECT,
|
|
1679
1679
|
// 节点配置
|
|
1680
1680
|
group: "inline",
|
|
@@ -1927,7 +1927,7 @@ function Cn(e, t) {
|
|
|
1927
1927
|
const l = (E = r.clipboardData) == null ? void 0 : E.getData("text/plain");
|
|
1928
1928
|
if (!l) return !1;
|
|
1929
1929
|
const u = e.mode === "single" ? l.replace(/\r?\n/g, " ") : l, { state: p } = a, { tr: f } = p;
|
|
1930
|
-
return f.insertText(u), a.dispatch(f),
|
|
1930
|
+
return f.insertText(u), a.dispatch(f), oe(() => {
|
|
1931
1931
|
var S;
|
|
1932
1932
|
(S = n.value) == null || S.commands.scrollIntoView();
|
|
1933
1933
|
}), !0;
|
|
@@ -2020,7 +2020,7 @@ function wn(e, t, o) {
|
|
|
2020
2020
|
const E = t.value.getText();
|
|
2021
2021
|
s.value === "single" ? f.scrollWidth > f.clientWidth && p("multiple") : E.length || p("single");
|
|
2022
2022
|
}, p = (f) => {
|
|
2023
|
-
s.value !== f && (i.value = !0, s.value = f,
|
|
2023
|
+
s.value !== f && (i.value = !0, s.value = f, oe(() => {
|
|
2024
2024
|
t.value && t.value.commands.focus("end"), r(), a();
|
|
2025
2025
|
}));
|
|
2026
2026
|
};
|
|
@@ -2071,7 +2071,7 @@ function kn(e, t, o) {
|
|
|
2071
2071
|
return K(
|
|
2072
2072
|
e,
|
|
2073
2073
|
() => {
|
|
2074
|
-
|
|
2074
|
+
oe(() => {
|
|
2075
2075
|
a();
|
|
2076
2076
|
});
|
|
2077
2077
|
},
|
|
@@ -2079,7 +2079,7 @@ function kn(e, t, o) {
|
|
|
2079
2079
|
), K(
|
|
2080
2080
|
n,
|
|
2081
2081
|
() => {
|
|
2082
|
-
|
|
2082
|
+
oe(() => {
|
|
2083
2083
|
a();
|
|
2084
2084
|
});
|
|
2085
2085
|
},
|
|
@@ -2149,7 +2149,7 @@ function Dn(e, t) {
|
|
|
2149
2149
|
editorProps: {
|
|
2150
2150
|
...m.options.editorProps,
|
|
2151
2151
|
handleKeyDown: (k, $) => {
|
|
2152
|
-
const q =
|
|
2152
|
+
const q = te.getState(k.state), De = H.getState(k.state), Oe = ae.getState(k.state);
|
|
2153
2153
|
return q && q.active || De && De.active || Oe && Oe.isOpen ? !1 : h.checkSubmitShortcut($) ? ($.preventDefault(), E(), !0) : h.checkNewlineShortcut($) ? ($.preventDefault(), S.value === "single" ? (L("multiple"), setTimeout(() => {
|
|
2154
2154
|
m.commands.splitBlock(), m.commands.focus();
|
|
2155
2155
|
}, 0)) : m.commands.splitBlock(), !0) : !1;
|
|
@@ -2257,7 +2257,7 @@ function Pe() {
|
|
|
2257
2257
|
hasContent: e.hasContent.value
|
|
2258
2258
|
}));
|
|
2259
2259
|
}
|
|
2260
|
-
const On = { class: "tr-sender-editor-scroll" }, In = /* @__PURE__ */
|
|
2260
|
+
const On = { class: "tr-sender-editor-scroll" }, In = /* @__PURE__ */ X({
|
|
2261
2261
|
__name: "index",
|
|
2262
2262
|
setup(e) {
|
|
2263
2263
|
const { editor: t, editorRef: o } = ue();
|
|
@@ -2267,7 +2267,7 @@ const On = { class: "tr-sender-editor-scroll" }, In = /* @__PURE__ */ G({
|
|
|
2267
2267
|
class: "tr-sender-editor-wrapper"
|
|
2268
2268
|
}, [
|
|
2269
2269
|
R("div", On, [
|
|
2270
|
-
A(t) ? (w(),
|
|
2270
|
+
A(t) ? (w(), U(A(xt), {
|
|
2271
2271
|
key: 0,
|
|
2272
2272
|
editor: A(t),
|
|
2273
2273
|
class: "tr-sender-editor-content"
|
|
@@ -2275,13 +2275,13 @@ const On = { class: "tr-sender-editor-scroll" }, In = /* @__PURE__ */ G({
|
|
|
2275
2275
|
])
|
|
2276
2276
|
], 512));
|
|
2277
2277
|
}
|
|
2278
|
-
}), nt = /* @__PURE__ */
|
|
2278
|
+
}), nt = /* @__PURE__ */ Z(In, [["__scopeId", "data-v-7f5b51aa"]]), Rn = { class: "tr-sender-single-layout" }, Bn = {
|
|
2279
2279
|
key: 0,
|
|
2280
2280
|
class: "tr-sender-header"
|
|
2281
2281
|
}, jn = { class: "tr-sender-container" }, $n = { class: "tr-sender-main" }, Kn = {
|
|
2282
2282
|
key: 0,
|
|
2283
2283
|
class: "tr-sender-prefix"
|
|
2284
|
-
}, qn = { class: "tr-sender-content" }, Nn = /* @__PURE__ */
|
|
2284
|
+
}, qn = { class: "tr-sender-content" }, Nn = /* @__PURE__ */ X({
|
|
2285
2285
|
__name: "SingleLineLayout",
|
|
2286
2286
|
setup(e) {
|
|
2287
2287
|
const { editor: t, hasContent: o, loading: s, showWordLimit: i, maxLength: n } = ue(), a = Pe();
|
|
@@ -2296,19 +2296,19 @@ const On = { class: "tr-sender-editor-scroll" }, In = /* @__PURE__ */ G({
|
|
|
2296
2296
|
])) : N("", !0),
|
|
2297
2297
|
R("div", qn, [
|
|
2298
2298
|
O(r.$slots, "content", { editor: A(t) }, () => [
|
|
2299
|
-
|
|
2299
|
+
Y(nt)
|
|
2300
2300
|
], !0)
|
|
2301
2301
|
])
|
|
2302
2302
|
]),
|
|
2303
2303
|
R("div", {
|
|
2304
|
-
class:
|
|
2304
|
+
class: V(["tr-sender-actions-inline", { "has-content": A(o) || A(s) }])
|
|
2305
2305
|
}, [
|
|
2306
|
-
A(i) && A(n) ? (w(),
|
|
2307
|
-
|
|
2306
|
+
A(i) && A(n) ? (w(), U(A(Ke), { key: 0 })) : N("", !0),
|
|
2307
|
+
Y(A(qe), null, me({ _: 2 }, [
|
|
2308
2308
|
r.$slots["actions-inline"] ? {
|
|
2309
2309
|
name: "prepend",
|
|
2310
2310
|
fn: B(() => [
|
|
2311
|
-
O(r.$slots, "actions-inline",
|
|
2311
|
+
O(r.$slots, "actions-inline", z(F(A(a))), void 0, !0)
|
|
2312
2312
|
]),
|
|
2313
2313
|
key: "0"
|
|
2314
2314
|
} : void 0
|
|
@@ -2317,24 +2317,24 @@ const On = { class: "tr-sender-editor-scroll" }, In = /* @__PURE__ */ G({
|
|
|
2317
2317
|
])
|
|
2318
2318
|
]));
|
|
2319
2319
|
}
|
|
2320
|
-
}), Hn = /* @__PURE__ */
|
|
2320
|
+
}), Hn = /* @__PURE__ */ Z(Nn, [["__scopeId", "data-v-7b0a576c"]]), Wn = {
|
|
2321
2321
|
key: 0,
|
|
2322
2322
|
class: "tr-sender-footer"
|
|
2323
|
-
}, zn = { class: "tr-sender-footer-left" }, Fn = { class: "tr-sender-footer-right" }, Vn = /* @__PURE__ */
|
|
2323
|
+
}, zn = { class: "tr-sender-footer-left" }, Fn = { class: "tr-sender-footer-right" }, Vn = /* @__PURE__ */ X({
|
|
2324
2324
|
__name: "index",
|
|
2325
2325
|
setup(e) {
|
|
2326
2326
|
const { mode: t, showWordLimit: o, maxLength: s } = ue(), i = Pe();
|
|
2327
2327
|
return (n, a) => A(t) === "multiple" ? (w(), P("div", Wn, [
|
|
2328
2328
|
R("div", zn, [
|
|
2329
|
-
O(n.$slots, "footer",
|
|
2329
|
+
O(n.$slots, "footer", z(F(A(i))), void 0, !0)
|
|
2330
2330
|
]),
|
|
2331
2331
|
R("div", Fn, [
|
|
2332
|
-
A(o) && A(s) ? (w(),
|
|
2333
|
-
|
|
2332
|
+
A(o) && A(s) ? (w(), U(A(Ke), { key: 0 })) : N("", !0),
|
|
2333
|
+
Y(A(qe), null, me({ _: 2 }, [
|
|
2334
2334
|
n.$slots["footer-right"] ? {
|
|
2335
2335
|
name: "prepend",
|
|
2336
2336
|
fn: B(() => [
|
|
2337
|
-
O(n.$slots, "footer-right",
|
|
2337
|
+
O(n.$slots, "footer-right", z(F(A(i))), void 0, !0)
|
|
2338
2338
|
]),
|
|
2339
2339
|
key: "0"
|
|
2340
2340
|
} : void 0
|
|
@@ -2342,13 +2342,13 @@ const On = { class: "tr-sender-editor-scroll" }, In = /* @__PURE__ */ G({
|
|
|
2342
2342
|
])
|
|
2343
2343
|
])) : N("", !0);
|
|
2344
2344
|
}
|
|
2345
|
-
}), Gn = /* @__PURE__ */
|
|
2345
|
+
}), Gn = /* @__PURE__ */ Z(Vn, [["__scopeId", "data-v-ffcdce27"]]), Un = { class: "tr-sender-multi-layout" }, Xn = {
|
|
2346
2346
|
key: 0,
|
|
2347
2347
|
class: "tr-sender-header"
|
|
2348
2348
|
}, Zn = { class: "tr-sender-main" }, Yn = {
|
|
2349
2349
|
key: 0,
|
|
2350
2350
|
class: "tr-sender-prefix"
|
|
2351
|
-
}, Jn = { class: "tr-sender-content" }, Qn = /* @__PURE__ */
|
|
2351
|
+
}, Jn = { class: "tr-sender-content" }, Qn = /* @__PURE__ */ X({
|
|
2352
2352
|
__name: "MultiLineLayout",
|
|
2353
2353
|
setup(e) {
|
|
2354
2354
|
const t = ue(), o = Pe();
|
|
@@ -2364,22 +2364,22 @@ const On = { class: "tr-sender-editor-scroll" }, In = /* @__PURE__ */ G({
|
|
|
2364
2364
|
O(s.$slots, "content", {
|
|
2365
2365
|
editor: A(t).editor
|
|
2366
2366
|
}, () => [
|
|
2367
|
-
|
|
2367
|
+
Y(nt)
|
|
2368
2368
|
], !0)
|
|
2369
2369
|
])
|
|
2370
2370
|
]),
|
|
2371
|
-
|
|
2371
|
+
Y(Gn, null, {
|
|
2372
2372
|
footer: B(() => [
|
|
2373
|
-
O(s.$slots, "footer",
|
|
2373
|
+
O(s.$slots, "footer", z(F(A(o))), void 0, !0)
|
|
2374
2374
|
]),
|
|
2375
2375
|
"footer-right": B(() => [
|
|
2376
|
-
O(s.$slots, "footer-right",
|
|
2376
|
+
O(s.$slots, "footer-right", z(F(A(o))), void 0, !0)
|
|
2377
2377
|
]),
|
|
2378
2378
|
_: 3
|
|
2379
2379
|
})
|
|
2380
2380
|
]));
|
|
2381
2381
|
}
|
|
2382
|
-
}), eo = /* @__PURE__ */
|
|
2382
|
+
}), eo = /* @__PURE__ */ Z(Qn, [["__scopeId", "data-v-0b507198"]]), to = /* @__PURE__ */ X({
|
|
2383
2383
|
__name: "index",
|
|
2384
2384
|
props: {
|
|
2385
2385
|
modelValue: {},
|
|
@@ -2405,7 +2405,7 @@ const On = { class: "tr-sender-editor-scroll" }, In = /* @__PURE__ */ G({
|
|
|
2405
2405
|
setup(e, { expose: t, emit: o }) {
|
|
2406
2406
|
const s = e, i = o, { context: n, expose: a } = Dn(s, i);
|
|
2407
2407
|
return t(a), (r, l) => (w(), P("div", {
|
|
2408
|
-
class:
|
|
2408
|
+
class: V([
|
|
2409
2409
|
"tr-sender",
|
|
2410
2410
|
`tr-sender--${A(n).mode.value}`,
|
|
2411
2411
|
`tr-sender--${A(n).size.value}`,
|
|
@@ -2415,7 +2415,7 @@ const On = { class: "tr-sender-editor-scroll" }, In = /* @__PURE__ */ G({
|
|
|
2415
2415
|
}
|
|
2416
2416
|
])
|
|
2417
2417
|
}, [
|
|
2418
|
-
A(n).mode.value === "single" ? (w(),
|
|
2418
|
+
A(n).mode.value === "single" ? (w(), U(Hn, { key: 0 }, me({ _: 2 }, [
|
|
2419
2419
|
r.$slots.header ? {
|
|
2420
2420
|
name: "header",
|
|
2421
2421
|
fn: B(() => [
|
|
@@ -2433,18 +2433,18 @@ const On = { class: "tr-sender-editor-scroll" }, In = /* @__PURE__ */ G({
|
|
|
2433
2433
|
r.$slots.content ? {
|
|
2434
2434
|
name: "content",
|
|
2435
2435
|
fn: B((u) => [
|
|
2436
|
-
O(r.$slots, "content",
|
|
2436
|
+
O(r.$slots, "content", z(F(u)), void 0, !0)
|
|
2437
2437
|
]),
|
|
2438
2438
|
key: "2"
|
|
2439
2439
|
} : void 0,
|
|
2440
2440
|
r.$slots["actions-inline"] ? {
|
|
2441
2441
|
name: "actions-inline",
|
|
2442
|
-
fn: B(() => [
|
|
2443
|
-
O(r.$slots, "actions-inline",
|
|
2442
|
+
fn: B((u) => [
|
|
2443
|
+
O(r.$slots, "actions-inline", z(F(u)), void 0, !0)
|
|
2444
2444
|
]),
|
|
2445
2445
|
key: "3"
|
|
2446
2446
|
} : void 0
|
|
2447
|
-
]), 1024)) : (w(),
|
|
2447
|
+
]), 1024)) : (w(), U(eo, { key: 1 }, me({ _: 2 }, [
|
|
2448
2448
|
r.$slots.header ? {
|
|
2449
2449
|
name: "header",
|
|
2450
2450
|
fn: B(() => [
|
|
@@ -2462,28 +2462,28 @@ const On = { class: "tr-sender-editor-scroll" }, In = /* @__PURE__ */ G({
|
|
|
2462
2462
|
r.$slots.content ? {
|
|
2463
2463
|
name: "content",
|
|
2464
2464
|
fn: B((u) => [
|
|
2465
|
-
O(r.$slots, "content",
|
|
2465
|
+
O(r.$slots, "content", z(F(u)), void 0, !0)
|
|
2466
2466
|
]),
|
|
2467
2467
|
key: "2"
|
|
2468
2468
|
} : void 0,
|
|
2469
2469
|
r.$slots.footer ? {
|
|
2470
2470
|
name: "footer",
|
|
2471
|
-
fn: B(() => [
|
|
2472
|
-
O(r.$slots, "footer",
|
|
2471
|
+
fn: B((u) => [
|
|
2472
|
+
O(r.$slots, "footer", z(F(u)), void 0, !0)
|
|
2473
2473
|
]),
|
|
2474
2474
|
key: "3"
|
|
2475
2475
|
} : void 0,
|
|
2476
2476
|
r.$slots["footer-right"] ? {
|
|
2477
2477
|
name: "footer-right",
|
|
2478
|
-
fn: B(() => [
|
|
2479
|
-
O(r.$slots, "footer-right",
|
|
2478
|
+
fn: B((u) => [
|
|
2479
|
+
O(r.$slots, "footer-right", z(F(u)), void 0, !0)
|
|
2480
2480
|
]),
|
|
2481
2481
|
key: "4"
|
|
2482
2482
|
} : void 0
|
|
2483
2483
|
]), 1024))
|
|
2484
2484
|
], 2));
|
|
2485
2485
|
}
|
|
2486
|
-
}), xe = /* @__PURE__ */
|
|
2486
|
+
}), xe = /* @__PURE__ */ Z(to, [["__scopeId", "data-v-796349fa"]]);
|
|
2487
2487
|
xe.name = "TrSender";
|
|
2488
2488
|
const no = function(e) {
|
|
2489
2489
|
e.component(xe.name, xe);
|