File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,21 @@ class Blocks extends React.Component {
96
96
) ;
97
97
this . workspace = this . ScratchBlocks . inject ( this . blocks , workspaceConfig ) ;
98
98
99
+ // Register buttons under new callback keys for creating variables,
100
+ // lists, and procedures from extensions.
101
+
102
+ const toolboxWorkspace = this . workspace . getFlyout ( ) . getWorkspace ( ) ;
103
+
104
+ const varListButtonCallback = type =>
105
+ ( ( ) => this . ScratchBlocks . Variables . createVariable ( this . workspace , null , type ) ) ;
106
+ const procButtonCallback = ( ) => {
107
+ this . ScratchBlocks . Procedures . createProcedureDefCallback_ ( this . workspace ) ;
108
+ } ;
109
+
110
+ toolboxWorkspace . registerButtonCallback ( 'MAKE_A_VARIABLE' , varListButtonCallback ( '' ) ) ;
111
+ toolboxWorkspace . registerButtonCallback ( 'MAKE_A_LIST' , varListButtonCallback ( 'list' ) ) ;
112
+ toolboxWorkspace . registerButtonCallback ( 'MAKE_A_PROCEDURE' , procButtonCallback ) ;
113
+
99
114
// Store the xml of the toolbox that is actually rendered.
100
115
// This is used in componentDidUpdate instead of prevProps, because
101
116
// the xml can change while e.g. on the costumes tab.
You can’t perform that action at this time.
0 commit comments