Chuck
Chuck

Reputation: 1210

PhpStorm Clipboard API

I'm trying to use the Clipboard API which already works in browsers, but PhpStorm doesn't know of it.

enter image description here

What does it take to make PhpStorm recognise it? I've set the JavaScript-language version in the project-settings to ECMAScript 6.

Upvotes: 0

Views: 75

Answers (2)

Chuck
Chuck

Reputation: 1210

Thanks to Lena for the right direction, I've found a way so sort it.

Under Settings > Javascript > Libraries click on Download. Select dom-clipboard-api from the list and click download and install.

The library stub consists of this: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/dom-clipboard-api/index.d.ts

I needed to invalidate caches and restart PhpStorm, but afterwards it worked as I expected.

Upvotes: 1

lena
lena

Reputation: 93868

PhpStorm uses library definitions stubs from https://github.com/Microsoft/TypeScript/tree/master/lib for Web APIs support. Unfortunately no library stubs are available for this API, as it's not yet widely adopted. Please see https://github.com/Microsoft/TypeScript/issues/26728#issuecomment-422970152 for possible workaround

Upvotes: 1

Related Questions