Wednesday 14 April 2010 7:31:28 pm - 6 replies
Hello,
I would like to know, if it's possible, how to display a new button in the oe toolbar.
My goal is to display a specific button which call a specific custom tag in order to avoid passing through the specific custom tag screen.
I've already managed the creation of my custom tag (named mycustomtag) and display a button on the oe tool bar. However, my button doesn't call any javascript event.
Thank you for your help,
Laurent
Friday 16 April 2010 12:58:11 pm
sub and sup are native commands, and use native tags, you can't use that as your limited to what the xhtml parser in ezoe supports.
But it is possible to create custom commands that create a custom tag with a predefined name, take a look at how pagebreak is implemented, it's part of the ez theme, but could just as well have been in an TinyMCE plugin (and yes, that is how you should implement this).
The pagebreak pieces as an example (this button only inserts a tag, it does not work on/off like sub/sup does):
// Control name lookup, format: title, command
controls : {
....
pagebreak : ['pagebreak_desc', 'mcePageBreak'],
_mcePageBreak : function( ui, val )
{
var ed = this.editor, n = ed.selection.getNode();
if ( n.nodeName === 'P' && n.parentNode.nodeName === 'BODY' )
ed.execCommand('mceInsertRawHTML', false, '</p><div type="custom" class="pagebreak mceItemCustomTag"><p>pagebreak</p></div><p>');
else if ( n.nodeName === 'BODY' )
ed.execCommand ('mceInsertRawHTML', false, '<div type="custom" class="pagebreak mceItemCustomTag"><p>pagebreak</p></div>');
else
alert( 'Not a suported location for a pagebreak, place it in the root of your document!' );
},
Modified on Friday 16 April 2010 12:58:38 pm by André R
Thursday 29 March 2012 3:15:44 am
Sebastiaan did indeed write a blog post, and it was good.
You must be logged in to post messages in this topic!