A Blockly plugin for automatically converting shadow blocks to real blocks when the user edits them.
yarn add @blockly/shadow-block-converter
npm install @blockly/shadow-block-converter --save
This plugin exports a function called shadowBlockConversionChangeListener
. If
you add it as a change listener to your blockly workspace then any shadow block
the user edits will be converted to a real block. See below for an example using
it with a workspace.
import * as Blockly from 'blockly';
import {shadowBlockConversionChangeListener} from '@blockly/shadow-block-converter';
function start() {
const workspace = Blockly.inject('blocklyDiv', {toolbox: toolbox});
workspace.addChangeListener(shadowBlockConversionChangeListener);
}
Apache 2.0