views:

59

answers:

0

I've been pulling my hair out trying to figure out the best way to fix this problem. Perhaps someone will have fun with this.

I have a div with contentEditable="true" that works fine for nearly everything. One exception is inside Firefox when the user uses CTRL-A to select everything and then copies/pastes. The select operation includes the tags for div itself! As far as I was able to search, this bug was supposedly fixed by Mozilla, but that just isn't true. The div just continually is pasted inside itself.

I've looked into editing the clipboard once the user has copied it, but Firefox doesn't seem too friendly towards that unless you use flash, which isn't very desirable. I've also thought of catching the offending tags on the other end, when the user does a paste, but the paste events put the actual text in the div after any javascript event handler has finished. Is there a way to edit the text being pasted before it happens?