clipboard.js IE下 不允许复制时, 问题修改

问题描述:
https://github.com/zenorocha/clipboard.js/wiki/Known-Issues
On IE9-11 there's a prompt that asks if the user wants to allow access to his/her clipboard.
If the user allows, everything will work as expected. But if the user denies access, it will still emit the success event. The root cause of the problem is that document.execCommand returns true even if it does not have permissions.

//original code:
try { e = document.execCommand(this.action) } catch (n) { e = !1 }
//moidfied code:
try { e = window.clipboardData ? window.clipboardData.setData('Text', this.selectedText) : document.execCommand(this.action) } catch (n) { e = !1 }

  

上一篇:(转)ios 代码规范


下一篇:grub4dos新手指南-1