mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 19:12:27 +08:00
42 lines
729 B
JavaScript
42 lines
729 B
JavaScript
import Component from "./component.js";
|
|
import keyboardActionsService from "../services/keyboard_actions.js";
|
|
|
|
class BasicWidget extends Component {
|
|
render() {
|
|
const $widget = this.doRender();
|
|
|
|
$widget.addClass('component')
|
|
.prop('component', this);
|
|
|
|
this.toggle(this.isEnabled());
|
|
|
|
return $widget;
|
|
}
|
|
|
|
isEnabled() {
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* for overriding
|
|
*/
|
|
doRender() {}
|
|
|
|
toggle(show) {
|
|
this.$widget.toggle(show);
|
|
}
|
|
|
|
isVisible() {
|
|
return this.$widget.is(":visible");
|
|
}
|
|
|
|
remove() {
|
|
if (this.$widget) {
|
|
this.$widget.remove();
|
|
}
|
|
}
|
|
|
|
cleanup() {}
|
|
}
|
|
|
|
export default BasicWidget; |