From 4c0bde0811a012537a67b07e83557bdc918841c0 Mon Sep 17 00:00:00 2001 From: m1k1o Date: Sun, 12 Jul 2020 21:34:44 +0200 Subject: [PATCH] clipboard_available getter --- client/src/components/video.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client/src/components/video.vue b/client/src/components/video.vue index 28014bd..763c37c 100644 --- a/client/src/components/video.vue +++ b/client/src/components/video.vue @@ -34,7 +34,7 @@
  • - + @@ -237,6 +237,10 @@ return this.$accessor.settings.scroll_invert } + get clipboard_available() { + return 'clipboard' in navigator + } + get clipboard() { return this.$accessor.remote.clipboard } @@ -310,7 +314,7 @@ @Watch('clipboard') onClipboardChanged(clipboard: string) { - if (navigator.clipboard && typeof navigator.clipboard.writeText === 'function') { + if (this.clipboard_available && typeof navigator.clipboard.writeText === 'function') { navigator.clipboard.writeText(clipboard).catch(console.error) } } @@ -428,7 +432,7 @@ return } - if (this.hosting && navigator.clipboard && typeof navigator.clipboard.readText === 'function') { + if (this.hosting && this.clipboard_available && typeof navigator.clipboard.readText === 'function') { navigator.clipboard .readText() .then(text => {