Code Monkey home page Code Monkey logo

copy-to-clipboard's People

Contributors

deniscarriere avatar dependabot[bot] avatar evenchange4 avatar julienw avatar ljharb avatar mariusandra avatar martynaszilinskas avatar mchl18 avatar nkbt avatar phiggins avatar pugnascotia avatar shvaikalesh avatar sloanesturz avatar sudodoki avatar wdlb avatar zardoy avatar zombiej avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

copy-to-clipboard's Issues

Copy into multiple formats

When you select table cells on the web and copy them, the browser stores the data in multiple formats: plain text, html... This makes it possible to paste the table into different places and it the target app can decide which format to use.

Clipboard.write() allows adding multiple items and each can be in different format. It's support is still poor though. But the selection and copying method should take care of this. It would be awesome if we could specify multiple formats in options so the copied content can be pasted into multiple targets.

Example: when I use

copy(htmlTableCode, { format: 'text/html' });

only the html format gets stored in the clipboard.

Stopped working on Chrome

My chrome version on mac: Version 50.0.2661.102 (64-bit)

Not sure if something real weird happened to my chrome or chrome released something that broke it. It has been working all the time and works on all other browsers.

Error messages in Chrome

If there is a text selection on a page and copy function is invoked (as a result of some user action), Chrome 43/45 prints Discontiguous selection is not supported in console and does not copy anything to the clipboard. And if it does, text selection is not restored (because of the lack of Selection.removeRange method).

Furthermore, text selection I have mentioned could be 0-length: any click on any text causes selection of type: "Caret". So this kinda bug happens quite often.

What I am proposing is to remove and restore user selection after copying to clipboard. This will solve both mentioned issues (errors in console and not restored text selection).

What do you think, @sudodoki?

Add "format" to options (cannot paste tab-delimited data into excel)

I came across this issue when trying to copy some tab-delimeted data to be paste-able into excel. I needed to paste my contents as text/plain because I guess that wasn't the default the browser does.

According to the w3 spec, you can do this like so:

document.addEventListener('copy', function(e){
    e.clipboardData.setData('text/plain', 'Hello, world!');
    e.clipboardData.setData('text/html', '<b>Hello, world!</b>');
    e.preventDefault(); // We want our data, not data from any selection, to be written to the clipboard
});

clipboardData is a DataTransfer object so it's setData should be well-supported, but I'm not sure about the document's copy event being very well supported.

I'd be happy to implement these changes, but I thought I'd raise an issue first to make sure this is something you'd be okay with adding to the library.

Ideally, the fix would be along the lines of: copy('blah blah', { debug: true, format: 'text/plain' })

Callback if copy successful

Just curious if there's a way to detect if copy is successful? If so can we expose a callback function option to let users perform custom actions on successful copy? Thanks!

Typescript definition?

I was going to publish a TypeScript definition for this module.

@sudodoki Any interest to include this directly in your library or would you rather have it maintained and published under DefinitelyTyped?

The definition is pretty straightforward and won't be very complicated (<10 LOC)

not working for script tags

I want a copy button for a text which basically is a script tag.
Something like:

<script type="text/javascript">
  var a = 2 + 3;
</script>

However, it doesn't work, becuase you are using innerHTML, which basically inserts the script inside the page.

Copy Html

I have some html I need to copy to clipboard in order to paste into a MailChimp template. Everything was working fine the way I expected it too, but suddenly it started falling back to a prompt and giving some errors about what I'm trying to copy is undefined.

copyToClipBoard = () => {
    const msg = 'HTML Copied to Clipboard'
    const type = 'info'
    this.editor.exportHtml(data => {
      console.log('data html', data.html);
      
      const copyHtml = data.html
      copy(copyHtml, {
        debug: true,
        message: 'Press #{key} to copy',
      });
    })
   
    this.createSnack(msg, type)
  }

I Dont understand why this was working fine and all of a sudden stopped? Here's what I'm trying to copy, I copied this out of the console log.

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">

<head>
  <title></title>
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="x-apple-disable-message-reformatting">
  <style type="text/css">
    #outlook a {
  padding: 0; }

.ReadMsgBody {
  width: 100%; }

.ExternalClass {
  width: 100%; }

.ExternalClass * {
  line-height: 100%; }

body {
  margin: 0;
  padding: 0;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%; }

