diff --git a/CHANGELOG.md b/CHANGELOG.md
index fd3f1236c..b7f28a98e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@
* Add customization parameter 'hideRightMenu' for hiding right panel on first loading (bug #39096)
### Document Editor
+* Search selected text
### Spreadsheet Editor
* Set print area
diff --git a/apps/common/main/lib/view/SearchDialog.js b/apps/common/main/lib/view/SearchDialog.js
index e266784d0..375841dd5 100644
--- a/apps/common/main/lib/view/SearchDialog.js
+++ b/apps/common/main/lib/view/SearchDialog.js
@@ -87,10 +87,10 @@
'
',
'
',
'',
- '',
+ '',
'
',
'
',
- '',
+ '',
'
',
'
',
'',
@@ -176,12 +176,14 @@
return this;
},
- show: function(mode) {
+ show: function(mode, text) {
Common.UI.Window.prototype.show.call(this);
!this.mode && !mode && (mode = 'search');
if (mode && this.mode != mode) this.setMode(mode);
+ text && this.setSearchText(text);
+
if (this.options.markresult && this.miHighlight.checked) {
this.fireEvent('search:highlight', [this, true]);
}
@@ -271,6 +273,10 @@
}
},
+ setSearchText: function(value) {
+ this.txtSearch && this.txtSearch.val(value);
+ },
+
onShowReplace: function(e) {
this.setMode((this.mode=='replace') ? 'search' : 'replace');
diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js
index 0fa76faae..e6b0a3018 100644
--- a/apps/documenteditor/main/app/controller/LeftMenu.js
+++ b/apps/documenteditor/main/app/controller/LeftMenu.js
@@ -535,9 +535,10 @@ define([
var mode = this.mode.isEdit ? (action || undefined) : 'no-replace';
if (this.dlgSearch.isVisible()) {
this.dlgSearch.setMode(mode);
+ this.dlgSearch.setSearchText(this.api.asc_GetSelectedText());
this.dlgSearch.focus();
} else {
- this.dlgSearch.show(mode);
+ this.dlgSearch.show(mode, this.api.asc_GetSelectedText());
}
} else this.dlgSearch['hide']();
},