Add clear io button.

Fix some weirdness with removing tabs
This commit is contained in:
j433866 2019-04-30 13:34:00 +01:00
parent a96cb3f99f
commit b4208ede3b
2 changed files with 28 additions and 9 deletions

View File

@ -280,7 +280,13 @@ class InputWaiter {
/** /**
* Sets the input in the input area * Sets the input in the input area
* *
* @param inputData * @param {object} inputData
* @param {number} inputData.inputNum
* @param {string | object} inputData.input
* @param {string} inputData.name
* @param {string} inputData.size
* @param {string} inputData.type
* @param {number} inputData.progress
* @param {boolean} [silent=false] * @param {boolean} [silent=false]
*/ */
set(inputData, silent=false) { set(inputData, silent=false) {
@ -768,7 +774,7 @@ class InputWaiter {
document.getElementById("save-all-to-file").style.display = "none"; document.getElementById("save-all-to-file").style.display = "none";
} }
this.changeTab(activeTab); this.changeTab(activeTab, this.app.options.syncTabs);
} }
/** /**
@ -899,8 +905,6 @@ class InputWaiter {
return nums; return nums;
} }
// clearAllIO
// could just re-run setup to create a new inputWorker
/** /**
* Handler for clear all IO events. * Handler for clear all IO events.
* Resets the input, output and info areas * Resets the input, output and info areas
@ -918,8 +922,23 @@ class InputWaiter {
this.addInput(true); this.addInput(true);
} }
// clearIO /**
// reset current tab * Handler for clear IO click event.
* Resets the input for the current tab
*/
clearIoClick() {
const inputNum = this.getActiveTab();
if (inputNum === -1) return;
this.updateInputValue(inputNum, "");
this.set({
inputNum: inputNum,
input: ""
});
this.updateTabHeader({inputNum: inputNum, input: ""});
}
// filter stuff should be sent to the inputWorker // filter stuff should be sent to the inputWorker
// returns a filterResult message that is handled and used to update the UI // returns a filterResult message that is handled and used to update the UI
@ -964,7 +983,7 @@ class InputWaiter {
*/ */
inputAdded(changeTab, inputNum) { inputAdded(changeTab, inputNum) {
if (changeTab) { if (changeTab) {
this.changeTab(inputNum); this.changeTab(inputNum, this.app.options.syncTabs);
} }
this.manager.output.addOutput(inputNum, changeTab); this.manager.output.addOutput(inputNum, changeTab);
} }
@ -1009,7 +1028,7 @@ class InputWaiter {
} }
}); });
this.manager.output.removeOutput(inputNum); this.manager.output.removeTab(inputNum);
} }
/** /**

View File

@ -156,7 +156,7 @@ class Manager {
// document.getElementById("input-text").addEventListener("mouseup", this.highlighter.inputMouseup.bind(this.highlighter)); // document.getElementById("input-text").addEventListener("mouseup", this.highlighter.inputMouseup.bind(this.highlighter));
// document.getElementById("input-text").addEventListener("mousemove", this.highlighter.inputMousemove.bind(this.highlighter)); // document.getElementById("input-text").addEventListener("mousemove", this.highlighter.inputMousemove.bind(this.highlighter));
// this.addMultiEventListener("#input-text", "mousedown dblclick select", this.highlighter.inputMousedown, this.highlighter); // this.addMultiEventListener("#input-text", "mousedown dblclick select", this.highlighter.inputMousedown, this.highlighter);
// document.querySelector("#input-file .close").addEventListener("click", this.input.clearIoClick.bind(this.input)); document.querySelector("#input-file .close").addEventListener("click", this.input.clearIoClick.bind(this.input));
document.getElementById("btn-new-tab").addEventListener("click", this.input.addInputClick.bind(this.input)); document.getElementById("btn-new-tab").addEventListener("click", this.input.addInputClick.bind(this.input));
document.getElementById("btn-previous-input-tab").addEventListener("click", this.input.changeTabLeft.bind(this.input)); document.getElementById("btn-previous-input-tab").addEventListener("click", this.input.changeTabLeft.bind(this.input));
document.getElementById("btn-next-input-tab").addEventListener("click", this.input.changeTabRight.bind(this.input)); document.getElementById("btn-next-input-tab").addEventListener("click", this.input.changeTabRight.bind(this.input));