Commit Graph

867 Commits

Author SHA1 Message Date
Rachel Fenichel
7afefa09f8 Merge pull request #914 from rachel-fenichel/feature/isFieldEditable
Add isEditable to field, and add tests
2017-02-06 15:46:33 -08:00
Rachel Fenichel
5a40208138 Separate tests 2017-02-06 15:25:59 -08:00
Rachel Fenichel
630863d9db Add isEditable to field, and add tests 2017-02-06 14:47:45 -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
Jim Mussared
ec878b02cd Correct changedState in setWarningText() (#908)
When clearing warnings on blocks with IDs, the changedState variable should be true if the text changed. This will trigger the block being reshaped and remove the space for the notification icon (this.bumpNeighbours_).
2017-02-06 08:41:17 -08:00
Rachel Fenichel
4152542c2f Fix some lint errors 2017-02-03 14:01:18 -08:00
Rachel Fenichel
cab3afd677 Merge pull request #894 from google/seanlip-block-descriptions
Use the empty field placeholder for dropdowns that do not have a value selected.
2017-02-02 11:53:33 -08:00
Andrew n marshall
e95991cba8 Adding @namespace annotations for JSDoc. (#900) 2017-02-01 09:10:35 -08:00
Tim Dawborn
89ee9809d9 Bugfix for #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c. (#895) 2017-01-31 08:58:03 -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
Sean Lip
bf3b5f9d0d Fix a bug where splicing a block between two linked blocks disconnects the group and messes up the focus. 2017-01-27 18:33:39 -08:00
Rachel Fenichel
fe92d75793 Merge pull request #885 from rachel-fenichel/bugfix/context_menu_placement
Place context menu correctly on touch
2017-01-27 14:08:36 -08:00
Rachel Fenichel
3722c7d329 Place context menu correctly on touch 2017-01-27 14:03:20 -08:00
Rachel Fenichel
37906a1099 Merge pull request #882 from rachel-fenichel/bugfix/set_check_headless
Stop bumping neighbours in headless blockly
2017-01-27 13:06:46 -08:00
Rachel Fenichel
2474ec53ab Stop bumping neighbours in headless blockly 2017-01-27 11:33:04 -08:00
Rachel Fenichel
6bae750b10 Don't try to get block position in a headless workspace 2017-01-27 10:41:40 -08:00
Rachel Fenichel
b530f73747 Merge pull request #878 from groklearning/fix-ie-edge-block-text-width
Work around the IE/Edge `getComputedTextLength()` block sizing bug
2017-01-27 09:39:29 -08:00
Tim Dawborn
39731c6ddc Change CSS transforms to work with older browsers (#879)
* Change the setting of the CSS transform properties on SVG nodes to set both the unprefixed version and the `-webkit-` prefixed version so that Blockly correctly renders in order browsers, such as Safari < 9 and iOS Safari < 9.2. For discussion of this issue, see https://groups.google.com/forum/#!topic/blockly/o3pERaRQhSg

* Correct the separation between the CSS transform property and the rest of the CSS that was in the variable misleadingly called "transform".
2017-01-27 09:19:58 -08:00
Tim Dawborn
d55d9cbd9f Attempt to work around the IE/Edge bug where getComputedTextLength() throws an exception when the SVG node is not visible. This workaround forces a re-render, which in turn, forces a re-calculation of the node width once a block is inserted into the workspace SVG. This workaround is only executed on IE and Edge. See https://groups.google.com/forum/#!topic/blockly/T8IR4t4xAIY for the initial discussion of this issue. 2017-01-27 15:15:09 +11: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
10108cc697 jsdoc corrections (#874) 2017-01-26 17:33:55 -08:00
Rachel Fenichel
3742788557 annotation updates 2017-01-26 16:37:35 -08:00
Rachel Fenichel
30a63e31dd Merge pull request #863 from rachel-fenichel/feature/custom_category
Enable custom flyout categories.
2017-01-26 15:43:47 -08: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
Rachel Fenichel
0062658cfa Add some safety 2017-01-25 14:49:46 -08:00
Rachel Fenichel
4872a6ad7f Enable custom flyout categories. 2017-01-23 17:21:48 -08:00
Andrew n marshall
0da5dda1f0 Fixing JSON support for images in dropdowns. Adding tests. (#851)
Fixes #848.
2017-01-23 13:39:14 -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
Rachel Fenichel
f6168e1364 Merge pull request #840 from rachel-fenichel/bugfix/procedure_rename
Use setValue in fieldTextInput so that procedure renaming works
2017-01-20 22:04:16 -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
Rachel Fenichel
7413413069 Use bindEvent_ instead of bindEventWithChecks_ for longStop 2017-01-18 18:14:30 -08:00
Rachel Fenichel
915f097480 Use setValue in fieldTextInput so that procedure renaming works 2017-01-18 17:08:40 -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
picklesrus
8aa8b1b3ba Add ability to add a class to a scrollbar so that different types of … (#837)
* Add ability to add a class to a scrollbar so that different types of scrollbars can
be distinguished from each other. You used to be able to do this by looking at the parent
element but now all the scrollbars are siblings in the dom.

Also, use this new class to fix #816 so that layering of the flyout and workspace scrollbars
are done correctly.
2017-01-18 13:02:08 -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
Andrew n marshall
bf16f11dbd Replace single quotes with double. (#836)
Fixes commits in #832.
2017-01-18 09:24:29 -08:00
Andrew n marshall
211d973054 FieldNumber & FieldAngle: Default value "0" (#832)
FieldNumber and FieldAngle previously accepted "undefined" as values, if not defined in JSON. This catches these and uses "0" for any NaN value.  The constructor value parameter is now optional. Includes tests.
2017-01-17 15:39:59 -08:00
Neil Fraser
59f408592a Replace 'const' with 'var'.
This unbreaks IE10 and advanced compiled apps such as Blockly Games.
2017-01-16 20:35:28 -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
Andrew n marshall
ac3df2759c PR #818: Adding support for string table lookups in dropdown field labels
Adding support for string table lookups in dropdown field labels specified in JSON.

Adds Blockly.utils.replaceMessageReferences() method to handle string replacement without interpolation tokens.  Effectively uses the same old code, now moved into tokenizeInterpolation_(), which takes a parseInterpolationTokens option.

Replaces the direct JavaScript references (not pure JSON, and thus not portable).

Demonstrating this behavior in the logic_boolean dropdown.
2017-01-11 15:47:56 -08:00
Neil Fraser
bea74dbbe3 Fix undo/redo for FieldCheckbox
Thanks to PR #813 by ademenev
2017-01-10 22:18:37 -08:00
Rachel Fenichel
37a4e8ece2 Merge pull request #807 from rachel-fenichel/bugfix/connect_under_flyout
Don't connect to blocks under the flyout.
2017-01-09 14:21:36 -08:00
Rachel Fenichel
a0e6d4bbb5 Don't connect to blocks under the flyout. 2017-01-05 16:06:15 -08:00
picklesrus
25ed815320 Make cursor stay as a closed hand when dragging blocks around in the drag surface. Do this by applying the same style to text elements in the drag surface that we do in the main svg. (#805) 2017-01-05 15:39:06 -08:00
Rachel Fenichel
3cd62050a2 Merge pull request #802 from rachel-fenichel/bugfix/field_undo
Fix two event bugs on fields
2017-01-05 13:14:20 -08:00