mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-21 09:38:01 +02:00
Desktop: Fixes #9958: Highlight partial matches in search results
This commit is contained in:
parent
f378662196
commit
0b2bb80bb8
@ -24,10 +24,17 @@ markJsUtils.markKeyword = (mark, keyword, stringUtils, extraOptions = null) => {
|
||||
const isBasicSearch = ['ja', 'zh', 'ko'].indexOf(keyword.scriptType) >= 0;
|
||||
|
||||
let value = keyword.value;
|
||||
let accuracy = keyword.accuracy ? keyword.accuracy : { value: 'exactly', limiters: ':;.,-–—‒_(){}[]!\'"+='.split('') };
|
||||
if (isBasicSearch) accuracy = 'partially';
|
||||
|
||||
const getAccuracy = (keyword) => {
|
||||
if (isBasicSearch) return 'partially';
|
||||
if (keyword.type === 'regex') return 'complementary';
|
||||
if (keyword.accuracy) return keyword.accuracy;
|
||||
return keyword.value.length >= 2 ? 'partially' : { value: 'exactly', limiters: ':;.,-–—‒_(){}[]!\'"+='.split('') };
|
||||
};
|
||||
|
||||
const accuracy = getAccuracy(keyword);
|
||||
|
||||
if (keyword.type === 'regex') {
|
||||
accuracy = 'complementary';
|
||||
// Remove the trailing wildcard and "accuracy = complementary" will take
|
||||
// care of highlighting the relevant keywords.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user