Having a simple set up for summernote.
<div id="summernote">data-here</div>
$('#summernote').summernote({
height: 200, // set editor height
focus: true,
callbacks // any callbacks didn't worked, onChange, onBlur etc..(any tip on how to add proper callbacks here)
});
I tried to make jquery code to catch on change event of my summernote, like:
$('#summernote').on("summernote.change", function (e) {
# Problem here when deleting (keyboard backspace, calls twice)
-some code here-
}
My problem with the summernote.change
is that when deleting text/content using keybord's backspace, the callback (on change) triggers twice instead.
Thus my inside function runs twice too.
Any idea on this guys, Thanks in advance.
As I know, it’s a known issue (https://github.com/summernote/summernote/issues/2888), but nobody tried to fix it.
So, I use it like this :
var mySec = 100;
var myEvent;
$('#summernote').on("summernote.change", function (e) {
clearTimeout(myEvent);
myEvent = setTimeout(function(){
console.log(e) // do something!
}, mySec);
});
I hope this will help you :)