diff --git a/src/hooks/useGlobalHotkey.ts b/src/hooks/useGlobalHotkey.ts index d667fb6b..63d6c31b 100644 --- a/src/hooks/useGlobalHotkey.ts +++ b/src/hooks/useGlobalHotkey.ts @@ -35,6 +35,7 @@ export default () => { deleteSlide, cutSlide, copyAndPasteSlide, + selectAllSlide, } = useSlideHandler() const { combineElements, uncombineElements } = useCombineElement() @@ -64,8 +65,8 @@ export default () => { } const selectAll = () => { - if (!editorAreaFocus.value) return - selectAllElement() + if (editorAreaFocus.value) selectAllElement() + if (thumbnailsFocus.value) selectAllSlide() } const lock = () => { diff --git a/src/hooks/useSlideHandler.ts b/src/hooks/useSlideHandler.ts index b95c06c0..7c8e6421 100644 --- a/src/hooks/useSlideHandler.ts +++ b/src/hooks/useSlideHandler.ts @@ -108,6 +108,13 @@ export default () => { deleteSlide(targetSlidesId) } + // 选中全部幻灯片 + const selectAllSlide = () => { + const newSelectedSlidesIndex = Array.from(Array(slides.value.length), (item, index) => index) + store.commit(MutationTypes.SET_ACTIVE_ELEMENT_ID_LIST, []) + store.commit(MutationTypes.UPDATE_SELECTED_SLIDES_INDEX, newSelectedSlidesIndex) + } + return { resetSlides, updateSlideIndex, @@ -117,5 +124,6 @@ export default () => { copyAndPasteSlide, deleteSlide, cutSlide, + selectAllSlide, } } \ No newline at end of file diff --git a/src/views/Editor/Thumbnails/index.vue b/src/views/Editor/Thumbnails/index.vue index ae4c2722..16a87337 100644 --- a/src/views/Editor/Thumbnails/index.vue +++ b/src/views/Editor/Thumbnails/index.vue @@ -65,6 +65,7 @@ export default defineComponent({ copyAndPasteSlide, deleteSlide, cutSlide, + selectAllSlide, } = useSlideHandler() // 切换页面 @@ -156,6 +157,11 @@ export default defineComponent({ subText: 'Ctrl + V', handler: pasteSlide, }, + { + text: '全选', + subText: 'Ctrl + A', + handler: selectAllSlide, + }, { text: '新建页面', subText: 'Enter', @@ -186,6 +192,11 @@ export default defineComponent({ subText: 'Ctrl + V', handler: pasteSlide, }, + { + text: '全选', + subText: 'Ctrl + A', + handler: selectAllSlide, + }, { divider: true }, { text: '新建页面',