Commit Graph

136 Commits

Author SHA1 Message Date
Andrew n marshall
8c46d7c798 Improve errors when validating JSON block definitions. (#1086)
goog.asserts to not run from blockly_compressed.js. User data validation should always run.
2017-05-05 11:14:54 -07:00
picklesrus
28572dadac Rebuild blockly_uncompressed to pick up a testing change to make travis happy. Fix a build warning from a multi-line string in the process. (#1059) 2017-04-21 16:20:13 -07:00
marisaleung
21bf339e5d bumpNeighbours_ function moved to block_svg.
Fixed #1009
2017-04-17 15:22:53 -07:00
Rachel Fenichel
f2f522d77a Miscellaneous comment cleanup 2017-04-05 15:52:49 -07:00
Rachel Fenichel
05312c9bf7 Merge pull request #952 from rachel-fenichel/feature/if_else_update
Use mutator extension for controls_if block
2017-02-27 19:56:32 -08:00
Rachel Fenichel
4b0c32e91f Add safety checks for mutators and non-mutator extensions 2017-02-23 15:55:13 -08:00
Andrew n marshall
3db3cf551f Fix #945 (annotations) and an eslint issue (constant condition) 2017-02-22 23:15:39 -08:00
Rachel Fenichel
455432250e Use mutator extension for controls_if block 2017-02-22 17:05:52 -08:00
Andrew n marshall
afd1fdeb15 .utils.replaceMessageReferences(..) now gracefully returns non-string arguments. 2017-02-14 11:00:34 -08:00
Andrew n marshall
750c0300ec Addressing comments. 2017-02-14 11:00:34 -08:00
Andrew n marshall
dc0d3beba3 Moving FieldImage string dereferencing back into Block.interpolate_() (part of jsonInit()). This sets a clear boundary of where dereferencing should happen.
Towards this, I've added message dereferencing for other field types here, as well.  I've used a pattern of field-type specific helper functions.
2017-02-14 11:00:34 -08:00
Andrew n marshall
640fb9c733 Dereference string table references when loading variable fields from JSON. 2017-02-14 11:00:34 -08:00
Andrew n marshall
79becd6b31 Add no-op stub .neighbors() for headless Connection. 2017-02-13 16:28:43 -08:00
Andrew n marshall
24ebbcaad0 Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911) 2017-02-06 14:15:20 -08:00
Andrew n marshall
680fc4b6d3 Porting Logic blocks to JSON (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
2017-02-06 13:40:05 -08:00
Rachel Fenichel
e429e0c42f Merge pull request #912 from rachel-fenichel/lint
Fix some lint errors
2017-02-06 12:39:45 -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
Rachel Fenichel
4152542c2f Fix some lint errors 2017-02-03 14:01:18 -08:00
Sean Lip
2c72590a01 Use the empty field placeholder for dropdowns that do not have a value selected. 2017-01-30 16:23:40 -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
fb0f1b05dd Unit tests for JSON block definitions (just the start) (#850)
* Beginnings of a JSON block definition unit test set.
 * Dispose of unit test workspaces and blocks in finally blocks.
 * Clarify JSON error message by echoing arg notation.
2017-01-20 14:18:33 -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
Rachel Fenichel
48df04eb72 Merge pull request #800 from groklearning/add-allInputsFilled-methods
Adds `allInputsFilled` methods to Block and Workspace.
2017-01-16 15:33:21 -08:00
Tim Dawborn
69df716ef5 Fixes as per code review on PR. 2017-01-16 08:48:11 +11:00
Andrew n marshall
4fdd16b499 JSON support for message lookup in colour, tooltip, and help URL. (#825)
String replacement for the colour, tooltip text and help URL attributes of JSON defined blocks.
Demonstrated in logic_boolean.
2017-01-13 16:54:27 -08:00
Tim Dawborn
f9e0552c11 Add an allInputsConnected method to Block and Workspace to test whether all trees in the block forest have their inputs filled. An optional argument controls whether or not shadow blocks are counted as being filled. Recommitting changes off develop instead of master as per discussion in PR #791. 2016-12-28 12:26:53 +11:00
Neil Fraser
4cda20dbbf Fix speling. 2016-11-19 02:40:11 -08:00
Neil Fraser
f6aef459fc API-breaking cleanup. But doubtful anyone will be affected. (#748)
* Make add/removeClass return whether they did anything.
* Move more functions onto utils.
* Move bind functions to Blockly.
* Routine recompile.
2016-11-15 13:54:33 -08:00
Neil Fraser
5b033e2f7b Misc cleanup. 2016-11-05 00:15:39 -07:00
Shannon McCabe
f7bbaaa82d JSDoc format fixes 2016-10-07 14:30:14 -07:00
Neil Fraser
bd4c6d096f Use goog.array.remove 2016-10-04 21:20:07 -07:00
Neil Fraser
13c5d9b3dd Improve bubble arrow paths for extreme ratios. 2016-09-27 18:26:29 -07:00
rachel-fenichel
21fea1279c Merge pull request #557 from google/feature/variable_management
Integrate variable management into develop.
2016-08-18 15:56:18 -07:00
Katelyn Mann
33e9d75457 Fix for #521.
Add a isMutator member similar to isFlyout to workspace_svg so it knows whether
it is mutator or not. Allow blocks to access that property so that they can recalculate
coordinates appropriately.
2016-08-16 11:19:29 -07:00
Rachel Fenichel
65d785a86d New message for deletion; block dispose is a noop if it's already been deleted 2016-08-09 17:17:08 -07:00
Sean Lip
d362c73a04 Allow a placeholder for empty fields to be specified when generating block descriptions. (#509)
* Allow a placeholder for empty fields to be specified when generating block descriptions.

* Correctly handle recursive block stringification.
2016-08-03 17:47:34 -07:00
Neil Fraser
823bf3c5da Allow substituted strings in interpolation. 2016-07-12 11:24:39 -07:00
Rodrigo Queiro
589f6ae13f Re-enable events even when an exception is thrown
This prevents a recoverable exception permanently disabling events. This
could be caused by calling domToWorkspace() to load a corrupt program.
2016-06-29 14:46:06 +02:00
Neil Fraser
0be0cc89c7 Second version of FieldNumber API. 2016-06-22 15:07:07 -07:00
Neil Fraser
98617d8ddc Move tokenizeIntepolation into Blockly.utils namespace. 2016-06-22 13:01:37 -07:00
Neil Fraser
732e9b0659 Start using field_number. 2016-06-21 04:10:32 -07:00
Rachel Fenichel
e28db7bc4e JS Doc and private 2016-05-10 15:46:51 -07:00
Rachel Fenichel
ae745dac80 block db doesn't belong in block.js 2016-05-10 15:45:19 -07:00
rachel-fenichel
7b1fdcb7c6 make tests work; make connext_ a member function. 2016-05-10 15:45:19 -07:00
Rachel Fenichel
3605dfb9c0 Undo decimation of variable redeclarations 2016-05-10 14:40:48 -07:00
Rachel Fenichel
640b38f38e lint 2016-05-05 13:13:48 -07:00
Rachel Fenichel
d89d8a2113 Add lightweight field_number 2016-05-04 13:30:18 -07:00
Neil Fraser
194341f2e5 Allow use of setOutput (and friends) to change checks. Issue #315. 2016-04-06 16:27:25 -07:00
Neil Fraser
61b3fbfe11 Move block database to workspace. 2016-04-05 18:43:39 -07:00
rachel-fenichel
1487a9e1d0 Merge pull request #302 from rachel-fenichel/cleanup/block_remove_rendered
Move Blockly.Block rendered into Blockly.BlockSvg
2016-03-31 14:17:32 -04:00