Inscryb/inscryb-markdown-editor

Shortcut for the custom function

Closed this issue · 8 comments

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

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

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.

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

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.

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.

Nice, thanks!

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

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