question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onPaste() just doesn't work anymore?

See original GitHub issue

With summernote v0.6.16, my onPaste callback works on Chrome (v46), but not on Firefox (v41).

With v0.7.0, it isn’t triggered on neither browser.

I tried both onPaste and onpaste but none of them works.

myElement.summernote({
    // all other settings
    onPaste: function (e) {
         // ...some code to clear up undesired formatting from the source...
     }
});

What happened? Am I doing something wrong?

The onPaste event is quite useful to remove undesired formatting when a user copies text from somewhere else (i.e. to standardize what and how text can be formatted).

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
easylogiccommented, Oct 15, 2015

hi @ybwxhzlw

The way to define the callback function was changed in 0.7.0 .

refer to below code.

$(".summernote").summernote({
    callbacks : {
        onPaste : function (e)  {

        }
    }
});

or 

$(".summernote").on("summernote.paste", function (we, e) { 

});
0reactions
hackerwinscommented, Nov 7, 2015

@stefl0n, @ybwxhzlw Thanks for reporting and waiting. This bug was fixed on develop branch and it will be released at v0.7.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

jQuery on("paste") for the first time doesn't grab or pass the value
Solution is to set the timeout. Right code looks like that and works just fine. $("#link").on("paste" ...
Read more >
Element: paste event - Web APIs | MDN
The paste event is fired when the user has initiated a "paste" action through the browser's user interface.
Read more >
preventDefault does not work in onPaste - CodeMirror
In a regular textarea, calling e.preventDefault() from onPaste cancels the paste. See for example jsfiddle where pasting is totally blocked ...
Read more >
How to Prevent Pasting into an Input - David Walsh Blog
The onpaste attribute lets us prevent pasting into the form. Adding the autocomplete attribute as well as preventing drag and drop into the ......
Read more >
How to prevent pasting into input fields - DEV Community ‍ ‍
This code cancels the default behaviour of the paste event (i.e. pasting the contents of the clipboard into the input element). When the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found