fix: only require one click to toggle stack components

This commit is contained in:
Baptiste Grob
2020-10-16 12:23:25 +02:00
parent 5b814ea9be
commit ceb2b3a1ba

View File

@@ -1080,15 +1080,13 @@ class EditorViewCtrl extends PureViewCtrl<{}, EditorState> {
this.application.componentManager!.contextItemDidChangeInArea(ComponentArea.NoteTags); this.application.componentManager!.contextItemDidChangeInArea(ComponentArea.NoteTags);
} }
reloadStackComponents() { async reloadStackComponents() {
this.setState({ const stackComponents = sortAlphabetically(
stackComponents: sortAlphabetically( this.application.componentManager!.componentsForArea(ComponentArea.EditorStack)
this.application.componentManager!.componentsForArea(ComponentArea.EditorStack) .filter(component => component.active)
.filter(component => component.active) );
)
});
if (this.note) { if (this.note) {
for (const component of this.state.stackComponents) { for (const component of stackComponents) {
if (component.active) { if (component.active) {
this.application.componentManager!.setComponentHidden( this.application.componentManager!.setComponentHidden(
component, component,
@@ -1097,6 +1095,7 @@ class EditorViewCtrl extends PureViewCtrl<{}, EditorState> {
} }
} }
} }
await this.setState({ stackComponents });
this.application.componentManager!.contextItemDidChangeInArea(ComponentArea.EditorStack); this.application.componentManager!.contextItemDidChangeInArea(ComponentArea.EditorStack);
} }