Esanders has uploaded a new change for review.
https://gerrit.wikimedia.org/r/100578
Change subject: Check the selection has collapsed after pasting
......................................................................
Check the selection has collapsed after pasting
In Chrome you can paste the empty string which triggers
the paste events but doesn't change the paste target. This
results in the insertion of the context character on empty
lines. To avoid this we can detect if the selection we put
around the context character is still there and abort the
paste.
Bug: 58138
Change-Id: Ib73465a2376cd316dbac6ce2567ecb64bc500307
---
M modules/ve/ce/ve.ce.Surface.js
1 file changed, 5 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor
refs/changes/78/100578/1
diff --git a/modules/ve/ce/ve.ce.Surface.js b/modules/ve/ce/ve.ce.Surface.js
index 2d0e5ee..ee1095e 100644
--- a/modules/ve/ce/ve.ce.Surface.js
+++ b/modules/ve/ce/ve.ce.Surface.js
@@ -875,6 +875,11 @@
$window = this.$( OO.ui.Element.getWindow( this.$.context ) ),
selection = this.model.getSelection();
+ // If the selection doesn't collapse after paste then nothing was
inserted
+ if ( !rangy.getSelection( this.getElementDocument() ).isCollapsed ) {
+ return;
+ }
+
// Remove the pasteProtect class. See #onCopy.
this.$pasteTarget.find( 'span' ).removeClass( 've-pasteProtect' );
--
To view, visit https://gerrit.wikimedia.org/r/100578
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib73465a2376cd316dbac6ce2567ecb64bc500307
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits