[DE] Fix Bug 56026

This commit is contained in:
Julia Radzhabova 2022-03-17 19:57:30 +03:00
parent 988eaa35ee
commit d3e8e72843
3 changed files with 39 additions and 7 deletions

View file

@ -171,7 +171,7 @@
this.txtSearch.on('keydown', null, 'search', _.bind(this.onKeyPress, this));
this.txtReplace.on('keydown', null, 'replace', _.bind(this.onKeyPress, this));
this.on('animate:before', _.bind(this.focus, this));
this.on('animate:before', _.bind(this.onAnimateBefore, this));
return this;
},
@ -191,14 +191,18 @@
this.focus();
},
focus: function() {
var me = this;
focus: function(type) {
var field = (type==='replace') ? this.txtReplace : this.txtSearch;
setTimeout(function(){
me.txtSearch.focus();
me.txtSearch.select();
field.focus();
field.select();
}, 10);
},
onAnimateBefore: function() {
this.focus();
},
onKeyPress: function(event) {
if (!this.isLocked()) {
if (event.keyCode == Common.UI.Keys.RETURN) {

View file

@ -575,8 +575,21 @@ define([
onQueryReplace: function(w, opts) {
if (!_.isEmpty(opts.textsearch)) {
var me = this;
var str = this.api.asc_GetErrorForReplaceString(opts.textreplace);
if (str) {
Common.UI.warning({
title: this.notcriticalErrorTitle,
msg: Common.Utils.String.format(this.warnReplaceString, str),
buttons: ['ok'],
callback: function(btn){
me.dlgSearch.focus('replace');
}
});
return;
}
if (!this.api.asc_replaceText(opts.textsearch, opts.textreplace, false, opts.matchcase, opts.matchword)) {
var me = this;
Common.UI.info({
msg: this.textNoTextFound,
callback: function() {
@ -589,6 +602,19 @@ define([
onQueryReplaceAll: function(w, opts) {
if (!_.isEmpty(opts.textsearch)) {
var me = this;
var str = this.api.asc_GetErrorForReplaceString(opts.textreplace);
if (str) {
Common.UI.warning({
title: this.notcriticalErrorTitle,
msg: Common.Utils.String.format(this.warnReplaceString, str),
buttons: ['ok'],
callback: function(btn){
me.dlgSearch.focus('replace');
}
});
return;
}
this.api.asc_replaceText(opts.textsearch, opts.textreplace, true, opts.matchcase, opts.matchword);
}
},
@ -928,7 +954,8 @@ define([
warnDownloadAsRTF : 'If you continue saving in this format some of the formatting might be lost.<br>Are you sure you want to continue?',
txtUntitled: 'Untitled',
txtCompatible: 'The document will be saved to the new format. It will allow to use all the editor features, but might affect the document layout.<br>Use the \'Compatibility\' option of the advanced settings if you want to make the files compatible with older MS Word versions.',
warnDownloadAsPdf: 'Your {0} will be converted to an editable format. This may take a while. The resulting document will be optimized to allow you to edit the text, so it might not look exactly like the original {0}, especially if the original file contained lots of graphics.'
warnDownloadAsPdf: 'Your {0} will be converted to an editable format. This may take a while. The resulting document will be optimized to allow you to edit the text, so it might not look exactly like the original {0}, especially if the original file contained lots of graphics.',
warnReplaceString: '{0} is not a valid special character for the Replace With box.'
}, DE.Controllers.LeftMenu || {}));
});

View file

@ -514,6 +514,7 @@
"DE.Controllers.LeftMenu.warnDownloadAs": "If you continue saving in this format all features except the text will be lost.<br>Are you sure you want to continue?",
"DE.Controllers.LeftMenu.warnDownloadAsPdf": "Your {0} will be converted to an editable format. This may take a while. The resulting document will be optimized to allow you to edit the text, so it might not look exactly like the original {0}, especially if the original file contained lots of graphics.",
"DE.Controllers.LeftMenu.warnDownloadAsRTF": "If you continue saving in this format some of the formatting might be lost.<br>Are you sure you want to continue?",
"DE.Controllers.LeftMenu.warnReplaceString": "{0} is not a valid special character for the Replace With box.",
"DE.Controllers.Main.applyChangesTextText": "Loading the changes...",
"DE.Controllers.Main.applyChangesTitleText": "Loading the Changes",
"DE.Controllers.Main.convertationTimeoutText": "Conversion timeout exceeded.",