Skip to content

Commit

Permalink
IBX-8502: Added unsupported locale fallback (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
reithor authored Aug 20, 2024
1 parent 0a3b830 commit 369f36f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/bundle/Resources/public/js/CKEditor/core/base-ckeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]) => {
Expand Down

0 comments on commit 369f36f

Please sign in to comment.