fix: correctly switch between editors
This commit is contained in:
@@ -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'
|
||||
)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user