fix(css): support style transformer for inline css (#2403)

* fix(css): support style transformer for inline css

* fix(eink): bold text for current chapter in the TOC, closes #2401
This commit is contained in:
Huang Xin
2025-11-05 01:36:46 +08:00
committed by GitHub
parent 9d301631ca
commit 0ec4e37c13
7 changed files with 48 additions and 4 deletions
@@ -129,13 +129,22 @@ const FoliateViewer: React.FC<{
if (viewSettings && detail.type === 'text/css')
return transformStylesheet(width, height, data);
if (viewSettings && bookData && detail.type === 'application/xhtml+xml') {
const ctx = {
const ctx: TransformContext = {
bookKey,
viewSettings,
width,
height,
primaryLanguage: bookData.book?.primaryLanguage,
content: data,
transformers: ['punctuation', 'footnote', 'whitespace', 'language', 'sanitizer'],
} as TransformContext;
transformers: [
'style',
'punctuation',
'footnote',
'whitespace',
'language',
'sanitizer',
],
};
return Promise.resolve(transformContent(ctx));
}
return data;
@@ -68,7 +68,7 @@ const TOCItemView = React.memo<{
className={clsx(
'flex w-full cursor-pointer items-center rounded-md py-4 sm:py-2',
isActive
? 'sm:bg-base-300/65 sm:hover:bg-base-300/75 sm:text-base-content text-blue-500'
? 'text-bold-in-eink sm:bg-base-300/65 sm:hover:bg-base-300/75 sm:text-base-content text-blue-500'
: 'sm:hover:bg-base-300/75',
)}
style={{