Revert "super ugly hack to make pasting files with selection smoother"

This reverts commit 12a5ffab0d.
pull/139/head
Aevann 2023-03-11 13:06:57 +02:00
parent 73c5479125
commit 739efee3fe
1 changed files with 2 additions and 15 deletions

View File

@ -472,25 +472,12 @@ function handle_files(input, newfiles) {
ta.value += '\n'
}
const selection_end = ta.selectionEnd
const selected_text = ta.value.substring(ta.selectionStart, selection_end);
for (const file of newfiles) {
oldfiles[ta.id].push(file)
if (span.innerHTML != ' ') span.innerHTML += ', '
span.innerHTML += file.name.substr(0, 30);
if (location.pathname != '/chat') {
const file_entry = `[${file.name}]`
if (selected_text) {
let old_value = ta.value
ta.value = old_value.replace(selected_text, file_entry);
ta.selectionEnd = selection_end + ta.value.length - old_value.length;
}
else {
ta.setRangeText(`${file_entry}\n`);
}
}
if (location.pathname != '/chat')
ta.setRangeText(`[${file.name}]\n`);
}
autoExpand(ta)