diff --git a/assets/js/field-text-editor.js b/assets/js/field-text-editor.js index 653d4caaa5..6f05710cf7 100644 --- a/assets/js/field-text-editor.js +++ b/assets/js/field-text-editor.js @@ -6,7 +6,9 @@ import Trix from 'trix/dist/trix'; // Provide Trix variable globally to allow custom backend pages to use it window.Trix = Trix; -document.addEventListener('DOMContentLoaded', () => { +// Listening to the DOMLoadedContent event is too late because the Trix editor is already initialized. +// To be sure to handle properly the custom configuration, we have to to listen to the trix-before-initialize event. +document.addEventListener('trix-before-initialize', () => { new TextEditorField(); });