Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace document.execCommand with navigator.clipboard #11251

Merged
merged 1 commit into from
Jun 23, 2020
Merged

Replace document.execCommand with navigator.clipboard #11251

merged 1 commit into from
Jun 23, 2020

Conversation

mbelsky
Copy link
Contributor

@mbelsky mbelsky commented Jun 21, 2020

Issue: #10526

What I did

Replace document.execCommand with navigator.clipboard

Navigator API: clipboard support table

How to test

  1. Open ?path=/story/basics-syntaxhighlighter--bordered-copy-able in examples/official-storybook
  2. Click 'Copy' button
  3. Check that your clipboard equals to
import { Good, Things } from 'life';

        const result = () => <Good><Things /></Good>;

        export { result as default };
      

(clipboard output is not formatted on next branch too. I think it better to fix in another pr)

window.setTimeout(() => setCopied(false), 1500);
})
// eslint-disable-next-line no-console
.catch(console.error);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use @storybook/client-logger instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed

@shilman shilman added maintenance User-facing maintenance tasks ui labels Jun 21, 2020
@ndelangen
Copy link
Member

awesome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance User-facing maintenance tasks ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants