| 177 | } |
| 178 | |
| 179 | componentDidUpdate(prevProps) { |
| 180 | const { path/*, ...rest*/ } = this.props; |
| 181 | |
| 182 | //this._editor.updateOptions(rest); * TODO - Ryan |
| 183 | |
| 184 | if (path !== prevProps.path) { |
| 185 | this.editorStates.set(prevProps.path, this.editor.saveViewState()); |
| 186 | this._openFile(path); |
| 187 | } |
| 188 | else { |
| 189 | const model = this.editor.getModel(); |
| 190 | if (value !== model.getValue()) { |
| 191 | model.pushEditOperations( |
| 192 | [], |
| 193 | [ |
| 194 | { |
| 195 | range: model.getFullModelRange(), |
| 196 | text: value, |
| 197 | } |
| 198 | ] |
| 199 | ); |
| 200 | } |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | componentWillUnmount() { |
| 205 | // dispose to prevent memory leaks |