Esanders has uploaded a new change for review.
https://gerrit.wikimedia.org/r/203964
Change subject: Disable pasteTarget-for-copying hack on iOS
......................................................................
Disable pasteTarget-for-copying hack on iOS
The native selection is the paste target is not hidden and
causes scrolling. Also keyboard copy is not really possible
on a standard iOS setup.
Change-Id: I9aecdb5b08c5c9bb2dd17d0274011e201188d293
---
M src/ce/ve.ce.Surface.js
M src/init/ve.init.Platform.js
2 files changed, 26 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor
refs/changes/64/203964/1
diff --git a/src/ce/ve.ce.Surface.js b/src/ce/ve.ce.Surface.js
index 7ec06ec..2dfc174 100644
--- a/src/ce/ve.ce.Surface.js
+++ b/src/ce/ve.ce.Surface.js
@@ -2288,9 +2288,19 @@
// Previously this was a single space but this isn't selected
programmatically
// properly, and in Safari results in a collapsed selection.
// onCopy will ignore this native selection and use the DM selection
- this.$pasteTarget.text( '☢' );
- ve.selectElement( this.$pasteTarget[0] );
- this.$pasteTarget[0].focus();
+ if ( !ve.init.platform.constructor.static.isIos() ) {
+ this.$pasteTarget.text( '☢' );
+ ve.selectElement( this.$pasteTarget[0] );
+ this.$pasteTarget[0].focus();
+ } else {
+ // Selecting the paste target fails on iOS:
+ // * The selection isn't invisible and causes scrolling
+ // * The user is unlikely to be able to trigger a keyboard copy
anyway
+ // Instead just deactivate the surface so the native cursor
doesn't
+ // get in the way.
+ // TODO: Provide a copy tool in the context menu
+ this.deactivate();
+ }
};
/**
diff --git a/src/init/ve.init.Platform.js b/src/init/ve.init.Platform.js
index fd724ff..ac31f44 100644
--- a/src/init/ve.init.Platform.js
+++ b/src/init/ve.init.Platform.js
@@ -44,12 +44,24 @@
* @static
* @method
* @inheritable
- * @returns {boolean} Whether we are in IE
+ * @returns {boolean} We are in IE
*/
ve.init.Platform.static.isInternetExplorer = function () {
return $.client.profile().name === 'msie';
};
+/**
+ * Check wheter we are running on iOS
+ *
+ * @static
+ * @method
+ * @inheritable
+ * @return {boolean} We are running on iOS
+ */
+ve.init.Platform.static.isIos = function () {
+ return /ipad|iphone|ipod/i.test( navigator.userAgent );
+};
+
/* Methods */
/**
--
To view, visit https://gerrit.wikimedia.org/r/203964
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9aecdb5b08c5c9bb2dd17d0274011e201188d293
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits