Skip to content

FIX-IMAGES: improve image import and restore cut-picture paste - #1065

Open
uhhJoyz wants to merge 1 commit into
storytold:mainfrom
uhhJoyz:fix/image-import-and-cut-paste
Open

uhhJoyz wants to merge 1 commit into
storytold:mainfrom
uhhJoyz:fix/image-import-and-cut-paste

Conversation

@uhhJoyz

@uhhJoyz uhhJoyz commented Oct 20, 2026 •

Copy link
Copy Markdown

Image import previously selected only one file and reopened without a useful starting folder. The desktop picture picker now allows multiple images, persists the last selected folder, and falls back to the active presentation's directory when there is no valid remembered folder. Change Picture remains single-select.

Cut pictures could fail to paste when system clipboard formats took precedence over DeckCraft's object marker. Marker pastes now restore the internal objects and original media directly. Copy/cut commands also publish the same nonempty marker as keyboard events so Ctrl+V is delivered for objects without text.

Validation:

  • Regression coverage for multiple imports, directory persistence/fallback, cancellation, and single-picture replacement.
  • Clipboard regressions reproduced before the fix and pass afterward; existing internal-object, external-image, and rich-text paste tests pass (7 distinct clipboard/paste tests).
  • Desktop and web build checks passed; cargo xtask wasm passed for all 23 checked crates.
  • User confirmed both fixes work in the application.
  • cargo xtask ci passes formatting and PDF dependency checks, then stops on the existing clippy::manual_range_contains warning in crates/model/src/trendline.rs:468. Full CI is not green; that unrelated file is unchanged.

Summary by CodeRabbit

  • New Features

    • Import multiple pictures at once from the desktop picker.
    • The picture picker remembers the last-used folder and falls back to the presentation folder when needed.
    • Picture replacement continues to use single-file selection.
    • Copying and pasting internal objects, including cut pictures, now reliably preserves the intended content.
  • Documentation

    • Updated the roadmap and parity checklist to reflect the latest picture import and clipboard behavior.

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ce36820c-2530-4e52-8bb4-9fe5138a8201
📥 Commits

Reviewing files that changed from the base of the PR and between fe510bd and 81f4bb9.

📒 Files selected for processing: 4
  • ROADMAP.md
  • apps/deckcraft/src/main.rs
  • crates/ui-egui/src/lib.rs
  • docs/parity-checklist.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

The desktop picture picker now supports multiple selection, remembered directories, and single-selection replacement. Object-marker paste now invokes DeckCraft’s internal paste command instead of checking external image or HTML clipboard formats.

Changes: Picture handling

Layer / File(s) Summary
Desktop picture picker
crates/ui-egui/src/lib.rs, apps/deckcraft/src/main.rs, ROADMAP.md, docs/parity-checklist.md
The desktop picker accepts a starting directory and a multiple-selection flag. Picture insertion supports multiple selected files and remembers their parent directory. Picture replacement requests one file. Tests cover selection, directory fallback, persistence, and cancellation. The roadmap and checklist record these behaviors.
Picture clipboard routing
crates/ui-egui/src/lib.rs, docs/parity-checklist.md
Copy and cut now publish an object marker when the copied text is empty. Pasting the marker invokes the internal paste command. Tests cover restoring cut picture media when external image or HTML clipboard formats are present.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant pick_and_run
  participant pick_pictures
  participant DesktopImagePicker
  User->>pick_and_run: request picture insertion or replacement
  pick_and_run->>pick_pictures: starting directory and selection mode
  pick_pictures->>DesktopImagePicker: open image dialog
  DesktopImagePicker-->>pick_pictures: selected image paths
  pick_pictures-->>pick_and_run: return selected paths
  pick_and_run-->>User: insert or replace pictures
Loading

Suggested reviewers: nikitkara

Merge Risk: ⚪ Minimal · up to 81f4b

The picture picker and object-marker paste changes are mergeable after normal checks. No material unresolved behavior issue was established.

Security architecture risk: 🔵 Low · up to 81f4b

The changes preserve existing file-access permissions and command-level recovery. No new privilege increase or data-disclosure path was established. Clipboard freshness across document switches remains an unresolved edge case.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The traced changes operate with the desktop process's existing filesystem authority and mutate the active presentation. Marker paste can transfer session-held objects into another active document, but the inspected branch does not itself return those contents to the external clipboard producer.

Trust Boundaries and Controls

  • inferred — A foreign or stale marker can select the current internal clipboard during paste. The base already allowed marker-driven internal object paste, but the new branch also avoids the supplied-text mismatch check and overrides external formats. This is a changed freshness assumption, not established exfiltration: document isolation is not demonstrated as a security contract, and cross-document clipboard use already exists.

