fix: correctly switch between editors
This commit is contained in:
@@ -205,7 +205,7 @@
|
|||||||
)
|
)
|
||||||
component-view.component-view(
|
component-view.component-view(
|
||||||
component-uuid='self.state.editorComponent.uuid',
|
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',
|
on-load='self.onEditorLoad',
|
||||||
application='self.application'
|
application='self.application'
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -344,9 +344,6 @@ class EditorViewCtrl extends PureViewCtrl<{}, EditorState> {
|
|||||||
const newEditor = this.application.componentManager!.editorForNote(this.note);
|
const newEditor = this.application.componentManager!.editorForNote(this.note);
|
||||||
const currentEditor = this.state.editorComponent;
|
const currentEditor = this.state.editorComponent;
|
||||||
if (currentEditor?.uuid !== newEditor?.uuid) {
|
if (currentEditor?.uuid !== newEditor?.uuid) {
|
||||||
if (currentEditor) {
|
|
||||||
await this.application.componentManager!.deactivateComponent(currentEditor.uuid);
|
|
||||||
}
|
|
||||||
await this.setState({
|
await this.setState({
|
||||||
editorComponent: newEditor,
|
editorComponent: newEditor,
|
||||||
/** Unload current component view so that we create a new one */
|
/** Unload current component view so that we create a new one */
|
||||||
@@ -355,6 +352,9 @@ class EditorViewCtrl extends PureViewCtrl<{}, EditorState> {
|
|||||||
if (newEditor && !newEditor.active) {
|
if (newEditor && !newEditor.active) {
|
||||||
await this.application.componentManager!.activateComponent(newEditor.uuid);
|
await this.application.componentManager!.activateComponent(newEditor.uuid);
|
||||||
}
|
}
|
||||||
|
if (currentEditor) {
|
||||||
|
await this.application.componentManager!.deactivateComponent(currentEditor.uuid);
|
||||||
|
}
|
||||||
await this.setState({
|
await this.setState({
|
||||||
/** Reload component view */
|
/** Reload component view */
|
||||||
editorUnloading: false
|
editorUnloading: false
|
||||||
|
|||||||
Reference in New Issue
Block a user