Idea for making keydownHandler reusable outside ProseMirror #5

Closed
ccorcos wants to merge 1 commit from master into master
ccorcos commented 2021-02-05 22:45:05 +01:00 (Migrated from github.com)

Hey there, since I'm using ProseMirror heavily in my application, I figured it makes sense to use the same keyboard shortcut handling in the rest of my application (navigating menus and stuff outside of ProseMirror).

I was hoping this would end up with a cleaner abstraction (its a little gross having to call callBindingsWithView every time), but maybe you might think of better way to do it so I can reuse this logic elsewhere.

Cheers,

Chet

Hey there, since I'm using ProseMirror heavily in my application, I figured it makes sense to use the same keyboard shortcut handling in the rest of my application (navigating menus and stuff outside of ProseMirror). I was hoping this would end up with a cleaner abstraction (its a little gross having to call `callBindingsWithView` every time), but maybe you might think of better way to do it so I can reuse this logic elsewhere. Cheers, Chet
marijnh commented 2021-02-08 12:03:16 +01:00 (Migrated from github.com)

Sorry, but I don't think this is a good idea. It's going to copy, bind, and normalize all handlers on every key press. We could have set up the abstractions differently to allow this more elegantly, but at this point I think just duplicating the logic you need in your own code is the more reasonable approach.

Sorry, but I don't think this is a good idea. It's going to copy, bind, and normalize all handlers on every key press. We could have set up the abstractions differently to allow this more elegantly, but at this point I think just duplicating the logic you need in your own code is the more reasonable approach.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
prosemirror/prosemirror-keymap!5
No description provided.