Support Command shortcuts in Crumble on macOS#1065
Open
GautamNambiar wants to merge 12 commits into
Open
Conversation
Updated keyboard shortcuts to support the use of macOS command key to substitute for all instances of the control key.
mac users can use command key instead of control key. For Windows keyboard users, since the meta key is the Windows key, this means that the control key can be replaced by the Windows key. (This is a harmless side effect.)
cmd can be used instead of ctrl
Fixing issues with keydown when pressing cmd
Author
|
The main issue that prompted me to make this fix was that ctrl+click on mac usually leads to the equivalent of a right click in Windows. So I had found difficulty with group-selecting two sets of qubits (as a symmetric difference). The PR fixes it. |
| * @param {!boolean} preview | ||
| */ | ||
| function pasteTextFromClipboardEvent(text, preview) { | ||
| let pastedCircuit = Circuit.fromStimCircuit(text); |
Contributor
There was a problem hiding this comment.
This is very similar to pasteFromClipboard. This code should be written once.
Contributor
|
Description says that Cmd+V behaviour was unchanged, but the code does have it in scope. |
| */ | ||
| function handleKeyboardEvent(ev) { | ||
| async function handleKeyboardEvent(ev) { | ||
| if (ev.type === 'keydown' && ev.metaKey) { |
Contributor
There was a problem hiding this comment.
Wouldn't these better be right next to the other chord handlers (makeChordHandlers) with meta+z etc.?
Co-authored-by: Iftach Yakar <DeDuckProject@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds macOS Command-key support for Crumble editing shortcuts, excluding paste.
Changes include:
Command+V is intentionally left unchanged/out of scope because clipboard-read behavior needs separate testing across browsers.
Addresses #651.
I worked with ChatGPT to help understand the code and make edits.