325 Commits

Author SHA1 Message Date
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
rachel-fenichel ae1a0aab8a add isConnected() to connections. 2016-03-30 15:10:59 -07:00
rachel-fenichel 7665066565 Move Blockly.Block rendered into Blockly.BlockSvg 2016-03-29 17:30:39 -07:00
Neil Fraser ac0b5e7871 Use ENUM for dragMode. Blocks no longer sticky when created from disappearing flyout. 2016-03-29 08:36:11 -07:00
Neil Fraser 741491347b Add list of ids to create/delete events for robustness. 2016-03-28 18:10:54 -07:00
Neil Fraser b8d48ebabe Destroy attached shadow block when input is destroyed. 2016-03-26 19:37:12 -07:00
Neil Fraser d086634394 Lint and recompile. 2016-03-18 15:19:26 -07:00
Neil Fraser a3b850b0d3 Merge pull request #287 from rachel-fenichel/feature/source_block_fn
Add a getter; stop accessing private field sourceBlock_ from outside …
2016-03-16 19:45:20 -07:00
rachel-fenichel 2c70f7ec26 Add a getter; stop accessing private field sourceBlock_ from outside of a connection. 2016-03-15 16:03:49 -07:00
rachel-fenichel 74ea1f1ffe consider the last block on the stack when looking for places to attach a dragging stack. 2016-03-11 18:07:26 -08:00
Neil Fraser 2a1ffa11c4 Add undo/redo. Also refactor connections.
Bugs in undoing mutators and renaming variables.
2016-03-03 17:48:54 -08:00
Neil Fraser 5097963cb1 Reduce code duplication in 'if' block. 2016-03-01 18:21:02 -08:00