mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Browser viewer: Fix context menu not working in input controls
This commit is contained in:
parent
cbbcec8525
commit
8de5a4ed86
@ -21,7 +21,8 @@ from read_book.toc import create_toc_panel
|
|||||||
from read_book.word_actions import create_word_actions_panel
|
from read_book.word_actions import create_word_actions_panel
|
||||||
from session import get_device_uuid
|
from session import get_device_uuid
|
||||||
from utils import (
|
from utils import (
|
||||||
full_screen_element, full_screen_supported, is_ios, safe_set_inner_html
|
default_context_menu_should_be_allowed, full_screen_element,
|
||||||
|
full_screen_supported, is_ios, safe_set_inner_html
|
||||||
)
|
)
|
||||||
from widgets import create_button, create_spinner
|
from widgets import create_button, create_spinner
|
||||||
|
|
||||||
@ -537,7 +538,7 @@ class Overlay:
|
|||||||
self.panels = []
|
self.panels = []
|
||||||
|
|
||||||
def oncontextmenu(self, evt):
|
def oncontextmenu(self, evt):
|
||||||
if evt.target and evt.target.tagName and evt.target.tagName.toLowerCase() in ('input', 'textarea'):
|
if default_context_menu_should_be_allowed(evt):
|
||||||
return
|
return
|
||||||
evt.preventDefault()
|
evt.preventDefault()
|
||||||
self.handling_context_menu_event = evt
|
self.handling_context_menu_event = evt
|
||||||
|
@ -15,7 +15,8 @@ from modals import error_dialog, warning_dialog
|
|||||||
from read_book.content_popup import ContentPopupOverlay
|
from read_book.content_popup import ContentPopupOverlay
|
||||||
from read_book.create_annotation import AnnotationsManager, CreateAnnotation
|
from read_book.create_annotation import AnnotationsManager, CreateAnnotation
|
||||||
from read_book.globals import (
|
from read_book.globals import (
|
||||||
current_book, runtime, set_current_spine_item, ui_operations, rtl_page_progression
|
current_book, rtl_page_progression, runtime, set_current_spine_item,
|
||||||
|
ui_operations
|
||||||
)
|
)
|
||||||
from read_book.goto import get_next_section
|
from read_book.goto import get_next_section
|
||||||
from read_book.open_book import add_book_to_recently_viewed
|
from read_book.open_book import add_book_to_recently_viewed
|
||||||
@ -37,7 +38,8 @@ from read_book.toc import get_current_toc_nodes, update_visible_toc_nodes
|
|||||||
from read_book.touch import set_left_margin_handler, set_right_margin_handler
|
from read_book.touch import set_left_margin_handler, set_right_margin_handler
|
||||||
from session import get_device_uuid, get_interface_data
|
from session import get_device_uuid, get_interface_data
|
||||||
from utils import (
|
from utils import (
|
||||||
html_escape, is_ios, parse_url_params, safe_set_inner_html, username_key
|
default_context_menu_should_be_allowed, html_escape, is_ios, parse_url_params,
|
||||||
|
safe_set_inner_html, username_key
|
||||||
)
|
)
|
||||||
from viewer.constants import READER_BACKGROUND_URL
|
from viewer.constants import READER_BACKGROUND_URL
|
||||||
|
|
||||||
@ -221,6 +223,7 @@ class View:
|
|||||||
container.appendChild(
|
container.appendChild(
|
||||||
E.div(style='max-height: 100vh; width: 100vw; height: 100vh; overflow: hidden; display: flex; align-items: stretch', # container for horizontally aligned panels
|
E.div(style='max-height: 100vh; width: 100vw; height: 100vh; overflow: hidden; display: flex; align-items: stretch', # container for horizontally aligned panels
|
||||||
oncontextmenu=def (ev):
|
oncontextmenu=def (ev):
|
||||||
|
if not default_context_menu_should_be_allowed(ev):
|
||||||
ev.preventDefault()
|
ev.preventDefault()
|
||||||
,
|
,
|
||||||
|
|
||||||
|
@ -13,6 +13,12 @@ if !is_ios and window.navigator.platform is 'MacIntel' and window.navigator.maxT
|
|||||||
is_ios = True
|
is_ios = True
|
||||||
|
|
||||||
|
|
||||||
|
def default_context_menu_should_be_allowed(evt):
|
||||||
|
if evt.target and evt.target.tagName and evt.target.tagName.toLowerCase() in ('input', 'textarea'):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def debounce(func, wait, immediate=False):
|
def debounce(func, wait, immediate=False):
|
||||||
# Returns a function, that, as long as it continues to be invoked, will not
|
# Returns a function, that, as long as it continues to be invoked, will not
|
||||||
# be triggered. The function will be called after it stops being called for
|
# be triggered. The function will be called after it stops being called for
|
||||||
|
Loading…
x
Reference in New Issue
Block a user