Skip to content

Commit 220c80c

Browse files
authored
listen to the FLYOUT not workspace
1 parent 52fb7b4 commit 220c80c

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/containers/blocks.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,12 +356,12 @@ class Blocks extends React.Component {
356356

357357
attachVM () {
358358
this.workspace.addChangeListener(this.props.vm.blockListener);
359-
this.workspace.addChangeListener(this.handleFieldBoxChange);
360359
this.flyoutWorkspace = this.workspace
361360
.getFlyout()
362361
.getWorkspace();
363362
this.flyoutWorkspace.addChangeListener(this.props.vm.flyoutBlockListener);
364363
this.flyoutWorkspace.addChangeListener(this.props.vm.monitorBlockListener);
364+
this.flyoutWorkspace.addChangeListener(this.handleFieldBoxChange);
365365
this.props.vm.addListener('SCRIPT_GLOW_ON', this.onScriptGlowOn);
366366
this.props.vm.addListener('SCRIPT_GLOW_OFF', this.onScriptGlowOff);
367367
this.props.vm.addListener('BLOCK_GLOW_ON', this.onBlockGlowOn);
@@ -497,7 +497,6 @@ class Blocks extends React.Component {
497497

498498
// Remove and reattach the workspace listener (but allow flyout events)
499499
this.workspace.removeChangeListener(this.props.vm.blockListener);
500-
this.workspace.removeChangeListener(this.handleFieldBoxChange);
501500
const dom = this.ScratchBlocks.Xml.textToDom(data.xml);
502501
try {
503502
this.ScratchBlocks.Xml.clearWorkspaceAndLoadFromXml(dom, this.workspace);
@@ -517,7 +516,6 @@ class Blocks extends React.Component {
517516
log.error(error);
518517
}
519518
this.workspace.addChangeListener(this.props.vm.blockListener);
520-
this.workspace.addChangeListener(this.handleFieldBoxChange);
521519

522520
if (this.props.vm.editingTarget && this.props.workspaceMetrics.targets[this.props.vm.editingTarget.id]) {
523521
const {scrollX, scrollY, scale} = this.props.workspaceMetrics.targets[this.props.vm.editingTarget.id];
@@ -740,7 +738,6 @@ class Blocks extends React.Component {
740738
}
741739
handleFieldBoxChange (args) {
742740
// update checkbox states with menu-dependent blocks
743-
console.log(args, this.props.vm, this.flyoutWorkspace, this.ScratchBlocks);
744741
const editingTarget = this.props.vm.editingTarget;
745742
if (!editingTarget || args.element !== 'field') return;
746743

0 commit comments

Comments
 (0)