jenkins-bot has submitted this change and it was merged.
Change subject: TextInputWidget: Add moveCursorToEnd()
......................................................................
TextInputWidget: Add moveCursorToEnd()
Upstreamed from ve.selectEnd() in VisualEditor.
Change-Id: Ia63e6c6a043f9d82ae7e29502ab399ed73ab17fa
---
M src/widgets/TextInputWidget.js
1 file changed, 17 insertions(+), 0 deletions(-)
Approvals:
Jforrester: Looks good to me, approved
jenkins-bot: Verified
diff --git a/src/widgets/TextInputWidget.js b/src/widgets/TextInputWidget.js
index 38baa48..4e0993b 100644
--- a/src/widgets/TextInputWidget.js
+++ b/src/widgets/TextInputWidget.js
@@ -463,6 +463,23 @@
};
/**
+ * Focus the input and move the cursor to the end.
+ */
+OO.ui.TextInputWidget.prototype.moveCursorToEnd = function () {
+ var textRange,
+ element = this.$input[0];
+ this.focus();
+ if ( element.selectionStart !== undefined ) {
+ element.selectionStart = element.selectionEnd =
element.value.length;
+ } else if ( element.createTextRange ) {
+ // IE 8 and below
+ textRange = element.createTextRange();
+ textRange.collapse( false );
+ textRange.select();
+ }
+};
+
+/**
* Set the validation pattern.
*
* The validation pattern is either a regular expression, a function, or the
symbolic name of a
--
To view, visit https://gerrit.wikimedia.org/r/232775
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia63e6c6a043f9d82ae7e29502ab399ed73ab17fa
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits