Add PDF state persistence

This commit is contained in:
2026-03-30 09:29:19 +02:00
parent d1bb79570d
commit 4613b8e5dd
15 changed files with 380 additions and 55 deletions

View File

@@ -18,8 +18,15 @@ use wasm_bindgen::JsValue;
/// `is_active` indicates whether this is the currently visible PDF tab; when
/// `true`, keymap actions for PDF page navigation are forwarded into the iframe.
#[component]
pub fn PdfViewer(ref_id: String, is_active: Signal<bool>) -> impl IntoView {
let url = format!("brittle://app/viewer?ref_id={ref_id}");
pub fn PdfViewer(
ref_id: String,
is_active: Signal<bool>,
initial_zoom: Option<f64>,
initial_scroll_top: Option<f64>,
) -> impl IntoView {
let mut url = format!("brittle://app/viewer?ref_id={ref_id}");
if let Some(z) = initial_zoom { url.push_str(&format!("&zoom={z}")); }
if let Some(s) = initial_scroll_top { url.push_str(&format!("&scroll_top={s}")); }
let iframe_ref = NodeRef::<leptos::html::Iframe>::new();