mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-03 09:45:22 +03:00
Fix error when model already exists
This commit is contained in:
parent
30ba285c9e
commit
88c91d2126
@ -50,6 +50,13 @@ export default function Config() {
|
||||
|
||||
const modelUri = Uri.parse('a://b/api/config/schema.json');
|
||||
|
||||
let yamlModel;
|
||||
if (editor.getModels().length > 0) {
|
||||
yamlModel = editor.getModel(modelUri)
|
||||
} else {
|
||||
yamlModel = editor.createModel(config, 'yaml', modelUri)
|
||||
}
|
||||
|
||||
setDiagnosticsOptions({
|
||||
enableSchemaRequest: true,
|
||||
hover: true,
|
||||
@ -66,7 +73,7 @@ export default function Config() {
|
||||
|
||||
window.editor = editor.create(document.getElementById('container'), {
|
||||
language: 'yaml',
|
||||
model: editor.createModel(config, 'yaml', modelUri),
|
||||
model: yamlModel,
|
||||
scrollBeyondLastLine: false,
|
||||
theme: 'vs-dark',
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user