Opened 9 years ago

Closed 9 years ago

#12789 closed Bug (duplicate)

forcePasteAsPlainText strips inline widget html when dropping

Reported by: Brian Mahler Owned by:
Priority: Normal Milestone:
Component: UI : Widgets Version: 4.3
Keywords: Cc:


If you have an inline widget with html in the template. When you drag and drop it, the surrounding html is stripped from the widget. I was able to fix this by modifying the widget plugin.js to work like the pastefromword plugin. Here are my modifications.

function finalizeNativeDrop( editor, sourceWidget, range ) {

Save the snapshot with the state before moving widget. Focus widget, so when we'll undo the DnD, widget will be focused. sourceWidget.focus(); 'saveSnapshot' );

Lock snapshot to group all steps of moving widget from the original place to the new one. 'lockSnapshot', { dontUpdate: true } );;

var widgetHtml = sourceWidget.wrapper.getOuterHtml(); sourceWidget.wrapper.remove(); editor.widgets.destroy(sourceWidget, true); editor.once('beforePaste', function(evt) { = 'html';


editor.execCommand( 'paste', widgetHtml ); 'unlockSnapshot' );


Change History (1)

comment:1 Changed 9 years ago by Jakub Ś

Resolution: duplicate
Status: newclosed

Problem can be reproduced in every browser from CKEditor 4.3.

Just add forcePasteAsPlainText : true to CKEditor configuration and try to DnD widget like MathJax.

This issue is however a duplicate of #11343 and I will have to close it as such.

@bhmahler could I ask you to prepare pull request ( for with your solution for issue #11343? That way it has much better chance to get reviewed and implemented in the future.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy