Skip to content

Commit

Permalink
fix: exit fullscreen model dup error
Browse files Browse the repository at this point in the history
  • Loading branch information
yangxiaolang committed Mar 11, 2024
1 parent 3df5a96 commit f7615f5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/monaco-common-editor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,10 @@ export abstract class MonacoCommonEditorComponent

createModel(value: string, uri?: string): editor.ITextModel {
const { monaco } = this.monacoProvider;
return monaco.editor.createModel(
value,
this.options.language,
uri ? monaco.Uri.parse(uri) : undefined,
);
const modelUri = uri ? monaco.Uri.parse(uri) : undefined;
const model = modelUri && monaco.editor.getModel(modelUri);
model?.dispose();
return monaco.editor.createModel(value, this.options.language, modelUri);
}

private async resetEditor() {
Expand Down

0 comments on commit f7615f5

Please sign in to comment.