Fix connection compatibility rules. Use the previous connection when 'pasting above' a block that already has a previous block.

This commit is contained in:
Sean Lip
2016-07-01 15:55:51 -07:00
parent a8bfc38545
commit f30bcbc0e7
2 changed files with 48 additions and 10 deletions

View File

@@ -147,7 +147,16 @@ blocklyApp.WorkspaceTreeComponent = ng.core
pasteToConnection_: function(connection) {
var that = this;
this.treeService.runWhilePreservingFocus(function() {
that.clipboardService.pasteFromClipboard(connection);
// 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.
if (connection.type == Blockly.PREVIOUS_STATEMENT &&
connection.isConnected()) {
that.clipboardService.pasteFromClipboard(
connection.targetConnection);
} else {
that.clipboardService.pasteFromClipboard(connection);
}
}, this.tree.id);
},
sendToMarkedSpot_: function() {