Merge branch 'master' into feature/176-CamelCaseTokens
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "omnisearch",
|
||||
"name": "Omnisearch",
|
||||
"version": "1.11.1",
|
||||
"version": "1.12.2",
|
||||
"minAppVersion": "1.0.0",
|
||||
"description": "A search engine that just works",
|
||||
"author": "Simon Cambier",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "omnisearch",
|
||||
"name": "Omnisearch",
|
||||
"version": "1.11.1",
|
||||
"version": "1.12.2",
|
||||
"minAppVersion": "1.0.0",
|
||||
"description": "A search engine that just works",
|
||||
"author": "Simon Cambier",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "scambier.obsidian-search",
|
||||
"version": "1.12.1-beta.1",
|
||||
"version": "1.12.2",
|
||||
"description": "A search engine for Obsidian",
|
||||
"main": "dist/main.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -190,9 +190,11 @@ export class Omnisearch {
|
||||
|
||||
// Filter query results to only keep files that match query.extensions (if any)
|
||||
if (query.extensions.length) {
|
||||
results = results.filter(r =>
|
||||
query.extensions.some(e => r.id.endsWith(e))
|
||||
)
|
||||
results = results.filter(r => {
|
||||
// ".can" should match ".canvas"
|
||||
const ext = '.' + r.id.split('.').pop()
|
||||
return query.extensions.some(e => ext.startsWith(e))
|
||||
})
|
||||
}
|
||||
|
||||
// If the query does not return any result,
|
||||
|
||||
@@ -27,7 +27,12 @@ export function highlighter(str: string): string {
|
||||
}
|
||||
|
||||
export function highlighterGroups(...args: any[]) {
|
||||
if (args[1] && args[2])
|
||||
if (
|
||||
args[1] !== null &&
|
||||
args[1] !== undefined &&
|
||||
args[2] !== null &&
|
||||
args[2] !== undefined
|
||||
)
|
||||
return `${args[1]}<span class="${highlightClass}">${args[2]}</span>`
|
||||
return '<no content>'
|
||||
}
|
||||
@@ -63,8 +68,9 @@ export function wait(ms: number): Promise<void> {
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/a/3561711
|
||||
// but we enclose special chars in brackets to avoid them being interpreted as regex
|
||||
export function escapeRegex(str: string): string {
|
||||
return str.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&')
|
||||
return str.replace(/[-/\\^$*+?.()|[\]{}]/g, '[$&]')
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,7 +94,7 @@ export function stringsToRegex(strings: string[]): RegExp {
|
||||
// Default word split is not applied if the user uses the cm-chs-patch plugin
|
||||
const joined =
|
||||
'(' +
|
||||
(getChsSegmenter() ? '' : SPACE_OR_PUNCTUATION.source) +
|
||||
(getChsSegmenter() ? '' : `^|${SPACE_OR_PUNCTUATION.source}`) +
|
||||
')' +
|
||||
'(' +
|
||||
strings.map(s => escapeRegex(s)).join('|') +
|
||||
|
||||
@@ -95,5 +95,9 @@
|
||||
"1.10.1": "1.0.0",
|
||||
"1.11.0-beta.1": "1.0.0",
|
||||
"1.11.0": "1.0.0",
|
||||
"1.11.1": "1.0.0"
|
||||
"1.11.1": "1.0.0",
|
||||
"1.12.0": "1.0.0",
|
||||
"1.12.1-beta.1": "1.0.0",
|
||||
"1.12.1": "1.0.0",
|
||||
"1.12.2": "1.0.0"
|
||||
}
|
||||
Reference in New Issue
Block a user