Merge branch 'master' into feature/automatic-ipn-generation

This commit is contained in:
Jan Böhmer 2025-11-03 00:30:14 +01:00
commit 7a144d31c6
153 changed files with 18678 additions and 1739 deletions

View file

@ -28,6 +28,27 @@ import {EditorWatchdog} from 'ckeditor5';
import "ckeditor5/ckeditor5.css";;
import "../../css/components/ckeditor.css";
const translationContext = require.context(
'ckeditor5/translations',
false,
//Only load the translation files we will really need
/(de|it|fr|ru|ja|cs|da|zh|pl|hu)\.js$/
);
function loadTranslation(language) {
if (!language || language === 'en') {
return null;
}
const lang = language.slice(0, 2);
const path = `./${lang}.js`;
if (translationContext.keys().includes(path)) {
const module = translationContext(path);
return module.default;
} else {
return null;
}
}
/* stimulusFetch: 'lazy' */
export default class extends Controller {
connect() {
@ -63,6 +84,13 @@ export default class extends Controller {
}
}
//Load translations if not english
let translations = loadTranslation(language);
if (translations) {
//Keep existing translations (e.g. from other plugins), if any
config.translations = [window.CKEDITOR_TRANSLATIONS, translations];
}
const watchdog = new EditorWatchdog();
watchdog.setCreator((elementOrData, editorConfig) => {
return EDITOR_TYPE.create(elementOrData, editorConfig)