diff --git a/apps/common/main/lib/view/SearchDialog.js b/apps/common/main/lib/view/SearchDialog.js
index 142dfa690..7620173a1 100644
--- a/apps/common/main/lib/view/SearchDialog.js
+++ b/apps/common/main/lib/view/SearchDialog.js
@@ -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) {
diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js
index fb8a03751..c12d02287 100644
--- a/apps/documenteditor/main/app/controller/LeftMenu.js
+++ b/apps/documenteditor/main/app/controller/LeftMenu.js
@@ -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.
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.
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 || {}));
});
\ No newline at end of file
diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json
index 4ab3fda4c..ae09b1213 100644
--- a/apps/documenteditor/main/locale/en.json
+++ b/apps/documenteditor/main/locale/en.json
@@ -514,6 +514,7 @@
"DE.Controllers.LeftMenu.warnDownloadAs": "If you continue saving in this format all features except the text will be lost.
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.
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.",