Skip to content

Commit a9d2bcf

Browse files
mortalYoungmumiao
authored andcommitted
fix: improve editor content change
1 parent 54cc07c commit a9d2bcf

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/controller/editor.tsx

+1-9
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ export class EditorController extends Controller implements IEditorController {
161161

162162
public onSelectTab = (tabId: string, groupId: number) => {
163163
this.editorService.setActive(groupId, tabId);
164-
this.updateCurrentValue();
165164
this.emit(EditorEvent.OnSelectTab, tabId, groupId);
166165
};
167166

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

283282
private initializeFile(path: string, value: string, language: string) {
284283
let model = monacoEditor.getModel(Uri.parse(path));
285-
const { current } = this.editorService.getState();
286284
if (model) {
287-
current?.editorInstance?.executeEdits('update-value', [
288-
{
289-
range: model.getFullModelRange(),
290-
text: value,
291-
forceMoveMarkers: true,
292-
},
293-
]);
285+
model.setValue(value);
294286
} else {
295287
model = monacoEditor.createModel(value, language, Uri.parse(path));
296288
}

0 commit comments

Comments
 (0)