mirror of
https://github.com/danbulant/monaco-yaml
synced 2026-09-20 14:54:15 +00:00
Dispose the old model before switching in demo
This prevents errors.
This commit is contained in:
parent
979ed62d6f
commit
3a0b164c51
1 changed files with 4 additions and 1 deletions
|
|
@ -152,7 +152,10 @@ fetch('https://www.schemastore.org/api/json/catalog.json').then(async (response)
|
||||||
});
|
});
|
||||||
|
|
||||||
select.addEventListener('change', () => {
|
select.addEventListener('change', () => {
|
||||||
ed.setModel(editor.createModel(ed.getValue(), 'yaml', Uri.parse(select.value)));
|
const oldModel = ed.getModel();
|
||||||
|
const newModel = editor.createModel(oldModel.getValue(), 'yaml', Uri.parse(select.value));
|
||||||
|
ed.setModel(newModel);
|
||||||
|
oldModel.dispose();
|
||||||
});
|
});
|
||||||
|
|
||||||
function* iterateSymbols(
|
function* iterateSymbols(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue