Viewer: Set the classes calibre-viewer-paginated and calibre-viewer-scrolling on the <body> tag in Paged and Flow modes. This allows the User styles to target these modes, if needed. Fixes #1847427 [Request New Feature](https://bugs.launchpad.net/calibre/+bug/1847427)

This commit is contained in:
Kovid Goyal 2019-10-09 13:06:14 +05:30
parent 6f09624280
commit e2ded28390
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 6 additions and 2 deletions

View File

@ -251,6 +251,7 @@ class IframeBoss:
document.documentElement.style.overflow = 'hidden'
if self.is_titlepage and not opts.cover_preserve_aspect_ratio:
document.body.classList.add('cover-fill')
document.body.classList.add(f'calibre-viewer-{window.navigator.epubReadingSystem.layoutStyle}')
self.last_window_width, self.last_window_height = scroll_viewport.width(), scroll_viewport.height()
apply_settings()
self.fix_fullscreen_svg_images()

View File

@ -103,9 +103,12 @@ def create_user_stylesheet_panel(container, apply_func, cancel_func):
_('A CSS style sheet that can be used to control the look and feel of the text. For examples, click'), ' ',
E.a(class_='blue-link', title=_("Examples of user style sheets"),
target=('_self' if runtime.is_standalone_viewer else '_blank'),
href='https://www.mobileread.com/forums/showthread.php?t=51500', _('here'))
href='https://www.mobileread.com/forums/showthread.php?t=51500', _('here.')),
' ', _(
'Note that you can use the selectors body.calibre-viewer-paginated and body.calibre-viewer-scrolling'
' to target the Paged and Flow modes.')
),
E.textarea(name='user-stylesheet', style='width: 100%; margin-top: 1ex; box-sizing: border-box; flex-grow: 10')
E.textarea(name='user-stylesheet', style='width: 100%; margin-top: 1ex; box-sizing: border-box; flex-grow: 10'),
)
)
)