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
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.
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
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: