mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
39 lines
813 B
JavaScript
39 lines
813 B
JavaScript
import Component from "./component.js";
|
|
import keyboardActionsService from "../services/keyboard_actions.js";
|
|
|
|
class BasicWidget extends Component {
|
|
render() {
|
|
const $widget = this.doRender();
|
|
|
|
keyboardActionsService.updateDisplayedShortcuts($widget);
|
|
|
|
$widget.find("[data-trigger-event]").on('click', e => {
|
|
const eventName = $(e.target).attr('data-trigger-event');
|
|
|
|
console.log("Triggering " + eventName);
|
|
|
|
this.appContext.trigger(eventName);
|
|
});
|
|
|
|
return $widget;
|
|
}
|
|
|
|
/**
|
|
* for overriding
|
|
*/
|
|
doRender() {}
|
|
|
|
toggle(show) {
|
|
this.$widget.toggle(show);
|
|
}
|
|
|
|
remove() {
|
|
if (this.$widget) {
|
|
this.$widget.remove();
|
|
}
|
|
}
|
|
|
|
cleanup() {}
|
|
}
|
|
|
|
export default BasicWidget; |