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';
}
});
}
});
答案 0 :(得分:1)
您可以将某些元素推送到protectedSource,CKE也会遵守。
示例:
config.protectedSource.push(/<button[^>]*><a[^>]*><\/a><\/button>/g);
我还没有对上述内容进行测试,但它应该可行。