* fix(node): Don't use global variables for jsdom injection Introduce a (hopefully generally applicable) mechanism for injecting dependencies into modules, specifically in this case to inject required bits of JSDOM's Window and Document implementations into core/utils/xml.js when running in node.js or other environments lacking a DOM. The injectDependencies function uses an options object to facilitate optionally injecting multiple named dependencies at the same time. Rename the xmlDocument local variable back to document (was renamed in #5461) so that the name used in this module corresponds to the usual global variable it replaces. Change the injection in scripts/package/node/core.js to use injectDependencies instead of setXmlDocument + global variables; also eliminate apparently-unnecessary creation of a special Document instance, using the default one supplied by jsdom instead. Fixes #6725. * deprecate(xml): Deprecate getXmlDocument and setXmlDocument Mark getXmlDocument and setXmlDocument as @deprecated, with suitable calls to deprecation.warn(). There are no remaining callers to either function within core - setXmlDocument was only used by the node.js wrapper, and and apparently getXmlDocument was never used AFAICT - and we do not anticipate that either were used by external developers. * fix: Corrections for comments on PR #6764.
Blockly
Google's Blockly is a web-based, visual programming editor. Users can drag blocks together to build programs. All code is free and open source.
The source for this module is in the Blockly repo.
Installation
You can install this package either via npm or unpkg.
npm
npm install blockly
unpkg
<script src="https://unpkg.com/blockly/blockly.min.js"></script>
Example Usage
import Blockly from 'blockly';
Blockly.inject('blocklyDiv', {
...
})
Samples
For samples on how to integrate Blockly into your project, view the list of samples at blockly-samples.
Importing Blockly
When you import Blockly with import * as Blockly from 'blockly'; you'll get the default modules:
Blockly core, Blockly built-in blocks, the JavaScript generator and the English lang files.
If you need more flexibility, you'll want to define your imports more carefully:
Blockly Core
import * as Blockly from 'blockly/core';
Blockly built in blocks
import * as libraryBlocks from 'blockly/blocks';
Blockly Generators
If your application needs to generate code from the Blockly blocks, you'll want to include a generator.
import {pythonGenerator} from 'blockly/python';
to include the Python generator. You can also import {javascriptGenerator} from 'blockly/javascript', {phpGenerator} from 'blockly/php', {dartGenerator} from 'blockly/dart' and {luaGenerator} from 'blockly/lua'.
Blockly Languages
import * as Fr from 'blockly/msg/fr';
Blockly.setLocale(Fr);
To import the French lang files. Once you've imported the specific lang module, you'll also want to set the locale in Blockly.
For a full list of supported Blockly locales, see: https://github.com/google/blockly/tree/master/msg/js
License
Apache 2.0