I'm adapting wthis widget for my template.
I cannot configure the filter to accept images and figure inside my widget.
I'm handling image as widget with image2 plugin, but I don't need to have widget inside widget (I know that is not possible to nest widget): whan I insert an image i can lose the widget functionality.
I need just to create a template that accept images and figure! This is my plugin.
CKEDITOR.plugins.add( 'ddayblock', {
requires: 'widget',
icons: 'ddayblock',
init: function( editor ) {
// Register the editing dialog.
CKEDITOR.dialog.add( 'ddayblock', this.path + 'dialogs/ddayblock.js' );
// Register the ddayblock widget.
editor.widgets.add( 'ddayblock', {
allowedContent:
'section figure div p[*]',
requiredContent: 'section(balanced-spaced)',
editables: {
title: {
selector: '.left',
allowedContent: 'p br ul ol li strong figure img em'
},
content: {
selector: '.right',
allowedContent: 'p br ul ol li strong figure img em'
}
},
template:
'<section class="balanced-spaced indented-left">' +
'<div class="left">Title</div>' +
'<div class="right">Title</div>' +
'</section>',
button: 'Create a block',
dialog: 'ddayblock',
upcast: function( element ) {
return element.name == 'section' && element.hasClass( 'balanced-spaced' );
},
init: function() {
var width = this.element.getStyle( 'width' );
if ( width )
this.setData( 'width', width );
if ( this.element.hasClass( 'align-left' ) )
this.setData( 'align', 'left' );
if ( this.element.hasClass( 'align-right' ) )
this.setData( 'align', 'right' );
if ( this.element.hasClass( 'align-center' ) )
this.setData( 'align', 'center' );
},
data: function() {
if ( this.data.width == '' )
this.element.removeStyle( 'width' );
else
this.element.setStyle( 'width', this.data.width );
// Brutally remove all align classes and set a new one if "align" widget data is set.
this.element.removeClass( 'align-left' );
this.element.removeClass( 'align-right' );
this.element.removeClass( 'align-center' );
if ( this.data.align )
this.element.addClass( 'align-' + this.data.align );
}
} );
}
} );

See http://ckeditor.com
See http://ckeditor.com/comment/130845#comment-130845. Bad news, I know.
Piotrek (Reinmar) Koszuliński
CKEditor JavaScript Developer
--
CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
I solved it!
I solved it!
I modify the image2 plugin to accept only img tag wrapped inside a figure tag (and I use classes for alignment).
So I insert the image wrapped with figure (so a widget) in the standard layout (and works), and an img without figure tag in the widget.