|
|
@ -6,6 +6,7 @@ import {
|
|
|
|
onKeyStroke,
|
|
|
|
onKeyStroke,
|
|
|
|
useEventListener,
|
|
|
|
useEventListener,
|
|
|
|
useLocalStorage,
|
|
|
|
useLocalStorage,
|
|
|
|
|
|
|
|
useScrollLock,
|
|
|
|
useSessionStorage
|
|
|
|
useSessionStorage
|
|
|
|
} from '@vueuse/core'
|
|
|
|
} from '@vueuse/core'
|
|
|
|
import Mark from 'mark.js'
|
|
|
|
import Mark from 'mark.js'
|
|
|
@ -16,6 +17,7 @@ import {
|
|
|
|
createApp,
|
|
|
|
createApp,
|
|
|
|
markRaw,
|
|
|
|
markRaw,
|
|
|
|
nextTick,
|
|
|
|
nextTick,
|
|
|
|
|
|
|
|
onBeforeUnmount,
|
|
|
|
onMounted,
|
|
|
|
onMounted,
|
|
|
|
ref,
|
|
|
|
ref,
|
|
|
|
shallowRef,
|
|
|
|
shallowRef,
|
|
|
@ -36,8 +38,9 @@ const emit = defineEmits<{
|
|
|
|
(e: 'close'): void
|
|
|
|
(e: 'close'): void
|
|
|
|
}>()
|
|
|
|
}>()
|
|
|
|
|
|
|
|
|
|
|
|
const el = shallowRef<HTMLDivElement>()
|
|
|
|
const el = shallowRef<HTMLElement>()
|
|
|
|
const resultsEl = shallowRef<HTMLDivElement>()
|
|
|
|
const resultsEl = shallowRef<HTMLElement>()
|
|
|
|
|
|
|
|
const body = shallowRef<HTMLElement>()
|
|
|
|
|
|
|
|
|
|
|
|
/* Search */
|
|
|
|
/* Search */
|
|
|
|
|
|
|
|
|
|
|
@ -312,6 +315,20 @@ useEventListener('popstate', (event) => {
|
|
|
|
emit('close')
|
|
|
|
emit('close')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Lock body */
|
|
|
|
|
|
|
|
const isLocked = useScrollLock(body)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
|
|
|
body.value = document.body
|
|
|
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
|
|
|
isLocked.value = true
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onBeforeUnmount(() => {
|
|
|
|
|
|
|
|
isLocked.value = false
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
function formMarkRegex(terms: Set<string>) {
|
|
|
|
function formMarkRegex(terms: Set<string>) {
|
|
|
|
return new RegExp(
|
|
|
|
return new RegExp(
|
|
|
|
[...terms]
|
|
|
|
[...terms]
|
|
|
|