soiz1 commited on
Commit
04f888b
·
verified ·
1 Parent(s): 472eec6

Update src/containers/blocks.jsx

Browse files
Files changed (1) hide show
  1. src/containers/blocks.jsx +9 -6
src/containers/blocks.jsx CHANGED
@@ -86,12 +86,17 @@ class Blocks extends React.Component {
86
  super(props);
87
  this.ScratchBlocks = VMScratchBlocks(props.vm);
88
  this.ScratchBlocks.Toolbox.registerMenu('extensionControls', [
 
 
 
 
 
89
  {
90
  text: 'Replace Extension',
91
  enabled: true,
92
  callback: ext => this.props.onOpenCustomExtensionModal(ext)
93
  }
94
- ], true);
95
  window.ScratchBlocks = this.ScratchBlocks;
96
  AddonHooks.blockly = this.ScratchBlocks;
97
  AddonHooks.blocklyCallbacks.forEach(i => i());
@@ -201,8 +206,8 @@ class Blocks extends React.Component {
201
  // entire toolbox every time we reset the workspace. We call updateToolbox as a part of
202
  // componentDidUpdate so the toolbox will still correctly be updated
203
  this.setToolboxRefreshEnabled = this.workspace.setToolboxRefreshEnabled.bind(this.workspace);
204
- this.workspace.setToolboxRefreshEnabled = () => {
205
- this.setToolboxRefreshEnabled(false);
206
  };
207
 
208
  // @todo change this when blockly supports UI events
@@ -512,8 +517,6 @@ class Blocks extends React.Component {
512
  }
513
  handleMonitorsUpdate (monitors) {
514
  // Update the checkboxes of the relevant monitors.
515
- // TODO: What about monitors that have fields? See todo in scratch-vm blocks.js changeBlock:
516
- // https://github.com/LLK/scratch-vm/blob/2373f9483edaf705f11d62662f7bb2a57fbb5e28/src/engine/blocks.js#L569-L576
517
  const flyout = this.workspace.getFlyout();
518
  for (const monitor of monitors.values()) {
519
  const blockId = monitor.get('id');
@@ -852,4 +855,4 @@ export default injectIntl(errorBoundaryHOC('Blocks')(
852
  mapStateToProps,
853
  mapDispatchToProps
854
  )(LoadScratchBlocksHOC(Blocks))
855
- ));
 
86
  super(props);
87
  this.ScratchBlocks = VMScratchBlocks(props.vm);
88
  this.ScratchBlocks.Toolbox.registerMenu('extensionControls', [
89
+ {
90
+ text: 'Remove Extension',
91
+ enabled: true,
92
+ callback: ext => props.vm.extensionManager.removeExtension(ext)
93
+ },
94
  {
95
  text: 'Replace Extension',
96
  enabled: true,
97
  callback: ext => this.props.onOpenCustomExtensionModal(ext)
98
  }
99
+ ]);
100
  window.ScratchBlocks = this.ScratchBlocks;
101
  AddonHooks.blockly = this.ScratchBlocks;
102
  AddonHooks.blocklyCallbacks.forEach(i => i());
 
206
  // entire toolbox every time we reset the workspace. We call updateToolbox as a part of
207
  // componentDidUpdate so the toolbox will still correctly be updated
208
  this.setToolboxRefreshEnabled = this.workspace.setToolboxRefreshEnabled.bind(this.workspace);
209
+ this.workspace.setToolboxRefreshEnabled = value => {
210
+ this.setToolboxRefreshEnabled(value);
211
  };
212
 
213
  // @todo change this when blockly supports UI events
 
517
  }
518
  handleMonitorsUpdate (monitors) {
519
  // Update the checkboxes of the relevant monitors.
 
 
520
  const flyout = this.workspace.getFlyout();
521
  for (const monitor of monitors.values()) {
522
  const blockId = monitor.get('id');
 
855
  mapStateToProps,
856
  mapDispatchToProps
857
  )(LoadScratchBlocksHOC(Blocks))
858
+ ));