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

Format selected text in textareas with keyboard shortcuts #2145

Merged
merged 6 commits into from Jun 22, 2019

Conversation

Projects
None yet
5 participants
@notlmn
Copy link
Contributor

commented Jun 10, 2019

Closes #2032.

If any text is selected while using these keys, the text is wrapped with each of the pressed characters. Text selection is still preserved so that the user can chain these key presses.

Demo

format-textarea

Test

On any comment textarea for commits or comments.

@jerone

This comment has been minimized.

Copy link
Contributor

commented Jun 10, 2019

I saw characters [ and ( in the list. Does that mean if I press [, it will add two [[, instead of []?

@notlmn

This comment has been minimized.

Copy link
Contributor Author

commented Jun 11, 2019

I saw characters [ and ( in the list. Does that mean if I press [, it will add two [[, instead of []?

Aah, that's right. Forgot to push some changes last night. Thanks for pointing that out.

@bfred-it
Copy link
Collaborator

left a comment

Should this be mentioned in the readme? Are any shortcuts in this file mentioned there?

@notlmn

This comment has been minimized.

Copy link
Contributor Author

commented Jun 19, 2019

Are any shortcuts in this file mentioned there?

This PR doesn't exactly add keyboard shortcuts, I don't know if we can call these actions "keyboard shortcuts".


Should this be mentioned in the readme?

Even if we added it to the readme, what should we call it? ¯\_(ツ)_/¯

@sindresorhus

This comment has been minimized.

Copy link
Owner

commented Jun 19, 2019

Yes, should be mentioned in the readme as it's not something most would just discover.

@bfred-it

This comment has been minimized.

Copy link
Collaborator

commented Jun 19, 2019

If you want to extract it into its own feature it could be easy-formatting or one-key-formatting maybe. This file has a few unrelated features, like “esc to blur” and “esc to cancel” I think.

@notlmn

This comment has been minimized.

Copy link
Contributor Author

commented Jun 20, 2019

This file has a few unrelated features, like “esc to blur” and “esc to cancel” I think.

Last time I checked, some of these sub-features weren't working, but that's another issue anyway.

There's still the question of what should this be called when including in readme, keyboard shortcut? Or if this should be extracted into its own feature.

@bfred-it

This comment has been minimized.

Copy link
Collaborator

commented Jun 20, 2019

“Format selected text with a key press when writing comments”

Perhaps. Not sure about “key press”. Is there an equivalent to “with a click”?

notlmn added some commits Jun 22, 2019

@bfred-it bfred-it merged commit 66a2e07 into sindresorhus:master Jun 22, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@PatricNox

This comment has been minimized.

Copy link

commented Jun 24, 2019

"Faster text formatting"

surround your word or phrase with asterisks. To italicize text, place underscores around a section.

This can also be achieved through highlighting the specific word, then pressing the underscore symbol on your keyboard to automatically format the text.


Something like this, maybe?

@bfred-it

This comment has been minimized.

Copy link
Collaborator

commented Jun 24, 2019

The formatting is part of GitHub already, so we don’t need to explain that part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.