From d33f5969ad6ce92f6119db386a1725ba475ebffe Mon Sep 17 00:00:00 2001 From: David Lynch Date: Mon, 28 Mar 2016 11:38:45 -0500 Subject: [PATCH] MWLinkAnnotationInspector: select entire link when switching tabs Bug: T129650 Change-Id: I4ca445f2c43438c36ece23245660b63f2a48b722 --- .../ui/inspectors/ve.ui.MWLinkAnnotationInspector.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/ve-mw/ui/inspectors/ve.ui.MWLinkAnnotationInspector.js b/modules/ve-mw/ui/inspectors/ve.ui.MWLinkAnnotationInspector.js index 02a88ad3dd..69dbbd8187 100644 --- a/modules/ve-mw/ui/inspectors/ve.ui.MWLinkAnnotationInspector.js +++ b/modules/ve-mw/ui/inspectors/ve.ui.MWLinkAnnotationInspector.js @@ -289,8 +289,12 @@ ve.ui.MWLinkAnnotationInspector.prototype.onLinkTypeIndexSet = function () { } this.annotationInput.getTextInputWidget().setValue( text ).focus(); - // Firefox moves the cursor to the beginning - this.annotationInput.getTextInputWidget().$input[ 0 ].setSelectionRange( end, end ); + // Select entire link when switching, for ease of replacing entire contents. + // Most common case: + // 1. Inspector opened, internal-link shown with the selected-word prefilled + // 2. User clicks external link tab (unnecessary, because we'd auto-switch, but the user doesn't know that) + // 3. User pastes a link, intending to replace the existing prefilled link + this.annotationInput.getTextInputWidget().$input[ 0 ].setSelectionRange( 0, end ); this.updateActions(); };