DragonByte Tech
Well-known member
At the moment, if 3rd party add-ons want to add custom BBCode with an overlay like the Spoiler dialog, we have to overwrite the
This effectively removes the ability for users to customise the BBCode and change the wording, in the above example if they want to use another tag other than
Please consider adding another option under "Advanced Options", where you can optionally specify a dialog reference. To avoid confusion for end-users, it might be useful to only show this option when the site is in development mode.
You could then extend the
And change the
In order to ensure the dialog in question is available, I would also suggest adding a new event to
So that we can easily insert our own dialogs without having to replicate the editor start process.
I believe adding this will significantly improve the functionality of custom editor buttons added by 3rd party addons.
Fillip
xfCustom
entry in the Froala list of commands, like so:
JavaScript:
$.FE.RegisterCommand('xfCustom_charge', {
title: custom.charge.title,
icon: 'xfCustom_charge',
undo: true,
focus: true,
callback: function()
{
XF.EditorHelpers.loadDialog(this, 'dbtechCreditsCharge');
}
});
This effectively removes the ability for users to customise the BBCode and change the wording, in the above example if they want to use another tag other than
[CHARGE]
as their BBCode.Please consider adding another option under "Advanced Options", where you can optionally specify a dialog reference. To avoid confusion for end-users, it might be useful to only show this option when the site is in development mode.
You could then extend the
js-editorCustom
array like so:
JSON:
"charge":{"title":"Charge","type":"fa","value":"money","option":"yes","dialog":"dbtechCreditsCharge"}
And change the
registerCustomCommands
callback like so:
JavaScript:
if (def.dialog)
{
XF.EditorHelpers.loadDialog(this, def.dialog);
}
else
{
XF.EditorHelpers.wrapSelectionText(
this,
def.option == 'yes' ? '[' + tagUpper + '=]' : '[' + tagUpper + ']',
'[/' + tagUpper + ']',
true
);
}
In order to ensure the dialog in question is available, I would also suggest adding a new event to
registerDialogs
JavaScript:
$(document).trigger('editor:register-dialogs');
So that we can easily insert our own dialogs without having to replicate the editor start process.
I believe adding this will significantly improve the functionality of custom editor buttons added by 3rd party addons.
Fillip
Upvote
6