Replies: 3 comments 14 replies
-
Noticed there's an glide-data-grid/packages/core/src/data-editor/data-editor.tsx Lines 2327 to 2381 in 0e62b1c That could be replaced by
|
Beta Was this translation helpful? Give feedback.
-
The imperative commands are there for you to handle these yourself if you want. Are they not good enough for that? |
Beta Was this translation helpful? Give feedback.
-
Hi @BrianHung, did you manage to implement these shortcuts? |
Beta Was this translation helpful? Give feedback.
-
For the app I'm integrating
glide-data-grid
into, we need some custom keyboard shortcutsImplementing either would involve overwriting default behavior (although tab behavior is not documented in keybindings), and essentially having
glide-data-grid
support custom keyboard shortcuts.Two ideas I want to propose:
onKeyDown
prop that takes priority over keybindings indata-editor
keybindings
intokeymap
andcommands
For the first idea, the current
onKeyDown
looks likeglide-data-grid/packages/core/src/data-editor/data-editor.tsx
Lines 1713 to 1718 in 0e62b1c
where
keybindings
are checked and ran.To support a
onKeyDown
prop, we can haveThe second idea is a bit more work and is inspired by how ProseMirror, a text editor framework, allows for developers to implement custom keyboard behavior:
https://prosemirror.net/docs/ref/#keymap
https://prosemirror.net/docs/ref/#commands
It essentially splits the concept of keyboard shortcuts into two concepts:
fillDown
anddeleteRange
"Mod+ArrowDown": fillDown
The benefit of this over the current
keybindings
prop is customizability and re-usability. For example,and
Note that the second idea is not exclusive with the first one: the first one would be prioritized over keymaps and commands as ProseMirror does: https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyDown.
Beta Was this translation helpful? Give feedback.
All reactions