fix: correctly switch between editors

This commit is contained in:
Baptiste Grob
2020-08-20 12:03:10 +02:00
parent 4b173bdf64
commit 7521847444
2 changed files with 4 additions and 4 deletions

View File

@@ -205,7 +205,7 @@
)
component-view.component-view(
component-uuid='self.state.editorComponent.uuid',
ng-if='self.state.editorComponent && !self.state.editorComponentUnloading',
ng-if='self.state.editorComponent && !self.state.editorUnloading',
on-load='self.onEditorLoad',
application='self.application'
)

View File

@@ -344,9 +344,6 @@ class EditorViewCtrl extends PureViewCtrl<{}, EditorState> {
const newEditor = this.application.componentManager!.editorForNote(this.note);
const currentEditor = this.state.editorComponent;
if (currentEditor?.uuid !== newEditor?.uuid) {
if (currentEditor) {
await this.application.componentManager!.deactivateComponent(currentEditor.uuid);
}
await this.setState({
editorComponent: newEditor,
/** Unload current component view so that we create a new one */
@@ -355,6 +352,9 @@ class EditorViewCtrl extends PureViewCtrl<{}, EditorState> {
if (newEditor && !newEditor.active) {
await this.application.componentManager!.activateComponent(newEditor.uuid);
}
if (currentEditor) {
await this.application.componentManager!.deactivateComponent(currentEditor.uuid);
}
await this.setState({
/** Reload component view */
editorUnloading: false