jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/384682 )
Change subject: Recalculate input size when placeholder is changed ...................................................................... Recalculate input size when placeholder is changed Change-Id: I3feb95275f7709ef0720310b411809a1a5f685a2 --- M modules/ui/ext.advancedSearch.ArbitraryWordInput.js 1 file changed, 12 insertions(+), 3 deletions(-) Approvals: Pablo Grass (WMDE): Looks good to me, approved jenkins-bot: Verified diff --git a/modules/ui/ext.advancedSearch.ArbitraryWordInput.js b/modules/ui/ext.advancedSearch.ArbitraryWordInput.js index abba980..d02d65b 100644 --- a/modules/ui/ext.advancedSearch.ArbitraryWordInput.js +++ b/modules/ui/ext.advancedSearch.ArbitraryWordInput.js @@ -25,7 +25,7 @@ $.extend( { allowArbitrary: true }, config || {} ) ); - this.input.$input.on( 'input', this.onInput.bind( this ) ); + this.input.$input.on( 'input', this.buildTagsFromInput.bind( this ) ); this.on( 'change', this.updatePlaceholder.bind( this ) ); this.populateFromStore(); @@ -59,7 +59,7 @@ this.populateFromStore(); }; - mw.libs.advancedSearch.ui.ArbitraryWordInput.prototype.onInput = function () { + mw.libs.advancedSearch.ui.ArbitraryWordInput.prototype.buildTagsFromInput = function () { var segments = this.input.getValue().split( ',' ); if ( segments.length > 1 ) { @@ -87,8 +87,17 @@ return mw.libs.advancedSearch.ui.ArbitraryWordInput.parent.prototype.isAllowedData.call( this, data ); }; + mw.libs.advancedSearch.ui.ArbitraryWordInput.prototype.setPlaceholder = function ( placeholderText ) { + var currentText = this.input.$input.attr( 'placeholder' ); + + if ( currentText !== placeholderText ) { + this.contentWidthWithPlaceholder = undefined; + this.input.$input.attr( 'placeholder', placeholderText ); + } + }; + mw.libs.advancedSearch.ui.ArbitraryWordInput.prototype.updatePlaceholder = function () { - this.input.$input.attr( 'placeholder', this.getTextForPlaceholder() ); + this.setPlaceholder( this.getTextForPlaceholder() ); }; mw.libs.advancedSearch.ui.ArbitraryWordInput.prototype.getTextForPlaceholder = function () { -- To view, visit https://gerrit.wikimedia.org/r/384682 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I3feb95275f7709ef0720310b411809a1a5f685a2 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/AdvancedSearch Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw <jeroended...@gmail.com> Gerrit-Reviewer: Addshore <addshorew...@gmail.com> Gerrit-Reviewer: Andrew-WMDE <andrew.kos...@wikimedia.de> Gerrit-Reviewer: Pablo Grass (WMDE) <pablo.gr...@wikimedia.de> Gerrit-Reviewer: Tobias Gritschacher <tobias.gritschac...@wikimedia.de> Gerrit-Reviewer: WMDE-Fisch <christoph.jau...@wikimedia.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits