style(reader): apply code formatting to existing format files

Run code formatting (prettier/eslint) on existing reader format files that
were not migrated to the new structure. This ensures consistent code style
across the codebase.

## Changes

### Formatting Applied
- Added newlines at end of files
- Fixed line length and indentation
- Updated import statements for consistency
- Applied code style rules uniformly

### Files Affected
- **Comic**: background-color, chapter-markers, page-order, panel-gap
- **Ebook**: font-loader, search, view-modes
- **Manga**: vertical-scroll-mode
- **PDF**: annotation-layer, pdf-navigation, pdf-text-selection

## Purpose

These files will be removed in subsequent commits as they are replaced by
the new modular structure. The formatting ensures consistency during the
transition period and maintains code quality standards.

Note: These are non-functional formatting changes only. No logic or behavior
was modified in this commit.
This commit is contained in:
2026-04-09 14:54:16 -04:00
parent ef5f6370d3
commit 43eee2170d
41 changed files with 238 additions and 4233 deletions
+31 -16
View File
@@ -1,25 +1,34 @@
// Annotation layer for rendering highlights and notes on PDFs
// Feature Registration Pattern implementation
import type { ReaderContext } from "../core/reader-context";
import { ReaderContext } from "../core/reader-context";
export function init(context: ReaderContext): void {
const highlights = new Map<string, HTMLElement>();
context.events.on("pdf:highlights:render", (detail: { container: HTMLElement; highlights: any[] }) => {
clearPDFHighlights(detail.container);
for (const highlight of detail.highlights) {
renderSinglePDFHighlight(detail.container, highlight, highlights);
}
});
context.events.on(
"pdf:highlights:render",
(detail: { container: HTMLElement; highlights: any[] }) => {
clearPDFHighlights(detail.container);
for (const highlight of detail.highlights) {
renderSinglePDFHighlight(detail.container, highlight, highlights);
}
},
);
context.events.on("pdf:highlights:clear", (detail: { container: HTMLElement }) => {
clearPDFHighlights(detail.container);
});
context.events.on(
"pdf:highlights:clear",
(detail: { container: HTMLElement }) => {
clearPDFHighlights(detail.container);
},
);
context.events.on("pdf:highlight:remove", (detail: { highlightId: string }) => {
removePDFHighlight(detail.highlightId, highlights);
});
context.events.on(
"pdf:highlight:remove",
(detail: { highlightId: string }) => {
removePDFHighlight(detail.highlightId, highlights);
},
);
context.events.on("reader:unload", () => {
highlights.forEach((element) => element.remove());
@@ -90,7 +99,9 @@ function parseColor(color: string): string {
function showNotePopup(highlight: PDFHighlight): void {
console.log("Show note for highlight:", highlight.id);
const event = new CustomEvent("pdf:note-show", { detail: { highlightId: highlight.id } });
const event = new CustomEvent("pdf:note-show", {
detail: { highlightId: highlight.id },
});
window.dispatchEvent(event);
}
@@ -99,10 +110,14 @@ export function clearPDFHighlights(container: HTMLElement): void {
Array.from(highlights).forEach((element) => element.remove());
}
export function removePDFHighlight(highlightId: string, highlights: Map<string, HTMLElement>): void {
export function removePDFHighlight(
highlightId: string,
highlights: Map<string, HTMLElement>,
): void {
const element = highlights.get(highlightId);
if (element) {
element.remove();
highlights.delete(highlightId);
}
}
}