-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
base: master
Are you sure you want to change the base?
Conversation
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
There was a problem hiding this 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.
browser/components/CodeEditor.js
Outdated
@@ -153,8 +153,69 @@ export default class CodeEditor extends React.Component { | |||
'Cmd-T': function (cm) { | |||
// Do nothing | |||
}, | |||
'Ctrl-I': function(cm) { |
There was a problem hiding this comment.
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)
}
browser/components/CodeEditor.js
Outdated
cm.replaceSelection(newSelection) | ||
} | ||
}, | ||
'Ctrl-B': function(cm) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same to here
browser/components/CodeEditor.js
Outdated
Enter: 'boostNewLineAndIndentContinueMarkdownList', | ||
'Ctrl-C': (cm) => { | ||
console.log('here', cm) |
There was a problem hiding this comment.
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
wokay done |
@Rokt33r I noticed this problem, Maybe we should replan Bootnote shortcuts?
Right now shorcuts used by Bootnote don’t have explict config file, maybe we could create keybindings.json for system use, and another keybindings.json file for user themselves to customize.
By do this , we can prevent shortcuts conflict, and user can know shortcuts clearly.
|
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