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