Commit Graph

118 Commits

Author SHA1 Message Date
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
Rachel Fenichel
1e3450a051 Indentation lint that blocks moving to eslint 4.0 2018-01-23 17:27:35 -08:00
Rachel Fenichel
b593d44379 Make the potential variable map null when not needed 2018-01-12 14:51:02 -08:00
Rachel Fenichel
80b397f532 Respond to more review comments 2018-01-10 17:27:43 -08:00
Rachel Fenichel
b342fb2121 Fix problem with clearing flyout after a variable was deleted. 2018-01-02 16:42:28 -08:00
Rachel Fenichel
9b091a8f9e Update procedure generators 2018-01-02 16:27:17 -08:00
Rachel Fenichel
d69519bdab Fix headless 2017-12-19 16:10:07 -08:00
Rachel Fenichel
4cd0b36944 Fix event ordering for variables created from XML implicitly 2017-12-19 14:25:52 -08:00
Rachel Fenichel
6218750207 Fix events for variable fields on new blocks; fix tests 2017-12-19 11:28:23 -08:00
Rachel Fenichel
cc6eeb8c68 Clean up TODOs and move potential variable map to the flyout workspace 2017-12-07 10:43:12 -08:00
Rachel Fenichel
0909af76e5 Fix missing events for variable creation 2017-12-06 16:41:17 -08:00
Rachel Fenichel
1506a36b58 Fix events for variable renaming 2017-12-06 14:41:56 -08:00
Rachel Fenichel
e4844cd120 Move getOrCreateVariable to variables.js 2017-12-05 13:08:01 -08:00
Rachel Fenichel
6bb048d1bb All tests pass 2017-12-04 14:29:16 -08:00
Rachel Fenichel
494c4882be Fix variable_map_test and variable_model_test 2017-12-01 14:05:37 -08:00
Rachel Fenichel
86e88aae92 Can now create a variable with the button in the flyout; drag a block with a variable out of the flyout; handle default variable names; and import and export variables 2017-11-30 16:30:58 -08:00
Rachel Fenichel
b870c3ccb9 Allow variables of different types to share the same name. 2017-11-30 13:16:16 -08:00
Rachel Fenichel
222407c6ce Extract code for domToField_ 2017-11-30 12:08:01 -08:00
Rachel Fenichel
d73337ad73 Extract fieldToDom into its own function 2017-11-30 11:24:57 -08:00
Rachel Fenichel
30716fbd78 switch to variabletype everywhere 2017-11-03 16:03:32 -07:00
Neil Fraser
2445a752b7 Resolve another 20 warnings. 2017-10-24 14:06:29 -07:00
Neil Fraser
4262b09002 Resolve 106 warnings. 2017-10-24 14:06:29 -07:00
Rachel Fenichel
bd1d199058 Don't check typeof == undefined in variable deserialization (#1379) 2017-10-23 11:28:00 -07:00
picklesrus
5518873389 Revert "Remove all all instances calling setValue on variable fields with the name instead of the id" (#1296)
* Revert "Create WorkspaceViewport class (#1291)"

This reverts commit 6c00d77c9e.

* Revert "Remove all all instances calling setValue with name. (#1254)"

This reverts commit 8e8b6b27af.
2017-08-28 16:55:44 -07:00
marisaleung
8e8b6b27af Remove all all instances calling setValue with name. (#1254) 2017-08-24 14:34:01 -07:00
Neil Fraser
fc8d4c90b4 Compatibility for Closure Compiler. (#1240) 2017-07-31 09:07:41 -07:00
marisaleung
733d869f8e Add VariableType checks. 2017-07-20 16:47:37 -07:00
marisaleung
aff9c4867c Correctly named block events called. 2017-06-08 15:44:43 -07:00
marisaleung
7f873b12c4 Wrap Error in Try Finally Block. 2017-06-07 10:00:04 -07:00
marisaleung
f7f664063b Deserialization variables at top. 2017-05-25 14:03:37 -07:00
marisaleung
dc06872a37 Deserialization variables at top. 2017-05-24 15:29:46 -07:00
marisaleung
ce4a84b3cf Include variables at top of serialization. 2017-05-24 10:53:44 -07:00
marisaleung
1cd8e1fcc1 Add type, id, and info to the generated xml.
Add xml tests for fieldToDom.
Update workspace tests to pass with new changes.
2017-05-19 15:47:39 -07:00
marisaleung
d903b5e86b VariableMap and functions added. 2017-05-03 10:51:24 -07:00
Rachel Fenichel
85b4f5f1a8 Fix #969 2017-03-17 16:25:45 -07:00
Andrew n marshall
6e1ffe09c2 Adding Blockly.Xml.appendDomToWorkspace() (#962)
This is a copy (with additional comments) of PR #822 (and also #961) by @qnoirhomme with unrelated files removed. See #822 for full review.
2017-03-03 08:40:00 -08:00
Andrew n marshall
e95991cba8 Adding @namespace annotations for JSDoc. (#900) 2017-02-01 09:10:35 -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