Split paragraphs at line boundaries across pages

This commit is contained in:
gloamxun committed 2026-10-23 02:23:18 +08:00
1 parent daf9f5c57e
commit b7b75fbff1
8 files changed
+263 -77

No files matched your search

+7 -1
View File
@@ -138,7 +138,13 @@ pub fn preview_json(source: &str) -> Result<String, String> {
let paragraphs = paragraphs(source)?;
let document = build_document(&paragraphs);
let engine = Engine::layout(&document);
Ok(render_json(&engine, None))
let json = render_json(&engine, None);
// Keep the layout so a following `/edit` request can diff against it and
// reuse page checkpoints instead of starting from a no-op document.
ROUTE_D_SESSION.with(|slot| {
*slot.borrow_mut() = Some((document, engine));
});
Ok(json)
}
/// Render the same checkpointed document as a route-D PDF.