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

Add Ctrl+I and Ctrl+B support to format text #2180

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

noelzubin
Copy link

Ctrl+I Now toggle Italics
Ctrl+B Now toggle Bold

Note: If there is a newline between the selected text this wont
work since codemirror doesn't wrap text with newline in them anyway

Ctrl+I Now toggle Italics
Ctrl+B Now toggle Bold

Note: If there is a newline between the selected text this wont
work since codemirror doesn't wrap text with newline in them anyway
@kazup01 kazup01 added the awaiting review ❇️ Pull request is awaiting a review. label Jul 6, 2018
@Rokt33r Rokt33r added awaiting changes 🖊️ Pull request has been reviewed, but contributor needs to make changes. and removed awaiting review ❇️ Pull request is awaiting a review. labels Jul 17, 2018
Copy link
Member

@Rokt33r Rokt33r left a comment

Choose a reason for hiding this comment

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

Please fix lint errors too.

@@ -153,8 +153,69 @@ export default class CodeEditor extends React.Component {
'Cmd-T': function (cm) {
// Do nothing
},
'Ctrl-I': function(cm) {
Copy link
Member

Choose a reason for hiding this comment

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

For macOS, we have to implement this to Cmd-I and Cmd-B.
So, we have to extract the handler and make it work depending on OS.
Like the below:

'Cmd-I': function (cm) {
  if (global.process.platform !== 'darwin') { return }
  applyItalic(cm)
},
'Ctrl-I': function (cm) {
  if (global.process.platform === 'darwin') { return }
  applyItalic(cm)
}

cm.replaceSelection(newSelection)
}
},
'Ctrl-B': function(cm) {
Copy link
Member

Choose a reason for hiding this comment

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

Same to here

Enter: 'boostNewLineAndIndentContinueMarkdownList',
'Ctrl-C': (cm) => {
console.log('here', cm)
Copy link
Member

Choose a reason for hiding this comment

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

Please remove this unnecessary logging

@noelzubin
Copy link
Author

wokay done

@Rokt33r
Copy link
Member

Rokt33r commented Jul 19, 2018

I found another problem that is the shortcut has a conflict with #2178 .

How do you think @enyaxu?

@enyaxu
Copy link
Contributor

enyaxu commented Jul 19, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting changes 🖊️ Pull request has been reviewed, but contributor needs to make changes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants