fix: load/unload tags component on change

This commit is contained in:
Baptiste Grob
2020-07-02 13:00:38 +02:00
parent 6052392833
commit d774ecb3e1

View File

@@ -387,6 +387,7 @@ class EditorViewCtrl extends PureViewCtrl implements EditorViewScope {
}
/** Reload componentStack in case new ones were added or removed */
await this.reloadComponentStack();
this.reloadNoteTagsComponent();
/** Observe editor changes to see if the current note should update its editor */
const editors = components.filter((component) => {
return component.isEditor();
@@ -1109,6 +1110,18 @@ class EditorViewCtrl extends PureViewCtrl implements EditorViewScope {
});
}
reloadNoteTagsComponent() {
const components = this.application.componentManager!
.componentsForArea(ComponentArea.NoteTags);
for (const component of components) {
if (component.active) {
this.componentGroup.activateComponent(component);
} else {
this.componentGroup.deactivateComponent(component);
}
}
}
async reloadComponentStack() {
const components = this.application.componentManager!
.componentsForArea(ComponentArea.EditorStack)