Commit Graph

155 Commits

Author SHA1 Message Date
Sam El-Husseini
5ce8c68833 Fix node build and add node tests (#2736)
* Fix node build and add node tests
2019-07-30 11:13:52 -07:00
Neil Fraser
bbb6e03801 Don’t save IDs of shadow blocks. 2019-07-15 14:37:27 -07:00
Neil Fraser
0e82677f27 Create stub for Node contstants.
Ironic that Node doesn’t have Node.  Not tested.
Fix two missing dependencies.
2019-07-15 14:37:27 -07:00
Neil Fraser
829dcc207c Make type and variabletype attributes optional
If a variable doesn’t have a type, then don’t add these empty attributes in the XML.
2019-07-15 14:37:27 -07:00
Neil Fraser
52b6ce18a5 Fix unit tests 2019-07-08 13:29:43 -07:00
Neil Fraser
74be35e23d Rename Blockly.Xml.utils to Blockly.utils.xml 2019-07-08 13:29:43 -07:00
Beka Westberg
5a4cc7ae12 Removed textToDom Needing <xml> Documents (#2585)
* Removed textToDom needing <xml> documents.

* Fixed jsdoc.

* Followon changes resulting from lack of XML tag.

* Fix Mocha test.
2019-06-24 15:50:06 -07:00
Neil Fraser
775ce34eac Simplify workspace.getBlocksBoundingBox
Previously it returned x,y,width,height.  Returning top,bottom,left,right results in simpler code, both in this function and in downstream callers.

This commit makes the minumum change to the metrics_test.  I’m happy to change the test’s data if that makes more sense.
2019-06-07 10:32:57 -07:00
Neil Fraser
d1a29739d8 Move utilities into own directory.
TODO: There are more functions which may be migrated into dom and string.
2019-06-07 10:32:57 -07:00
Beka Westberg
2f0b02525a Moved serializing the field's name up to xml.js 2019-05-31 10:12:57 -07:00
Neil Fraser
dce0b77424 Fix 19 warnings in theme-related code. (#2523)
* Fix 19 warnings in theme-related code.

Resolves #2414

* Remove suppressPrefixSuffix property definition

The mixin code throws an error if property exists on both objects.

* eslint has strange ideas about indentation.
2019-05-30 10:05:06 -07:00
Neil Fraser
459961c3cb Replace Element constants with Node constants.
Element constants apparently don’t exist in IE or Edge.  Node constants apparently do.
2019-05-29 10:45:54 -07:00
Neil Fraser
9f528922a7 Fix some dependencies 2019-05-24 15:45:05 -07:00
Neil Fraser
5cf52c566a Fix a dozen compiler warnings. 2019-05-17 16:48:40 -07:00
Neil Fraser
4161ba0fa7 Move goog.global to Blockly.utils.global
Can’t use Blockly.global since that’s the last file to load.
2019-05-17 15:04:39 -07:00
Neil Fraser
28ad3a9bd3 Blockly.utils.userAgent moved to Blockly.userAgent 2019-05-10 16:56:26 -07:00
Neil Fraser
834fa64674 Use Element constants and ‘i’ variable.
I don’t care about whether we use the Element constants or the ubiquitously known 1 & 3 integers.  But we had a mix.
Also, ’x’ is usually used for horizontal location, ‘i’ is an iterator.
No functional change.
2019-05-02 09:56:37 -07:00
Beka Westberg
123b5dc91e Added fromXml and toXml to fields. 2019-04-25 16:00:09 -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
e8573bc0db Added isSerializable function and SERIALIZABLE property to fields. 2019-04-21 08:28:37 -07:00
Neil Fraser
f118d33855 Corrections to JSDoc comments 2019-03-29 15:24:37 -07:00
Beka Westberg
bad1b39502 Changed require's to be in correct lexicographical order. 2019-01-26 07:03:47 -08:00
Beka Westberg
b4e643f22e Fixed Xml goog.require's. Changed Blockly.Events.Ui functions to Blockly.Events.FinishedLoading. 2019-01-25 17:08:30 -08:00
Beka Westberg
bb2260fd91 Added a Finished Loading event. 2019-01-25 16:04:02 -08:00
RoboErikG
ecc555b7f3 Fix bad xml element when generating next node (#2098)
Fixes #2096

We were creating a text node to wrap any block connected to
next when we should have just been attaching the generated dom.
2018-10-31 09:52:59 -07:00
Neil Fraser
aa09ad9175 Line wrap at 80. 2018-10-16 11:34:10 -07:00
Neil Fraser
f196816f62 Move DOMParser and XMLSerializer to Xml.utils 2018-10-16 11:34:10 -07:00
Neil Fraser
c74830231c Minor corrections 2018-10-16 11:34:10 -07:00
Neil Fraser
dddb94aedd Fix circular dependency. 2018-10-16 11:34:10 -07:00
Neil Fraser
e62bb1af73 Remove all calls to goog.dom.createDom
All XML node cereations are now centralized.
2018-10-16 11:34:10 -07:00
Neil Fraser
59a4db61b2 Remove .children access
Not supported in node.js’ xmldom package.
2018-09-20 20:34:07 -07:00
Rachel Fenichel
b4865f07f7 Fix some more annotations and an accidental global use of this 2018-09-11 16:41:01 -07:00
Andrew n marshall
411ec9724e Replacing node.parentNode.removeChild(node)
...with Blockly.utils.removeNode(..), which includes
a null/undefined check on parentNode before continuing.
2018-09-04 13:31:53 -07:00
Neil Fraser
dce60fd152 Replace ReferenceError with Error.
Change to 4-space indentation rather than aligning with parent structure.
2018-07-11 12:20:02 -07:00
Neil Fraser
c51cf0b79c Remove goog.dom.removeNode 2018-07-11 12:20:02 -07:00
Neil Fraser
3909bd420a Remove all goog.asserts and goog.isXxx
First step to reducing Closure’s footprint.
2018-07-11 12:20:02 -07:00
Neil Fraser
13f7e75ffb Supress empty <variables> tag in XML. 2018-06-29 17:52:26 -07:00
Andrew n marshall
7886d24130 Fixing xml.js: Always throw XML I/O errors; Support parsing in Node (#1911)
* Improved Blockly.XML comments.
 * Support JSDOM as an alternate parser under Node.js
 * Throw standard errors instead of goog.asserts.
 * Adding textToDomDocument_ and override in gulpfile.
2018-06-12 14:03:10 -07:00
Rachel Fenichel
df7f534ad6 Performance improvements for workspace clear and load 2018-05-17 11:05:18 -07:00
Rachel Fenichel
a572a15874 Merge pull request #1827 from rachel-fenichel/feature/references_variables
Add a referencesVariables function to field
2018-04-27 15:34:53 -07:00
Rachel Fenichel
ee6f2ea097 Comments v3 (#1817)
* Add skeleton for workspace comments

* XML parsing and encoding of workspace comments.

* Minor fix: piping the height and width from xml to newWorkspaceComment

* Move height and width into workspace_comment_svg

* rename newWorkspaceComment to newComment

* minor refactoring. PR changes

* Functions for managing the comment's lifecycle

* Add initial tests

* Add another test

* Add basic rendering of a comment.

* Cleanup remaining highlighting steps from render

* Fix lint

* Fix aslant

* Add basic comment translate

* Simplify render code into one setPath method

* Move steps to setPath_

* Remove svg elements when disposing of a comment; some code cleanup

* Add a workspace comment on context menu click and position it where the initial context menu was clicked.

* Minor rendering changes, fixes RTL. Fix positioning of new (context menu) comments while workspace is scaled.

* PR feedback

* Gesture code for dragging comments

* Add comment (block drag) surface methods

* minor comment fix

* Comment fixes

* Add comment dragger

* Making rendered private

* Require CommentDragger

* Make basic comment dragging work

* Increase the border around the comment to make a bigger drag handle

* Remove typo

* Allow comments to be selected. Highlight selected comment. Only edit comment on click. Updated comment rendering.

* minor refactor: remove commented out code

* PR comments

* lint and rebuild

* Fix renamed function call

* Fix workspace getMetrics by storing comment size as a number, not a string

* Enable comment deletion when dragging over the toolbox or trash can

* Give issue references to some todos

* Create a helper function for workspace comment creation

* Integrate sam's workspace comments, using the bubble dragger

* Remove comment_dragger references

* Remove comment dragger.js

* Remove pointer handling

* Fix lint

* Move comment XML functions into the comment files.

* Fix tests

* Fix type annotations

* Fix comments on comments

* Fix compiler errors related to visibility.

* Fix merge issues and add an issue number to a TODO

* Add a new message for default text on workspace comments, and rebuild

* Add support for a context menu on workspace comment showing delete and duplication options.
Add copy and paste support.

* PR comment feedback

* Show a delete icon on the comment when selected. Delete icon deletes the comment. Comment can be deleted if dragged onto the toolbox or the trash icon. A normal bubble cannot be deleted that way.

* use isDeletable instead

* Support drag of the comment during editing mode using the top handle.

* Add skeletons for all workspace comment events

* Rebuild with new comments

* Get rid of confused TODO

* JSDoc on a function

* Fix broken tests

* More PR feedback

* Fix lint

* Delete comment on mouse out, highlight on mouse down.

* Fix lint.

* Show delete hand cursor when dragging a comment to delete over the toolbox

* Focus textarea on select

* Add delete events

* Remove workspace comment create event, and add TODO placeholder

* Provide default values if comment height and width are missing in XML

* Set comment handle fill to none by default

* Rebuild

* Comment de/serialization should include location.

* Add comment move events, with undo and redo

* Add comment change events

* Move files up to core

* Add package/private annotations wherever possible

* Move the workspace comment events up to core and into a single file

* Mark things package or private where possible

* Get rid of unnecessary changes to messge files

* Fix lint

* Fix some review feedback

* Make changes to the comment db happen in addTopComment and removeTopComment

* Add css classes for toggling comment focus

* Clean up css for comment focus

* Rebuild
2018-04-27 15:18:59 -07:00
Rachel Fenichel
a8767ee6c9 Add a referencesVariables function to field 2018-04-25 15:15:05 -07:00
Neil Fraser
662d79443f Add 'ordered' option to descendant getting functions. (#1786) 2018-04-17 11:41:03 -07:00
Neil Fraser
35f7357878 Strip coordinates from storage of single block stacks.
When loading, place blocks with no coordinates at 10,10 instead of 0,0.
2018-04-05 14:04:06 -07:00
Troy McKinnon
65d0b8fda7 Allow block xml disable tag to be more accepting 2018-04-04 13:42:01 -05:00
Rachel Fenichel
6d83b9bc28 Add keyword-spacing rule to eslint 2018-03-19 13:10:29 -07:00
Rachel Fenichel
4c9b602523 Move event classes into separate files, and update requires accordingly 2018-02-27 17:47:33 -08:00
Neil Fraser
73417b8317 Reduce size of XML by omitting empty variable tag. 2018-02-14 11:22:55 -08:00
Rachel Fenichel
3b168f5370 Fix #1538 2018-01-26 15:20:19 -08:00
Rachel Fenichel
3e62ffc20a Split at higher level for multiline function calls 2018-01-24 11:26:41 -08:00