From e7fa005d96f0db60297193f6810037d387c62550 Mon Sep 17 00:00:00 2001 From: LilyMakesThings <127533508+LilyMakesThings@users.noreply.github.com> Date: Fri, 30 Jun 2023 04:52:24 +0100 Subject: [PATCH] codeGIO/ExtraUtilities: update clipboard blocks for consistency (#636) --- extensions/codeGIO/ExtraUtilities.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/extensions/codeGIO/ExtraUtilities.js b/extensions/codeGIO/ExtraUtilities.js index ff188064fe..3c7414dde4 100644 --- a/extensions/codeGIO/ExtraUtilities.js +++ b/extensions/codeGIO/ExtraUtilities.js @@ -326,12 +326,19 @@ } set_clipboard(args) { - navigator.clipboard.writeText(args.one); + if (navigator.clipboard && navigator.clipboard.writeText) { + navigator.clipboard.writeText(args.one); + } } get_clipboard() { if (navigator.clipboard && navigator.clipboard.readText) { - return navigator.clipboard.readText(); + return Scratch.canReadClipboard().then(allowed => { + if (allowed) { + return navigator.clipboard.readText(); + } + return ''; + }); } return ''; }