refac: tts input

This commit is contained in:
Timothy Jaeryang Baek
2025-07-11 12:15:13 +04:00
parent 3bc5485867
commit 0db8bedf45
3 changed files with 68 additions and 16 deletions

View File

@@ -325,15 +325,7 @@
replaceCommandWithText(text);
} else {
if ($settings?.richTextInput ?? true) {
const selection = window.getSelection();
if (selection && selection.rangeCount > 0) {
const range = selection.getRangeAt(0);
range.deleteContents();
range.insertNode(document.createTextNode(text));
range.collapse(false);
selection.removeAllRanges();
selection.addRange(range);
}
chatInputElement?.insertContent(text);
} else {
const cursor = chatInput.selectionStart;
prompt = prompt.slice(0, cursor) + text + prompt.slice(cursor);
@@ -966,10 +958,12 @@
}}
onConfirm={async (data) => {
const { text, filename } = data;
prompt = `${prompt}${text} `;
recording = false;
await tick();
insertTextAtCursor(text);
await tick();
document.getElementById('chat-input')?.focus();