table,
td {
  border-collapse: collapse;
  mso-table-lspace: 0pt;
  mso-table-rspace: 0pt; }

img {
  border: 0;
  height: auto;
  line-height: 100%;
  outline: none;
  text-decoration: none;
  -ms-interpolation-mode: bicubic; }

p, ul {
  display: block;
  margin: 0; }

@media only screen and (min-width: 480px) {
  .email-col-17 {
    width: 17% !important; }
  .email-col-25 {
    width: 25% !important; }
  .email-col-33 {
    width: 33% !important; }
  .email-col-50 {
    width: 50% !important; }
  .email-col-67 {
    width: 67% !important; }
  .email-col-100 {
    width: 100% !important; } }

@media only screen and (max-width: 480px) {
  img.fullwidth {
    max-width: 100% !important; } }

  </style>
  
<!--[if mso]>
<xml>
  <o:OfficeDocumentSettings>
    <o:AllowPNG/>
    <o:PixelsPerInch>96</o:PixelsPerInch>
  </o:OfficeDocumentSettings>
</xml>
<![endif]-->
<!--[if mso]>
<style type="text/css">
  ul li {
    list-style:disc inside;
    mso-special-format:bullet;
  }
</style>
<![endif]-->
<!--[if lte mso 11]>
<style type="text/css">
  .outlook-group-fix {
    width:100% !important;
  }
</style>
<![endif]-->

</head>

<body id="u_body" class="u_body" width="100%" bgcolor="#e7e7e7" style="margin: 0; mso-line-height-rule: exactly; background-color: #e7e7e7;">
  <div style="background-color: #e7e7e7; font-family: arial,helvetica,sans-serif;">
  
<table id="u_row_1" class="u_row" align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="margin: 0; padding: 0">
  <tr>
    <td align="center" valign="top" bgcolor="" style="padding: 10px; background-color: ;">
      <!--[if mso | IE]>
      <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="500" align="center" style="width:500px;"><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;">
      <![endif]-->
      <div style="margin:0px auto;max-width:500px;">
        <table role="presentation" cellpadding="0" cellspacing="0" style="font-size:0px;width:100%;" align="center" border="0">
          <tbody>
            <tr>
              <td style="text-align:center;vertical-align:top;direction:ltr;font-size:0px;" bgcolor="">
                <!--[if mso | IE]>
                <table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td style="vertical-align:top;width:500px;">
  <![endif]-->
  <div id="u_column_1" class="email-col-100 outlook-group-fix u_column" style="vertical-align:top;display:inline-block;direction:ltr;font-size:13px;text-align:left;width:100%;">
    
<table id="u_content_button_2" class="u_content_button" style="font-family:arial,helvetica,sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
  <tbody>
    <tr>
      <td style="overflow-wrap: break-word;padding:10px;font-family:arial,helvetica,sans-serif;" align="left">
        
<div align="center">
  <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="border-spacing: 0; border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;font-family:arial,helvetica,sans-serif;"><tr><td style="font-family:arial,helvetica,sans-serif;" align="center"><v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="" style="height:36px; v-text-anchor:middle; width:110px;" arcsize="11%" stroke="f" fillcolor="#3AAEE0"><w:anchorlock/><center style="color:#FFFFFF;font-family:arial,helvetica,sans-serif;"><![endif]-->
    <a href="" target="_blank" style="display: inline-block;font-family:arial,helvetica,sans-serif;text-decoration: none;-webkit-text-size-adjust: none;text-align: center;color: #FFFFFF; background-color: #3AAEE0; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; width: auto; padding: 10px 20px; mso-border-alt: none;">
      <span style="line-height:120%;">Button Text</span>
    </a>
  <!--[if mso]></center></v:roundrect></td></tr></table><![endif]-->
</div>

      </td>
    </tr>
  </tbody>
</table>

<table id="u_content_button_3" class="u_content_button" style="font-family:arial,helvetica,sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
  <tbody>
    <tr>
      <td style="overflow-wrap: break-word;padding:10px;font-family:arial,helvetica,sans-serif;" align="left">
        
