• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

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

#1
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.