diff --git a/plugins/clipboard/plugin.js b/plugins/clipboard/plugin.js index 0133104a704..2cb3e2821d1 100644 --- a/plugins/clipboard/plugin.js +++ b/plugins/clipboard/plugin.js @@ -476,17 +476,19 @@ function addPasteListenersToEditable() { var editable = editor.editable(); - if ( !CKEDITOR.env.ie ) { - editable.on( 'copy', function( evt ) { + if ( CKEDITOR.plugins.clipboard.isDataFreelyAvailableInPasteEvent ) { + var initOnCopyCut = function( evt ) { clipboard.initPasteDataTransfer( evt, editor ); evt.data.preventDefault(); - } ); + }; + + editable.on( 'copy', initOnCopyCut ); + editable.on( 'cut', initOnCopyCut ); + // Delete content with the low priority so one can overwrite cut data. editable.on( 'cut', function( evt ) { - clipboard.initPasteDataTransfer( evt, editor ); editor.getSelection().getRanges()[ 0 ].deleteContents(); // @todo replace with the new delete content function - evt.data.preventDefault(); - } ); + }, null, null, 999 ); } // We'll be catching all pasted content in one line, regardless of whether @@ -1284,7 +1286,8 @@ 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; + canListenOnDocument = !CKEDITOR.env.ie || CKEDITOR.env.version > 8, + dropTarget = CKEDITOR.plugins.clipboard.getDropTarget( editor ); // Listed on dragstart to mark internal and cross-editor drag & drop // and save range and selected HTML. @@ -1466,6 +1469,42 @@ * @class CKEDITOR.plugins.clipboard */ CKEDITOR.plugins.clipboard = { + /** + * True if the environment allows to get data from the paste event without security dialog on the paste event. + * + * @since 4.5 + * @readonly + * @property {Boolean} + */ + isDataFreelyAvailableInPasteEvent: !CKEDITOR.env.ie, + + /** + * True if the environment supports MIME types and custom data types in dataTransfer/cliboardData getData/setData methods. + * + * @since 4.5 + * @readonly + * @property {Boolean} + */ + isCustomDataTypesSupported: !CKEDITOR.env.ie, + + /** + * Returns the element should be used as target for the drop event. + * + * @since 4.5 + * @param {CKEDITOR.editor} editor The editor instance. + * @returns {CKEDITOR.dom.domObject} the element should be used as target for the drop event. + */ + getDropTarget: function( editor ) { + var editable = editor.editable(); + + // #11123 Firefox needs to listen on document, because otherwise event won't be fired. + // #11086 IE8 cannot listen on document. + if ( ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 ) || editable.isInline() ) { + return editable; + } else { + return editor.document; + } + }, /** * IE 8 & 9 split text node on drop so the first node contains * text before drop position and the second contains rest. If we @@ -1703,12 +1742,12 @@ }, /** - * Initialize dataTransfer object based on the native drop event. If data + * Initialize dataTransfer object based on the drop event. If data * transfer object was already initialized on this event then function will * return that object. * * @since 4.5 - * @param {Object} domEvent A native DOM drop event object. + * @param {CKEDITOR.dom.event} evt A drop event object. * @param {CKEDITOR.editor} [sourceEditor] The source editor instance. * @returns {CKEDITOR.plugins.clipboard.dataTransfer} dataTransfer object */ @@ -1736,8 +1775,20 @@ return dataTransfer; }, + /** + * Initialize dataTransfer object based on the paste event. If data + * transfer object was already initialized on this event then function will + * return that object. On IE it is not possible to link copy/cut and paste event + * so the method returns always a new object. The same if there is no paste event + * passed to the method. + * + * @since 4.5 + * @param {CKEDITOR.dom.event} [evt] A paste event object. + * @param {CKEDITOR.editor} [sourceEditor] The source editor instance. + * @returns {CKEDITOR.plugins.clipboard.dataTransfer} dataTransfer object + */ initPasteDataTransfer: function( evt, sourceEditor ) { - if ( CKEDITOR.env.ie ) { + if ( !this.isDataFreelyAvailableInPasteEvent ) { return new this.dataTransfer( null, sourceEditor ); } else if ( evt && evt.data && evt.data.$ ) { var dataTransfer = new this.dataTransfer( evt.data.$.clipboardData, sourceEditor ); @@ -1784,14 +1835,13 @@ }; // Data type used to link drag and drop events. - var clipboardIdDataType = - // In IE URL data type is buggie and there is no way to mark drag & drop without - // modifying text data (which would be displayed if user drop content to the textarea) - // so we just read dragged text. - CKEDITOR.env.ie ? 'Text' : - // In Chrome and Firefox we can use custom data types. - 'cke/id'; - + // + // In IE URL data type is buggie and there is no way to mark drag & drop without + // modifying text data (which would be displayed if user drop content to the textarea) + // so we just read dragged text. + // + // In Chrome and Firefox we can use custom data types. + var clipboardIdDataType = CKEDITOR.plugins.clipboard.isCustomDataTypesSupported ? 'cke/id' : 'Text'; /** * Facade for the native `dataTransfer`/`clipboadData` object to hide all differences * between browsers. @@ -1904,10 +1954,10 @@ * * @since 4.5 * @readonly - * @property {Number} [=0] + * @property {Number} [=1] * @member CKEDITOR */ - CKEDITOR.DATA_TRANSFER_INTERNAL = 0; + CKEDITOR.DATA_TRANSFER_INTERNAL = 1; /** * Data transfer operation (drag and drop or copy and pasted) started and ended in the @@ -1915,10 +1965,10 @@ * * @since 4.5 * @readonly - * @property {Number} [=1] + * @property {Number} [=2] * @member CKEDITOR */ - CKEDITOR.DATA_TRANSFER_CROSS_EDITORS = 1; + CKEDITOR.DATA_TRANSFER_CROSS_EDITORS = 2; /** * Data transfer operation (drag and drop or copy and pasted) started not in the CKEditor. @@ -1926,10 +1976,10 @@ * * @since 4.5 * @readonly - * @property {Number} [=2] + * @property {Number} [=3] * @member CKEDITOR */ - CKEDITOR.DATA_TRANSFER_EXTERNAL = 2; + CKEDITOR.DATA_TRANSFER_EXTERNAL = 3; CKEDITOR.plugins.clipboard.dataTransfer.prototype = { /** @@ -1986,7 +2036,7 @@ // There is "Unexpected call to method or property access." error if you try // to set data of unsupported type on IE. - if ( CKEDITOR.env.ie && type != 'URL' && type != 'Text' ) { + if ( !CKEDITOR.plugins.clipboard.isCustomDataTypesSupported && type != 'URL' && type != 'Text' ) { return; } @@ -2028,6 +2078,8 @@ i; function getAndSetData( type ) { + type = that._.normalizeType( type ); + var data = that.getData( type ); if ( data ) { that._.data[ type ] = data; @@ -2035,13 +2087,15 @@ } // Copy data. - if ( CKEDITOR.env.ie ) { + if ( CKEDITOR.plugins.clipboard.isCustomDataTypesSupported ) { + if ( this.$.types ) { + for ( i = 0; i < this.$.types.length; i++ ) { + getAndSetData( this.$.types[ i ] ); + } + } + } else { getAndSetData( 'Text' ); getAndSetData( 'URL' ); - } else if ( this.$.types ) { - for ( i = 0; i < this.$.types.length; i++ ) { - getAndSetData( this.$.types[ i ] ); - } } // Copy files references. @@ -2099,13 +2153,15 @@ // Add native types. if ( this.$ ) { - if ( CKEDITOR.env.ie ) { + if ( CKEDITOR.plugins.clipboard.isCustomDataTypesSupported ) { + if ( this.$.types ) { + for ( var i = 0; i < this.$.types.length; i++ ) { + typesToCheck[ this.$.types[ i ] ] = 1; + } + } + } else { typesToCheck[ 'Text' ] = 1; typesToCheck[ 'URL' ] = 1; - } else if ( this.$.types ) { - for ( var i = 0; i < this.$.types.length; i++ ) { - typesToCheck[ this.$.types[ i ] ] = 1; - } } } diff --git a/tests/_benderjs/ckeditor/static/tools.js b/tests/_benderjs/ckeditor/static/tools.js index e279e8e9016..6973fbe9485 100644 --- a/tests/_benderjs/ckeditor/static/tools.js +++ b/tests/_benderjs/ckeditor/static/tools.js @@ -778,7 +778,7 @@ return { types: [], files: CKEDITOR.env.ie && CKEDITOR.env.version < 10 ? undefined : [], - _data: [], + _data: {}, // Emulate browsers native behavior for getDeta/setData. setData: function( type, data ) { if ( CKEDITOR.env.ie && type != 'Text' && type != 'URL' ) @@ -787,7 +787,13 @@ if ( CKEDITOR.env.ie && CKEDITOR.env.version > 9 && type == 'URL' ) return; - this._data[ type ] = data; + if ( type == 'text/plain' || type == 'Text' ) { + this._data[ 'text/plain' ] = data; + this._data[ 'Text' ] = data; + } else { + this._data[ type ] = data; + } + this.types.push( type ); }, getData: function( type ) { diff --git a/tests/plugins/clipboard/datatransfer.js b/tests/plugins/clipboard/datatransfer.js index 2579e61e942..434ffed7b5e 100644 --- a/tests/plugins/clipboard/datatransfer.js +++ b/tests/plugins/clipboard/datatransfer.js @@ -51,7 +51,7 @@ bender.test( { assert.areSame( dataTransfer1a.id, dataTransfer1b.id, 'Ids for object based on the same event should be the same.' ); // In IE we can not use any data type besides text, so id is fixed. - if ( !CKEDITOR.env.ie ) + if ( CKEDITOR.plugins.clipboard.isCustomDataTypesSupported ) assert.areNotSame( dataTransfer1a.id, dataTransfer2.id, 'Ids for object based on different events should be different.' ); }, @@ -77,7 +77,8 @@ bender.test( { }, 'test internal drag drop, no event': function() { - var bot = this.bots.editor1, + var isCustomDataTypesSupported = CKEDITOR.plugins.clipboard.isCustomDataTypesSupported, + bot = this.bots.editor1, editor = this.editors.editor1, dataTransfer; @@ -89,7 +90,7 @@ bender.test( { transferType: CKEDITOR.DATA_TRANSFER_INTERNAL, sourceEditor: editor, targetEditor: editor, - text: CKEDITOR.env.ie ? '' : 'xfoox', + text: isCustomDataTypesSupported ? 'xfoox' : '', html: 'xfoox' }, dataTransfer ); }, @@ -113,12 +114,13 @@ bender.test( { }, 'test drop html from external source': function() { - var editor = this.editors.editor1, + var isCustomDataTypesSupported = CKEDITOR.plugins.clipboard.isCustomDataTypesSupported, + editor = this.editors.editor1, nativeData, dataTransfer; nativeData = bender.tools.mockNativeDataTransfer(); nativeData.setData( 'Text', 'bar' ); - if ( !CKEDITOR.env.ie ) { + if ( isCustomDataTypesSupported ) { nativeData.setData( 'text/html', 'xfoox' ); } @@ -129,7 +131,7 @@ bender.test( { sourceEditor: undefined, targetEditor: editor, text: 'bar', - html: CKEDITOR.env.ie ? '' : 'xfoox' }, + html: isCustomDataTypesSupported ? 'xfoox' : '' }, dataTransfer ); }, @@ -156,7 +158,8 @@ bender.test( { }, 'test drag drop between editors, no event': function() { - var bot1 = this.bots.editor1, + var isCustomDataTypesSupported = CKEDITOR.plugins.clipboard.isCustomDataTypesSupported, + bot1 = this.bots.editor1, editor1 = this.editors.editor1, editor2 = this.editors.editor2, dataTransfer; @@ -168,7 +171,7 @@ bender.test( { transferType: CKEDITOR.DATA_TRANSFER_CROSS_EDITORS, sourceEditor: editor1, targetEditor: editor2, - text: CKEDITOR.env.ie ? '' : 'xfoox', + text: isCustomDataTypesSupported ? 'xfoox' : '', html: 'xfoox' }, dataTransfer ); }, @@ -262,11 +265,11 @@ bender.test( { assert.areSame( 'bar', dataTransfer.getData( 'CKE/Custom' ), 'CKE/custom - CKE/Custom' ); }, - 'test set-get data, data type: plain/html, dataTransfer without event': function() { + 'test set-get data, data type: text/html, dataTransfer without event': function() { var dataTransfer = new CKEDITOR.plugins.clipboard.dataTransfer(); - dataTransfer.setData( 'plain/html', 'html' ); - assert.areSame( 'html', dataTransfer.getData( 'plain/html' ), 'plain/html - plain/html' ); + dataTransfer.setData( 'text/html', 'html' ); + assert.areSame( 'html', dataTransfer.getData( 'text/html' ), 'text/html - text/html' ); }, 'test set-get data, data type: undefined data, dataTransfer without event': function() { @@ -308,13 +311,16 @@ bender.test( { }, 'test cacheData': function() { - // Emulate native clipboard. - var nativeData = bender.tools.mockNativeDataTransfer(); - if ( CKEDITOR.env.ie ) { - nativeData.setData( 'Text', 'foo' ); - } else { - nativeData.setData( 'plain/html', 'foo' ); + var isCustomDataTypesSupported = CKEDITOR.plugins.clipboard.isCustomDataTypesSupported, + // Emulate native clipboard. + nativeData = bender.tools.mockNativeDataTransfer(); + + if ( isCustomDataTypesSupported ) { + nativeData.setData( 'text/html', 'foo' ); + nativeData.setData( 'text/plain', 'bom' ); nativeData.setData( 'cke/custom', 'bar' ); + } else { + nativeData.setData( 'Text', 'foo' ); } // CacheData. @@ -329,12 +335,13 @@ bender.test( { nativeData.getData = throwPermissionDenied; // Assert - if ( CKEDITOR.env.ie ) { - assert.areSame( 'foo', dataTransfer.getData( 'Text' ) ); + if ( isCustomDataTypesSupported ) { + assert.areSame( 'foo', dataTransfer.getData( 'text/html' ) ); + assert.areSame( 'bom', dataTransfer.getData( 'text/plain' ) ); + assert.areSame( 'bar', dataTransfer.getData( 'cke/custom' ) ); assert.areSame( '', dataTransfer.getData( 'cke/undefined' ) ); } else { - assert.areSame( 'foo', dataTransfer.getData( 'plain/html' ) ); - assert.areSame( 'bar', dataTransfer.getData( 'cke/custom' ) ); + assert.areSame( 'foo', dataTransfer.getData( 'Text' ) ); assert.areSame( '', dataTransfer.getData( 'cke/undefined' ) ); } @@ -534,7 +541,8 @@ bender.test( { }, 'test initDragDataTransfer constructor': function() { - var bot = this.bots.editor1, + var isCustomDataTypesSupported = CKEDITOR.plugins.clipboard.isCustomDataTypesSupported, + bot = this.bots.editor1, editor = this.editors.editor1; bot.setHtmlWithSelection( '

x[xfoox]x

' ); @@ -547,13 +555,14 @@ bender.test( { transferType: CKEDITOR.DATA_TRANSFER_INTERNAL, sourceEditor: editor, targetEditor: editor, - text: CKEDITOR.env.ie ? '' : 'xfoox', + text: isCustomDataTypesSupported ? 'xfoox' : '', html: 'xfoox' }, dataTransfer ); }, 'test initDragDataTransfer constructor, no event': function() { - var bot = this.bots.editor1, + var isCustomDataTypesSupported = CKEDITOR.plugins.clipboard.isCustomDataTypesSupported, + bot = this.bots.editor1, editor = this.editors.editor1; bot.setHtmlWithSelection( '

x[xfoox]x

' ); @@ -564,13 +573,13 @@ bender.test( { transferType: CKEDITOR.DATA_TRANSFER_INTERNAL, sourceEditor: editor, targetEditor: editor, - text: CKEDITOR.env.ie ? '' : 'xfoox', + text: isCustomDataTypesSupported ? 'xfoox' : '', html: 'xfoox' }, dataTransfer ); }, 'test initPasteDataTransfer binding': function() { - if ( CKEDITOR.env.ie ) { + if ( !CKEDITOR.plugins.clipboard.isCustomDataTypesSupported ) { assert.ignore(); } @@ -588,14 +597,16 @@ bender.test( { }, 'test initPasteDataTransfer constructor': function() { - var bot = this.bots.editor1, + var isDataFreelyAvailableInPasteEvent = CKEDITOR.plugins.clipboard.isDataFreelyAvailableInPasteEvent, + isCustomDataTypesSupported = CKEDITOR.plugins.clipboard.isCustomDataTypesSupported, + bot = this.bots.editor1, editor = this.editors.editor1, nativeData = bender.tools.mockNativeDataTransfer(), evt = { data: { $: { clipboardData: nativeData } } }; bot.setHtmlWithSelection( '

x[xfoox]x

' ); - if ( CKEDITOR.env.ie ) { + if ( isDataFreelyAvailableInPasteEvent ) { evt.data.$.clipboardData.setData = function() { assert.fail( 'Native setData should not be touched on IE.' ); }; @@ -611,13 +622,14 @@ bender.test( { transferType: CKEDITOR.DATA_TRANSFER_INTERNAL, sourceEditor: editor, targetEditor: editor, - text: CKEDITOR.env.ie ? '' : 'xfoox', + text: isCustomDataTypesSupported ? 'xfoox' : '', html: 'xfoox' }, dataTransfer ); }, 'test initPasteDataTransfer constructor, no event': function() { - var bot = this.bots.editor1, + var isCustomDataTypesSupported = CKEDITOR.plugins.clipboard.isCustomDataTypesSupported, + bot = this.bots.editor1, editor = this.editors.editor1; bot.setHtmlWithSelection( '

x[xfoox]x

' ); @@ -628,7 +640,7 @@ bender.test( { transferType: CKEDITOR.DATA_TRANSFER_INTERNAL, sourceEditor: editor, targetEditor: editor, - text: CKEDITOR.env.ie ? '' : 'xfoox', + text: isCustomDataTypesSupported ? 'xfoox' : '', html: 'xfoox' }, dataTransfer ); } diff --git a/tests/plugins/clipboard/drop.js b/tests/plugins/clipboard/drop.js index cbf3decfcbc..491430e4e17 100644 --- a/tests/plugins/clipboard/drop.js +++ b/tests/plugins/clipboard/drop.js @@ -20,7 +20,7 @@ CKEDITOR.disableAutoInline = true; function drag( editor, evt ) { var editable = editor.editable(), - dropTarget = ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 ) || editable.isInline() ? editable : editor.document, + dropTarget = CKEDITOR.plugins.clipboard.getDropTarget( editor ), dragEventCounter = 0; editor.once( 'dragstart', function( dragEvt ) { @@ -37,8 +37,9 @@ function drag( editor, evt ) { } function drop( editor, evt, config, onDrop, onFinish ) { - var editable = editor.editable(), - dropTarget = ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 ) || editable.isInline() ? editable : editor.document, + var isCustomDataTypesSupported = CKEDITOR.plugins.clipboard.isCustomDataTypesSupported, + editable = editor.editable(), + dropTarget = CKEDITOR.plugins.clipboard.getDropTarget( editor ), range = new CKEDITOR.dom.range( editor.document ), values = { beforePasteEventCounter: 0, pasteEventCounter: 0, dropEventCounter: 0 }, expectedPasteEventCount = typeof config.expectedPasteEventCount !== 'undefined' ? config.expectedPasteEventCount : 1, @@ -94,7 +95,7 @@ function drop( editor, evt, config, onDrop, onFinish ) { // Drop event asserts assert.areSame( 1, values.dropEventCounter, 'There should be always one drop.' ); assert.isTrue( values.dropInstanceOfDataTransfer, 'On drop: dropEvt.data.dataTransfer should be instance of dataTransfer.' ); - if ( config.expectedText && !CKEDITOR.env.ie ) { + if ( config.expectedText && isCustomDataTypesSupported ) { assert.areSame( config.expectedText, values.dropDataText, 'On drop: text data should match.' ); } if ( config.expectedHtml ) { @@ -114,7 +115,7 @@ function drop( editor, evt, config, onDrop, onFinish ) { if ( expectedPasteEventCount > 0 ) { assert.areSame( config.expectedTransferType, values.pasteTransferType, 'On paste: transferType should match.' ); // Do not check Text data on IE. - if ( !CKEDITOR.env.ie ) { + if ( isCustomDataTypesSupported ) { assert.areSame( config.expectedText, values.pasteDataText, 'On paste: text data should match.' ); } // isInnerHtmlMatching remove space from the end of strings we compare, adding 'x' fix this problem. @@ -375,31 +376,32 @@ var editors, editorBots, }, 'test drop html from external source': function( editor ) { - var bot = editorBots[ editor.name ], + var isCustomDataTypesSupported = CKEDITOR.plugins.clipboard.isCustomDataTypesSupported, + bot = editorBots[ editor.name ], evt = bender.tools.mockDropEvent(); bot.setHtmlWithSelection( '

Lorem ipsum sit amet.

' ); editor.resetUndo(); - if ( CKEDITOR.env.ie ) { - evt.$.dataTransfer.setData( 'Text', 'dolor' ); - } else { + if ( isCustomDataTypesSupported ) { evt.$.dataTransfer.setData( 'text/html', 'dolor' ); + } else { + evt.$.dataTransfer.setData( 'Text', 'dolor' ); } drop( editor, evt, { element: editor.document.getById( 'p' ).getChild( 0 ), offset: 6, expectedTransferType: CKEDITOR.DATA_TRANSFER_EXTERNAL, - expectedText: CKEDITOR.env.ie ? 'dolor' : '', - expectedHtml: CKEDITOR.env.ie ? '' : 'dolor', - expectedDataType: CKEDITOR.env.ie ? 'text' : 'html', - expectedDataValue: CKEDITOR.env.ie ? '<b>dolor</b>' : 'dolor' + expectedText: !isCustomDataTypesSupported ? 'dolor' : '', + expectedHtml: !isCustomDataTypesSupported ? '' : 'dolor', + expectedDataType: !isCustomDataTypesSupported ? 'text' : 'html', + expectedDataValue: !isCustomDataTypesSupported ? '<b>dolor</b>' : 'dolor' }, null, function() { - if ( CKEDITOR.env.ie ) { - assert.areSame( '

Lorem <b>dolor</b>^ipsum sit amet.

', bender.tools.getHtmlWithSelection( editor ), 'after drop' ); - } else { + if ( isCustomDataTypesSupported ) { assert.areSame( '

Lorem dolor^ipsum sit amet.

', bender.tools.getHtmlWithSelection( editor ), 'after drop' ); + } else { + assert.areSame( '

Lorem <b>dolor</b>^ipsum sit amet.

', bender.tools.getHtmlWithSelection( editor ), 'after drop' ); } editor.execCommand( 'undo' ); diff --git a/tests/plugins/clipboard/paste.js b/tests/plugins/clipboard/paste.js index 124eacea9a7..59351612aae 100644 --- a/tests/plugins/clipboard/paste.js +++ b/tests/plugins/clipboard/paste.js @@ -1010,7 +1010,7 @@ 'editor.getClipboardData - successful': function() { // We cannot test them in IE because this tcs will open security alert which will stop tests. - if ( CKEDITOR.env.ie ) + if ( !CKEDITOR.plugins.clipboard.isDataFreelyAvailableInPasteEvent ) assert.ignore(); var tc = this, @@ -1056,7 +1056,7 @@ 'editor.getClipboardData - unsuccessful': function() { // We cannot test them in IE because this tcs will open security alert which will stop tests. - if ( CKEDITOR.env.ie ) + if ( !CKEDITOR.plugins.clipboard.isDataFreelyAvailableInPasteEvent ) assert.ignore(); var tc = this, @@ -1098,7 +1098,7 @@ 'editor.getClipboardData - canceled beforePaste': function() { // We cannot test them in IE because this tcs will open security alert which will stop tests. - if ( CKEDITOR.env.ie ) + if ( !CKEDITOR.plugins.clipboard.isDataFreelyAvailableInPasteEvent ) assert.ignore(); var tc = this, @@ -1182,7 +1182,7 @@ }, 'paste with HTML in clipboardData': function() { - if ( CKEDITOR.env.ie ) { + if ( !CKEDITOR.plugins.clipboard.isCustomDataTypesSupported ) { assert.ignore(); } @@ -1210,7 +1210,7 @@ }, 'paste with HTML in clipboardData - cancel on before paste': function() { - if ( CKEDITOR.env.ie ) { + if ( !CKEDITOR.plugins.clipboard.isCustomDataTypesSupported ) { assert.ignore(); } @@ -1242,7 +1242,7 @@ }, 'test cut': function() { - if ( CKEDITOR.env.ie ) + if ( !CKEDITOR.plugins.clipboard.isDataFreelyAvailableInPasteEvent ) assert.ignore(); var editor = this.editor, @@ -1260,7 +1260,7 @@ }, 'test copy': function() { - if ( CKEDITOR.env.ie ) + if ( !CKEDITOR.plugins.clipboard.isDataFreelyAvailableInPasteEvent ) assert.ignore(); var editor = this.editor, @@ -1278,7 +1278,7 @@ }, 'test cut and paste': function() { - if ( CKEDITOR.env.ie ) + if ( !CKEDITOR.plugins.clipboard.isDataFreelyAvailableInPasteEvent ) assert.ignore(); var tc = this, @@ -1316,7 +1316,7 @@ }, 'test copy and paste': function() { - if ( CKEDITOR.env.ie ) + if ( !CKEDITOR.plugins.clipboard.isDataFreelyAvailableInPasteEvent ) assert.ignore(); var tc = this, @@ -1354,7 +1354,7 @@ }, 'test paste if dataTransfer is not empty': function() { - if ( CKEDITOR.env.ie ) + if ( !CKEDITOR.plugins.clipboard.isDataFreelyAvailableInPasteEvent ) assert.ignore(); var editor = this.editor; diff --git a/tests/plugins/widget/dnd.js b/tests/plugins/widget/dnd.js index 530e8f7304a..00e25b8c1c6 100644 --- a/tests/plugins/widget/dnd.js +++ b/tests/plugins/widget/dnd.js @@ -60,7 +60,7 @@ } function dragstart( editor, evt ) { - var dropTarget = CKEDITOR.env.ie && CKEDITOR.env.version < 9 ? editor.editable() : editor.document; + var dropTarget = CKEDITOR.plugins.clipboard.getDropTarget( editor ); dropTarget.fire( 'dragstart', evt ); } diff --git a/tests/plugins/widget/undo.js b/tests/plugins/widget/undo.js index f8f8b54a36d..934dd711799 100644 --- a/tests/plugins/widget/undo.js +++ b/tests/plugins/widget/undo.js @@ -340,7 +340,7 @@ // Ensure async. wait( function() { - var dropTarget = CKEDITOR.env.ie && CKEDITOR.env.version < 9 ? editor.editable() : editor.document, + var dropTarget = CKEDITOR.plugins.clipboard.getDropTarget( editor ), evt = bender.tools.mockDropEvent(); evt.testRange = range;