shortcut to move to description

practiced-songs
Matthew Huntington 10 months ago
parent aa10ef8176
commit bfc4e0c29f

@ -6,6 +6,8 @@
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const descriptionInput = ref(null)
onMounted(()=>{ onMounted(()=>{
window.addEventListener('keydown', (event)=>{ window.addEventListener('keydown', (event)=>{
if(event.key === 'ArrowDown'){ if(event.key === 'ArrowDown'){
@ -15,8 +17,12 @@
event.preventDefault() event.preventDefault()
proxy.stop() proxy.stop()
} }
if(event.key === 'Enter' && event.metaKey === true){ if(event.ctrlKey === true){
proxy.submit(event) if(event.key === 'Enter'){
proxy.submit(event)
} else if(event.key === 'd') {
descriptionInput.value.focus()
}
} }
}) })
}) })
@ -26,7 +32,12 @@
import CategoryChooser from './category_chooser.vue' import CategoryChooser from './category_chooser.vue'
import { getHours, getMinutes, createTimeObj, getAccumulatedSeconds, formatSeconds } from '../libs/time.js' import { getHours, getMinutes, createTimeObj, getAccumulatedSeconds, formatSeconds } from '../libs/time.js'
import { copiedSongs, currentWorkingCategory, currentWorkingInstrument, description } from '../libs/state.js' import {
copiedSongs,
currentWorkingCategory,
currentWorkingInstrument,
description
} from '../libs/state.js'
const removeSong = (song) => { const removeSong = (song) => {
copiedSongs.value = copiedSongs.value.filter(curr => curr !== song) copiedSongs.value = copiedSongs.value.filter(curr => curr !== song)
@ -217,7 +228,7 @@
</div> </div>
<form @submit="submit"> <form @submit="submit">
<label>Description</label> <label>Description</label>
<input v-model="description" type="text" maxlength="128"/> <input v-model="description" ref="descriptionInput" type="text" maxlength="128"/>
<ul v-if="copiedSongs.length > 0"> <ul v-if="copiedSongs.length > 0">
<li @click="removeSong(song)" v-for="song in copiedSongs">{{song}}</li> <li @click="removeSong(song)" v-for="song in copiedSongs">{{song}}</li>

Loading…
Cancel
Save