[MediaWiki-commits] [Gerrit] Always use absolute URLs in external links in the clipboard - change (VisualEditor/VisualEditor)
jenkins-bot has submitted this change and it was merged. Change subject: Always use absolute URLs in external links in the clipboard .. Always use absolute URLs in external links in the clipboard When writing relative links to the clipboard using clipboardData the full path information is lost, so make sure all links are absolute. Bug: 58136 Change-Id: I7ba039dbbf14648510c154ad99d41823b084 --- M modules/ve/ce/ve.ce.Surface.js 1 file changed, 7 insertions(+), 0 deletions(-) Approvals: Catrope: Looks good to me, approved jenkins-bot: Verified diff --git a/modules/ve/ce/ve.ce.Surface.js b/modules/ve/ce/ve.ce.Surface.js index 19cc080..77235fe 100644 --- a/modules/ve/ce/ve.ce.Surface.js +++ b/modules/ve/ce/ve.ce.Surface.js @@ -720,8 +720,15 @@ // Webkit allows us to directly edit the clipboard // Disable the default event so we can override the data e.preventDefault(); + + // Because we have to write HTML to the clipboard directly (clipboardData.setData) + // href absolutization doesn't occur, so do it manually. + this.$pasteTarget.find( 'a' ).attr( 'href', function () { return this.href; } ); + clipboardData.setData( 'text/xcustom', this.clipboardId + '-' + clipboardIndex ); // As we've disabled the default event we need to set the normal clipboard data + // It is apparently impossible to set text/xcustom without setting the other + // types manually too. clipboardData.setData( 'text/html', this.$pasteTarget.html() ); clipboardData.setData( 'text/plain', this.$pasteTarget.text() ); } else { -- To view, visit https://gerrit.wikimedia.org/r/106253 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7ba039dbbf14648510c154ad99d41823b084 Gerrit-PatchSet: 2 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Esanders Gerrit-Reviewer: Catrope Gerrit-Reviewer: Esanders Gerrit-Reviewer: Krinkle Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Always use absolute URLs in external links in the clipboard - change (VisualEditor/VisualEditor)
Esanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/106253 Change subject: Always use absolute URLs in external links in the clipboard .. Always use absolute URLs in external links in the clipboard When writing relative links to the clipboard using clipboardData the full path information is lost, so make sure all links are absolute. Bug: 58136 Change-Id: I7ba039dbbf14648510c154ad99d41823b084 --- M modules/ve/ce/ve.ce.Surface.js 1 file changed, 7 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/53/106253/1 diff --git a/modules/ve/ce/ve.ce.Surface.js b/modules/ve/ce/ve.ce.Surface.js index 19cc080..84bbe3f 100644 --- a/modules/ve/ce/ve.ce.Surface.js +++ b/modules/ve/ce/ve.ce.Surface.js @@ -720,8 +720,15 @@ // Webkit allows us to directly edit the clipboard // Disable the default event so we can override the data e.preventDefault(); + + // Because we're have to write HTML to the clipboard directly (see below) + // href absolutization doesn't occur so do it manually + this.$pasteTarget.find( 'a' ).attr( 'href', function () { return this.href; } ); + clipboardData.setData( 'text/xcustom', this.clipboardId + '-' + clipboardIndex ); // As we've disabled the default event we need to set the normal clipboard data + // It is apparently impossible to set text/xcustom without setting the other + // types manually too. clipboardData.setData( 'text/html', this.$pasteTarget.html() ); clipboardData.setData( 'text/plain', this.$pasteTarget.text() ); } else { -- To view, visit https://gerrit.wikimedia.org/r/106253 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7ba039dbbf14648510c154ad99d41823b084 Gerrit-PatchSet: 1 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Esanders ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits