mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
43 lines
1.0 KiB
JavaScript
43 lines
1.0 KiB
JavaScript
import FlexContainer from "./flex_container.js";
|
|
import utils from "../../services/utils.js";
|
|
import appContext from "../../services/app_context.js";
|
|
|
|
export default class RootContainer extends FlexContainer {
|
|
constructor() {
|
|
super('row');
|
|
|
|
this.id('root-widget');
|
|
this.css('height', '100vh');
|
|
}
|
|
|
|
refresh() {
|
|
this.$widget.removeClass(); // remove all classes
|
|
const note = appContext.tabManager.getActiveContextNote();
|
|
|
|
if (note) {
|
|
this.$widget.addClass(note.getCssClass());
|
|
|
|
this.$widget.addClass(utils.getNoteTypeClass(note.type));
|
|
this.$widget.addClass(utils.getMimeTypeClass(note.mime));
|
|
|
|
this.$widget.toggleClass("protected", note.isProtected);
|
|
}
|
|
}
|
|
|
|
noteSwitchedEvent() {
|
|
this.refresh();
|
|
}
|
|
|
|
activeContextChangedEvent() {
|
|
this.refresh();
|
|
}
|
|
|
|
noteSwitchedAndActivatedEvent() {
|
|
this.refresh();
|
|
}
|
|
|
|
noteTypeMimeChangedEvent() {
|
|
this.refresh();
|
|
}
|
|
}
|