Skip to content

Commit e89a8ea

Browse files
authored
Merge branch 'develop' into greenkeeper/scratch-svg-renderer-0.2.0-prerelease.20190329052730
2 parents 6d5a6d4 + 98274c8 commit e89a8ea

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
"scratch-render": "0.1.0-prerelease.20190312125229",
112112
"scratch-storage": "1.2.2",
113113
"scratch-svg-renderer": "0.2.0-prerelease.20190329052730",
114-
"scratch-vm": "0.2.0-prerelease.20190326160300",
114+
"scratch-vm": "0.2.0-prerelease.20190329172358",
115115
"selenium-webdriver": "3.6.0",
116116
"startaudiocontext": "1.2.1",
117117
"style-loader": "^0.23.0",

src/containers/blocks.jsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,21 @@ class Blocks extends React.Component {
9696
);
9797
this.workspace = this.ScratchBlocks.inject(this.blocks, workspaceConfig);
9898

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+
99114
// Store the xml of the toolbox that is actually rendered.
100115
// This is used in componentDidUpdate instead of prevProps, because
101116
// the xml can change while e.g. on the costumes tab.

src/containers/sb-file-uploader.jsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,6 @@ class SBFileUploader extends React.Component {
118118
const filename = this.fileToUpload && this.fileToUpload.name;
119119
this.props.vm.loadProject(this.reader.result)
120120
.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-
}
127121
this.props.onLoadingFinished(this.props.loadingState, true);
128122
// Reset the file input after project is loaded
129123
// This is necessary in case the user wants to reload a project

0 commit comments

Comments
 (0)