123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- var blocklyApp = {};
- blocklyApp.UtilsService = ng.core
- .Class({
- constructor: function() {},
- generateUniqueId: function() {
- return 'blockly-' + Blockly.genUid();
- },
- generateIds: function(elementsList) {
- var idMap = {};
- for (var i = 0; i < elementsList.length; i++){
- idMap[elementsList[i]] = this.generateUniqueId();
- }
- return idMap;
- },
- generateAriaLabelledByAttr: function(mainLabel, secondLabel) {
- return mainLabel + (secondLabel ? ' ' + secondLabel : '');
- },
- getInputTypeLabel: function(connection) {
-
-
- if (connection.check_) {
- return connection.check_.join(', ');
- } else {
- return Blockly.Msg.ANY;
- }
- },
- getBlockTypeLabel: function(inputBlock) {
- if (inputBlock.type == Blockly.NEXT_STATEMENT) {
- return Blockly.Msg.BLOCK;
- } else {
- return Blockly.Msg.VALUE;
- }
- },
- getBlockDescription: function(block) {
-
-
- return block.toString(undefined, 'BLANK');
- },
- isWorkspaceEmpty: function() {
- return !blocklyApp.workspace.topBlocks_.length;
- },
- getBlockById: function(blockId) {
- return this.getBlockByIdFromWorkspace(blockId, blocklyApp.workspace);
- },
- getBlockByIdFromWorkspace: function(blockId, workspace) {
-
-
- return workspace.getBlockById(blockId);
- }
- });
|