From 93caf4d222207781c8eef57217cd05bc5b95b090 Mon Sep 17 00:00:00 2001 From: MarekSpodBiedry <73122968+MarekSpodBiedry@users.noreply.github.com> Date: Fri, 30 Oct 2026 16:37:27 +0100 Subject: [PATCH 1/2] Paste copied shapes while a text box is being edited (#1550) --- crates/engine/src/cmd/edit.rs | 3 ++- crates/engine/src/tests.rs | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rs index b098503ca..725808e4d 100644 --- a/crates/engine/src/cmd/edit.rs +++ b/crates/engine/src/cmd/edit.rs @@ -278,7 +278,8 @@ fn paste(s: &mut Session, p: &Value) -> Result { return paste_plain(s, t); } let editing = s.doc()?.selection.text.is_some(); - if editing { + // Copied shapes are pasted as shapes even while a text box is being edited (the caret leaves it). + if editing && (s.clipboard.text.is_some() || s.clipboard.shapes.is_empty()) { if let Some(body) = s.clipboard.text.clone() { return super::text::paste_body(s, &body); } diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 4dfc21f45..6692ee155 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -214,6 +214,20 @@ fn clipboard_copy_paste_shapes_and_slides() { assert!(s.doc().unwrap().doc.validate().is_empty()); } +#[test] +fn copied_shapes_paste_as_shapes_while_a_text_box_is_being_edited() { + let mut s = session(); + s.execute("shape.insert", &json!({"preset": "ellipse", "rect": [10, 10, 50, 50]})).unwrap(); + s.execute("edit.copy", &json!({})).unwrap(); + let r = s.execute("insert.textBox", &json!({"text": "Hello"})).unwrap(); + let id = r["id"].as_u64().unwrap(); + s.execute("text.edit", &json!({"id": id})).unwrap(); + let before = s.doc().unwrap().current_slide().unwrap().shapes.len(); + s.execute("edit.paste", &json!({})).unwrap(); + assert_eq!(s.doc().unwrap().current_slide().unwrap().shapes.len(), before + 1); + assert!(s.doc().unwrap().selection.text.is_none()); +} + #[test] fn pasted_shapes_get_the_next_automatic_name() { let mut s = session(); From 0d190bc0af375d12b22f14c522f34a7ecb9e87e6 Mon Sep 17 00:00:00 2001 From: MarekSpodBiedry <73122968+MarekSpodBiedry@users.noreply.github.com> Date: Sun, 1 Nov 2026 07:38:17 +0100 Subject: [PATCH 2/2] Keep pasting into the notes while they are being edited (#1550) --- crates/engine/src/cmd/edit.rs | 6 +++--- crates/engine/src/tests.rs | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rs index 6d39cc050..9a25b008d 100644 --- a/crates/engine/src/cmd/edit.rs +++ b/crates/engine/src/cmd/edit.rs @@ -277,9 +277,9 @@ fn paste(s: &mut Session, p: &Value) -> Result { } return paste_plain(s, t); } - let editing = s.doc()?.selection.text.is_some(); - // Copied shapes are pasted as shapes even while a text box is being edited (the caret leaves it). - if editing && (s.clipboard.text.is_some() || s.clipboard.shapes.is_empty()) { + let (editing, notes) = s.doc()?.selection.text.as_ref().map_or((false, false), |t| (true, t.notes)); + // Copied shapes are pasted as shapes even while a text box is being edited (the caret leaves it), but never into the notes. + if editing && (notes || s.clipboard.text.is_some() || s.clipboard.shapes.is_empty()) { if let Some(body) = s.clipboard.text.clone() { return super::text::paste_body(s, &body); } diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 2a75b08fd..4c79476d2 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -228,6 +228,18 @@ fn copied_shapes_paste_as_shapes_while_a_text_box_is_being_edited() { assert!(s.doc().unwrap().selection.text.is_none()); } +#[test] +fn copied_shapes_are_not_pasted_while_the_notes_are_being_edited() { + let mut s = session(); + s.execute("shape.insert", &json!({"preset": "ellipse", "rect": [10, 10, 50, 50]})).unwrap(); + s.execute("edit.copy", &json!({})).unwrap(); + s.execute("text.edit", &json!({"notes": true})).unwrap(); + let before = s.doc().unwrap().current_slide().unwrap().shapes.len(); + s.execute("edit.paste", &json!({})).unwrap(); + assert_eq!(s.doc().unwrap().current_slide().unwrap().shapes.len(), before); + assert!(s.doc().unwrap().selection.text.as_ref().is_some_and(|t| t.notes)); +} + #[test] fn pasted_shapes_get_the_next_automatic_name() { let mut s = session();