mirror of
https://github.com/zadam/trilium.git
synced 2025-11-06 13:26:01 +01:00
launcher improvements
This commit is contained in:
22
src/public/app/widgets/buttons/onclick_button.js
Normal file
22
src/public/app/widgets/buttons/onclick_button.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import AbstractButtonWidget from "./abstract_button.js";
|
||||
|
||||
export default class OnClickButtonWidget extends AbstractButtonWidget {
|
||||
doRender() {
|
||||
super.doRender();
|
||||
|
||||
if (this.settings.onClick) {
|
||||
this.$widget.on("click", e => {
|
||||
this.$widget.tooltip("hide");
|
||||
|
||||
this.settings.onClick(this, e);
|
||||
});
|
||||
} else {
|
||||
console.warn(`Button widget '${this.componentId}' has no defined click handler`, this.settings);
|
||||
}
|
||||
}
|
||||
|
||||
onClick(handler) {
|
||||
this.settings.onClick = handler;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user