
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
blockly-react
Advanced tools
React implementation for Block based code editor Blockly.
npm run build
Here’s a basic example of how to use the Blockly-react components:
import BlocklyReact from './src/Blockly';
import React, { useEffect, useState } from 'react';
import * as Blockly from 'blockly/core';
const Controls_if_Mutator = () => {
const [base_block, set_base_block] = useState<Blockly.Block>();
const [else_if_inputs, set_else_if_inputs] = useState(0);
const [else_input, set_else_input] = useState(false);
useEffect(() => {
if (!base_block) return;
base_block.inputList
.map((i) => i.name)
.forEach((input) => {
if (!(input == 'if' || input == 'do')) {
base_block.removeInput(input);
}
});
console.debug(base_block.inputList, else_if_inputs, 'input list');
for (let i = 0; i < else_if_inputs; i++) {
base_block.appendValueInput(`if-${i}`).appendField('else if');
base_block.appendStatementInput(`if-do-${i}`).appendField('do');
}
if (else_input) {
base_block.appendStatementInput('else').appendField('else');
}
}, [else_if_inputs, else_input, base_block]);
return (
<>
<BlocklyReact.Block type="controls_if_if" NextStatement={null} style="logic_blocks">
<BlocklyReact.Input type="dummy">
<BlocklyReact.Field type="text" value="if" />
</BlocklyReact.Input>
</BlocklyReact.Block>
<BlocklyReact.Block
type="controls_if_else"
PreviousStatement={null}
style="logic_blocks">
<BlocklyReact.Input type="dummy">
<BlocklyReact.Field type="text" value="else" />
</BlocklyReact.Input>
</BlocklyReact.Block>
<BlocklyReact.Block
type="controls_if_else_if"
PreviousStatement={null}
NextStatement={null}
style="logic_blocks">
<BlocklyReact.Input type="dummy">
<BlocklyReact.Field type="text" value="else if" />
</BlocklyReact.Input>
</BlocklyReact.Block>
<BlocklyReact.Mutator
type="controls_if_mutator"
decompose={function (workspace) {
const block = workspace.newBlock('controls_if_if');
block.initSvg();
set_base_block(this);
return block;
}}
compose={function (block) {
let next_conn = block.getNextBlock();
let controls_if_else_if_number = 0;
let contains_else = false;
while (next_conn != null) {
console.debug(next_conn?.type, 'type');
if (next_conn?.type == 'controls_if_else_if') {
controls_if_else_if_number++;
} else if (next_conn?.type == 'controls_if_else') {
contains_else = true;
}
next_conn = next_conn.getNextBlock();
}
set_else_if_inputs(controls_if_else_if_number);
set_else_input(() => contains_else);
}}
saveExtraState={() => {}}
loadExtraState={(state) => {}}
blockList={['controls_if_else_if', 'controls_if_else']}></BlocklyReact.Mutator>
</>
);
};
const Demo = () => {
return (
<BlocklyReact.Workspace
className="workspace"
config={{
grid: {
spacing: 20,
length: 3,
colour: '#ccc',
snap: true
}
}}>
<BlocklyReact.Toolbox
kind="categoryToolbox"
content={[
{
category: 'Logic',
content: ['controls_if'],
categorystyle: 'logic_category'
}
]}
/>
<BlocklyReact.Block
type="controls_if"
PreviousStatement={null}
NextStatement={null}
style="logic_blocks"
mutator="controls_if_mutator">
<BlocklyReact.Input name="if" type="input-value" check="Boolean">
<BlocklyReact.Field type="text" value="if" />
</BlocklyReact.Input>
<BlocklyReact.Input name="do" type="statement">
<BlocklyReact.Field type="text" value="do" />
</BlocklyReact.Input>
<Controls_if_Mutator />
</BlocklyReact.Block>
</BlocklyReact.Workspace>
);
};
FAQs
React implementation for Block based code editor Blockly.
We found that blockly-react demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.