1.0.2 • Published 3 years ago

blockly-react-component v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

blockly-react-component

A React component that embeds a Blockly visual programming editor.

NPM JavaScript Style Guide

Created with create-react-library.

Install

npm install --save blockly-react-component

or

yarn add blockly-react-component

Usage

import React, { Component } from 'react'

import BlocklyComponent from 'blockly-react-component'

class Example extends Component {
  render() {
    return <BlocklyComponent />
  }
}

Properties

PropTypeDescription
idstringHTML id attribute for the blockly Div element.
localestringBlockly workspace locale, see https://github.com/google/blockly/tree/master/msg/js for available languages. Default locale is 'en'. Since blockly uses a global namespace, you can not set different languages in multiple component instances.
classNamestringCSS class for the blockly Div element.
styleReact.CSSPropertiesCSS style properties for the blockly Div element.
initialXmlstringInitial Xml content for the blockly editor.
onWorkspaceChange(workspace?: Blockly.WorkspaceSvg) => voidDo something when blockly workspace content changes.
...blocklyOptionsany of Blockly.BlocklyOptionsOptions for the blockly injection. See https://developers.google.com/blockly/guides/configure/web/configuration_struct for available options. You can generate a toolbox xml from Blockly Developer Tools - Workspace Factory.

Example

See the code on example/src/App.tsx. It uses a standard blockly built-in toolbox.

Example Page

License

MIT © alienzhangyw

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago