diff --git a/core/block.js b/core/block.js index 060fff97c..8a0521c08 100644 --- a/core/block.js +++ b/core/block.js @@ -1123,7 +1123,8 @@ Block.prototype.getVarModels = function() { Block.prototype.updateVarName = function(variable) { for (let i = 0, input; (input = this.inputList[i]); i++) { for (let j = 0, field; (field = input.fieldRow[j]); j++) { - if (field.referencesVariables() && variable.getId() === field.getValue()) { + if (field.referencesVariables() && + variable.getId() === field.getValue()) { field.refreshVariableName(); } } diff --git a/core/blockly.js b/core/blockly.js index 26328a302..85916e400 100644 --- a/core/blockly.js +++ b/core/blockly.js @@ -748,8 +748,7 @@ exports.zelos = zelos; // accessors on one copy would call get/set functions on the other // copy!) if (globalThis.goog && globalThis.Blockly && - typeof globalThis.Blockly === 'object' && - globalThis.Blockly !== exports) { + typeof globalThis.Blockly === 'object' && globalThis.Blockly !== exports) { const descriptors = Object.getOwnPropertyDescriptors(exports); const accessors = {}; for (const key in descriptors) { diff --git a/core/contextmenu_items.js b/core/contextmenu_items.js index ccb7f72e2..73ac6a030 100644 --- a/core/contextmenu_items.js +++ b/core/contextmenu_items.js @@ -604,7 +604,7 @@ const registerHelp = function() { scope) { const block = scope.block; const url = (typeof block.helpUrl === 'function') ? block.helpUrl() : - block.helpUrl; + block.helpUrl; if (url) { return 'enabled'; } diff --git a/core/css.js b/core/css.js index b38c7e04f..aef41e4c4 100644 --- a/core/css.js +++ b/core/css.js @@ -39,8 +39,8 @@ const register = function(cssContent) { if (Array.isArray(cssContent)) { deprecation.warn( - 'Registering CSS by passing an array of strings', 'September 2021', - 'September 2022', 'css.register passing a multiline string'); + 'Registering CSS by passing an array of strings', 'September 2021', + 'September 2022', 'css.register passing a multiline string'); content += ('\n' + cssContent.join('\n')); } else { // Add new cssContent in the global content. diff --git a/core/events/events.js b/core/events/events.js index bc935b645..d4cb5f7d4 100644 --- a/core/events/events.js +++ b/core/events/events.js @@ -145,4 +145,3 @@ Object.defineProperties(exports, { }, }, }); - diff --git a/core/events/events_block_change.js b/core/events/events_block_change.js index 4b7ed2b0a..4a9720ad8 100644 --- a/core/events/events_block_change.js +++ b/core/events/events_block_change.js @@ -139,7 +139,8 @@ BlockChange.prototype.run = function(forward) { block.domToMutation( Xml.textToDom(/** @type {string} */ (value) || '')); } - eventUtils.fire(new BlockChange(block, 'mutation', null, oldState, value)); + eventUtils.fire( + new BlockChange(block, 'mutation', null, oldState, value)); break; } default: diff --git a/core/events/events_block_create.js b/core/events/events_block_create.js index 1300e0c60..9a3254358 100644 --- a/core/events/events_block_create.js +++ b/core/events/events_block_create.js @@ -50,8 +50,8 @@ const BlockCreate = function(opt_block) { * JSON representation of the block that was just created. * @type {!blocks.State} */ - this.json = /** @type {!blocks.State} */ (blocks.save( - opt_block, {addCoordinates: true})); + this.json = /** @type {!blocks.State} */ ( + blocks.save(opt_block, {addCoordinates: true})); }; object.inherits(BlockCreate, BlockBase); diff --git a/core/events/events_block_delete.js b/core/events/events_block_delete.js index d1333c9ba..80ef65d5e 100644 --- a/core/events/events_block_delete.js +++ b/core/events/events_block_delete.js @@ -59,8 +59,8 @@ const BlockDelete = function(opt_block) { * JSON representation of the block that was just deleted. * @type {!blocks.State} */ - this.oldJson = /** @type {!blocks.State} */ (blocks.save( - opt_block, {addCoordinates: true})); + this.oldJson = /** @type {!blocks.State} */ ( + blocks.save(opt_block, {addCoordinates: true})); }; object.inherits(BlockDelete, BlockBase); @@ -95,7 +95,7 @@ BlockDelete.prototype.fromJson = function(json) { this.oldXml = Xml.textToDom(json['oldXml']); this.ids = json['ids']; this.wasShadow = - json['wasShadow'] || this.oldXml.tagName.toLowerCase() === 'shadow'; + json['wasShadow'] || this.oldXml.tagName.toLowerCase() === 'shadow'; this.oldJson = /** @type {!blocks.State} */ (json['oldJson']); if (json['recordUndo'] !== undefined) { this.recordUndo = json['recordUndo']; diff --git a/core/events/events_comment_change.js b/core/events/events_comment_change.js index fef6f4150..1f6b44ba3 100644 --- a/core/events/events_comment_change.js +++ b/core/events/events_comment_change.js @@ -97,6 +97,7 @@ CommentChange.prototype.run = function(forward) { comment.setContent(contents); }; -registry.register(registry.Type.EVENT, eventUtils.COMMENT_CHANGE, CommentChange); +registry.register( + registry.Type.EVENT, eventUtils.COMMENT_CHANGE, CommentChange); exports.CommentChange = CommentChange; diff --git a/core/events/events_comment_create.js b/core/events/events_comment_create.js index c82fc24a5..5d9cb8d79 100644 --- a/core/events/events_comment_create.js +++ b/core/events/events_comment_create.js @@ -76,6 +76,7 @@ CommentCreate.prototype.run = function(forward) { CommentBase.CommentCreateDeleteHelper(this, forward); }; -registry.register(registry.Type.EVENT, eventUtils.COMMENT_CREATE, CommentCreate); +registry.register( + registry.Type.EVENT, eventUtils.COMMENT_CREATE, CommentCreate); exports.CommentCreate = CommentCreate; diff --git a/core/events/events_comment_delete.js b/core/events/events_comment_delete.js index d4dba4433..54e1df4ba 100644 --- a/core/events/events_comment_delete.js +++ b/core/events/events_comment_delete.js @@ -73,6 +73,7 @@ CommentDelete.prototype.run = function(forward) { CommentBase.CommentCreateDeleteHelper(this, !forward); }; -registry.register(registry.Type.EVENT, eventUtils.COMMENT_DELETE, CommentDelete); +registry.register( + registry.Type.EVENT, eventUtils.COMMENT_DELETE, CommentDelete); exports.CommentDelete = CommentDelete; diff --git a/core/events/events_viewport.js b/core/events/events_viewport.js index 806223e95..71ac3d3c7 100644 --- a/core/events/events_viewport.js +++ b/core/events/events_viewport.js @@ -100,6 +100,7 @@ ViewportChange.prototype.fromJson = function(json) { this.oldScale = json['oldScale']; }; -registry.register(registry.Type.EVENT, eventUtils.VIEWPORT_CHANGE, ViewportChange); +registry.register( + registry.Type.EVENT, eventUtils.VIEWPORT_CHANGE, ViewportChange); exports.ViewportChange = ViewportChange; diff --git a/core/field_colour.js b/core/field_colour.js index e9ec37668..4b4c037a9 100644 --- a/core/field_colour.js +++ b/core/field_colour.js @@ -255,25 +255,85 @@ FieldColour.prototype.getText = function() { */ FieldColour.COLOURS = [ // grays - '#ffffff', '#cccccc', '#c0c0c0', '#999999', '#666666', '#333333', '#000000', + '#ffffff', + '#cccccc', + '#c0c0c0', + '#999999', + '#666666', + '#333333', + '#000000', // reds - '#ffcccc', '#ff6666', '#ff0000', '#cc0000', '#990000', '#660000', '#330000', + '#ffcccc', + '#ff6666', + '#ff0000', + '#cc0000', + '#990000', + '#660000', + '#330000', // oranges - '#ffcc99', '#ff9966', '#ff9900', '#ff6600', '#cc6600', '#993300', '#663300', + '#ffcc99', + '#ff9966', + '#ff9900', + '#ff6600', + '#cc6600', + '#993300', + '#663300', // yellows - '#ffff99', '#ffff66', '#ffcc66', '#ffcc33', '#cc9933', '#996633', '#663333', + '#ffff99', + '#ffff66', + '#ffcc66', + '#ffcc33', + '#cc9933', + '#996633', + '#663333', // olives - '#ffffcc', '#ffff33', '#ffff00', '#ffcc00', '#999900', '#666600', '#333300', + '#ffffcc', + '#ffff33', + '#ffff00', + '#ffcc00', + '#999900', + '#666600', + '#333300', // greens - '#99ff99', '#66ff99', '#33ff33', '#33cc00', '#009900', '#006600', '#003300', + '#99ff99', + '#66ff99', + '#33ff33', + '#33cc00', + '#009900', + '#006600', + '#003300', // turquoises - '#99ffff', '#33ffff', '#66cccc', '#00cccc', '#339999', '#336666', '#003333', + '#99ffff', + '#33ffff', + '#66cccc', + '#00cccc', + '#339999', + '#336666', + '#003333', // blues - '#ccffff', '#66ffff', '#33ccff', '#3366ff', '#3333ff', '#000099', '#000066', + '#ccffff', + '#66ffff', + '#33ccff', + '#3366ff', + '#3333ff', + '#000099', + '#000066', // purples - '#ccccff', '#9999ff', '#6666cc', '#6633ff', '#6600cc', '#333399', '#330099', + '#ccccff', + '#9999ff', + '#6666cc', + '#6633ff', + '#6600cc', + '#333399', + '#330099', // violets - '#ffccff', '#ff99ff', '#cc66cc', '#cc33cc', '#993399', '#663366', '#330033', + '#ffccff', + '#ff99ff', + '#cc66cc', + '#cc33cc', + '#993399', + '#663366', + '#330033', ]; /** diff --git a/core/inject.js b/core/inject.js index 638d88eaa..d74c88b3d 100644 --- a/core/inject.js +++ b/core/inject.js @@ -343,19 +343,22 @@ const loadSounds = function(pathToMedia, workspace) { const audioMgr = workspace.getAudioManager(); audioMgr.load( [ - pathToMedia + 'click.mp3', pathToMedia + 'click.wav', + pathToMedia + 'click.mp3', + pathToMedia + 'click.wav', pathToMedia + 'click.ogg', ], 'click'); audioMgr.load( [ - pathToMedia + 'disconnect.wav', pathToMedia + 'disconnect.mp3', + pathToMedia + 'disconnect.wav', + pathToMedia + 'disconnect.mp3', pathToMedia + 'disconnect.ogg', ], 'disconnect'); audioMgr.load( [ - pathToMedia + 'delete.mp3', pathToMedia + 'delete.ogg', + pathToMedia + 'delete.mp3', + pathToMedia + 'delete.ogg', pathToMedia + 'delete.wav', ], 'delete'); diff --git a/core/options.js b/core/options.js index a83c61180..af7ea45b6 100644 --- a/core/options.js +++ b/core/options.js @@ -94,7 +94,7 @@ const Options = function(options) { toolboxAtStart ? toolbox.Position.TOP : toolbox.Position.BOTTOM; } else { toolboxPosition = (toolboxAtStart === rtl) ? toolbox.Position.RIGHT : - toolbox.Position.LEFT; + toolbox.Position.LEFT; } let hasCss = options['css']; diff --git a/core/procedures.js b/core/procedures.js index 0baaa9042..174b7c0dd 100644 --- a/core/procedures.js +++ b/core/procedures.js @@ -328,7 +328,8 @@ exports.mutatorOpenListener = mutatorOpenListener; * @param {!Abstract} e The event that triggered this listener. */ const mutatorChangeListener = function(e) { - if (e.type !== eventUtils.BLOCK_CREATE && e.type !== eventUtils.BLOCK_DELETE && + if (e.type !== eventUtils.BLOCK_CREATE && + e.type !== eventUtils.BLOCK_DELETE && e.type !== eventUtils.BLOCK_CHANGE) { return; } diff --git a/core/renderers/common/block_rendering.js b/core/renderers/common/block_rendering.js index b17a5cb14..c98a31c76 100644 --- a/core/renderers/common/block_rendering.js +++ b/core/renderers/common/block_rendering.js @@ -72,7 +72,7 @@ exports.isDebuggerEnabled = isDebuggerEnabled; * to register. * @throws {Error} if a renderer with the same name has already been registered. */ - const register = function(name, rendererClass) { +const register = function(name, rendererClass) { registry.register(registry.Type.RENDERER, name, rendererClass); }; exports.register = register; diff --git a/core/renderers/common/constants.js b/core/renderers/common/constants.js index 821869037..7f080b264 100644 --- a/core/renderers/common/constants.js +++ b/core/renderers/common/constants.js @@ -784,7 +784,8 @@ ConstantProvider.prototype.makeJaggedTeeth = function() { const width = this.JAGGED_TEETH_WIDTH; const mainPath = svgPaths.line([ - svgPaths.point(width, height / 4), svgPaths.point(-width * 2, height / 2), + svgPaths.point(width, height / 4), + svgPaths.point(-width * 2, height / 2), svgPaths.point(width, height / 4), ]); return {height: height, width: width, path: mainPath}; @@ -800,7 +801,8 @@ ConstantProvider.prototype.makeStartHat = function() { const width = this.START_HAT_WIDTH; const mainPath = svgPaths.curve('c', [ - svgPaths.point(30, -height), svgPaths.point(70, -height), + svgPaths.point(30, -height), + svgPaths.point(70, -height), svgPaths.point(width, 0), ]); return {height: height, width: width, path: mainPath}; @@ -837,7 +839,8 @@ ConstantProvider.prototype.makePuzzleTab = function() { 'c', [ svgPaths.point(0, forward * control1Y), - svgPaths.point(-width, back * control2Y), endPoint1, + svgPaths.point(-width, back * control2Y), + endPoint1, ]) + svgPaths.curve( 's', [svgPaths.point(width, back * control3Y), endPoint2]); diff --git a/core/renderers/common/debug.js b/core/renderers/common/debug.js index 7527c49a2..e8b2d9aea 100644 --- a/core/renderers/common/debug.js +++ b/core/renderers/common/debug.js @@ -2,7 +2,7 @@ * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: Apache-2.0 -*/ + */ /** * @fileoverview Block rendering debugging functionality. diff --git a/core/renderers/common/marker_svg.js b/core/renderers/common/marker_svg.js index cb1bc47ca..f3db22d3a 100644 --- a/core/renderers/common/marker_svg.js +++ b/core/renderers/common/marker_svg.js @@ -147,8 +147,7 @@ MarkerSvg.prototype.isCursor = function() { * @package */ MarkerSvg.prototype.createDom = function() { - const className = - this.isCursor() ? CURSOR_CLASS : MARKER_CLASS; + const className = this.isCursor() ? CURSOR_CLASS : MARKER_CLASS; this.svgGroup_ = dom.createSvgElement(Svg.G, {'class': className}, null); diff --git a/core/renderers/geras/constants.js b/core/renderers/geras/constants.js index 43db9d91e..9f4f77c8c 100644 --- a/core/renderers/geras/constants.js +++ b/core/renderers/geras/constants.js @@ -64,8 +64,7 @@ ConstantProvider.prototype.getCSS_ = function(selector) { // Insertion marker. selector + ' .blocklyInsertionMarker>.blocklyPathLight,', selector + ' .blocklyInsertionMarker>.blocklyPathDark {', - 'fill-opacity: ' + this.INSERTION_MARKER_OPACITY + ';', - 'stroke: none;', + 'fill-opacity: ' + this.INSERTION_MARKER_OPACITY + ';', 'stroke: none;', '}', /* eslint-enable indent */ ]); diff --git a/core/renderers/geras/highlight_constants.js b/core/renderers/geras/highlight_constants.js index 053d84e56..5627e40c9 100644 --- a/core/renderers/geras/highlight_constants.js +++ b/core/renderers/geras/highlight_constants.js @@ -215,7 +215,8 @@ HighlightConstantProvider.prototype.makePuzzleTab = function() { svgPaths.curve( 'q', [ - svgPaths.point(-width * 0.05, 10), svgPaths.point(width * 0.3, 9.5), + svgPaths.point(-width * 0.05, 10), + svgPaths.point(width * 0.3, 9.5), ]) + svgPaths.moveBy(width * 0.67, -1.9) + svgPaths.lineOnAxis('v', verticalOverlap); @@ -272,12 +273,14 @@ HighlightConstantProvider.prototype.makeJaggedTeeth = function() { HighlightConstantProvider.prototype.makeStartHat = function() { const hatHeight = this.constantProvider.START_HAT.height; const pathRtl = svgPaths.moveBy(25, -8.7) + svgPaths.curve('c', [ - svgPaths.point(29.7, -6.2), svgPaths.point(57.2, -0.5), + svgPaths.point(29.7, -6.2), + svgPaths.point(57.2, -0.5), svgPaths.point(75, 8.7), ]); const pathLtr = svgPaths.curve('c', [ - svgPaths.point(17.8, -9.2), svgPaths.point(45.3, -14.9), + svgPaths.point(17.8, -9.2), + svgPaths.point(45.3, -14.9), svgPaths.point(75, -8.7), ]) + svgPaths.moveTo(100.5, hatHeight + 0.5); return { diff --git a/core/renderers/measurables/input_row.js b/core/renderers/measurables/input_row.js index 307b2b384..2f0e6011e 100644 --- a/core/renderers/measurables/input_row.js +++ b/core/renderers/measurables/input_row.js @@ -59,7 +59,8 @@ InputRow.prototype.measure = function() { if (Types.isInput(elem)) { if (Types.isStatementInput(elem)) { connectedBlockWidths += elem.connectedBlockWidth; - } else if (Types.isExternalInput(elem) && elem.connectedBlockWidth !== 0) { + } else if ( + Types.isExternalInput(elem) && elem.connectedBlockWidth !== 0) { connectedBlockWidths += (elem.connectedBlockWidth - elem.connectionWidth); } diff --git a/core/renderers/measurables/round_corner.js b/core/renderers/measurables/round_corner.js index a68326477..fa153eedb 100644 --- a/core/renderers/measurables/round_corner.js +++ b/core/renderers/measurables/round_corner.js @@ -38,7 +38,7 @@ const RoundCorner = function(constants, opt_position) { RoundCorner.superClass_.constructor.call(this, constants); this.type = ((!opt_position || opt_position === 'left') ? Types.LEFT_ROUND_CORNER : - Types.RIGHT_ROUND_CORNER) | + Types.RIGHT_ROUND_CORNER) | Types.CORNER; this.width = this.constants_.CORNER_RADIUS; // The rounded corner extends into the next row by 4 so we only take the diff --git a/core/renderers/measurables/square_corner.js b/core/renderers/measurables/square_corner.js index c1b801d5d..347483e5c 100644 --- a/core/renderers/measurables/square_corner.js +++ b/core/renderers/measurables/square_corner.js @@ -38,7 +38,7 @@ const SquareCorner = function(constants, opt_position) { SquareCorner.superClass_.constructor.call(this, constants); this.type = ((!opt_position || opt_position === 'left') ? Types.LEFT_SQUARE_CORNER : - Types.RIGHT_SQUARE_CORNER) | + Types.RIGHT_SQUARE_CORNER) | Types.CORNER; this.height = this.constants_.NO_PADDING; this.width = this.constants_.NO_PADDING; diff --git a/core/renderers/measurables/types.js b/core/renderers/measurables/types.js index b9514c376..faa80b597 100644 --- a/core/renderers/measurables/types.js +++ b/core/renderers/measurables/types.js @@ -52,7 +52,7 @@ const Types = { ROW: 1 << 20, // Row. TOP_ROW: 1 << 21, // Top Row. BOTTOM_ROW: 1 << 22, // Bottom Row. - INPUT_ROW: 1 << 23, // Input Row. + INPUT_ROW: 1 << 23, // Input Row. }; /** diff --git a/core/renderers/zelos/constants.js b/core/renderers/zelos/constants.js index 6c8874ae3..518f5de4d 100644 --- a/core/renderers/zelos/constants.js +++ b/core/renderers/zelos/constants.js @@ -216,21 +216,21 @@ const ConstantProvider = function() { 0: 5 * this.GRID_UNIT, // Field in hexagon. 1: 2 * this.GRID_UNIT, // Hexagon in hexagon. 2: 5 * this.GRID_UNIT, // Round in hexagon. - 3: 5 * this.GRID_UNIT, // Square in hexagon. + 3: 5 * this.GRID_UNIT, // Square in hexagon. }, 2: { // Outer shape: round. 0: 3 * this.GRID_UNIT, // Field in round. 1: 3 * this.GRID_UNIT, // Hexagon in round. 2: 1 * this.GRID_UNIT, // Round in round. - 3: 2 * this.GRID_UNIT, // Square in round. + 3: 2 * this.GRID_UNIT, // Square in round. }, 3: { // Outer shape: square. 0: 2 * this.GRID_UNIT, // Field in square. 1: 2 * this.GRID_UNIT, // Hexagon in square. 2: 2 * this.GRID_UNIT, // Round in square. - 3: 2 * this.GRID_UNIT, // Square in square. + 3: 2 * this.GRID_UNIT, // Square in square. }, }; @@ -455,7 +455,8 @@ ConstantProvider.prototype.makeStartHat = function() { const width = this.START_HAT_WIDTH; const mainPath = svgPaths.curve('c', [ - svgPaths.point(25, -height), svgPaths.point(71, -height), + svgPaths.point(25, -height), + svgPaths.point(71, -height), svgPaths.point(width, 0), ]); return {height: height, width: width, path: mainPath}; diff --git a/core/renderers/zelos/info.js b/core/renderers/zelos/info.js index 966f4eaff..26bad0775 100644 --- a/core/renderers/zelos/info.js +++ b/core/renderers/zelos/info.js @@ -271,8 +271,7 @@ RenderInfo.prototype.addInput_ = function(input, activeRow) { activeRow.rightAlignedDummyInput = input; } else if (input.type === inputTypes.STATEMENT) { // Handle statements without next connections correctly. - activeRow.elements.push( - new StatementInput(this.constants_, input)); + activeRow.elements.push(new StatementInput(this.constants_, input)); activeRow.hasStatement = true; if (activeRow.align === null) { @@ -327,7 +326,7 @@ RenderInfo.prototype.adjustXPosition_ = function() { const nextSpacer = this.rows[i + 1]; const hasPrevNotch = i === 2 ? !!this.topRow.hasPreviousConnection : - !!prevSpacer.followsStatement; + !!prevSpacer.followsStatement; const hasNextNotch = i + 2 >= this.rows.length - 1 ? !!this.bottomRow.hasNextConnection : !!nextSpacer.precedesStatement; @@ -505,7 +504,8 @@ RenderInfo.prototype.getNegativeSpacing_ = function(elem) { return 0; } // Special case for hexagonal output. - if (outerShape === constants.SHAPES.HEXAGONAL && outerShape !== innerShape) { + if (outerShape === constants.SHAPES.HEXAGONAL && + outerShape !== innerShape) { return 0; } return connectionWidth - diff --git a/core/serialization/blocks.js b/core/serialization/blocks.js index 316901fff..d354f19de 100644 --- a/core/serialization/blocks.js +++ b/core/serialization/blocks.js @@ -91,15 +91,12 @@ exports.State = State; * could not be serialied (eg it was an insertion marker). * @alias Blockly.serialization.blocks.save */ -const save = function( - block, - { - addCoordinates = false, - addInputBlocks = true, - addNextBlocks = true, - doFullSerialization = true, - } = {} -) { +const save = function(block, { + addCoordinates = false, + addInputBlocks = true, + addNextBlocks = true, + doFullSerialization = true, +} = {}) { if (block.isInsertionMarker()) { return null; } @@ -176,8 +173,10 @@ const saveExtraState = function(block, state) { } else if (block.mutationToDom) { const extraState = block.mutationToDom(); if (extraState !== null) { - state['extraState'] = Xml.domToText(extraState).replace( - ' xmlns="https://developers.google.com/blockly/xml"', ''); + state['extraState'] = + Xml.domToText(extraState) + .replace( + ' xmlns="https://developers.google.com/blockly/xml"', ''); } } }; @@ -262,8 +261,8 @@ const saveNextBlocks = function(block, state, doFullSerialization) { if (!block.nextConnection) { return; } - const connectionState = saveConnection( - block.nextConnection, doFullSerialization); + const connectionState = + saveConnection(block.nextConnection, doFullSerialization); if (connectionState) { state['next'] = connectionState; } @@ -329,15 +328,11 @@ exports.append = append; * @alias Blockly.serialization.blocks.appendInternal * @package */ -const appendInternal = function( - state, - workspace, - { - parentConnection = undefined, - isShadow = false, - recordUndo = false, - } = {} -) { +const appendInternal = function(state, workspace, { + parentConnection = undefined, + isShadow = false, + recordUndo = false, +} = {}) { const prevRecordUndo = eventUtils.getRecordUndo(); eventUtils.setRecordUndo(recordUndo); const existingGroup = eventUtils.getGroup(); @@ -382,14 +377,10 @@ exports.appendInternal = appendInternal; * False by default. * @return {!Block} The block that was just appended. */ -const appendPrivate = function( - state, - workspace, - { - parentConnection = undefined, - isShadow = false, - } = {} -) { +const appendPrivate = function(state, workspace, { + parentConnection = undefined, + isShadow = false, +} = {}) { if (!state['type']) { throw new MissingBlockType(state); } @@ -486,7 +477,7 @@ const tryToConnectParent = function(parentConnection, child, state) { throw new MissingConnection('output', child, state); } connected = parentConnection.connect(childConnection); - } else { // Statement type. + } else { // Statement type. childConnection = child.previousConnection; if (!childConnection) { throw new MissingConnection('previous', child, state); @@ -500,12 +491,10 @@ const tryToConnectParent = function(parentConnection, child, state) { checker.getErrorMessage( checker.canConnectWithReason( childConnection, parentConnection, false), - childConnection, - parentConnection), - parentConnection.type === inputTypes.VALUE ? - 'output connection' : 'previous connection', - child, - state); + childConnection, parentConnection), + parentConnection.type === inputTypes.VALUE ? 'output connection' : + 'previous connection', + child, state); } }; @@ -606,8 +595,7 @@ const loadConnection = function(connection, connectionState) { } if (connectionState['block']) { appendPrivate( - connectionState['block'], - connection.getSourceBlock().workspace, + connectionState['block'], connection.getSourceBlock().workspace, {parentConnection: connection}); } }; @@ -657,15 +645,15 @@ class BlockSerializer { save(workspace) { const blockStates = []; for (const block of workspace.getTopBlocks(false)) { - const state = saveBlock( - block, {addCoordinates: true, doFullSerialization: false}); + const state = + saveBlock(block, {addCoordinates: true, doFullSerialization: false}); if (state) { blockStates.push(state); } } if (blockStates.length) { return { - 'languageVersion': 0, // Currently unused. + 'languageVersion': 0, // Currently unused. 'blocks': blockStates, }; } diff --git a/core/serialization/workspaces.js b/core/serialization/workspaces.js index 3ecb3b387..3a6b8ca8c 100644 --- a/core/serialization/workspaces.js +++ b/core/serialization/workspaces.js @@ -17,13 +17,13 @@ */ goog.module('Blockly.serialization.workspaces'); goog.module.declareLegacyNamespace(); - + const dom = goog.require('Blockly.utils.dom'); const eventUtils = goog.require('Blockly.Events.utils'); const registry = goog.require('Blockly.registry'); // eslint-disable-next-line no-unused-vars const {Workspace} = goog.require('Blockly.Workspace'); - + /** * Returns the state of the workspace as a plain JavaScript object. @@ -43,7 +43,7 @@ const save = function(workspace) { return state; }; exports.save = save; - + /** * Loads the variable represented by the given state into the given workspace. * @param {!Object} state The state of the workspace to deserialize @@ -60,9 +60,10 @@ const load = function(state, workspace, {recordUndo = false} = {}) { return; } - const deserializers = Object.entries(serializerMap) - .sort(([, {priority: priorityA}], [, {priority: priorityB}]) => - priorityB - priorityA); + const deserializers = + Object.entries(serializerMap).sort(([, {priority: priorityA}], [ + , {priority: priorityB} + ]) => priorityB - priorityA); const prevRecordUndo = eventUtils.getRecordUndo(); eventUtils.setRecordUndo(recordUndo); @@ -75,7 +76,7 @@ const load = function(state, workspace, {recordUndo = false} = {}) { if (workspace.setResizesEnabled) { workspace.setResizesEnabled(false); } - + // We want to trigger clearing in reverse priority order so plugins don't end // up missing dependencies. for (const [, deserializer] of deserializers.reverse()) { diff --git a/core/theme/classic.js b/core/theme/classic.js index daf650c7a..648ec5fb8 100644 --- a/core/theme/classic.js +++ b/core/theme/classic.js @@ -51,7 +51,6 @@ let categoryStyles = { * @type {Theme} * @alias Blockly.Themes.Classic */ -const Classic = - new Theme('classic', defaultBlockStyles, categoryStyles); +const Classic = new Theme('classic', defaultBlockStyles, categoryStyles); exports.Classic = Classic; diff --git a/core/toolbox/collapsible_category.js b/core/toolbox/collapsible_category.js index 9baee7e02..ccb88da14 100644 --- a/core/toolbox/collapsible_category.js +++ b/core/toolbox/collapsible_category.js @@ -118,7 +118,8 @@ CollapsibleToolboxCategory.prototype.parseContents_ = function(categoryDef) { // Separators can exist as either a flyout item or a toolbox item so // decide where it goes based on the type of the previous item. if (!registry.hasItem(registry.Type.TOOLBOX_ITEM, itemDef['kind']) || - (itemDef['kind'].toLowerCase() === ToolboxSeparator.registrationName && + (itemDef['kind'].toLowerCase() === + ToolboxSeparator.registrationName && prevIsFlyoutItem)) { const flyoutItem = /** @type {toolbox.FlyoutItemInfo} */ (itemDef); this.flyoutItems_.push(flyoutItem); diff --git a/core/touch.js b/core/touch.js index 924a351d1..b977d05af 100644 --- a/core/touch.js +++ b/core/touch.js @@ -159,13 +159,12 @@ exports.shouldHandleEvent = shouldHandleEvent; * @alias Blockly.Touch.getTouchIdentifierFromEvent */ const getTouchIdentifierFromEvent = function(e) { - return e.pointerId !== undefined ? - e.pointerId : + return e.pointerId !== undefined ? e.pointerId : (e.changedTouches && e.changedTouches[0] && e.changedTouches[0].identifier !== undefined && e.changedTouches[0].identifier !== null) ? - e.changedTouches[0].identifier : - 'mouse'; + e.changedTouches[0].identifier : + 'mouse'; }; exports.getTouchIdentifierFromEvent = getTouchIdentifierFromEvent; diff --git a/core/utils/style.js b/core/utils/style.js index 436da69d8..88162a3d7 100644 --- a/core/utils/style.js +++ b/core/utils/style.js @@ -258,7 +258,8 @@ exports.scrollIntoContainerView = scrollIntoContainerView; * in form of goog.math.Coordinate(scrollLeft, scrollTop). * @alias Blockly.utils.style.getContainerOffsetToScrollInto */ -const getContainerOffsetToScrollInto = function(element, container, opt_center) { +const getContainerOffsetToScrollInto = function( + element, container, opt_center) { // Absolute position of the element's border's top left corner. const elementPos = getPageOffset(element); // Absolute position of the container's border's top left corner. diff --git a/core/utils/useragent.js b/core/utils/useragent.js index 503a26ed3..2e9dbaa80 100644 --- a/core/utils/useragent.js +++ b/core/utils/useragent.js @@ -112,72 +112,86 @@ isTablet = isIPad || (isAndroid && !has('Mobile')) || has('Silk'); isMobile = !isTablet && (isIPod || isIPhone || isAndroid || has('IEMobile')); })((globalThis['navigator'] && globalThis['navigator']['userAgent']) || ''); -/** @const {string} +/** + * @const {string} * @alias Blockly.utils.userAgent.raw */ exports.raw = rawUserAgent; -/** @const {boolean} +/** + * @const {boolean} * @alias Blockly.utils.userAgent.IE */ exports.IE = isIe; -/** @const {boolean} +/** + * @const {boolean} * @alias Blockly.utils.userAgent.EDGE */ exports.EDGE = isEdge; -/** @const {boolean} +/** + * @const {boolean} * @alias Blockly.utils.userAgent.JavaFx */ exports.JavaFx = isJavaFx; -/** @const {boolean} +/** + * @const {boolean} * @alias Blockly.utils.userAgent.CHROME */ exports.CHROME = isChrome; -/** @const {boolean} +/** + * @const {boolean} * @alias Blockly.utils.userAgent.WEBKIT */ exports.WEBKIT = isWebKit; -/** @const {boolean} +/** + * @const {boolean} * @alias Blockly.utils.userAgent.GECKO */ exports.GECKO = isGecko; -/** @const {boolean} +/** + * @const {boolean} * @alias Blockly.utils.userAgent.ANDROID */ exports.ANDROID = isAndroid; -/** @const {boolean} +/** + * @const {boolean} * @alias Blockly.utils.userAgent.IPAD */ exports.IPAD = isIPad; -/** @const {boolean} +/** + * @const {boolean} * @alias Blockly.utils.userAgent.IPOD */ exports.IPOD = isIPod; -/** @const {boolean} +/** + * @const {boolean} * @alias Blockly.utils.userAgent.IPHONE */ exports.IPHONE = isIPhone; -/** @const {boolean} +/** + * @const {boolean} * @alias Blockly.utils.userAgent.MAC */ exports.MAC = isMac; -/** @const {boolean} +/** + * @const {boolean} * @alias Blockly.utils.userAgent.TABLET */ exports.TABLET = isTablet; -/** @const {boolean} +/** + * @const {boolean} * @alias Blockly.utils.userAgent.MOBILE */ exports.MOBILE = isMobile; diff --git a/core/xml.js b/core/xml.js index 663d1ee0a..dcd68a257 100644 --- a/core/xml.js +++ b/core/xml.js @@ -272,7 +272,8 @@ const blockToDom = function(block, opt_noId) { element.appendChild(container); } } - const nextShadow = block.nextConnection && block.nextConnection.getShadowDom(); + const nextShadow = + block.nextConnection && block.nextConnection.getShadowDom(); if (nextShadow && (!nextBlock || !nextBlock.isShadow())) { container.appendChild(cloneShadow(nextShadow, opt_noId)); } @@ -483,7 +484,8 @@ const domToWorkspace = function(xml, workspace) { /** @type {!WorkspaceSvg} */ (workspace), width); } } else { - const {WorkspaceComment} = goog.module.get('Blockly.WorkspaceComment'); + const {WorkspaceComment} = + goog.module.get('Blockly.WorkspaceComment'); if (!WorkspaceComment) { console.warn( 'Missing require for Blockly.WorkspaceComment, ' + @@ -537,7 +539,7 @@ const appendDomToWorkspace = function(xml, workspace) { // Load the new blocks into the workspace and get the IDs of the new blocks. const newBlockIds = domToWorkspace(xml, workspace); if (bbox && bbox.top !== bbox.bottom) { // check if any previous block - let offsetY = 0; // offset to add to y of the new block + let offsetY = 0; // offset to add to y of the new block let offsetX = 0; const farY = bbox.bottom; // bottom position const topX = workspace.RTL ? bbox.right : bbox.left; // x of bounding box