1
0
Fork 0
forked from OpenNeo/impress

whoops, dont trigger autofilter checkbox if we *only* collapsed spaces

This commit is contained in:
Matt Dunn-Rankin 2017-01-09 11:16:38 -08:00
parent 0679d60c82
commit 17f289f68f

View file

@ -1355,12 +1355,12 @@ View.Search = function (wardrobe) {
function updateQuery() { function updateQuery() {
var human_query = typeof current_query === 'string' ? current_query : ''; var human_query = typeof current_query === 'string' ? current_query : '';
var autofilterClause = buildAutofilterClause(); var autofilterClause = buildAutofilterClause();
var autofilterPresent = human_query.indexOf(autofilterClause) >= 0;
var queryWithoutAutofilterClause = human_query var queryWithoutAutofilterClause = human_query
.replace(autofilterClause, '') // remove autofilter clause .replace(autofilterClause, '') // remove autofilter clause
.replace(/^\s+/, '') // remove leading spaces .replace(/^\s+/, '') // remove leading spaces
.replace(/\s+$/, '') // remove trailing spaces .replace(/\s+$/, '') // remove trailing spaces
.replace(/\s+/g, ' '); // collapse spaces .replace(/\s+/g, ' '); // collapse spaces
var autofilterPresent = human_query !== queryWithoutAutofilterClause;
if (autofilterPresent) { if (autofilterPresent) {
$('#preview-search-autofilter').attr('checked', 'checked'); $('#preview-search-autofilter').attr('checked', 'checked');
} else if (current_query.length > 0) { } else if (current_query.length > 0) {