Commit Graph

128 Commits

Author SHA1 Message Date
Neil Fraser
d919b0af21 Update JSDoc from Array.<> to Array<>
Same with Object.
2021-05-27 21:30:26 -07:00
Beka Westberg
04ea0f1397 Fixes mutators considering insertion markers during compose (#4449)
* Fix markers for lists, logic, and text

* Fix insertion markers in procedure mutators
2020-11-17 13:32:36 -08:00
Monica Kozbial
dd0d5aee53 Adding procedure tests and handling procedures instantiated without name (#4428)
* Expand procedure tests and fix bug with default ids

* Add tests

* Remove xml_procedures_test.js and add non-overlapping test cases into procedures_test.js
2020-11-06 11:48:48 -08:00
Monica Kozbial
638ecf6023 Adding getter to procedures call for arguments_. (#3983) 2020-06-22 15:28:31 -07:00
Beka Westberg
79ce850cf8 Fix procedure callers accessing private vars 2020-04-11 16:16:25 -07:00
Beka Westberg
fabb8c44b1 Fix procedure args handling case incorrectly 2020-02-23 10:12:08 -08:00
Neil Fraser
4e2f8e6e02 Use SPDX licences.
This is a followup to #3127.
At the time, SPDX licenses were pending approval by Google.
2020-02-11 13:27:20 -08:00
Monica Kozbial
e2b510662c Fixing typo on "programmatically". (#3654) 2020-01-24 15:10:22 -08:00
Beka Westberg
6d1bb201f7 feat: Improved procedure arg interaction. (#3527)
* feat: Improved procedure arg interaction.

* Added docs.

* Fixed typos and typings.

* Fixed typings?

* Changed visibility to private.
2020-01-07 13:55:46 -08:00
Neil Fraser
22c1eba546 Make warnings an optional module. 2019-11-01 11:52:12 -07:00
Neil Fraser
123f436e04 Add parens around inline assignments (#3381) 2019-10-31 15:17:35 -07:00
Sam El-Husseini
664cc3d6cd Fix warnings related to number of arguments passed. (#3270) 2019-10-17 11:47:30 -05:00
Sam El-Husseini
2ac4149d98 Misc compiler warnings. (#3172)
* Fix misc compiler warnings. Use ws.getToolbox() instead of ws.toolbox_
2019-10-07 11:06:56 -07:00
Sam El-Husseini
d0772ad496 Fix compiler warnings related to fields. (#3144)
* Fix compiler warnings related to fields.
2019-10-03 15:58:46 -07:00
Neil Fraser
b46a4fe286 Bring our license format up to date (#3127)
* Google changed from an Inc to an LLC.

This happened back in 2017 but we didn’t notice.  Officially we should update files from Inc to LLC when they are changed as part of regular edits, but this is a nightmare to remember for the next decade.

* Remove project description/titles from licenses

This is no longer part of Google’s header requirements.  Our existing descriptions were useless (“Visual Blocks Editor”) or grossly obselete (“Visual Blocks Language”).

* License no longer requires URL.

* Fix license regexps.
2019-10-02 14:46:56 -07:00
Neil Fraser
a1e3973499 Make block comments an optional module. (#3053)
Measured as a 5 KB *increase* in code size, but that's because some other commit just landed between my tests. It's like running down an up escalator.
2019-09-19 14:53:28 -07:00
Neil Fraser
84a814cda1 Make mutator an optional module. (#3048) 2019-09-19 11:39:55 -07:00
Beka Westberg
093467aed1 Added More Procedure Unit Tests (#2630)
* Added more procedure unit tests.

* Cleanup from rebase.

* Cleanup.
2019-09-18 16:14:06 -07:00
Neil Fraser
0add3a5e3e Add require statements to all block files. 2019-09-18 13:00:44 -07:00
Rachel Fenichel
f717add5a5 Block annotations (#2997)
* Replace `@this Blockly.Block` with `@this {Blockly.Block}` in all block files.

* Fix 9 compiler warnings (JSC_USED_GLOBAL_THIS)
2019-09-11 17:50:52 -07:00
Rachel Fenichel
e523943ee9 Merge pull request #2615 from BeksOmega/fixes/Procedures
Fixed Procedure Empty Names & Procedure Parameters
2019-07-23 11:21:22 -07:00
Beka Westberg
b7e6d3704a Fixed Procedure Argument Escaping (#2626)
* Refactored procedure decompose to build XML node by node. Fixed argument name escaping.

* Fixed review comments.
2019-07-10 16:58:25 -07:00
Beka Westberg
c053130da3 Fixed Procedure Decomposition Not Working with >1 Arguments (#2622)
* Fixed procedure decomposition not working with >1 arguments.

* Fixed typo causing #2612.
2019-07-09 16:06:58 -07:00
Neil Fraser
52b6ce18a5 Fix unit tests 2019-07-08 13:29:43 -07:00
Beka Westberg
bb19b4ce0c Reenabled parameter case tests. 2019-07-08 10:44:20 -07:00
Beka Westberg
ab352114b7 Fixed renaming procedure parameters. 2019-07-08 10:39:29 -07:00
Beka Westberg
b34ca2f93b Fixed review comments. 2019-06-25 15:08:01 -07:00
Beka Westberg
85c4e4129f Added procedure tests. 2019-06-25 15:08:01 -07:00
Neil Fraser
b8cbd9e7df Resolve 13 warnings
Reduce count from 632 to 619.
Eliminate copy-paste code duplication in Field.prototype.setValue
2019-06-12 10:59:33 -07:00
Neil Fraser
cf91b82bb0 Fix three new and ten existing Closure warnings.
Current count: 638
2019-06-07 10:32:57 -07:00
Beka Westberg
73ff710a4d Added getSourceBlock function to field. (#2508) 2019-05-29 12:50:00 -07:00
Neil Fraser
e642a77f5d Use conventional prefix/suffix for function calls.
Previously a function call with no return value generated:

  prefix();
  suffix();
  function();

The intent was so the prefix and suffix calls in the function body wouldn’t overlap with the prefix and suffix calls of the function call.  However, this is doomed to be inconsistent with a function call with a return value:

  prefix();
  print(function());
  suffix();

Thus since overlaping must exist, both types of function calls should have consistent suffix locations.
2019-05-17 15:04:39 -07:00
Neil Fraser
c0e14c3a7c Add method to suppress prefix/suffix from blocks.
This allows generators to have more control over the placement of suffix.  Needed for ‘if’ blocks and function calls which require their suffix code to be somewhere other than the end.
Also, add loop’s prefix to ‘break’ blocks, since the loop’s suffix will be the next statement hit.
Also, reuse procedures_callreturn generator for procedures_callnoreturn.
2019-05-14 17:19:31 -07:00
Neil Fraser
25adb40e66 Prefix and suffix edge cases for flow statements.
Call suffix code on break/continue before executing the break/continue.
Call prefix code for enclosing loop before executing continue.
2019-05-14 17:19:31 -07:00
Beka Westberg
5c4c816a9b Removed setVisible from the public API (#2406) 2019-04-24 16:07:47 -07:00
Jim Jiang
1b10d134a5 Add Block.setEnabled (#2386)
* Implement Block.setEnabled()

From issue #1593. This commit:
- add setEnabled
- deprecate setDisabled

* Update setDisabled calls to setEnabled

Add setEnabled and deprecate setDisabled in
- core/block_svg

Update calls in
- blocks/loops
- blocks/procedures
- core/block_events
- core/events
- core/flyout_base
- core/xml
- tests/workplace_svg/procedure_svg_test

* Implement changes from comments from RoboErikG

- Implement isEnabled()
- Make this.disabled @private
- Make setDisabled(disabled) call setEnabled(!disabled)
- Update setEnabled to use isEnabled()

* Utilize isEnabled() and fix typos

Fix missing parentheses
Implement isEnabled() more widely
Fix lint and parentheses errors

* Change prevDisabledState to prevEnabledState
2019-04-23 08:49:07 -07:00
Beka Westberg
9dec2da5c5 Movement Updates (#2247)
This is a squash and merge of a large set of changes by @BeksOmega 

* Added functionality to scrolling, dragging, and zooming.

* Fixed incorrect changes to workspaceChanged function.

* Fixed comment.

* Fixed typo.

* Removed scrollbar.set calls from workspace_svg.

* Removed scrollbar.resize() call.

* Added move options to playground.

* Fixed scroll_ calls that replaced scrollbar.set calls.

* Removed this.scrollbar checks.

* Changed zoom so that it always zooms towards the coordinates. Changed isContentBounded_ to be separate from isMovable_ (b/c of the previous change zoomControls had to be added to the bounded check). Fixed scroll_() calls... again.

* Changed procedures so the Highlight definition option is only available if the workspace is moveable.

* Fixed scrollCenter so that it works with flyout toolboxes.

* Fixed zoomToFit so that it works with horizontal flyout toolboxes.

* Fixed Typo.

* Fixed bumping blocks when the workspace is not movable.

* Fixed bumping not working with left and top toolbox positions.

* Re-Added not allowing scrollCenter if the workspace is not movable. Disabled scrollCenter button for this case.

* Cleaned up formatting.

* Fixed bumping... again. Reformatted workspaceChanged a bit.

* Changed blocks to be completely bumped into the workspace.

* Reorganized metrics-getting for workspaceChanged.

* Added bumping workspace comments. Moved event checking.

* Renamed workspaceChanged to bumpObjects.

* Added a bumpObjects developer reminder.

* Added warning to zoomToFit.

* Cleaned up some text.

* Added better inline documentation.

* Fixed up inline docs.

* Cleaned up comments.

* Fixed zoomCenter not actually zooming towards the center.

* Fixed zoomControls error on unmovable bottom-toolbox workspaces

* Fixed programatically placing blocks in an unmovable workspace.

* Removed unnecessary translate call in inject.

* Reversed removal of translate. (apparently it was necessary)

* Cleaned up code in response to first round of reviews.

* Added unit comments to the zoom function.

* Removed bumpObjectsEventChecker. Added BUMP_EVENTS list to Blockly.Events.

* Changed getWorkspaceObjectMetrics call to getBoundingRectangle().

* Fixed utils.mouseToSvg (was causing problems with zoom on wheel if the page was scrolled).

* Fixed zoom when page is scrolled (actually this time). Reverted changes to utils.mouseToSvg.

* Fixed centerOnBlock.

* Added unit docs to translate. Moved setting the grid position to the translate function.

* Added TODO's.
2019-02-18 15:28:51 -08:00
TangHu2018
6b9d98f592 Update procedures.js
When I use [Rename variable...] in procedure definition block.
The argument name for calling procedure has not changed.
2019-02-02 05:54:45 +09:00
alschmiedt
e7a120e69f Merge branch 'develop' of https://github.com/alschmiedt/blockly into blockly_colours 2019-01-08 13:36:39 -08:00
alschmiedt
4982c5c310 Changes names for block styles 2019-01-08 09:40:30 -08:00
Noah Glaser
7c619a1dba Prevent duplicate parameters in functions (#2177)
Prevents the coder from using duplicate parameters names in functions.

In the validator function check for parameter names that have been used. If it finds a block with a name that matches return null so that it will revert the change. Also change the name each time a new parameter is created to try to prevent duplicate name.
2019-01-07 12:44:01 -08:00
alschmiedt
1b3955d9d6 Fixing review comments 2018-12-21 07:52:50 -08:00
alschmiedt
d9c4608da8 Remove use of style variables in block definition 2018-12-20 10:09:47 -08:00
RoboErikG
a14ff64cf3 Avoid crashing when a procedure input has an empty string (#2182)
Fixes #1958

This will drop the input when it's in the empty string state. This
causes the block to remove the input and re-add it when the text
is reverted, but prevents the breakage. A followup fix should leave
the input alone instead of removing it, but this works for now.
2018-12-19 10:37:40 -08:00
alschmiedt
034bcb00bb Replace setting colour to setting style in block definitions 2018-12-18 10:01:05 -08:00
Rachel Fenichel
6092e4c517 Calls to getAllBlocks should pass a value for _ordered_ 2018-09-13 16:06:19 -07:00
RoboErikG
9eacd7d3b9 Disable/enable function calls along with their definitions (#2019)
Fixes #1344

Extends the event listener on procedure caller blocks to also check
for their definition being enabled/disabled and update their own
state in response.
2018-08-23 11:18:29 -07:00
Andrew n marshall
dec9a2c743 Correcting annotations of procedure block mixin functions. 2018-08-22 12:55:16 -07:00
Gokula Krishna
eef7e8f923 Change the XML attribute key from var-id to varid 2018-07-25 10:56:22 +08:00
Gokula Krishna
2c3ef64609 Remove varId attribute while saving 2018-07-24 17:29:35 +08:00