wysihat

How can you catch a contentEditable paste event?

旧街凉风 提交于 2019-12-07 01:27:42
问题 I've got a great editable text area going with wysihat and contentEditable. I really need a way to intercept paste events to either stop them, or process their DOM before allowing insertion. It's a little crazy they people can paste entire webpages into the editable areas. Is this possible? Come on future, arrive on my doorstep. HTML5 gurus, fire! 回答1: You can't access the content's that will be inserted. What you can do is add an event listener that runs some cleanup code on Ctrl+V (with a

How can you catch a contentEditable paste event?

北城余情 提交于 2019-12-05 05:10:53
I've got a great editable text area going with wysihat and contentEditable. I really need a way to intercept paste events to either stop them, or process their DOM before allowing insertion. It's a little crazy they people can paste entire webpages into the editable areas. Is this possible? Come on future, arrive on my doorstep. HTML5 gurus, fire! You can't access the content's that will be inserted. What you can do is add an event listener that runs some cleanup code on Ctrl+V (with a timeout, so it sees the pasted text) the onpaste event works fine, at least u can reject user insert behavior