Add clear all io button.

This commit is contained in:
j433866 2019-04-30 13:18:22 +01:00
parent 1f39a922d1
commit a96cb3f99f
4 changed files with 67 additions and 30 deletions

View file

@ -168,6 +168,17 @@ class OutputWaiter {
delete (this.outputs[inputNum]);
}
/**
* Removes all output tabs
*/
removeAllOutputs() {
this.outputs = {};
const tabs = document.getElementById("output-tabs").children;
for (let i = tabs.length - 1; i >= 0; i--) {
tabs.item(i).remove();
}
}
/**
* Sets the output in the output textarea.
*
@ -427,7 +438,7 @@ class OutputWaiter {
const tabsWrapper = document.getElementById("output-tabs");
const numTabs = tabsWrapper.children.length;
if (numTabs < this.maxTabs) {
if (this.getTabItem(inputNum) === undefined && numTabs < this.maxTabs) {
// Create a new tab element
const newTab = this.createTabElement(inputNum);
@ -442,6 +453,15 @@ class OutputWaiter {
document.getElementById("output-loader").style.height = "calc(100% - var(--tab-height) - var(--title-height))";
document.getElementById("save-all-to-file").style.display = "inline-block";
} else {
tabsWrapper.parentElement.style.display = "none";
document.getElementById("output-wrapper").style.height = "calc(100% - var(--title-height))";
document.getElementById("output-highlighter").style.height = "calc(100% - var(--title-height))";
document.getElementById("output-file").style.height = "calc(100% - var(--title-height))";
document.getElementById("output-loader").style.height = "calc(100% - var(--title-height))";
document.getElementById("save-all-to-file").style.display = "none";
}
}