Commit Graph

65 Commits

Author SHA1 Message Date
RoboErikG
26e74f72d6 Missed one use of string instead of .property in extensions.js (#1262) 2017-08-04 11:34:33 -07:00
RoboErikG
fab59facee Update extensions.js to be compatible with ADVANCED_OPTIMIZATIONS (#1253)
* Update extensions.js to be compatible with ADVANCED_OPTIMIZATIONS

We were using strings to check for the existence of properties on
a mutator, which breaks if those properties were renamed by the
closure compiler. This updates all of the uses to direct function
references so that anyone building with advanced optimizations turned
on will get the correct method references in their mutators.

fixes #1251

* Update to extensions.js for advanced optimizations

Some minor updates to making extensions.js work with advanced
optimizations.

* use === undefined instead of typeof == 'undefined'
2017-08-03 15:18:41 -07:00
Neil Fraser
fc8d4c90b4 Compatibility for Closure Compiler. (#1240) 2017-07-31 09:07:41 -07:00
Rachel Fenichel
c30928a177 Make some functions private and add tests 2017-02-24 15:51:59 -08:00
Rachel Fenichel
aa8e996799 Handle mutations with both mixins and functions 2017-02-23 17:07:06 -08:00
Rachel Fenichel
4b0c32e91f Add safety checks for mutators and non-mutator extensions 2017-02-23 15:55:13 -08:00
Rachel Fenichel
455432250e Use mutator extension for controls_if block 2017-02-22 17:05:52 -08:00
Andrew n marshall
a4cfd5cbc8 Porting Loop blocks to JSON (#919)
* Improved documentation on `Blockly.Extensions.buildTooltipForDropdown`
 * Replaced incorrect uses of `@mixes` JSDoc annotation (on mixin extensions) with `@augments Blockly.Block`.
 * Added Blockly.Extensions.buildTooltipWithFieldValue() extension helper.
2017-02-08 11:36:38 -08:00
Andrew n marshall
15827c5d30 Adds Block.prototype.mixin() and Blockly.Extensions.registerMixin(). (#907)
Adds Block.prototype.mixin() and Blockly.Extensions.registerMixin().
This adds support for a common use pattern in extensions, and adds
error checking to avoid future incompatibilities.
2017-02-06 10:00:08 -08:00
Andrew n marshall
e95991cba8 Adding @namespace annotations for JSDoc. (#900) 2017-02-01 09:10:35 -08:00
Tim Dawborn
14ee069543 Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876. 2017-01-27 13:51:18 +11:00
Andrew n marshall
624afeee94 Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
Defer tooltip message string check until after load, when all Blockly.Msg should be loaded.
Avoids validation in headless mode, due to lack of document.readyState.
2017-01-26 15:12:32 -08:00
Andrew n marshall
7b0275cd70 Porting math.js blocks to JSON (#846)
Moving all `math.js` definitions into a single JSON array, complete with i18n syntax for all messages, dropdowns, and tooltips.

Adding Blockly.Extensions.buildTooltipForDropdown(..) to facilitate the creation and error-checking of tooltips that update based on the value of a dropdown.

Now warn on raw string in JSON 'extensions'.
2017-01-23 10:23:55 -08:00
Andrew n marshall
78dc5ed9c2 JSON definitions for colour blocks (#838)
Replaces old colour block definitions with a Blockly.defineBlocksWithJsonArray(..) call. Generator unit tests continue to load and pass, signifying compatibility with prior block definitions.

Replaces extension 'math_number_tooltip' with the reusable 'parent_tooltip_when_inline' extension, also used by colour_picker. Includes tests.
2017-01-18 13:48:46 -08:00
Andrew n marshall
a47bd93f4c Adding extensions for JSON support of dynamic blocks. (#834)
Adding support for extensions, functions that can assist with loading blocks, much like init functions, but that can be referenced from JSON definitions. This allows JSON definitions to define dynamic blocks such as onchange handlers and mutators.

Rewrote math_number as an example pure JSON block.
2017-01-18 12:45:39 -08:00