Merge pull request #1518 from ONLYOFFICE/feature/search-callback
Use callback in search function
This commit is contained in:
commit
7d19d36a13
|
@ -560,15 +560,15 @@ define([
|
||||||
|
|
||||||
onQuerySearch: function(d, w, opts) {
|
onQuerySearch: function(d, w, opts) {
|
||||||
if (opts.textsearch && opts.textsearch.length) {
|
if (opts.textsearch && opts.textsearch.length) {
|
||||||
if (!this.api.asc_findText(opts.textsearch, d != 'back', opts.matchcase, opts.matchword)) {
|
var me = this;
|
||||||
var me = this;
|
this.api.asc_findText(opts.textsearch, d != 'back', opts.matchcase, function(resultCount) {
|
||||||
Common.UI.info({
|
!resultCount && Common.UI.info({
|
||||||
msg: this.textNoTextFound,
|
msg: me.textNoTextFound,
|
||||||
callback: function() {
|
callback: function() {
|
||||||
me.dlgSearch.focus();
|
me.dlgSearch.focus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -108,12 +108,12 @@ const Search = withTranslation()(props => {
|
||||||
f7.popover.close('.document-menu.modal-in', false);
|
f7.popover.close('.document-menu.modal-in', false);
|
||||||
|
|
||||||
if (params.find && params.find.length) {
|
if (params.find && params.find.length) {
|
||||||
|
|
||||||
if(params.highlight) api.asc_selectSearchingResults(true);
|
if (params.highlight) api.asc_selectSearchingResults(true);
|
||||||
|
|
||||||
if (!api.asc_findText(params.find, params.forward, params.caseSensitive, params.highlight) ) {
|
api.asc_findText(params.find, params.forward, params.caseSensitive, function (resultCount) {
|
||||||
f7.dialog.alert(null, _t.textNoTextFound);
|
!resultCount && f7.dialog.alert(null, _t.textNoTextFound);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -438,15 +438,15 @@ define([
|
||||||
|
|
||||||
onQuerySearch: function(d, w, opts) {
|
onQuerySearch: function(d, w, opts) {
|
||||||
if (opts.textsearch && opts.textsearch.length) {
|
if (opts.textsearch && opts.textsearch.length) {
|
||||||
if (!this.api.findText(opts.textsearch, d != 'back', opts.matchcase)) {
|
var me = this;
|
||||||
var me = this;
|
this.api.asc_findText(opts.textsearch, d != 'back', opts.matchcase, function(resultCount) {
|
||||||
Common.UI.info({
|
!resultCount && Common.UI.info({
|
||||||
msg: this.textNoTextFound,
|
msg: me.textNoTextFound,
|
||||||
callback: function() {
|
callback: function() {
|
||||||
me.dlgSearch.focus();
|
me.dlgSearch.focus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -88,9 +88,10 @@ const Search = withTranslation()(props => {
|
||||||
f7.popover.close('.document-menu.modal-in', false);
|
f7.popover.close('.document-menu.modal-in', false);
|
||||||
|
|
||||||
if (params.find && params.find.length) {
|
if (params.find && params.find.length) {
|
||||||
if (!api.findText(params.find, params.forward, params.caseSensitive) ) {
|
api.asc_findText(params.find, params.forward, params.caseSensitive, function(resultCount) {
|
||||||
f7.dialog.alert(null, _t.textNoTextFound);
|
!resultCount && f7.dialog.alert(null, _t.textNoTextFound);
|
||||||
}
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -566,15 +566,15 @@ define([
|
||||||
options.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked);
|
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);
|
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;
|
||||||
var me = this;
|
this.api.asc_findText(options, function(resultCount) {
|
||||||
Common.UI.info({
|
!resultCount && Common.UI.info({
|
||||||
msg: this.textNoTextFound,
|
msg: me.textNoTextFound,
|
||||||
callback: function() {
|
callback: function() {
|
||||||
me.dlgSearch.focus();
|
me.dlgSearch.focus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
// }
|
// }
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -165,9 +165,9 @@ const Search = withTranslation()(props => {
|
||||||
|
|
||||||
if (params.highlight) api.asc_selectSearchingResults(true);
|
if (params.highlight) api.asc_selectSearchingResults(true);
|
||||||
|
|
||||||
if (!api.asc_findText(options)) {
|
api.asc_findText(options, function(resultCount) {
|
||||||
f7.dialog.alert(null, _t.textNoTextFound);
|
!resultCount && f7.dialog.alert(null, _t.textNoTextFound);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue