Merge pull request #500 from ONLYOFFICE/fix/bug-19846

[SSE] Fix Bug 19846
This commit is contained in:
Julia Radzhabova 2020-09-09 14:06:04 +03:00 committed by GitHub
commit 86ece7f5c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -108,7 +108,7 @@ define([
}).on ('changing', function (input, value) {
if (value.length) {
value = value.replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
me.filter = new RegExp(value, 'ig');
me.filter = value.toLowerCase();
} else {
me.filter = undefined;
}
@ -321,12 +321,22 @@ define([
}
var me = this,
filter_reg = new RegExp(me.filter, 'ig'),
arr = this.allFunctions.filter(function(item) {
return !!item.get('name').match(me.filter);
return !!item.get('name').match(filter_reg);
});
if (arr.length>0 && this.cmbFuncGroup.store.at(0).get('value')!='Recommended') {
this.cmbFuncGroup.store.unshift({value: 'Recommended', displayValue: this.txtRecommended});
this.cmbFuncGroup.onResetItems();
if (arr.length>0) {
if (this.cmbFuncGroup.store.at(0).get('value')!='Recommended') {
this.cmbFuncGroup.store.unshift({value: 'Recommended', displayValue: this.txtRecommended});
this.cmbFuncGroup.onResetItems();
}
var idx = _.findIndex(arr, function(item) {
return (item.get('name').toLowerCase()===me.filter);
});
if (idx>0) {
var removed = arr.splice(idx, 1);
arr.unshift(removed[0]);
}
} else if (arr.length==0 && this.cmbFuncGroup.store.at(0).get('value')=='Recommended') {
this.cmbFuncGroup.store.shift();
this.cmbFuncGroup.onResetItems();