diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e0ceaf..99bc8d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## [Unreleased] +### Added +* allow to use `window.tinymceModes` to add or override tinymce modes ### Fixed * fix default crud sort * fix hidden save button in file manager diff --git a/src/core/Resources/assets/js/modules/tinymce.js b/src/core/Resources/assets/js/modules/tinymce.js index d5d1f61..798f117 100644 --- a/src/core/Resources/assets/js/modules/tinymce.js +++ b/src/core/Resources/assets/js/modules/tinymce.js @@ -53,7 +53,7 @@ const fileManagerBrowser = function (callback) { }) } -if (typeof window.tinymce !== 'undefined') { +const createTinymceConfig = function () { window.tinymce.murph = window.tinymce.murph || {} window.tinymce.murph.selector = window.tinymce.murph.selector || '*[data-tinymce]' window.tinymce.murph.configurationBase = window.tinymce.murph.configurationBase || { @@ -80,6 +80,7 @@ if (typeof window.tinymce !== 'undefined') { } window.tinymce.murph.modes = window.tinymce.murph.modes || {} + window.tinymceModes = window.tinymceModes || {} window.tinymce.murph.modes.default = window.tinymce.murph.modes.default || { plugins: 'print preview importcss searchreplace visualblocks visualchars fullscreen template table charmap hr pagebreak nonbreaking toc insertdatetime advlist lists wordcount textpattern noneditable help charmap quickbars link image code autoresize', @@ -95,6 +96,11 @@ if (typeof window.tinymce !== 'undefined') { toolbar: 'undo redo | bold italic underline' } + window.tinymce.murph.modes = { + ...window.tinymce.murph.modes, + ...window.tinymceModes + } + tinymce.addI18n('fr_FR', { Redo: 'R\u00e9tablir', Undo: 'Annuler', @@ -612,15 +618,12 @@ const doInitEditor = () => { } module.exports = function () { - if (typeof tinymce === 'undefined') { - return - } - const observer = new MutationObserver(doInitEditor) const config = { attributes: false, childList: true, subtree: true } observer.observe(document.querySelector('body'), config) $(() => { + createTinymceConfig() doInitEditor() $('body').on('hidden.bs.modal', '.modal', (e) => {