mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +02:00
chore(client/ts): port note_wrapper
This commit is contained in:
parent
4c44ce0ebe
commit
2a90f4c6e9
@ -158,7 +158,7 @@ export default class LoadResults {
|
|||||||
return Object.keys(this.noteIdToComponentId);
|
return Object.keys(this.noteIdToComponentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
isNoteReloaded(noteId: string | undefined, componentId: string | null = null) {
|
isNoteReloaded(noteId: string | undefined | null, componentId: string | null = null) {
|
||||||
if (!noteId) {
|
if (!noteId) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,21 @@
|
|||||||
import FlexContainer from "./containers/flex_container.js";
|
import FlexContainer from "./containers/flex_container.js";
|
||||||
import utils from "../services/utils.js";
|
import utils from "../services/utils.js";
|
||||||
import attributeService from "../services/attributes.js";
|
import attributeService from "../services/attributes.js";
|
||||||
|
import type BasicWidget from "./basic_widget.js";
|
||||||
|
import type { EventData } from "../components/app_context.js";
|
||||||
|
import type NoteContext from "../components/note_context.js";
|
||||||
|
|
||||||
|
export default class NoteWrapperWidget extends FlexContainer<BasicWidget> {
|
||||||
|
|
||||||
|
private noteContext?: NoteContext;
|
||||||
|
|
||||||
export default class NoteWrapperWidget extends FlexContainer {
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super("column");
|
super("column");
|
||||||
|
|
||||||
this.css("flex-grow", "1").collapsible();
|
this.css("flex-grow", "1").collapsible();
|
||||||
}
|
}
|
||||||
|
|
||||||
setNoteContextEvent({ noteContext }) {
|
setNoteContextEvent({ noteContext }: EventData<"setNoteContext">) {
|
||||||
this.noteContext = noteContext;
|
this.noteContext = noteContext;
|
||||||
|
|
||||||
this.refresh();
|
this.refresh();
|
||||||
@ -51,7 +57,7 @@ export default class NoteWrapperWidget extends FlexContainer {
|
|||||||
this.$widget.toggleClass("protected", note.isProtected);
|
this.$widget.toggleClass("protected", note.isProtected);
|
||||||
}
|
}
|
||||||
|
|
||||||
async entitiesReloadedEvent({ loadResults }) {
|
async entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
|
||||||
// listening on changes of note.type and CSS class
|
// listening on changes of note.type and CSS class
|
||||||
|
|
||||||
const noteId = this.noteContext?.noteId;
|
const noteId = this.noteContext?.noteId;
|
Loading…
x
Reference in New Issue
Block a user