mirror of
https://github.com/google/blockly.git
synced 2026-01-04 15:40:08 +01:00
fix: Copy shortcuts before returning them (#9109)
This commit is contained in:
@@ -278,7 +278,9 @@ export class ShortcutRegistry {
|
||||
* Undefined if no shortcuts exist.
|
||||
*/
|
||||
getShortcutNamesByKeyCode(keyCode: string): string[] | undefined {
|
||||
return this.keyMap.get(keyCode) || [];
|
||||
// Copy the list of shortcuts in case one of them unregisters itself
|
||||
// in its callback.
|
||||
return this.keyMap.get(keyCode)?.slice() || [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user