Fix allowFreeEntry taglist does not get rendered after focus out from input field

This commit is contained in:
Hadi Nategh 2017-09-11 11:57:55 +02:00
parent 27fab7c259
commit 35f2f3fcf1

View File

@ -236,7 +236,7 @@ var et2_taglist = (function(){ "use strict"; return et2_selectbox.extend([et2_IR
renderer: jQuery.proxy(this.options.listRenderer || this.selectionRenderer,this), renderer: jQuery.proxy(this.options.listRenderer || this.selectionRenderer,this),
maxSelection: this.options.multiple ? this.options.maxSelection : 1, maxSelection: this.options.multiple ? this.options.maxSelection : 1,
maxSelectionRenderer: jQuery.proxy(function(v) { this.egw().lang('You can not choose more then %1 item(s)!', v); }, this), maxSelectionRenderer: jQuery.proxy(function(v) { this.egw().lang('You can not choose more then %1 item(s)!', v); }, this),
minCharsRenderer: jQuery.proxy(function(v){ minCharsRenderer: jQuery.proxy(function(v){
this.egw().lang(v == 1 ? 'Please type 1 more character' : 'Please type %1 more characters',v); this.egw().lang(v == 1 ? 'Please type 1 more character' : 'Please type %1 more characters',v);
}, this), }, this),
width: this.options.width, // propagate width width: this.options.width, // propagate width
@ -356,8 +356,13 @@ var et2_taglist = (function(){ "use strict"; return et2_selectbox.extend([et2_IR
if(document.activeElement === document.body || if(document.activeElement === document.body ||
widget.div.has(document.activeElement).length > 0) widget.div.has(document.activeElement).length > 0)
{ {
if (widget.options.allowFreeEntries) taglist.container.blur();
taglist.input.focus(); taglist.input.focus();
} }
else if (widget.options.allowFreeEntries)
{
taglist.container.blur();
}
});},100 });},100
); );
this.$taglist.one('collapse', function() { this.$taglist.one('collapse', function() {
@ -408,7 +413,7 @@ var et2_taglist = (function(){ "use strict"; return et2_selectbox.extend([et2_IR
// multiple on the page // multiple on the page
this.div.on('blur', 'input', function() { this.div.on('blur', 'input', function() {
jQuery('.ms-ctn-focus', widget.div).removeClass('ms-ctn-focus'); jQuery('.ms-ctn-focus', widget.div).removeClass('ms-ctn-focus');
}) });
return true; return true;
}, },