From 18e8adf1b7e604f8d3644a4fa33d9d0bb19bdcde Mon Sep 17 00:00:00 2001
From: Piotr Jasiun
Date: Wed, 29 Jul 2015 10:37:42 +0200
Subject: [PATCH 1/9] Tests: added 'pastefromword' plugin to the paste manual
test.
---
tests/plugins/clipboard/manual/paste.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/plugins/clipboard/manual/paste.md b/tests/plugins/clipboard/manual/paste.md
index d2d9372c6e7..292edc6b506 100644
--- a/tests/plugins/clipboard/manual/paste.md
+++ b/tests/plugins/clipboard/manual/paste.md
@@ -1,6 +1,6 @@
@bender-ui: collapsed
@bender-tags: 4.5.0, tc
-@bender-ckeditor-plugins: wysiwygarea, toolbar, undo, basicstyles, image2, font, stylescombo, basicstyles, format, maximize, blockquote, list, table, resize, elementspath, justify, clipboard, floatingspace, sourcearea, htmlwriter, link, uploadimage, image2
+@bender-ckeditor-plugins: wysiwygarea, toolbar, undo, basicstyles, image2, font, stylescombo, basicstyles, format, maximize, blockquote, list, table, resize, elementspath, justify, clipboard, floatingspace, sourcearea, htmlwriter, link, uploadimage, image2, pastefromword
@bender-include: ../../uploadwidget/manual/_helpers/xhr.js
## Scenarios:
From 46e36c92b25a90911ac6f80e7e16d9ce2c145dff Mon Sep 17 00:00:00 2001
From: Piotr Jasiun
Date: Wed, 29 Jul 2015 10:48:54 +0200
Subject: [PATCH 2/9] Tests: use 'isCustomCopyCutSupported' instead of
'isHtmlInExternalDataTransfer' in paste tests.
---
tests/plugins/clipboard/paste.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/plugins/clipboard/paste.js b/tests/plugins/clipboard/paste.js
index 21052477430..5eff98c578c 100644
--- a/tests/plugins/clipboard/paste.js
+++ b/tests/plugins/clipboard/paste.js
@@ -1243,7 +1243,7 @@
},
'paste with HTML in clipboardData': function() {
- if ( !CKEDITOR.plugins.clipboard.isHtmlInExternalDataTransfer ) {
+ if ( !CKEDITOR.plugins.clipboard.isCustomCopyCutSupported ) {
assert.ignore();
}
@@ -1270,7 +1270,7 @@
},
'paste with HTML in clipboardData - cancel on before paste': function() {
- if ( !CKEDITOR.plugins.clipboard.isHtmlInExternalDataTransfer ) {
+ if ( !CKEDITOR.plugins.clipboard.isCustomCopyCutSupported ) {
assert.ignore();
}
From 4bc99eb1c2e217b11e3b9ae5d4f28e96953de3b3 Mon Sep 17 00:00:00 2001
From: Piotr Jasiun
Date: Wed, 29 Jul 2015 11:59:01 +0200
Subject: [PATCH 3/9] Introduce 'clipboardApiCanBeUsed' method, and based check
on this method.
---
plugins/clipboard/plugin.js | 45 +++++++++++++++++++++++++------------
1 file changed, 31 insertions(+), 14 deletions(-)
diff --git a/plugins/clipboard/plugin.js b/plugins/clipboard/plugin.js
index ff70129db51..b6f6077462a 100644
--- a/plugins/clipboard/plugin.js
+++ b/plugins/clipboard/plugin.js
@@ -1028,8 +1028,7 @@
type: 'auto',
method: 'paste',
dataTransfer: clipboard.initPasteDataTransfer( evt )
- },
- external = eventData.dataTransfer.getTransferType( editor ) === CKEDITOR.DATA_TRANSFER_EXTERNAL;
+ };
eventData.dataTransfer.cacheData();
@@ -1041,7 +1040,7 @@
var beforePasteNotCanceled = editor.fire( 'beforePaste', eventData ) !== false;
// Do not use paste bin if the browser let us get HTML or files from dataTranfer.
- if ( beforePasteNotCanceled && ( clipboard.isHtmlInExternalDataTransfer || !external ) && !eventData.dataTransfer.isEmpty() ) {
+ if ( beforePasteNotCanceled && clipboard.clipboardApiCanBeUsed( eventData.dataTransfer, editor ) ) {
evt.data.preventDefault();
setTimeout( function() {
firePasteEvents( editor, eventData );
@@ -1489,17 +1488,6 @@
*/
isFileApiSupported: !CKEDITOR.env.ie || CKEDITOR.env.version > 9,
-
- /**
- * True if external data transfer contains HTML data.
- *
- * @since 4.5
- * @readonly
- * @property {Boolean}
- */
- isHtmlInExternalDataTransfer: !CKEDITOR.env.ie && !CKEDITOR.env.safari,
-
-
/**
* Main native paste event editable should listen to.
*
@@ -1515,6 +1503,35 @@
*/
mainPasteEvent: ( CKEDITOR.env.ie && !CKEDITOR.env.edge ) ? 'beforepaste' : 'paste',
+ /**
+ * Return true if reliable data are available in Clipboard API.
+ *
+ * @since 4.5.2
+ */
+ clipboardApiCanBeUsed: function( dataTransfer, editor ) {
+ // If data transfer is different then external it means that it is custom cut/copy/paste support handling
+ // and data data are put manually on the data transfer.
+ if ( dataTransfer.getTransferType( editor ) != CKEDITOR.DATA_TRANSFER_EXTERNAL ) {
+ return true;
+ }
+
+ // On Chrome we can trust Clipboard API, the exception is Chrome on Android (and in the desktop mode), where
+ // clipboard API is not available so we need to check it (#13187).
+ if ( CKEDITOR.env.chrome && !dataTransfer.isEmpty() ) {
+ return true;
+ }
+
+ // Because of Firefox bug HTML data are not available in some cases (e.g. paste from work), in such cases we
+ // need to use paste bin (#13528, https://bugzilla.mozilla.org/show_bug.cgi?id=1183686).
+ if ( CKEDITOR.env.gecko && dataTransfer.getData( 'text/html' ) ) {
+ return true;
+ }
+
+ // On Safari and IE HTML data are not available thought Clipboard API.
+ // It is safer to use paste bin in unknown cases.
+ return false;
+ },
+
/**
* Returns the element that should be used as the target for the drop event.
*
From a3c1a231689f78dfc43989213606d9a2813a2660 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotrek=20Koszuli=C5=84ski?=
Date: Wed, 29 Jul 2015 14:03:41 +0200
Subject: [PATCH 4/9] Naming and docs.
---
plugins/clipboard/plugin.js | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/plugins/clipboard/plugin.js b/plugins/clipboard/plugin.js
index b6f6077462a..16da8c5f63a 100644
--- a/plugins/clipboard/plugin.js
+++ b/plugins/clipboard/plugin.js
@@ -1040,7 +1040,7 @@
var beforePasteNotCanceled = editor.fire( 'beforePaste', eventData ) !== false;
// Do not use paste bin if the browser let us get HTML or files from dataTranfer.
- if ( beforePasteNotCanceled && clipboard.clipboardApiCanBeUsed( eventData.dataTransfer, editor ) ) {
+ if ( beforePasteNotCanceled && clipboard.canClipboardApiBeUsed( eventData.dataTransfer, editor ) ) {
evt.data.preventDefault();
setTimeout( function() {
firePasteEvents( editor, eventData );
@@ -1504,31 +1504,36 @@
mainPasteEvent: ( CKEDITOR.env.ie && !CKEDITOR.env.edge ) ? 'beforepaste' : 'paste',
/**
- * Return true if reliable data are available in Clipboard API.
+ * Returns `true` if we can expect that the browser provides data through the Clipboard API.
+ * If not, CKEditor will use the paste bin. Read more in
+ * the [Clipboard Integration](http://docs.ckeditor.com/#!/guide/dev_clipboard-section-clipboard-api) guide.
*
* @since 4.5.2
+ * @returns {Boolean}
*/
- clipboardApiCanBeUsed: function( dataTransfer, editor ) {
- // If data transfer is different then external it means that it is custom cut/copy/paste support handling
- // and data data are put manually on the data transfer.
+ canClipboardApiBeUsed: function( dataTransfer, editor ) {
+ // If it's an internal or cross-editor data transfer, then it means that custom cut/copy/paste support works
+ // and that the data were put manually on the data transfer so we can be sure that it's available.
if ( dataTransfer.getTransferType( editor ) != CKEDITOR.DATA_TRANSFER_EXTERNAL ) {
return true;
}
- // On Chrome we can trust Clipboard API, the exception is Chrome on Android (and in the desktop mode), where
+ // In Chrome we can trust Clipboard API, with the exception of Chrome on Android (in both - mobile and desktop modes), where
// clipboard API is not available so we need to check it (#13187).
if ( CKEDITOR.env.chrome && !dataTransfer.isEmpty() ) {
return true;
}
- // Because of Firefox bug HTML data are not available in some cases (e.g. paste from work), in such cases we
- // need to use paste bin (#13528, https://bugzilla.mozilla.org/show_bug.cgi?id=1183686).
+ // Because of a Firefox bug HTML data are not available in some cases (e.g. paste from Word), in such cases we
+ // need to use the pastebin (#13528, https://bugzilla.mozilla.org/show_bug.cgi?id=1183686).
if ( CKEDITOR.env.gecko && dataTransfer.getData( 'text/html' ) ) {
return true;
}
- // On Safari and IE HTML data are not available thought Clipboard API.
- // It is safer to use paste bin in unknown cases.
+ // In Safari and IE HTML data is not available though the Clipboard API.
+ // In Edge things are a bit messy at the moment -
+ // https://connect.microsoft.com/IE/feedback/details/1572456/edge-clipboard-api-text-html-content-messed-up-in-event-clipboarddata
+ // It is safer to use the paste bin in unknown cases.
return false;
},
From 9caad3a428619d05f50f0a94ec00d56f93dd4f1c Mon Sep 17 00:00:00 2001
From: Piotr Jasiun
Date: Wed, 29 Jul 2015 16:34:26 +0200
Subject: [PATCH 5/9] Check if there are files on Firefox.
---
plugins/clipboard/plugin.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/clipboard/plugin.js b/plugins/clipboard/plugin.js
index 16da8c5f63a..ddaa87df1a9 100644
--- a/plugins/clipboard/plugin.js
+++ b/plugins/clipboard/plugin.js
@@ -1526,7 +1526,7 @@
// Because of a Firefox bug HTML data are not available in some cases (e.g. paste from Word), in such cases we
// need to use the pastebin (#13528, https://bugzilla.mozilla.org/show_bug.cgi?id=1183686).
- if ( CKEDITOR.env.gecko && dataTransfer.getData( 'text/html' ) ) {
+ if ( CKEDITOR.env.gecko && ( dataTransfer.getData( 'text/html' ) || dataTransfer.getFilesCount() ) ) {
return true;
}
From 3c40e9869da3e3bc87bd52038fce8236c2100465 Mon Sep 17 00:00:00 2001
From: Piotr Jasiun
Date: Wed, 29 Jul 2015 17:45:30 +0200
Subject: [PATCH 6/9] Tests for canClipboardApiBeUsed.
---
tests/plugins/clipboard/paste.js | 104 +++++++++++++++++++++++++++++++
1 file changed, 104 insertions(+)
diff --git a/tests/plugins/clipboard/paste.js b/tests/plugins/clipboard/paste.js
index 5eff98c578c..d8a49c5a3f6 100644
--- a/tests/plugins/clipboard/paste.js
+++ b/tests/plugins/clipboard/paste.js
@@ -1445,6 +1445,110 @@
}, 0 );
},
+ 'test canClipboardApiBeUsed internal': function() {
+ var canClipboardApiBeUsed = CKEDITOR.plugins.clipboard.canClipboardApiBeUsed;
+
+ var editor = this.editor,
+ nativeData = bender.tools.mockNativeDataTransfer(),
+ evt = { data: { $: { clipboardData: nativeData } } },
+ dataTransfer = CKEDITOR.plugins.clipboard.initPasteDataTransfer( evt, editor );
+
+ assert.isTrue( canClipboardApiBeUsed( dataTransfer, editor ), 'Clipboard API should be used for internal operations.' );
+ },
+
+ 'test canClipboardApiBeUsed in chrome': function() {
+ if ( !CKEDITOR.env.chrome ) {
+ assert.ignore();
+ }
+
+ var canClipboardApiBeUsed = CKEDITOR.plugins.clipboard.canClipboardApiBeUsed;
+
+ var nativeData = bender.tools.mockNativeDataTransfer();
+
+ nativeData.setData( 'text/html', 'foo' );
+
+ var evt = { data: { $: { clipboardData: nativeData } } },
+ dataTransfer = CKEDITOR.plugins.clipboard.initPasteDataTransfer( evt );
+
+ assert.isTrue( canClipboardApiBeUsed( dataTransfer ), 'Clipboard API should be used in Chrome.' );
+ },
+
+ 'test canClipboardApiBeUsed in Android chrome (no dataTransfer support)': function() {
+ if ( !CKEDITOR.env.chrome ) {
+ assert.ignore();
+ }
+
+ var canClipboardApiBeUsed = CKEDITOR.plugins.clipboard.canClipboardApiBeUsed;
+
+ var dataTransfer = CKEDITOR.plugins.clipboard.initPasteDataTransfer(); // no native data transfer
+
+ assert.isFalse( canClipboardApiBeUsed( dataTransfer ),
+ 'Clipboard API should NOT be used for in Android Chrome.' );
+ },
+
+ 'test canClipboardApiBeUsed in Firefox with HTML': function() {
+ if ( !CKEDITOR.env.gecko ) {
+ assert.ignore();
+ }
+
+ var canClipboardApiBeUsed = CKEDITOR.plugins.clipboard.canClipboardApiBeUsed;
+
+ var nativeData = bender.tools.mockNativeDataTransfer();
+
+ nativeData.setData( 'text/html', 'foo' );
+
+ var evt = { data: { $: { clipboardData: nativeData } } },
+ dataTransfer = CKEDITOR.plugins.clipboard.initPasteDataTransfer( evt );
+
+ assert.isTrue( canClipboardApiBeUsed( dataTransfer ), 'Clipboard API should be used in Firefox with HTML.' );
+ },
+
+ 'test canClipboardApiBeUsed in Firefox with files': function() {
+ if ( !CKEDITOR.env.gecko ) {
+ assert.ignore();
+ }
+
+ var canClipboardApiBeUsed = CKEDITOR.plugins.clipboard.canClipboardApiBeUsed;
+
+ var nativeData = bender.tools.mockNativeDataTransfer();
+
+ nativeData.files.push( 'foo' );
+
+ var evt = { data: { $: { clipboardData: nativeData } } },
+ dataTransfer = CKEDITOR.plugins.clipboard.initPasteDataTransfer( evt );
+
+ assert.isTrue( canClipboardApiBeUsed( dataTransfer ), 'Clipboard API should be used in Firefox with files.' );
+ },
+
+ 'test canClipboardApiBeUsed in Firefox without files and html': function() {
+ if ( !CKEDITOR.env.gecko ) {
+ assert.ignore();
+ }
+
+ var canClipboardApiBeUsed = CKEDITOR.plugins.clipboard.canClipboardApiBeUsed;
+
+ var nativeData = bender.tools.mockNativeDataTransfer(),
+ evt = { data: { $: { clipboardData: nativeData } } },
+ dataTransfer = CKEDITOR.plugins.clipboard.initPasteDataTransfer( evt );
+
+ assert.isFalse( canClipboardApiBeUsed( dataTransfer ),
+ 'Clipboard API should not be used in Firefox without html and files.' );
+ },
+
+ 'test canClipboardApiBeUsed on other browser': function() {
+ if ( CKEDITOR.env.chrome || CKEDITOR.env.gecko ) {
+ assert.ignore();
+ }
+
+ var canClipboardApiBeUsed = CKEDITOR.plugins.clipboard.canClipboardApiBeUsed;
+
+ var nativeData = bender.tools.mockNativeDataTransfer(),
+ evt = { data: { $: { clipboardData: nativeData } } },
+ dataTransfer = CKEDITOR.plugins.clipboard.initPasteDataTransfer( evt );
+
+ assert.isFalse( canClipboardApiBeUsed( dataTransfer ), 'Clipboard API should not be used in other browsers.' );
+ },
+
'#131 - trailing spaces': function() {
assertPasteEvent(
this.editor,
From 86b5d74f557bbff59c3f7175badb2b3ec409f46e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotrek=20Koszuli=C5=84ski?=
Date: Wed, 29 Jul 2015 22:43:33 +0200
Subject: [PATCH 7/9] Tests: Tags and wording.
---
tests/plugins/clipboard/manual/draganddrop.md | 1 +
tests/plugins/clipboard/manual/paste.md | 6 ++++--
tests/plugins/clipboard/paste.js | 6 +++---
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/tests/plugins/clipboard/manual/draganddrop.md b/tests/plugins/clipboard/manual/draganddrop.md
index daf7eb13c96..abf4d950dab 100644
--- a/tests/plugins/clipboard/manual/draganddrop.md
+++ b/tests/plugins/clipboard/manual/draganddrop.md
@@ -1,4 +1,5 @@
@bender-ui: collapsed
+@bender-tags: 4.5.0, 4.5.2, tc
@bender-ckeditor-plugins: wysiwygarea, toolbar, undo, basicstyles, image2, font, stylescombo, basicstyles, format, maximize, blockquote, list, table, resize, elementspath, justify, clipboard, floatingspace, sourcearea, htmlwriter, link
* test internal D&D in the editor,
diff --git a/tests/plugins/clipboard/manual/paste.md b/tests/plugins/clipboard/manual/paste.md
index 292edc6b506..845d8ac9097 100644
--- a/tests/plugins/clipboard/manual/paste.md
+++ b/tests/plugins/clipboard/manual/paste.md
@@ -1,5 +1,5 @@
@bender-ui: collapsed
-@bender-tags: 4.5.0, tc
+@bender-tags: 4.5.0, 4.5.2, tc
@bender-ckeditor-plugins: wysiwygarea, toolbar, undo, basicstyles, image2, font, stylescombo, basicstyles, format, maximize, blockquote, list, table, resize, elementspath, justify, clipboard, floatingspace, sourcearea, htmlwriter, link, uploadimage, image2, pastefromword
@bender-include: ../../uploadwidget/manual/_helpers/xhr.js
@@ -11,7 +11,8 @@
* copy and paste file (works only on Firefox),
* copy and paste part of the image from the image editor,
* copy and paste internal HTML,
- * copy and paste text from another editor.
+ * copy and paste text from another editor,
+ * copy and paste HTML from other browser (the same OS).
## Notes:
@@ -28,6 +29,7 @@
### Firefox
+* There's no `text/html` data for external paste. Hence, pastebin is used. Hence, data type always equals `html` (see: [`config.clipboard_defaultContentType`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-clipboard_defaultContentType)).
* Paste is always recognized as external.
### IE
diff --git a/tests/plugins/clipboard/paste.js b/tests/plugins/clipboard/paste.js
index d8a49c5a3f6..0a2ca6ec3ff 100644
--- a/tests/plugins/clipboard/paste.js
+++ b/tests/plugins/clipboard/paste.js
@@ -1456,7 +1456,7 @@
assert.isTrue( canClipboardApiBeUsed( dataTransfer, editor ), 'Clipboard API should be used for internal operations.' );
},
- 'test canClipboardApiBeUsed in chrome': function() {
+ 'test canClipboardApiBeUsed in Chrome': function() {
if ( !CKEDITOR.env.chrome ) {
assert.ignore();
}
@@ -1473,7 +1473,7 @@
assert.isTrue( canClipboardApiBeUsed( dataTransfer ), 'Clipboard API should be used in Chrome.' );
},
- 'test canClipboardApiBeUsed in Android chrome (no dataTransfer support)': function() {
+ 'test canClipboardApiBeUsed in Android Chrome (no dataTransfer support)': function() {
if ( !CKEDITOR.env.chrome ) {
assert.ignore();
}
@@ -1520,7 +1520,7 @@
assert.isTrue( canClipboardApiBeUsed( dataTransfer ), 'Clipboard API should be used in Firefox with files.' );
},
- 'test canClipboardApiBeUsed in Firefox without files and html': function() {
+ 'test canClipboardApiBeUsed in Firefox without files and HTML': function() {
if ( !CKEDITOR.env.gecko ) {
assert.ignore();
}
From 05d10ccffe4e3f1aa287786c3a2a63c77ef55011 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotrek=20Koszuli=C5=84ski?=
Date: Wed, 29 Jul 2015 22:57:32 +0200
Subject: [PATCH 8/9] Changelog entry.
---
CHANGES.md | 1 +
plugins/clipboard/plugin.js | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/CHANGES.md b/CHANGES.md
index 821f45aa334..5ec90ab42b2 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -6,6 +6,7 @@ CKEditor 4 Changelog
Fixed Issues:
* [PR#201](https://github.com/ckeditor/ckeditor-dev/pull/201): Fixed: Buttons in the toolbar configurator cause form submission. Thanks to [colemanw](https://github.com/colemanw)!
+* [#13528](http://dev.ckeditor.com/ticket/13528): [Firefox@Windows] Fixed: Content copied from Microsoft Word and other external applications is pasted as plain text. Removed the [`CKEDITOR.plugins.clipboard.isHtmlInExternalDataTransfer`] property as the check must be dynamic.
* [#13434](http://dev.ckeditor.com/ticket/13434): Fixed: Dialog state indicator broken in Right–To–Left environments.
* [#13451](http://dev.ckeditor.com/ticket/13451): [IE8-9] Fixed: One drag&drop operation may affect following ones.
* [#13129](http://dev.ckeditor.com/ticket/13129) Fixed: Block widget blurred after a drop followed by an undo.
diff --git a/plugins/clipboard/plugin.js b/plugins/clipboard/plugin.js
index ddaa87df1a9..5c96256b1bb 100644
--- a/plugins/clipboard/plugin.js
+++ b/plugins/clipboard/plugin.js
@@ -1504,8 +1504,8 @@
mainPasteEvent: ( CKEDITOR.env.ie && !CKEDITOR.env.edge ) ? 'beforepaste' : 'paste',
/**
- * Returns `true` if we can expect that the browser provides data through the Clipboard API.
- * If not, CKEditor will use the paste bin. Read more in
+ * Returns `true` if we can expect that the browser provides HTML data through the Clipboard API.
+ * If not, then it returns `false` and as a result CKEditor will use the paste bin. Read more in
* the [Clipboard Integration](http://docs.ckeditor.com/#!/guide/dev_clipboard-section-clipboard-api) guide.
*
* @since 4.5.2
From 2e19d84b869e388f630b109e08d5ff237cffd727 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotrek=20Koszuli=C5=84ski?=
Date: Wed, 29 Jul 2015 23:15:17 +0200
Subject: [PATCH 9/9] Renamed the method.
---
plugins/clipboard/plugin.js | 4 +--
tests/plugins/clipboard/paste.js | 42 ++++++++++++++++----------------
2 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/plugins/clipboard/plugin.js b/plugins/clipboard/plugin.js
index 5c96256b1bb..a93d2570ee7 100644
--- a/plugins/clipboard/plugin.js
+++ b/plugins/clipboard/plugin.js
@@ -1040,7 +1040,7 @@
var beforePasteNotCanceled = editor.fire( 'beforePaste', eventData ) !== false;
// Do not use paste bin if the browser let us get HTML or files from dataTranfer.
- if ( beforePasteNotCanceled && clipboard.canClipboardApiBeUsed( eventData.dataTransfer, editor ) ) {
+ if ( beforePasteNotCanceled && clipboard.canClipboardApiBeTrusted( eventData.dataTransfer, editor ) ) {
evt.data.preventDefault();
setTimeout( function() {
firePasteEvents( editor, eventData );
@@ -1511,7 +1511,7 @@
* @since 4.5.2
* @returns {Boolean}
*/
- canClipboardApiBeUsed: function( dataTransfer, editor ) {
+ canClipboardApiBeTrusted: function( dataTransfer, editor ) {
// If it's an internal or cross-editor data transfer, then it means that custom cut/copy/paste support works
// and that the data were put manually on the data transfer so we can be sure that it's available.
if ( dataTransfer.getTransferType( editor ) != CKEDITOR.DATA_TRANSFER_EXTERNAL ) {
diff --git a/tests/plugins/clipboard/paste.js b/tests/plugins/clipboard/paste.js
index 0a2ca6ec3ff..3ba4059b0ed 100644
--- a/tests/plugins/clipboard/paste.js
+++ b/tests/plugins/clipboard/paste.js
@@ -1445,23 +1445,23 @@
}, 0 );
},
- 'test canClipboardApiBeUsed internal': function() {
- var canClipboardApiBeUsed = CKEDITOR.plugins.clipboard.canClipboardApiBeUsed;
+ 'test canClipboardApiBeTrusted internal': function() {
+ var canClipboardApiBeTrusted = CKEDITOR.plugins.clipboard.canClipboardApiBeTrusted;
var editor = this.editor,
nativeData = bender.tools.mockNativeDataTransfer(),
evt = { data: { $: { clipboardData: nativeData } } },
dataTransfer = CKEDITOR.plugins.clipboard.initPasteDataTransfer( evt, editor );
- assert.isTrue( canClipboardApiBeUsed( dataTransfer, editor ), 'Clipboard API should be used for internal operations.' );
+ assert.isTrue( canClipboardApiBeTrusted( dataTransfer, editor ), 'Clipboard API should be used for internal operations.' );
},
- 'test canClipboardApiBeUsed in Chrome': function() {
+ 'test canClipboardApiBeTrusted in Chrome': function() {
if ( !CKEDITOR.env.chrome ) {
assert.ignore();
}
- var canClipboardApiBeUsed = CKEDITOR.plugins.clipboard.canClipboardApiBeUsed;
+ var canClipboardApiBeTrusted = CKEDITOR.plugins.clipboard.canClipboardApiBeTrusted;
var nativeData = bender.tools.mockNativeDataTransfer();
@@ -1470,28 +1470,28 @@
var evt = { data: { $: { clipboardData: nativeData } } },
dataTransfer = CKEDITOR.plugins.clipboard.initPasteDataTransfer( evt );
- assert.isTrue( canClipboardApiBeUsed( dataTransfer ), 'Clipboard API should be used in Chrome.' );
+ assert.isTrue( canClipboardApiBeTrusted( dataTransfer ), 'Clipboard API should be used in Chrome.' );
},
- 'test canClipboardApiBeUsed in Android Chrome (no dataTransfer support)': function() {
+ 'test canClipboardApiBeTrusted in Android Chrome (no dataTransfer support)': function() {
if ( !CKEDITOR.env.chrome ) {
assert.ignore();
}
- var canClipboardApiBeUsed = CKEDITOR.plugins.clipboard.canClipboardApiBeUsed;
+ var canClipboardApiBeTrusted = CKEDITOR.plugins.clipboard.canClipboardApiBeTrusted;
var dataTransfer = CKEDITOR.plugins.clipboard.initPasteDataTransfer(); // no native data transfer
- assert.isFalse( canClipboardApiBeUsed( dataTransfer ),
+ assert.isFalse( canClipboardApiBeTrusted( dataTransfer ),
'Clipboard API should NOT be used for in Android Chrome.' );
},
- 'test canClipboardApiBeUsed in Firefox with HTML': function() {
+ 'test canClipboardApiBeTrusted in Firefox with HTML': function() {
if ( !CKEDITOR.env.gecko ) {
assert.ignore();
}
- var canClipboardApiBeUsed = CKEDITOR.plugins.clipboard.canClipboardApiBeUsed;
+ var canClipboardApiBeTrusted = CKEDITOR.plugins.clipboard.canClipboardApiBeTrusted;
var nativeData = bender.tools.mockNativeDataTransfer();
@@ -1500,15 +1500,15 @@
var evt = { data: { $: { clipboardData: nativeData } } },
dataTransfer = CKEDITOR.plugins.clipboard.initPasteDataTransfer( evt );
- assert.isTrue( canClipboardApiBeUsed( dataTransfer ), 'Clipboard API should be used in Firefox with HTML.' );
+ assert.isTrue( canClipboardApiBeTrusted( dataTransfer ), 'Clipboard API should be used in Firefox with HTML.' );
},
- 'test canClipboardApiBeUsed in Firefox with files': function() {
+ 'test canClipboardApiBeTrusted in Firefox with files': function() {
if ( !CKEDITOR.env.gecko ) {
assert.ignore();
}
- var canClipboardApiBeUsed = CKEDITOR.plugins.clipboard.canClipboardApiBeUsed;
+ var canClipboardApiBeTrusted = CKEDITOR.plugins.clipboard.canClipboardApiBeTrusted;
var nativeData = bender.tools.mockNativeDataTransfer();
@@ -1517,36 +1517,36 @@
var evt = { data: { $: { clipboardData: nativeData } } },
dataTransfer = CKEDITOR.plugins.clipboard.initPasteDataTransfer( evt );
- assert.isTrue( canClipboardApiBeUsed( dataTransfer ), 'Clipboard API should be used in Firefox with files.' );
+ assert.isTrue( canClipboardApiBeTrusted( dataTransfer ), 'Clipboard API should be used in Firefox with files.' );
},
- 'test canClipboardApiBeUsed in Firefox without files and HTML': function() {
+ 'test canClipboardApiBeTrusted in Firefox without files and HTML': function() {
if ( !CKEDITOR.env.gecko ) {
assert.ignore();
}
- var canClipboardApiBeUsed = CKEDITOR.plugins.clipboard.canClipboardApiBeUsed;
+ var canClipboardApiBeTrusted = CKEDITOR.plugins.clipboard.canClipboardApiBeTrusted;
var nativeData = bender.tools.mockNativeDataTransfer(),
evt = { data: { $: { clipboardData: nativeData } } },
dataTransfer = CKEDITOR.plugins.clipboard.initPasteDataTransfer( evt );
- assert.isFalse( canClipboardApiBeUsed( dataTransfer ),
+ assert.isFalse( canClipboardApiBeTrusted( dataTransfer ),
'Clipboard API should not be used in Firefox without html and files.' );
},
- 'test canClipboardApiBeUsed on other browser': function() {
+ 'test canClipboardApiBeTrusted on other browser': function() {
if ( CKEDITOR.env.chrome || CKEDITOR.env.gecko ) {
assert.ignore();
}
- var canClipboardApiBeUsed = CKEDITOR.plugins.clipboard.canClipboardApiBeUsed;
+ var canClipboardApiBeTrusted = CKEDITOR.plugins.clipboard.canClipboardApiBeTrusted;
var nativeData = bender.tools.mockNativeDataTransfer(),
evt = { data: { $: { clipboardData: nativeData } } },
dataTransfer = CKEDITOR.plugins.clipboard.initPasteDataTransfer( evt );
- assert.isFalse( canClipboardApiBeUsed( dataTransfer ), 'Clipboard API should not be used in other browsers.' );
+ assert.isFalse( canClipboardApiBeTrusted( dataTransfer ), 'Clipboard API should not be used in other browsers.' );
},
'#131 - trailing spaces': function() {