Skip to content

Instantly share code, notes, and snippets.

@robsonsobral
Forked from cesarfigueroa/paste.js
Created December 4, 2019 13:34
Show Gist options
  • Save robsonsobral/6210a20e573f1866c220f88c56909d79 to your computer and use it in GitHub Desktop.
Save robsonsobral/6210a20e573f1866c220f88c56909d79 to your computer and use it in GitHub Desktop.

Revisions

  1. @cesarfigueroa cesarfigueroa created this gist Sep 25, 2014.
    4 changes: 4 additions & 0 deletions paste.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    document.querySelector('[contenteditable]').addEventListener('paste', function (event) {
    event.preventDefault();
    document.execCommand('inserttext', false, event.clipboardData.getData('text/plain'));
    });