perf: 优化全局快捷键禁用逻辑

This commit is contained in:
zxc 2025-03-05 20:14:54 +08:00
parent 966f336704
commit 6b74cf13c8
4 changed files with 10 additions and 5 deletions

View File

@ -16,7 +16,7 @@
1. 本项目是一个 “Web 幻灯片应用” ,而不是 “低代码平台”、“H5 编辑器”、“图片编辑器” 、“白板应用”等。
2. 本项目的目标受众是<b>有【Web 幻灯片】开发需求的开发者</b>,提供的链接只是一个演示地址,不提供任何在线服务。你不应该直接将本项目作为工具使用,也不支持开箱即用。
如果你只是需要一个服务或工具,可以选择更优秀和成熟的产品,例如:[Slidev](https://sli.dev/)、[revealjs](https://revealjs.com/) 等。
3. 本项目是基于 DOM 的渲染方案,优点是上手简单易扩展。但是相比 Canvas 渲染的方案,在复杂场景下性能会存在一定的差距,所以如果你对性能有较高的要求,本项目可能不是一个好的选择/参考方向。
3. 本项目是基于 DOM 的渲染方案,优点是上手简单易扩展。但是相比 Canvas 渲染的方案,在极端复杂场景下性能会存在一定的差距,所以如果你对性能有较高的要求,本项目可能不是一个好的选择/参考方向。
4. 这里总结了一些[常见问题](/doc/Q&A.md),第一次提 Issues 和 PR 时,务必提前阅读此文档。

View File

@ -33,7 +33,7 @@
#### 内容页
* 标题
* 2~4个内容项包括
* 内容项标题(标记类型为:列表项标题)
* 内容项标题(标记类型为:列表项标题)
* 内容项正文(标记类型为:列表项目)
* 内容项编号(标记类型为:项目编号)
* 图片(背景图、页面插图、项目插图)

View File

@ -58,6 +58,7 @@ const turnTarget = (slideId: string) => {
margin-right: 20px;
word-break: keep-all;
white-space: nowrap;
cursor: pointer;
@include ellipsis-oneline();
}

View File

@ -11,7 +11,7 @@
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
import { debounce } from 'lodash'
import { storeToRefs } from 'pinia'
import { useMainStore } from '@/store'
import { useKeyboardStore, useMainStore } from '@/store'
import type { EditorView } from 'prosemirror-view'
import { toggleMark, wrapIn, lift } from 'prosemirror-commands'
import { initProsemirrorEditor, createDocument } from '@/utils/prosemirror'
@ -45,7 +45,8 @@ const emit = defineEmits<{
}>()
const mainStore = useMainStore()
const { handleElementId, textFormatPainter, richTextAttrs } = storeToRefs(mainStore)
const { handleElementId, textFormatPainter, richTextAttrs, activeElementIdList } = storeToRefs(mainStore)
const { ctrlOrShiftKeyActive } = storeToRefs(useKeyboardStore())
const editorViewRef = ref<HTMLElement>()
let editorView: EditorView
@ -63,7 +64,10 @@ const handleInput = debounce(function(isHanldeHistory = false) {
}, 300, { trailing: true })
const handleFocus = () => {
mainStore.setDisableHotkeysState(true)
// ctrlshift
if (!ctrlOrShiftKeyActive.value || activeElementIdList.value.length <= 1) {
mainStore.setDisableHotkeysState(true)
}
emit('focus')
}