fix: Add Keyboard Shortcut for the Color Picker #3867#4028
Conversation
|
🎉 Thanks for opening this pull request! Please check out our contributing guidelines if you haven't already. |
e053b64 to
474fa20
Compare
There was a problem hiding this comment.
Pull request overview
Adds a CodeMirror keybinding to open the existing CSS color picker via keyboard, and adjusts keymap construction to be per-file-state (avoiding mutation of the shared extraKeymaps array).
Changes:
- Added helpers to locate the color picker
<input type="color">near the current selection and programmatically open it. - Added
Mod-Kkeybinding (CSS-only) to open the color picker. - Switched from mutating
extraKeymapsto cloning it per file (fileExtraKeymaps) before adding file-specific bindings.
There was a problem hiding this comment.
i would request you to look at the keymap implementation of tidyCodeWithPrettier and understand the code patterns we are already using.
placing the mode check inside the function assigned to run seems reasonable, since tidyCodeWithPrettier already follows the same pattern.
|
lgtm!! sorry I resolved the merge conflicts weirdly so I think the code will be temporarily broken but I'll merge it into the develop branch and fix it on my end |
Issue:
Fixes #3867
This PR adds a keyboard shortcut mod+k, command+k on Mac and control+k on Windows to open the color picker when the user starts adding a color.
Demo:
Changes:
Added a keyboard shortcut that opens the color picker across browsers and operating systems by calling the color picker function on press of that shortcut.
Added a function that finds where the user is currently at in the editor and adds the color to that line.
I have verified that this pull request:
npm run lint)npm run test) - the repository came with test errors. ours does not add any test errors.npm run typecheck)developbranch.Fixes #123