mirror of
https://github.com/google/blockly.git
synced 2026-01-05 08:00:09 +01:00
Standardize indentation.
This commit is contained in:
@@ -27,39 +27,39 @@
|
||||
blocklyApp.FieldSegmentComponent = ng.core.Component({
|
||||
selector: 'blockly-field-segment',
|
||||
template: `
|
||||
<template [ngIf]="!mainField">
|
||||
<label [id]="mainFieldId">{{getPrefixText()}}</label>
|
||||
</template>
|
||||
|
||||
<template [ngIf]="mainField">
|
||||
<template [ngIf]="isTextInput()">
|
||||
{{getPrefixText()}}
|
||||
<input [id]="mainFieldId" type="text" [disabled]="disabled"
|
||||
[ngModel]="mainField.getValue()" (ngModelChange)="mainField.setValue($event)"
|
||||
[attr.aria-label]="getFieldDescription() + (disabled ? 'Disabled text field' : 'Press Enter to edit text')"
|
||||
tabindex="-1">
|
||||
<template [ngIf]="!mainField">
|
||||
<label [id]="mainFieldId">{{getPrefixText()}}</label>
|
||||
</template>
|
||||
|
||||
<template [ngIf]="isNumberInput()">
|
||||
{{getPrefixText()}}
|
||||
<input [id]="mainFieldId" type="number" [disabled]="disabled"
|
||||
[ngModel]="mainField.getValue()" (ngModelChange)="setNumberValue($event)"
|
||||
[attr.aria-label]="getFieldDescription() + (disabled ? 'Disabled number field' : 'Press Enter to edit number')"
|
||||
tabindex="-1">
|
||||
</template>
|
||||
<template [ngIf]="mainField">
|
||||
<template [ngIf]="isTextInput()">
|
||||
{{getPrefixText()}}
|
||||
<input [id]="mainFieldId" type="text" [disabled]="disabled"
|
||||
[ngModel]="mainField.getValue()" (ngModelChange)="mainField.setValue($event)"
|
||||
[attr.aria-label]="getFieldDescription() + (disabled ? 'Disabled text field' : 'Press Enter to edit text')"
|
||||
tabindex="-1">
|
||||
</template>
|
||||
|
||||
<template [ngIf]="isDropdown()">
|
||||
{{getPrefixText()}}
|
||||
<select [id]="mainFieldId" [name]="mainFieldId" tabindex="-1"
|
||||
[ngModel]="mainField.getValue()"
|
||||
(ngModelChange)="handleDropdownChange(mainField, $event)">
|
||||
<option *ngFor="#optionValue of getOptions()" value="{{optionValue}}"
|
||||
[selected]="mainField.getValue() == optionValue">
|
||||
{{optionText[optionValue]}}
|
||||
</option>
|
||||
</select>
|
||||
<template [ngIf]="isNumberInput()">
|
||||
{{getPrefixText()}}
|
||||
<input [id]="mainFieldId" type="number" [disabled]="disabled"
|
||||
[ngModel]="mainField.getValue()" (ngModelChange)="setNumberValue($event)"
|
||||
[attr.aria-label]="getFieldDescription() + (disabled ? 'Disabled number field' : 'Press Enter to edit number')"
|
||||
tabindex="-1">
|
||||
</template>
|
||||
|
||||
<template [ngIf]="isDropdown()">
|
||||
{{getPrefixText()}}
|
||||
<select [id]="mainFieldId" [name]="mainFieldId" tabindex="-1"
|
||||
[ngModel]="mainField.getValue()"
|
||||
(ngModelChange)="handleDropdownChange(mainField, $event)">
|
||||
<option *ngFor="#optionValue of getOptions()" value="{{optionValue}}"
|
||||
[selected]="mainField.getValue() == optionValue">
|
||||
{{optionText[optionValue]}}
|
||||
</option>
|
||||
</select>
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
`,
|
||||
inputs: ['prefixFields', 'mainField', 'mainFieldId', 'level'],
|
||||
pipes: [blocklyApp.TranslatePipe]
|
||||
|
||||
@@ -27,32 +27,32 @@
|
||||
blocklyApp.SidebarComponent = ng.core.Component({
|
||||
selector: 'blockly-sidebar',
|
||||
template: `
|
||||
<div class="blocklySidebarColumn">
|
||||
<button *ngFor="#buttonConfig of customSidebarButtons"
|
||||
id="{{buttonConfig.id || undefined}}"
|
||||
(click)="buttonConfig.action()"
|
||||
class="blocklySidebarButton">
|
||||
{{buttonConfig.text}}
|
||||
</button>
|
||||
<button id="{{ID_FOR_ATTACH_TO_LINK_BUTTON}}"
|
||||
(click)="showToolboxModalForAttachToMarkedConnection()"
|
||||
[attr.disabled]="!isAnyConnectionMarked() ? 'disabled' : undefined"
|
||||
[attr.aria-disabled]="!isAnyConnectionMarked()"
|
||||
class="blocklySidebarButton">
|
||||
{{'ATTACH_NEW_BLOCK_TO_LINK'|translate}}
|
||||
</button>
|
||||
<button id="{{ID_FOR_CREATE_NEW_GROUP_BUTTON}}"
|
||||
(click)="showToolboxModalForCreateNewGroup()"
|
||||
class="blocklySidebarButton">
|
||||
{{'CREATE_NEW_BLOCK_GROUP'|translate}}
|
||||
</button>
|
||||
<button id="clear-workspace" (click)="clearWorkspace()"
|
||||
[attr.disabled]="isWorkspaceEmpty() ? 'disabled' : undefined"
|
||||
[attr.aria-disabled]="isWorkspaceEmpty()"
|
||||
class="blocklySidebarButton">
|
||||
{{'ERASE_WORKSPACE'|translate}}
|
||||
</button>
|
||||
</div>
|
||||
<div class="blocklySidebarColumn">
|
||||
<button *ngFor="#buttonConfig of customSidebarButtons"
|
||||
id="{{buttonConfig.id || undefined}}"
|
||||
(click)="buttonConfig.action()"
|
||||
class="blocklySidebarButton">
|
||||
{{buttonConfig.text}}
|
||||
</button>
|
||||
<button id="{{ID_FOR_ATTACH_TO_LINK_BUTTON}}"
|
||||
(click)="showToolboxModalForAttachToMarkedConnection()"
|
||||
[attr.disabled]="!isAnyConnectionMarked() ? 'disabled' : undefined"
|
||||
[attr.aria-disabled]="!isAnyConnectionMarked()"
|
||||
class="blocklySidebarButton">
|
||||
{{'ATTACH_NEW_BLOCK_TO_LINK'|translate}}
|
||||
</button>
|
||||
<button id="{{ID_FOR_CREATE_NEW_GROUP_BUTTON}}"
|
||||
(click)="showToolboxModalForCreateNewGroup()"
|
||||
class="blocklySidebarButton">
|
||||
{{'CREATE_NEW_BLOCK_GROUP'|translate}}
|
||||
</button>
|
||||
<button id="clear-workspace" (click)="clearWorkspace()"
|
||||
[attr.disabled]="isWorkspaceEmpty() ? 'disabled' : undefined"
|
||||
[attr.aria-disabled]="isWorkspaceEmpty()"
|
||||
class="blocklySidebarButton">
|
||||
{{'ERASE_WORKSPACE'|translate}}
|
||||
</button>
|
||||
</div>
|
||||
`,
|
||||
pipes: [blocklyApp.TranslatePipe]
|
||||
})
|
||||
|
||||
@@ -27,48 +27,48 @@
|
||||
blocklyApp.WorkspaceTreeComponent = ng.core.Component({
|
||||
selector: 'blockly-workspace-tree',
|
||||
template: `
|
||||
<li [id]="idMap['blockRoot']" role="treeitem" class="blocklyHasChildren"
|
||||
[attr.aria-labelledBy]="generateAriaLabelledByAttr(idMap['blockSummary'], 'blockly-translate-workspace-block')"
|
||||
[attr.aria-level]="level">
|
||||
<label [id]="idMap['blockSummary']">{{getBlockDescription()}}</label>
|
||||
<li [id]="idMap['blockRoot']" role="treeitem" class="blocklyHasChildren"
|
||||
[attr.aria-labelledBy]="generateAriaLabelledByAttr(idMap['blockSummary'], 'blockly-translate-workspace-block')"
|
||||
[attr.aria-level]="level">
|
||||
<label [id]="idMap['blockSummary']">{{getBlockDescription()}}</label>
|
||||
|
||||
<ol role="group">
|
||||
<template ngFor #blockInput [ngForOf]="block.inputList" #i="index">
|
||||
<li role="treeitem" [id]="idMap['listItem' + i]" [attr.aria-level]="level + 1" *ngIf="blockInput.fieldRow.length"
|
||||
[attr.aria-labelledBy]="generateAriaLabelledByAttr(idMap['fieldLabel' + i])">
|
||||
<blockly-field-segment *ngFor="#fieldSegment of inputListAsFieldSegments[i]"
|
||||
[prefixFields]="fieldSegment.prefixFields"
|
||||
[mainField]="fieldSegment.mainField"
|
||||
[mainFieldId]="idMap['fieldLabel' + i]"
|
||||
[level]="level + 2">
|
||||
</blockly-field-segment>
|
||||
</li>
|
||||
<ol role="group">
|
||||
<template ngFor #blockInput [ngForOf]="block.inputList" #i="index">
|
||||
<li role="treeitem" [id]="idMap['listItem' + i]" [attr.aria-level]="level + 1" *ngIf="blockInput.fieldRow.length"
|
||||
[attr.aria-labelledBy]="generateAriaLabelledByAttr(idMap['fieldLabel' + i])">
|
||||
<blockly-field-segment *ngFor="#fieldSegment of inputListAsFieldSegments[i]"
|
||||
[prefixFields]="fieldSegment.prefixFields"
|
||||
[mainField]="fieldSegment.mainField"
|
||||
[mainFieldId]="idMap['fieldLabel' + i]"
|
||||
[level]="level + 2">
|
||||
</blockly-field-segment>
|
||||
</li>
|
||||
|
||||
<blockly-workspace-tree *ngIf="blockInput.connection && blockInput.connection.targetBlock()"
|
||||
[block]="blockInput.connection.targetBlock()" [level]="level + 1"
|
||||
[tree]="tree">
|
||||
</blockly-workspace-tree>
|
||||
<li #inputList [id]="idMap['inputList' + i]" role="treeitem"
|
||||
*ngIf="blockInput.connection && !blockInput.connection.targetBlock()"
|
||||
[attr.aria-labelledBy]="generateAriaLabelledByAttr(idMap['inputMenuLabel' + i], 'blockly-submenu-indicator')"
|
||||
[attr.aria-level]="level + 1">
|
||||
<label [id]="idMap['inputMenuLabel' + i]">
|
||||
{{getBlockNeededLabel(blockInput)}}
|
||||
</label>
|
||||
<button [id]="idMap[fieldButtonsInfo[0].baseIdKey + 'Button' + i]"
|
||||
(click)="fieldButtonsInfo[0].action(blockInput.connection)"
|
||||
[disabled]="fieldButtonsInfo[0].isDisabled(blockInput.connection)" tabindex="-1">
|
||||
{{fieldButtonsInfo[0].translationIdForText|translate}}
|
||||
</button>
|
||||
</li>
|
||||
</template>
|
||||
</ol>
|
||||
</li>
|
||||
<blockly-workspace-tree *ngIf="blockInput.connection && blockInput.connection.targetBlock()"
|
||||
[block]="blockInput.connection.targetBlock()" [level]="level + 1"
|
||||
[tree]="tree">
|
||||
</blockly-workspace-tree>
|
||||
<li #inputList [id]="idMap['inputList' + i]" role="treeitem"
|
||||
*ngIf="blockInput.connection && !blockInput.connection.targetBlock()"
|
||||
[attr.aria-labelledBy]="generateAriaLabelledByAttr(idMap['inputMenuLabel' + i], 'blockly-submenu-indicator')"
|
||||
[attr.aria-level]="level + 1">
|
||||
<label [id]="idMap['inputMenuLabel' + i]">
|
||||
{{getBlockNeededLabel(blockInput)}}
|
||||
</label>
|
||||
<button [id]="idMap[fieldButtonsInfo[0].baseIdKey + 'Button' + i]"
|
||||
(click)="fieldButtonsInfo[0].action(blockInput.connection)"
|
||||
[disabled]="fieldButtonsInfo[0].isDisabled(blockInput.connection)" tabindex="-1">
|
||||
{{fieldButtonsInfo[0].translationIdForText|translate}}
|
||||
</button>
|
||||
</li>
|
||||
</template>
|
||||
</ol>
|
||||
</li>
|
||||
|
||||
<blockly-workspace-tree *ngIf= "block.nextConnection && block.nextConnection.targetBlock()"
|
||||
[block]="block.nextConnection.targetBlock()"
|
||||
[level]="level" [tree]="tree">
|
||||
</blockly-workspace-tree>
|
||||
<blockly-workspace-tree *ngIf= "block.nextConnection && block.nextConnection.targetBlock()"
|
||||
[block]="block.nextConnection.targetBlock()"
|
||||
[level]="level" [tree]="tree">
|
||||
</blockly-workspace-tree>
|
||||
`,
|
||||
directives: [blocklyApp.FieldSegmentComponent, ng.core.forwardRef(function() {
|
||||
return blocklyApp.WorkspaceTreeComponent;
|
||||
|
||||
@@ -27,32 +27,32 @@
|
||||
blocklyApp.WorkspaceComponent = ng.core.Component({
|
||||
selector: 'blockly-workspace',
|
||||
template: `
|
||||
<div class="blocklyWorkspaceColumn">
|
||||
<h3 #workspaceTitle id="blockly-workspace-title">{{'WORKSPACE'|translate}}</h3>
|
||||
<div class="blocklyWorkspaceColumn">
|
||||
<h3 #workspaceTitle id="blockly-workspace-title">{{'WORKSPACE'|translate}}</h3>
|
||||
|
||||
<div *ngIf="workspace" class="blocklyWorkspace">
|
||||
<ol #tree *ngFor="#block of workspace.topBlocks_; #i = index"
|
||||
tabindex="0" role="tree" class="blocklyTree blocklyWorkspaceFocusTarget"
|
||||
[attr.aria-activedescendant]="getActiveDescId(tree.id)"
|
||||
[attr.aria-labelledby]="workspaceTitle.id"
|
||||
(keydown)="onKeypress($event, tree)"
|
||||
(focus)="speakLocation(i)">
|
||||
<blockly-workspace-tree [level]="0" [block]="block" [tree]="tree" [isTopLevel]="true">
|
||||
</blockly-workspace-tree>
|
||||
</ol>
|
||||
<div *ngIf="workspace" class="blocklyWorkspace">
|
||||
<ol #tree *ngFor="#block of workspace.topBlocks_; #i = index"
|
||||
tabindex="0" role="tree" class="blocklyTree blocklyWorkspaceFocusTarget"
|
||||
[attr.aria-activedescendant]="getActiveDescId(tree.id)"
|
||||
[attr.aria-labelledby]="workspaceTitle.id"
|
||||
(keydown)="onKeypress($event, tree)"
|
||||
(focus)="speakLocation(i)">
|
||||
<blockly-workspace-tree [level]="0" [block]="block" [tree]="tree" [isTopLevel]="true">
|
||||
</blockly-workspace-tree>
|
||||
</ol>
|
||||
|
||||
<span *ngIf="workspace.topBlocks_.length === 0">
|
||||
<p>
|
||||
There are no blocks in the workspace.
|
||||
<button (click)="showToolboxModalForCreateNewGroup()"
|
||||
class="blocklyWorkspaceFocusTarget"
|
||||
id="{{ID_FOR_EMPTY_WORKSPACE_BTN}}">
|
||||
Create new block group...
|
||||
</button>
|
||||
</p>
|
||||
</span>
|
||||
<span *ngIf="workspace.topBlocks_.length === 0">
|
||||
<p>
|
||||
There are no blocks in the workspace.
|
||||
<button (click)="showToolboxModalForCreateNewGroup()"
|
||||
class="blocklyWorkspaceFocusTarget"
|
||||
id="{{ID_FOR_EMPTY_WORKSPACE_BTN}}">
|
||||
Create new block group...
|
||||
</button>
|
||||
</p>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
directives: [blocklyApp.WorkspaceTreeComponent],
|
||||
pipes: [blocklyApp.TranslatePipe]
|
||||
|
||||
Reference in New Issue
Block a user