From e8149e2588193a7101d66c65971f84bad3c41ea8 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Tue, 2 Jun 2015 22:03:08 +0100 Subject: [PATCH] Always preserve input when switch between internal/external links Although an internal link is unlikely to be a valid external link, this prevents an annoying experience when the user switches to external and then back to internal while exploring features. Change-Id: I178cf3f641db683f5dd0a49c246c204ded89760c --- .../inspectors/ve.ui.MWLinkAnnotationInspector.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/modules/ve-mw/ui/inspectors/ve.ui.MWLinkAnnotationInspector.js b/modules/ve-mw/ui/inspectors/ve.ui.MWLinkAnnotationInspector.js index c1aca8ea26..f062b29edd 100644 --- a/modules/ve-mw/ui/inspectors/ve.ui.MWLinkAnnotationInspector.js +++ b/modules/ve-mw/ui/inspectors/ve.ui.MWLinkAnnotationInspector.js @@ -147,16 +147,9 @@ ve.ui.MWLinkAnnotationInspector.prototype.onLinkTypeSelectSelect = function () { this.annotationInput = this.createAnnotationInput(); this.form.$element.append( this.annotationInput.$element ); - if ( isExternal ) { - // If the user switches to external links clear the input, unless the input is URL-like - if ( !inputHasProtocol ) { - text = ''; - } - } else { - // If the user manually switches to internal links with an external link in the input, remember this - if ( inputHasProtocol ) { - this.allowProtocolInInternal = true; - } + // If the user manually switches to internal links with an external link in the input, remember this + if ( !isExternal && inputHasProtocol ) { + this.allowProtocolInInternal = true; } this.annotationInput.text.setValue( text ).focus();