feat(srs): add shortcut support

This commit is contained in:
Tienson Qin
2021-07-22 01:18:47 +08:00
parent 7051667a1b
commit 0e5f601b23
4 changed files with 80 additions and 20 deletions

View File

@@ -8,10 +8,12 @@
[frontend.handler.search :as search-handler]
[frontend.handler.ui :as ui-handler]
[frontend.handler.web.nfs :as nfs-handler]
[frontend.extensions.srs.handler :as srs]
[frontend.modules.shortcut.before :as m]
[frontend.state :as state]
[frontend.util :refer [mac?]]))
;; TODO: how to extend this for plugins usage? An atom?
(def default-config
{:shortcut.handler/date-picker
{:date-picker/complete
@@ -53,6 +55,28 @@
:binding "shift+enter"
:fn ui-handler/auto-complete-shift-complete}}
:shortcut.handler/cards
{:cards/toggle-answers
{:desc "Cards: show/hide answers/clozes"
:binding "s"
:fn srs/toggle-answers}
:cards/next-card
{:desc "Cards: next card"
:binding "n"
:fn srs/next-card}
:cards/forgotten
{:desc "Cards: forgotten"
:binding "f"
:fn srs/forgotten}
:cards/remembered
{:desc "Cards: remembered"
:binding "r"
:fn srs/remembered}
:cards/recall
{:desc "Cards: take a while to recall"
:binding "t"
:fn srs/recall}}
:shortcut.handler/block-editing-only
^{:before m/enable-when-editing-mode!}
{:editor/escape-editing