diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2024-09-24 10:29:54 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2024-09-24 12:17:22 +0800 |
commit | 8d161bfb1f014a3184ab7111f7cd39b3c253f552 (patch) | |
tree | 42f6dadd251fb80bfc32571a1dc4276fc9a4b079 /src/editor.mjs | |
parent | c7ac371639e223282efff546c198428f736232f0 (diff) |
feat: add focusNextBlock util
Diffstat (limited to 'src/editor.mjs')
-rw-r--r-- | src/editor.mjs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/editor.mjs b/src/editor.mjs index 550f626..f4fadb4 100644 --- a/src/editor.mjs +++ b/src/editor.mjs | |||
@@ -552,15 +552,24 @@ document.onkeydown = (e) => { | |||
552 | return null | 552 | return null |
553 | } | 553 | } |
554 | if (!cm.hasFocus()) { | 554 | if (!cm.hasFocus()) { |
555 | e.preventDefault() | ||
556 | if (!dumbymap) return | 555 | if (!dumbymap) return |
557 | 556 | ||
558 | if (e.key === 'Tab') { | 557 | if (e.key === 'Tab') { |
558 | e.preventDefault() | ||
559 | dumbymap.utils.focusNextMap(e.shiftKey) | 559 | dumbymap.utils.focusNextMap(e.shiftKey) |
560 | } | 560 | } |
561 | if (e.key === 'x') { | 561 | if (e.key === 'x') { |
562 | e.preventDefault() | ||
562 | dumbymap.utils.switchToNextLayout() | 563 | dumbymap.utils.switchToNextLayout() |
563 | } | 564 | } |
565 | if (e.key === 'n') { | ||
566 | e.preventDefault() | ||
567 | dumbymap.utils.focusNextBlock() | ||
568 | } | ||
569 | if (e.key === 'p') { | ||
570 | e.preventDefault() | ||
571 | dumbymap.utils.focusNextBlock(true) | ||
572 | } | ||
564 | } | 573 | } |
565 | } | 574 | } |
566 | 575 | ||