mirror of
https://github.com/hodgef/simple-keyboard.git
synced 2025-02-22 01:29:39 +08:00
Add class per plugin
This commit is contained in:
parent
1ee5c7dd2d
commit
824c3578d0
@ -63,6 +63,11 @@ class SimpleKeyboard {
|
|||||||
this.options.theme = this.options.theme || "hg-theme-default";
|
this.options.theme = this.options.theme || "hg-theme-default";
|
||||||
this.options.inputName = this.options.inputName || "default";
|
this.options.inputName = this.options.inputName || "default";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {object} Classes identifying loaded plugins
|
||||||
|
*/
|
||||||
|
this.keyboardPluginClasses = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bindings
|
* Bindings
|
||||||
*/
|
*/
|
||||||
@ -557,11 +562,11 @@ class SimpleKeyboard {
|
|||||||
|
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
if(module.constructor.name && module.constructor.name !== "Function"){
|
if(module.constructor.name && module.constructor.name !== "Function"){
|
||||||
this.keyboardDOM.classList.add(
|
let classStr = `module-${this.utilities.camelCase(module.constructor.name)}`;
|
||||||
`module-${this.utilities.camelCase(module.constructor.name)}`
|
this.keyboardPluginClasses = this.keyboardPluginClasses + ` ${classStr}`;
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.render();
|
||||||
module.init(this);
|
module.init(this);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -633,7 +638,7 @@ class SimpleKeyboard {
|
|||||||
/**
|
/**
|
||||||
* Adding themeClass, layoutClass to keyboardDOM
|
* Adding themeClass, layoutClass to keyboardDOM
|
||||||
*/
|
*/
|
||||||
this.keyboardDOM.className += ` ${this.options.theme} ${layoutClass}`;
|
this.keyboardDOM.className += ` ${this.options.theme} ${layoutClass} ${this.keyboardPluginClasses}`;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterating through each row
|
* Iterating through each row
|
||||||
|
Loading…
Reference in New Issue
Block a user