Rasmus Vind
Well-known member
My site supports a special programming language highlighting with [code=jass]. I very much like to highlight this, so my graphic artist created an icon for it. The only problem is that I can't seem to create a custom button for it. The only real way to do this from my eyes is to create a new BB code tag for [jass] but I'd rather piggy back on the existing foundation of [code].
I was looking into running this code on the clientside, but it did not do anything:
	
	
	
		
Any tips?
				
			I was looking into running this code on the clientside, but it did not do anything:
		JavaScript:
	
	const name = 'code';
const defTitle = 'JASS code highlight';
const tagUpper = 'code';
const template = {
    template: 'image',
    SRC: '"' + XF.canonicalizeUrl('styles/default/ratory/trigger_tag.png') + '"',
    ALT: '"' + defTitle + '"'
};
var config = {
    title: defTitle,
    icon: name,
    undo: true,
    focus: true,
    callback: function()
    {
        XF.EditorHelpers.wrapSelectionText(
            this,
            '[' + tagUpper + '=jass]',
            '[/' + tagUpper + ']',
            true
        );
    }
};
FroalaEditor.DefineIcon(name, template);
FroalaEditor.RegisterCommand(name, config);
XF.editorStart.custom.push(name);Any tips?
 
 
		 
 
		
 
 
		 
 
		 
 
		 
 
		 
 
		