microsoft / monaco-editor

A browser based code editor

Home Page:https://microsoft.github.io/monaco-editor/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] Safari: non-https site reports `undefined is not an object (evaluating 'navigator.clipboard.write')`

wxiaoguang opened this issue · comments

Reproduction Steps

  • Use monaco-editor on a "http" site (v0.48.0), (do not use localhost, use local IP like http://192.168.1.20)
  • Use Safari to open the page, input anything
  • Then navigator.clipboard.write triggers the bug
    installWebKitWriteTextWorkaround() {
        const handler = () => {
            ....
            navigator.clipboard.write([new ClipboardItem({ // !!!!!!!!!!!!!! BUG HERE !!!!!!!!!!!!!!!!!!!!!
                    'text/plain': currentWritePromise.p,
                })])
            ....
        };