Reputation: 1284
I have a CKEditor widget resembling a tab-module.
As editables I have defined a span.title
and div.content
.
When I am in editing mode inside a span.title
and then paste something using CTRL+V, the span gets broken and I have two spans. As if it gets divided on whatever position I paste.
When I am in editing mode inside a div.content
and then paste something using CTRL+V, the contents of the clipboard are correctly inserted into that div.
Is it because span is an inline-element and div is a block-element and CKEditor doesnt allow pasting into inline-elements? Can I somehow change this behaviour?
Upvotes: 2
Views: 364
Reputation: 141
I had this issue when trying to have a <cite>
element as an editable. Trick was to tweak the CKEDITOR.dtd
properties.
// This prevents the pasting from splitting parent element.
delete CKEDITOR.dtd.$removeEmpty.cite;
// This tells the editor to allow editing in this element.
CKEDITOR.dtd.$editable.cite = 1;
I imagine this would affect the behavior of all <cite>
elements in any editor currently loaded. Not ideal in all cases for most elements, but for our requirements for a blockquote/pullquote widget, the <cite>
element is only allowed inside our <blockquote>
elements in any editor.
Upvotes: 0
Reputation: 1734
CKEditor allows pasting of block and inline elements (keep in mind that content filtering (ACF) can be used which also affects pasting) so it is probably not the issue in this case.
I would also make sure that the content which you are trying to paste does not contain any HTML which may cause the behavior you described.
If you could provide widget HTML/template or code which you are using I will be glad to investigate this issue in more depth.
Upvotes: 1