summernote
summernote copied to clipboard
Custom plugins tooltip error with summernote-lite
Checklist
- [x] I've looked at the documentation to make sure the behavior isn't documented and expected.
- [x] I'm sure this is an issue with Summernote, not with my app or other dependencies (Angular, Cordova, React, etc.).
- [x] I've searched through the current issues to make sure this hasn't been reported yet.
- [x] My issue is pertinent to this repository of Summernote (jQuery), or I was unable to have my issue resolved from the relevant version I'm using, such as Angular, dJango, Rails or React. Please try your issue at the relevent repository first.
- [x] I understand that issues without interaction for more than 14 days (2 weeks), may be closed at our discretion. We do this, as sometimes issues are abandoned. We may at our discretion, add issues to the relevant project to be looked at, or for maintainers to work through as time permits. This is to help keep issues relevant to the current version of Summernote, and to reduce clutter.
- [x] I agree to follow the Code of Conduct that this project adheres to.
Steps to reproduce
- Use
summernote-lite.jsinstead ofsummernote-bs4.jsinexamples/plugin-hello.html - Launch summernote in local with
yarn devand go tohttp://localhost:3000/examples/plugin-hello.html - Hover over the custom plugin button "Hello" -> an error is raised (
targetOffset is undefined, in fileTooltipUI.jsL44)
This error is raised because there is no options.container known by our custom call to ui.button in plugin/hello/summernote-ext-hello.js.
This can be quick-fixed with the workaround bellow :
$.extend($.summernote.plugins, {
...
'hello': function(context) {
...
var button = ui.button({
container: context.options.container, // -----> Quickfix: add this line.
contents: '<i class="fa fa-child"/> Hello',
tooltip: 'hello',
click: function() {
...
}
}
}
});
A better way would be for summernote to set the options.container value implicitly if not already defined. I opened a PR for this : #4740
Expected behavior
The container should be known by buttons created from plugins.
Current behavior
No options.container known, see message above.
Minimal example reproducing the issue
No response
Environment
- Summernote version: v0.9.1 (latest)
- Browser (with version): this issue is browser independant
- OS/Platform (with version): this issue is OS/platform independant