[SSE mobile] Add Highlight results into search
This commit is contained in:
parent
4841a1628b
commit
30445d51b6
|
@ -81,7 +81,8 @@ define([
|
|||
'searchbar:show' : this.onSearchbarShow,
|
||||
'searchbar:hide' : this.onSearchbarHide,
|
||||
'searchbar:render' : this.onSearchbarRender,
|
||||
'searchbar:showsettings': this.onSearchbarSettings
|
||||
'searchbar:showsettings': this.onSearchbarSettings,
|
||||
'search:highlight' : this.onSearchHighlight
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@ -168,22 +169,26 @@ define([
|
|||
searchIn = Common.SharedSettings.get('search-in') === 'sheet' ? 'sheet' : 'workbook',
|
||||
isMatchCase = Common.SharedSettings.get('search-match-case') === true,
|
||||
isMatchCell = Common.SharedSettings.get('search-match-cell') === true,
|
||||
isHighlightRes = Common.SharedSettings.get('search-highlight-res') === true,
|
||||
$pageSettings = $('.page[data-page=search-settings]'),
|
||||
$inputType = $pageSettings.find('input[name=search-type]'),
|
||||
$inputSearchIn = $pageSettings.find('input[name=search-in]'),
|
||||
$inputMatchCase = $pageSettings.find('#search-match-case input:checkbox'),
|
||||
$inputMatchCell = $pageSettings.find('#search-match-cell input:checkbox');
|
||||
$inputMatchCell = $pageSettings.find('#search-match-cell input:checkbox'),
|
||||
$inputHighlightResults = $pageSettings.find('#search-highlight-res input:checkbox');
|
||||
|
||||
$inputType.val([isReplace ? 'replace' : 'search']);
|
||||
$inputSearchIn.val([searchIn]);
|
||||
$inputMatchCase.prop('checked', isMatchCase);
|
||||
$inputMatchCell.prop('checked', isMatchCell);
|
||||
$inputHighlightResults.prop('checked', isHighlightRes);
|
||||
|
||||
// init events
|
||||
$inputType.single('change', _.bind(me.onTypeChange, me));
|
||||
$inputSearchIn.single('change', _.bind(me.onSearchInChange, me));
|
||||
$inputMatchCase.single('change', _.bind(me.onMatchCaseClick, me));
|
||||
$inputMatchCell.single('change', _.bind(me.onMatchCellClick, me));
|
||||
$inputHighlightResults.single('change', _.bind(me.onHighlightResultsClick, me));
|
||||
},
|
||||
|
||||
onSearchbarShow: function(bar) {
|
||||
|
@ -241,7 +246,11 @@ define([
|
|||
},
|
||||
|
||||
onReplace: function (btn) {
|
||||
this.onQueryReplace(this.searchBar.query, this.replaceBar.query);
|
||||
var me = this;
|
||||
me.onQueryReplace(me.searchBar.query, me.replaceBar.query);
|
||||
setTimeout(function () {
|
||||
me.onQuerySearch(me.searchBar.query, 'next');
|
||||
}, 10);
|
||||
},
|
||||
|
||||
onReplaceAll: function (e) {
|
||||
|
@ -359,6 +368,16 @@ define([
|
|||
Common.SharedSettings.set('search-match-cell', $(e.currentTarget).is(':checked'));
|
||||
},
|
||||
|
||||
onHighlightResultsClick: function (e) {
|
||||
var value = $(e.currentTarget).is(':checked');
|
||||
Common.SharedSettings.set('search-highlight-res', value);
|
||||
this.api.asc_selectSearchingResults(value);
|
||||
},
|
||||
|
||||
onSearchHighlight: function(w, highlight) {
|
||||
this.api.asc_selectSearchingResults(highlight);
|
||||
},
|
||||
|
||||
// API handlers
|
||||
|
||||
textNoTextFound: 'Text not found',
|
||||
|
|
|
@ -123,6 +123,19 @@
|
|||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div id="search-highlight-res" class="item-content">
|
||||
<div class="item-inner">
|
||||
<div class="item-title"><%= scope.textHighlightRes %></div>
|
||||
<div class="item-after">
|
||||
<label class="label-switch">
|
||||
<input type="checkbox">
|
||||
<div class="checkbox"></div>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -155,6 +155,13 @@ define([
|
|||
me.fireEvent('searchbar:render', me);
|
||||
me.fireEvent('searchbar:show', me);
|
||||
|
||||
if(Common.SharedSettings.get('search-highlight-res') === undefined) {
|
||||
Common.SharedSettings.set('search-highlight-res', true);
|
||||
}
|
||||
if (Common.SharedSettings.get('search-highlight-res')) {
|
||||
this.fireEvent('search:highlight', [this, true]);
|
||||
}
|
||||
|
||||
searchBar = $$('.searchbar.document');
|
||||
|
||||
_.defer(function() {
|
||||
|
@ -188,6 +195,8 @@ define([
|
|||
uiApp.hideNavbar(searchBar);
|
||||
}, 10);
|
||||
}
|
||||
|
||||
this.fireEvent('search:highlight', [this, false]);
|
||||
},
|
||||
|
||||
textFind: 'Find',
|
||||
|
@ -199,7 +208,8 @@ define([
|
|||
textMatchCell: 'Match Cell',
|
||||
textSearchIn: 'Search In',
|
||||
textWorkbook: 'Workbook',
|
||||
textSheet: 'Sheet'
|
||||
textSheet: 'Sheet',
|
||||
textHighlightRes: 'Highlight results'
|
||||
}
|
||||
})(), SSE.Views.Search || {}))
|
||||
});
|
Loading…
Reference in a new issue