PDF import: honor the editing data opt-out when opening a file (#7572)

This commit is contained in:
makesomethingshit
2026-11-22 13:50:06 +09:00
parent 9fff48d88f
commit 6cda197cbe
2 changed files with 23 additions and 1 deletions
+2 -1
View File
@@ -149,7 +149,8 @@ impl LoadOptions {
editing_data,
trust_editing_data,
legacy_names,
native: true,
// The command's opt-out also skips the embedded VectorCraft document.
native: editing_data,
link_pages,
})
}
@@ -53,6 +53,27 @@ fn a_pdf_saved_with_preserve_editing_reopens_as_the_same_document() {
assert!(vectorcraft_pdf::editing(&b64(&v)).is_some_and(|e| e.intact));
}
#[test]
fn opening_a_preserve_editing_pdf_without_editing_data_imports_its_pages() {
let mut s = rich();
assert!(!s.doc().unwrap().doc.symbols.is_empty());
let exported = s.execute("document.exportPdf", &json!({"preserveEditing": true})).unwrap();
let reopened = s
.execute(
"document.open",
&json!({
"name": "rich.pdf",
"dataBase64": exported["dataBase64"],
"cropTo": "media",
"editingData": false,
}),
)
.unwrap();
assert_eq!(reopened["restored"], false, "{reopened}");
assert!(s.doc().unwrap().doc.symbols.is_empty(), "the PDF page has no native symbol definitions");
}
#[test]
fn pages_changed_elsewhere_open_as_artwork_with_a_warning() {
let mut s = rich();