@@ -78,13 +78,13 @@ export default async function ({ addon, msg }) {
78
78
return keys ;
79
79
}
80
80
81
- for ( const opcode of [ "sensing_keyoptions" , "event_whenkeypressed" ] ) {
81
+ for ( const opcode of [ "sensing_keyoptions" , "event_whenkeypressed" , "event_whenkeyhit" ] ) {
82
82
const block = ScratchBlocks . Blocks [ opcode ] ;
83
83
const originalInit = block . init ;
84
84
block . init = function ( ...args ) {
85
85
const originalJsonInit = this . jsonInit ;
86
86
this . jsonInit = function ( obj ) {
87
- appendKeys ( obj . args0 [ 0 ] . options , opcode === "event_whenkeypressed" ) ;
87
+ appendKeys ( obj . args0 [ 0 ] . options , opcode === "event_whenkeypressed" || opcode === "event_whenkeyhit" ) ;
88
88
return originalJsonInit . call ( this , obj ) ;
89
89
} ;
90
90
return originalInit . call ( this , ...args ) ;
@@ -97,7 +97,7 @@ export default async function ({ addon, msg }) {
97
97
if ( workspace && flyout ) {
98
98
const allBlocks = [ ...workspace . getAllBlocks ( ) , ...flyout . getWorkspace ( ) . getAllBlocks ( ) ] ;
99
99
for ( const block of allBlocks ) {
100
- if ( block . type !== "event_whenkeypressed" && block . type !== "sensing_keyoptions" ) {
100
+ if ( block . type !== "event_whenkeypressed" && block . type !== "event_whenkeyhit" && block . type !== " sensing_keyoptions") {
101
101
continue ;
102
102
}
103
103
const input = block . inputList [ 0 ] ;
@@ -110,7 +110,7 @@ export default async function ({ addon, msg }) {
110
110
}
111
111
field . menuGenerator_ = appendKeys (
112
112
defaultKeys ? [ ...defaultKeys ] : field . menuGenerator_ ,
113
- block . type === "event_whenkeypressed"
113
+ block . type === "event_whenkeypressed" || block . type === "event_whenkeyhit"
114
114
) ;
115
115
}
116
116
}
0 commit comments