Added font-awesome capabilities

Added a way to use font-awesome for the icons on the tabs. Requires font-awesome to be loaded in the HTML page that uses electron-tabs and the "iconURL" starting with "fa-".
This commit is contained in:
Bastian Küppers 2016-11-29 16:20:45 +01:00 committed by GitHub
parent 43b1fb7ae0
commit 99a78390a3

View file

@ -160,7 +160,13 @@ class Tab extends EventEmitter {
this.iconURL = iconURL; this.iconURL = iconURL;
let span = this.tabElements.icon; let span = this.tabElements.icon;
if (iconURL) { if (iconURL) {
span.innerHTML = `<img src="${iconURL}" />`; console.log(iconURL);
if(iconURL.startsWith("fa-")) {
span.innerHTML = `<i class="fa ${iconURL}"></i>`;
}
else {
span.innerHTML = `<img src="${iconURL}" />`;
}
} }
this.emit("icon-changed", iconURL, this); this.emit("icon-changed", iconURL, this);
return this; return this;