Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Add publishing keyboard shortcuts #1286

Merged
merged 3 commits into from May 7, 2020
Merged

Add publishing keyboard shortcuts #1286

merged 3 commits into from May 7, 2020

Conversation

black-puppydog
Copy link
Contributor

Allow fast publish and cancel actions when previewing posts.

Addresses #1285 by adding a key handler to the preview sheet.
It also put the focus on the cancel button. The result is that after
entering preview with <Ctrl/Cmd> + <Return> ...

  • <Return> OR <Escape> will cancel the publish and go back to editing
  • <Ctrl/Cmd> + <Return> once more will publish the message.

When I hit cancel, I usually want to keep editing. This small change puts
the focus back to the textArea when I hit cancel, so that I can just keep
typing right away.
This can be used to e.g. set event handlers or such for the faux-modals
we use for confirmation dialogs and such.
Addresses #1285 by adding a key handler to the preview sheet.
It also put the focus on the cancel button. The result is that after
entering preview with `<Ctrl/Cmd> + <Return>` ...

* `<Return>` OR `<Escape>` will cancel the publish and go back to editing
* `<Ctrl/Cmd> + <Return>` once more will publish the message.
Comment on lines +10 to +14
let fullAttributes = { className: 'Sheet', classList }
if (attributes !== undefined) {
fullAttributes = { ...attributes, ...fullAttributes }
}
const container = h('div', fullAttributes, [
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This feels like it could be cleaner. I'm passing the classList and the attributes separately just to have them be recombined...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, could I maybe attache the event handlers (passed as attributes) to something else that makes more sense?

@christianbundy
Copy link
Contributor

christianbundy commented May 7, 2020

Concern: I know that Microsoft Word uses Ctrl+Enter as a page break, but since GitHub does Ctrl+Enter and I haven't seen them criticized for it (???) then I think this is good to go.

@christianbundy christianbundy merged commit b46eb2b into master May 7, 2020
@black-puppydog
Copy link
Contributor Author

I wouldn't target feature parity with MS Word, or even shared UX. :P

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants