From 0f4607a070dc4635ac260dd67d322079770cadd9 Mon Sep 17 00:00:00 2001 From: Sergey Krashevich Date: Sat, 27 Dec 2025 08:08:28 +0300 Subject: [PATCH] Improve YAML language detection in config.html Refactored the logic for detecting the YAML language in Monaco editor to handle cases where getLanguages may not be available or Monaco is not loaded. This increases robustness and prevents potential runtime errors. --- www/config.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/www/config.html b/www/config.html index 9d01ec4a..d541a780 100644 --- a/www/config.html +++ b/www/config.html @@ -52,7 +52,13 @@ container.textContent = ''; const ensureYamlLanguage = () => { - const hasYaml = (monaco.languages.getLanguages?.() || []).some((l) => l.id === 'yaml'); + const languages = + (window.monaco && + monaco.languages && + typeof monaco.languages.getLanguages === 'function' && + monaco.languages.getLanguages()) || + []; + const hasYaml = languages.some((l) => l.id === 'yaml'); if (hasYaml) return; monaco.languages.register({