MWLinkAnnotationInspector: select entire link when switching tabs

Bug: T129650
Change-Id: I4ca445f2c43438c36ece23245660b63f2a48b722
This commit is contained in:
David Lynch 2016-03-28 11:38:45 -05:00
parent f239e17a1e
commit d33f5969ad

View file

@ -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();
};