mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
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:
parent
c6f0abf732
commit
7953d131ae
@ -269,7 +269,9 @@ COPY web/package.json web/package-lock.json ./
|
|||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
COPY web/ ./
|
COPY web/ ./
|
||||||
RUN npm run build
|
RUN npm run build \
|
||||||
|
&& mv dist/BASE_PATH/monacoeditorwork/* dist/assets/ \
|
||||||
|
&& rm -rf dist/BASE_PATH
|
||||||
|
|
||||||
# Collect final files in a single layer
|
# Collect final files in a single layer
|
||||||
FROM scratch AS rootfs
|
FROM scratch AS rootfs
|
||||||
|
@ -243,6 +243,7 @@ http {
|
|||||||
sub_filter '"/BASE_PATH/dist/' '"$http_x_ingress_path/dist/';
|
sub_filter '"/BASE_PATH/dist/' '"$http_x_ingress_path/dist/';
|
||||||
sub_filter '"/BASE_PATH/js/' '"$http_x_ingress_path/js/';
|
sub_filter '"/BASE_PATH/js/' '"$http_x_ingress_path/js/';
|
||||||
sub_filter '"/BASE_PATH/assets/' '"$http_x_ingress_path/assets/';
|
sub_filter '"/BASE_PATH/assets/' '"$http_x_ingress_path/assets/';
|
||||||
|
sub_filter '"/BASE_PATH/monacoeditorwork/' '"$http_x_ingress_path/assets/';
|
||||||
sub_filter 'return"/BASE_PATH/"' 'return window.baseUrl';
|
sub_filter 'return"/BASE_PATH/"' 'return window.baseUrl';
|
||||||
sub_filter '<body>' '<body><script>window.baseUrl="$http_x_ingress_path/";</script>';
|
sub_filter '<body>' '<body><script>window.baseUrl="$http_x_ingress_path/";</script>';
|
||||||
sub_filter_types text/css application/javascript;
|
sub_filter_types text/css application/javascript;
|
||||||
|
@ -50,6 +50,13 @@ export default function Config() {
|
|||||||
|
|
||||||
const modelUri = Uri.parse('a://b/api/config/schema.json');
|
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({
|
setDiagnosticsOptions({
|
||||||
enableSchemaRequest: true,
|
enableSchemaRequest: true,
|
||||||
hover: true,
|
hover: true,
|
||||||
@ -66,7 +73,7 @@ export default function Config() {
|
|||||||
|
|
||||||
window.editor = editor.create(document.getElementById('container'), {
|
window.editor = editor.create(document.getElementById('container'), {
|
||||||
language: 'yaml',
|
language: 'yaml',
|
||||||
model: editor.createModel(config, 'yaml', modelUri),
|
model: yamlModel,
|
||||||
scrollBeyondLastLine: false,
|
scrollBeyondLastLine: false,
|
||||||
theme: 'vs-dark',
|
theme: 'vs-dark',
|
||||||
});
|
});
|
||||||
|
@ -10,7 +10,8 @@ export default defineConfig({
|
|||||||
'import.meta.vitest': 'undefined',
|
'import.meta.vitest': 'undefined',
|
||||||
},
|
},
|
||||||
plugins: [preact(), monacoEditorPlugin.default({
|
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: {
|
test: {
|
||||||
environment: 'jsdom',
|
environment: 'jsdom',
|
||||||
|
Loading…
Reference in New Issue
Block a user