-
Notifications
You must be signed in to change notification settings - Fork 646
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
added KeyBindings #103
base: master
Are you sure you want to change the base?
added KeyBindings #103
Conversation
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.
Hey, I'm sorry for a late review on this.
I've pointed out two main issues I see with the current code and I think it'd be trivial to fix these.
Also, I think we can safely use the selectionChanger
function for headings like:
cm.replaceSelection(
selectionChanger(
cm.getSelection(), '### ', ''
)
);
Thanks for the changes @mohan-mu.
index.js
Outdated
// bold | ||
'Ctrl-B': function(cm) { | ||
var selection = cm.getSelection(); | ||
cm.replaceSelection('**' + selection + '**'); |
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.
This change takes away the existing functionality where you could use CTRL+B to toggle bold. This would always add more text. For example, pressing the hotkey twice on 'hello' would result in:
=> hello
=> **hello**
=> ****hello****
Arguably, the first approach wasn't foolproof either, but this implementation is immediately broken.
index.js
Outdated
}, | ||
// keyboard shortcut | ||
'Ctrl-L': function(cm) { | ||
cm.replaceSelection(selectionChanger(cm.getSelection(), '<kbd>', '</kbd>')); |
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.
Your changes appear to change the code to be indented with 2 characters instead of 4, which is the current convention of the file. I'd appreciate if you could make sure the file remains consistent.
Hi Maintainers, I have added
KeyBindings
for the below keys#71 ,#50
Ctrl-Alt-1
: Heading 1Ctrl-Alt-2
: Heading 2Ctrl-Alt-3
: Heading 3Ctrl-Alt-4
: Heading 4Ctrl-Alt-5
: Heading 5Ctrl-Alt-6
: Heading 6Shift-Ctrl-L
: Links,Shift-Ctrl-I
: Image,Shift-Ctrl-.
: BlockQuoteShift-Ctrl-'
:CodeBlockShift-U
: Unordered list,Shift-O
:Ordered list,Please check it out
Thank You