Prevent paste event altogether

I’m capturing the paste event and handling it in a popup box. I was getting a double paste, so I realized I needed to get CM to not do anything.

cm.on(“paste”,
function(e) { e.preventDefault(); });

Doesn’t seem to work… am I doing something wrong?

The first argument passed to your handler is the CodeMirror instance (as a glance at the error console would probably have told you, since that doesn’t have a preventDefault method). The event is the second argument.