File tree Expand file tree Collapse file tree 3 files changed +16
-7
lines changed Expand file tree Collapse file tree 3 files changed +16
-7
lines changed Original file line number Diff line number Diff line change 111
111
"scratch-render" : " 0.1.0-prerelease.20190312125229" ,
112
112
"scratch-storage" : " 1.2.2" ,
113
113
"scratch-svg-renderer" : " 0.2.0-prerelease.20190329052730" ,
114
- "scratch-vm" : " 0.2.0-prerelease.20190326160300 " ,
114
+ "scratch-vm" : " 0.2.0-prerelease.20190329172358 " ,
115
115
"selenium-webdriver" : " 3.6.0" ,
116
116
"startaudiocontext" : " 1.2.1" ,
117
117
"style-loader" : " ^0.23.0" ,
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.
Original file line number Diff line number Diff line change @@ -118,12 +118,6 @@ class SBFileUploader extends React.Component {
118
118
const filename = this . fileToUpload && this . fileToUpload . name ;
119
119
this . props . vm . loadProject ( this . reader . result )
120
120
. then ( ( ) => {
121
- // Remove the hash if any (without triggering a hash change event or a reload)
122
- try { // Can fail e.g. when GUI is loaded from static file (integration tests)
123
- history . replaceState ( { } , document . title , '.' ) ;
124
- } catch {
125
- // No fallback, just do not trigger promise catch below
126
- }
127
121
this . props . onLoadingFinished ( this . props . loadingState , true ) ;
128
122
// Reset the file input after project is loaded
129
123
// This is necessary in case the user wants to reload a project
You can’t perform that action at this time.
0 commit comments