Skip to content

Commit

Permalink
fix: exit fullscreen model dup error (#96)
Browse files Browse the repository at this point in the history
* fix: exit fullscreen model dup error

* Create chatty-frogs-press.md
  • Loading branch information
yangxiaolang authored Mar 14, 2024
1 parent 3df5a96 commit a2d430e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/chatty-frogs-press.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ng-monaco-editor": patch
---

fix: exit fullscreen model dup error
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 a2d430e

Please sign in to comment.