Custom button not working : context is undefined
Custom button not working in 0.8.12 : context is undefined
Error in 0.8.12 : https://jsfiddle.net/4kq7ws9z/ but same code it works in 0.8.10 : https://jsfiddle.net/8fm5vq50/17/
The same. 'context' variable is not available in the custom button callback anymore. I used it in context.invoke('editor.saveRange'); and context.invoke('editor.restoreRange'); - Do we still need that anyway?
So by what replacing the context.invoke('editor.insertText', 'hello'); like showed in example page ?
#3150 seems to be a related issue. I would like to see this fixed as well.
I found a workaround in this older answer on SO:
Instead of
context.invoke('editor.insertText', 'hello');
use
$('#editorID').summernote('editor.insertText', 'hello');
It works, but I would hardly call this a good permanent solution...
The change happened in v0.8.12 (7b2a514) in response to a different bug. But I can't figure out how to use insertText with the new version.
https://summernote.org/deep-dive/#insertion-api As this has been open for some time now, and I hope you were able to resolve your issue, I'll close this. If it's still an issue, please reopen or create a new issue.
Please also update the documentation.
The documentation shows how to insert different things. What do you think needs updating? Or, if you have a better way to explain the current explainations you are welcome to do a PR fixing those. You can do that here: https://github.com/summernote/summernote.github.io
The documentation on custom buttons refer to the context parameter (which is undefined), which makes the given example not work. See https://summernote.org/deep-dive/#custom-button
FYI: this bug has been fixed in https://github.com/summernote/summernote/pull/3284 (which reverted commit https://github.com/summernote/summernote/commit/7b2a514f5d53edeffcb8c67cde30eb59381d7f75), but it's still on the develop branch.
Thanks @TOPVeric for mentioning that. Could we please make sure we are using the develop branch version, and that issue isn't persistent there.
FYI: this bug has been fixed in #3284 (which reverted commit 7b2a514), but it's still on the
developbranch.
Can you please merge this into the original code, because I have downloaded the summernote-bs4.js and not from any branch.
FYI: this bug has been fixed in #3284 (which reverted commit 7b2a514), but it's still on the
developbranch.Can you please merge this into the original code, because I have downloaded the summernote-bs4.js and not from any branch.
I'm not one of the developers, I'm just following this issue since I'm having problems with this bug as well.
Not sure when the develop branch will be merged to master, you can clone the development branch, install npm in the clone and build the project, then grab the files you need out of the dist/ folder,
Thanks for the quick response.
Just to make sure: I assume the Closed status doesn't mean this won't eventually reach master right? We do need this feature, but we can stay on an older version for now. So there is no rush, I just want to make sure this will eventually reach master and the nuget package.
Just to make sure: I assume the Closed status doesn't mean this won't eventually reach master right? We do need this feature, but we can stay on an older version for now. So there is no rush, I just want to make sure this will eventually reach master and the nuget package.
AFAIK, closed only means that this issue is closed/resolved. The solution has been merged into the develop branch, which will eventually be merged into master and published to npm as a new version. I don't know when that will be though.
You can if you wish, clone the develop branch, and build the project to get the latest changes. Install and running NPM instructions can b found here https://github.com/summernote/summernote/blob/develop/.github/CONTRIBUTING.md