From 63a2fa94745b5ef25bbbdd6faefdff0dc4d80999 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 3 Nov 2023 13:05:15 +0530 Subject: [PATCH] Revert removal of context menu for sandboxed iframes The context menu is needed for copying text on mobile devices. --- src/pyj/utils.pyj | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/pyj/utils.pyj b/src/pyj/utils.pyj index c6a6ca0636..1a2a6256f6 100644 --- a/src/pyj/utils.pyj +++ b/src/pyj/utils.pyj @@ -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'{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