mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 11:19:56 +00:00
perf: 优化回复消息自动@逻辑
This commit is contained in:
parent
eb7d93af87
commit
7c4c7eea9c
@ -288,6 +288,10 @@ export default {
|
||||
type: String,
|
||||
default: "top"
|
||||
},
|
||||
replyMsgAutoMention: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -1314,7 +1318,22 @@ export default {
|
||||
|
||||
cancelQuote() {
|
||||
if (this.quoteUpdate) {
|
||||
// 取消修改
|
||||
this.$emit('input', '')
|
||||
} else {
|
||||
// 取消回复
|
||||
if (this.$refs.editor.firstChild.querySelectorAll('img').length === 0) {
|
||||
const quoteDiv = document.createElement('div')
|
||||
quoteDiv.innerHTML = this.$refs.editor.firstChild.innerHTML
|
||||
quoteDiv.querySelectorAll("span.mention").forEach(span => {
|
||||
if (span.getAttribute("data-id") == this.quoteData.userid) {
|
||||
span.innerHTML = "";
|
||||
}
|
||||
})
|
||||
if (!quoteDiv.innerText.replace(/\s/g, '')) {
|
||||
this.$emit('input', '')
|
||||
}
|
||||
}
|
||||
}
|
||||
this.setQuote(0)
|
||||
},
|
||||
@ -1323,7 +1342,10 @@ export default {
|
||||
if (this.dialogData.type !== 'group') {
|
||||
return
|
||||
}
|
||||
if (this.quoteUpdate || !this.quoteData) {
|
||||
if (this.quoteUpdate || !this.quoteData || !this.replyMsgAutoMention) {
|
||||
return
|
||||
}
|
||||
if (data.bot && !$A.rightExists(data.email, '@bot.system')) {
|
||||
return
|
||||
}
|
||||
if (this.userId === data.userid || this.quoteData.userid !== data.userid) {
|
||||
|
||||
@ -263,6 +263,7 @@
|
||||
:emoji-bottom="windowPortrait"
|
||||
:maxlength="200000"
|
||||
:placeholder="$L('输入消息...')"
|
||||
:reply-msg-auto-mention="replyMsgAutoMention"
|
||||
@on-focus="onEventFocus"
|
||||
@on-blur="onEventBlur"
|
||||
@on-more="onEventMore"
|
||||
@ -861,6 +862,7 @@ export default {
|
||||
selectedTextStatus: false, // 是否选择文本
|
||||
scrollToBottomRefresh: false, // 滚动到底部重新获取消息
|
||||
androidKeyboardVisible: false, // Android键盘是否可见
|
||||
replyMsgAutoMention: false, // 允许回复消息后自动@
|
||||
}
|
||||
},
|
||||
|
||||
@ -1490,6 +1492,7 @@ export default {
|
||||
this.positionShow = false
|
||||
this.msgPrepared = false
|
||||
this.scrollToBottomRefresh = false
|
||||
this.replyMsgAutoMention = false
|
||||
this.allMsgs = this.allMsgList
|
||||
this.errorId = 0
|
||||
//
|
||||
@ -3030,6 +3033,7 @@ export default {
|
||||
},
|
||||
|
||||
onReply(type) {
|
||||
this.replyMsgAutoMention = true
|
||||
this.setQuote(this.operateItem.id, type)
|
||||
this.inputFocus()
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user