Skip to content

Commit

Permalink
Merge branch '8_add-hotkeys'
Browse files Browse the repository at this point in the history
  • Loading branch information
isosphere committed Jul 9, 2024
2 parents 5d0147f + 43b1230 commit 50eada0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "logseq-journals-nextprev",
"description": "Provides buttons to jump to the next or previous journal entry",
"version": "1.2.0",
"version": "1.3.0",
"main": "dist/index.html",
"author": "Matthew Scheffel",
"scripts": {
Expand Down
33 changes: 32 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ import App from './App.vue'
import './index.css'

/** settings **/
const settingsSchema = [
{
key: 'hotkey_next',
type: 'string',
title: 'Shortcut: Next Journal',
description: 'A hotkey to go to the next journal that exists, chronologically.',
default: "ctrl+right",
},
{
key: 'hotkey_prev',
type: 'string',
title: 'Shortcut: Previous Journal',
description: 'A hotkey to go to the previous journal that exists, chronologically.',
default: "ctrl+left",
},
]

let app = null

/**
Expand Down Expand Up @@ -62,9 +79,23 @@ function main () {
}
`)

if (logseq.settings.hotkey_next) {
logseq.App.registerCommandShortcut({
binding: logseq.settings.hotkey_next,
}, () => { model.nextDay(null) }
)
}

if (logseq.settings.hotkey_prev) {
logseq.App.registerCommandShortcut({
binding: logseq.settings.hotkey_prev,
}, () => { model.prevDay(null) }
)
}

// main UI
app = createApp(App).mount('#app')
}

// bootstrap
logseq.ready(main).catch(null)
logseq.useSettingsSchema(settingsSchema).ready(main).catch(null)

0 comments on commit 50eada0

Please sign in to comment.