From adeeb613a48ef8913e460388f9e75ed98adaf880 Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Wed, 29 Apr 2026 11:01:25 -0700 Subject: [PATCH] feat: Play delete sound when workspace comments are deleted (#9776) * feat: Play delete sound when workspace comments are deleted * fix: Play delete sound (and no error beep) when cutting workspace comments * fix: Play delete sound when deleting comments via the context menu --- packages/blockly/core/comments/delete_comment_bar_button.ts | 1 + packages/blockly/core/contextmenu_items.ts | 1 + packages/blockly/core/shortcut_items.ts | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/packages/blockly/core/comments/delete_comment_bar_button.ts b/packages/blockly/core/comments/delete_comment_bar_button.ts index c61db9b9c..15ed4b259 100644 --- a/packages/blockly/core/comments/delete_comment_bar_button.ts +++ b/packages/blockly/core/comments/delete_comment_bar_button.ts @@ -102,5 +102,6 @@ export class DeleteCommentBarButton extends CommentBarButton { this.getCommentView().dispose(); e?.stopPropagation(); getFocusManager().focusNode(this.workspace); + this.workspace.getAudioManager().play('delete'); } } diff --git a/packages/blockly/core/contextmenu_items.ts b/packages/blockly/core/contextmenu_items.ts index ef29a1920..45f6269c4 100644 --- a/packages/blockly/core/contextmenu_items.ts +++ b/packages/blockly/core/contextmenu_items.ts @@ -591,6 +591,7 @@ export function registerCommentDelete() { eventUtils.setGroup(true); scope.comment?.dispose(); eventUtils.setGroup(false); + scope.comment?.workspace.getAudioManager().play('delete'); }, scopeType: ContextMenuRegistry.ScopeType.COMMENT, id: 'commentDelete', diff --git a/packages/blockly/core/shortcut_items.ts b/packages/blockly/core/shortcut_items.ts index 5f8dd1779..92a0ea6e5 100644 --- a/packages/blockly/core/shortcut_items.ts +++ b/packages/blockly/core/shortcut_items.ts @@ -118,6 +118,7 @@ export function registerDelete() { eventUtils.setGroup(true); focused.dispose(); eventUtils.setGroup(false); + workspace.getAudioManager().play('delete'); } return true; }, @@ -249,10 +250,13 @@ export function registerCut() { if (focused instanceof BlockSvg) { focused.checkAndDelete(); + e.preventDefault(); } else if (isIDeletable(focused)) { eventUtils.setGroup(true); focused.dispose(); eventUtils.setGroup(false); + workspace.getAudioManager().play('delete'); + e.preventDefault(); } return !!copyData; },