diff --git a/src/bundle/Resources/public/js/CKEditor/core/base-ckeditor.js b/src/bundle/Resources/public/js/CKEditor/core/base-ckeditor.js index 517d6276..b78a00e3 100644 --- a/src/bundle/Resources/public/js/CKEditor/core/base-ckeditor.js +++ b/src/bundle/Resources/public/js/CKEditor/core/base-ckeditor.js @@ -125,7 +125,15 @@ const VIEWPORT_TOP_OFFSET_DISTRACTION_FREE_MODE = 0; const wrapper = this.getHTMLDocumentFragment(container.closest('.ibexa-data-source').querySelector('textarea').value); const section = wrapper.childNodes[0]; const { toolbar, extraPlugins = [], extraConfig = {} } = window.ibexa.richText.CKEditor; - const locale = new Intl.Locale(doc.querySelector('meta[name="LanguageCode"]').content); + let locale; + try { + locale = new Intl.Locale(doc.querySelector('meta[name="LanguageCode"]').content); + } catch (e) { + console.warn( + `Unsupported LanguageCode '${doc.querySelector('meta[name="LanguageCode"]').content}' - using fallback 'eng-GB'.`, + ); + locale = new Intl.Locale('eng-GB'); + } const blockCustomStyles = Object.entries(ibexa.richText.customStyles) .filter(([, customStyleConfig]) => !customStyleConfig.inline) .map(([customStyleName, customStyleConfig]) => {