为播放详情页歌词选择界面添加全选快捷键支持
parent
f40f019d2e
commit
98b4abfa19
|
@ -25,7 +25,7 @@
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
<transition enter-active-class="animated fadeIn" leave-active-class="animated fadeOut">
|
<transition enter-active-class="animated fadeIn" leave-active-class="animated fadeOut">
|
||||||
<div v-if="isShowLrcSelectContent" :class="[$style.lyricSelectContent, 'select', 'scroll', 'lyricSelectContent']" @contextmenu="handleCopySelectText">
|
<div v-if="isShowLrcSelectContent" ref="dom_lrc_select_content" tabindex="-1" :class="[$style.lyricSelectContent, 'select', 'scroll', 'lyricSelectContent']" @contextmenu="handleCopySelectText">
|
||||||
<div v-for="(info, index) in lyric.lines" :key="index" :class="[$style.lyricSelectline, { [$style.lrcActive]: lyric.line == index }]">
|
<div v-for="(info, index) in lyric.lines" :key="index" :class="[$style.lyricSelectline, { [$style.lrcActive]: lyric.line == index }]">
|
||||||
<span>{{ info.text }}</span>
|
<span>{{ info.text }}</span>
|
||||||
<template v-for="(lrc, i) in info.extendedLyrics" :key="i">
|
<template v-for="(lrc, i) in info.extendedLyrics" :key="i">
|
||||||
|
@ -59,6 +59,7 @@ import useLyric from '@renderer/utils/compositions/useLyric'
|
||||||
import LyricMenu from './components/LyricMenu.vue'
|
import LyricMenu from './components/LyricMenu.vue'
|
||||||
import { appSetting } from '@renderer/store/setting'
|
import { appSetting } from '@renderer/store/setting'
|
||||||
import { setLyricOffset } from '@renderer/core/lyric'
|
import { setLyricOffset } from '@renderer/core/lyric'
|
||||||
|
import useSelectAllLrc from './useSelectAllLrc'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
@ -83,6 +84,8 @@ export default {
|
||||||
handleScrollLrc,
|
handleScrollLrc,
|
||||||
} = useLyric({ isPlay, lyric, playProgress, isShowLyricProgressSetting })
|
} = useLyric({ isPlay, lyric, playProgress, isShowLyricProgressSetting })
|
||||||
|
|
||||||
|
const dom_lrc_select_content = useSelectAllLrc()
|
||||||
|
|
||||||
watch([isFullscreen, isShowPlayComment], () => {
|
watch([isFullscreen, isShowPlayComment], () => {
|
||||||
setTimeout(handleScrollLrc, 400)
|
setTimeout(handleScrollLrc, 400)
|
||||||
})
|
})
|
||||||
|
@ -154,6 +157,7 @@ export default {
|
||||||
dom_lyric,
|
dom_lyric,
|
||||||
dom_lyric_text,
|
dom_lyric_text,
|
||||||
dom_skip_line,
|
dom_skip_line,
|
||||||
|
dom_lrc_select_content,
|
||||||
isMsDown,
|
isMsDown,
|
||||||
timeStr,
|
timeStr,
|
||||||
handleLyricMouseDown,
|
handleLyricMouseDown,
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
import { ref, onBeforeUnmount } from '@common/utils/vueTools'
|
||||||
|
|
||||||
|
export default () => {
|
||||||
|
const dom_lrc_select_content = ref()
|
||||||
|
const handle_key_mod_a_down = ({ event }) => {
|
||||||
|
if (event.target.tagName == 'INPUT' || !dom_lrc_select_content.value || document.activeElement != dom_lrc_select_content.value) return
|
||||||
|
event.preventDefault()
|
||||||
|
if (event.repeat) return
|
||||||
|
|
||||||
|
let selection = window.getSelection()
|
||||||
|
let range = document.createRange()
|
||||||
|
range.selectNodeContents(dom_lrc_select_content.value)
|
||||||
|
selection.removeAllRanges()
|
||||||
|
selection.addRange(range)
|
||||||
|
}
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
window.key_event.off('key_mod+a_down', handle_key_mod_a_down)
|
||||||
|
})
|
||||||
|
window.key_event.on('key_mod+a_down', handle_key_mod_a_down)
|
||||||
|
|
||||||
|
return dom_lrc_select_content
|
||||||
|
}
|
Loading…
Reference in New Issue