From 4bf48d8d998bce94a4939d3483e0ee02c51641ff Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 9 Aug 2020 17:24:40 +0530 Subject: [PATCH] Better error message when clipboard is not available --- src/pyj/read_book/ui.pyj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pyj/read_book/ui.pyj b/src/pyj/read_book/ui.pyj index 3fab594aa6..e1fe7c06a1 100644 --- a/src/pyj/read_book/ui.pyj +++ b/src/pyj/read_book/ui.pyj @@ -78,6 +78,10 @@ class ReadUI: ui_operations.open_url = def(url): window.open(url, '_blank') ui_operations.copy_selection = def(text): + if not window.navigator.clipboard: + return error_dialog(_('No clipboard access'), _( + 'Your browser requires you to access the Content server over an HTTPS connection' + ' to be able to copy to clipboard.')) window.navigator.clipboard.writeText(text or '').then(def (): pass;, def(): error_dialog(_('Could not copy to clipboard'), _('No permission to write to clipboard')) )