From bd3a2121869000933211fcb17d98613654fc5907 Mon Sep 17 00:00:00 2001 From: kozbial Date: Thu, 5 Aug 2021 15:43:06 -0700 Subject: [PATCH] clang-format core/events/block_events.js --- core/events/events_block_base.js | 3 +-- core/events/events_block_change.js | 16 +++++++--------- core/events/events_block_create.js | 5 ++--- core/events/events_block_delete.js | 5 ++--- core/events/events_block_move.js | 12 +++++------- 5 files changed, 17 insertions(+), 24 deletions(-) diff --git a/core/events/events_block_base.js b/core/events/events_block_base.js index 76fa09c978f..1f22a4ed86d 100644 --- a/core/events/events_block_base.js +++ b/core/events/events_block_base.js @@ -42,8 +42,7 @@ const BlockBase = function(opt_block) { */ this.workspaceId = this.isBlank ? '' : opt_block.workspace.id; }; -object.inherits(BlockBase, - Abstract); +object.inherits(BlockBase, Abstract); /** * Encode the event as JSON. diff --git a/core/events/events_block_change.js b/core/events/events_block_change.js index 5e12919c05c..38d8b5c679c 100644 --- a/core/events/events_block_change.js +++ b/core/events/events_block_change.js @@ -32,8 +32,8 @@ const registry = goog.require('Blockly.registry'); * @extends {Events.BlockBase} * @constructor */ -const BlockChange = function(opt_block, opt_element, opt_name, opt_oldValue, - opt_newValue) { +const BlockChange = function( + opt_block, opt_element, opt_name, opt_oldValue, opt_newValue) { BlockChange.superClass_.constructor.call(this, opt_block); if (!opt_block) { return; // Blank event to be populated by fromJson. @@ -94,7 +94,7 @@ BlockChange.prototype.run = function(forward) { const workspace = this.getEventWorkspace_(); const block = workspace.getBlockById(this.blockId); if (!block) { - console.warn("Can't change non-existent block: " + this.blockId); + console.warn('Can\'t change non-existent block: ' + this.blockId); return; } if (block.mutator) { @@ -108,7 +108,7 @@ BlockChange.prototype.run = function(forward) { if (field) { field.setValue(value); } else { - console.warn("Can't set non-existent field: " + this.name); + console.warn('Can\'t set non-existent field: ' + this.name); } break; } @@ -132,11 +132,10 @@ BlockChange.prototype.run = function(forward) { } if (block.domToMutation) { const dom = Xml.textToDom(/** @type {string} */ - (value) || ''); + (value) || ''); block.domToMutation(dom); } - Events.fire(new BlockChange( - block, 'mutation', null, oldMutation, value)); + Events.fire(new BlockChange(block, 'mutation', null, oldMutation, value)); break; } default: @@ -144,7 +143,6 @@ BlockChange.prototype.run = function(forward) { } }; -registry.register(registry.Type.EVENT, Events.CHANGE, - BlockChange); +registry.register(registry.Type.EVENT, Events.CHANGE, BlockChange); exports = BlockChange; diff --git a/core/events/events_block_create.js b/core/events/events_block_create.js index 460afc2c1af..e3531dabea7 100644 --- a/core/events/events_block_create.js +++ b/core/events/events_block_create.js @@ -100,13 +100,12 @@ BlockCreate.prototype.run = function(forward) { block.dispose(false); } else if (id == this.blockId) { // Only complain about root-level block. - console.warn("Can't uncreate non-existent block: " + id); + console.warn('Can\'t uncreate non-existent block: ' + id); } } } }; -registry.register(registry.Type.EVENT, Events.CREATE, - BlockCreate); +registry.register(registry.Type.EVENT, Events.CREATE, BlockCreate); exports = BlockCreate; diff --git a/core/events/events_block_delete.js b/core/events/events_block_delete.js index f2bf510e7d8..57275b31aab 100644 --- a/core/events/events_block_delete.js +++ b/core/events/events_block_delete.js @@ -99,7 +99,7 @@ BlockDelete.prototype.run = function(forward) { block.dispose(false); } else if (id == this.blockId) { // Only complain about root-level block. - console.warn("Can't delete non-existent block: " + id); + console.warn('Can\'t delete non-existent block: ' + id); } } } else { @@ -109,7 +109,6 @@ BlockDelete.prototype.run = function(forward) { } }; -registry.register(registry.Type.EVENT, Events.DELETE, - BlockDelete); +registry.register(registry.Type.EVENT, Events.DELETE, BlockDelete); exports = BlockDelete; diff --git a/core/events/events_block_move.js b/core/events/events_block_move.js index 766d72f96bf..8ab5c5367e0 100644 --- a/core/events/events_block_move.js +++ b/core/events/events_block_move.js @@ -85,8 +85,7 @@ BlockMove.prototype.fromJson = function(json) { this.newInputName = json['newInputName']; if (json['newCoordinate']) { const xy = json['newCoordinate'].split(','); - this.newCoordinate = - new Coordinate(Number(xy[0]), Number(xy[1])); + this.newCoordinate = new Coordinate(Number(xy[0]), Number(xy[1])); } if (json['recordUndo'] !== undefined) { this.recordUndo = json['recordUndo']; @@ -144,7 +143,7 @@ BlockMove.prototype.run = function(forward) { const workspace = this.getEventWorkspace_(); const block = workspace.getBlockById(this.blockId); if (!block) { - console.warn("Can't move non-existent block: " + this.blockId); + console.warn('Can\'t move non-existent block: ' + this.blockId); return; } const parentId = forward ? this.newParentId : this.oldParentId; @@ -154,7 +153,7 @@ BlockMove.prototype.run = function(forward) { if (parentId) { parentBlock = workspace.getBlockById(parentId); if (!parentBlock) { - console.warn("Can't connect to non-existent block: " + parentId); + console.warn('Can\'t connect to non-existent block: ' + parentId); return; } } @@ -179,12 +178,11 @@ BlockMove.prototype.run = function(forward) { if (parentConnection) { blockConnection.connect(parentConnection); } else { - console.warn("Can't connect to non-existent input: " + inputName); + console.warn('Can\'t connect to non-existent input: ' + inputName); } } }; -registry.register(registry.Type.EVENT, Events.MOVE, - BlockMove); +registry.register(registry.Type.EVENT, Events.MOVE, BlockMove); exports = BlockMove;