Add PDF state persistence
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user