Merge remote-tracking branch 'origin/master' into refactor/common.css

pull/934/head
charlie 2020-12-16 12:00:03 +08:00
commit 75e496856f
3 changed files with 20 additions and 5 deletions

View File

@ -491,8 +491,13 @@
(fn [e key-code]
(let [key (gobj/get e "key")
value (gobj/get input "value")
ctrlKey (gobj/get e "ctrlKey")
metaKey (gobj/get e "metaKey")
pos (:pos (util/get-caret-pos input))]
(cond
(or ctrlKey metaKey)
nil
(or
(and (= key "#")
(and

View File

@ -1180,8 +1180,15 @@
(string/join "\n"))
:markdown
(str (subs content 0 (string/last-index-of content "---\n\n"))
"---\n\n")
(let [[m leading-spaces first-dashes] (re-find #"(\s*)(---\n)" content)]
(if m
(let [begin (count leading-spaces)
begin-inner (+ begin (count first-dashes))
second-dashes "\n---\n"
end-inner (string/index-of content second-dashes begin-inner)
end (if end-inner (+ end-inner (count second-dashes)) begin)]
(subs content begin end))
""))
content))))

View File

@ -72,8 +72,7 @@
"ctrl+h" editor-handler/highlight-format!
"ctrl+shift+a" editor-handler/select-all-blocks!
"alt+shift+up" (fn [state e] (editor-handler/move-up-down e true))
"alt+shift+down" (fn [state e] (editor-handler/move-up-down e false))
"ctrl+c ctrl+s" (fn [state e] (search-handler/rebuild-indices!))}
"alt+shift+down" (fn [state e] (editor-handler/move-up-down e false))}
(medley/map-keys util/->system-modifier)))
(defonce chords
@ -83,7 +82,11 @@
"t r" ui-handler/toggle-right-sidebar!
"t e" state/toggle-new-block-shortcut!
"s" route-handler/toggle-between-page-and-file!
})
"ctrl+c ctrl+s" (fn [state e]
(search-handler/rebuild-indices!)
;; return false to prevent default browser behavior
;; and stop event from bubbling
false)})
(defonce bind! (gobj/get mousetrap "bind"))