diff options
| author | Hsieh Chin Fan <pham@topo.tw> | 2024-09-24 16:40:01 +0800 |
|---|---|---|
| committer | Hsieh Chin Fan <pham@topo.tw> | 2024-09-24 16:40:01 +0800 |
| commit | 6b1211f6734c11c477e94a93e22d4153edc10be6 (patch) | |
| tree | edd134e9269ff753ae49716ff4a3a48dc601e7d3 /src | |
| parent | d9a29f863c1bbf946f481de5817488ed679206af (diff) | |
feat: use Escape and F1 to switch preview/editor
Diffstat (limited to 'src')
| -rw-r--r-- | src/editor.mjs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/editor.mjs b/src/editor.mjs index 6456293..9ff8be6 100644 --- a/src/editor.mjs +++ b/src/editor.mjs | |||
| @@ -559,9 +559,12 @@ document.onkeydown = (e) => { | |||
| 559 | e.preventDefault() | 559 | e.preventDefault() |
| 560 | return null | 560 | return null |
| 561 | } | 561 | } |
| 562 | if (!cm.hasFocus()) { | ||
| 563 | if (!dumbymap) return | ||
| 564 | 562 | ||
| 563 | if (!cm.hasFocus()) { | ||
| 564 | if (e.key === 'F1') { | ||
| 565 | e.preventDefault() | ||
| 566 | cm.focus() | ||
| 567 | } | ||
| 565 | if (e.key === 'Tab') { | 568 | if (e.key === 'Tab') { |
| 566 | e.preventDefault() | 569 | e.preventDefault() |
| 567 | dumbymap.utils.focusNextMap(e.shiftKey) | 570 | dumbymap.utils.focusNextMap(e.shiftKey) |