Search code examples
javascriptsummernote

Summernote click event?


How can I handle summernote click event? I want to handle cursor position when changing by mouse click. There is a onFocus callback, but when editor already has focus, I can't found a solution.

I want to do something like this:

callbacks: {
    onKeydown: function (e) {
        $('#summernote').summernote('editor.saveRange');
    },
    onClick: function (e) {
        $('#summernote').summernote('editor.saveRange');
    }

Solution

  • I've came with this solution:

    $scope.summernoteOptions = {
        onInit: function () {
            $(".note-editable").on('click', '.cssTargetClass', function (e) {});
                }
            }
        };
    

    Where cssTargetClass is the class of the type of elements that I want to bind to event.