Add class per plugin

This commit is contained in:
Francisco Hodge 2018-10-31 19:48:17 -04:00
parent 1ee5c7dd2d
commit 824c3578d0

View File

@ -63,6 +63,11 @@ class SimpleKeyboard {
this.options.theme = this.options.theme || "hg-theme-default";
this.options.inputName = this.options.inputName || "default";
/**
* @type {object} Classes identifying loaded plugins
*/
this.keyboardPluginClasses = '';
/**
* Bindings
*/
@ -557,11 +562,11 @@ class SimpleKeyboard {
/* istanbul ignore next */
if(module.constructor.name && module.constructor.name !== "Function"){
this.keyboardDOM.classList.add(
`module-${this.utilities.camelCase(module.constructor.name)}`
);
let classStr = `module-${this.utilities.camelCase(module.constructor.name)}`;
this.keyboardPluginClasses = this.keyboardPluginClasses + ` ${classStr}`;
}
this.render();
module.init(this);
});
}
@ -633,7 +638,7 @@ class SimpleKeyboard {
/**
* 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