Skip to content

Supporting cutting and pasting in web applications

Dion has a long, interesting, painful article about supporting cut, paste, and copy operations for Bespin, a web based code editor.

In our world with the editor [in webkit], we use the before events to set things up, and we have to do something pretty hacky to make it happen. The copy event itself only actually goes through if you are on an element that supports it. There are hacks around this too. For example, if you want to be able to get a copy event on a div, you need to turn on contentEdible and set the tab index to -1. Strange huh?

All I can say is ‘Ow!’