rstudio/rstudio — pull request #165 by jmcphers (2014-09-17 19:50:52+00:00)
Title: Fix clipboard copy in IE10+

This change fixes a problem in IE10+ in which the copy command doesn't work in the ACE editor component.

The problem is a result of IE's treatment of the `beforecopy` and `copy` events. In IE, the clipboard data from ACE (i.e. the selection contents) is successfully recorded in ACE's handler for the `beforecopy` event, but then immediately cleared in the `copy` event.

The fix is to suppress the `copy` event when two conditions hold:

- The current browser is IE, and
- The text on the clipboard is the text ACE thinks should be on the clipboard

Suppressing the event leaves intact the clipboard data loaded in `beforecopy`.