Skip to content
Permalink
Browse files

Merge branch 't/13015' into major

  • Loading branch information...
Reinmar committed Jun 1, 2015
2 parents fe4de43 + 0fcb0bc commit cb5fd3a85372b564b25da006a6edd66ea6095930
@@ -22,6 +22,7 @@ Fixed Issues:
* [#13186](http://dev.ckeditor.com/ticket/13186): Fixed: Content dropped to a nested editable is not filtered by the Advanced Content Filter.
* [#13140](http://dev.ckeditor.com/ticket/13140): Fixed: Error thrown when dropping a block widget right after itself.
* [#13176](http://dev.ckeditor.com/ticket/13176): [IE8] Fixed: Errors while drag&drop of embed widgets.
* [#13015](http://dev.ckeditor.com/ticket/13015): Fixed: Dropping image file on [Enhanced Image](http://ckeditor.com/addon/image2) causes page reload.
* Toolbar configurators:
* [#13185](http://dev.ckeditor.com/ticket/13185): Fixed: Wrong position of the suggestion box if there is not enough space below the caret.
* [#13138](http://dev.ckeditor.com/ticket/13138): Fixed: The "Toggle empty elements" button label is unclear.
@@ -1341,7 +1341,17 @@
// Cancel native drop.
evt.data.preventDefault();

// Getting drop position is one of the most complex part.
var target = evt.data.getTarget(),
readOnly = target.isReadOnly();

// Do nothing if drop on non editable element (#13015).
// The <html> tag isn't editable (body is), but we want to allow drop on it
// (so it is possible to drop below editor contents).
if ( readOnly && !( target.type == CKEDITOR.NODE_ELEMENT && target.is( 'html' ) ) ) {
return;
}

// Getting drop position is one of the most complex parts.
var dropRange = clipboard.getRangeAtDropPosition( evt, editor ),
dragRange = clipboard.dragRange;

@@ -1,4 +1,4 @@
/**
/**
* @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or http://ckeditor.com/license
*/
@@ -3044,6 +3044,14 @@
widget.wrapper.append( container );
}

// Preventing page reload when dropped content on widget wrapper (#13015).
// Widget is not editable so by default drop on it isn't allowed what means that
// browser handles it (there's no editable#drop event). If there's no drop event we cannot block
// the drop, so page is reloaded. This listener enables drop on widget wrappers.
widget.wrapper.on( 'dragover', function( evt ) {
evt.data.preventDefault();
} );

widget.wrapper.on( 'mouseenter', widget.updateDragHandlerPosition, widget );
setTimeout( function() {
widget.on( 'data', widget.updateDragHandlerPosition, widget );
@@ -817,6 +817,10 @@
var dataTransfer = this.mockNativeDataTransfer(),
target = new CKEDITOR.dom.node( 'targetMock' );

target.isReadOnly = function() {
return false;
};

return {
$: {
dataTransfer: dataTransfer
@@ -958,6 +958,29 @@ var testsForMultipleEditor = {
expectedBeforePasteEventCount: 1,
expectedPasteEventCount: 0
} );
},

'test drop on non editable (#13015)': function() {
var editor = this.editors.divarea,
bot = this.editorBots[ editor.name ],
evt = bender.tools.mockDropEvent();

bot.setHtmlWithSelection( '<div><p contenteditable="false">foo</p></div>' );
editor.resetUndo();

// Target is not editable.
evt.getTarget = function() {
return editor.editable().findOne( 'p' ).getFirst();
};

var dropSpy = sinon.spy();
editor.on( 'drop', dropSpy );

var dropTarget = CKEDITOR.plugins.clipboard.getDropTarget( editor );
dropTarget.fire( 'dragstart', evt );
dropTarget.fire( 'drop', evt );

assert.isFalse( dropSpy.called );
}
};

@@ -12,5 +12,6 @@ Test if photo uploading works properly:
* If image is removed during upload, the process should be aborted.
* Check if you see a message about the progress, success and abort.
* Try to D&D elements which are not intended to be uploaded (e.g. empty anchor).
* Page shouldn't reload when image is drop on another one.
**Note:** This test use upload mock which will show you *Lena* instead of the real uploaded image.
@@ -11,5 +11,6 @@ Test if photo uploading works properly:
* It should be possible to format text and copy image during upload.
* If image is removed during upload, the process should be aborted.
* Check if you see a message about the progress, success and abort.
* Page shouldn't reload when image is drop on another one.
**Note:** This test use upload mock which will show you *Lena* instead of the real uploaded image.
**Note:** This test use upload mock which will show you *Lena* instead of the real uploaded image.

0 comments on commit cb5fd3a

Please sign in to comment.
You can’t perform that action at this time.