When a block is pasted to a tree, set the active descendant of that tree to the newly-pasted block.

This commit is contained in:
Sean Lip
2016-07-21 17:28:58 -07:00
parent 869bda6495
commit c958cf5eaf
2 changed files with 8 additions and 2 deletions

View File

@@ -115,6 +115,7 @@ blocklyApp.ClipboardService = ng.core
alert(
Blockly.Msg.PASTED_BLOCK_FROM_CLIPBOARD_MSG +
reconstitutedBlock.toString());
return reconstitutedBlock.id;
},
pasteToMarkedConnection: function(block) {
var xml = Blockly.Xml.blockToDom(block);

View File

@@ -157,13 +157,18 @@ blocklyApp.WorkspaceTreeComponent = ng.core
// If the connection is a 'previousConnection' and that connection is
// already joined to something, use the 'nextConnection' of the
// previous block instead in order to do an insertion.
var newBlockId = null;
if (connection.type == Blockly.PREVIOUS_STATEMENT &&
connection.isConnected()) {
that.clipboardService.pasteFromClipboard(
newBlockId = that.clipboardService.pasteFromClipboard(
connection.targetConnection);
} else {
that.clipboardService.pasteFromClipboard(connection);
newBlockId = that.clipboardService.pasteFromClipboard(connection);
}
// Move the screenreader focus to the newly-pasted block.
that.treeService.setActiveDesc(newBlockId + 'blockRoot', that.tree.id);
}, this.tree.id);
},
moveToMarkedSpot_: function() {