forked from rDrama/rDrama
Revert "super ugly hack to make pasting files with selection smoother"
This reverts commit 12a5ffab0d
.
master
parent
73c5479125
commit
739efee3fe
|
@ -472,25 +472,12 @@ function handle_files(input, newfiles) {
|
||||||
ta.value += '\n'
|
ta.value += '\n'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const selection_end = ta.selectionEnd
|
|
||||||
const selected_text = ta.value.substring(ta.selectionStart, selection_end);
|
|
||||||
|
|
||||||
for (const file of newfiles) {
|
for (const file of newfiles) {
|
||||||
oldfiles[ta.id].push(file)
|
oldfiles[ta.id].push(file)
|
||||||
if (span.innerHTML != ' ') span.innerHTML += ', '
|
if (span.innerHTML != ' ') span.innerHTML += ', '
|
||||||
span.innerHTML += file.name.substr(0, 30);
|
span.innerHTML += file.name.substr(0, 30);
|
||||||
if (location.pathname != '/chat') {
|
if (location.pathname != '/chat')
|
||||||
const file_entry = `[${file.name}]`
|
ta.setRangeText(`[${file.name}]\n`);
|
||||||
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`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
autoExpand(ta)
|
autoExpand(ta)
|
||||||
|
|
Loading…
Reference in New Issue