fix: 发送消息失败再次编辑格式丢失的问题

This commit is contained in:
kuaifan 2023-06-30 22:25:43 +08:00
parent 19fd36b195
commit a6ce767532
2 changed files with 25 additions and 8 deletions

View File

@ -713,7 +713,6 @@ export default {
this.quill.on('text-change', _ => { this.quill.on('text-change', _ => {
this.textTimer && clearTimeout(this.textTimer) this.textTimer && clearTimeout(this.textTimer)
this.textTimer = setTimeout(_ => { this.textTimer = setTimeout(_ => {
console.log(11);
if (this.maxlength > 0 && this.quill.getLength() > this.maxlength) { if (this.maxlength > 0 && this.quill.getLength() > this.maxlength) {
this.quill.deleteText(this.maxlength, this.quill.getLength()); this.quill.deleteText(this.maxlength, this.quill.getLength());
} }

View File

@ -840,14 +840,21 @@ export default {
return null return null
}, },
footerStyle({keyboardType, keyboardHeight, safeAreaBottom, windowScrollY, isMessenger}) { footerPaddingBottom({keyboardType, keyboardHeight, safeAreaBottom, windowScrollY, isMessenger}) {
const style = {};
if (windowScrollY === 0 if (windowScrollY === 0
&& isMessenger && isMessenger
&& keyboardType === "show" && keyboardType === "show"
&& keyboardHeight > 0 && keyboardHeight > 0
&& keyboardHeight < 120) { && keyboardHeight < 120) {
style.paddingBottom = (keyboardHeight + safeAreaBottom) + 'px'; return keyboardHeight + safeAreaBottom;
}
return 0;
},
footerStyle({footerPaddingBottom}) {
const style = {};
if (footerPaddingBottom) {
style.paddingBottom = `${footerPaddingBottom}px`;
} }
return style; return style;
}, },
@ -1085,7 +1092,7 @@ export default {
this.allMsgs = newList; this.allMsgs = newList;
} }
// //
if (!this.windowActive || (tail > 10 && oldList.length > 0)) { if (!this.windowActive || (tail > 45 && oldList.length > 0)) {
const lastId = oldList[oldList.length - 1] ? oldList[oldList.length - 1].id : 0 const lastId = oldList[oldList.length - 1] ? oldList[oldList.length - 1].id : 0
const tmpList = newList.filter(item => item.id && item.id > lastId) const tmpList = newList.filter(item => item.id && item.id > lastId)
this.msgNew += tmpList.length this.msgNew += tmpList.length
@ -1102,7 +1109,7 @@ export default {
this.navStyle = { this.navStyle = {
marginTop: val + 'px' marginTop: val + 'px'
} }
if (tail <= 10) { if (tail <= 45) {
requestAnimationFrame(this.onToBottom) requestAnimationFrame(this.onToBottom)
} }
if (this.$refs.input.isFocus) { if (this.$refs.input.isFocus) {
@ -1130,6 +1137,15 @@ export default {
if (index > -1) { if (index > -1) {
setTimeout(_ => this.msgActiveIndex = -1, 800) setTimeout(_ => this.msgActiveIndex = -1, 800)
} }
},
footerPaddingBottom(val) {
if (val) {
const {tail} = this.scrollInfo();
if (tail <= 45) {
requestAnimationFrame(this.onToBottom)
}
}
} }
}, },
@ -2080,7 +2096,7 @@ export default {
const {offset, tail} = this.scrollInfo(); const {offset, tail} = this.scrollInfo();
this.scrollOffset = offset; this.scrollOffset = offset;
this.scrollTail = tail; this.scrollTail = tail;
if (this.scrollTail <= 10) { if (this.scrollTail <= 45) {
this.msgNew = 0; this.msgNew = 0;
} }
// //
@ -2285,7 +2301,7 @@ export default {
const {tail} = this.scrollInfo() const {tail} = this.scrollInfo()
this.setQuote(this.operateItem.id, type) this.setQuote(this.operateItem.id, type)
this.inputFocus() this.inputFocus()
if (tail <= 10) { if (tail <= 45) {
requestAnimationFrame(this.onToBottom) requestAnimationFrame(this.onToBottom)
} }
}, },
@ -2546,8 +2562,10 @@ export default {
config.okText = '再次编辑' config.okText = '再次编辑'
config.onOk = () => { config.onOk = () => {
this.tempMsgs = this.tempMsgs.filter(({id}) => id != data.id) this.tempMsgs = this.tempMsgs.filter(({id}) => id != data.id)
this.$refs.input.setPasteMode(false)
this.msgText = msg this.msgText = msg
this.inputFocus() this.inputFocus()
this.$nextTick(_ => this.$refs.input.setPasteMode(true))
} }
} else if (type === 'record') { } else if (type === 'record') {
config.okText = '重新发送' config.okText = '重新发送'