feat: import Saber notebooks (Issue #47)

The import now also accepts Saber files: .sbn2 (BSON) with its asset
files next to it, .sba archives (zip with main.sbn2 and assets) and the
old JSON .sbn, including the layout before format version 8 with
strokes outside the pages. Taken over: strokes with pen pressure and
perfect_freehand's thinning, highlighters, circle and rectangle shapes,
typed text (Quill delta as one text field), images (SVG rasterized),
background images and PDF pages as PDF backgrounds, paper patterns.

BSON and zip are read by small built-in readers, so no new
dependencies. The SVG rasterizer moved to src/import.rs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
haraldandClaude Opus 5.5 committed 2026-10-27 12:25:29 +01:00
1 parent ca6f64ec8e
commit 397bf3bfe4
11 files changed
+970 -52

No files matched your search

+6 -3
View File
@@ -1,4 +1,4 @@
//! Eingebaute, stift- und fingertaugliche Dateiauswahl für Bilder und importierbare Dateien (PDF, Xournal++, Rnote).
//! Eingebaute, stift- und fingertaugliche Dateiauswahl für Bilder und importierbare Dateien (PDF, Xournal++, Rnote, Saber).
//!
//! Bewusst ohne Systemdialog: der bräuchte GTK oder das Desktop-Portal, die unter WSL und auf
//! schlanken Systemen oft fehlen. Die Auswahl zeigt Ordner und die passenden Dateien des
@@ -22,7 +22,7 @@ pub struct PickerEntry {
pub enum PickerKind {
/// Bilder zum Einfügen auf der aktuellen Seite
Image,
/// PDF, Xournal++ or Rnote file to import as a new notebook
/// PDF, Xournal++, Rnote or Saber file to import as a new notebook
Import,
}
@@ -194,6 +194,8 @@ mod tests {
"Skript.PDF",
"mathe.xopp",
"skizze.rnote",
"Uni.sbn2",
"Uni.sbn2.0",
] {
std::fs::write(dir.path().join(name), b"x").unwrap();
}
@@ -219,7 +221,8 @@ mod tests {
"zOrdner",
"mathe.xopp",
"skizze.rnote",
"Skript.PDF"
"Skript.PDF",
"Uni.sbn2"
]
);
}