mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 15:26:16 -04:00
Change pasting to keep cursor position.
Move output scrolling to changeTab() instead of set()
This commit is contained in:
parent
39101610d5
commit
98af95a6ce
2 changed files with 11 additions and 4 deletions
|
@ -699,7 +699,14 @@ class InputWaiter {
|
|||
// changing the value, so instead change it here ourselves
|
||||
// and manually fire inputChange()
|
||||
e.preventDefault();
|
||||
document.getElementById("input-text").value += pastedData;
|
||||
const inputText = document.getElementById("input-text");
|
||||
const selStart = inputText.selectionStart;
|
||||
const selEnd = inputText.selectionEnd;
|
||||
const startVal = inputText.value.slice(0, selStart);
|
||||
const endVal = inputText.value.slice(selEnd);
|
||||
|
||||
inputText.value = startVal + pastedData + endVal;
|
||||
inputText.setSelectionRange(selStart + pastedData.length, selStart + pastedData.length);
|
||||
this.debounceInputChange(e);
|
||||
} else {
|
||||
e.preventDefault();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue