refactor(multi): DRY out view state changes
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
1e1a0939ab
commit
dfbf1ae9ae
@ -291,16 +291,12 @@ class Editor extends Component {
|
|||||||
this.setState({ fileKey: newFileKey });
|
this.setState({ fileKey: newFileKey });
|
||||||
const editor = this._editor;
|
const editor = this._editor;
|
||||||
const currentState = editor.saveViewState();
|
const currentState = editor.saveViewState();
|
||||||
|
|
||||||
const currentModel = editor.getModel();
|
const currentModel = editor.getModel();
|
||||||
if (currentModel === this.data.indexjs.model) {
|
|
||||||
this.data.indexjs.state = currentState;
|
for (const key in this.data) {
|
||||||
} else if (currentModel === this.data.indexcss.model) {
|
if (currentModel === this.data[key].model) {
|
||||||
this.data.indexcss.state = currentState;
|
this.data[key].state = currentState;
|
||||||
} else if (currentModel === this.data.indexhtml.model) {
|
}
|
||||||
this.data.indexhtml.state = currentState;
|
|
||||||
} else if (currentModel === this.data.indexjsx.model) {
|
|
||||||
this.data.indexjsx.state = currentState;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
editor.setModel(this.data[newFileKey].model);
|
editor.setModel(this.data[newFileKey].model);
|
||||||
|
Reference in New Issue
Block a user