You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-15 23:00:36 +02:00
All: Search: Integration to CLI and mobile apps
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
const stringUtilsCommon = require('./string-utils-common.js');
|
||||
|
||||
const defaultDiacriticsRemovalMap = [
|
||||
{'base':'A', 'letters':/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g},
|
||||
{'base':'AA','letters':/[\uA732]/g},
|
||||
@ -228,12 +230,12 @@ function surroundKeywords(keywords, text, prefix, suffix) {
|
||||
|
||||
let regexString = keywords.map((k) => {
|
||||
if (k.type === 'regex') {
|
||||
return k.valueRegex;
|
||||
return stringUtilsCommon.replaceRegexDiacritics(k.valueRegex);
|
||||
} else {
|
||||
return pregQuote(k);
|
||||
}
|
||||
return stringUtilsCommon.replaceRegexDiacritics(stringUtilsCommon.pregQuote(k.value));
|
||||
}
|
||||
}).join('|');
|
||||
regexString = '\\b(' + regexString + ')\\b'
|
||||
regexString = '(' + regexString + ')'
|
||||
const re = new RegExp(regexString, 'gi');
|
||||
return text.replace(re, prefix + '$1' + suffix);
|
||||
}
|
||||
@ -251,5 +253,5 @@ function scriptType(s) {
|
||||
|
||||
module.exports = Object.assign(
|
||||
{ removeDiacritics, escapeFilename, wrap, splitCommandString, padLeft, toTitleCase, urlDecode, escapeHtml, surroundKeywords, scriptType },
|
||||
require('./string-utils-common.js'),
|
||||
stringUtilsCommon,
|
||||
);
|
||||
|
Reference in New Issue
Block a user