浏览代码

refac: message input optimization

Timothy Jaeryang Baek 3 周之前
父节点
当前提交
e1386fe80b
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. 7 2
      src/lib/components/channel/MessageInput.svelte

+ 7 - 2
src/lib/components/channel/MessageInput.svelte

@@ -226,12 +226,17 @@
 		const chatInput = document.getElementById('chat-input');
 		const chatInput = document.getElementById('chat-input');
 
 
 		if (chatInput) {
 		if (chatInput) {
-			text = await textVariableHandler(text || '');
+			if (text !== '') {
+				text = await textVariableHandler(text || '');
+			}
 
 
 			chatInputElement?.setText(text);
 			chatInputElement?.setText(text);
 			chatInputElement?.focus();
 			chatInputElement?.focus();
 
 
-			text = await inputVariableHandler(text);
+			if (text !== '') {
+				text = await inputVariableHandler(text);
+			}
+
 			await tick();
 			await tick();
 			if (cb) await cb(text);
 			if (cb) await cb(text);
 		}
 		}