We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e06e916 commit 791f45aCopy full SHA for 791f45a
src/nodes/SearchTerm.svelte
@@ -3,10 +3,10 @@
3
4
export let text
5
6
- $: i = text.indexOf($searchValue)
7
- $: pre = text.substring(0, i)
8
- $: highlight = text.substring(i, i + $searchValue.length)
9
- $: post = text.substring(i + $searchValue.length)
+ $: i = text ? text.indexOf($searchValue) : -1
+ $: pre = text ? text.substring(0, i) : ''
+ $: highlight = text ? text.substring(i, i + $searchValue.length) : ''
+ $: post = text ? text.substring(i + $searchValue.length) : ''
10
</script>
11
12
<style>
0 commit comments