Commit Graph

2917 Commits

Author SHA1 Message Date
Beka Westberg db09cbf6e4 feat: add serialization and deserialization of comments (#5216)
* Add tests for (de)seralizing icons

* Add logic for (de)serializing icons

* fix: add docs for saveIcons

* fix: add timeout for setting comment visible
2021-08-18 06:51:34 -07:00
Beka Westberg acbfb5af57 Add throwing exceptions during deserialization (#5200)
* Add exception definitions

* Add tests for throwing errors during deserialization

* Add actually throwing exceptions

* Cleanup

* Cleanup

* Fix tests

* fix: PR Comments
2021-08-17 06:55:25 -07:00
Beka Westberg 39826e4b33 feat: upgrade block defs to have JSO serialization hooks (#5329)
* Respect nulls from blocks.save

* Upgrade list blocks to use JSO serialization

* Upgrade logic blocks to use JSO serialization

* Upgrade math blocks to use JSO serialization

* Upgrade text blocks to use JSO serialization

* Upgrade procedure blocks to use JSO serialization

* Add more mutator tests

* Fix firing enabled events

* PR Comments
2021-08-12 08:53:28 -07:00
Beka Westberg 5631d4a490 fix: touch up some deserialization behavior (#5181)
* Add parameter for recording undo.

This sets up the most common default behavior, but also makes it clear
to people that it is happening, because it might not be expected.

* Add grouping of events

* Add text width caching

* Add disabling workspace resizing

* Add performance optimizations

* Respect nulls from blocks.save

* Cleanup from rebase

* PR Comments

* Cleanup from rebase
2021-08-11 08:01:24 -07:00
Beka Westberg cc26417e7e feat: add initialization of blocks and event firing (#5166)
* Change playground to use JSO system

* Add tests for initialization and events

* Add initialization of blocks

* PR Comments
2021-08-10 13:14:37 -07:00
Beka Westberg ea8eb52c00 feat: add deserialization of JSO block state (#5137)
* Fixup tests

* Add deserialization of blocks

* Cleanup

* PR commnts
2021-08-06 11:39:39 -07:00
Beka Westberg c59d0616c6 feat: add top level save and load functions for JSO serialization (#5132)
* Add top-level serialization API

* Add using JSO system in serializer tests

* Make compiler happy
2021-08-06 09:19:23 -07:00
Beka Westberg f9285e269a feat: add JSO serialization and deserialization of variables (#5131)
* Add variable serialization tests

* Fix requires for new file

* Add serialization and deserialization of variables

* Remove only in tests

* Cleanup
2021-08-06 08:45:47 -07:00
Beka Westberg 3fb09af387 feat: add serialization of child blocks (#5120)
* Add tests for serializing connected blocks

* Add serialization of child blocks

* Add tests for not serializing children

* Add options for not serializing children

* Fix types

* Change addNextBlocks to default to true

* Cleanup

* Fix types
2021-08-06 07:55:04 -07:00
Beka Westberg 8eff8e8fdb feat: upgrade fields to use new JSO hooks (#5077)
* Upgrade field angle to use new serialization

* Upgrade field checkbox to use new serialization

* Upgrade field colour to use new serialization

* Upgrade field dropdown to use new serialization

* Upgrade serializable label field to use new serialization

* Upgrade field multiline input to use new serialization

* Upgrade field number to use new serialization

* Upgrade field text input to use new serialization

* Upgrade variable field to use new serialization

* Fix type casts

* Feedback from PR

* Switch to use getValue()
2021-08-06 06:54:54 -07:00
Beka Westberg 95c88094d6 Add serialization of field values (#5072)
* Add tests for field serialization

* Add field serialization

* Fixup types and tests
2021-07-30 08:38:00 -07:00
Beka Westberg 8f1f67062d Add serialization of mutators (#5054)
* Add tests for saving extra state

* Add serializing extra state

* Fix backwards compatibility

* Switch to other function declarations

* Handle null returns from hooks

* Remove backwards compatibility

* Remove XML require, and fix type

* Fix JSDoc formatting
2021-07-30 08:06:38 -07:00
Beka Westberg d03f5254ab Add serialization of basic block attributes to JSOs (#5053)
* Add basic attribute tests

* Add basic block serialization

* Add more attribute tests

* Change save to use options dictionary

* Add obeying save options

* Add test for data attribute

* Add saving data tag

* Move to ES6 syntax

* Fixup move to es6 syntax

* Declare module

* Format and lint

* Add docs

* Add returning null on insertion markers

* Fixup for move to module

* Switch to other function declarations

* Cleanup for finalized style

* Fix lint and types

* Export State def

* Switch disabled=true to enabled=false
2021-07-23 15:03:11 -07:00
Beka Westberg 9631efb3eb Add JSO hooks for blocks and fields. (#5052)
* Add JSON serialiation hooks for fields

* Add checking for JSON hooks

* Fix other checks and move checks to function

* Remove error for both serialization hooks being defined

* Fixup comments and errors

* Add tests

* Add json hooks to block properties

* Cleanup

* Rip out fragile backwards compatibility
2021-07-20 13:28:30 -07:00
Christopher Allen d313ec804a Merge branch 'develop' into goog.module-prep
This resolves a conflict in `blockly_uncompressed.js`, and missing
updates to `test/deps.js`, caused by PR #5041.
2021-07-13 22:16:35 +01: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
alschmiedt 2b6b89dc54 Remove themes that were moved to blockly samples (#5041) 2021-07-13 13:31:27 -07:00
Christopher Allen 948fade7c5 Only disable eslint indent check on one line
For whatever reason eslint was rejecting the (styleguide-correct)
indentation of the line beginning with "/** @type ...", and in my
naïvete I got a little more zealous than I intended in suppressing
the error.
2021-07-13 12:08:35 +01:00
Neil Fraser b3c94db951 Revert "Revert "Group field edits together for undo/redo""
This reverts commit 344ebcfd02.
2021-07-12 09:38:04 -07:00
Aaron Dodson 0b66af2e84 Merge pull request #5020 from hpnrep6/flyout-button
Fix vertical button padding in horizontal flyout
2021-07-12 08:28:28 -07:00
Neil Fraser 8a3c701026 Enable static method inheritance. 2021-07-11 23:20:20 -07:00
Neil Fraser 2c6d044c40 Review updates 2021-07-11 23:19:01 -07:00
Neil Fraser 02fd8cf7a4 Linting 2021-07-11 23:19:01 -07:00
Neil Fraser cba7a68207 Allow inheriting of fromJson in fields 2021-07-11 23:19:01 -07:00
hpnrep6 048e77dc9a Include button heights in flyout height calculation 2021-07-12 01:26:03 -04:00
Christopher Allen 603755f250 Suppress spurious eslint error
eslint appears to be confused by the leading JSDoc comment on the
continuation line and suggests it should be indented only 4 rather
than 8 spaces.
2021-07-12 03:51:17 +01:00
Christopher Allen 1197afcee7 Fix JSDoc type annotations causing closure-make-deps warnings
Some type annotations were missing curly brackets, which makes
closure-make-deps emit uninteresting warnings.  Now any output
from the command will be informative and related to whatever
one is presently working on.
2021-07-12 03:17:14 +01:00
Rachel Fenichel 89cf049e74 Merge pull request #4995 from BeksOmega/fix/jsdoc
Updates JSDoc in Block and BlockSvg
2021-07-09 15:57:38 -07:00
Rachel Fenichel 61e2d4caee Merge pull request #4985 from maribethb/typo
fix doc typo
2021-07-09 15:31:15 -07:00
Aaron Dodson 3f55ca59ad Merge pull request #4969 from gonfunko/scrollin-safari
Work around WebKit bug that prevents scrolling/zooming the workspace.
2021-07-08 08:25:29 -07:00
Aaron Dodson 49a4fa7898 Merge pull request #4938 from gonfunko/flyout-zoom
Reflow flyouts when zoom level changes to keep block zoom level in sync.
2021-07-07 10:29:44 -07:00
Beka Westberg a589cd6923 Update jsdoc 2021-07-07 14:42:18 +00:00
Maribeth Bottorff 74f1926b6a fix doc typo 2021-07-01 19:11:06 -07:00
Maribeth Bottorff d102cbfab4 Fix Jsdoc by removing trailing comma (#4974) 2021-06-30 16:45:02 -07:00
Aaron Dodson c163a76807 Removed unused event argument. 2021-06-30 17:52:17 +00:00
Aaron Dodson 5aa8bab22f Work around WebKit bug that prevents scrolling/zooming the workspace. 2021-06-30 17:40:00 +00:00
Neil Fraser 344ebcfd02 Revert "Group field edits together for undo/redo"
This reverts commit 33ad2448b8.
2021-06-29 11:35:21 -07:00
Neil Fraser 33ad2448b8 Group field edits together for undo/redo
Fixes #4189.
Also use 0 instead of 0px, in accordance with the rest of Blockly and Google’s CSS style guide.
2021-06-29 09:57:25 -07:00
Rachel Fenichel 5412adf7e5 Merge pull request #4951 from rachel-fenichel/remove_build_py
Remove deprecated build.py script
2021-06-28 11:13:05 -07:00
Rachel Fenichel 5c48bfc188 Tweak comment 2021-06-28 11:09:01 -07:00
Aaron Dodson 627647c7f2 Reflow workspace- and toolbox-owned flyouts when workspace zoom changes. 2021-06-28 11:08:03 -07:00
Aaron Dodson 0d44d22629 Revert "Reflow flyouts when zoom level changes to keep block zoom level in sync."
This reverts commit 1f6c8f0206.
2021-06-28 10:48:36 -07:00
Neil Fraser 9ad50ea98a Fix escape key on all fields. (#4934)
Currently the escape key fails to revert the value.  This is the inherited root of all type-in fields, including number, angle, and note.

Fixes #4910
2021-06-27 23:51:46 -07:00
Rachel Fenichel 2fcdd846be Remove deprecated build.py script 2021-06-24 16:58:28 -07:00
Aaron Dodson 1f6c8f0206 Reflow flyouts when zoom level changes to keep block zoom level in sync. 2021-06-18 20:26:17 +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
Neil Fraser 292911062e Honour option for collapse in context menu
Currently the ‘collapse’ option is always present, even if flagged off in the inject options.
2021-06-18 08:23:09 -07:00
Neil Fraser c8bea1ff3a Remove return value from Field dropdownCreate_ (#4915)
These functions have side effects and set all kinds of private fields.  It is misleading for them to return the top-level element, for the caller to assign to a private field.
2021-06-18 08:22:25 -07:00
Monica Kozbial 7b286dbf82 Update the registered component ids (#4898) 2021-06-17 17:50:04 -07:00
Monica Kozbial 7d45b531ac Update toolbox drag target when visibility changes (#4919) 2021-06-17 15:17:36 -07:00