fix: use register/deregister for editors instead of activate/deactivate

This commit is contained in:
Baptiste Grob
2020-08-25 17:57:22 +02:00
parent b1cde8308f
commit 696f34b788

View File

@@ -348,9 +348,9 @@ class EditorViewCtrl extends PureViewCtrl<{}, EditorState> {
/** Unload current component view so that we create a new one */ /** Unload current component view so that we create a new one */
editorUnloading: true editorUnloading: true
}); });
if (newEditor && !newEditor.active) { if (newEditor) {
/** Activate the new editor while the component view is unloading */ /** Register this new editor while the editor view is reloading */
await this.application.componentManager!.activateComponent(newEditor.uuid); this.application.componentManager!.registerComponent(newEditor.uuid);
} }
await unloading; await unloading;
const reloading = this.setState({ const reloading = this.setState({
@@ -358,9 +358,9 @@ class EditorViewCtrl extends PureViewCtrl<{}, EditorState> {
editorComponent: newEditor, editorComponent: newEditor,
editorUnloading: false, editorUnloading: false,
}); });
if (currentEditor?.active) { if (currentEditor) {
/** Deactivate the current (previous) editor while the editor view is reloading */ /** Deregister the current (previous) editor while the editor view is reloading */
await this.application.componentManager!.deactivateComponent(currentEditor.uuid); this.application.componentManager!.deregisterComponent(currentEditor.uuid);
} }
await reloading; await reloading;
this.reloadFont(); this.reloadFont();