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.javascript

//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 }
相關文章
相關標籤/搜索