diff --git a/package-lock.json b/package-lock.json index 77c16a6cd8..d3bd004fe9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "2.0.0", "license": "Apache-2.0", "dependencies": { + "@blockly/continuous-toolbox": "^5.0.15", "blockly": "^10.0.0" }, "devDependencies": { @@ -120,6 +121,17 @@ "node": ">=4" } }, + "node_modules/@blockly/continuous-toolbox": { + "version": "5.0.15", + "resolved": "https://registry.npmjs.org/@blockly/continuous-toolbox/-/continuous-toolbox-5.0.15.tgz", + "integrity": "sha512-XXW+ETvPljsq9A5KdXO/aKnVbEIy+ANlgfQmPN9Vztl4U0NdQ3QvA/PtZRlZ6ISJdEkM4GnhTXOIIO+0qDqJ8w==", + "engines": { + "node": ">=8.17.0" + }, + "peerDependencies": { + "blockly": "^10.0.0" + } + }, "node_modules/@commitlint/cli": { "version": "17.8.1", "resolved": "https://registry.npmjs.org/@commitlint/cli/-/cli-17.8.1.tgz", @@ -7098,6 +7110,12 @@ } } }, + "@blockly/continuous-toolbox": { + "version": "5.0.15", + "resolved": "https://registry.npmjs.org/@blockly/continuous-toolbox/-/continuous-toolbox-5.0.15.tgz", + "integrity": "sha512-XXW+ETvPljsq9A5KdXO/aKnVbEIy+ANlgfQmPN9Vztl4U0NdQ3QvA/PtZRlZ6ISJdEkM4GnhTXOIIO+0qDqJ8w==", + "requires": {} + }, "@commitlint/cli": { "version": "17.8.1", "resolved": "https://registry.npmjs.org/@commitlint/cli/-/cli-17.8.1.tgz", diff --git a/package.json b/package.json index 1f02c6681d..ab6450e05f 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "webpack-dev-server": "^4.11.1" }, "dependencies": { + "@blockly/continuous-toolbox": "^5.0.15", "blockly": "^10.0.0" } } diff --git a/src/index.js b/src/index.js index c3d352081c..bd0320177a 100644 --- a/src/index.js +++ b/src/index.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import * as Blockly from 'blockly/core'; import '../blocks_common/math.js'; import '../blocks_vertical/vertical_extensions.js'; import '../blocks_vertical/control.js'; @@ -15,9 +16,26 @@ import '../blocks_vertical/operators.js'; import '../blocks_vertical/sensing.js'; import '../blocks_vertical/sound.js'; import * as scratchBlocksUtils from '../core/scratch_blocks_utils.js'; +import { + ContinuousToolbox, + ContinuousFlyout, + ContinuousMetrics, +} from '@blockly/continuous-toolbox'; export * from 'blockly'; export * from './categories.js'; export * from '../core/colours.js'; export * from '../msg/scratch_msgs.js'; export {scratchBlocksUtils}; + +export function inject(container, options) { + Object.assign(options, { + plugins: { + toolbox: ContinuousToolbox, + flyoutsVerticalToolbox: ContinuousFlyout, + metricsManager: ContinuousMetrics, + }, + }); + const workspace = Blockly.inject(container, options); + return workspace; +} \ No newline at end of file