DragonByte Tech
Well-known member
TL;DR: How can I add a new element handler to the editor similar to
---
I want to add a new mention-like feature to the editor (just initialised by another character), and I'm stuck trying to figure out how I would apply the handler.
In editor.js I see this code:
Ideally I would want my code to run after
I see the
Any advice would be greatly appreciated
Fillip
user-mentioner
?---
I want to add a new mention-like feature to the editor (just initialised by another character), and I'm stuck trying to figure out how I would apply the handler.
In editor.js I see this code:
JavaScript:
function getBbCodeBox()
{
var $oel = ed.$oel;
var $bbCodeBox = $oel.data('xfBbCodeBox');
if (!$bbCodeBox)
{
var borderAdjust = parseInt(ed.$wp.css('border-bottom-width'), 10)
+ parseInt(ed.$wp.css('border-top-width'), 10);
$bbCodeBox = $('<textarea class="input" style="display: none" />');
$bbCodeBox.css({
minHeight: ed.opts.heightMin ? (ed.opts.heightMin + borderAdjust) + 'px' : null,
maxHeight: ed.opts.heightMax ? ed.opts.heightMax + 'px' : null,
height: ed.opts.height ? (ed.opts.height + borderAdjust) + 'px' : null,
padding: ed.$el.css('padding')
});
$bbCodeBox.attr('name', $oel.data('original-name'));
$oel.data('xfBbCodeBox', $bbCodeBox);
ed.$wp.after($bbCodeBox);
XF.Element.applyHandler($bbCodeBox, 'textarea-handler');
XF.Element.applyHandler($bbCodeBox, 'user-mentioner');
}
return $bbCodeBox;
}
Ideally I would want my code to run after
XF.Element.applyHandler($bbCodeBox, 'user-mentioner');
in order to apply my own handler.I see the
XF.extend
system but it only seems to apply to classes like XF.EditorDialog
that have added explicit support for extensions.Any advice would be greatly appreciated
Fillip