开发者

How to access the result of a drag and drop (or paste) operation in a contentEditable element?

开发者 https://www.devze.com 2023-03-31 08:59 出处:网络
I have a contentEditable element that should accept drag\'n drop actions but I\'d like to modify what is being dropped (or pasted) because some HTML tags should be tolerated while others shouldn\'t.

I have a contentEditable element that should accept drag'n drop actions but I'd like to modify what is being dropped (or pasted) because some HTML tags should be tolerated while others shouldn't.

But how do I access just what has been copied instead of the whole element? When I listen to events on the editable element, then the whole editable element is the context (obviously)...? and the event itself does not开发者_C百科 seem to contain what is being copied (and is different between FF and Webkit).

Any idea?


I posted a similar question today, worded differently, and it was brilliantly answered by user Binary9: Drag and drop event in a contentEditable element

This question should really be closed but I don't know how to do that.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号