fix: display hidden footnotes, closes #1847 (#1907)

This commit is contained in:
Huang Xin
2025-08-26 18:45:12 +08:00
committed by GitHub
parent 48212d892f
commit 3ea54e6725
4 changed files with 28 additions and 2 deletions
+13 -1
View File
@@ -101,6 +101,8 @@ export const EXTS: Record<BookFormat, string> = {
EPUB: 'epub',
PDF: 'pdf',
MOBI: 'mobi',
AZW: 'azw',
AZW3: 'azw3',
CBZ: 'cbz',
FB2: 'fb2',
FBZ: 'fbz',
@@ -228,7 +230,17 @@ export class DocumentLoader {
const fflate = await import('foliate-js/vendor/fflate.js');
const { MOBI } = await import('foliate-js/mobi.js');
book = await new MOBI({ unzlib: fflate.unzlibSync }).open(this.file);
format = 'MOBI';
const ext = this.file.name.split('.').pop()?.toLowerCase();
switch (ext) {
case 'azw':
format = 'AZW';
break;
case 'azw3':
format = 'AZW3';
break;
default:
format = 'MOBI';
}
} else if (this.isFB2()) {
const { makeFB2 } = await import('foliate-js/fb2.js');
book = await makeFB2(this.file);
@@ -218,6 +218,7 @@ export abstract class BaseAppService implements AppService {
};
// update book metadata when reimporting the same book
if (existingBook) {
existingBook.format = book.format;
existingBook.title = existingBook.title ?? book.title;
existingBook.sourceTitle = existingBook.sourceTitle ?? book.sourceTitle;
existingBook.author = existingBook.author ?? book.author;
+1 -1
View File
@@ -1,6 +1,6 @@
import { BookMetadata } from '@/libs/document';
export type BookFormat = 'EPUB' | 'PDF' | 'MOBI' | 'CBZ' | 'FB2' | 'FBZ';
export type BookFormat = 'EPUB' | 'PDF' | 'MOBI' | 'AZW' | 'AZW3' | 'CBZ' | 'FB2' | 'FBZ';
export type BookNoteType = 'bookmark' | 'annotation' | 'excerpt';
export type HighlightStyle = 'highlight' | 'underline' | 'squiggly';
export type HighlightColor = 'red' | 'yellow' | 'green' | 'blue' | 'violet';
+13
View File
@@ -363,6 +363,19 @@ export const getFootnoteStyles = () => `
margin: unset !important;
text-indent: unset !important;
}
div {
margin: unset !important;
padding: unset !important;
}
.epubtype-footnote,
aside[epub|type~="endnote"],
aside[epub|type~="footnote"],
aside[epub|type~="note"],
aside[epub|type~="rearnote"] {
display: block;
}
`;
const getTranslationStyles = (showSource: boolean) => `