Call to XenForo.register doesn't work being called on event

Vladislav Rastrusny

Active member
This works ok:
PHP:
XenForo.register('textarea.BbCodeWysiwygEditor', 'XenForo.CustomEditorForMyAddon');
  });

But this doesn't:
PHP:
  $(document).on('EditorInit', function (e, data) {
  XenForo.register('textarea.BbCodeWysiwygEditor', 'XenForo.CustomEditorForMyAddon');
  });
EditorInit is executed, I can see that by placing alert(1) before XenForo.register, but the registration itself doesn't work. It doesn't register editor plugin.

EditorInit even needed in cases like with XenMediaGallery, where editor HTML code is loaded by Ajax later after DOM is complete.
 
Top Bottom