E-book viewer: Add support for HTML image maps. Fixes #2040487 [Image hotspots using map tag results in error message](https://bugs.launchpad.net/calibre/+bug/2040487)

This commit is contained in:
Kovid Goyal 2023-10-25 19:06:00 +05:30
parent 2feaa3e854
commit 9763120b3d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 3 additions and 3 deletions

View File

@ -432,7 +432,7 @@ def transform_inline_styles(container, name, transform_sheet, transform_style):
def transform_html(container, name, virtualize_resources, link_uid, link_to_map, virtualized_names):
link_xpath = XPath('//h:a[@href]')
link_xpath = XPath('//h:*[@href and (self::h:a or self::h:area)]')
svg_link_xpath = XPath('//svg:a')
img_xpath = XPath('//h:img[@src]')
svg_img_xpath = XPath('//svg:image[@xl:href]')
@ -604,7 +604,7 @@ def worker_main():
def virtualize_html(container, name, link_uid, link_to_map, virtualized_names):
changed = set()
link_xpath = XPath('//h:a[@href]')
link_xpath = XPath('//h:*[@href and (self::h:a or self::h:area)]')
svg_link_xpath = XPath('//svg:a')
link_replacer = create_link_replacer(container, link_uid, changed)

View File

@ -691,7 +691,7 @@ class IframeBoss:
self.comm.send_message(action, data)
def connect_links(self):
for a in document.body.querySelectorAll(f'a[{self.link_attr}]'):
for a in document.body.querySelectorAll(f'a[{self.link_attr}],area[{self.link_attr}]'):
a.addEventListener('click', self.link_activated)
if runtime.is_standalone_viewer:
# links with a target get turned into requests to open a new window by Qt