You don't have to write any code for this.

If you select the text and right mouse click, there is a default popup menu that contains Cut/Copy/Paste/Delete already there for you.