tuikit-atomicx-vue3 4.5.0 → 4.5.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/{PopoverTrigger-L8abAry7.js → PopoverPortal-DghpKKm8.js} +91 -136
- package/dist/PopoverTrigger-BajjNkGO.js +54 -0
- package/dist/{PopperContent-XdhqL8Y2.js → PopperContent-SLoFuK7k.js} +6 -6
- package/dist/{Teleport-CSEuZbpM.js → Teleport-DFrneqLM.js} +4 -4
- package/dist/baseComp/Modal/Modal.js +3 -3
- package/dist/components/BarrageInput/EmojiPicker/EmojiPicker.js +10 -9
- package/dist/components/BarrageInput/TextEditor/CharacterCountExtension.js +1 -1
- package/dist/components/BarrageInput/TextEditor/EditorCore.js +16 -15
- package/dist/components/ConversationList/ConversationPreview/ConversationPreviewAbstract.js +62 -40
- package/dist/components/ConversationList/ConversationPreview/ConversationPreviewTimestamp.js +29 -27
- package/dist/components/ConversationList/ConversationPreview/ConversationPreviewTitle.js +27 -23
- package/dist/components/ConversationList/ConversationPreview/ConversationPreviewTitle.vue.d.ts +1 -1
- package/dist/components/ConversationList/ConversationPreview/ConversationPreviewUI.js +67 -65
- package/dist/components/ConversationList/ConversationPreview/ConversationPreviewUnread.js +32 -30
- package/dist/components/ConversationList/ConversationPreview/utils.d.ts +2 -2
- package/dist/components/ConversationList/ConversationPreview/utils.js +81 -35
- package/dist/components/ConversationList/i18n/en-US.d.ts +10 -1
- package/dist/components/ConversationList/i18n/en-US.js +11 -2
- package/dist/components/ConversationList/i18n/zh-CN.d.ts +10 -1
- package/dist/components/ConversationList/i18n/zh-CN.js +11 -2
- package/dist/components/LiveScenePanel/index.js +10 -9
- package/dist/components/MessageInput/AttachmentPicker/index.js +10 -9
- package/dist/components/MessageInput/EmojiPicker/EmojiPicker.js +17 -16
- package/dist/components/MessageInput/QuotedMessagePreview/index.js +35 -35
- package/dist/components/MessageInput/TextEditor/EditorCore.d.ts +13 -12
- package/dist/components/MessageInput/TextEditor/EditorCore.js +54 -89
- package/dist/components/MessageInput/TextEditor/extensions/MentionSuggestion.js +229 -0
- package/dist/components/MessageInput/TextEditor/extensions/MentionSuggestion.vue.d.ts +15 -0
- package/dist/components/MessageInput/TextEditor/extensions/characterCountExtension.js +1 -1
- package/dist/components/MessageInput/TextEditor/extensions/emojiExtension.d.ts +1 -0
- package/dist/components/MessageInput/TextEditor/extensions/emojiExtension.js +22 -0
- package/dist/components/MessageInput/TextEditor/extensions/enterKeyExtension.d.ts +3 -0
- package/dist/components/MessageInput/TextEditor/extensions/enterKeyExtension.js +15 -0
- package/dist/components/MessageInput/TextEditor/extensions/imageExtension.js +2 -2
- package/dist/components/MessageInput/TextEditor/extensions/index.d.ts +8 -0
- package/dist/components/MessageInput/TextEditor/extensions/index.js +12 -0
- package/dist/components/MessageInput/TextEditor/extensions/mentionExtension.d.ts +5 -0
- package/dist/components/MessageInput/TextEditor/extensions/mentionExtension.js +330 -0
- package/dist/components/MessageInput/TextEditor/index.js +62 -62
- package/dist/components/MessageInput/i18n/en-US.d.ts +3 -0
- package/dist/components/MessageInput/i18n/en-US.js +4 -1
- package/dist/components/MessageInput/i18n/index.d.ts +6 -0
- package/dist/components/MessageInput/i18n/zh-CN.d.ts +3 -0
- package/dist/components/MessageInput/i18n/zh-CN.js +4 -1
- package/dist/components/MessageList/Message/ImageMessage/ImageMessage.js +119 -89
- package/dist/components/MessageList/Message/ImageMessage/ImagePreview.js +142 -0
- package/dist/components/MessageList/Message/ImageMessage/ImagePreview.vue.d.ts +20 -0
- package/dist/components/MessageList/Message/Message.vue.d.ts +8 -0
- package/dist/components/MessageList/Message/MessageLayout/MessageActionDropdown/MessageActionDropdown.js +3 -3
- package/dist/components/MessageList/Message/MessageLayout/MessageLayout.js +69 -58
- package/dist/components/MessageList/Message/MessageLayout/MessageLayout.vue.d.ts +8 -0
- package/dist/components/MessageList/Message/index.js +8 -4
- package/dist/components/MessageList/MessageList.js +98 -90
- package/dist/components/MessageList/MessageList.vue.d.ts +1 -1
- package/dist/components/MessageList/index.d.ts +21 -3
- package/dist/components/Search/SearchResults/SearchResultsItem/Message/Message.js +6 -6
- package/dist/components/Search/SearchResults/SearchResultsItem/Message/Message.vue.d.ts +1 -1
- package/dist/index-BvFYOUyz.js +2936 -0
- package/dist/{index-Do-2CngU.js → index-C8Jw_xE4.js} +1621 -1731
- package/dist/{index-7vNB_Vx8.js → index-CiYL_XsE.js} +1 -1
- package/dist/index-CzCDLp99.js +2174 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +103 -103
- package/dist/states/MessageActionState/MessageActionState.js +83 -223
- package/dist/states/MessageInputState/MessageInputState.js +115 -83
- package/dist/states/MessageInputState/type.d.ts +36 -10
- package/dist/states/MessageInputState/utils.d.ts +1 -5
- package/dist/states/MessageListState/MessageListState.d.ts +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/{chat/index.d.ts → subEntry/chat/chat.d.ts} +2112 -2087
- package/dist/subEntry/chat/chat.js +89 -0
- package/dist/subEntry/chat/index.d.ts +11 -0
- package/dist/subEntry/chat/index.js +81 -0
- package/dist/{chat → subEntry/chat}/server.js +4 -4
- package/dist/{useId-CtirfF0W.js → useId-D5WE76CM.js} +1 -1
- package/dist/{utils-DaB7eSu5.js → utils-CttDpxqz.js} +1 -1
- package/package.json +8 -6
- package/src/components/ConversationList/ConversationPreview/ConversationPreview.scss +8 -0
- package/src/components/ConversationList/ConversationPreview/ConversationPreviewAbstract.vue +32 -1
- package/src/components/ConversationList/ConversationPreview/ConversationPreviewTitle.vue +3 -2
- package/src/components/ConversationList/ConversationPreview/utils.ts +98 -28
- package/src/components/ConversationList/i18n/en-US.ts +10 -1
- package/src/components/ConversationList/i18n/zh-CN.ts +10 -1
- package/src/components/LiveScenePanel/index.vue +1 -0
- package/src/components/MessageInput/QuotedMessagePreview/QuotedMessagePreview.vue +19 -22
- package/src/components/MessageInput/TextEditor/Editor.scss +25 -0
- package/src/components/MessageInput/TextEditor/EditorCore.ts +79 -99
- package/src/components/MessageInput/TextEditor/TextEditor.vue +64 -68
- package/src/components/MessageInput/TextEditor/extensions/MentionSuggestion.vue +449 -0
- package/src/components/MessageInput/TextEditor/extensions/emojiExtension.ts +22 -0
- package/src/components/MessageInput/TextEditor/extensions/enterKeyExtension.ts +22 -0
- package/src/components/MessageInput/TextEditor/extensions/index.ts +8 -0
- package/src/components/MessageInput/TextEditor/extensions/mentionExtension.ts +87 -0
- package/src/components/MessageInput/i18n/en-US.ts +3 -0
- package/src/components/MessageInput/i18n/zh-CN.ts +3 -0
- package/src/components/MessageList/Message/ImageMessage/ImageMessage.vue +49 -0
- package/src/components/MessageList/Message/ImageMessage/ImagePreview.vue +344 -0
- package/src/components/MessageList/Message/Message.vue +6 -0
- package/src/components/MessageList/Message/MessageLayout/MessageLayout.vue +8 -1
- package/src/components/MessageList/MessageList.vue +36 -14
- package/src/components/Search/SearchResults/SearchResultsItem/Message/Message.vue +30 -31
- package/src/index.ts +1 -1
- package/src/{chat/index.ts → subEntry/chat/chat.ts} +25 -18
- package/src/subEntry/chat/index.ts +13 -0
- package/src/{chat → subEntry/chat}/server.ts +3 -3
- package/dist/chat/index.js +0 -59
- package/dist/index-ZILx4LYk.js +0 -4826
- package/dist/states/SearchState.d.ts +0 -314
- /package/dist/{chat → subEntry/chat}/server.d.ts +0 -0
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { P as V, a as K, D as F, b as G, e as z, N as j, c as J, m as q } from "../../../../index-C8Jw_xE4.js";
|
|
2
|
+
import { V as Q } from "../../../../index-CzCDLp99.js";
|
|
3
|
+
import { ConversationType as X } from "../../../../types/engine.js";
|
|
4
|
+
import Y from "./MentionSuggestion.js";
|
|
5
|
+
import { useGroupSettingState as Z } from "../../../../states/GroupSettingState/GroupSettingState.js";
|
|
6
|
+
import { GroupType as ee } from "../../../../states/GroupSettingState/types.js";
|
|
7
|
+
import { useConversationListState as te } from "../../../../states/ConversationListState/ConversationListState.js";
|
|
8
|
+
function ne(e) {
|
|
9
|
+
var t;
|
|
10
|
+
const { char: n, allowSpaces: o, allowToIncludeChar: r, allowedPrefixes: a, startOfLine: m, $position: l } = e, u = o && !r, c = z(n), S = new RegExp(`\\s${c}$`), x = m ? "^" : "", $ = r ? "" : c, B = u ? new RegExp(`${x}${c}.*?(?=\\s${$}|$)`, "gm") : new RegExp(`${x}(?:^)?${c}[^\\s${$}]*`, "gm"), h = ((t = l.nodeBefore) === null || t === void 0 ? void 0 : t.isText) && l.nodeBefore.text;
|
|
11
|
+
if (!h)
|
|
12
|
+
return null;
|
|
13
|
+
const i = l.pos - h.length, g = Array.from(h.matchAll(B)).pop();
|
|
14
|
+
if (!g || g.input === void 0 || g.index === void 0)
|
|
15
|
+
return null;
|
|
16
|
+
const d = g.input.slice(Math.max(0, g.index - 1), g.index), f = new RegExp(`^[${a == null ? void 0 : a.join("")}\0]?$`).test(d);
|
|
17
|
+
if (a !== null && !f)
|
|
18
|
+
return null;
|
|
19
|
+
const p = i + g.index;
|
|
20
|
+
let v = p + g[0].length;
|
|
21
|
+
return u && S.test(h.slice(v - 1, v + 1)) && (g[0] += " ", v += 1), p < l.pos && v >= l.pos ? {
|
|
22
|
+
range: {
|
|
23
|
+
from: p,
|
|
24
|
+
to: v
|
|
25
|
+
},
|
|
26
|
+
query: g[0].slice(n.length),
|
|
27
|
+
text: g[0]
|
|
28
|
+
} : null;
|
|
29
|
+
}
|
|
30
|
+
const oe = new K("suggestion");
|
|
31
|
+
function ie({ pluginKey: e = oe, editor: t, char: n = "@", allowSpaces: o = !1, allowToIncludeChar: r = !1, allowedPrefixes: a = [" "], startOfLine: m = !1, decorationTag: l = "span", decorationClass: u = "suggestion", command: c = () => null, items: S = () => [], render: x = () => ({}), allow: $ = () => !0, findSuggestionMatch: B = ne }) {
|
|
32
|
+
let h;
|
|
33
|
+
const i = x == null ? void 0 : x(), g = new V({
|
|
34
|
+
key: e,
|
|
35
|
+
view() {
|
|
36
|
+
return {
|
|
37
|
+
update: async (d, f) => {
|
|
38
|
+
var p, v, T, b, w, A, M;
|
|
39
|
+
const s = (p = this.key) === null || p === void 0 ? void 0 : p.getState(f), y = (v = this.key) === null || v === void 0 ? void 0 : v.getState(d.state), C = s.active && y.active && s.range.from !== y.range.from, R = !s.active && y.active, D = s.active && !y.active, P = !R && !D && s.query !== y.query, _ = R || C && P, E = P || C, k = D || C && P;
|
|
40
|
+
if (!_ && !E && !k)
|
|
41
|
+
return;
|
|
42
|
+
const L = k && !_ ? s : y, N = d.dom.querySelector(`[data-decoration-id="${L.decorationId}"]`);
|
|
43
|
+
h = {
|
|
44
|
+
editor: t,
|
|
45
|
+
range: L.range,
|
|
46
|
+
query: L.query,
|
|
47
|
+
text: L.text,
|
|
48
|
+
items: [],
|
|
49
|
+
command: (H) => c({
|
|
50
|
+
editor: t,
|
|
51
|
+
range: L.range,
|
|
52
|
+
props: H
|
|
53
|
+
}),
|
|
54
|
+
decorationNode: N,
|
|
55
|
+
// virtual node for popper.js or tippy.js
|
|
56
|
+
// this can be used for building popups without a DOM node
|
|
57
|
+
clientRect: N ? () => {
|
|
58
|
+
var H;
|
|
59
|
+
const { decorationId: U } = (H = this.key) === null || H === void 0 ? void 0 : H.getState(t.state), I = d.dom.querySelector(`[data-decoration-id="${U}"]`);
|
|
60
|
+
return (I == null ? void 0 : I.getBoundingClientRect()) || null;
|
|
61
|
+
} : null
|
|
62
|
+
}, _ && ((T = i == null ? void 0 : i.onBeforeStart) === null || T === void 0 || T.call(i, h)), E && ((b = i == null ? void 0 : i.onBeforeUpdate) === null || b === void 0 || b.call(i, h)), (E || _) && (h.items = await S({
|
|
63
|
+
editor: t,
|
|
64
|
+
query: L.query
|
|
65
|
+
})), k && ((w = i == null ? void 0 : i.onExit) === null || w === void 0 || w.call(i, h)), E && ((A = i == null ? void 0 : i.onUpdate) === null || A === void 0 || A.call(i, h)), _ && ((M = i == null ? void 0 : i.onStart) === null || M === void 0 || M.call(i, h));
|
|
66
|
+
},
|
|
67
|
+
destroy: () => {
|
|
68
|
+
var d;
|
|
69
|
+
h && ((d = i == null ? void 0 : i.onExit) === null || d === void 0 || d.call(i, h));
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
state: {
|
|
74
|
+
// Initialize the plugin's internal state.
|
|
75
|
+
init() {
|
|
76
|
+
return {
|
|
77
|
+
active: !1,
|
|
78
|
+
range: {
|
|
79
|
+
from: 0,
|
|
80
|
+
to: 0
|
|
81
|
+
},
|
|
82
|
+
query: null,
|
|
83
|
+
text: null,
|
|
84
|
+
composing: !1
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
// Apply changes to the plugin state from a view transaction.
|
|
88
|
+
apply(d, f, p, v) {
|
|
89
|
+
const { isEditable: T } = t, { composing: b } = t.view, { selection: w } = d, { empty: A, from: M } = w, s = { ...f };
|
|
90
|
+
if (s.composing = b, T && (A || t.view.composing)) {
|
|
91
|
+
(M < f.range.from || M > f.range.to) && !b && !f.composing && (s.active = !1);
|
|
92
|
+
const y = B({
|
|
93
|
+
char: n,
|
|
94
|
+
allowSpaces: o,
|
|
95
|
+
allowToIncludeChar: r,
|
|
96
|
+
allowedPrefixes: a,
|
|
97
|
+
startOfLine: m,
|
|
98
|
+
$position: w.$from
|
|
99
|
+
}), C = `id_${Math.floor(Math.random() * 4294967295)}`;
|
|
100
|
+
y && $({
|
|
101
|
+
editor: t,
|
|
102
|
+
state: v,
|
|
103
|
+
range: y.range,
|
|
104
|
+
isActive: f.active
|
|
105
|
+
}) ? (s.active = !0, s.decorationId = f.decorationId ? f.decorationId : C, s.range = y.range, s.query = y.query, s.text = y.text) : s.active = !1;
|
|
106
|
+
} else
|
|
107
|
+
s.active = !1;
|
|
108
|
+
return s.active || (s.decorationId = null, s.range = { from: 0, to: 0 }, s.query = null, s.text = null), s;
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
props: {
|
|
112
|
+
// Call the keydown hook if suggestion is active.
|
|
113
|
+
handleKeyDown(d, f) {
|
|
114
|
+
var p;
|
|
115
|
+
const { active: v, range: T } = g.getState(d.state);
|
|
116
|
+
return v && ((p = i == null ? void 0 : i.onKeyDown) === null || p === void 0 ? void 0 : p.call(i, { view: d, event: f, range: T })) || !1;
|
|
117
|
+
},
|
|
118
|
+
// Setup decorator on the currently active suggestion.
|
|
119
|
+
decorations(d) {
|
|
120
|
+
const { active: f, range: p, decorationId: v } = g.getState(d);
|
|
121
|
+
return f ? F.create(d.doc, [
|
|
122
|
+
G.inline(p.from, p.to, {
|
|
123
|
+
nodeName: l,
|
|
124
|
+
class: u,
|
|
125
|
+
"data-decoration-id": v
|
|
126
|
+
})
|
|
127
|
+
]) : null;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
return g;
|
|
132
|
+
}
|
|
133
|
+
function re({ editor: e, overrideSuggestionOptions: t, extensionName: n, char: o = "@" }) {
|
|
134
|
+
const r = new K();
|
|
135
|
+
return {
|
|
136
|
+
editor: e,
|
|
137
|
+
char: o,
|
|
138
|
+
pluginKey: r,
|
|
139
|
+
command: ({ editor: a, range: m, props: l }) => {
|
|
140
|
+
var u, c, S;
|
|
141
|
+
const x = a.view.state.selection.$to.nodeAfter;
|
|
142
|
+
((u = x == null ? void 0 : x.text) === null || u === void 0 ? void 0 : u.startsWith(" ")) && (m.to += 1), a.chain().focus().insertContentAt(m, [
|
|
143
|
+
{
|
|
144
|
+
type: n,
|
|
145
|
+
attrs: { ...l, mentionSuggestionChar: o }
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
type: "text",
|
|
149
|
+
text: " "
|
|
150
|
+
}
|
|
151
|
+
]).run(), (S = (c = a.view.dom.ownerDocument.defaultView) === null || c === void 0 ? void 0 : c.getSelection()) === null || S === void 0 || S.collapseToEnd();
|
|
152
|
+
},
|
|
153
|
+
allow: ({ state: a, range: m }) => {
|
|
154
|
+
const l = a.doc.resolve(m.from), u = a.schema.nodes[n];
|
|
155
|
+
return !!l.parent.type.contentMatch.matchType(u);
|
|
156
|
+
},
|
|
157
|
+
...t
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function W(e) {
|
|
161
|
+
return (e.options.suggestions.length ? e.options.suggestions : [e.options.suggestion]).map((t) => re({
|
|
162
|
+
// @ts-ignore `editor` can be `undefined` when converting the document to HTML with the HTML utility
|
|
163
|
+
editor: e.editor,
|
|
164
|
+
overrideSuggestionOptions: t,
|
|
165
|
+
extensionName: e.name,
|
|
166
|
+
char: t.char
|
|
167
|
+
}));
|
|
168
|
+
}
|
|
169
|
+
function O(e, t) {
|
|
170
|
+
const n = W(e), o = n.find((r) => r.char === t);
|
|
171
|
+
return o || (n.length ? n[0] : null);
|
|
172
|
+
}
|
|
173
|
+
const ae = j.create({
|
|
174
|
+
name: "mention",
|
|
175
|
+
priority: 101,
|
|
176
|
+
addOptions() {
|
|
177
|
+
return {
|
|
178
|
+
HTMLAttributes: {},
|
|
179
|
+
renderText({ node: e, suggestion: t }) {
|
|
180
|
+
var n, o;
|
|
181
|
+
return `${(n = t == null ? void 0 : t.char) !== null && n !== void 0 ? n : "@"}${(o = e.attrs.label) !== null && o !== void 0 ? o : e.attrs.id}`;
|
|
182
|
+
},
|
|
183
|
+
deleteTriggerWithBackspace: !1,
|
|
184
|
+
renderHTML({ options: e, node: t, suggestion: n }) {
|
|
185
|
+
var o, r;
|
|
186
|
+
return [
|
|
187
|
+
"span",
|
|
188
|
+
q(this.HTMLAttributes, e.HTMLAttributes),
|
|
189
|
+
`${(o = n == null ? void 0 : n.char) !== null && o !== void 0 ? o : "@"}${(r = t.attrs.label) !== null && r !== void 0 ? r : t.attrs.id}`
|
|
190
|
+
];
|
|
191
|
+
},
|
|
192
|
+
suggestions: [],
|
|
193
|
+
suggestion: {}
|
|
194
|
+
};
|
|
195
|
+
},
|
|
196
|
+
group: "inline",
|
|
197
|
+
inline: !0,
|
|
198
|
+
selectable: !1,
|
|
199
|
+
atom: !0,
|
|
200
|
+
addAttributes() {
|
|
201
|
+
return {
|
|
202
|
+
id: {
|
|
203
|
+
default: null,
|
|
204
|
+
parseHTML: (e) => e.getAttribute("data-id"),
|
|
205
|
+
renderHTML: (e) => e.id ? {
|
|
206
|
+
"data-id": e.id
|
|
207
|
+
} : {}
|
|
208
|
+
},
|
|
209
|
+
label: {
|
|
210
|
+
default: null,
|
|
211
|
+
parseHTML: (e) => e.getAttribute("data-label"),
|
|
212
|
+
renderHTML: (e) => e.label ? {
|
|
213
|
+
"data-label": e.label
|
|
214
|
+
} : {}
|
|
215
|
+
},
|
|
216
|
+
// When there are multiple types of mentions, this attribute helps distinguish them
|
|
217
|
+
mentionSuggestionChar: {
|
|
218
|
+
default: "@",
|
|
219
|
+
parseHTML: (e) => e.getAttribute("data-mention-suggestion-char"),
|
|
220
|
+
renderHTML: (e) => ({
|
|
221
|
+
"data-mention-suggestion-char": e.mentionSuggestionChar
|
|
222
|
+
})
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
},
|
|
226
|
+
parseHTML() {
|
|
227
|
+
return [
|
|
228
|
+
{
|
|
229
|
+
tag: `span[data-type="${this.name}"]`
|
|
230
|
+
}
|
|
231
|
+
];
|
|
232
|
+
},
|
|
233
|
+
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
234
|
+
const n = O(this, e.attrs.mentionSuggestionChar);
|
|
235
|
+
if (this.options.renderLabel !== void 0)
|
|
236
|
+
return console.warn("renderLabel is deprecated use renderText and renderHTML instead"), [
|
|
237
|
+
"span",
|
|
238
|
+
q({ "data-type": this.name }, this.options.HTMLAttributes, t),
|
|
239
|
+
this.options.renderLabel({
|
|
240
|
+
options: this.options,
|
|
241
|
+
node: e,
|
|
242
|
+
suggestion: n
|
|
243
|
+
})
|
|
244
|
+
];
|
|
245
|
+
const o = { ...this.options };
|
|
246
|
+
o.HTMLAttributes = q({ "data-type": this.name }, this.options.HTMLAttributes, t);
|
|
247
|
+
const r = this.options.renderHTML({
|
|
248
|
+
options: o,
|
|
249
|
+
node: e,
|
|
250
|
+
suggestion: n
|
|
251
|
+
});
|
|
252
|
+
return typeof r == "string" ? [
|
|
253
|
+
"span",
|
|
254
|
+
q({ "data-type": this.name }, this.options.HTMLAttributes, t),
|
|
255
|
+
r
|
|
256
|
+
] : r;
|
|
257
|
+
},
|
|
258
|
+
renderText({ node: e }) {
|
|
259
|
+
const t = {
|
|
260
|
+
options: this.options,
|
|
261
|
+
node: e,
|
|
262
|
+
suggestion: O(this, e.attrs.mentionSuggestionChar)
|
|
263
|
+
};
|
|
264
|
+
return this.options.renderLabel !== void 0 ? (console.warn("renderLabel is deprecated use renderText and renderHTML instead"), this.options.renderLabel(t)) : this.options.renderText(t);
|
|
265
|
+
},
|
|
266
|
+
addKeyboardShortcuts() {
|
|
267
|
+
return {
|
|
268
|
+
Backspace: () => this.editor.commands.command(({ tr: e, state: t }) => {
|
|
269
|
+
let n = !1;
|
|
270
|
+
const { selection: o } = t, { empty: r, anchor: a } = o;
|
|
271
|
+
if (!r)
|
|
272
|
+
return !1;
|
|
273
|
+
t.doc.nodesBetween(a - 1, a, (u, c) => {
|
|
274
|
+
if (u.type.name === this.name)
|
|
275
|
+
return n = !0, e.insertText(this.options.deleteTriggerWithBackspace ? "" : this.options.suggestion.char || "", c, c + u.nodeSize), !1;
|
|
276
|
+
});
|
|
277
|
+
let m = new J(), l = 0;
|
|
278
|
+
return t.doc.nodesBetween(a - 1, a, (u, c) => {
|
|
279
|
+
if (u.type.name === this.name)
|
|
280
|
+
return n = !0, m = u, l = c, !1;
|
|
281
|
+
}), n && e.insertText(this.options.deleteTriggerWithBackspace ? "" : m.attrs.mentionSuggestionChar, l, l + m.nodeSize), n;
|
|
282
|
+
})
|
|
283
|
+
};
|
|
284
|
+
},
|
|
285
|
+
addProseMirrorPlugins() {
|
|
286
|
+
return W(this).map(ie);
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
function pe() {
|
|
290
|
+
return ae.configure({
|
|
291
|
+
deleteTriggerWithBackspace: !0,
|
|
292
|
+
HTMLAttributes: {
|
|
293
|
+
class: "uikit-message-input-mention-tag"
|
|
294
|
+
},
|
|
295
|
+
suggestion: {
|
|
296
|
+
char: "@",
|
|
297
|
+
// Items are now managed inside the component via GroupSettingState
|
|
298
|
+
items: () => [],
|
|
299
|
+
render: () => {
|
|
300
|
+
let e = null, t = null;
|
|
301
|
+
const n = () => {
|
|
302
|
+
t != null && t.parentNode && t.parentNode.removeChild(t), e == null || e.destroy(), e = null, t = null;
|
|
303
|
+
};
|
|
304
|
+
return {
|
|
305
|
+
onStart: (o) => {
|
|
306
|
+
var l;
|
|
307
|
+
const { activeConversation: r } = te(), { memberCount: a, groupType: m } = Z();
|
|
308
|
+
((l = r.value) == null ? void 0 : l.type) === X.GROUP && a.value && a.value > 1 && m.value !== ee.AVCHATROOM && (e = new Q(Y, {
|
|
309
|
+
props: o,
|
|
310
|
+
editor: o.editor
|
|
311
|
+
}), e.element && (t = e.element, document.body.appendChild(t)));
|
|
312
|
+
},
|
|
313
|
+
onUpdate(o) {
|
|
314
|
+
e == null || e.updateProps(o);
|
|
315
|
+
},
|
|
316
|
+
onKeyDown(o) {
|
|
317
|
+
var r, a;
|
|
318
|
+
return o.event.key === "Escape" ? (n(), !0) : ((a = (r = e == null ? void 0 : e.ref) == null ? void 0 : r.onKeyDown) == null ? void 0 : a.call(r, o)) || !1;
|
|
319
|
+
},
|
|
320
|
+
onExit() {
|
|
321
|
+
n();
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
export {
|
|
329
|
+
pe as createMentionExtension
|
|
330
|
+
};
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useUIKit as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
import { defineComponent as b, computed as I, watch as i, onBeforeUnmount as S, createElementBlock as B, openBlock as L, normalizeClass as r, unref as n, createElementVNode as p, createVNode as M, renderSlot as c } from "vue";
|
|
2
|
+
import { useUIKit as y } from "@tencentcloud/uikit-base-component-vue3";
|
|
3
|
+
import { u as N, a as P } from "../../../index-CzCDLp99.js";
|
|
4
|
+
import { createExtensions as U, convertEditorContent as V } from "./EditorCore.js";
|
|
5
|
+
import { useMessageInputState as k } from "../../../states/MessageInputState/MessageInputState.js";
|
|
6
|
+
import { useConversationListState as w } from "../../../states/ConversationListState/ConversationListState.js";
|
|
7
|
+
const F = "_disabled_ihh75_11", O = "_editor_ihh75_21", s = {
|
|
7
8
|
"input-wrapper": "_input-wrapper_ihh75_1",
|
|
8
|
-
disabled:
|
|
9
|
+
disabled: F,
|
|
9
10
|
"input-prefix": "_input-prefix_ihh75_15",
|
|
10
11
|
"input-suffix": "_input-suffix_ihh75_16",
|
|
11
|
-
editor:
|
|
12
|
-
},
|
|
12
|
+
editor: O
|
|
13
|
+
}, K = /* @__PURE__ */ b({
|
|
13
14
|
__name: "TextEditor",
|
|
14
15
|
props: {
|
|
15
16
|
autoFocus: { type: Boolean, default: !0 },
|
|
@@ -17,67 +18,66 @@ const R = "_disabled_ihh75_11", U = "_editor_ihh75_21", i = {
|
|
|
17
18
|
placeholder: { default: void 0 },
|
|
18
19
|
maxLength: { default: void 0 }
|
|
19
20
|
},
|
|
20
|
-
setup(
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
placeholder:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
onEnter: () => {
|
|
36
|
-
I(), l("");
|
|
37
|
-
},
|
|
38
|
-
onFocus: () => {
|
|
39
|
-
p.value = !0;
|
|
40
|
-
},
|
|
41
|
-
onBlur: () => {
|
|
42
|
-
p.value = !1;
|
|
43
|
-
}
|
|
44
|
-
}), e.dataset.editorCreated = "true", u(a)));
|
|
45
|
-
}), L(() => {
|
|
46
|
-
const e = n.value;
|
|
47
|
-
a && e && (a.destroy(), e.removeAttribute("data-editor-created"), u(null));
|
|
48
|
-
}), r(E, (e, o) => {
|
|
49
|
-
(e == null ? void 0 : e.conversationID) !== (o == null ? void 0 : o.conversationID) && l("");
|
|
50
|
-
}), r(g, () => {
|
|
51
|
-
if (a && t.placeholder === void 0) {
|
|
52
|
-
const e = a.extensionManager.extensions.find(
|
|
53
|
-
(o) => o.name === "placeholder"
|
|
54
|
-
);
|
|
55
|
-
e && (e.options.placeholder = c.value, a.view.updateState(a.state));
|
|
21
|
+
setup(f) {
|
|
22
|
+
const o = f, { t: m, language: h } = y(), { activeConversation: x } = w(), { updateRawValue: _, sendMessage: E, setEditorInstance: d, setContent: l } = k(), u = I(() => o.placeholder ?? m("MessageInput.enter_a_message")), g = () => {
|
|
23
|
+
E(), l("");
|
|
24
|
+
}, a = N({
|
|
25
|
+
autofocus: o.autoFocus,
|
|
26
|
+
editable: !o.disabled,
|
|
27
|
+
extensions: U({
|
|
28
|
+
placeholder: u.value,
|
|
29
|
+
maxLength: o.maxLength,
|
|
30
|
+
showPlaceholderOnlyWhenEditable: o.placeholder === void 0,
|
|
31
|
+
onEnter: g
|
|
32
|
+
}),
|
|
33
|
+
onUpdate: ({ editor: e }) => {
|
|
34
|
+
const t = V(e.getJSON());
|
|
35
|
+
_(t);
|
|
56
36
|
}
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
37
|
+
});
|
|
38
|
+
return i(a, (e) => {
|
|
39
|
+
d(e ?? null);
|
|
40
|
+
}, { immediate: !0 }), i(() => o.disabled, (e) => {
|
|
41
|
+
var t;
|
|
42
|
+
(t = a.value) == null || t.setEditable(!e), e && l("");
|
|
43
|
+
}), i([u, h], () => {
|
|
44
|
+
if (!a.value)
|
|
45
|
+
return;
|
|
46
|
+
const e = a.value.extensionManager.extensions.find(
|
|
47
|
+
(t) => t.name === "placeholder"
|
|
48
|
+
);
|
|
49
|
+
e && (e.options.placeholder = u.value, a.value.view.updateState(a.value.state));
|
|
50
|
+
}), i(() => o.maxLength, (e) => {
|
|
51
|
+
if (!a.value)
|
|
52
|
+
return;
|
|
53
|
+
const t = a.value.extensionManager.extensions.find(
|
|
54
|
+
(v) => v.name === "characterCount"
|
|
55
|
+
);
|
|
56
|
+
t && (t.options.limit = e);
|
|
57
|
+
}), i(x, (e, t) => {
|
|
58
|
+
(e == null ? void 0 : e.conversationID) !== (t == null ? void 0 : t.conversationID) && l("");
|
|
59
|
+
}), S(() => {
|
|
60
|
+
d(null);
|
|
61
|
+
}), (e, t) => (L(), B("div", {
|
|
62
|
+
class: r([n(s)["input-wrapper"], o.disabled && n(s).disabled])
|
|
61
63
|
}, [
|
|
62
|
-
|
|
63
|
-
class:
|
|
64
|
+
p("div", {
|
|
65
|
+
class: r(n(s)["input-prefix"])
|
|
64
66
|
}, [
|
|
65
|
-
|
|
67
|
+
c(e.$slots, "inputPrefix")
|
|
66
68
|
], 2),
|
|
67
|
-
(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
_("div", {
|
|
74
|
-
class: d(s(i)["input-suffix"])
|
|
69
|
+
M(n(P), {
|
|
70
|
+
editor: n(a),
|
|
71
|
+
class: r([n(s).editor, "message-input"])
|
|
72
|
+
}, null, 8, ["editor", "class"]),
|
|
73
|
+
p("div", {
|
|
74
|
+
class: r(n(s)["input-suffix"])
|
|
75
75
|
}, [
|
|
76
|
-
|
|
76
|
+
c(e.$slots, "inputSuffix")
|
|
77
77
|
], 2)
|
|
78
78
|
], 2));
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
81
|
export {
|
|
82
|
-
|
|
82
|
+
K as TextEditor
|
|
83
83
|
};
|
|
@@ -11,7 +11,10 @@ const e = {
|
|
|
11
11
|
select_call_members: "Select call members",
|
|
12
12
|
cancel: "Cancel",
|
|
13
13
|
confirm: "Confirm",
|
|
14
|
-
initiate_call: "Initiate call"
|
|
14
|
+
initiate_call: "Initiate call",
|
|
15
|
+
loading: "Loading...",
|
|
16
|
+
no_matching_members: "No matching members",
|
|
17
|
+
at_all_members: "All members"
|
|
15
18
|
};
|
|
16
19
|
export {
|
|
17
20
|
e as default
|
|
@@ -13,6 +13,9 @@ export declare const resources: {
|
|
|
13
13
|
cancel: string;
|
|
14
14
|
confirm: string;
|
|
15
15
|
initiate_call: string;
|
|
16
|
+
loading: string;
|
|
17
|
+
no_matching_members: string;
|
|
18
|
+
at_all_members: string;
|
|
16
19
|
};
|
|
17
20
|
'zh-CN': {
|
|
18
21
|
file: string;
|
|
@@ -28,5 +31,8 @@ export declare const resources: {
|
|
|
28
31
|
cancel: string;
|
|
29
32
|
confirm: string;
|
|
30
33
|
initiate_call: string;
|
|
34
|
+
loading: string;
|
|
35
|
+
no_matching_members: string;
|
|
36
|
+
at_all_members: string;
|
|
31
37
|
};
|
|
32
38
|
};
|