Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding new post shortcut #34

Merged

Conversation

kkoppenhaver
Copy link
Contributor

This is the first pass at adding a new post shortcut as identified in #2.

Because there seems to be some precedent with using Ctrl + Option (Mac) and Alt + Shift (Windows) for shortcuts in the WordPress editor, I've opted for Ctrl + Option + N to be the Mac shortcut and Alt + Shift + N to be the Windows shortcut.

This code listens for either of those key combinations to be pressed and then clicks the existing New Post button. This may be possible to use window.location.href or something like that instead of simulating a click (especially if #7 gets merged and the button isn't always new post), but I think it should work for now.

@aurooba aurooba self-requested a review June 1, 2022 17:19
@aurooba aurooba linked an issue Jun 1, 2022 that may be closed by this pull request
Copy link
Member

@aurooba aurooba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this briefly and it works great. Thanks for adding this @kkoppenhaver! I'm sorry it took me to so long to get to it. 😅 I've just left one comment about an import.

My other thought would be, should we add some sort of visual feedback when the keyboard shortcut is used, so that folks know it's actually working? You can see it working when you see the browser is loading a new page, but that's possibly a bit too subtle. What do you think?

src/utils.js Outdated Show resolved Hide resolved
src/utils.js Show resolved Hide resolved
@aurooba
Copy link
Member

aurooba commented Feb 26, 2023

Although as I'm thinking about it, perhaps there should be feedback regardless of how we press the button. So I can add that as a separate PR. Once you've reviewed the requested change on this, we can merge. :)

@kkoppenhaver
Copy link
Contributor Author

Thanks @aurooba, I've taken care of that change and updated both README files to move this from an "upcoming feature" into the supported features list.

Congrats on the podcast launch, by the way. I've been a listener since episode 1 :)

@aurooba
Copy link
Member

aurooba commented Feb 26, 2023

@kkoppenhaver Thanks for the changes! :)

I'm glad you like the podcast! :) Let us know if there are any particular topics you'd love to hear about!

@aurooba aurooba merged commit 1fc7bf7 into createwithrani:develop Feb 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Keyboard shortcut to create new post
2 participants