Following situation:
I have a wiget which just adds an uneditable div with the text "open" and a class marking it as widget. When this widget is being inserted in the editor I'd like to add a view "br" elements after it PLUS adding the widget again with another additional class. Putting all this html in the template property does not seem to work at all:
CKEDITOR.plugins.add( 'tabs', { requires: 'widget', icons: 'tabs', init: function( editor ) { editor.widgets.add( 'tabs', { allowedContent: 'div(!tabs,tabs-end)', requiredContent: 'div(tabs,tabs-end)', template: '<div class="tabs">Open</div> <br /> <div class="tabs tabs-end">Close</div>', button: 'Create Tabs', upcast: function( element, data ) { return element.name == 'div' && (element.hasClass( 'tabs' ) || element.hasClass( 'tabs-end' )); } } ); editor.ui.addButton( 'tabs', { label : 'Tabs erstellen', command : 'tabs' }); } } );
How can I do that?
You need to implement your
You need to implement your own command and execute the 'tabs' command twice inside it. Your buttons should point to that command instead of 'tabs'.
Piotrek (Reinmar) Koszuliński
CKEditor JavaScript Developer
--
CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Thanks for you answer. Is
Thanks for you answer. Is there anything wrong about doing it like so:
Hmm... it should work. It's a
Hmm... it should work. It's a pretty unusuall usage, because widget's command start to insert two widgets, but you can do that.
Piotrek (Reinmar) Koszuliński
CKEditor JavaScript Developer
--
CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
thanks for you help!
thanks for you help!