<div align="center">
  <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="border-spacing: 0; border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;font-family:arial,helvetica,sans-serif;"><tr><td style="font-family:arial,helvetica,sans-serif;" align="center"><v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="" style="height:36px; v-text-anchor:middle; width:110px;" arcsize="11%" stroke="f" fillcolor="#3AAEE0"><w:anchorlock/><center style="color:#FFFFFF;font-family:arial,helvetica,sans-serif;"><![endif]-->
    <a href="" target="_blank" style="display: inline-block;font-family:arial,helvetica,sans-serif;text-decoration: none;-webkit-text-size-adjust: none;text-align: center;color: #FFFFFF; background-color: #3AAEE0; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; width: auto; padding: 10px 20px; mso-border-alt: none;">
      <span style="line-height:120%;">Button Text</span>
    </a>
  <!--[if mso]></center></v:roundrect></td></tr></table><![endif]-->
</div>

      </td>
    </tr>
  </tbody>
</table>

<table id="u_content_button_4" class="u_content_button" style="font-family:arial,helvetica,sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
  <tbody>
    <tr>
      <td style="overflow-wrap: break-word;padding:10px;font-family:arial,helvetica,sans-serif;" align="left">
        
<div align="center">
  <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="border-spacing: 0; border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;font-family:arial,helvetica,sans-serif;"><tr><td style="font-family:arial,helvetica,sans-serif;" align="center"><v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="" style="height:45px; v-text-anchor:middle; width:120px;" arcsize="9%" stroke="f" fillcolor="#3AAEE0"><w:anchorlock/><center style="color:#FFFFFF;font-family:arial,helvetica,sans-serif;"><![endif]-->
    <a href="" target="_blank" style="display: inline-block;font-family:arial,helvetica,sans-serif;text-decoration: none;-webkit-text-size-adjust: none;text-align: center;color: #FFFFFF; background-color: #3AAEE0; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; width: auto; padding: 10px 20px; mso-border-alt: none;">
      <span style="line-height:120%;">Button Text</span>
    </a>
  <!--[if mso]></center></v:roundrect></td></tr></table><![endif]-->
</div>

      </td>
    </tr>
  </tbody>
</table>

<table id="u_content_button_1" class="u_content_button" style="font-family:arial,helvetica,sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
  <tbody>
    <tr>
      <td style="overflow-wrap: break-word;padding:10px;font-family:arial,helvetica,sans-serif;" align="left">
        
<div align="center">
  <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="border-spacing: 0; border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;font-family:arial,helvetica,sans-serif;"><tr><td style="font-family:arial,helvetica,sans-serif;" align="center"><v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="" style="height:45px; v-text-anchor:middle; width:120px;" arcsize="9%" stroke="f" fillcolor="#3AAEE0"><w:anchorlock/><center style="color:#FFFFFF;font-family:arial,helvetica,sans-serif;"><![endif]-->
    <a href="" target="_blank" style="display: inline-block;font-family:arial,helvetica,sans-serif;text-decoration: none;-webkit-text-size-adjust: none;text-align: center;color: #FFFFFF; background-color: #3AAEE0; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; width: auto; padding: 10px 20px; mso-border-alt: none;">
      <span style="line-height:120%;">Button Text</span>
    </a>
  <!--[if mso]></center></v:roundrect></td></tr></table><![endif]-->
</div>

      </td>
    </tr>
  </tbody>
</table>

  </div>
  <!--[if mso | IE]>
  </td>
</tr></table>
                <![endif]-->
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <!--[if mso | IE]>
      </td></tr></table>
      <![endif]-->
    </td>
  </tr>
</table>

  </div>
</body>

</html>

and the errors:

index.js:49 unable to copy using execCommand:  Error: copy command was unsuccessful
    at copy (index.js:45)
    at Object.eval (EmailCanvas.js:119)
    at e.value (embed.js:1)
    at e.value (embed.js:1)
    at embed.js:1
copy @ index.js:49
(anonymous) @ EmailCanvas.js:119
value @ embed.js:1
value @ embed.js:1
(anonymous) @ embed.js:1
index.js:50 trying IE specific stuff
copy @ index.js:50
(anonymous) @ EmailCanvas.js:119
value @ embed.js:1
value @ embed.js:1
(anonymous) @ embed.js:1
index.js:55 unable to copy using clipboardData:  TypeError: Cannot read property 'setData' of undefined
    at copy (index.js:52)
    at Object.eval (EmailCanvas.js:119)
    at e.value (embed.js:1)
    at e.value (embed.js:1)
    at embed.js:1
copy @ index.js:55
(anonymous) @ EmailCanvas.js:119
value @ embed.js:1
value @ embed.js:1
(anonymous) @ embed.js:1
index.js:56 falling back to prompt

