feat(pdf): move ebook reader to embedpdf, add bookmarks, remove old pdf.js stuff (#393)

* feat(pdf): move ebook reader to embedpdf, add bookmarks, remove old pdf.js stuff

* feat(pdf): add page number support for bookmarks and enhance mobile navigation

* feat(pdf): implement document ID tracking for search functionality

* feat(pdf): add page number column to book marks and update unique index

* feat(pdf): enhance annotation handling and improve search result scrolling

* feat(pdf): improve layout handling and enhance resize observer functionality

* feat(pdf): improve document viewer initialization and improve close button styling

* fix(pdf): remove 'form' from disabled categories

* feat(pdf): add pan mode functionality and enhance sidebar layout

* feat(pdf): improve book viewer initialization with enhanced element detection

* feat(pdf): add link handling to text selection and improve popup actions

* feat(pdf): enhance link detection and improve selection handling in event service

* feat(pdf): improve accessibility and improve resource management in PDF viewer

* feat(pdf): add resize observer for improved layout handling

* feat(pdf): error handling and improve navigation in PDF reader
This commit is contained in:
brios
2026-04-22 17:27:07 -04:00
committed by Zach Yale
parent e3b22ed9c6
commit 6c8a907325
29 changed files with 3681 additions and 724 deletions
@@ -35,7 +35,8 @@ export type ReaderIconName =
| 'long-strip'
| 'direction-ltr'
| 'direction-rtl'
| 'magnifier';
| 'magnifier'
| 'link';
interface IconPath {
d: string;
@@ -199,6 +200,10 @@ const ICONS: Record<ReaderIconName, IconPath[]> = {
{d: 'M21 21l-5-5'},
{d: 'M7,10 L13,10', type: 'line'},
{d: 'M10,7 L10,13', type: 'line'}
],
'link': [
{d: 'M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71'},
{d: 'M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71'}
]
};
@@ -10,6 +10,13 @@
<app-reader-icon name="copy" [size]="16"></app-reader-icon>
</button>
@if (linkUrl) {
<div class="divider"></div>
<button class="action-btn" (click)="onGoToLink()" [title]="t('goToLink')">
<app-reader-icon name="link" [size]="16"></app-reader-icon>
</button>
}
<div class="divider"></div>
<button class="action-btn" (click)="onSearch()" [title]="t('searchInBook')">
@@ -6,7 +6,7 @@ import {ReaderIconComponent} from './icon.component';
export type AnnotationStyle = 'highlight' | 'underline' | 'strikethrough' | 'squiggly';
export interface TextSelectionAction {
type: 'select' | 'annotate' | 'delete' | 'dismiss' | 'preview' | 'search' | 'note';
type: 'select' | 'annotate' | 'delete' | 'dismiss' | 'preview' | 'search' | 'note' | 'go-to-link';
color?: string;
style?: AnnotationStyle;
annotationId?: number;
@@ -37,6 +37,7 @@ export class TextSelectionPopupComponent {
@Input() showBelow = false;
@Input() overlappingAnnotationId: number | null = null;
@Input() selectedText = '';
@Input() linkUrl?: string;
@Output() action = new EventEmitter<TextSelectionAction>();
showAnnotationOptions = false;
@@ -122,6 +123,12 @@ export class TextSelectionPopupComponent {
this.hasPreview = false;
}
onGoToLink(): void {
if (this.linkUrl) {
this.action.emit({type: 'go-to-link'});
}
}
onNote(): void {
this.action.emit({type: 'note'});
this.showAnnotationOptions = false;