Fixed #236 - missing space with highlighted words (#239)

This commit is contained in:
Simon Cambier
2023-05-09 21:50:51 +02:00
committed by GitHub
parent 362df5360b
commit 8b7cd2d3e3
2 changed files with 4 additions and 3 deletions

View File

@@ -71,8 +71,9 @@
<span class="omnisearch-result__title"> <span class="omnisearch-result__title">
<span bind:this="{elFilePathIcon}"></span> <span bind:this="{elFilePathIcon}"></span>
<span>{@html title.replace(reg, highlighterGroups)}</span> <span>{@html title.replace(reg, highlighterGroups)}</span>
<span class="omnisearch-result__extension" <span class="omnisearch-result__extension">
>.{getExtension(note.path)}</span> .{getExtension(note.path)}
</span>
<!-- Counter --> <!-- Counter -->
{#if note.matches.length > 0} {#if note.matches.length > 0}

View File

@@ -33,7 +33,7 @@ export function highlighterGroups(...args: any[]) {
args[2] !== null && args[2] !== null &&
args[2] !== undefined args[2] !== undefined
) )
return `${args[1]}<span class="${highlightClass}">${args[2]}</span>` return `<span>${args[1]}</span><span class="${highlightClass} b">${args[2]}</span>`
return '&lt;no content&gt;' return '&lt;no content&gt;'
} }