Merge pull request #2023 from ONLYOFFICE/feature/search-in-menu

Feature/search in menu
This commit is contained in:
Julia Radzhabova 2022-10-24 20:58:03 +03:00 committed by GitHub
commit 3ab4211953
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View file

@ -407,8 +407,9 @@ define([
},
selectCandidate: function() {
var index = this._search.index || 0,
var index = (this._search.index && this._search.index != -1) ? this._search.index : 0,
re = new RegExp('^' + ((this._search.full) ? this._search.text : this._search.char), 'i'),
isFirstCharsEqual = re.test(this.store.at(index).get(this.displayField)),
itemCandidate, idxCandidate;
for (var i=0; i<this.store.length; i++) {
@ -417,6 +418,8 @@ define([
if (!itemCandidate) {
itemCandidate = item;
idxCandidate = i;
if(!isFirstCharsEqual)
break;
}
if (this._search.full && i==index || i>index) {
itemCandidate = item;

View file

@ -472,8 +472,9 @@ define([
},
selectCandidate: function() {
var index = this._search.index || 0,
var index = (this._search.index && this._search.index != -1) ? this._search.index : 0,
re = new RegExp('^' + ((this._search.full) ? this._search.text : this._search.char), 'i'),
isFirstCharsEqual = re.test(this.items[index].caption),
itemCandidate, idxCandidate;
for (var i=0; i<this.items.length; i++) {
@ -482,6 +483,8 @@ define([
if (!itemCandidate) {
itemCandidate = item;
idxCandidate = i;
if(!isFirstCharsEqual)
break;
}
if (this._search.full && i==index || i>index) {
itemCandidate = item;
@ -1051,8 +1054,9 @@ define([
},
selectCandidate: function() {
var index = this._search.index || 0,
var index = (this._search.index && this._search.index != -1) ? this._search.index : 0,
re = new RegExp('^' + ((this._search.full) ? this._search.text : this._search.char), 'i'),
isFirstCharsEqual = re.test(this.items[index].caption),
itemCandidate, idxCandidate;
for (var i=0; i<this.items.length; i++) {
@ -1061,6 +1065,8 @@ define([
if (!itemCandidate) {
itemCandidate = item;
idxCandidate = i;
if(!isFirstCharsEqual)
break;
}
if (this._search.full && i==index || i>index) {
itemCandidate = item;