Reputation: 1260
I would like to have widget that can have <button><a></a></button>
inside. Unfortunately CKE deletes <a></a>
. How to overcome this?
This is the code:
CKEDITOR.plugins.add( 'interButton', {
requires: 'widget',
icons: 'interButton',
init: function( editor ) {
editor.widgets.add('interButton', {
button: 'Add Button',
template:
'<button><a></a></button>',
allowedContent:
'button[*]{*}(*); a[*]{*}(*)',
upcast: function( element ) {
return element.name == 'button';
}
});
}
});
Upvotes: 0
Views: 388
Reputation: 1284
You can push certain elements to the protectedSource and CKE will obey.
example:
config.protectedSource.push(/<button[^>]*><a[^>]*><\/a><\/button>/g);
I haven't tested the above, but it should work.
Upvotes: 1