Resilience and Maintainability Implications

  • observed — Cut captures selected objects and referenced media before deletion. Paste copies media into the destination, allocates fresh identities on conflicting media contents, and remaps shape references within document edits. These mechanisms preserve media ownership and failure containment rather than substituting stale external clipboard images.
Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the two main changes: improved image import and restoration of cut-picture paste.
Docstring Coverage Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 2 files. (2 skipped: 2 …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 2 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@FredApps FredApps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReviewerA — source-read COMMENT (not an approval)

I read the head of the diff: FIX-IMAGES, image import is improved and pasting a cut picture is restored. Two ROADMAP rows: cut and copy of pictures now publish a nonempty clipboard marker through commands as well as keyboard events (and pasting that marker is fixed), and the desktop picture picker allows multiple selection, remembers the last picture folder in preferences and defaults to the active one. That is two or three fixes in one PR (clipboard, picker, folder memory), and the remembered folder is a path stored in preferences (user data that the privacy documentation should list). Pictures from the picker are untrusted: sizes and decoders are bounded in the importer I did not read. I have not run it, and no exact-head CI result exists for this head. Nothing was run.

I ran nothing and have no exact-head CI result for this PR, so this is not an approval. Where a diff was long I read its code hunks rather than every generated or documentation line.

Status: waiting_author.

@aiongg aiongg added the bugfix Fixes something that is broken: wrong result, crash, data loss label Nov 4, 2026

@aiongg aiongg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-generated review (Opus). Not a maintainer decision.

No blocking problems found (not certain).

Insert Picture can now select several files and starts in the last-used picture folder or the presentation's folder. Pasting the internal object marker now restores the session's objects directly, and menu Copy/Cut publish the same nonempty marker as the keyboard shortcuts.

  • crates/ui-egui/src/lib.rs:1756: when the paste text is the object marker, it goes straight to the internal clipboard, so a stale image format offered next to the marker no longer replaces the cut picture.
  • crates/ui-egui/src/lib.rs:675: menu and ribbon Copy/Cut now use system_clipboard_text, the same as publish_clipboard at lib.rs:1824, so Ctrl+V is delivered for textless shapes copied from the menu.
  • crates/ui-egui/src/lib.rs:1265: only insert.picture asks for multiple selection; Change Picture and SmartArt pictures stay single-select.
  • crates/ui-egui/src/lib.rs:1258-1263: a remembered folder that no longer exists is skipped and the presentation's folder is used instead; relative document paths are resolved against the working directory.
  • The other picture pickers still open with no starting folder and no multiple selection: crates/ui-egui/src/panes.rs:644, panes.rs:837, panes.rs:897 and the Photo Album picker at crates/ui-egui/src/dialogs.rs:220. Photo Album in particular would benefit from multiple selection.
  • apps/deckcraft/src/main.rs:115 repeats the picture extension list from main.rs:99; a shared constant would keep them in sync.
  • The picker change and the clipboard fix are independent; separate pull requests would be easier to review and revert.

Claims checked:

  • verified: The desktop picture picker allows selecting multiple images for picture import (apps/deckcraft/src/main.rs:117 calls pick_files when multiple is set; crates/ui-egui/src/lib.rs:1265 passes multiple for insert.picture and lib.rs:1269 runs the command once per returned path)
  • verified: The last selected picture folder is remembered and persisted with preferences (crates/ui-egui/src/lib.rs:1271 stores the parent of each picked path in UiState.picture_directory (lib.rs:267); UiState is serde(default) (lib.rs:243), so older settings still load)
  • verified: With no valid remembered folder, the picker starts in the active presentation's directory (crates/ui-egui/src/lib.rs:1258-1263 filters the remembered folder with is_dir and otherwise uses the parent of the active document path, made absolute against current_dir)
  • verified: Change Picture remains single-select (crates/ui-egui/src/lib.rs:1023 routes Change Picture to picture.change, and lib.rs:1265 sets multiple only when cmd == "insert.picture")
  • verified: Pasting the object marker restores internal objects and original media without querying other system clipboard formats (crates/ui-egui/src/lib.rs:1756-1761 runs edit.paste with no text and skips clipboard_html and clipboard_image; crates/engine/src/cmd/edit.rs:348-358 pastes the clipboard shapes wi…
  • verified: Copy/Cut commands publish the same nonempty marker as keyboard events (crates/ui-egui/src/lib.rs:675 sets pending_copy to system_clipboard_text(t), the same helper publish_clipboard uses at lib.rs:1824; lib.rs:327-328 maps empty text to OBJECTS_MARKER)

Recommendation: merge, after a maintainer's decision.

Reviewed at 81f4bb9.

@aiongg

aiongg commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Automated message. Not a maintainer decision.

This branch conflicts with main. Could you merge or rebase main into it? The conflict needs a person to resolve.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fixes something that is broken: wrong result, crash, data loss

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants