From 61583fff31044a6f1887372031015bfda06896cb Mon Sep 17 00:00:00 2001 From: lizschwab Date: Tue, 7 Apr 2026 13:50:28 -0700 Subject: [PATCH] fix: add group when cutting workspace comments (#9680) * fix: add group when cutting workspace comments * Update shortcut_items.ts * added check for group to the cut workspace comment unit test --- packages/blockly/core/shortcut_items.ts | 2 ++ packages/blockly/tests/mocha/shortcut_items_test.js | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/packages/blockly/core/shortcut_items.ts b/packages/blockly/core/shortcut_items.ts index caa8ea84c..3e3e3c9e4 100644 --- a/packages/blockly/core/shortcut_items.ts +++ b/packages/blockly/core/shortcut_items.ts @@ -217,7 +217,9 @@ export function registerCut() { if (focused instanceof BlockSvg) { focused.checkAndDelete(); } else if (isIDeletable(focused)) { + eventUtils.setGroup(true); focused.dispose(); + eventUtils.setGroup(false); } return !!copyData; }, diff --git a/packages/blockly/tests/mocha/shortcut_items_test.js b/packages/blockly/tests/mocha/shortcut_items_test.js index 99c7bd4d0..0a42c41ba 100644 --- a/packages/blockly/tests/mocha/shortcut_items_test.js +++ b/packages/blockly/tests/mocha/shortcut_items_test.js @@ -295,6 +295,11 @@ suite('Keyboard Shortcut Items', function () { this.disposeSpy = sinon.spy(this.comment, 'dispose'); this.injectionDiv.dispatchEvent(keyEvent); + + const deleteEvents = this.workspace + .getUndoStack() + .filter((e) => e.type === 'comment_delete'); + assert(deleteEvents[0].group !== ''); // Group string is not empty sinon.assert.calledOnce(this.copySpy); sinon.assert.calledOnce(this.disposeSpy); });