mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-14 12:11:43 +01:00
Fixes microsoft/monaco-editor#2313: navigator.clipboard is not defined when loading not secure, via http
This commit is contained in:
@@ -27,7 +27,8 @@ const supportsCopy = (platform.isNative || document.queryCommandSupported('copy'
|
||||
const supportsCopyWithSyntaxHighlighting = (supportsCopy && !browser.isEdge);
|
||||
// Firefox only supports navigator.clipboard.readText() in browser extensions.
|
||||
// See https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/readText#Browser_compatibility
|
||||
const supportsPaste = (browser.isFirefox ? document.queryCommandSupported('paste') : true);
|
||||
// When loading over http, navigator.clipboard can be undefined. See https://github.com/microsoft/monaco-editor/issues/2313
|
||||
const supportsPaste = (typeof navigator.clipboard === 'undefined' || browser.isFirefox) ? document.queryCommandSupported('paste') : true;
|
||||
|
||||
function registerCommand<T extends Command>(command: T): T {
|
||||
command.register();
|
||||
|
||||
Reference in New Issue
Block a user