Skip to content

Commit

Permalink
fix: prevent default browser behavior for tab and shift+tab when ther…
Browse files Browse the repository at this point in the history
…e is no indent or unindent happening (athensresearch#209)

Co-authored-by: Adrien Lacquemant <github@alaq.io>
Co-authored-by: nthd3gr33 <codinginenglish@gmail.com>
  • Loading branch information
3 people committed Jul 8, 2020
1 parent 4f193e6 commit 0aef1d6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/cljs/athens/views/blocks.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,10 @@
(and (= key KeyCodes.DOWN) bottom-row?) (dispatch [:down uid])
(and (= key KeyCodes.RIGHT) block-end?) (dispatch [:right uid])

(and (= key KeyCodes.TAB) shift) (dispatch [:unindent uid])
(= key KeyCodes.TAB) (dispatch [:indent uid])
(and (= key KeyCodes.TAB) shift) (do (.preventDefault e)
(dispatch [:unindent uid]))
(= key KeyCodes.TAB) (do (.preventDefault e)
(dispatch [:indent uid]))
(= key KeyCodes.ENTER) (do (.preventDefault e)
(dispatch [:enter uid value index state]))
(and (= key KeyCodes.BACKSPACE) block-start?) (dispatch [:backspace uid value]))))
Expand Down

0 comments on commit 0aef1d6

Please sign in to comment.