diff --git a/apps/pdfcraft-cli/src/ui.rs b/apps/pdfcraft-cli/src/ui.rs
index 032b51642f..832140b16e 100644
--- a/apps/pdfcraft-cli/src/ui.rs
+++ b/apps/pdfcraft-cli/src/ui.rs
@@ -14,8 +14,7 @@ use super::{CliError, stdout_line};
/// One request to a running app's control channel (`pdfcraft --control PORT`).
pub(crate) fn ui(args: &[String]) -> Result<(), CliError> {
validate_options("ui", args, UI_OPTIONS)?;
- let port = flag(args, "--control")
- .ok_or("ui: missing --control PORT (start the app with `pdfcraft --control PORT`)")?;
+ let port = flag(args, "--control").ok_or("ui: missing --control PORT (start the app with `pdfcraft --control PORT`)")?;
let port = control_port(port).map_err(|e| format!("ui: --control {port}: {e}"))?;
let env = EnvNames::for_app("PDFCRAFT");
let env_token = std::env::var(&env.token).ok().filter(|v| !v.trim().is_empty());
@@ -28,9 +27,8 @@ pub(crate) fn ui(args: &[String]) -> Result<(), CliError> {
let token = client_token(supplied.as_deref(), token_file_given.as_deref(), &FlagNames::default(), &env).map_err(|e| format!("ui: {e}"))?;
let pos = positional(args, UI_OPTIONS);
- let method = *pos
- .first()
- .ok_or("ui: missing method (state, inspect, click, move, release, type, key, command, commands, set, open, screenshot, …)")?;
+ let method =
+ *pos.first().ok_or("ui: missing method (state, inspect, click, move, release, type, key, command, commands, set, open, screenshot, …)")?;
let method = if method.starts_with("ui.") { method.to_string() } else { format!("ui.{method}") };
let mut params = serde_json::Map::new();
for kv in pos.iter().skip(1) {
diff --git a/crates/engine/src/catalog.rs b/crates/engine/src/catalog.rs
index 8affb889f1..ced85412f3 100644
--- a/crates/engine/src/catalog.rs
+++ b/crates/engine/src/catalog.rs
@@ -84,7 +84,7 @@ pub static TOOL_GROUPS: &[ToolGroup] = &[
title: "Export to",
items: &[
item("Microsoft Word (.docx)", "file-text", "export.docx", Ready),
- item("Spreadsheet (.xlsx)", "grid","export.xlsx", Planned("M10")),
+ item("Spreadsheet (.xlsx)", "grid", "export.xlsx", Planned("M10")),
item("Presentation (.pptx)", "presentation", "export.pptx", Ready),
item("Image (PNG)", "image", "export.image", Ready),
item("Export all images", "image", "export.all_images", Ready),
@@ -107,8 +107,8 @@ pub static TOOL_GROUPS: &[ToolGroup] = &[
items: &[
item("Add text", "type", "sign.fill.text", Ready),
item("Checkmark", "check", "sign.fill.check", Ready),
- item("Cross", "close","sign.fill.cross", Ready),
- item("Dot", "target","sign.fill.dot", Ready),
+ item("Cross", "close", "sign.fill.cross", Ready),
+ item("Dot", "target", "sign.fill.dot", Ready),
item("Line", "minus", "sign.fill.line", Ready),
item("Date", "clock-3", "sign.fill.date", Ready),
item("Signature", "signature", "sign.fill.signature", Ready),
@@ -130,11 +130,11 @@ pub static TOOL_GROUPS: &[ToolGroup] = &[
title: "Modify page",
items: &[
item("Edit text & images", "text-cursor-input", "edit.edit_text", Ready),
- item("Rotate pages", "rotate_cw","page.rotate", Ready),
+ item("Rotate pages", "rotate_cw", "page.rotate", Ready),
item("Insert pages", "file-plus-2", "page.insert", Ready),
item("Delete pages", "trash-2", "page.delete", Ready),
item("Extract pages", "file-output", "page.extract", Ready),
- item("Organize pages", "layout_grid","page.organize", Ready),
+ item("Organize pages", "layout_grid", "page.organize", Ready),
],
},
ToolSection {
@@ -144,7 +144,7 @@ pub static TOOL_GROUPS: &[ToolGroup] = &[
item("Image", "image-plus", "edit.image", Ready),
menu_item("Header and footer", "heading", &["edit.header_footer", "edit.header_footer.update", "edit.header_footer.remove"]),
menu_item("Watermark", "stamp", &["edit.watermark", "edit.watermark.update", "edit.watermark.remove"]),
- item("Link", "link","edit.link", Ready),
+ item("Link", "link", "edit.link", Ready),
item("Bates numbering", "hash", "edit.bates", Ready),
menu_item("Background", "palette", &["edit.background", "edit.background.update", "edit.background.remove"]),
item("Attach file", "paperclip", "edit.attach", Ready),
@@ -191,8 +191,8 @@ pub static TOOL_GROUPS: &[ToolGroup] = &[
ToolSection {
title: "Page options",
items: &[
- item("Page grid", "layout_grid","page.organize", Ready),
- item("Rotate", "rotate_cw","page.rotate", Ready),
+ item("Page grid", "layout_grid", "page.organize", Ready),
+ item("Rotate", "rotate_cw", "page.rotate", Ready),
item("Delete", "trash-2", "page.delete", Ready),
item("Extract", "file-output", "page.extract", Ready),
item("Insert", "file-plus-2", "page.insert", Ready),
@@ -206,7 +206,7 @@ pub static TOOL_GROUPS: &[ToolGroup] = &[
item("Set page boxes", "square-dashed-mouse-pointer", "page.boxes", Ready),
item("Crop pages", "crop", "page.crop", Ready),
item("Duplicate pages", "copy-plus", "page.duplicate", Ready),
- item("Reverse pages", "swap_vertical","page.reverse", Ready),
+ item("Reverse pages", "swap_vertical", "page.reverse", Ready),
item("Page labels", "tag", "page.number", Ready),
item("Page transitions", "presentation", "page.transitions", Planned("M4")),
],
@@ -226,8 +226,8 @@ pub static TOOL_GROUPS: &[ToolGroup] = &[
items: &[
item("Sticky note", "sticky-note", "comment.note", Ready),
item("Highlight text", "highlighter", "comment.highlight", Ready),
- item("Underline", "text_underline","comment.underline", Ready),
- item("Strikethrough", "text_strikethrough","comment.strikeout", Ready),
+ item("Underline", "text_underline", "comment.underline", Ready),
+ item("Strikethrough", "text_strikethrough", "comment.strikeout", Ready),
item("Squiggly underline", "spline", "comment.squiggly", Ready),
item("Text box", "type", "comment.freetext", Ready),
],
@@ -283,7 +283,7 @@ pub static TOOL_GROUPS: &[ToolGroup] = &[
title: "Protect",
items: &[
item("Protect with password", "lock", "protect.password", Ready),
- item("Remove hidden information", "eye_off","protect.remove_hidden", Ready),
+ item("Remove hidden information", "eye_off", "protect.remove_hidden", Ready),
],
},
ToolSection {
@@ -291,7 +291,7 @@ pub static TOOL_GROUPS: &[ToolGroup] = &[
items: &[
item("Encrypt with certificate", "file-lock-2", "protect.certificate", Planned("M8")),
item("Security properties", "shield-check", "protect.properties", Ready),
- item("Remove security", "lock_open","protect.remove", Ready),
+ item("Remove security", "lock_open", "protect.remove", Ready),
],
},
],
@@ -306,7 +306,7 @@ pub static TOOL_GROUPS: &[ToolGroup] = &[
sections: &[ToolSection {
title: "Redact",
items: &[
- item("Redact text and images", "rectangle","redact.mark", Ready),
+ item("Redact text and images", "rectangle", "redact.mark", Ready),
item("Redact pages", "file-x", "redact.pages", Ready),
item("Find text and redact", "file-search", "redact.search", Ready),
item("Set properties", "settings-2", "redact.properties", Ready),
@@ -347,7 +347,7 @@ pub static TOOL_GROUPS: &[ToolGroup] = &[
item("Field properties", "settings-2", "form.field.properties", Ready),
item("Tab order by rows", "rows-3", "form.tab_order.row", Ready),
item("Tab order by columns", "columns-3", "form.tab_order.column", Ready),
- item("Calculation order", "list_numbered","form.calculation_order", Ready),
+ item("Calculation order", "list_numbered", "form.calculation_order", Ready),
item("Flatten form fields", "layers", "form.flatten", Ready),
item("Import data", "file-input", "form.import_data", Ready),
item("Export data", "file-output", "form.export_data", Ready),
@@ -357,10 +357,10 @@ pub static TOOL_GROUPS: &[ToolGroup] = &[
title: "Add form components",
items: &[
item("Text field", "text-cursor-input", "form.add.text", Ready),
- item("Text field table", "grid","form.add.text_table", Ready),
+ item("Text field table", "grid", "form.add.text_table", Ready),
item("Checkbox", "check-circle-2", "form.add.checkbox", Ready),
item("Radio button", "circle", "form.add.radio", Ready),
- item("Drop-down list", "chevron_down","form.add.combo", Ready),
+ item("Drop-down list", "chevron_down", "form.add.combo", Ready),
item("List box", "list", "form.add.list", Ready),
item("Button", "square", "form.add.button", Ready),
item("Image field", "image", "form.add.image", Ready),
@@ -482,7 +482,7 @@ pub static TOOL_GROUPS: &[ToolGroup] = &[
item("Open accessibility report", "file-text", "a11y.report", Ready),
item("Add alternate text", "image", "a11y.alt_text", Ready),
item("Tags panel", "tag", "a11y.tags", Ready),
- item("Fix reading order", "list_numbered","a11y.reading_order", Planned("M12")),
+ item("Fix reading order", "list_numbered", "a11y.reading_order", Planned("M12")),
],
}],
},
diff --git a/crates/engine/src/session/save.rs b/crates/engine/src/session/save.rs
index 2e26be4056..52085888ab 100644
--- a/crates/engine/src/session/save.rs
+++ b/crates/engine/src/session/save.rs
@@ -212,10 +212,12 @@ impl Session {
// The working bytes hold typed Password-field values (#3926, #3944): a recovery file
// is written from a copy without them, and none is written if that copy fails.
let bytes = match d.editor.as_ref().filter(|e| pdfcraft_forms::has_password_values(&e.cos) || pdfcraft_xfa::has_password_values(&e.cos)) {
- Some(e) => match writable(&e.cos).and_then(|c| write_incremental(&c, &SaveOptions::default()).map_err(|e| EditError::Write(e.to_string()))) {
- Ok(b) => Arc::new(b),
- Err(_) => return None,
- },
+ Some(e) => {
+ match writable(&e.cos).and_then(|c| write_incremental(&c, &SaveOptions::default()).map_err(|e| EditError::Write(e.to_string()))) {
+ Ok(b) => Arc::new(b),
+ Err(_) => return None,
+ }
+ }
None => d.bytes.clone(),
};
Some(RecoverySnapshot {
diff --git a/crates/engine/src/signature_image.rs b/crates/engine/src/signature_image.rs
index dde9c0cd62..f9a22f4084 100644
--- a/crates/engine/src/signature_image.rs
+++ b/crates/engine/src/signature_image.rs
@@ -220,7 +220,6 @@ impl SignatureImage {
pdfcraft_sign::Graphic::Image { width: side(self.size[0]), height: side(self.size[1]), rgba: self.rgba.clone() }
}
-
/// The user-space box for the image with its left edge at `at` (a user-space point on `page`),
/// vertically centered, with the same 150 pt width cap as typed names. Left and centered are
/// as displayed: on a page with `/Rotate` the box runs along the turned page's axes.
diff --git a/crates/ui-egui/examples/properties_scenarios.rs b/crates/ui-egui/examples/properties_scenarios.rs
index ec21861d41..348709479c 100644
--- a/crates/ui-egui/examples/properties_scenarios.rs
+++ b/crates/ui-egui/examples/properties_scenarios.rs
@@ -8,12 +8,12 @@ use std::io::{BufRead, Read, Write};
use std::path::PathBuf;
use std::sync::Arc;
+use craft::ui::dialog::dialog_id;
+use craft::ui::patterns::form_dialogs::HostedParamDialog;
use egui::accesskit::Role;
use egui_kittest::Harness;
use egui_kittest::kittest::{NodeT, Queryable};
use pdfcraft_engine::{DocId, Edit, Session};
-use craft::ui::dialog::dialog_id;
-use craft::ui::patterns::form_dialogs::HostedParamDialog;
use pdfcraft_ui_egui::{PdfCraftApp, PropsTab};
use serde::Deserialize;
use serde_json::{Value, json};
diff --git a/crates/ui-egui/src/canvas/organize.rs b/crates/ui-egui/src/canvas/organize.rs
index 2d706a61ee..46f60653e4 100644
--- a/crates/ui-egui/src/canvas/organize.rs
+++ b/crates/ui-egui/src/canvas/organize.rs
@@ -1,5 +1,5 @@
use super::{DocView, Edit, Pos2, ViewAction};
-use craft::behavior::{IconId, MiddleButton, Selection};
+use craft::behavior::{GesturePhase, IconId, MiddleButton, Selection};
use craft::keymap::CommandRef;
use craft::pages::ui::thumbnails::{ORGANIZE_ZOOM, PageThumbnails, ThumbnailArrangement, ThumbnailEvent};
use craft::ui::bars::{Bar, BarKind};
@@ -218,7 +218,12 @@ pub(super) fn organize_grid(view: &mut DocView, doc: &pdfcraft_engine::Document,
for event in out.events {
match event {
ThumbnailEvent::Go(page) => view.go_to_page(page),
- ThumbnailEvent::Reorder(craft::behavior::EditEvent::Commit { after, .. }) => commit_reorder(view, after.keys, after.to, after.copy),
+ // A drag ends as a commit, a keyboard move as a set; proposals during the drag move nothing.
+ ThumbnailEvent::Reorder(edit) if matches!(edit.phase(), Some(GesturePhase::Commit) | None) => {
+ if let Some(mv) = edit.value() {
+ commit_reorder(view, mv.keys.clone(), mv.to, mv.copy);
+ }
+ }
ThumbnailEvent::Delete(pages) => view.session.pending_edit = Some(Edit::DeletePages { pages }),
ThumbnailEvent::Activate(page) => {
view.organize = false;
@@ -246,8 +251,10 @@ pub(super) fn organize_grid(view: &mut DocView, doc: &pdfcraft_engine::Document,
}
if let Some(at) = cx.ui.data(|d| d.get_temp::