Commit c1a1414b by Sixong.Zhu

update

parent 50e9105f
......@@ -50,7 +50,6 @@
import { dbController } from "../database";
import { getLastMessageId } from "../store";
import { CustomerServiceEvent } from "../event";
import xim from "../xim/xim";
@Component({ components: { message, ImagePreview, VideoPreview } })
export default class MessageList extends Vue {
......@@ -95,7 +94,7 @@
private get messages() {
if (this.historyMessage) {
if (this.sendingMessages) {
if (this.sendingMessages && this.sendingMessages.length) {
return [...this.historyMessage, ...this.sendingMessages].filter(
(i) => i.chat_id === this.chatId && i.id > 0
);
......@@ -103,7 +102,7 @@
return this.historyMessage;
}
if (this.sendingMessages) {
if (this.sendingMessages && this.sendingMessages.length) {
return this.sendingMessages.filter(
(i) => i.chat_id === this.chatId && i.id > 0
);
......
......@@ -369,30 +369,17 @@
*/
private combine(nodes: ChildNode[]) {
const sendingNodes: ChildNode[] = [];
let needCreateNewNode = false;
let text = "";
for (const item of nodes) {
if (!isImageOrFile(item) && item.textContent) {
if (needCreateNewNode) {
text = "";
needCreateNewNode = false;
}
text += item.textContent;
} else {
needCreateNewNode = true;
if (text) {
this.checkTextLength(text);
const node = document.createTextNode(text);
sendingNodes.push(node);
}
if (isImageOrFile(item)) {
sendingNodes.push(item);
continue;
}
if (item.textContent) {
const text = item.textContent;
this.checkTextLength(text);
const node = document.createTextNode(text);
sendingNodes.push(node);
}
}
if (text) {
this.checkTextLength(text);
const node = document.createTextNode(text);
sendingNodes.push(node);
}
return sendingNodes;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment