perf: 搜索/替换体验优化

This commit is contained in:
pipipi-pikachu 2023-09-10 12:31:28 +08:00
parent 8d34751196
commit df8e43bdc1
2 changed files with 8 additions and 2 deletions

View File

@ -26,6 +26,7 @@ export default () => {
handleElementId,
editorAreaFocus,
thumbnailsFocus,
showSearchPanel,
} = storeToRefs(mainStore)
const { currentSlide } = storeToRefs(useSlidesStore())
const { ctrlKeyState, shiftKeyState, spaceKeyState } = storeToRefs(keyboardStore)
@ -153,7 +154,7 @@ export default () => {
}
if (key === KEYS.F) {
e.preventDefault()
mainStore.setSearchPanelState(true)
mainStore.setSearchPanelState(!showSearchPanel.value)
return
}

View File

@ -37,7 +37,7 @@
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import { onMounted, ref } from 'vue'
import { useMainStore } from '@/store'
import useSearch from '@/hooks/useSearch'
import MoveablePanel from '@/components/MoveablePanel.vue'
@ -75,6 +75,11 @@ const tabs: TabItem[] = [
const close = () => {
mainStore.setSearchPanelState(false)
}
const searchInpRef = ref<HTMLInputElement>()
onMounted(() => {
searchInpRef.value!.focus()
})
</script>
<style lang="scss" scoped>