addRange fails in Chrome in some context

I have a very specific issue in Chrome.

The first attempt to copy the content of an input content fails because somehow when document.body.appendChild(mark) is called in copy() the selection is not null.
Instead the type in selection.type is set to Caret and so the rangeCountis equal to 1. Which, I suppose, made addRange fails due, I suppose again, to this error in my console:

[Deprecation] The behavior that Selection.addRange() merges existing Range and the specified Range was removed. See https://www.chromestatus.com/features/6680566019653632 for more details.

If I click somewhere in my input before the copy, it works. Don't know what's the mess with the caret?!

I'm on a mac and it works in safari. Also I'm using copy-to-clipboard through react-copy-to-clipboard.

Thanks

EDIT: As a work around I put a autofocus on the input field and it works.

Detect touch devices.

As suggested by @shvaikalesh in #3, just considering this a separate issue.

Also, messages like "double tap and choose copy" can be displayed on handheld devices.

Furthermore, it is possible to detect whether virtual keyboard or hardware one is used (innerHeight property of window shrinks when most of mobile keyboards slide up, except for iOS).

Error using clipboard-copy on glitch.com

I am hosting my app on glitch.com and running the code below give an error message

Code:

const copy = require('clipboard-copy');

copy('copied');

Error Message:
UnhandledPromiseRejectionWarning: ReferenceError: navigator is not defined at clipboardCopy (/rbd/pnpm-volume/9f6c9fba-aa0c-4aca-a74c-4ee444e59487/node_modules/.registry.npmjs.org/clipboard-copy/2.0.1/node_modules/clipboard-copy/index.js:5:3)

Consider replacing the use of `selectNode` by `selectAllChildren` or `selectNodeContents`

In the current version of the library, we select the text to be copied by using this code:

range.selectNode(mark);
selection.addRange(range);

The problem with selectNode is that it selects the Node itself, which has comme unfortunate consequence that the Selection object gets focusNode and anchorNode set to body which is the parent of the element. This is expected according to MDN:

The Range.selectNode() method sets the Range to contain the Node and its contents. The parent Node of the start and end of the Range will be the same as the parent of the referenceNode.

The direct consequence is that the copy event's target is then body, while it would be better if it was the range itself (more about that below).

An easy way to fix it is to replace range.selectNode by range.selectNodeContents. Another way is to replace using a range and directly use selection.selectAllChildren, but then we need to also change (maybe simplify?) the way we remove the selection by always calling selection.removeAllRanges().

Now, why is that useful ?
Because I think the component should stop the propagation of the "copy" event by adding something like:

    mark.addEventListener('copy', e => e.stopPropagation());

This is useful because applications commonly add a copy event handler on the body to handle ctrl-c operations (that's what we do in our app indeed!). It's on body because there are some cross-browser issues about what the target should be in some situations.

But in my opinion the copy event provoked by copy-to-clipboard is an unfortunate side effect of the method we use to copy, and so it should just be invisible to the outer code.

I'll be happy to do the patch if you think the changes are useful.

with mark.innerHTML isn't possible copy iframe string

With mark.textContent it worked fine.
I have for example this string <iframe src="http://google.com" width="960" height="1300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" style="overflow: hidden;"> and it won't copy at all, no error is displayed.

OS detection

window.prompt('Copy to clipboard: Ctrl+C, Enter', text);

It is Cmd+C on Mac, and it would be great if copy-button did some UA/OS sniffing to show appropriate messages.

Also, messages like "double tap and choose copy" can be displayed on handheld devices.

Furthermore, it is possible to detect whether virtual keyboard or hardware one is used (innerHeight property of window shrinks when most of mobile keyboards slide up, except for iOS).

Just couple of ideas of mine.

Fragments Break Copy Functionality

Giving CopyToClipboard a fragment as a child will break the copy functionality

  return (
    <CopyToClipboard text={url} onCopy={toggle}>
      <>
        <Button key="clipboard" icon tooltipLabel={t('Copy Link')}>
          link
        </Button>
      </>
    </CopyToClipboard>
  )

Add prompt config

It would be great if we could configure the prompt text "Copy to clipboard: Ctrl+C, Enter".

Getting error

(node:57623) UnhandledPromiseRejectionWarning: TypeError: reselectPrevious is not a function
at copy (/Users/butuzgol/Desktop/game/game/node_modules/copy-to-clipboard/index.js:72:5)
at start$ (/Users/butuzgol/Desktop/game/game/data/helpers.js:38:3)
at tryCatch (/Users/butuzgol/Desktop/game/game/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:65:40)

Prompt on cypress

Prompt alert when testing the application with cypress. Is there a way to solve it?

Not working in FF Version 42

I am using this in my react component and found that for FF 36 and 42.0 it's not working. Do you know any workaround to solve this issue

Uncaught RangeError: Maximum call stack size exceeded.

yo. I reported this error after using it, but it did copy the content to the clipboard. What is the cause of this?

index.js:19 Uncaught RangeError: Maximum call stack size exceeded.
    at push../node_modules/toggle-selection/index.js.module.exports (index.js:19)
    at copy (index.js:28)
    at App.copyText (App.js:101)
    at HTMLUnknownElement.callCallback (react-dom.development.js:363)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:412)
    at invokeGuardedCallback (react-dom.development.js:465)
    at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:480)
    at executeDispatch (react-dom.development.js:613)
    at executeDispatchesInOrder (react-dom.development.js:638)
    at executeDispatchesAndRelease (react-dom.development.js:743)
    at executeDispatchesAndReleaseTopLevel (react-dom.development.js:752)
    at forEachAccumulated (react-dom.development.js:724)
    at runEventsInBatch (react-dom.development.js:769)
    at runExtractedPluginEventsInBatch (react-dom.development.js:915)
    at handleTopLevel (react-dom.development.js:5866)
    at batchedEventUpdates (react-dom.development.js:1454)
    at dispatchEventForPluginEventSystem (react-dom.development.js:5966)
    at attemptToDispatchEvent (react-dom.development.js:6083)
    at dispatchEvent (react-dom.development.js:5986)
    at unstable_runWithPriority (scheduler.development.js:818)
    at runWithPriority$2 (react-dom.development.js:12259)
    at discreteUpdates$1 (react-dom.development.js:24328)
    at discreteUpdates (react-dom.development.js:1485)
    at dispatchDiscreteEvent (react-dom.development.js:5949)
    at index.js:37
    at copy (index.js:91)
    at App.copyText (App.js:101)
    at HTMLUnknownElement.callCallback (react-dom.development.js:363)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:412)
    at invokeGuardedCallback (react-dom.development.js:465)
    at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:480)
    at executeDispatch (react-dom.development.js:613)
    at executeDispatchesInOrder (react-dom.development.js:638)
    at executeDispatchesAndRelease (react-dom.development.js:743)
    at executeDispatchesAndReleaseTopLevel (react-dom.development.js:752)
    at forEachAccumulated (react-dom.development.js:724)
    at runEventsInBatch (react-dom.development.js:769)
    at runExtractedPluginEventsInBatch (react-dom.development.js:915)
    at handleTopLevel (react-dom.development.js:5866)
    at batchedEventUpdates (react-dom.development.js:1454)
    at dispatchEventForPluginEventSystem (react-dom.development.js:5966)
    at attemptToDispatchEvent (react-dom.development.js:6083)
    at dispatchEvent (react-dom.development.js:5986)
    at unstable_runWithPriority (scheduler.development.js:818)
    at runWithPriority$2 (react-dom.development.js:12259)
    at discreteUpdates$1 (react-dom.development.js:24328)
    at discreteUpdates (react-dom.development.js:1485)
    at dispatchDiscreteEvent (react-dom.development.js:5949)
    at index.js:37
    at copy (index.js:91)

Define "older IOS versions"

Can you please define what is considered an "olde ios version" that this script wont work with? I mean, anything but the latest patch would be considered older and I dont think thats the case. What version and under does it actually not work on of iOS? 8?

Unable to get property 'clearData' of undefined or null reference

Hello,

Currently I got hit with the issue mentioned above that Unable to get property 'clearData' of undefined or null reference. This issue happens only when users they use IE 11 and unfortunately, there is no way of making them use another browser for now.

Outputting the message from Sentry:
Unable to get property 'clearData' of undefined or null reference

 e.stopPropagation();
 if (options.format) {
    e.preventDefault();
    e.clipboardData.clearData();
    e.clipboardData.setData(options.format, text);
 }
});
  document.body.appendChild(mark);
  range.selectNodeContents(mark);
  selection.addRange(range);

Is there a solution for this issue? Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.