Update EPUBViewer.tsx

This commit is contained in:
Hirosashii 2025-11-21 01:27:05 -05:00 committed by GitHub
parent 381d5c8048
commit 84c5d3abcf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -22,6 +22,7 @@ export function EPUBViewer({ className = '' }: EPUBViewerProps) {
const { const {
currDocData, currDocData,
currDocName, currDocName,
currDocText, // added for Fork1
locationRef, locationRef,
handleLocationChanged, handleLocationChanged,
bookRef, bookRef,
@ -59,7 +60,7 @@ export function EPUBViewer({ className = '' }: EPUBViewerProps) {
registerLocationChangeHandler(handleLocationChanged); registerLocationChangeHandler(handleLocationChanged);
}, [registerLocationChangeHandler, handleLocationChanged]); }, [registerLocationChangeHandler, handleLocationChanged]);
if (!currDocData) { if (!currDocData) {
return <DocumentSkeleton />; return <DocumentSkeleton />;
} }
@ -82,6 +83,23 @@ export function EPUBViewer({ className = '' }: EPUBViewerProps) {
}} }}
/> />
</div> </div>
{/* Plain-text mirror of the current EPUB page for tools like Migaku */}
{currDocText && (
<div
id="migaku-epub-plain-text"
aria-hidden="true"
style={{
position: 'absolute',
left: '-99999px',
top: '0',
whiteSpace: 'pre-wrap',
pointerEvents: 'none',
}}
>
{currDocText}
</div>
)}
</div> </div>
); );
} }