Commit Graph

328 Commits

Author SHA1 Message Date
Neil Fraser
ae39fb9e23 Add supressPrefixSuffix to if/else block
Alternatively, this could be done by using an extension, rather than JSON.  I have no preference.
Issue #5268.
2021-08-04 10:19:25 -07:00
jschanker
de1b3214be Enforce connection preconditions for setParent (#4999)
* Fix error conditions for setParent #4989

* Error now thrown when calling `a.setParent(b)` on non-null b if the output/previous connection of a is not connected to an input/next connection of b without removing block from old parent's child list.
* Commented out error for when calling `a.setParent(null)` if a is connected to superior block.
* Adjusted comment to reflect that blocks were no longer being disconnected in this method.
* Also changed == to === per #4924 (`newParent` and `this.parentBlock_` must both be instances of `Blockly.Block`).

* Fix error conditions for setParent #4989

* Error now thrown when calling `a.setParent(b)` on non-null b if the output/previous connection of a is not connected to an input/next connection of b without removing block from old parent's child list.
* Error now thrown when calling `a.setParent(null)` if a is connected to a superior block.
* Adjusted comment to reflect that blocks were no longer being disconnected in this method.
* Also changed == to === per #4924 (`newParent` and `this.parentBlock_` must both be instances of `Blockly.Block`).

* Fix error conditions for setParent #4989

* Error now thrown when calling `a.setParent(b)` on non-null b if the output/previous connection of a is not connected to an input/next connection of b without removing block from old parent's child list.
* Commented out error for when calling `a.setParent(null)` if a is connected to superior block.
* Adjusted comment to reflect that blocks were no longer being disconnected in this method.
* Also changed == to === per google#4924 (`newParent` and `this.parentBlock_` must both be instances of `Blockly.Block`).
* Fixed lint errors.

* Fix error conditions for setParent google#4989

* Error now thrown when calling `a.setParent(b)` on non-null b if the output/previous connection of a is not connected to an input/next connection of b without removing block from old parent's child list.
* Commented out error for when calling `a.setParent(null)` if a is connected to superior block.
* Adjusted comment to reflect that blocks were no longer being disconnected in this method.
* Also changed == to === per google#4924 (`newParent` and `this.parentBlock_` must both be instances of `Blockly.Block`).
* Fixed lint errors.
* Adjusted comment.

* Removed unnecessary set to null/added tests

* One is failing (commented out), will investigate later

* Lint fix

* Removed failing test that correctly fails

* Update comments to conform to style guide

Capitalize first letter, period at end
2021-07-13 13:56:42 -07:00
Beka Westberg
a589cd6923 Update jsdoc 2021-07-07 14:42:18 +00:00
Beka Westberg
13bb9f5bf6 Refactor connect logic (#4880)
* Refactor connect logic.

* Fixup from rebase

* Fix build

* PR Comments
2021-06-18 09:53:43 -07:00
jschanker
672574b056 Require field name to be string, test changes
* Now throws error for getField/getFieldValue/setFieldValue if provided name is not a string
* Changed error to more specific TypeError
* Type checking and error message moved up to getField
* Tests added/modified to check that non-string types for field names produce type errors
2021-06-16 10:46:05 +01:00
jschanker
62bb663b38 Added tests/setFieldValue error message
* Added tests for getting/setting field (values) when names are not supplied and test for getting a field value, setting it to a new value, and getting it again.
* Added more user-friendly error message for setFieldValue telling the developer that he/she is missing the name rather than Field "undefined" not found.
* Fixed lint error by removing trailing space
2021-06-16 10:46:05 +01:00
jschanker
f9c5260fb0 Added tests/setFieldValue error message
* Added tests for getting/setting field (values) when names are not supplied and test for getting a field value, setting it to a new value, and getting it again.
* Added more user-friendly error message for setFieldValue telling the developer that he/she is missing the name rather than Field "undefined" not found.
2021-06-16 10:46:05 +01:00
jschanker
ee8e282360 Fix #4830 for getting/setting unnamed fields
* Returns null when getting unnamed field (value), throws error Field "undefined" not found when attempting to set value of unnamed field
2021-06-16 10:46:05 +01:00
Monica Kozbial
a17cb7f12e Adding parameter to dragEnter and dragExit (#4890)
* introduce IDraggable interface
* Add parameter to drag methods in IDragTarget
* combines bubble/drag methods on IDragTarget and IDeleteArea to take an IDraggable element
2021-06-11 12:58:26 -07:00
Neil Fraser
96315ad449 Fix removal of spaces near parens inside strings
Extra spaces should only be stripped from the inside of paren tokens.  Parens in strings (and other static content) should not be edited.
2021-06-09 22:16:35 -07:00
Neil Fraser
861a981cb6 Remove extra else clauses 2021-06-09 11:41:42 -07:00
Neil Fraser
cff7b359f4 Make comments more consistent. 2021-06-09 11:41:42 -07:00
Neil Fraser
c5a7b481bc Code simplifications 2021-06-03 08:23:01 -07:00
Neil Fraser
e661c92a36 More JSDoc improvements 2021-05-27 21:30:26 -07:00
Neil Fraser
d919b0af21 Update JSDoc from Array.<> to Array<>
Same with Object.
2021-05-27 21:30:26 -07:00
Neil Fraser
d519ab8f54 JSDoc improvements 2021-05-27 21:30:26 -07:00
Neil Fraser
dd0314bc0b Normalize comments 2021-05-19 09:57:14 -07:00
Sam El-Husseini
f2f878db8c Fix multiple strict require warnings (#4793) 2021-04-21 16:46:04 -07:00
alschmiedt
fe41814958 Fix missing dependency (#4722) 2021-03-24 13:08:20 -07:00
Sam El-Husseini
63d26dc186 Add extra requires check (#4677)
* Add extra requires check
2021-03-05 09:50:51 -08:00
Rachel Fenichel
750b62030b First pass at creating connectionTypes and inputTYpes 2021-03-04 10:22:24 -08:00
Rachel Fenichel
4e31deca2b Align constants -> Blockly.constants.ALIGN enum 2021-02-26 11:12:53 -08:00
Sam El-Husseini
f97730e83c Sort requires (#4658)
* Cleanup gulp method to sort requires
2021-02-25 17:17:42 -08:00
Sam El-Husseini
ab8a11784d Fix event related missing requires (#4656)
* Fix event related missing requires
2021-02-25 14:28:11 -08:00
Beka Westberg
87f4799be7 Remove last FieldLabel call and fix adding dummy inputs to json (#4601)
* Change insertFieldAt to use registry

* Fix adding dummy input for non field_ prefixed fields

* Remove bad new keyword

* Add type cast
2021-02-05 16:03:32 -08:00
Beka Westberg
75f118b4f9 Refactor interpolate_ into multiple functions & remove direct new Field call (#4585)
* Refactor interpolation

* Added docs

* Add tests

* Add test for dummy input after field not prefixed with field_

* Fix typings

* Pr comments
2021-01-22 12:44:50 -08:00
alschmiedt
a3adc42e8a Remove keyboard navigation from core (#4593) 2021-01-19 11:50:51 -08:00
Rachel Fenichel
40928634e5 Add some missing requires and requireTypes 2021-01-08 15:03:55 -08:00
Monica Kozbial
4922cdccd3 Make isInsertionMarker public (#4525) 2020-12-11 15:56:00 -08:00
Monica Kozbial
b8cfab62e8 Remove warning from Block bumpNeighbors (#4484)
* Remove warning
2020-12-02 16:39:30 -08:00
Sam El-Husseini
fba35d342c Add missing require Blockly.constants (#4366) 2020-10-12 17:56:42 -04:00
Rachel Fenichel
3bf8a38020 Delete some deprecated functions 2020-09-28 13:09:19 -07:00
Maribeth Bottorff
6017a953d1 Fix bugs related to events firing during block create (#4278)
Fix bugs related to events firing during block create and add test for expected block init behavior
2020-09-15 20:02:07 -07:00
Beka Westberg
47cc3b97b0 Add getTooltip (#4254)
* Add getTooltip

* Add tests

* Fix typings?

* Fix typings?

* PR Comments
2020-09-10 08:57:05 -07:00
Beka Westberg
af9be6d9c3 Update some inline docs in block.js (#4241)
* Update some inline docs in block.js

* Fix build error
2020-09-01 10:27:17 -07:00
Rachel Fenichel
7288c66294 Rename connectionTypeChecker->connectionChecker 2020-07-16 17:40:13 -06:00
Rachel Fenichel
8ae3dc3d5e Cleanup 2020-07-16 17:40:13 -06:00
Rachel Fenichel
e24f3cef9b Add isDragging to canConnectWithReason and delete newly unused code paths. 2020-07-16 17:40:13 -06:00
Rachel Fenichel
450aed0aa2 More work on connection type checks 2020-07-16 17:40:12 -06:00
Rachel Fenichel
5b393eed76 More cleanup 2020-07-16 14:11:48 -06:00
Rachel Fenichel
6990ac5efd Fix annotation and remove redundant 'Blockly.' 2020-07-16 14:08:27 -06:00
Rachel Fenichel
2f5663b1ec Add deprecation helper + 2 uses 2020-07-16 13:59:32 -06:00
Sam El-Husseini
9e7f3b07e9 Advanced compilation fixes (#3995)
* Advanced compilation fixes
2020-06-25 11:59:03 -07:00
alschmiedt
4335bb6452 Add opt quiet to remove field (#3968)
* Add opt quiet to remove field
2020-06-12 14:18:28 -07:00
alschmiedt
9ec8305889 Update documentation (#3965) 2020-06-12 10:48:49 -07:00
Sam El-Husseini
b84d25fe2d Strict types in input (#3912)
* Strict types in input.js
2020-05-21 17:57:13 -07:00
Sam El-Husseini
317834ff59 Add accessibility interfaces and fix navigation types (#3908)
* Add accessibility interfaces and fix navigation types
2020-05-21 11:18:10 -07:00
Sam El-Husseini
a5a3b045d3 Use the Blockly AST for block toString (#3895)
* Use the AST tree to populate block toString, add paranthesis around Number and Boolean connections
2020-05-14 17:06:35 -07:00
Maribeth Bottorff
781dbd974d Make block.removeInput return a boolean. (#3832)
Make block.removeInput return a boolean.
2020-04-17 17:47:58 -07:00
Beka Westberg
9e98df9949 Fix collapsed blocks not updating when modified (#3806)
* Stop recursive render calls

* Fix visibility bugs.

* Make toString ignore collapsed input.

* Add automatic collapse rendering handling

* Fix insertion markers with collapsed

* Add tests

* Fix build?

* PR comments

* Add missing jsdoc
2020-04-16 13:02:05 -07:00