A group of Blockly blocks that add and remove connections dynamically.
npm install @blockly/block-dynamic-connection --save
import * as Blockly from 'blockly';
import * as BlockDynamicConnection from '@blockly/block-dynamic-connection';
const myWorkspace = Blockly.inject({
// options...
plugins: {
connectionPreviewer:
BlockDynamicConnection.decoratePreviewer(
// Replace with a custom connection previewer, or remove to decorate
// the default one.
Blockly.InsertionMarkerPreviewer,
),
},
};
// Add the change listener so connections will be finalized on deletion.
workspace.addChangeListener(BlockDynamicConnection.finalizeConnections);
overrideOldBlockDefinitions
: Replaces the Blockly default blocks with the dynamic connection blocks. This enables projects to use the dynamic block plugin without changing existing XML/JSON.
dynamic_text_join
replacestext_join
dynamic_list_create
replaceslists_create_with
dynamic_if
replacescontrols_if
Apache 2.0