From 83759dbbeeffadde2548ce6e3ebf2c62f2e86678 Mon Sep 17 00:00:00 2001 From: Sean Lip Date: Fri, 22 Jul 2016 14:55:22 -0700 Subject: [PATCH] Declare field buttons declaratively. --- accessible/workspace-tree.component.js | 35 ++++++++++++++++++-------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/accessible/workspace-tree.component.js b/accessible/workspace-tree.component.js index 6c11b0c47..996117d36 100644 --- a/accessible/workspace-tree.component.js +++ b/accessible/workspace-tree.component.js @@ -63,17 +63,11 @@ blocklyApp.WorkspaceTreeComponent = ng.core
    -
  1. - -
  2. -
  3. -
@@ -271,6 +265,27 @@ blocklyApp.WorkspaceTreeComponent = ng.core } }]; + // Generate a list of action buttons. + this.fieldButtonsInfo = [{ + baseIdKey: 'markSpot', + translationIdForText: 'MARK_THIS_SPOT', + action: function(connection) { + that.clipboardService.markConnection(connection); + }, + isDisabled: function() { + return false; + } + }, { + baseIdKey: 'paste', + translationIdForText: 'PASTE', + action: function(connection) { + that.clipboardService.pasteFromClipboard(connection); + }, + isDisabled: function(connection) { + return !that.isCompatibleWithClipboard(connection); + } + }]; + // Make a list of all the id keys. this.idKeys = ['blockRoot', 'blockSummary', 'listItem', 'label']; this.actionButtonsInfo.forEach(function(buttonInfo) {