Open Eraldo opened 8 years ago
As the guy who retrofitted user customizable shortcuts into the editor, I admit that the bindings
look-up table is a little bit of a hack introduced to avoid backwards incompatible changes to how toolbar code works. A fix to both this and #248 should be relatively easy, but I expect backwards incompatible changes to be unavoidable at this point, so I'd like to hear the original author's thoughts on the matter. Especially given that version 2.0 of SimpleMDE is planned at some point and bumping up major revision is IMHO the best time to introduce stuff that breaks the API.
Yeah.. that sounds good. :)
I guess having the ability to just add
or replace parts of the toolbar vs overwrite it entirely would also be great. I hope for progress either way.
+1
I think we need a solution that accomplishes the following:
toolbar
optionBecause I advocate using the latest
tag when including SimpleMDE from a CDN, I think it's very important to maintain backwards compatibility, even with major releases. Plus this is an important goal if we want users to use the latest code. By ensuring that new updates don't break old code, it's far more likely that users will be using the latest code without fear of breaking their software.
Yes, well, that's not helpful. :) What if the point number 5 prevents a problem from being solved? Asking for future reference, though, because I think I have an idea how to make both issues go away, while keeping backwards compatibility. Will give it a try over the weekend.
I'd argue that most, if not all, changes can be accomplished in a fashion that retains backwards compatibility if we're clever enough.
If a particular issue does arise that would inhibit backwards compatibility, then the benefits would need to be weighed with the consequences. But I'd rather cross that bridge when we get there since it's rather situation-dependent.
@trwired Awesome.. looking forward to it. :D @WesCossick Sounds like the optimal solution. I wish you luck. Thank's for working on it - I appreciate it a lot.
seems still can't add shortcut key for custom function? I have following code to handle image upload , want to add a shortkey for this { name: "uploadImage", action: function customFunction(editor){ $("#fileLoader").trigger("click"); }, className: "fa fa-picture-o", title: "Add Image", } ], shortcuts: { "uploadImage": "Cmd-Alt-U" }
Seconded. @WesCossick any ideas?
Any updates yet? :) Or examples?
I guess just being able to add (extend) custom bindings would already fix this. Shall I create a PR?
@Eraldo, this project is dead and there has been not movement on it. I have talked with Wes and he has no interest in moving forward or passing over the project. Some of us have moved over to https://github.com/Inscryb/inscryb-markdown-editor and I would be happy to accept your PR or any other contributions.
If I overwrite the toolbar as demonstrated in the example code:
Then the tooltip does not show shortcuts anymore. (none of the buttons do anymore)
As far as I can tell this is because the action e.g.:
SimpleMDE.toggleBold
will not be found ingetBindingName
which looks for that function inbindings[key]
and findstoggleBold
instead. (bindings[key] === f
)Is there a way to add another button without having to recreate all the others? Or how else could I go about that? Ideas? Thanks. ;)