Better error message when clipboard is not available

This commit is contained in:
Kovid Goyal 2020-08-09 17:24:40 +05:30
parent 34375f5891
commit 4bf48d8d99
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -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'))
)