Implement correct behaviour for copying a block from the toolbox to a marked spot.

This commit is contained in:
Sean Lip
2016-07-21 16:48:08 -07:00
parent 606a5e1d08
commit c4abbff496
3 changed files with 39 additions and 27 deletions

View File

@@ -176,15 +176,18 @@ blocklyApp.WorkspaceTreeComponent = ng.core
var blockDescription = this.block.toString();
var newBlockId = this.clipboardService.pasteToMarkedConnection(
this.block, false);
this.block);
var that = this;
this.removeBlockAndSetFocus_(this.block, function() {
that.block.dispose(true);
});
// Invoke a digest cycle, so that the DOM settles.
setTimeout(function() {
var destinationTreeId = that.treeService.getTreeIdForBlock(newBlockId);
that.treeService.clearActiveDesc(destinationTreeId);
document.getElementById(destinationTreeId).focus();
that.treeService.setActiveDesc(
newBlockId + 'blockRoot', destinationTreeId);