Skip to content

Commit

Permalink
fix: 发送消息失败再次编辑格式丢失的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
kuaifan committed Jun 30, 2023
1 parent f0a8beb commit d72e1ed
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,6 @@ export default {
this.quill.on('text-change', _ => {
this.textTimer && clearTimeout(this.textTimer)
this.textTimer = setTimeout(_ => {
console.log(11);
if (this.maxlength > 0 && this.quill.getLength() > this.maxlength) {
this.quill.deleteText(this.maxlength, this.quill.getLength());
}
Expand Down
32 changes: 25 additions & 7 deletions resources/assets/js/pages/manage/components/DialogWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -840,14 +840,21 @@ export default {
return null
},
footerStyle({keyboardType, keyboardHeight, safeAreaBottom, windowScrollY, isMessenger}) {
const style = {};
footerPaddingBottom({keyboardType, keyboardHeight, safeAreaBottom, windowScrollY, isMessenger}) {
if (windowScrollY === 0
&& isMessenger
&& keyboardType === "show"
&& keyboardHeight > 0
&& keyboardHeight < 120) {
style.paddingBottom = (keyboardHeight + safeAreaBottom) + 'px';
return keyboardHeight + safeAreaBottom;
}
return 0;
},
footerStyle({footerPaddingBottom}) {
const style = {};
if (footerPaddingBottom) {
style.paddingBottom = `${footerPaddingBottom}px`;
}
return style;
},
Expand Down Expand Up @@ -1085,7 +1092,7 @@ export default {
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 tmpList = newList.filter(item => item.id && item.id > lastId)
this.msgNew += tmpList.length
Expand All @@ -1102,7 +1109,7 @@ export default {
this.navStyle = {
marginTop: val + 'px'
}
if (tail <= 10) {
if (tail <= 45) {
requestAnimationFrame(this.onToBottom)
}
if (this.$refs.input.isFocus) {
Expand Down Expand Up @@ -1130,6 +1137,15 @@ export default {
if (index > -1) {
setTimeout(_ => this.msgActiveIndex = -1, 800)
}
},
footerPaddingBottom(val) {
if (val) {
const {tail} = this.scrollInfo();
if (tail <= 45) {
requestAnimationFrame(this.onToBottom)
}
}
}
},
Expand Down Expand Up @@ -2080,7 +2096,7 @@ export default {
const {offset, tail} = this.scrollInfo();
this.scrollOffset = offset;
this.scrollTail = tail;
if (this.scrollTail <= 10) {
if (this.scrollTail <= 45) {
this.msgNew = 0;
}
//
Expand Down Expand Up @@ -2285,7 +2301,7 @@ export default {
const {tail} = this.scrollInfo()
this.setQuote(this.operateItem.id, type)
this.inputFocus()
if (tail <= 10) {
if (tail <= 45) {
requestAnimationFrame(this.onToBottom)
}
},
Expand Down Expand Up @@ -2546,8 +2562,10 @@ export default {
config.okText = '再次编辑'
config.onOk = () => {
this.tempMsgs = this.tempMsgs.filter(({id}) => id != data.id)
this.$refs.input.setPasteMode(false)
this.msgText = msg
this.inputFocus()
this.$nextTick(_ => this.$refs.input.setPasteMode(true))
}
} else if (type === 'record') {
config.okText = '重新发送'
Expand Down

0 comments on commit d72e1ed

Please sign in to comment.