From b356b80f8c86d110951301b83607de245b4ef6cc Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sun, 30 Aug 2026 17:44:39 -0400 Subject: [PATCH] refac --- src/lib/components/common/PDFViewer.svelte | 27 ++++++++++++-------- src/lib/components/common/PptxPreview.svelte | 21 +++++++++------ 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/src/lib/components/common/PDFViewer.svelte b/src/lib/components/common/PDFViewer.svelte index c8dfaabf35..badbb8ac58 100644 --- a/src/lib/components/common/PDFViewer.svelte +++ b/src/lib/components/common/PDFViewer.svelte @@ -386,6 +386,10 @@ void selectPage(selectedPage + (e.key === 'ArrowUp' || e.key === 'ArrowLeft' ? -1 : 1)); }; + const focusViewer = () => { + if (!outerContainer?.contains(document.activeElement)) outerContainer?.focus(); + }; + const loadPdf = async () => { if (!url && !data) return; @@ -462,9 +466,7 @@ }); - - -
+
{#if loading}
@@ -475,14 +477,17 @@
{/if} -
+
diff --git a/src/lib/components/common/PptxPreview.svelte b/src/lib/components/common/PptxPreview.svelte index d94708ddbf..dc9b54d7a5 100644 --- a/src/lib/components/common/PptxPreview.svelte +++ b/src/lib/components/common/PptxPreview.svelte @@ -121,6 +121,10 @@ } }; + const focusPreview = () => { + if (!rootEl?.contains(document.activeElement)) rootEl?.focus(); + }; + const zoomIn = () => { if (!pzInstance || !stageEl) return; pzInstance.zoomTo(stageEl.clientWidth / 2, stageEl.clientHeight / 2, 1.25); @@ -227,14 +231,15 @@ }); - - -
+