Commit graph

107 commits

Author SHA1 Message Date
Karishma Chadha
93bbd0b00f Track cloud variable info and handle naming and renaming cloud variables. 2018-11-13 16:43:00 -05:00
Karishma Chadha
0fa3ef6e78 Fix RTL block comment positioning and RTL workspace comment rendering 2018-10-02 16:48:58 -04:00
Andrew Sliwinski
5b34893292
Revert "Throw Errors instead of using goog.asserts" 2018-08-22 15:29:43 -04:00
Rachel Fenichel
c88b1f8d2a Throw Errors instead of using goog.asserts 2018-07-24 16:21:15 -07:00
Karishma Chadha
c23fe53344 Allow for local variables by passing in extra scope information (provided by the gui). This information is included in the varCreate event. Pass in a list of additional var names to check against when creating a variable (e.g. local var names from all sprites when checking for name conflicts to create a global var. 2018-07-03 14:01:49 -04:00
Lee Howett
169e79053d Unselect any currently-selected block before executing an undo/redo 2018-05-31 14:52:40 -07:00
Rachel Fenichel
8bd2067dab
No trailing spaces, even on comments. 2018-05-25 11:20:51 -07:00
Rachel Fenichel
5b76c6257e
Add comments to explain some subtle code. 2018-05-25 11:00:07 -07:00
Rachel Fenichel
af4060c75b Add ordered option to getDescendants and all uses.
"
2018-05-16 12:51:41 -07:00
Rachel Fenichel
6a3692da01 Add the bubble dragger and ws comment basics 2018-05-11 16:35:31 -07:00
Corey Frang
51c3e8e96c Optimize block.setParent during clearing workspace 2018-05-04 13:29:14 -04:00
Rachel Fenichel
4fc5b6ac97 More small stuff from google, and allow unused vars with _names 2018-04-26 17:06:12 -07:00
kchadha
f5d7fc6908
Merge pull request from kchadha/variables_by_id
Variables by Id -- Separate namespaces per variable type
2018-01-22 16:30:34 -05:00
Karishma Chadha
8c6e2c523c Refresh the toolbox after deleting a custom procedure definition. 2018-01-19 14:11:04 -05:00
Karishma Chadha
8b5762581b Code cleanup, removing todo comments. 2018-01-18 15:03:46 -05:00
Karishma Chadha
ec257e51ca Fixing errors from previous merge conflict resolution. 2018-01-18 15:03:46 -05:00
Rachel Fenichel
7102012240 Pulling in final changes from upstream blockly/variables_by_id branch.
Includes commits 1fa27fa (01/12/18) through fa91c6b (01/16/18).
2018-01-18 15:03:46 -05:00
Rachel Fenichel
855ec2665a Pulling in the latest changes from google/blockly/variables_by_id branch,
starting with commit 6218750 (December 19, 2017) through commit 80b397f (January 10, 2018).
2018-01-18 15:03:46 -05:00
Karishma Chadha
db44603362 Pulling in changes from blockly/variables_by_id. 2018-01-18 15:03:46 -05:00
Rachel Fenichel
c865f36837 Apply new names for procedure components 2017-11-16 13:18:53 -08:00
Rachel Fenichel
9771120ab4 Cleanup of workspace context menu code 2017-10-13 13:36:37 -07:00
Paul Kaplan
2af85c92b4 Fix errant newlines 2017-06-23 11:45:48 -04:00
Paul Kaplan
fce962c0fc Merge 06-22 2017-06-22 11:30:37 -04:00
Paul Kaplan
dd964828e1 Merge/05 24 ()
* JSON definitions for colour blocks ()

Replaces old colour block definitions with a Blockly.defineBlocksWithJsonArray(..) call. Generator unit tests continue to load and pass, signifying compatibility with prior block definitions.

Replaces extension 'math_number_tooltip' with the reusable 'parent_tooltip_when_inline' extension, also used by colour_picker. Includes tests.

* Rewrite tree.service.js.

- Remove unnecessary code and functions.
- Add documentation where needed.
- Fix a bug arising when a block on the workspace is attached to an existing link.

* Use setValue in fieldTextInput so that procedure renaming works

* Further cleanup and removal of unnecessary functions. Pull some strings out for i18n.

* Use bindEvent_ instead of bindEventWithChecks_ for longStop

* Clean up workspace.component.js. When moving a block from one place to another, move all blocks after it too, and adjust the active descs accordingly.

* Unit tests for JSON block definitions (just the start) ()

 * Beginnings of a JSON block definition unit test set.
 * Dispose of unit test workspaces and blocks in finally blocks.
 * Clarify JSON error message by echoing arg notation.

* New blocks text_count, text_replace, and text_reverse ()

Includes generators for all languages and units tests on those generators.

* Fixing combo boxes getting out-of-sync with NVDA.

Combo boxes need to be special cased like text input. Also, Escape is
a reserved button in NVDA, so I added Enter as a way to "submit and
move up a level" in addition to escape, so these boxes can be edited
while NVDA is on.

* Temporary fix for broken text field validation.

* rebuild

* Add a block to reverse a list ()

* Localisation updates from https://translatewiki.net.

* Porting math.js blocks to JSON ()

Moving all `math.js` definitions into a single JSON array, complete with i18n syntax for all messages, dropdowns, and tooltips.

Adding Blockly.Extensions.buildTooltipForDropdown(..) to facilitate the creation and error-checking of tooltips that update based on the value of a dropdown.

Now warn on raw string in JSON 'extensions'.

* Fixing JSON support for images in dropdowns. Adding tests. ()

Fixes .

* Update README.md

Add a link to our forum.

* Correcting math_change color

* Enable custom flyout categories.

* Add some safety

* Update the set of reserved words in Python to reflect the current state of Python (2.7 and 3.6). ()

* Localisation updates from https://translatewiki.net.

* .getOptions_() to .getOptions() ()

Fixes .

* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. ()

Defer tooltip message string check until after load, when all Blockly.Msg should be loaded.
Avoids validation in headless mode, due to lack of document.readyState.

* annotation updates

* annotation updates

* jsdoc corrections ()

* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes .

* 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.

* Change CSS transforms to work with older browsers ()

* Change the setting of the CSS transform properties on SVG nodes to set both the unprefixed version and the `-webkit-` prefixed version so that Blockly correctly renders in order browsers, such as Safari < 9 and iOS Safari < 9.2. For discussion of this issue, see https://groups.google.com/forum/#!topic/blockly/o3pERaRQhSg

* Correct the separation between the CSS transform property and the rest of the CSS that was in the variable misleadingly called "transform".

* Don't try to get block position in a headless workspace

* Stop bumping neighbours in headless blockly

* Place context menu correctly on touch

* Clear all active desc ids when the 'Erase Workspace' button is pressed.

* Fix a bug where splicing a block between two linked blocks disconnects the group and messes up the focus.

* Deleting a top-level block does not cause blocks after it to be deleted. Properly handle the active desc for this case.

* Localisation updates from https://translatewiki.net.

* Use the empty field placeholder for dropdowns that do not have a value selected.

* Bugfix for . I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. ()

* Adding @namespace annotations for JSDoc. ()

* Fix typo causing TypeError ()

* Pinning the angular2 dependency, and including licenses. ()

* Add skeleton for tests on rendered workspaces

* Fix some lint errors

* Localisation updates from https://translatewiki.net.

* Correct changedState in setWarningText() ()

When clearing warnings on blocks with IDs, the changedState variable should be true if the text changed. This will trigger the block being reshaped and remove the space for the notification icon (this.bumpNeighbours_).

* Adds Block.prototype.mixin() and Blockly.Extensions.registerMixin(). ()

Adds Block.prototype.mixin() and Blockly.Extensions.registerMixin().
This adds support for a common use pattern in extensions, and adds
error checking to avoid future incompatibilities.

* Porting Logic blocks to JSON ()

Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.

* Improving errors/warnings with Block.toDevString() and Connection.toString(). ()

* Add isEditable to field, and add tests

* Separate tests

* Blockly.Constants.Math and Blockly.Constants.Colour extension constants ()

Also, correcting quotes in logic.js.

* Correction to logic_ternary type check ()

* Porting Loop blocks to JSON ()

 * Improved documentation on `Blockly.Extensions.buildTooltipForDropdown`
 * Replaced incorrect uses of `@mixes` JSDoc annotation (on mixin extensions) with `@augments Blockly.Block`.
 * Added Blockly.Extensions.buildTooltipWithFieldValue() extension helper.

* Workspace isDraggable

* JSONify simple list blocks

* JSONify variable blocks

* Initial text block, with a mixin to generate quote image fields. ()

Text block now uses the extension "text_quotes", supported by Blockly.Constants.Text.QUOTE_IMAGE_MIXIN.quoteField_(fieldName), so that each platform can use the best platform appropriate image (size, density, etc.) for the quotes.

* Add no-op stub .neighbors() for headless Connection.

* Adding tests for logic_ternary block in a new jsunit test framework.

* Correcting output of the logic_null block.

* Potential bug fix for issue 

* extension controls_if => controls_if_mutator.

* Renamed extension function constant, and moved variables into the mixin.

* Dereference string table references when loading variable fields from JSON.

* Moving FieldImage string dereferencing back into Block.interpolate_() (part of jsonInit()). This sets a clear boundary of where dereferencing should happen.
Towards this, I've added message dereferencing for other field types here, as well.  I've used a pattern of field-type specific helper functions.

* Addressing comments.

* .utils.replaceMessageReferences(..) now gracefully returns non-string arguments.

* Clarification update.
Unraveling nested ternaries in Blockly.utils.tokenizeInterpolation_()

* Code correction from previous commit. Moved style to css.js and set ROUNDING=15;

* Fixing Enter so it properly propogates to dropdown selection. ()

Fixing FieldSegment so it updates dropdowns when the underlying dropdown changes.

* Localisation updates from https://translatewiki.net.

* Make variable add set/get block in context menu obey block limits

* Localisation updates from https://translatewiki.net.

* Use mutator extension for controls_if block

* Fix . Don't check for presence of constants.js

* Fix  (annotations) and an eslint issue (constant condition)

* Localisation updates from https://translatewiki.net.

* Fix : BlockFactory typo and copypasta

* Add safety checks for mutators and non-mutator extensions

* Handle mutations with both mixins and functions

* Adding warning on duplicate JSON block definition.

* period

* Make some functions private and add tests

* Localisation updates from https://translatewiki.net.

* Update help URL per .
Replace URL usages of %28 and %29 with normal parenthesis characters. (They aren't replaced by JavaScript's encodeURIComponent() function, and seem to work just fine without them.)
Added missing semicolon in build.py.

* Typo in comment.

* Make it easier to read the code that creates the variable category in the tolbox

* Adding Blockly.Xml.appendDomToWorkspace() ()

This is a copy (with additional comments) of PR  (and also ) by @qnoirhomme with unrelated files removed. See  for full review.

* Annotation fixes

* Fix bug  by explicitly grabbing focus on the workspace svg element. ()

* Potential fix for .  Stops checking whether we are mid workspace drag since we do not always get mosue up events when blockly is in an iframe. ()

* Adding new minimap demo

* Basic code style changes. Adding a few more comments. Return early if disableScrollChange in onScrollChange listener.

* `unction` to `function` corrects  ()

* Cross browser friendly fix for .  This calls blur and focus from … ()

* Cross browser friendly fix for .  This calls blur and focus from workspace.markFocused and removes the event listener on focus events.  markFocused is called from all of our mouse down handlers, which triggers the focus event leading to an infinite loop of focus.  As far as I can tell, there are no uses of the focus handler that actually did anything for us.

* Localisation updates from https://translatewiki.net.

* Another attempt to fix  to keep the page from jumping to the focused workspace in IE 11 ()

* Adding horizontal scrolling. Changed scroll change callbacks from onScroll_ to setHandlePosition. onScroll_ is not challed when workspace is dragged.

* set background color to lilac if opening the playground from file:

* Registering mousemove and mouseup listener in mousedown event. Mousemove and Mouseup events are now listening over document.

* Localisation updates from https://translatewiki.net.

* Fix  by overriding the updateWidth method in FieldImage blocks to be a no-op. FieldImage fields should not change size after the width is set in init.  The updateWidth and, therefore, getCachedWidth is now being called by BlockSvg renderFields_ (see commit d55d9cbd9f). IIUC, updateWidth/getCachedWidth was only called from render before which is overridden in FieldImage to be a no-op already. ()

* Fix 

* Localisation updates from https://translatewiki.net.

* Fix .  Looks like the original PR just forgot this block. ()

* rebuild develop ()

* Added the variable modal and component and implemented basic renaming functionality. ()

* Fixing commenting from the last commit. ()

* Localisation updates from https://translatewiki.net.

* RemoveAttribute doesn't work on SVG elements in IE 10.  Use setAttribute to null instead.

* Adding the remove variable modal and functionality to accessible Blockly. ()

* Minimap position bug fix for browsers other than chrome. Added touch support.

* Adding an add variable modal to accessible Blockly. ()

* Adding the remove variable modal and functionality to accessible Blockly.

* Adding the add variable modal for accessible Blockly.

* Block browser context menu in the toolbox and flyout

* Add links to the dev registration form and contributor guidelines

* Miscellaneous comment cleanup

* Adding the common modal class. ()

Centralizes accessible modal behavior.

* - Changed error message referencing 'procedure' instead of 'function' ()

- Added iOS specific UI messages
- Fixed bug with js_to_json.py script where it didn't recognize ' character

* - Allows use of Blockly's messaging format for category name, colour,… ()

...in toolbox XML.
- Updated code editor demo to use this message format
- Re-built blockly_compressed.js

* Making text_count use a text color (like text_length, which also returns a number). ()

* Enable google/blockly with continuous build on travis ci () ()

* create .travis for ci job

* initial checkin for blocky-web travis ci job

* rename file to .travis.yaml for typo

* remove after_script

* added cache

* rename .travis.yaml to .travis.yml

* Update .travis.yml

* include build script

* fix yaml file format issue

* debug install part

* debug build issue

* Update .travis.yml

* remove cache for now

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* more debug info

* Update .travis.yml

* Update .travis.yml

* fix typo

* installing chrome browser

* remove chrome setting config

* run build.py as part of npm install

* Update .travis.yml

* update karma dependency

* use karma as test runner

* fix typo

* remove karma test for now

* Update .travis.yml

* Update package.json

* add npm test target

* add browserstack-runner depdendency

* update browser support

* fix typo for test target

* fix chrome typo

* added closure dependency

* add google-closure-library

* include blockly_uncompressed.js and core.js dependency

* uncomment out core/*.js files

* add kama job as part of install

* remove browserstack add on for now

* fix karma config typo

* add karma-closure

* add os support

* remove typo config

* include more closure files

* change os back to linux

* use closure-library from node_modules

* change log level back to INFO

* change npm test target to use open browser command instead of karma

* change travis test target to use open command instead of karma

* list current directory

* find what's in current dir

* typo command

* Update .travis.yml

* typo again

* open right index.html

* use right path for index.html

* xdg-open to open default browser on travis

* exit browser after 5s wait

* change timeout to 1 min

* exit after opening up browser

* use browser only

* use karma

* remove un-needed dependency

* clean up script section

* fix typo

* update build status on readme

* initial commit for selenium integration tests

* update selenium jar path

* fix test_runner.js typo

* add more debug info

* check java version

* add && instead of 9288

* fix java path

* add logic to check if selenium is running or not

* add some deugging info

* initial commit to get chromedriver

* add chromedriver flag

* add get_chromedriver.sh to package.json and .travel

* change browser to chrome for now

* fix path issue

* update chromdriver path

* fix path issue again

* more debugging

* add debug msg

* fix typo

* minor fix for getting chromedriver

* install latest chrome browser

* clean up pakcage.json

* use npm target for test run

* remove removing trailing comma

* fix another trailing comma

* updated travis test target

* clean up scripts

* not sure nmp run preinstall

* redirect selenium log to tmp file

* revert writing console log to file

* update test summary

* more clean up

* minor clean up before pull request

* resolved closure-library conflict

1. add closure-library to dependencies instead of devDependencies.
2. add lint back in scripts block

* fix typo (adding comma) in script section

* Renames Blockly.workspaceDragSurface to Blockly.WorkspaceDragSurface.

Fixes .

* Ensure useDragSurface is a boolean.

Fixed 

* use pretest instead of preinstall in package.json ()

* cherry pick for pretest fix

* put pretest target to test_setup.sh

* fix conflict

* cherry pick for get_chromedriver.sh

* add some sleep to wait download to finish

* use node.js stable

* use npm test target

* field_angle renders degree symbol consistently.

Fixes 

* bumpNeighbours_ function moved to block_svg.

Fixed 

* Update RegEx in js-to-json to match windowi eol ()

The current regex only works with the "\n" line endings as it expects no characters after the optional ";" at the end of the line. In windows, if it adds the "\r" it counts as a characters and is not part of the line terminator so it doesn't match.

* Fix French translation of "colour with rgb" block ()

"colorier", which is currently used, is a verb and proposed "couleur" is
a noun: the block in question does not change colour of anything, it
creates new colour instead, thus noun is more applicable.

Also, noun is used in French translation of "random colour" block:
"couleur aléatoire".

* Enforcing non-empty names on value inputs and statement inputs. ()

* Correcting  ()

single quotes. better logic.

* Created a variable model with name, id, and type.

Created a jsunit test file for variable model.

* Change how blockly handles cursors.  The old way was quite slow becau… ()

* Change how blockly handles cursors.  The old way was quite slow because it changed the stylesheet directly.  See issue  for more details on implementation and tradeoffs.  This changes makes the following high level changes: deprecate Blockly.Css.setCursor, use built in open and closed hand cursor instead of custom .cur files, add css to draggable objects to set the open and closed hand cursors.

* Rebuild blockly_uncompressed to pick up a testing change to make travis happy.  Fix a build warning from a multi-line string in the process. ()

* Merge master into develop ()

- pick up translation changes
- clean up trailing spaces

* use goog.string.startswith instead of string.startswith ()

* New jsinterpreter demo includes wait block. Both demos have improved UI for clarity. ()

Refactor of interpreter demo
 * Renamed demos/interpreter/index.html as demos/interpreter/step-execution.html (including redirect), and added demos/interpreter/async-execution.html.
 * Refactored code to automatically generate/parse the blocks, eliminating the need for a "Parse JavaScript" button. Code is still shown in alert upon stepping to the first statement. Print statements now write to output <textarea> instead of modal dialogs.

* VariableMap and functions added.

* Create separate file for VariableMap and its functions.

* Fix  ()

* VariableMap and functions added.

* Fix  ()

* Improve errors when validating JSON block definitions. ()

goog.asserts to not run from blockly_compressed.js. User data validation should always run.

* Dragging changes, rebased on develop ()

* Add block drag surface translateSurfaceBy

* Add dragged connection manager

* Add gesture.js

* Add GestureHandler

* Implemented gesture skeleton

* Most basic workspace dragging

* Add dragged connection manager

* cleanup

* doc

* more cleanup

* Add gesture handler

* Add translateSurfaceInternal

* core/block_dragger.js

* cleanup

* Pull in changes to dragged connection manager

* Pull in changes to dragged connection manager

* comments

* more annotations

* Add workspace dragger

* Add coordinate annotations

* Start on block dragging

* Limit number of concurrent gestures

* Add some TODOs

* start using dragged connection manager

* Set origin correctly for dragging blocks

* Connect or delete at the end of a block drag.

* cleanup

* handle field clicks and block + workspace right-clicks

* move code into BlockDragger class, but still reach into Gesture internals a lot

* Clean up block dragger

* Call blockDragger constructor with correct arguments

* Enable block dragging in a mutator workspace

* Add workspace dragger

* click todos

* Drag flyout with background

* more dragging from flyout

* nit

* fix dragging from flyouts

* Remove unused code and rename gestureHandler to gestureDB

* Rename gesture handler

* Added some jsdoc in gesture.js

* Update some docs

* Move some code to block_svg and clean up code

* Lots of coordinate annotations

* Fix block dragging when zoomed.

* Remove built files from branch

* More dragging work ()

-- Drag bubbles while dragging blocks
-- Use bindEventWithChecks to work in touch on Android. Not tested anywhere else yet.
-- Handle dragging blocks while zoomed
-- Handle dragging blocks in mutators
-- Handle right-clicks (I hope)
-- Removed lots of unused code

* More dragging work ()

- Removed gestureDB
- Removing uses of terminateDrag
- Cleaned up disposal code

* Dragging bugfixes ()

- Get rid of flyout.dragMode_ and blockly.dragMode_
- Make drags from the flyout start from the top block in the group
- Block tooltips from being scheduled or shown during gestures
- Don't resize mutator bubbles mid-drag

* Fix events in new dragging ()

* rebuild for testing

* unbuild

* Fix events

* rebuild

* Fix up cursors

* Use language files from develop

* Remove handled TODOS

* attempt to fix IE rerendering bug, and recalculate workspace positions on scroll

* Rebuild all the things

* Comment cleanup; annotations; delete unused variables.

* Tidy up context menu code. ()

* add osx travis test run job ()

* Names are correctly fetched from VariableModels!

* add more wait time for test setup ()

* Work around timing issue with travis osx issue ()

* add more wait time for test setup

* increase selenium wait time

* add more wait

* Fix  by adding a rule to cover the toolbox labels too. ()

* Assign variable UUID to field_variable dropdown.

* Change registration link to a static one ()

This lets us redirect to a different form if we change it in the future.

* Edit generators to read in Variable Models.

* Add VariableMap requirement to workspace.

* Changed parameter name in workspace for clarity.

* Add type, id, and info to the generated xml.

Add xml tests for fieldToDom.
Update workspace tests to pass with new changes.

* Fix apostrophe in tooltips and helpurls ()

* Click events on shadow blocks have the correct id ()

* Add image_onclick option ()

* Cleanup: semicolons, spacing, etc. ()

* Spelling.  Spelling is hard.

* Add variable info to xml generated in variables.js

* Add missing CLAs info to the contributing file ()

* Add missing CLAs info to the contributing file

* Added larger changes paragraph

* Replacing latest prettifier hosted in repo with latest version at rawgit CDN. ()

* Forgot update code demo ()

* Move audio code to a new file ()

* move audio code to a new file

* dispose

* null check

* Make flyout get variables from target workspace's variableMap.

* Require VariableModel in field_variable.js.

* Update contributing.md ()

* Include variables at top of serialization.

* Move blockSvg.getHeightWidth to block_render_svg.js ()

* Deserialization variables at top.

* Create grid object ()

* Create grid object

* Doc

* Units!  Thanks @RoboErikG

* Add our sound files in other formats

* Remove duplicate merged code

* Remove translation files

* Cleanup duplicate functions

* Add back scrollbar code

* Fix variable related issues

* Revert workspace variable creation change

* Delete language files

* Appease linter

* Remove duplication

* Add spaces to jsdoc line
2017-05-30 09:26:06 -04:00
Rachel Fenichel
6275e1137c New dragging! Merge from google ()
Port of a major refactor from Blockly.  Dragging logic now lives in block_dragger.js, gesture.js, workspace_dragger.js, dragged_connection_manager.js (unused by scratch-blocks), and insertion_marker_manager.js (used only by scratch-blocks).
2017-05-22 13:08:22 -07:00
Paul Kaplan
1827255261 Merge google/blockly, May 2017 ()
* Move createDom call into the constructor of block drag surface. ()

* Make cursor stay as a closed hand when dragging blocks around in the drag surface. Do this by applying the same style to text elements in the drag surface that we do in the main svg. ()

* Don't connect to blocks under the flyout.

* recompile again. ()

* Fix german translation

* Option for moving one block from stack.

See thread in support group before merging.

* Fix german translation of 'delete x blocks'

* Adding unit tests for ifelse block.

* Improvements to the generator test framework.

* <field>, <value> reorder due to load/save.

* Expand stack-drag modifier key to include alt and ctrl.

* Use the npm closure library instead of the same library installed at a parallel directory

* Fix undo/redo for FieldCheckbox

Thanks to PR  by ademenev

* Localisation updates from https://translatewiki.net.

* PR : Adding support for string table lookups in dropdown field labels

Adding support for string table lookups in dropdown field labels specified in JSON.

Adds Blockly.utils.replaceMessageReferences() method to handle string replacement without interpolation tokens.  Effectively uses the same old code, now moved into tokenizeInterpolation_(), which takes a parseInterpolationTokens option.

Replaces the direct JavaScript references (not pure JSON, and thus not portable).

Demonstrating this behavior in the logic_boolean dropdown.

* Integrating qqq.json changes into messages.json. ()

From commits b77f8cbebc and 4ecdedec9f

* Naming changes in mirror demo

* Adding support for untranslated messages. ()

This will be used to define constants accessible in JSON block definitions. Messages with descriptions that include `{{Notranslate}}` will not be included in the translation files sent to TranslateWiki. Instead, they are written to `msg/json/constants.json`, and later merged back into the `.js` files, similar to synonyms.

Template details: https://translatewiki.net/wiki/Template:Notranslate

* JSON support for message lookup in colour, tooltip, and help URL. ()

String replacement for the colour, tooltip text and help URL attributes of JSON defined blocks.
Demonstrated in logic_boolean.

* Fixes as per code review on PR.

* Localisation updates from https://translatewiki.net.

* Reduce number of Closure files in App Engine upload.

* Python false is False.  Issue .

* Replace 'const' with 'var'.

This unbreaks IE10 and advanced compiled apps such as Blockly Games.

* Fix bug in audioService where attached event callbacks were not being cleared properly.

* Rename workspace-tree to workspace-block.

* Minor refactoring of the modal code (add comments, guard against invalid keystrokes, etc.).

* FieldNumber & FieldAngle: Default value "0" ()

FieldNumber and FieldAngle previously accepted "undefined" as values, if not defined in JSON. This catches these and uses "0" for any NaN value.  The constructor value parameter is now optional. Includes tests.

* Remove unnecessary check when attaching a new block to a marked connection.

* Remove debug info.

* Refactor and simplify field-segment.component.js.

* Replace single quotes with double. ()

Fixes commits in .

* Adding extensions for JSON support of dynamic blocks. ()

Adding support for extensions, functions that can assist with loading blocks, much like init functions, but that can be referenced from JSON definitions. This allows JSON definitions to define dynamic blocks such as onchange handlers and mutators.

Rewrote math_number as an example pure JSON block.

* Add ability to add a class to a scrollbar so that different types of … ()

* Add ability to add a class to a scrollbar so that different types of scrollbars can
be distinguished from each other. You used to be able to do this by looking at the parent
element but now all the scrollbars are siblings in the dom.

Also, use this new class to fix  so that layering of the flyout and workspace scrollbars
are done correctly.

* JSON definitions for colour blocks ()

Replaces old colour block definitions with a Blockly.defineBlocksWithJsonArray(..) call. Generator unit tests continue to load and pass, signifying compatibility with prior block definitions.

Replaces extension 'math_number_tooltip' with the reusable 'parent_tooltip_when_inline' extension, also used by colour_picker. Includes tests.

* Rewrite tree.service.js.

- Remove unnecessary code and functions.
- Add documentation where needed.
- Fix a bug arising when a block on the workspace is attached to an existing link.

* Use setValue in fieldTextInput so that procedure renaming works

* Further cleanup and removal of unnecessary functions. Pull some strings out for i18n.

* Use bindEvent_ instead of bindEventWithChecks_ for longStop

* Clean up workspace.component.js. When moving a block from one place to another, move all blocks after it too, and adjust the active descs accordingly.

* Unit tests for JSON block definitions (just the start) ()

 * Beginnings of a JSON block definition unit test set.
 * Dispose of unit test workspaces and blocks in finally blocks.
 * Clarify JSON error message by echoing arg notation.

* New blocks text_count, text_replace, and text_reverse ()

Includes generators for all languages and units tests on those generators.

* Fixing combo boxes getting out-of-sync with NVDA.

Combo boxes need to be special cased like text input. Also, Escape is
a reserved button in NVDA, so I added Enter as a way to "submit and
move up a level" in addition to escape, so these boxes can be edited
while NVDA is on.

* Temporary fix for broken text field validation.

* rebuild

* Add a block to reverse a list ()

* Localisation updates from https://translatewiki.net.

* Porting math.js blocks to JSON ()

Moving all `math.js` definitions into a single JSON array, complete with i18n syntax for all messages, dropdowns, and tooltips.

Adding Blockly.Extensions.buildTooltipForDropdown(..) to facilitate the creation and error-checking of tooltips that update based on the value of a dropdown.

Now warn on raw string in JSON 'extensions'.

* Fixing JSON support for images in dropdowns. Adding tests. ()

Fixes .

* Update README.md

Add a link to our forum.

* Correcting math_change color

* Enable custom flyout categories.

* Add some safety

* Update the set of reserved words in Python to reflect the current state of Python (2.7 and 3.6). ()

* Localisation updates from https://translatewiki.net.

* .getOptions_() to .getOptions() ()

Fixes .

* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. ()

Defer tooltip message string check until after load, when all Blockly.Msg should be loaded.
Avoids validation in headless mode, due to lack of document.readyState.

* annotation updates

* annotation updates

* jsdoc corrections ()

* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes .

* 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.

* Change CSS transforms to work with older browsers ()

* Change the setting of the CSS transform properties on SVG nodes to set both the unprefixed version and the `-webkit-` prefixed version so that Blockly correctly renders in order browsers, such as Safari < 9 and iOS Safari < 9.2. For discussion of this issue, see https://groups.google.com/forum/#!topic/blockly/o3pERaRQhSg

* Correct the separation between the CSS transform property and the rest of the CSS that was in the variable misleadingly called "transform".

* Don't try to get block position in a headless workspace

* Stop bumping neighbours in headless blockly

* Place context menu correctly on touch

* Clear all active desc ids when the 'Erase Workspace' button is pressed.

* Fix a bug where splicing a block between two linked blocks disconnects the group and messes up the focus.

* Deleting a top-level block does not cause blocks after it to be deleted. Properly handle the active desc for this case.

* Localisation updates from https://translatewiki.net.

* Use the empty field placeholder for dropdowns that do not have a value selected.

* Bugfix for . I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. ()

* Adding @namespace annotations for JSDoc. ()

* Fix typo causing TypeError ()

* Pinning the angular2 dependency, and including licenses. ()

* Add skeleton for tests on rendered workspaces

* Fix some lint errors

* Localisation updates from https://translatewiki.net.

* Correct changedState in setWarningText() ()

When clearing warnings on blocks with IDs, the changedState variable should be true if the text changed. This will trigger the block being reshaped and remove the space for the notification icon (this.bumpNeighbours_).

* Adds Block.prototype.mixin() and Blockly.Extensions.registerMixin(). ()

Adds Block.prototype.mixin() and Blockly.Extensions.registerMixin().
This adds support for a common use pattern in extensions, and adds
error checking to avoid future incompatibilities.

* Porting Logic blocks to JSON ()

Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.

* Improving errors/warnings with Block.toDevString() and Connection.toString(). ()

* Add isEditable to field, and add tests

* Separate tests

* Blockly.Constants.Math and Blockly.Constants.Colour extension constants ()

Also, correcting quotes in logic.js.

* Correction to logic_ternary type check ()

* Porting Loop blocks to JSON ()

 * Improved documentation on `Blockly.Extensions.buildTooltipForDropdown`
 * Replaced incorrect uses of `@mixes` JSDoc annotation (on mixin extensions) with `@augments Blockly.Block`.
 * Added Blockly.Extensions.buildTooltipWithFieldValue() extension helper.

* Workspace isDraggable

* JSONify simple list blocks

* JSONify variable blocks

* Initial text block, with a mixin to generate quote image fields. ()

Text block now uses the extension "text_quotes", supported by Blockly.Constants.Text.QUOTE_IMAGE_MIXIN.quoteField_(fieldName), so that each platform can use the best platform appropriate image (size, density, etc.) for the quotes.

* Add no-op stub .neighbors() for headless Connection.

* Adding tests for logic_ternary block in a new jsunit test framework.

* Correcting output of the logic_null block.

* Potential bug fix for issue 

* extension controls_if => controls_if_mutator.

* Renamed extension function constant, and moved variables into the mixin.

* Dereference string table references when loading variable fields from JSON.

* Moving FieldImage string dereferencing back into Block.interpolate_() (part of jsonInit()). This sets a clear boundary of where dereferencing should happen.
Towards this, I've added message dereferencing for other field types here, as well.  I've used a pattern of field-type specific helper functions.

* Addressing comments.

* .utils.replaceMessageReferences(..) now gracefully returns non-string arguments.

* Clarification update.
Unraveling nested ternaries in Blockly.utils.tokenizeInterpolation_()

* Code correction from previous commit. Moved style to css.js and set ROUNDING=15;

* Fixing Enter so it properly propogates to dropdown selection. ()

Fixing FieldSegment so it updates dropdowns when the underlying dropdown changes.

* Localisation updates from https://translatewiki.net.

* Make variable add set/get block in context menu obey block limits

* Localisation updates from https://translatewiki.net.

* Use mutator extension for controls_if block

* Fix . Don't check for presence of constants.js

* Fix  (annotations) and an eslint issue (constant condition)

* Localisation updates from https://translatewiki.net.

* Fix : BlockFactory typo and copypasta

* Add safety checks for mutators and non-mutator extensions

* Handle mutations with both mixins and functions

* Adding warning on duplicate JSON block definition.

* period

* Make some functions private and add tests

* Localisation updates from https://translatewiki.net.

* Update help URL per .
Replace URL usages of %28 and %29 with normal parenthesis characters. (They aren't replaced by JavaScript's encodeURIComponent() function, and seem to work just fine without them.)
Added missing semicolon in build.py.

* Typo in comment.

* Make it easier to read the code that creates the variable category in the tolbox

* Adding Blockly.Xml.appendDomToWorkspace() ()

This is a copy (with additional comments) of PR  (and also ) by @qnoirhomme with unrelated files removed. See  for full review.

* Annotation fixes

* Fix bug  by explicitly grabbing focus on the workspace svg element. ()

* Potential fix for .  Stops checking whether we are mid workspace drag since we do not always get mosue up events when blockly is in an iframe. ()

* Adding new minimap demo

* Basic code style changes. Adding a few more comments. Return early if disableScrollChange in onScrollChange listener.

* `unction` to `function` corrects  ()

* Cross browser friendly fix for .  This calls blur and focus from … ()

* Cross browser friendly fix for .  This calls blur and focus from workspace.markFocused and removes the event listener on focus events.  markFocused is called from all of our mouse down handlers, which triggers the focus event leading to an infinite loop of focus.  As far as I can tell, there are no uses of the focus handler that actually did anything for us.

* Localisation updates from https://translatewiki.net.

* Another attempt to fix  to keep the page from jumping to the focused workspace in IE 11 ()

* Adding horizontal scrolling. Changed scroll change callbacks from onScroll_ to setHandlePosition. onScroll_ is not challed when workspace is dragged.

* set background color to lilac if opening the playground from file:

* Registering mousemove and mouseup listener in mousedown event. Mousemove and Mouseup events are now listening over document.

* Localisation updates from https://translatewiki.net.

* Fix  by overriding the updateWidth method in FieldImage blocks to be a no-op. FieldImage fields should not change size after the width is set in init.  The updateWidth and, therefore, getCachedWidth is now being called by BlockSvg renderFields_ (see commit d55d9cbd9f). IIUC, updateWidth/getCachedWidth was only called from render before which is overridden in FieldImage to be a no-op already. ()

* Fix 

* Localisation updates from https://translatewiki.net.

* Fix .  Looks like the original PR just forgot this block. ()

* rebuild develop ()

* Added the variable modal and component and implemented basic renaming functionality. ()

* Fixing commenting from the last commit. ()

* Localisation updates from https://translatewiki.net.

* RemoveAttribute doesn't work on SVG elements in IE 10.  Use setAttribute to null instead.

* Adding the remove variable modal and functionality to accessible Blockly. ()

* Minimap position bug fix for browsers other than chrome. Added touch support.

* Adding an add variable modal to accessible Blockly. ()

* Adding the remove variable modal and functionality to accessible Blockly.

* Adding the add variable modal for accessible Blockly.

* Block browser context menu in the toolbox and flyout

* Add links to the dev registration form and contributor guidelines

* Miscellaneous comment cleanup

* Adding the common modal class. ()

Centralizes accessible modal behavior.

* - Changed error message referencing 'procedure' instead of 'function' ()

- Added iOS specific UI messages
- Fixed bug with js_to_json.py script where it didn't recognize ' character

* - Allows use of Blockly's messaging format for category name, colour,… ()

...in toolbox XML.
- Updated code editor demo to use this message format
- Re-built blockly_compressed.js

* Making text_count use a text color (like text_length, which also returns a number). ()

* Enable google/blockly with continuous build on travis ci () ()

* create .travis for ci job

* initial checkin for blocky-web travis ci job

* rename file to .travis.yaml for typo

* remove after_script

* added cache

* rename .travis.yaml to .travis.yml

* Update .travis.yml

* include build script

* fix yaml file format issue

* debug install part

* debug build issue

* Update .travis.yml

* remove cache for now

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* more debug info

* Update .travis.yml

* Update .travis.yml

* fix typo

* installing chrome browser

* remove chrome setting config

* run build.py as part of npm install

* Update .travis.yml

* update karma dependency

* use karma as test runner

* fix typo

* remove karma test for now

* Update .travis.yml

* Update package.json

* add npm test target

* add browserstack-runner depdendency

* update browser support

* fix typo for test target

* fix chrome typo

* added closure dependency

* add google-closure-library

* include blockly_uncompressed.js and core.js dependency

* uncomment out core/*.js files

* add kama job as part of install

* remove browserstack add on for now

* fix karma config typo

* add karma-closure

* add os support

* remove typo config

* include more closure files

* change os back to linux

* use closure-library from node_modules

* change log level back to INFO

* change npm test target to use open browser command instead of karma

* change travis test target to use open command instead of karma

* list current directory

* find what's in current dir

* typo command

* Update .travis.yml

* typo again

* open right index.html

* use right path for index.html

* xdg-open to open default browser on travis

* exit browser after 5s wait

* change timeout to 1 min

* exit after opening up browser

* use browser only

* use karma

* remove un-needed dependency

* clean up script section

* fix typo

* update build status on readme

* initial commit for selenium integration tests

* update selenium jar path

* fix test_runner.js typo

* add more debug info

* check java version

* add && instead of 9288

* fix java path

* add logic to check if selenium is running or not

* add some deugging info

* initial commit to get chromedriver

* add chromedriver flag

* add get_chromedriver.sh to package.json and .travel

* change browser to chrome for now

* fix path issue

* update chromdriver path

* fix path issue again

* more debugging

* add debug msg

* fix typo

* minor fix for getting chromedriver

* install latest chrome browser

* clean up pakcage.json

* use npm target for test run

* remove removing trailing comma

* fix another trailing comma

* updated travis test target

* clean up scripts

* not sure nmp run preinstall

* redirect selenium log to tmp file

* revert writing console log to file

* update test summary

* more clean up

* minor clean up before pull request

* resolved closure-library conflict

1. add closure-library to dependencies instead of devDependencies.
2. add lint back in scripts block

* fix typo (adding comma) in script section

* Renames Blockly.workspaceDragSurface to Blockly.WorkspaceDragSurface.

Fixes .

* Ensure useDragSurface is a boolean.

Fixed 

* use pretest instead of preinstall in package.json ()

* cherry pick for pretest fix

* put pretest target to test_setup.sh

* fix conflict

* cherry pick for get_chromedriver.sh

* add some sleep to wait download to finish

* use node.js stable

* use npm test target

* field_angle renders degree symbol consistently.

Fixes 

* bumpNeighbours_ function moved to block_svg.

Fixed 

* Update RegEx in js-to-json to match windowi eol ()

The current regex only works with the "\n" line endings as it expects no characters after the optional ";" at the end of the line. In windows, if it adds the "\r" it counts as a characters and is not part of the line terminator so it doesn't match.

* Fix French translation of "colour with rgb" block ()

"colorier", which is currently used, is a verb and proposed "couleur" is
a noun: the block in question does not change colour of anything, it
creates new colour instead, thus noun is more applicable.

Also, noun is used in French translation of "random colour" block:
"couleur aléatoire".

* Enforcing non-empty names on value inputs and statement inputs. ()

* Correcting  ()

single quotes. better logic.

* Created a variable model with name, id, and type.

Created a jsunit test file for variable model.

* Change how blockly handles cursors.  The old way was quite slow becau… ()

* Change how blockly handles cursors.  The old way was quite slow because it changed the stylesheet directly.  See issue  for more details on implementation and tradeoffs.  This changes makes the following high level changes: deprecate Blockly.Css.setCursor, use built in open and closed hand cursor instead of custom .cur files, add css to draggable objects to set the open and closed hand cursors.

* Rebuild blockly_uncompressed to pick up a testing change to make travis happy.  Fix a build warning from a multi-line string in the process. ()

* Merge master into develop ()

- pick up translation changes
- clean up trailing spaces

* use goog.string.startswith instead of string.startswith ()

* New jsinterpreter demo includes wait block. Both demos have improved UI for clarity. ()

Refactor of interpreter demo
 * Renamed demos/interpreter/index.html as demos/interpreter/step-execution.html (including redirect), and added demos/interpreter/async-execution.html.
 * Refactored code to automatically generate/parse the blocks, eliminating the need for a "Parse JavaScript" button. Code is still shown in alert upon stepping to the first statement. Print statements now write to output <textarea> instead of modal dialogs.

* Fix  ()

* Fix cursor and mistaken css from merge

* Comment out broken field angle merge

* Fix broken merge with borders

* Add back original package json (woops)

* Remove render function for field angle, may not be the right way but it was broken...

* Revert merge blocking variable shadow blocks

* Add changes from built lang files

* Add back travis and readme

* Revert broken cleanup additions

* Add notes for scratch-block specific functions

* Revert change to css so blocks stay under the toolbox

* Add back accidentally removed files

* Use getFlyout_ instead of getFlyout everywhere

* Satisfy the linter

* Re-remove deprecated function

* Remove duplicated code in block_svg

* Add back flip_rtl option for images

* Remove more duplicated functions from past merges

* Fix flip_rtl code

* Revert renaming of getFlyout
2017-05-11 15:58:18 -04:00
Rachel Fenichel
c9182b97fa Add variable getter field 2017-02-22 13:49:39 -08:00
Rachel Fenichel
57c3666198 Feature/merge feb 2017 ()
* Revert "Rebuild nov 3 16"

* Move injected css to start of head

* simplification

* lint

* Remove copy/paste buttons.

* Localisation updates from https://translatewiki.net.

* Don't split dropdown text if there is an image.

* Unblock push to master.

* Revert "Revert "Rebuild nov 3 16""

This reverts commit c8ca24a000.

* rebuild

* Remove ifelse block and messages'

* Remove obsolete Gecko image hack.  Apparently this has been fixed in Gecko.

* Add correct focus behavior for the modal. Update boundary sounds.

* Disallow clicks on disabled buttons.

* add back metadata tag to qqq

* revert qqq.json

* Improve performance of block dragging.  This is a backport of the blo… ()

Improve performance of block dragging.  This is a backport of the block drag surface from scratch-blocks.  At the beginning of a block drag, blocks get moved to a drag surface which then translates using translate3d to avoid repainting the entire svg on every mouse move.  At the end of the drag, the blocks are dropped back in the svg in their new position.

* API-breaking cleanup.  But doubtful anyone will be affected. ()

* Make add/removeClass return whether they did anything.
* Move more functions onto utils.
* Move bind functions to Blockly.
* Routine recompile.

* String reference in JSON string messages ()

 * Adds message references to message string interpolation, in the form of %{BKY_STRING}.
 * Re-adding CONTROLS_IFELSE block using the new syntax, referencing to CONTROL_IF equivalents.

* Fix compiler errors.

* Break the sidebar out into its own individual component.

* Hide notification messages after a short time interval.

* Fix selection border on blocks that have been highlighted.

* controls_ifelse: Remove right-align. Remove Boolean check on statements. ()

* Move away from using a common modal service, since the block options and the toolbox modals are going to end up behaving fairly differently.

* Fix conflict between 'utils' and 'image dropdown' merges.

* Add a contextual modal for the toolbox.

* Fix some bugs arising in the toolbox modal for the no-categories case.

* Allow attaching blocks to a marked spot from the toolbox modal. This is the last prerequisite for removal of the existing on-screen toolbox.

* Delete the on-screen toolbox.

* Add warning sounds when the user reaches a boundary of the workspace.

* Stop some blocks from throwing errors in headless workspaces.

* Lint

* Fix speling.

* Fix broken highlighting when highlighted block is deleted.  Issue 752.

* When the workspace is empty, make it easy for the user to add a new group of blocks to it.

* Handle the finer points for setting focus correctly after deleting blocks from the workspace.

* When user edits text in a field, set text, not value.

Existing text-editable fields don’t care (dropdown care, but are not
text-editable).  But a note picker needs to set its value to 60 if text
is set to ‘C4’.

* Set the text not the value when closing a text editor.

Also rename variables for clarity.

* Localisation updates from https://translatewiki.net.

* Streamline the logic for block selection callbacks in the toolbox modal.

* Do not show disabled actions in the block options modal.

* Set focus correctly when toolbox modal is dismissed.

* Add information regarding target screen reader and browser.

* Rebuild Blockly.

* Remove unavailable blocks from toolbox modal. Hide unnecessary category name in a toolbox without categories.

* Do some refactoring and tidy-up. Pull some hardcoded strings out for i18n purposes; remove unused strings.

* Update config options for sidebar buttons.

* Minor refactoring. Remove unused dependencies.

* Improve styling of sidebar buttons.

* Remove clipboard functionality.

* Refactor and simplify marked spot logic.

* Change dropdowns to select fields instead of lists of buttons.

* Add ability to specify a css class for labels and buttons

* Don't make labels clickable

* console.log -> console.warn

* change 'class' to 'web-style'

* createSvgElement is now in utils.  fix two calls.

* Improve comments.

* lint

* fix missing semicolon

* When adding a new block group from the toolbox modal, only show blocks with no output connections.

* Clean up the sidebar file and remove unneeded code.

* Remove some functions from utilsService and consolidate code in workspace-tree.component.js.

* Standardize indentation.

* Remove premature focus on buttons in modal dialogs, since this prevents readout of the dialog text.

* Localisation updates from https://translatewiki.net.

* Don't get Toolbox element unless needed.

* Associate flyout button callbacks directly with workspaces

* Add colour block to the block factory base block initial state

* Start getting helpurl and tooltip in

* Generate helpURL and tooltip for Javascript block definition

* Use Tab keys instead of arrow keys for dialog boxes. Set role=alertdialog and read out the header/text automatically. Ensure that Esc key actually closes dialogs and that all keystrokes are captured.

* Add an aria-describedby to the 'create new block group...' button in the workspace to give more context.

* Fix issue with aria-liveregion not speaking. Allow sufficient time for alert noise to play before speaking the notification.

* Make zoom speed independent of event granularity

Before, touchpads would give "smoother" scrolling by delivering lots of
mousewheel events with small distance changes. Because the code only
looked at the sign of deltaY, ten 5px scrolls would zoom 10x more than
one 50px scroll.

This change makes zooming with a touchpad more like zooming with a
mousewheel. On my laptop, a full-scale zoom (fully out to fully in) was
about a 5mm finger movement before, and is now about 3cm.

Fixes .

* Split the scrollbar and flyout out into their own SVG elements. They ()

* Split the scrollbar and flyout out into their own SVG elements. They
are siblings of the workpsace SVG.  This paves the way to make performance
improvements to workspace dragging.

* remove overflow-y on the block exporter labels so scroll bars do not show upin firefox.  Also fix up the styles on the labels so that they display better in firefox. ()

* Fix  by adjusting the regex to not have \.  Still not 100% sure w… ()

* Fix  by adjusting the regex to not have \.  Still not 100% sure why that was there.
Also replaces bad names on input.  There are probably more invalid names but this is
a start.

* update generator comments

* Move the call to disable resize before placeNewBlock so that it is of… ()

* Move the call to disable resize before placeNewBlock so that it is off when workspace resizeContents
gets triggered by placeNewBlock.  This fixes a bug in rtl mode where the workspace was being resized
between when the block was added to the workspace and when it was moved to the proper location.

* Disable workspace resizing while loading the flyout from XML

* Localisation updates from https://translatewiki.net.

* Add a workspace drag surface that blocks and bubble get moved to duri… ()

* Add a workspace drag surface that blocks and bubble get moved to during a workspace drag.
The surface is translated using translate3d instead of svg's translate attribute so that
the browser does not have to repaint the entire workspace on every mouse move.
This is very similar to the block drag surface.

* Address code review comments

* add back hasClass_ utility removed in  and stop using contains since it is not supported in IE

* Fixes  by checking if getComputedStyle is null in is3dSupported.  We do not cache the value in this case and try again later. is3dSupported is only called while users are interacting with blockly which they cannot do while hidden so the performance implications of running the check again are minimal. ()

* Localisation updates from https://translatewiki.net.

* Change the Python codegen for string quoting to match the behaviour of `repr` on a string in CPython.

* Localisation updates from https://translatewiki.net.

* Add an `allInputsConnected` method to `Block` and `Workspace` to test whether all trees in the block forest have their inputs filled. An optional argument controls whether or not shadow blocks are counted as being filled. Recommitting changes off `develop` instead of `master` as per discussion in PR .

* Localisation updates from https://translatewiki.net.

* Localisation updates from https://translatewiki.net.

* Use the drag surface when scrolling using the scrollbars.  ()

* End event groups when you finish editing a field

* Fix  and make the workspace grid drag along with the workspace. ()

There was some IE specific code that also applies to Edge so just updated
a conditional to include Edge.

* Now that text input's setText skips setValue, it needs to explicitly create a change event

* Check if the text has changed before firing an event

* Init procedure blocks with empty name, and set default name in xml in Blockly.Procedures.flyoutCategory

* Routine rebuild

* Move createDom call into the constructor of block drag surface. ()

* Make cursor stay as a closed hand when dragging blocks around in the drag surface. Do this by applying the same style to text elements in the drag surface that we do in the main svg. ()

* Don't connect to blocks under the flyout.

* recompile again. ()

* Fix german translation

* Fix german translation of 'delete x blocks'

* Adding unit tests for ifelse block.

* Improvements to the generator test framework.

* <field>, <value> reorder due to load/save.

* Use the npm closure library instead of the same library installed at a parallel directory

* Fix undo/redo for FieldCheckbox

Thanks to PR  by ademenev

* PR : Adding support for string table lookups in dropdown field labels

Adding support for string table lookups in dropdown field labels specified in JSON.

Adds Blockly.utils.replaceMessageReferences() method to handle string replacement without interpolation tokens.  Effectively uses the same old code, now moved into tokenizeInterpolation_(), which takes a parseInterpolationTokens option.

Replaces the direct JavaScript references (not pure JSON, and thus not portable).

Demonstrating this behavior in the logic_boolean dropdown.

* Integrating qqq.json changes into messages.json. ()

From commits b77f8cbebc and 4ecdedec9f

* Naming changes in mirror demo

* Adding support for untranslated messages. ()

This will be used to define constants accessible in JSON block definitions. Messages with descriptions that include `{{Notranslate}}` will not be included in the translation files sent to TranslateWiki. Instead, they are written to `msg/json/constants.json`, and later merged back into the `.js` files, similar to synonyms.

Template details: https://translatewiki.net/wiki/Template:Notranslate

* JSON support for message lookup in colour, tooltip, and help URL. ()

String replacement for the colour, tooltip text and help URL attributes of JSON defined blocks.
Demonstrated in logic_boolean.

* Fixes as per code review on PR.

* Reduce number of Closure files in App Engine upload.

* Python false is False.  Issue .

* Replace 'const' with 'var'.

This unbreaks IE10 and advanced compiled apps such as Blockly Games.

* Fix bug in audioService where attached event callbacks were not being cleared properly.

* Rename workspace-tree to workspace-block.

* Minor refactoring of the modal code (add comments, guard against invalid keystrokes, etc.).

* FieldNumber & FieldAngle: Default value "0" ()

FieldNumber and FieldAngle previously accepted "undefined" as values, if not defined in JSON. This catches these and uses "0" for any NaN value.  The constructor value parameter is now optional. Includes tests.

* Remove unnecessary check when attaching a new block to a marked connection.

* Remove debug info.

* Refactor and simplify field-segment.component.js.

* Replace single quotes with double. ()

Fixes commits in .

* Adding extensions for JSON support of dynamic blocks. ()

Adding support for extensions, functions that can assist with loading blocks, much like init functions, but that can be referenced from JSON definitions. This allows JSON definitions to define dynamic blocks such as onchange handlers and mutators.

Rewrote math_number as an example pure JSON block.

* Add ability to add a class to a scrollbar so that different types of … ()

* Add ability to add a class to a scrollbar so that different types of scrollbars can
be distinguished from each other. You used to be able to do this by looking at the parent
element but now all the scrollbars are siblings in the dom.

Also, use this new class to fix  so that layering of the flyout and workspace scrollbars
are done correctly.

* JSON definitions for colour blocks ()

Replaces old colour block definitions with a Blockly.defineBlocksWithJsonArray(..) call. Generator unit tests continue to load and pass, signifying compatibility with prior block definitions.

Replaces extension 'math_number_tooltip' with the reusable 'parent_tooltip_when_inline' extension, also used by colour_picker. Includes tests.

* Rewrite tree.service.js.

- Remove unnecessary code and functions.
- Add documentation where needed.
- Fix a bug arising when a block on the workspace is attached to an existing link.

* Use setValue in fieldTextInput so that procedure renaming works

* Further cleanup and removal of unnecessary functions. Pull some strings out for i18n.

* Use bindEvent_ instead of bindEventWithChecks_ for longStop

* Clean up workspace.component.js. When moving a block from one place to another, move all blocks after it too, and adjust the active descs accordingly.

* Unit tests for JSON block definitions (just the start) ()

 * Beginnings of a JSON block definition unit test set.
 * Dispose of unit test workspaces and blocks in finally blocks.
 * Clarify JSON error message by echoing arg notation.

* New blocks text_count, text_replace, and text_reverse ()

Includes generators for all languages and units tests on those generators.

* Fixing combo boxes getting out-of-sync with NVDA.

Combo boxes need to be special cased like text input. Also, Escape is
a reserved button in NVDA, so I added Enter as a way to "submit and
move up a level" in addition to escape, so these boxes can be edited
while NVDA is on.

* Add a block to reverse a list ()

* Porting math.js blocks to JSON ()

Moving all `math.js` definitions into a single JSON array, complete with i18n syntax for all messages, dropdowns, and tooltips.

Adding Blockly.Extensions.buildTooltipForDropdown(..) to facilitate the creation and error-checking of tooltips that update based on the value of a dropdown.

Now warn on raw string in JSON 'extensions'.

* Fixing JSON support for images in dropdowns. Adding tests. ()

Fixes .

* Update README.md

Add a link to our forum.

* Correcting math_change color

* Enable custom flyout categories.

* Add some safety

* Update the set of reserved words in Python to reflect the current state of Python (2.7 and 3.6). ()

* .getOptions_() to .getOptions() ()

Fixes .

* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. ()

Defer tooltip message string check until after load, when all Blockly.Msg should be loaded.
Avoids validation in headless mode, due to lack of document.readyState.

* annotation updates

* jsdoc corrections ()

* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes .

* 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.

* Change CSS transforms to work with older browsers ()

* Change the setting of the CSS transform properties on SVG nodes to set both the unprefixed version and the `-webkit-` prefixed version so that Blockly correctly renders in order browsers, such as Safari < 9 and iOS Safari < 9.2. For discussion of this issue, see https://groups.google.com/forum/#!topic/blockly/o3pERaRQhSg

* Correct the separation between the CSS transform property and the rest of the CSS that was in the variable misleadingly called "transform".

* Don't try to get block position in a headless workspace

* Stop bumping neighbours in headless blockly

* Place context menu correctly on touch

* Clear all active desc ids when the 'Erase Workspace' button is pressed.

* Fix a bug where splicing a block between two linked blocks disconnects the group and messes up the focus.

* Deleting a top-level block does not cause blocks after it to be deleted. Properly handle the active desc for this case.

* Use the empty field placeholder for dropdowns that do not have a value selected.

* Bugfix for . I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. ()

* Adding @namespace annotations for JSDoc. ()

* Fix typo causing TypeError ()

* Pinning the angular2 dependency, and including licenses. ()

* Add skeleton for tests on rendered workspaces

* Fix some lint errors

* Correct changedState in setWarningText() ()

When clearing warnings on blocks with IDs, the changedState variable should be true if the text changed. This will trigger the block being reshaped and remove the space for the notification icon (this.bumpNeighbours_).

* Adds Block.prototype.mixin() and Blockly.Extensions.registerMixin(). ()

Adds Block.prototype.mixin() and Blockly.Extensions.registerMixin().
This adds support for a common use pattern in extensions, and adds
error checking to avoid future incompatibilities.

* Porting Logic blocks to JSON ()

Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.

* Improving errors/warnings with Block.toDevString() and Connection.toString(). ()

* Add isEditable to field, and add tests

* Separate tests

* Blockly.Constants.Math and Blockly.Constants.Colour extension constants ()

Also, correcting quotes in logic.js.

* Correction to logic_ternary type check ()

* Porting Loop blocks to JSON ()

 * Improved documentation on `Blockly.Extensions.buildTooltipForDropdown`
 * Replaced incorrect uses of `@mixes` JSDoc annotation (on mixin extensions) with `@augments Blockly.Block`.
 * Added Blockly.Extensions.buildTooltipWithFieldValue() extension helper.

* Workspace isDraggable

* JSONify simple list blocks

* JSONify variable blocks

* Initial text block, with a mixin to generate quote image fields. ()

Text block now uses the extension "text_quotes", supported by Blockly.Constants.Text.QUOTE_IMAGE_MIXIN.quoteField_(fieldName), so that each platform can use the best platform appropriate image (size, density, etc.) for the quotes.

* Add no-op stub .neighbors() for headless Connection.

* Adding tests for logic_ternary block in a new jsunit test framework.

* Correcting output of the logic_null block.

* extension controls_if => controls_if_mutator.

* Renamed extension function constant, and moved variables into the mixin.

* Dereference string table references when loading variable fields from JSON.

* Moving FieldImage string dereferencing back into Block.interpolate_() (part of jsonInit()). This sets a clear boundary of where dereferencing should happen.
Towards this, I've added message dereferencing for other field types here, as well.  I've used a pattern of field-type specific helper functions.

* Addressing comments.

* .utils.replaceMessageReferences(..) now gracefully returns non-string arguments.

* Fix a few small errors and rebuild

* Call dynamic toolbox generators correctly

* cleanup

* Fix unit tests, and delete a few that relied on completely undefined behaviour

* Fix RTL text inputs

* eslintignore more tests

* Fix insertion marker highlighting, I think

* Make getFlyout public
2017-02-21 15:09:23 -05:00
Andrew Sliwinski
be9d5fefed Merge from Upstream Blockly ()
* WIP merge from upstream google/blockly

* fixing some merging bugs. Getting the drag surface to work, updating some function calls, etc.

* make the trash can lid animate again and fix the cursor to show an x when things will be removed.

* Fix text rendering logic in fields

* Hand apply some more changes from blockly flyout.js to flyout_base.js.

Also revert 08efd1381c
in scratch-blocks since it breaks variables and there is more work fenichel is planning
to do here.

* Fix drop-down field rendering

* Resolve issue with text input field widths on init

* Remove unused blockly (built) files

* Remove unused language files

* Resolve lint issues and rebuild

* Add blockly build targets to cleanup script

* Return 0 if 'this.arrow_' does not exist in a dropdown field

* Remove unused / irrelevant comments
2017-02-02 14:17:43 -05:00
Rachel Fenichel
41fc324aee lint 2016-11-02 13:56:27 -07:00
Rachel Fenichel
a3839b52ad Merge branch 'develop' of https://github.com/google/blockly into feature/merge_nov_1 2016-11-01 18:02:37 -07:00
Rachel Fenichel
844b7771e2 Merge branch 'develop' of https://github.com/google/blockly into feature/merge_nov_1 2016-11-01 18:00:26 -07:00
Andrew n marshall
52ffc64f6a Refactor variable rename to handle UI actions more directly. ()
FieldDropdown now has onItemSelected(..) method to handle the menu item selection action. Variable renames and deletes are now handled here, instead of during validation.

Also fixes an issue deleting variables used by less than two blocks.

Fixes .
2016-11-01 16:32:10 -07:00
rachel-fenichel
ed9453cfb5 fix some annotations 2016-10-21 17:38:57 -07:00
rachel-fenichel
3d53b1e7fb Fix annotation 2016-10-21 17:34:59 -07:00
Andrew n marshall
81499e4392 Merge pull request from AnmAtAnm/alert-confirm-prompt
Adding hooks to support custom alert, confirm, and prompt dialogs
2016-10-20 17:20:00 -07:00
Andrew n marshall
8f3b4bcb5e Replaces calls to window.alert(), window.confirm(), and window.prompt() with Blockly.alert(), Blockly.confirm(), and Blockly.prompt(). These are designed to allow app developers to replace the dialogs with versions that match their own open app, possibly avoiding modal browser dialogs. They each take a callback, so the developer has the opportunity to implement non-modal behavior. 2016-10-20 16:30:40 -07:00
Tim Mickel
f318d6a7ea Tweaks for clicking blocks in toolbox ()
* Make a copy of listeners (fix ), allow ID lookup in flyout

* Move flyout cursor change to when block drags

* Fire a stack-click event in flyout, to match workspace
2016-10-13 17:09:41 -04:00
Chris Johnson
832df810c1 Stops duplicating on rename of old ID to old ID. 2016-10-09 13:11:21 -05:00
Shannon McCabe
f7bbaaa82d JSDoc format fixes 2016-10-07 14:30:14 -07:00
Neil Fraser
bd4c6d096f Use goog.array.remove 2016-10-04 21:20:07 -07:00
Tim Mickel
dec82e2551 Hide DropDownDivs and WidgetDivs on workspace clear () 2016-09-28 16:41:35 -04:00
Tim Mickel
a6f34ae519 Merge google/develop, recompile ()
* Check result of window.confirm before deleting variables.

* Create CONTRIBUTING.md

* Localisation updates from https://translatewiki.net.

* Cherrypick fixes made directly to master back into develop ()

* Check result of window.confirm before deleting variables.

* Create CONTRIBUTING.md

* rebuild

* Localisation updates from https://translatewiki.net.

* Minor wording change.

* Localisation updates from https://translatewiki.net.

* Localisation updates from https://translatewiki.net.

* Simplify the handling of the active desc for a toolbox without categories.

* Remove tables from the HTML. Move the toolbar buttons to the end so that they don't impede switching between the toolbox and workspace.

* When cutting or copying a block, do not include blocks joined to it.

* Add shadow to flyout buttons.

* Move 'create new group' button to the bottom of each toolbox block, and remove other buttons if there is nothing in the workspace.

* Add keyboard shortcuts for cut, copy and paste operations.

* Remove clipboard buttons to simplify UI.

* Prevent setting a number value to NaN. Select the field value on entry to an input field. State the contents of the input field when describing the field.

* Add aria-level and aria-selected attrs to dropdowns.

* routine recompile

* Update demo to latest interpreter.

* Move 'move to marked spot' button to the top of the block options list.

* Fix incorrect aria-levels in toolbox tree component.

* Add new fields to toolbarButtonConfig.

* Recompile

* Remove CONTRIBUTING
2016-09-22 16:39:52 -04:00
picklesrus
dab7fd5751 Cherrypick fixes made directly to master back into develop ()
* Check result of window.confirm before deleting variables.

* Create CONTRIBUTING.md
2016-09-07 11:50:50 -07:00
Rachel Fenichel
a979a422e4 Merge branch 'develop' of https://github.com/google/blockly into merge_sept_01 2016-09-01 16:52:08 -07:00
Tim Mickel
f1aac859e3 Stripping old blocks code; moving blocks -> blocks_common, project-wide lint ()
* Remove unused Blockly blocks

* Remove unused text Blockly blocks; convert to JSON

* Move blocks/ -> blocks_common/

* Recompile for moved/removed blocks

* Remove spectools

* Project-wide lint

* Recompile August 30

* Pin package.json
2016-08-30 15:50:59 -04:00
Rachel Fenichel
d2ce081dc4 Move functions for updating variables on a workspace into workspace.js, and some lint 2016-08-17 16:07:50 -07:00
Rachel Fenichel
dfe61087f0 Correctly update variable list when pasting code 2016-07-14 15:39:41 -07:00
Rachel Fenichel
acbb456f0a Update variable list when copying in new blocks 2016-07-13 16:46:27 -07:00
Rachel Fenichel
18be9d1de8 Merge branch 'feature/variable_management' of https://github.com/google/blockly into feature/variable_management 2016-07-13 14:36:35 -07:00