mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00

The regression was introduced in 612e4406b55619e1d8de8b57797fa6ab834111be. This might cause some other issues in closing the highlights, but none were identified during a cursory testing.
37 lines
961 B
JavaScript
37 lines
961 B
JavaScript
import AbstractButtonWidget from "./abstract_button.js";
|
|
import { t } from "../../services/i18n.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(t("onclick_button.no_click_handler", { componentId: this.componentId }), this.settings);
|
|
}
|
|
|
|
if (this.settings.onAuxClick) {
|
|
this.$widget.on("auxclick", e => {
|
|
this.$widget.tooltip("hide");
|
|
|
|
this.settings.onAuxClick(this, e);
|
|
});
|
|
}
|
|
}
|
|
|
|
onClick(handler) {
|
|
this.settings.onClick = handler;
|
|
return this;
|
|
}
|
|
|
|
onAuxClick(handler) {
|
|
this.settings.onAuxClick = handler;
|
|
return this;
|
|
}
|
|
}
|