added additionalTabClass for Tab Class
This commit is contained in:
parent
986f762ae1
commit
91a87b7d76
3 changed files with 6 additions and 0 deletions
|
@ -101,6 +101,7 @@ Add a new tab to the tab group and returns a `Tab` instance.
|
|||
* `visible` (default: `true`): set this to `false` if you don't want to display the tab once it is loaded. If set to `false` then you will need to call `tab.show()` to display the tab.
|
||||
* `active` (default: `false`): set this to `true` if you want to activate the tab once it is loaded. Otherwise you will need to call `tab.activate()`.
|
||||
* `ready`: a callback function to call once the tab is ready. The `Tab` instance is passed as the only parameter.
|
||||
* `additionalTabClass`: optional css class which is added to a single tab.
|
||||
|
||||
#### `tabGroup.getTab(id)`
|
||||
|
||||
|
|
1
index.d.ts
vendored
1
index.d.ts
vendored
|
@ -39,6 +39,7 @@ declare namespace ElectronTabs {
|
|||
webviewAttributes?: {[key: string]: any};
|
||||
visible?: boolean;
|
||||
active?: boolean;
|
||||
additionalTabClass?: string;
|
||||
ready?: (tab: Tab) => void;
|
||||
}
|
||||
|
||||
|
|
4
index.js
4
index.js
|
@ -180,6 +180,7 @@ class Tab extends EventEmitter {
|
|||
this.closable = args.closable === false ? false : true;
|
||||
this.webviewAttributes = args.webviewAttributes || {};
|
||||
this.webviewAttributes.src = args.src;
|
||||
this.additionalTabClass = args.additionalTabClass;
|
||||
this.tabElements = {};
|
||||
TabPrivate.initTab.bind(this)();
|
||||
TabPrivate.initWebview.bind(this)();
|
||||
|
@ -375,6 +376,9 @@ const TabPrivate = {
|
|||
// Create tab element
|
||||
let tab = this.tab = document.createElement("div");
|
||||
tab.classList.add(tabClass);
|
||||
if(this.additionalTabClass) {
|
||||
tab.classList.add(this.additionalTabClass);
|
||||
}
|
||||
for (let el of ["icon", "title", "buttons", "badge"]) {
|
||||
let span = tab.appendChild(document.createElement("span"));
|
||||
span.classList.add(`${tabClass}-${el}`);
|
||||
|
|
Loading…
Add table
Reference in a new issue