mirror of
https://github.com/kevin-DL/build-gmail-clone-with-vue-3.git
synced 2026-01-11 18:54:31 +00:00
keyboard shortcuts for 'archived, then next/previous'
This commit is contained in:
@@ -41,13 +41,17 @@
|
||||
|
||||
let openEmail = function(email) {
|
||||
openedEmail.value = email;
|
||||
|
||||
if(email) {
|
||||
openedEmail.value.read = true;
|
||||
}
|
||||
}
|
||||
|
||||
let changeEmail = function({amount}){
|
||||
let changeEmail = function({amount, archive}){
|
||||
let index = emails.findIndex(e => e == openedEmail.value);
|
||||
|
||||
if(archive) { emails[index].archived = true }
|
||||
|
||||
openEmail(emails[index + amount])
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
setup({email}, {emit}) {
|
||||
useKeydown([
|
||||
{key: 'k', fn: () => emit('changeEmail', {amount: -1})},
|
||||
{key: 'j', fn: () => emit('changeEmail', {amount: 1})}
|
||||
{key: 'j', fn: () => emit('changeEmail', {amount: 1})},
|
||||
{key: '[', fn: () => emit('changeEmail', {amount: -1, archive: true})},
|
||||
{key: ']', fn: () => emit('changeEmail', {amount: 1, archive: true})},
|
||||
])
|
||||
|
||||
let emailMarkdown = marked(email.body);
|
||||
|
||||
Reference in New Issue
Block a user