File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
src/Resources/views/Admin Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 211211 setupRichEditor (editor, tags, locale);
212212 });
213213
214+ // This event authorized external JS script to activate Rich Editor on a RichEditor input.
215+ // It's usefull in case of AJAX loaded input or in case of dynmamic DOM addition.
216+ document .addEventListener (' mbiz:rich-editor:add-editor' , (e ) => {
217+ const {editor } = e .detail ;
218+ if (editor === null || editor .dataset .component === undefined || editor .dataset .component !== ' rich-editor' ) {
219+ return ;
220+ }
221+ let tags = editor .dataset .tags .length === 0 ? [] : editor .dataset .tags .split (' ,' )
222+ let locale = editor .dataset .locale ? editor .dataset .locale : fallBackLocale;
223+ setupRichEditor (editor, tags, locale);
224+ });
225+
214226 // JQuery event triggered by @SyliusUiBundle/Resources/private/js/sylius-form-collection.js
215227 $ (document ).on (' collection-form-add' , (event , addedElement ) => {
216228 document .dispatchEvent (new CustomEvent (' rich-editor:reload' , {
You can’t perform that action at this time.
0 commit comments