mirror of
https://github.com/gchq/CyberChef.git
synced 2025-06-13 17:55:27 -04:00
Merge d0c1e5525e
into c57556f49f
This commit is contained in:
commit
ff5c1ce1b6
2 changed files with 35 additions and 8 deletions
|
@ -758,6 +758,15 @@ class InputWaiter {
|
|||
* @param {string | ArrayBuffer} value
|
||||
*/
|
||||
updateInputValue(inputNum, value, force=false) {
|
||||
// Preserve current selection
|
||||
const inputElement = document.getElementById("input-text");
|
||||
let selectionStart = null;
|
||||
let selectionEnd = null;
|
||||
if (inputElement) {
|
||||
selectionStart = inputElement.selectionStart;
|
||||
selectionEnd = inputElement.selectionEnd;
|
||||
}
|
||||
|
||||
// Prepare the value as a buffer (full value) and a string sample (up to 4096 bytes)
|
||||
let buffer;
|
||||
let stringSample = "";
|
||||
|
@ -796,6 +805,14 @@ class InputWaiter {
|
|||
eolSequence: this.getEOLSeq()
|
||||
}
|
||||
}, transferable);
|
||||
|
||||
// Restore selection if it was set
|
||||
if (inputElement && selectionStart !== null && selectionEnd !== null) {
|
||||
requestAnimationFrame(() => {
|
||||
inputElement.selectionStart = selectionStart;
|
||||
inputElement.selectionEnd = selectionEnd;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -551,17 +551,27 @@ class OutputWaiter {
|
|||
if (!this.outputExists(inputNum)) {
|
||||
this.addOutput(inputNum);
|
||||
}
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(data, "dish")) {
|
||||
data.dish = new Dish(data.dish);
|
||||
// Preserve current selection
|
||||
const outputElement = document.getElementById("output-text");
|
||||
let selectionStart = null;
|
||||
let selectionEnd = null;
|
||||
if (outputElement) {
|
||||
selectionStart = outputElement.selectionStart;
|
||||
selectionEnd = outputElement.selectionEnd;
|
||||
}
|
||||
|
||||
this.outputs[inputNum].data = data;
|
||||
this.outputs[inputNum].statusMessage = statusMessage;
|
||||
if (set) {
|
||||
this.set(inputNum);
|
||||
|
||||
const tabItem = this.manager.tabs.getTabItem(inputNum, "output");
|
||||
if (tabItem) tabItem.style.background = "";
|
||||
|
||||
if (set) this.set(inputNum);
|
||||
// Restore selection if it was set
|
||||
if (outputElement && selectionStart !== null && selectionEnd !== null) {
|
||||
requestAnimationFrame(() => {
|
||||
outputElement.selectionStart = selectionStart;
|
||||
outputElement.selectionEnd = selectionEnd;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue