copy-to-clipboard icon indicating copy to clipboard operation
copy-to-clipboard copied to clipboard

Should check options.format for other browser

Open qrqhuang opened this issue 5 years ago • 1 comments

for this code fragment, Is it necessary for other browser to check options.format ?

I config wrong with format: 'plain' , and then nothing could paste.

if (typeof e.clipboardData === "undefined") { // IE 11
  debug && console.warn("unable to use e.clipboardData");
  debug && console.warn("trying IE specific stuff");
  window.clipboardData.clearData();
  var format = clipboardToIE11Formatting[options.format] || clipboardToIE11Formatting["default"]
  window.clipboardData.setData(format, text);
} else { // all other browsers
  e.clipboardData.clearData();
  e.clipboardData.setData(options.format, text);
}

qrqhuang avatar Aug 03 '20 10:08 qrqhuang

Which more strange thing is when I import js from wzrd.in , code above runs well. Cause stuck of cdn site , I could not compare source with them.

qrqhuang avatar Aug 03 '20 10:08 qrqhuang