mirror of
https://github.com/google/blockly.git
synced 2026-05-01 17:40:11 +02:00
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
This commit is contained in:
@@ -102,5 +102,6 @@ export class DeleteCommentBarButton extends CommentBarButton {
|
||||
this.getCommentView().dispose();
|
||||
e?.stopPropagation();
|
||||
getFocusManager().focusNode(this.workspace);
|
||||
this.workspace.getAudioManager().play('delete');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user