mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-26 08:26:04 +00:00
Merge pull request #9071 from makesomethingshit/fix/7572-pdf-editing-data-opt-out
PDF import: honor the editing data opt-out when opening a file (#7572)
This commit is contained in:
@@ -159,7 +159,8 @@ impl LoadOptions {
|
||||
trust_editing_data,
|
||||
embedded_fonts,
|
||||
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();
|
||||
|
||||
Reference in New Issue
Block a user