mirror of
https://github.com/google/blockly.git
synced 2026-01-07 17:10:11 +01:00
Wording changes. Reinstate copy/paste blocks temporarily.
This commit is contained in:
@@ -31,20 +31,24 @@ Blockly.Msg.WORKSPACE_BLOCK = 'workspace block. Move right to view submenu.';
|
||||
|
||||
Blockly.Msg.CLEAR_WORKSPACE = 'Erase Workspace';
|
||||
|
||||
Blockly.Msg.COPY_TO_MARKED_SPOT = 'Copy to marked spot.';
|
||||
Blockly.Msg.COPY_TO_CLIPBOARD = 'Copy to clipboard.';
|
||||
Blockly.Msg.COPY_TO_MARKED_SPOT = 'Copy to link.';
|
||||
Blockly.Msg.COPY_TO_WORKSPACE = 'Add to workspace.';
|
||||
|
||||
Blockly.Msg.COPY_BLOCK = 'Copy block.';
|
||||
Blockly.Msg.DELETE = 'Delete block.';
|
||||
Blockly.Msg.MARK_SPOT_BEFORE = 'Mark spot before.';
|
||||
Blockly.Msg.MARK_SPOT_AFTER = 'Mark spot after.';
|
||||
Blockly.Msg.MARK_THIS_SPOT = 'Mark this spot.';
|
||||
Blockly.Msg.MOVE_TO_MARKED_SPOT = 'Move to marked spot.';
|
||||
Blockly.Msg.PASTE = 'Paste.';
|
||||
Blockly.Msg.MARK_SPOT_BEFORE = 'Add link before.';
|
||||
Blockly.Msg.MARK_SPOT_AFTER = 'Add link after.';
|
||||
Blockly.Msg.MARK_THIS_SPOT = 'Add link inside.';
|
||||
Blockly.Msg.MOVE_TO_MARKED_SPOT = 'Attach to link.';
|
||||
Blockly.Msg.PASTE_AFTER = 'Paste after.';
|
||||
Blockly.Msg.PASTE_BEFORE = 'Paste before.';
|
||||
Blockly.Msg.PASTE_INSIDE = 'Paste inside.';
|
||||
|
||||
Blockly.Msg.ANY = 'any';
|
||||
Blockly.Msg.BLOCK = 'block';
|
||||
Blockly.Msg.BUTTON = 'Button.';
|
||||
Blockly.Msg.FOR = 'for';
|
||||
Blockly.Msg.STATEMENT = 'statement';
|
||||
Blockly.Msg.VALUE = 'value';
|
||||
|
||||
Blockly.Msg.BLOCK_OPTIONS = 'Block options: ';
|
||||
|
||||
@@ -34,6 +34,13 @@ blocklyApp.ToolboxTreeComponent = ng.core
|
||||
[attr.aria-level]="level">
|
||||
<label #toolboxBlockSummary [id]="idMap['toolboxBlockSummary']">{{getBlockDescription()}}</label>
|
||||
<ol role="group" *ngIf="displayBlockMenu">
|
||||
<li [id]="idMap['blockCopy']" role="treeitem" *ngIf="!isWorkspaceEmpty()"
|
||||
[attr.aria-labelledBy]="generateAriaLabelledByAttr(idMap['blockCopyButton'], 'blockly-button')"
|
||||
[attr.aria-level]="level + 1">
|
||||
<button [id]="idMap['blockCopyButton']" (click)="copyToClipboard()" tabindex="-1">
|
||||
{{'COPY_TO_CLIPBOARD'|translate}}
|
||||
</button>
|
||||
</li>
|
||||
<li [id]="idMap['sendToSelected']" role="treeitem" *ngIf="!isWorkspaceEmpty()"
|
||||
[attr.aria-labelledBy]="generateAriaLabelledByAttr(idMap['sendToSelectedButton'], 'blockly-button')"
|
||||
[attr.aria-level]="level + 1"
|
||||
@@ -77,7 +84,7 @@ blocklyApp.ToolboxTreeComponent = ng.core
|
||||
if (this.displayBlockMenu) {
|
||||
idKeys = idKeys.concat([
|
||||
'workspaceCopy', 'workspaceCopyButton', 'sendToSelected',
|
||||
'sendToSelectedButton']);
|
||||
'sendToSelectedButton', 'blockCopy', 'blockCopyButton']);
|
||||
}
|
||||
|
||||
this.idMap = {};
|
||||
@@ -111,6 +118,11 @@ blocklyApp.ToolboxTreeComponent = ng.core
|
||||
canBeCopiedToMarkedConnection: function() {
|
||||
return this.clipboardService.canBeCopiedToMarkedConnection(this.block);
|
||||
},
|
||||
copyToClipboard: function() {
|
||||
this.clipboardService.copy(this.block);
|
||||
this.notificationsService.setStatusMessage(
|
||||
this.getBlockDescription() + ' ' + Blockly.Msg.COPIED_BLOCK_MSG);
|
||||
},
|
||||
copyToWorkspace: function() {
|
||||
var blockDescription = this.getBlockDescription();
|
||||
var xml = Blockly.Xml.blockToDom(this.block);
|
||||
|
||||
@@ -54,7 +54,7 @@ blocklyApp.UtilsService = ng.core
|
||||
},
|
||||
getBlockTypeLabel: function(inputBlock) {
|
||||
if (inputBlock.type == Blockly.NEXT_STATEMENT) {
|
||||
return Blockly.Msg.STATEMENT;
|
||||
return Blockly.Msg.BLOCK;
|
||||
} else {
|
||||
return Blockly.Msg.VALUE;
|
||||
}
|
||||
|
||||
@@ -162,12 +162,39 @@ blocklyApp.WorkspaceTreeComponent = ng.core
|
||||
// Generate a list of action buttons.
|
||||
var that = this;
|
||||
this.actionButtonsInfo = [{
|
||||
baseIdKey: 'moveToMarkedSpot',
|
||||
translationIdForText: 'MOVE_TO_MARKED_SPOT',
|
||||
action: that.moveToMarkedSpot_.bind(that),
|
||||
baseIdKey: 'copy',
|
||||
translationIdForText: 'COPY_BLOCK',
|
||||
action: function() {
|
||||
that.clipboardService.copy(that.block);
|
||||
that.notificationsService.setStatusMessage(
|
||||
that.getBlockDescription() + ' ' + Blockly.Msg.COPIED_BLOCK_MSG);
|
||||
},
|
||||
isDisabled: function() {
|
||||
return !that.clipboardService.isMovableToMarkedConnection(
|
||||
that.block);
|
||||
return false;
|
||||
}
|
||||
}, {
|
||||
baseIdKey: 'pasteBefore',
|
||||
translationIdForText: 'PASTE_BEFORE',
|
||||
action: function() {
|
||||
that.treeService.pasteToConnection(
|
||||
that.block, that.block.previousConnection);
|
||||
},
|
||||
isDisabled: function() {
|
||||
return Boolean(
|
||||
!that.block.previousConnection ||
|
||||
!that.isCompatibleWithClipboard(that.block.previousConnection));
|
||||
}
|
||||
}, {
|
||||
baseIdKey: 'pasteAfter',
|
||||
translationIdForText: 'PASTE_AFTER',
|
||||
action: function() {
|
||||
that.treeService.pasteToConnection(
|
||||
that.block, that.block.nextConnection);
|
||||
},
|
||||
isDisabled: function() {
|
||||
return Boolean(
|
||||
!that.block.nextConnection ||
|
||||
!that.isCompatibleWithClipboard(that.block.nextConnection));
|
||||
}
|
||||
}, {
|
||||
baseIdKey: 'markBefore',
|
||||
@@ -183,6 +210,14 @@ blocklyApp.WorkspaceTreeComponent = ng.core
|
||||
isDisabled: function() {
|
||||
return !that.block.nextConnection;
|
||||
}
|
||||
}, {
|
||||
baseIdKey: 'moveToMarkedSpot',
|
||||
translationIdForText: 'MOVE_TO_MARKED_SPOT',
|
||||
action: that.moveToMarkedSpot_.bind(that),
|
||||
isDisabled: function() {
|
||||
return !that.clipboardService.isMovableToMarkedConnection(
|
||||
that.block);
|
||||
}
|
||||
}, {
|
||||
baseIdKey: 'delete',
|
||||
translationIdForText: 'DELETE',
|
||||
@@ -204,7 +239,7 @@ blocklyApp.WorkspaceTreeComponent = ng.core
|
||||
}
|
||||
}, {
|
||||
baseIdKey: 'paste',
|
||||
translationIdForText: 'PASTE',
|
||||
translationIdForText: 'PASTE_INSIDE',
|
||||
action: function(connection) {
|
||||
that.treeService.pasteToConnection(that.block, connection);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user