mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-06 12:54:57 +01:00
Implement simple speech for the browser viewer
This commit is contained in:
parent
85bf7f823e
commit
d9592d090b
1 changed files with 6 additions and 0 deletions
|
|
@ -113,6 +113,12 @@ def __init__(self):
|
|||
window.navigator.clipboard.writeText(text or '').then(def (): pass;, def():
|
||||
error_dialog(_('Could not copy to clipboard'), _('No permission to write to clipboard'))
|
||||
)
|
||||
ui_operations.speak_simple_text = def (text):
|
||||
if not window.speechSynthesis:
|
||||
return error_dialog(_('No speech support'), _(
|
||||
'Your browser does not have support for Speech'))
|
||||
ut = new SpeechSynthesisUtterance(text) # noqa
|
||||
window.speechSynthesis.speak(ut)
|
||||
|
||||
def on_resize(self):
|
||||
self.view.on_resize()
|
||||
|
|
|
|||
Loading…
Reference in a new issue