Skip to content

Commit 0e3452c

Browse files
committed
add hotkeys handling regardless keyboard layout
1 parent 1a8cdb5 commit 0e3452c

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
# Obsidian Scroll Editor Plugin
22

3-
This plugin adds scroll commands for Obsidian editor.
3+
This plugin adds scroll commands for the Obsidian editor.
44

5-
The plugin adds `scroll-up` and `scroll-down` commands to the editor. Assign hotkeys to this commands to
5+
The plugin adds `scroll-up` and `scroll-down` commands to the editor. Assign hotkeys to these commands to
66
scroll the editor view.
77

88
![Editor Scroll Commands](media/editor-scroll-commands.png "Editor Scroll Commands")
99

1010
The commands itself do nothing, so use the hotkeys to scroll the editor.
1111

12+
![Editor Scroll Commands Hotkeys](media/editor-scroll-commands-hotkeys.png "Editor Scroll Commands Hotkeys")
13+
1214
The settings allow you to change the scroll offset and the interval.
1315

1416
![Editor Scroll Commands Settings](media/editor-scroll-commands-settings.png "Editor Scroll Commands Settings")
1517

16-
## How to use
18+
## Development
1719

1820
- Clone this repo.
1921
- Make sure your NodeJS is at least v16 (`node --version`).
@@ -22,5 +24,6 @@ The settings allow you to change the scroll offset and the interval.
2224

2325
## Manually installing the plugin
2426

25-
- Copy over `main.js`, `manifest.json` to your vault `VaultFolder/.obsidian/plugins/your-plugin-id/`.
27+
- Copy over `main.js`, `manifest.json` to your vault `VaultFolder/.obsidian/plugins/obsidian-editor-scroll-commands/`.
2628

29+
See ![latest release](https://github.com/PhoSor/obsidian-editor-scroll-commands/releases/latest) in **Releases** section.

main.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ export default class EditorScrollCommandsPlugin extends Plugin {
6161

6262
isScrollHotkeyEvent(event: KeyboardEvent, hotkeys: Hotkey[]) {
6363
return hotkeys.some((hotkey: Hotkey) => {
64-
let keyMatched = (hotkey.key.toUpperCase() == event.key.toUpperCase()
65-
? true : false);
64+
let keyMatched =
65+
(hotkey.key == event.code) ||
66+
('Key' + hotkey.key == event.code);
6667

6768
let allModsMatched = hotkey.modifiers.every(m => {
6869
let propName = ModToEventProp[m];
20.6 KB
Loading

0 commit comments

Comments
 (0)