Skip to content

Commit

Permalink
fix: improve editor content change
Browse files Browse the repository at this point in the history
  • Loading branch information
mortalYoung authored and mumiao committed Jul 1, 2021
1 parent 54cc07c commit a9d2bcf
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/controller/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ export class EditorController extends Controller implements IEditorController {

public onSelectTab = (tabId: string, groupId: number) => {
this.editorService.setActive(groupId, tabId);
this.updateCurrentValue();
this.emit(EditorEvent.OnSelectTab, tabId, groupId);
};

Expand Down Expand Up @@ -282,15 +281,8 @@ export class EditorController extends Controller implements IEditorController {

private initializeFile(path: string, value: string, language: string) {
let model = monacoEditor.getModel(Uri.parse(path));
const { current } = this.editorService.getState();
if (model) {
current?.editorInstance?.executeEdits('update-value', [
{
range: model.getFullModelRange(),
text: value,
forceMoveMarkers: true,
},
]);
model.setValue(value);
} else {
model = monacoEditor.createModel(value, language, Uri.parse(path));
}
Expand Down

0 comments on commit a9d2bcf

Please sign in to comment.