no message

This commit is contained in:
kuaifan 2022-11-16 20:52:17 +08:00
parent 21b6479dbe
commit 70ec88e57d
3 changed files with 33 additions and 6 deletions

View File

@ -31,7 +31,7 @@
ref="editor"
class="no-dark-content"
:style="editorStyle"
@click.stop=""
@click.stop="onClickEditor"
@paste="handlePaste"></div>
<!-- 工具栏 -->
@ -465,9 +465,6 @@ export default {
}
}, 200);
}
this.$nextTick(_ => {
this.updateEmojiQuick(this.value)
})
} else {
this.$emit('on-blur')
}
@ -699,11 +696,13 @@ export default {
},
updateEmojiQuick(text) {
if (!this.isFocus) {
if (!this.isFocus || !text) {
this.emojiQuickShow = false
return
}
this.emojiQuickTimer && clearTimeout(this.emojiQuickTimer)
this.emojiQuickTimer = setTimeout(_ => {
text = text.replace(/&nbsp;/g," ")
text = text.replace(/<[^>]+>/g, "")
if (text
&& text.indexOf(" ") === -1
@ -730,7 +729,7 @@ export default {
}
}
this.emojiQuickShow = false
}, 200)
}, 100)
},
setText(value) {
@ -766,6 +765,10 @@ export default {
}, 600)
},
onClickEditor() {
this.updateEmojiQuick(this.value)
},
focus() {
this.$nextTick(() => {
if (this.quill) {

View File

@ -2159,6 +2159,29 @@ export default {
} else {
state.dialogIns.push(data);
}
// 会话消息总数量大于200时只保留最近打开的5个会话
const msg_max = 200
const retain_num = 5
if (state.dialogMsgs.length > msg_max) {
state.dialogHistory = state.dialogHistory.filter(id => id != data.dialog_id)
state.dialogHistory.push(data.dialog_id)
if (state.dialogHistory.length > retain_num) {
const historys = state.dialogHistory.slice().reverse()
const newIds = []
const delIds = []
historys.forEach(id => {
if (newIds.length < retain_num || state.dialogIns.findIndex(item => item.dialog_id == id) > -1) {
newIds.push(id)
} else {
delIds.push(id)
}
})
if (delIds.length > 0) {
state.dialogMsgs = state.dialogMsgs.filter(item => !delIds.includes(item.dialog_id));
}
state.dialogHistory = newIds
}
}
},
/**

View File

@ -79,6 +79,7 @@ const stateData = {
dialogIns: [],
dialogMsgs: [],
dialogTodos: [],
dialogHistory: [],
dialogInputCache: $A.getStorageArray("cacheDialogInput"),
dialogMsgTransfer: {time: 0},