Simon-Initiative / oli-torus

Next Generation OLI Authoring and Delivery Platform
https://proton.oli.cmu.edu
MIT License
83 stars 35 forks source link

[BUG FIX] [MER-3146] Advanced Author and Simple Author/Flowchart: Keyboard Shortcuts Request on Canvas #4865

Closed dtiwarATS closed 2 months ago

dtiwarATS commented 3 months ago

Hey @bsparks please look at the PR. Thanks

There was a request to handle some shortcuts specific to Mac and Windows:

  1. On Mac,cmd+y works but it also opens chrome history, so it makes it unusable, can we remove this keyboard control for Mac?
  2. Implement cmd+shift+z is the “traditional” redo on Mac
bsparks commented 3 months ago

hmm perhaps it's time to add some user agent sniffing to check if it is macOS and do the config that way. https://github.com/quentin-sommer/react-useragent is something, I haven't looked at it for more than 10 seconds FYI :D maybe adding to the configuration of the keys an optional OS to allow it on so that each can do it in the way that fits

dtiwarATS commented 3 months ago

Hey @bsparks , I looked at the user agent. It is good library to handle the rendering of components based on OS and maybe we can pass the OS info and then do customization in the generic useKeyDown hook but again it has many OS (Windows, Mac, tablet, Linux etc.). The library is good and now I know that there is something out there that can help in OS specific stuff :)

In our case here, we have very limited shortcuts and they most are working with generic code. It was just the one short cut based on Mac that needed some extra handling. I think as far as this PR goes; I think we can continue with the same code instead of adding the user agent for handling the shortcuts.

Please let me know your thoughts. BDW - Code freeze is also approaching for v0.28.