A Blockly … field.
yarn add @blockly/plugin
npm install @blockly/plugin --save
import * as Blockly from 'blockly';
import {FieldTemplate} from '@blockly/plugin';
Blockly.Blocks["test_field_template"] = {
init: function () {
this.appendDummyInput()
.appendField("template: ")
.appendField(new FieldTemplate(...), "FIELDNAME");
}
};
import * as Blockly from 'blockly';
import '@blockly/plugin';
Blockly.defineBlocksWithJsonArray([
{
"type": "test_field_template",
"message0": "template: %1",
"args0": [
{
"type": "field_template",
"name": "FIELDNAME",
"value": ...
}
]
}]);
Apache 2.0