Commit c1a1414b by Sixong.Zhu

update

parent 50e9105f
...@@ -50,7 +50,6 @@ ...@@ -50,7 +50,6 @@
import { dbController } from "../database"; import { dbController } from "../database";
import { getLastMessageId } from "../store"; import { getLastMessageId } from "../store";
import { CustomerServiceEvent } from "../event"; import { CustomerServiceEvent } from "../event";
import xim from "../xim/xim";
@Component({ components: { message, ImagePreview, VideoPreview } }) @Component({ components: { message, ImagePreview, VideoPreview } })
export default class MessageList extends Vue { export default class MessageList extends Vue {
...@@ -95,7 +94,7 @@ ...@@ -95,7 +94,7 @@
private get messages() { private get messages() {
if (this.historyMessage) { if (this.historyMessage) {
if (this.sendingMessages) { if (this.sendingMessages && this.sendingMessages.length) {
return [...this.historyMessage, ...this.sendingMessages].filter( return [...this.historyMessage, ...this.sendingMessages].filter(
(i) => i.chat_id === this.chatId && i.id > 0 (i) => i.chat_id === this.chatId && i.id > 0
); );
...@@ -103,7 +102,7 @@ ...@@ -103,7 +102,7 @@
return this.historyMessage; return this.historyMessage;
} }
if (this.sendingMessages) { if (this.sendingMessages && this.sendingMessages.length) {
return this.sendingMessages.filter( return this.sendingMessages.filter(
(i) => i.chat_id === this.chatId && i.id > 0 (i) => i.chat_id === this.chatId && i.id > 0
); );
......
...@@ -369,31 +369,18 @@ ...@@ -369,31 +369,18 @@
*/ */
private combine(nodes: ChildNode[]) { private combine(nodes: ChildNode[]) {
const sendingNodes: ChildNode[] = []; const sendingNodes: ChildNode[] = [];
let needCreateNewNode = false;
let text = "";
for (const item of nodes) { for (const item of nodes) {
if (!isImageOrFile(item) && item.textContent) { if (isImageOrFile(item)) {
if (needCreateNewNode) {
text = "";
needCreateNewNode = false;
}
text += item.textContent;
} else {
needCreateNewNode = true;
if (text) {
this.checkTextLength(text);
const node = document.createTextNode(text);
sendingNodes.push(node);
}
sendingNodes.push(item); sendingNodes.push(item);
continue;
} }
} if (item.textContent) {
const text = item.textContent;
if (text) {
this.checkTextLength(text); this.checkTextLength(text);
const node = document.createTextNode(text); const node = document.createTextNode(text);
sendingNodes.push(node); sendingNodes.push(node);
} }
}
return sendingNodes; 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