wierkstudio / ciphereditor

Web app for cryptography, coding and data encouraging beginners and pros alike to explore new operations and build own workflows.
https://ciphereditor.com
MIT License
115 stars 22 forks source link

Improved keybindings #9

Closed robigan closed 2 years ago

robigan commented 2 years ago

Adds Ctrl+y keybinding for redo actions, mainly because Windows and the Cinnamon DE (A Linux Desktop Environment aimed at being similar to Windows) use Ctrl+y.

Also adds the Meta+k/Ctrl+k action, inspired from Discord, GitHub and Algolia search to bring up the Add modal.

Next to do is check the platform being run on and disabled/enable certain shortcuts depending on the platform or otherwise there will be conflicting functionality.

vercel[bot] commented 2 years ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
ciphereditor ✅ Ready (Inspect) Visit Preview Sep 1, 2022 at 9:01AM (UTC)
ffraenz commented 2 years ago

@robigan I just checked the preview for this PR. When I press Cmd+K in Firefox for macOS, it focusses the address bar instead of the add modal. Are we missing an event.preventDefault() somewhere down the line? 🤔

robigan commented 2 years ago

@robigan I just checked the preview for this PR. When I press Cmd+K in Firefox for macOS, it focusses the address bar instead of the add modal. Are we missing an event.preventDefault() somewhere down the line? 🤔

Ok so this is the issue, I want to implement a platform checker (as I wrote in the PR description) so that the code isn't preventing default behaviors for other platforms that the shortcut doesn't run on. That is the exact reason why I PRing into the dev branch

ffraenz commented 2 years ago

I see your point. Platform detection is not a trivial thing as we can no longer rely on user agent strings. To finalize this PR, though, I would call preventDefault() for all recognized shortcuts (on all platforms) for now and later improve from here. You may even add a // TODO: comment mentioning this next to the call.