mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-14 21:35:19 +00:00
refac: textarea
This commit is contained in:
parent
17ed7351a4
commit
b85cfdc90f
1 changed files with 6 additions and 1 deletions
|
|
@ -26,7 +26,8 @@
|
||||||
event.preventDefault(); // Prevent the default paste action
|
event.preventDefault(); // Prevent the default paste action
|
||||||
const clipboardData = event.clipboardData?.getData('text/plain'); // Get plaintext from clipboard
|
const clipboardData = event.clipboardData?.getData('text/plain'); // Get plaintext from clipboard
|
||||||
|
|
||||||
value = `${value}${clipboardData}`; // Append the plaintext to the current value
|
// Insert plaintext into the textarea
|
||||||
|
document.execCommand('insertText', false, clipboardData);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -37,6 +38,10 @@
|
||||||
style="field-sizing: content; -moz-user-select: text !important;"
|
style="field-sizing: content; -moz-user-select: text !important;"
|
||||||
on:input={() => {
|
on:input={() => {
|
||||||
const text = textareaElement.innerText;
|
const text = textareaElement.innerText;
|
||||||
|
if (text.trim() === '\n') {
|
||||||
|
value = '';
|
||||||
|
return;
|
||||||
|
}
|
||||||
value = text.trim();
|
value = text.trim();
|
||||||
}}
|
}}
|
||||||
on:paste={handlePaste}
|
on:paste={handlePaste}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue