forked from Github/frigate
Fix monaco editor issues (#4724)
* Add sub filter for monaco editor * Don't include files for unused languages * Move necessary files and cleanup build * Update sub filter for new location * Still need to include default editor worker * Fix error when model already exists
This commit is contained in:
@@ -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',
|
||||
});
|
||||
|
||||
@@ -10,7 +10,8 @@ export default defineConfig({
|
||||
'import.meta.vitest': 'undefined',
|
||||
},
|
||||
plugins: [preact(), monacoEditorPlugin.default({
|
||||
customWorkers: [{label: 'yaml', entry: 'monaco-yaml/yaml.worker'}]
|
||||
customWorkers: [{ label: 'yaml', entry: 'monaco-yaml/yaml.worker' }],
|
||||
languageWorkers: ['editorWorkerService'], // we don't use any of the default languages
|
||||
})],
|
||||
test: {
|
||||
environment: 'jsdom',
|
||||
|
||||
Reference in New Issue
Block a user