content-editable-html-stripper
This package contains a convenient function to remove HTML-like entities from a string on paste events to contenteditable
elements. This uses clipboardData
. Although clipboardData
is an exprimental technology, it is widely supported by modern browsers.
Installation
npm install content-editable-html-stripper --save
Usage
To strip HTML-like entites from content pasted into a contenteditable
container,
API
handlePaste(event)
Insert string into focused contenteditable
element with HTML-like entities removed from pasted string.
Vanilla
???
document0
React
{ const onPaste = props return <blockquote contenteditable='true' onPaste=handlePaste /> }
Yeah, it's magic 💫