XF 2.0 (JS) Attach focus trigger event to editor row

Lukas W.

Well-known member
Licensed customer
Is there a way to attach the focus-trigger event from xf/core/action.js to an editor row? I'm basically trying to implement a submit button that pops up when you click the froala editor, just like it does in the profile post section in the member profile when you click the profile post textarea. Simply adding data-xf-init="focus-trigger" data-display="< :next" to the <xf:editorrow> tag doesn't seem to work, the attributes just disappear after the tag rendering.
 
You'd likely have to extend the formEditor function in the Templater and edit the public:editor template.
 
Phew, that sounds like a bunch of work for such a little feature. Thanks for the hints though!
 
I've built a simpler workaround for this. Basically I've wrapped the editorrow in an additional class and attached the following event to it:

JavaScript:
$('.some-unique-editor-wrapper-class').one('click', function ($event) {
    /* Under the assumption, that the element right after the wrapper is the submit button */
    $(this).next().addClassTransitioned('is-active');
});
 
Back
Top Bottom