mirror of
https://github.com/pipipi-pikachu/PPTist.git
synced 2025-04-15 02:20:00 +08:00
Merge branch 'kankanol1-pageUpAndPageDown'
This commit is contained in:
commit
12f56370b4
@ -22,6 +22,8 @@ export const enum KEYS {
|
|||||||
TAB = 'TAB',
|
TAB = 'TAB',
|
||||||
BACKSPACE = 'BACKSPACE',
|
BACKSPACE = 'BACKSPACE',
|
||||||
ESC = 'ESCAPE',
|
ESC = 'ESCAPE',
|
||||||
|
PAGEUP = 'PAGEUP',
|
||||||
|
PAGEDOWN = 'PAGEDOWN',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const HOTKEY_DOC = [
|
export const HOTKEY_DOC = [
|
||||||
@ -43,8 +45,9 @@ export const HOTKEY_DOC = [
|
|||||||
type: '幻灯片放映',
|
type: '幻灯片放映',
|
||||||
children: [
|
children: [
|
||||||
{ label: '开始放映幻灯片', value: 'Ctrl + F' },
|
{ label: '开始放映幻灯片', value: 'Ctrl + F' },
|
||||||
{ label: '切换上一页', value: '↑ / ←' },
|
{ label: '切换上一页', value: '↑ / ← / PgUp' },
|
||||||
{ label: '切换下一页', value: '↓ / → / Enter / Space' },
|
{ label: '切换下一页', value: '↓ / → / PgDown' },
|
||||||
|
{ label: '切换下一页', value: 'Enter / Space' },
|
||||||
{ label: '退出放映', value: 'ESC' },
|
{ label: '退出放映', value: 'ESC' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -57,8 +60,10 @@ export const HOTKEY_DOC = [
|
|||||||
{ label: '放大画布', value: 'Ctrl + =' },
|
{ label: '放大画布', value: 'Ctrl + =' },
|
||||||
{ label: '缩小画布', value: 'Ctrl + -' },
|
{ label: '缩小画布', value: 'Ctrl + -' },
|
||||||
{ label: '使画布适应当前屏幕', value: 'Ctrl + 0' },
|
{ label: '使画布适应当前屏幕', value: 'Ctrl + 0' },
|
||||||
{ label: '编辑上一页', value: '↑ / ← / 鼠标上滚' },
|
{ label: '上一页(未选中元素)', value: '↑ / ←' },
|
||||||
{ label: '编辑下一页', value: '↓ / → / 鼠标下滚' },
|
{ label: '下一页(未选中元素)', value: '↓ / →' },
|
||||||
|
{ label: '上一页', value: '鼠标上滚 / PgUp' },
|
||||||
|
{ label: '下一页', value: '鼠标下滚 / PgDown' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -95,6 +95,11 @@ export default () => {
|
|||||||
else if (key === KEYS.UP || key === KEYS.DOWN) updateSlideIndex(key)
|
else if (key === KEYS.UP || key === KEYS.DOWN) updateSlideIndex(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const moveSlide = (key: string) => {
|
||||||
|
if (key === KEYS.PAGEUP) updateSlideIndex(KEYS.UP)
|
||||||
|
else if (key === KEYS.PAGEDOWN) updateSlideIndex(KEYS.DOWN)
|
||||||
|
}
|
||||||
|
|
||||||
const order = (command: ElementOrderCommands) => {
|
const order = (command: ElementOrderCommands) => {
|
||||||
if (!handleElement.value) return
|
if (!handleElement.value) return
|
||||||
orderElement(handleElement.value, command)
|
orderElement(handleElement.value, command)
|
||||||
@ -217,6 +222,16 @@ export default () => {
|
|||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
move(KEYS.RIGHT)
|
move(KEYS.RIGHT)
|
||||||
}
|
}
|
||||||
|
if (key === KEYS.PAGEUP) {
|
||||||
|
if (disableHotkeys.value) return
|
||||||
|
e.preventDefault()
|
||||||
|
moveSlide(KEYS.PAGEUP)
|
||||||
|
}
|
||||||
|
if (key === KEYS.PAGEDOWN) {
|
||||||
|
if (disableHotkeys.value) return
|
||||||
|
e.preventDefault()
|
||||||
|
moveSlide(KEYS.PAGEDOWN)
|
||||||
|
}
|
||||||
if (key === KEYS.ENTER) {
|
if (key === KEYS.ENTER) {
|
||||||
if (disableHotkeys.value) return
|
if (disableHotkeys.value) return
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
@ -14,7 +14,7 @@ import useHistorySnapshot from '@/hooks/useHistorySnapshot'
|
|||||||
export default () => {
|
export default () => {
|
||||||
const mainStore = useMainStore()
|
const mainStore = useMainStore()
|
||||||
const slidesStore = useSlidesStore()
|
const slidesStore = useSlidesStore()
|
||||||
const { selectedSlidesIndex: _selectedSlidesIndex } = storeToRefs(mainStore)
|
const { selectedSlidesIndex: _selectedSlidesIndex, activeElementIdList } = storeToRefs(mainStore)
|
||||||
const { currentSlide, slides, theme, slideIndex } = storeToRefs(slidesStore)
|
const { currentSlide, slides, theme, slideIndex } = storeToRefs(slidesStore)
|
||||||
|
|
||||||
const selectedSlidesIndex = computed(() => [..._selectedSlidesIndex.value, slideIndex.value])
|
const selectedSlidesIndex = computed(() => [..._selectedSlidesIndex.value, slideIndex.value])
|
||||||
@ -45,9 +45,11 @@ export default () => {
|
|||||||
*/
|
*/
|
||||||
const updateSlideIndex = (command: string) => {
|
const updateSlideIndex = (command: string) => {
|
||||||
if (command === KEYS.UP && slideIndex.value > 0) {
|
if (command === KEYS.UP && slideIndex.value > 0) {
|
||||||
|
if (activeElementIdList.value.length) mainStore.setActiveElementIdList([])
|
||||||
slidesStore.updateSlideIndex(slideIndex.value - 1)
|
slidesStore.updateSlideIndex(slideIndex.value - 1)
|
||||||
}
|
}
|
||||||
else if (command === KEYS.DOWN && slideIndex.value < slides.value.length - 1) {
|
else if (command === KEYS.DOWN && slideIndex.value < slides.value.length - 1) {
|
||||||
|
if (activeElementIdList.value.length) mainStore.setActiveElementIdList([])
|
||||||
slidesStore.updateSlideIndex(slideIndex.value + 1)
|
slidesStore.updateSlideIndex(slideIndex.value + 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,12 +182,13 @@ export default () => {
|
|||||||
const keydownListener = (e: KeyboardEvent) => {
|
const keydownListener = (e: KeyboardEvent) => {
|
||||||
const key = e.key.toUpperCase()
|
const key = e.key.toUpperCase()
|
||||||
|
|
||||||
if (key === KEYS.UP || key === KEYS.LEFT) execPrev()
|
if (key === KEYS.UP || key === KEYS.LEFT || key === KEYS.PAGEUP) execPrev()
|
||||||
else if (
|
else if (
|
||||||
key === KEYS.DOWN ||
|
key === KEYS.DOWN ||
|
||||||
key === KEYS.RIGHT ||
|
key === KEYS.RIGHT ||
|
||||||
key === KEYS.SPACE ||
|
key === KEYS.SPACE ||
|
||||||
key === KEYS.ENTER
|
key === KEYS.ENTER ||
|
||||||
|
key === KEYS.PAGEDOWN
|
||||||
) execNext()
|
) execNext()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user