chore(client/ts): port note_wrapper

This commit is contained in:
Elian Doran 2025-02-08 21:42:12 +02:00
parent 4c44ce0ebe
commit 2a90f4c6e9
No known key found for this signature in database
2 changed files with 10 additions and 4 deletions

View File

@ -158,7 +158,7 @@ export default class LoadResults {
return Object.keys(this.noteIdToComponentId);
}
isNoteReloaded(noteId: string | undefined, componentId: string | null = null) {
isNoteReloaded(noteId: string | undefined | null, componentId: string | null = null) {
if (!noteId) {
return false;
}

View File

@ -1,15 +1,21 @@
import FlexContainer from "./containers/flex_container.js";
import utils from "../services/utils.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() {
super("column");
this.css("flex-grow", "1").collapsible();
}
setNoteContextEvent({ noteContext }) {
setNoteContextEvent({ noteContext }: EventData<"setNoteContext">) {
this.noteContext = noteContext;
this.refresh();
@ -51,7 +57,7 @@ export default class NoteWrapperWidget extends FlexContainer {
this.$widget.toggleClass("protected", note.isProtected);
}
async entitiesReloadedEvent({ loadResults }) {
async entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
// listening on changes of note.type and CSS class
const noteId = this.noteContext?.noteId;