mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit book: Preview panel: Fix hyphenation at end of line being rendered as boxes on macOS. Fixes #1958730 [Ebook editor: Breaking long words at the ends of lines causing boxes to be rendered instead of hyphens on macOS](https://bugs.launchpad.net/calibre/+bug/1958730)
This commit is contained in:
parent
ad12732edc
commit
0172b61217
@ -20,7 +20,8 @@ from threading import Thread
|
|||||||
|
|
||||||
from calibre import prints
|
from calibre import prints
|
||||||
from calibre.constants import (
|
from calibre.constants import (
|
||||||
FAKE_HOST, FAKE_PROTOCOL, __version__, is_running_from_develop
|
FAKE_HOST, FAKE_PROTOCOL, __version__, is_running_from_develop, ismacos,
|
||||||
|
iswindows
|
||||||
)
|
)
|
||||||
from calibre.ebooks.oeb.base import OEB_DOCS, XHTML_MIME, serialize
|
from calibre.ebooks.oeb.base import OEB_DOCS, XHTML_MIME, serialize
|
||||||
from calibre.ebooks.oeb.polish.parsing import parse
|
from calibre.ebooks.oeb.polish.parsing import parse
|
||||||
@ -252,6 +253,7 @@ def get_editor_settings(tprefs):
|
|||||||
'bg': get_color('preview_background', dark_color),
|
'bg': get_color('preview_background', dark_color),
|
||||||
'fg': get_color('preview_foreground', dark_text_color),
|
'fg': get_color('preview_foreground', dark_text_color),
|
||||||
'link': get_color('preview_link_color', dark_link_color),
|
'link': get_color('preview_link_color', dark_link_color),
|
||||||
|
'os': 'windows' if iswindows else ('macos' if ismacos else 'linux'),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -208,11 +208,13 @@ def load_mathjax():
|
|||||||
|
|
||||||
|
|
||||||
if document.body:
|
if document.body:
|
||||||
|
settings = JSON.parse(window.navigator.userAgent.split('|')[1])
|
||||||
|
css = '[data-in-split-mode="1"] [data-is-block="1"]:hover { cursor: pointer !important; border-top: solid 5px green !important }'
|
||||||
|
if settings.os is 'macos':
|
||||||
|
# See settings.pyj for reason for webkit-hyphenate-character
|
||||||
|
css += '\n* { -webkit-hyphenate-character: "-" !important }\n'
|
||||||
document.body.addEventListener('click', onclick, True)
|
document.body.addEventListener('click', onclick, True)
|
||||||
document.documentElement.appendChild(E.style(
|
document.documentElement.appendChild(E.style(type='text/css', css))
|
||||||
type='text/css',
|
|
||||||
'[data-in-split-mode="1"] [data-is-block="1"]:hover { cursor: pointer !important; border-top: solid 5px green !important }'
|
|
||||||
))
|
|
||||||
|
|
||||||
fix_fullscreen_svg_images()
|
fix_fullscreen_svg_images()
|
||||||
if check_for_maths():
|
if check_for_maths():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user