jenkins-bot has submitted this change and it was merged. Change subject: Fix clipboardData API path on copy ......................................................................
Fix clipboardData API path on copy Newer versions of Chrome return undefined for DataTransfer#setData however we can still check for the presence of a fully featured DataTransfer object by checking for the 'items' property. Unfortunately this isn't robust feature detection so we'll need to monitor the situation. Change-Id: I52fbbe7597f4779b07c619a1ce601b9a7f504cc4 (cherry picked from commit 0bdd6371155528ff79cffe1eaf5b14d042bb828a) --- M src/ce/ve.ce.Surface.js M tests/ce/ve.ce.Surface.test.js 2 files changed, 3 insertions(+), 4 deletions(-) Approvals: Catrope: Looks good to me, approved jenkins-bot: Verified diff --git a/src/ce/ve.ce.Surface.js b/src/ce/ve.ce.Surface.js index 681f0f1..94205f2 100644 --- a/src/ce/ve.ce.Surface.js +++ b/src/ce/ve.ce.Surface.js @@ -1185,11 +1185,9 @@ clipboardItem = { slice: slice, hash: null }; clipboardIndex = this.clipboard.push( clipboardItem ) - 1; - // Check we have setData and that it actually works (returns true) + // Check we have a W3C clipboardData API if ( - clipboardData && clipboardData.setData && - clipboardData.setData( 'text/xcustom', '' ) && - clipboardData.setData( 'text/html', '' ) + clipboardData && clipboardData.items ) { // Webkit allows us to directly edit the clipboard // Disable the default event so we can override the data diff --git a/tests/ce/ve.ce.Surface.test.js b/tests/ce/ve.ce.Surface.test.js index cc4f061..3bcb8d5 100644 --- a/tests/ce/ve.ce.Surface.test.js +++ b/tests/ce/ve.ce.Surface.test.js @@ -470,6 +470,7 @@ testEvent = { originalEvent: { clipboardData: { + items: [], setData: function ( prop, val ) { testClipboardData[prop] = val; return true; -- To view, visit https://gerrit.wikimedia.org/r/167339 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I52fbbe7597f4779b07c619a1ce601b9a7f504cc4 Gerrit-PatchSet: 1 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: wmf/1.25wmf4 Gerrit-Owner: Jforrester <jforres...@wikimedia.org> Gerrit-Reviewer: Catrope <roan.katt...@gmail.com> Gerrit-Reviewer: Esanders <esand...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits