Fix #2033947 [Content Server returning error messages (Running from source*)](https://bugs.launchpad.net/calibre/+bug/2033947)

This commit is contained in:
Kovid Goyal 2023-09-02 14:24:35 +05:30
parent fef4b97a03
commit 9982065666
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -242,7 +242,10 @@ def sandboxed_html(html, style, sandbox):
final_html = f'<!DOCTYPE html><html><head><style>{css}</style></head><body>{html}</body></html>' final_html = f'<!DOCTYPE html><html><head><style>{css}</style></head><body>{html}</body></html>'
# prevent context menu on right click in iframe # prevent context menu on right click in iframe
ans.addEventListener('load', def(ev): ans.addEventListener('load', def(ev):
ev.target.contentWindow.addEventListener('contextmenu', def(e): e.preventDefault();) try:
ev.target.contentWindow.addEventListener('contextmenu', def(e): e.preventDefault();)
except:
pass
) )
ans.srcdoc = final_html ans.srcdoc = final_html
return ans return ans