mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Revert removal of context menu for sandboxed iframes
The context menu is needed for copying text on mobile devices.
This commit is contained in:
parent
909654fa39
commit
63a2fa9474
@ -240,12 +240,5 @@ def sandboxed_html(html, style, sandbox):
|
||||
css = 'html, body { margin: 0; padding: 0; font-family: __FONT__ } p:first-child { margin-top: 0; padding-top: 0; -webkit-margin-before: 0 }'.replace('__FONT__', get_font_family())
|
||||
css += style or ''
|
||||
final_html = f'<!DOCTYPE html><html><head><style>{css}</style></head><body>{html}</body></html>'
|
||||
# prevent context menu on right click in iframe
|
||||
ans.addEventListener('load', def(ev):
|
||||
try:
|
||||
ev.target.contentWindow.addEventListener('contextmenu', def(e): e.preventDefault();)
|
||||
except:
|
||||
pass
|
||||
)
|
||||
ans.srcdoc = final_html
|
||||
return ans
|
||||
|
Loading…
x
Reference in New Issue
Block a user