diff --git a/app/assets/javascripts/views/editor/editor-view.pug b/app/assets/javascripts/views/editor/editor-view.pug index ae2ce369b..e0ba096a0 100644 --- a/app/assets/javascripts/views/editor/editor-view.pug +++ b/app/assets/javascripts/views/editor/editor-view.pug @@ -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' ) diff --git a/app/assets/javascripts/views/editor/editor_view.ts b/app/assets/javascripts/views/editor/editor_view.ts index 61276e5f0..904b90242 100644 --- a/app/assets/javascripts/views/editor/editor_view.ts +++ b/app/assets/javascripts/views/editor/editor_view.ts @@ -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