From c10483999eaa9da182925451e18903336a81e0df Mon Sep 17 00:00:00 2001 From: Moriel Schottlender Date: Thu, 9 Apr 2015 16:22:45 -0700 Subject: [PATCH] Focus the search box in the re-use citation dialog Bug: T91479 Change-Id: I3ad7c99d2fded2d2f21bd210dd57ad9807d88e13 --- modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js index 1d0ccd2f05..3905f4ede4 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js @@ -20,6 +20,7 @@ ve.ui.MWReferenceDialog = function VeUiMWReferenceDialog( config ) { // Properties this.referenceModel = null; + this.useExisting = false; }; /* Inheritance */ @@ -193,7 +194,11 @@ ve.ui.MWReferenceDialog.prototype.onSearchSelect = function ( ref ) { ve.ui.MWReferenceDialog.prototype.getReadyProcess = function ( data ) { return ve.ui.MWReferenceDialog.super.prototype.getReadyProcess.call( this, data ) .next( function () { - this.referenceSurface.focus(); + if ( this.useExisting ) { + this.search.getQuery().focus().select(); + } else { + this.referenceSurface.focus(); + } }, this ); }; @@ -396,7 +401,7 @@ ve.ui.MWReferenceDialog.prototype.getSetupProcess = function ( data ) { if ( data.useExisting ) { this.useExistingReference( 'insert-select' ); } - + this.useExisting = !!data.useExisting; // If we're using an existing reference, start off disabled // If not, set disabled based on whether or not there are any existing ones. this.actions.setAbilities( {