Skip to content

Commit

Permalink
Merge branch 't/11086'
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Jasiun committed Jan 13, 2014
2 parents ebd3500 + f65eda5 commit 0016523
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -26,6 +26,7 @@ CKEditor 4 Changelog
* [#10787](http://dev.ckeditor.com/ticket/10787): [Firefox] Fixed: Broken replacement of text while pasting into div-based editor.
* [#10884](http://dev.ckeditor.com/ticket/10884): Widgets integration with [Showblocks](http://ckeditor.com/addon/showblocks) plugin.
* [#11021](http://dev.ckeditor.com/ticket/11021): Fixed: An error thrown when selecting entire editable's contents while fake selection is on.
* [#11086](http://dev.ckeditor.com/ticket/11086): [IE8]Re enable inline widgets drag & drop on IE8.

## CKEditor 4.3.1

Expand Down
23 changes: 14 additions & 9 deletions plugins/widget/plugin.js
Expand Up @@ -838,10 +838,6 @@
* @property {CKEDITOR.dom.element} wrapper
*/

// #11074 - IE8 throws exceptions when dragging widget using the native method.
if ( this.inline && CKEDITOR.env.ie && CKEDITOR.env.version < 9 )
this.draggable = false;

widgetsRepo.fire( 'instanceCreated', this );

setupWidget( this, widgetDef );
Expand Down Expand Up @@ -1781,6 +1777,11 @@
return element.hasAttribute( 'data-cke-temp' );
}

// @param {CKEDITOR.dom.element}
function isDragHandler2( element ) {
return element.type == CKEDITOR.NODE_ELEMENT && element.hasAttribute( 'data-cke-widget-drag-handler' );
}

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.
Expand Down Expand Up @@ -1934,10 +1935,12 @@
lineutils = CKEDITOR.plugins.lineutils;

editor.on( 'contentDom', function() {
var editable = editor.editable();
var editable = editor.editable(),
// #11123 Firefox needs to listen on document, because otherwise event won't be fired.
// #11086 IE8 cannot listen on document.
dropTarget = ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 ) || editable.isInline() ? editable : editor.document;

// #11123 Firefox needs to listen on document, because otherwise event won't be fired.
editable.attachListener( editable.isInline() ? editable : editor.document, 'drop', function( evt ) {
editable.attachListener( dropTarget, 'drop', function( evt ) {
var dataStr = evt.data.$.dataTransfer.getData( 'text' ),
dataObj,
sourceWidget,
Expand Down Expand Up @@ -2747,8 +2750,10 @@
// #11145: [IE8] Non-editable content of widget is draggable.
if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 ) {
widget.wrapper.on( 'dragstart', function( evt ) {
// Allow text dragging inside nested editables.
if ( !getNestedEditable( widget, evt.data.getTarget() ) )
var target = evt.data.getTarget();

// Allow text dragging inside nested editables or dragging inline widget's drag handler.
if ( !getNestedEditable( widget, target ) && !( widget.inline && isDragHandler2( target ) ) )
evt.data.preventDefault();
} );
}
Expand Down

0 comments on commit 0016523

Please sign in to comment.