Add tests for menuConfig to ensure no keyboard shortcuts overlap with Monaco editor shortcuts #499

Open
opened 2021-09-10 00:12:01 +02:00 by franknoirot · 1 comment
franknoirot commented 2021-09-10 00:12:01 +02:00 (Migrated from github.com)

We have implemented a solution for adding keyboard shortcuts to menu items using HotKeyJS, but have run into a possible issue where the editor package, Monaco Editor by Microsoft, has a large number of its own shortcuts that could interfere with our custom ones.

We would like to write a test that pulls either dynamically (preferred) or statically from a list of all of Monaco's command shortcuts to verify that any shortcuts defined within menuConfig are not already taken by the editor.

Issues to solve:

  1. Monaco has no clean API to gather all command shortcuts
  2. The syntax Monaco uses for defining shortcuts is different from HotKeyJS
We have implemented a solution for adding keyboard shortcuts to menu items using HotKeyJS, but have run into a possible issue where the editor package, Monaco Editor by Microsoft, has a large number of its own shortcuts that could interfere with our custom ones. We would like to write a test that pulls either dynamically (preferred) or statically from a list of all of Monaco's command shortcuts to verify that any shortcuts defined within `menuConfig` are not already taken by the editor. **Issues to solve:** 1. Monaco has no clean API to gather all command shortcuts 2. The syntax Monaco uses for defining shortcuts is different from HotKeyJS
franknoirot commented 2021-09-10 00:14:22 +02:00 (Migrated from github.com)

Previous research done:

There doesn't appear to be a great way to pull the shortcuts from Monaco programmatically, only was able to find this GH issue comment about it. There doesn't appear to be like KeybindingsRegistry.getAll() method or anything like that.

The Monaca online editor is built on top of Monaco and has this hardcoded list of shortcuts that we could pull from for a hardcoded solution. I think they'll be pretty stable so that might not be too bad? And this issue has been raised in Monaco for an easy API for swapping out keyboard shortcuts, I couldn't find a clean holistic API for keybindings at all really.

Previous research done: > There doesn't appear to be a great way to pull the shortcuts from Monaco programmatically, only was able to find this GH issue comment about it. There doesn't appear to be like KeybindingsRegistry.getAll() method or anything like that. > The Monaca online editor is built on top of Monaco and has this hardcoded list of shortcuts that we could pull from for a hardcoded solution. I think they'll be pretty stable so that might not be too bad? And this issue has been raised in Monaco for an easy API for swapping out keyboard shortcuts, I couldn't find a clean holistic API for keybindings at all really.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: h3n3/cadhub#499