[DE] Search selected text

This commit is contained in:
Julia Radzhabova 2018-11-15 15:02:50 +03:00
parent 9ce8081d66
commit 8348a8d432
3 changed files with 12 additions and 4 deletions

View file

@ -8,6 +8,7 @@
* Add customization parameter 'hideRightMenu' for hiding right panel on first loading (bug #39096) * Add customization parameter 'hideRightMenu' for hiding right panel on first loading (bug #39096)
### Document Editor ### Document Editor
* Search selected text
### Spreadsheet Editor ### Spreadsheet Editor
* Set print area * Set print area

View file

@ -87,10 +87,10 @@
'<div class="box">', '<div class="box">',
'<div class="input-row">', '<div class="input-row">',
'<span class="btn-placeholder" id="search-placeholder-btn-options"></span>', '<span class="btn-placeholder" id="search-placeholder-btn-options"></span>',
'<input type="text" id="sd-text-search" class="form-control" maxlength="100" placeholder="'+this.textSearchStart+'">', '<input type="text" id="sd-text-search" class="form-control" maxlength="255" placeholder="'+this.textSearchStart+'">',
'</div>', '</div>',
'<div class="input-row">', '<div class="input-row">',
'<input type="text" id="sd-text-replace" class="form-control" maxlength="100" placeholder="'+this.textReplaceDef+'">', '<input type="text" id="sd-text-replace" class="form-control" maxlength="255" placeholder="'+this.textReplaceDef+'">',
'</div>', '</div>',
'<div class="input-row">', '<div class="input-row">',
'<label class="link" id="search-label-replace" result="replaceshow">'+this.txtBtnReplace+'</label>', '<label class="link" id="search-label-replace" result="replaceshow">'+this.txtBtnReplace+'</label>',
@ -176,12 +176,14 @@
return this; return this;
}, },
show: function(mode) { show: function(mode, text) {
Common.UI.Window.prototype.show.call(this); Common.UI.Window.prototype.show.call(this);
!this.mode && !mode && (mode = 'search'); !this.mode && !mode && (mode = 'search');
if (mode && this.mode != mode) this.setMode(mode); if (mode && this.mode != mode) this.setMode(mode);
text && this.setSearchText(text);
if (this.options.markresult && this.miHighlight.checked) { if (this.options.markresult && this.miHighlight.checked) {
this.fireEvent('search:highlight', [this, true]); this.fireEvent('search:highlight', [this, true]);
} }
@ -271,6 +273,10 @@
} }
}, },
setSearchText: function(value) {
this.txtSearch && this.txtSearch.val(value);
},
onShowReplace: function(e) { onShowReplace: function(e) {
this.setMode((this.mode=='replace') ? 'search' : 'replace'); this.setMode((this.mode=='replace') ? 'search' : 'replace');

View file

@ -535,9 +535,10 @@ define([
var mode = this.mode.isEdit ? (action || undefined) : 'no-replace'; var mode = this.mode.isEdit ? (action || undefined) : 'no-replace';
if (this.dlgSearch.isVisible()) { if (this.dlgSearch.isVisible()) {
this.dlgSearch.setMode(mode); this.dlgSearch.setMode(mode);
this.dlgSearch.setSearchText(this.api.asc_GetSelectedText());
this.dlgSearch.focus(); this.dlgSearch.focus();
} else { } else {
this.dlgSearch.show(mode); this.dlgSearch.show(mode, this.api.asc_GetSelectedText());
} }
} else this.dlgSearch['hide'](); } else this.dlgSearch['hide']();
}, },