Jeroen De Dauw has uploaded a new change for review. (
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(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AdvancedSearch
refs/changes/82/384682/1
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: newchange
Gerrit-Change-Id: I3feb95275f7709ef0720310b411809a1a5f685a2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/AdvancedSearch
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits