jupyter / spreadsheet

A spreadsheet component for phosphor
BSD 3-Clause "New" or "Revised" License
5 stars 3 forks source link

Missing Reference to `ClipboardEvent` #1

Closed blink1073 closed 7 years ago

blink1073 commented 9 years ago

The demo looks great! I had to change these to any to get it to compile. These were the only two lines in the repo that contained the word ClipboardEvent.

$ gulp
[05:26:01] Using gulpfile ~/workspace/spreadsheet/gulpfile.js
[05:26:01] Starting 'default'...
spreadsheet.ts(392,52): error TS2304: Cannot find name 'ClipboardEvent'.
spreadsheet.ts(409,52): error TS2304: Cannot find name 'ClipboardEvent'.
[05:26:02] TypeScript: 2 semantic errors
[05:26:02] TypeScript: emit succeeded (with errors)
[05:26:02] Finished 'default' after 1.11 s
$ npm -v
2.10.1
$ node -v
v0.12.4
$ uname -a
Darwin 0202-ssilvester.local 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 20:23:44 PDT 2015; root:xnu-2782.20.48~8/RELEASE_X86_64 x86_64
svurens commented 9 years ago

The error is because the ClipboardEvent is not officially a part of Javascript/Typescript. It's somewhat of a temporary fix, since every browser handles the clipboard slightly differently. Chrome and Firefox both support the ClipboardEvent. It's probably best to either leave it as is, or change it to any for now, since handling the clipboard on Internet Explorer looks to be difficult.

If there is a better way to handle the web clipboard, I'd be glad to hear of it, though.

blink1073 commented 9 years ago

According to Mozilla it is supported as of IE 5.0: https://developer.mozilla.org/en-US/docs/Web/API/ClipboardEvent/clipboardData

blink1073 commented 9 years ago

But perhaps not the getData and setData methods...

svurens commented 9 years ago

The events are not supported, though: https://developer.mozilla.org/en-US/docs/Web/Events/copy

rgbkrk commented 9 years ago

That's why things like Google Docs fake copy + paste (works within the same domain, etc.) and others use ZeroClipboard (which is a flash library) for access to the system copy + paste buffers (see sharecell's use of ZeroClipboard).