Add mime type detection to tab title.

Move addition of close tab button back
This commit is contained in:
j433866 2019-06-13 11:13:53 +01:00
parent 6ee76e3bf0
commit 84204c1d12
2 changed files with 42 additions and 16 deletions

View file

@ -159,6 +159,22 @@ class TabWaiter {
newTab.appendChild(newTabContent);
if (io === "input") {
const newTabButton = document.createElement("button"),
newTabButtonIcon = document.createElement("i");
newTabButton.type = "button";
newTabButton.className = "btn btn-primary bmd-btn-icon btn-close-tab";
newTabButtonIcon.classList.add("material-icons");
newTabButtonIcon.innerText = "clear";
newTabButton.appendChild(newTabButtonIcon);
newTabButton.addEventListener("click", this.manager.input.removeTabClick.bind(this.manager.input));
newTab.appendChild(newTabButton);
}
return newTab;
}
@ -170,22 +186,7 @@ class TabWaiter {
* @returns {Element}
*/
createInputTabElement(inputNum, active=false) {
const newTab = this.createTabElement(inputNum, active, "input"),
newTabButton = document.createElement("button"),
newTabButtonIcon = document.createElement("i");
newTabButton.type = "button";
newTabButton.className = "btn btn-primary bmd-btn-icon btn-close-tab";
newTabButtonIcon.classList.add("material-icons");
newTabButtonIcon.innerText = "clear";
newTabButton.appendChild(newTabButtonIcon);
newTabButton.addEventListener("click", this.manager.input.removeTabClick.bind(this.manager.input));
newTab.appendChild(newTabButton);
return newTab;
return this.createTabElement(inputNum, active, "input");
}
/**