Inscryb / inscryb-markdown-editor

A simple, beautiful, and embeddable JavaScript Markdown editor. Based off SimpleMDE by Sparksuite.
MIT License
90 stars 16 forks source link

Shortcut for the custom function #23

Closed serafxxx closed 5 years ago

serafxxx commented 6 years ago

I'm currently using SimpleMDE, but looks like its dead. Going to move to inscryb if it would be possible to assign shortcut to a custom function

CWharton commented 6 years ago

This would be a great feature to have. You are more than welcome to submit a PR.

working-name commented 6 years ago

I'm looking for the same thing, but don't have the skill to code it myself, obviously, since I'm posting here instead of just making it happen.

CWharton commented 6 years ago

@working-name, this project is open source and free to use to benefit everyone. I offer users of this software to do PR to implement features and to fix bugs to help this project evolve. You are not obligated by any means to contribute to this project in order to use it. Please understand that I am one person that works on several projects, have a full-time job, am a full-time parent, and working on a company startup. I do wish I could add all the features requested by other to this project but unfortunately, I do not have that kind of time. This is why I offer other to contribute what they can. If you are incapable or unwilling to contribute then please be forbearing and I will add this feature in the future unless someone commits a PR before I get the time.

working-name commented 6 years ago

I understand it's free as in free beer, I'm not trying to be an ass. I am also very grateful that you actually have continued working on a dead project. However, I have a sour taste in my mouth from other "open source" project managers where the de-facto response is "good luck".

I just took your "more than welcome to submit a PR" as "good luck", which is in line with other disinterested publishers. My mistake for pooling you together with the others.

Yes, you are right, I'm not at the point where I can figure it out, although I have been playing with it ever since I asked the other question about the toolbar buttons being completely replaced. If by some miracle I figure out how to get shortcuts for custom function names, I will definitely submit a PR.

jonyhayama commented 5 years ago

The solution is quite simple. I tried to submit a PR but for some reason I couldn't push my changes...

Anyway, you can simply add

if( options.name && options.name in shortcuts ){
    bindings[options.name] = options.action;
}

right before return el; on the createIcon function. the line number is 125 if I'm not mistaken.

working-name commented 5 years ago

Nice, thanks!

jonyhayama commented 5 years ago

Actually moved it to right before if (options.title && enableTooltips) { so the tooltip is properly generated. Created a pull request, hope it helps :)

jonyhayama commented 5 years ago

@CWharton I believe we should close this issue... :)