mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Implement simple speech for the browser viewer
This commit is contained in:
parent
85bf7f823e
commit
d9592d090b
@ -113,6 +113,12 @@ class ReadUI:
|
|||||||
window.navigator.clipboard.writeText(text or '').then(def (): pass;, def():
|
window.navigator.clipboard.writeText(text or '').then(def (): pass;, def():
|
||||||
error_dialog(_('Could not copy to clipboard'), _('No permission to write to clipboard'))
|
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):
|
def on_resize(self):
|
||||||
self.view.on_resize()
|
self.view.on_resize()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user