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

notlmn
Copy link
Contributor

@notlmn notlmn 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
Copy link
Contributor

jerone commented Jun 10, 2019

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

@notlmn
Copy link
Contributor Author

notlmn 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.

Copy link
Member

@fregante fregante left a comment

Choose a reason for hiding this comment

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

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

@notlmn
Copy link
Contributor Author

notlmn 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
Copy link
Member

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

@fregante
Copy link
Member

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
Copy link
Contributor Author

notlmn 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.

@fregante
Copy link
Member

fregante 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”?

@fregante fregante merged commit 66a2e07 into refined-github:master Jun 22, 2019
@PatricNox
Copy link

"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?

@fregante
Copy link
Member

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
Development

Successfully merging this pull request may close these issues.

Shortcut to format selected text as code
5 participants