From 86a6fa1f2fa809ca7e5426b3c76b69079ecf088c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gruszczy=C5=84ski?= Date: Sat, 12 Sep 2026 10:34:13 +0200 Subject: [PATCH] hotfix pagebreak --- Cargo.lock | 2 +- Cargo.toml | 2 +- static/js/pdf-export.js | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a632711..f3e095b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2581,7 +2581,7 @@ dependencies = [ [[package]] name = "rustpad" -version = "0.2.74" +version = "0.2.75" dependencies = [ "argon2", "aws-config", diff --git a/Cargo.toml b/Cargo.toml index 850354a..c2faa0f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustpad" -version = "0.2.74" +version = "0.2.75" edition = "2024" rust-version = "1.94" description = "Collaborative Markdown notepad built with Axum, WebSockets and SQLite, PostgreSQL and MySQL" diff --git a/static/js/pdf-export.js b/static/js/pdf-export.js index 7167675..9f0707e 100644 --- a/static/js/pdf-export.js +++ b/static/js/pdf-export.js @@ -530,12 +530,26 @@ function printStyles(cssSize, pageWidthMm, pageHeightMm, marginMm, preserveColor } .pdf-content .pdf-keep-unit { + /* + * Chromium can leave a 1-2 px fragment of an avoided block on the + * previous page before moving the real block to the next page. + * Making the keep unit an atomic inline-block prevents that ghost + * fragment while preserving book-like pagination. + */ + display: inline-block; + width: 100%; + vertical-align: top; + box-sizing: border-box; break-inside: avoid-page; page-break-inside: avoid; } .pdf-content .pdf-keep-unit > :first-child { margin-top: 0 !important; } .pdf-content .pdf-keep-unit > :last-child { margin-bottom: 0 !important; } .pdf-content .pdf-atomic-visual { + display: inline-block; + width: 100%; + vertical-align: top; + box-sizing: border-box; break-before: avoid-page; page-break-before: avoid; }