XF 2.0 Calling an editor window not working

Dannymh

Active member
Hi,

Working through a few things, I have a set of code that works for my giphy plugin but when I create a similar plugin and try to tie the even to to a custom Bb code button the system is failing to find my template and throwing the following

Code:
The requested page could not be found. (Code: invalid_action, controller: XF:Editor, action: Stselector)

The code I am using is the smilie code and I do have a template named editor_stselector

Here is my code, so far, I am just using the exact smilie code for now until I build out the function as first step is just to get the template to trigger.

Code:
var STSEL = window.STSEL || {};

!function($, window, document, _undefined)
{
    "use strict";

   
    STSEL.editorButton = {
        init: function()
        {

            if ($.FE.COMMANDS.xfCustom_stselector)
            {
                $.FE.COMMANDS.xfCustom_stselector.callback = STSEL.editorButton.callback;
            }
        },

       
        callback: function()
                {
                    var ed = this;

                    var $stselectorBox = ed.$oel.data('xfSelectorBox');
                    if ($stselectorBox)
                    {
                        $stselectorBox.toggleClassTransitioned('is-active');
                        ed.$wp.toggleClassTransitioned('smilieBox-active');
                    }
                    else
                    {
                        $stselectorBox = $('<div class="editorSmilies" />');
                        ed.$oel.data('xfSelectorrBox', $stselectorBox);
                        ed.$wp.before($stselectorBox);

                        XF.ajax('GET',
                            XF.canonicalizeUrl('index.php?editor/stselector'),
                            {},
                            function (data)
                            {
                                if (data.html)
                                {
                                    XF.setupHtmlInsert(data.html, function($html)
                                    {
                                        ed.events.bindClick($stselectorBox, 'img.smilie', function(e)
                                        {
                                            var $target = $(e.currentTarget),
                                                $img = $target.clone();

                                            $img.addClass('fr-draggable');
                                            XF.EditorHelpers.focus(ed);
                                            ed.html.insert($('<div />').html($img).html());
                                        });

                                        $stselectorBox.html($html).addClassTransitioned('is-active');
                                        ed.$wp.toggleClassTransitioned('smilieBox-active');
                                    });
                                }
                            }
                        );
                    }
                }
    };

    $(document).on('editor:first-start', STSEL.editorButton.init);
}
(jQuery, window, document);

this is the line that is causing the error, but I can not figure out why it can not find the template that does exist as a master style

Code:
XF.canonicalizeUrl('index.php?editor/stselector'),
 
Last edited:
That error isn't really suggesting it can't find the template, it's suggesting it can't find actionStselector inside the Editor controller. Have you added a class extension to the XF\Pub\Controller\Editor controller? Is there a method in there called actionStselector?
 
That error isn't really suggesting it can't find the template, it's suggesting it can't find actionStselector inside the Editor controller. Have you added a class extension to the XF\Pub\Controller\Editor controller? Is there a method in there called actionStselector?

I haven't but the same wasn't needed for the Giphy code. The Giphy one worked with the exact same setup as this

- template modification to include the options to JS
- Include this JS code
- Include CSS
- Create custom button and tie this to it

i'll add it to the controller just a bit stumped as to how it is working for giphy but not for this
 
That error isn't really suggesting it can't find the template, it's suggesting it can't find actionStselector inside the Editor controller. Have you added a class extension to the XF\Pub\Controller\Editor controller? Is there a method in there called actionStselector?


cancel that you are right there was something I had missed, thank you
 
Back
Top Bottom