Merge pull request #1518 from ONLYOFFICE/feature/search-callback

Use callback in search function
This commit is contained in:
Oleg Korshul 2022-01-25 16:28:32 +03:00 committed by GitHub
commit 7d19d36a13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 27 deletions

View file

@ -560,15 +560,15 @@ define([
onQuerySearch: function(d, w, opts) {
if (opts.textsearch && opts.textsearch.length) {
if (!this.api.asc_findText(opts.textsearch, d != 'back', opts.matchcase, opts.matchword)) {
var me = this;
Common.UI.info({
msg: this.textNoTextFound,
var me = this;
this.api.asc_findText(opts.textsearch, d != 'back', opts.matchcase, function(resultCount) {
!resultCount && Common.UI.info({
msg: me.textNoTextFound,
callback: function() {
me.dlgSearch.focus();
}
});
}
});
}
},

View file

@ -108,12 +108,12 @@ const Search = withTranslation()(props => {
f7.popover.close('.document-menu.modal-in', false);
if (params.find && params.find.length) {
if(params.highlight) api.asc_selectSearchingResults(true);
if (!api.asc_findText(params.find, params.forward, params.caseSensitive, params.highlight) ) {
f7.dialog.alert(null, _t.textNoTextFound);
}
if (params.highlight) api.asc_selectSearchingResults(true);
api.asc_findText(params.find, params.forward, params.caseSensitive, function (resultCount) {
!resultCount && f7.dialog.alert(null, _t.textNoTextFound);
});
}
};

View file

@ -438,15 +438,15 @@ define([
onQuerySearch: function(d, w, opts) {
if (opts.textsearch && opts.textsearch.length) {
if (!this.api.findText(opts.textsearch, d != 'back', opts.matchcase)) {
var me = this;
Common.UI.info({
msg: this.textNoTextFound,
var me = this;
this.api.asc_findText(opts.textsearch, d != 'back', opts.matchcase, function(resultCount) {
!resultCount && Common.UI.info({
msg: me.textNoTextFound,
callback: function() {
me.dlgSearch.focus();
}
});
}
});
}
},

View file

@ -88,9 +88,10 @@ const Search = withTranslation()(props => {
f7.popover.close('.document-menu.modal-in', false);
if (params.find && params.find.length) {
if (!api.findText(params.find, params.forward, params.caseSensitive) ) {
f7.dialog.alert(null, _t.textNoTextFound);
}
api.asc_findText(params.find, params.forward, params.caseSensitive, function(resultCount) {
!resultCount && f7.dialog.alert(null, _t.textNoTextFound);
});
}
};

View file

@ -566,15 +566,15 @@ define([
options.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked);
options.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked?Asc.c_oAscFindLookIn.Formulas:Asc.c_oAscFindLookIn.Value);
if (!this.api.asc_findText(options)) {
var me = this;
Common.UI.info({
msg: this.textNoTextFound,
var me = this;
this.api.asc_findText(options, function(resultCount) {
!resultCount && Common.UI.info({
msg: me.textNoTextFound,
callback: function() {
me.dlgSearch.focus();
}
});
}
});
// }
},

View file

@ -165,9 +165,9 @@ const Search = withTranslation()(props => {
if (params.highlight) api.asc_selectSearchingResults(true);
if (!api.asc_findText(options)) {
f7.dialog.alert(null, _t.textNoTextFound);
}
api.asc_findText(options, function(resultCount) {
!resultCount && f7.dialog.alert(null, _t.textNoTextFound);
});
}
};