2014-12-23 11:22:02 -08:00
|
|
|
/**
|
|
|
|
* @license
|
|
|
|
* Visual Blocks Editor
|
|
|
|
*
|
|
|
|
* Copyright 2014 Google Inc.
|
|
|
|
* https://developers.google.com/blockly/
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @fileoverview Object representing a workspace rendered as SVG.
|
|
|
|
* @author fraser@google.com (Neil Fraser)
|
|
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
goog.provide('Blockly.WorkspaceSvg');
|
|
|
|
|
|
|
|
// TODO(scr): Fix circular dependencies
|
Merge google/develop June 22 (#441)
* Localisation updates from https://translatewiki.net.
* test page that creates random blocks and randomly drags them around the page
* Localisation updates from https://translatewiki.net.
* add missing return in fake drag
* get rid of drag_tests file:
* Generated JS helper functions should be camelCase.
Complying with Google style guide.
* Localisation updates from https://translatewiki.net.
* Fix extra category error. Clean up code, rename variables, reduce line lengths, fix lint issues.
* Remove claim that good.string.quote should be used.
* Change the blockly workspace resizing strategy. (#386)
* Add a new method to be called when the contents of the workspace change and
the scrollbars need to be adjusted but the the chrome (trash, toolbox, etc)
are expected to stay in the same place.
Change a bunch of calls to svgResize to either be removed or call the new
method instead. This is a nice performance win since the offsetHeight/Width
call in svgResize can be expensive, especially when called as often as we do -
there was some layout thrashing.
This also paves the way for moving calls to recordDeleteAreas
(which is also expensive) to a more cacheable spot than on every
mouse down/touch event.
of things (namely the scrollbars)
* Fix size of graph demo when it first loads by calling svgResize.
The graph starts with fixed width and was relying on a resize event
to fire (which I believe was removed in commit
217c681b86b0f2df76c479c9efae62e6e).
* Fix the resizing of the code demo. The demo's tab min-width used to
match the toolbox's width was only being set on a resize event, but
commit 217c681b86b0f2df76c479c9efae62e6e changed how that worked.
* Fix up some comments.
* Use specific workspaces rather than Blockly.getMainWorkspace().
* Make workspace required for resizeSvgContents and update
some calls to send real workspaces rather than ones that are
null.
Remove the private tag on terminateDrag_ because it is only
actually called from outside the BlockSvg object.
* Remove a rogue period.
* Recategorize BlockSvg.terminateDrag_ to @package instead of @private so that
other developers don't use it, but it still can be used by other Blockly classes.
* Add a TODO to fix issue #307.
* Add @package to workspace resizeContents.
* Routine recompile
* Fix unit tests.
* Fix inheritance on rendered connection.
Closure compiler on maximum compression breaks badly due to lack of
@extends attribute.
* Add toolbox location and toolbox mode options to playground.
* Increase commonality between playgrounds.
* Properly deal with shadow statement blocks in stacks.
* Localisation updates from https://translatewiki.net.
* Use a comment block for function comments in generated JS, Python and Dart.
* Fix typo in flyout.js (#403)
* Fix typo in flyout.js (#402)
* Line wrap comments in generated code.
* Remove reference to undefined variable (#413)
REASON_MUST_DISCONNECT was removed by a refactor in 2a1ffa1.
* Fix airstrike by grabbing the correct toolbox element. (#411)
Probably broken in 266e2ffa9a017d21d7ca2f151730d6ecfcecf173.
* Localisation updates from https://translatewiki.net.
* Fix issue #406 by calling resize from the keypress handler on text inputs. (#408)
* Remove shadow blocks from Accessible Blockly demo. Update README.
* Generate for loops on one line.
* Introduce a common translation pipe; remove local stringMap attributes. Fix variable name error in paste functions. Minor linting.
* Fix precedence on isIndex blocks.
* Add indexing setting for JavaScript Generation (#419)
Adding setting to allow for switching between zero and one based indexing for Blockly Blocks such that the generated code will use this flag to determine whether one based or zero based indexing should be used. One based indexing is enabled by default.
* Remove unused functions and dependencies.
* Remove the unnecessary construction of new services.
* Fix sort block in JS to satisfy tests.
* Trigger a contents resize in block's moveBy. (#422)
This fixes #420 but and it also fixes some other similar problems
with copy/paste and other users of moveBy.
* Consolidate the usages of the 'blockly-disabled' label.
* Fix error when undoing a shadow block replacement. Issue #415.
* Unify setActiveDesc() and updateSelectedNode() in the TreeService. Move function calls made directly within the template to the correct hooks.
* Standardize naming of components.
* Prevent collisions between user functions and helper functions.
* Localisation updates from https://translatewiki.net.
* Fix #425. Attash the resize handler to the workspace so it can be removed (#429)
when workspace.dispose() is called.
* Change the TreeService to a singleton.
* Remove unneeded generated parens around function calls in indexOf blocks.
* Fix #423 by calling workspace's resize when the flyout reflows. (#430)
* Updating URLs to reflect new docs. (#418)
* Updating URLs to reflect new docs. Removing -blockly in URLs.
* Rebuilt.
* Routine recompile
* Prevent selected block from ending up underneath a bumped block.
* Fix undo on fields with validators with side effects.
* Don't fire change event on fields that haven't been named yet.
* Localisation updates from https://translatewiki.net.
* Fix tree focus issues.
* Fix remaining focus issues on block deletion.
* cache delete areas instead of recalculating them onMouseDown
* Cache screen CTM for performance improvement.
* Call svgResizeContents from block_svg's dipose so that deleting blocks (#434)
from the context menu (or anywhere really) causes the workspace to
recalculate its size.
Remove the call to svgResizeContents from onMouseUp's logic for
determining whether the block is being dropped in the trash
since it calls dispose.
One side effect of this is that when you delete multiple blocks
resize gets called for each of them and the scrollbars move during
the operation. This is most obviously seen by doing an airstrike
in the playground and then deleting all the blocks at once.
* Allow terminal blocks to replace other terminal blocks (#433)
* Allow terminal blocks to replace other terminal blocks
* Updated test to allow replacing terminal blocks
* Refactor how activeDescendant is set. Introduce helper functions to ensure that calls like pasteAbove() preserve the focus.
* Localisation updates from https://translatewiki.net.
* Remove unnecessary logging.
* Reduce unneeded parentheses in JS and Python.
* Start using field_number.
* Make it easy to disable unconnected blocks.
* Routine recompile.
* Check if matrix is null in mouseToSvg
* Remove js/ localizations pre-merge
* Fix change to block_render_svg
* Fix error in xml.js
* Playground merge
* Add simple toolboxes to playgrounds
* Fix flyout reference in events listener
* Move tokenizeIntepolation into Blockly.utils namespace.
* Use simpler message interpolation in Code demo.
* Create console stub for IE 9.
* Don't output blockId if not set (e.g., toolbox category event). (#443)
* Fix block in multi-playground
* Increase commonality between playgrounds.
# Conflicts:
# tests/multi_playground.html
# tests/playground.html
* Remove "show flyouts" button
* Recompile for merge June 22
2016-06-22 17:50:16 -04:00
|
|
|
//goog.require('Blockly.BlockSvg');
|
2016-07-07 18:35:41 -04:00
|
|
|
goog.require('Blockly.Colours');
|
2016-03-10 15:23:15 -08:00
|
|
|
goog.require('Blockly.ConnectionDB');
|
2016-08-25 13:28:05 -07:00
|
|
|
goog.require('Blockly.constants');
|
2017-07-06 18:00:33 -07:00
|
|
|
goog.require('Blockly.DataCategory');
|
2016-07-07 18:35:41 -04:00
|
|
|
goog.require('Blockly.DropDownDiv');
|
2018-05-09 13:34:21 -07:00
|
|
|
goog.require('Blockly.Events.BlockCreate');
|
2017-05-22 13:08:22 -07:00
|
|
|
goog.require('Blockly.Gesture');
|
Merge/05 24 (#903)
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Localisation updates from https://translatewiki.net.
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* Localisation updates from https://translatewiki.net.
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Localisation updates from https://translatewiki.net.
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 #661
* 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. (#934)
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 #946. Don't check for presence of constants.js
* Fix #945 (annotations) and an eslint issue (constant condition)
* Localisation updates from https://translatewiki.net.
* Fix #950: 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 #937.
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() (#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.
* Annotation fixes
* Fix bug #904 by explicitly grabbing focus on the workspace svg element. (#964)
* Potential fix for #888. Stops checking whether we are mid workspace drag since we do not always get mosue up events when blockly is in an iframe. (#899)
* Adding new minimap demo
* Basic code style changes. Adding a few more comments. Return early if disableScrollChange in onScrollChange listener.
* `unction` to `function` corrects #962 (#970)
* Cross browser friendly fix for #904. This calls blur and focus from … (#972)
* Cross browser friendly fix for #904. 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 #904 to keep the page from jumping to the focused workspace in IE 11 (#974)
* 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 #967 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 d55d9cbd9ff308ff5e361cf77acabb61a4bf4695). IIUC, updateWidth/getCachedWidth was only called from render before which is overridden in FieldImage to be a no-op already. (#979)
* Fix #969
* Localisation updates from https://translatewiki.net.
* Fix #986. Looks like the original PR just forgot this block. (#992)
* rebuild develop (#996)
* Added the variable modal and component and implemented basic renaming functionality. (#991)
* Fixing commenting from the last commit. (#1000)
* 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. (#1011)
* Minimap position bug fix for browsers other than chrome. Added touch support.
* Adding an add variable modal to accessible Blockly. (#1015)
* 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. (#1017)
Centralizes accessible modal behavior.
* - Changed error message referencing 'procedure' instead of 'function' (#1019)
- 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,… (#1028)
...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). (#1027)
* Enable google/blockly with continuous build on travis ci (#1023) (#1035)
* 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 #880.
* Ensure useDragSurface is a boolean.
Fixed #988
* use pretest instead of preinstall in package.json (#1043)
* 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 #973
* bumpNeighbours_ function moved to block_svg.
Fixed #1009
* Update RegEx in js-to-json to match windowi eol (#1050)
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 (#1053)
"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. (#1054)
* Correcting #1054 (#1056)
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… (#1057)
* Change how blockly handles cursors. The old way was quite slow because it changed the stylesheet directly. See issue #981 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. (#1059)
* Merge master into develop (#1063)
- pick up translation changes
- clean up trailing spaces
* use goog.string.startswith instead of string.startswith (#1065)
* New jsinterpreter demo includes wait block. Both demos have improved UI for clarity. (#1001)
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 #1069 (#1073)
* VariableMap and functions added.
* Fix #1051 (#1084)
* Improve errors when validating JSON block definitions. (#1086)
goog.asserts to not run from blockly_compressed.js. User data validation should always run.
* Dragging changes, rebased on develop (#1078)
* 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 (#1026)
-- 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 (#1048)
- Removed gestureDB
- Removing uses of terminateDrag
- Cleaned up disposal code
* Dragging bugfixes (#1058)
- 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 (#1060)
* 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. (#1081)
* add osx travis test run job (#1074)
* Names are correctly fetched from VariableModels!
* add more wait time for test setup (#1091)
* Work around timing issue with travis osx issue (#1092)
* add more wait time for test setup
* increase selenium wait time
* add more wait
* Fix #1077 by adding a rule to cover the toolbox labels too. (#1099)
* Assign variable UUID to field_variable dropdown.
* Change registration link to a static one (#1106)
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 (#1111)
* Click events on shadow blocks have the correct id (#1089)
* Add image_onclick option (#1080)
* Cleanup: semicolons, spacing, etc. (#1116)
* Spelling. Spelling is hard.
* Add variable info to xml generated in variables.js
* Add missing CLAs info to the contributing file (#1119)
* Add missing CLAs info to the contributing file
* Added larger changes paragraph
* Replacing latest prettifier hosted in repo with latest version at rawgit CDN. (#1120)
* Forgot update code demo (#1121)
* Move audio code to a new file (#1122)
* 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 (#1126)
* Include variables at top of serialization.
* Move blockSvg.getHeightWidth to block_render_svg.js (#1118)
* Deserialization variables at top.
* Create grid object (#1131)
* 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
|
|
|
goog.require('Blockly.Grid');
|
2016-04-07 13:38:36 -07:00
|
|
|
goog.require('Blockly.Options');
|
2018-04-30 15:55:31 -07:00
|
|
|
goog.require('Blockly.scratchBlocksUtils');
|
2014-12-23 11:22:02 -08:00
|
|
|
goog.require('Blockly.ScrollbarPair');
|
2016-09-07 18:10:25 -07:00
|
|
|
goog.require('Blockly.Touch');
|
2014-12-23 11:22:02 -08:00
|
|
|
goog.require('Blockly.Trashcan');
|
2016-09-08 16:54:10 -07:00
|
|
|
//goog.require('Blockly.VerticalFlyout');
|
2014-12-23 11:22:02 -08:00
|
|
|
goog.require('Blockly.Workspace');
|
Merge/05 24 (#903)
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Localisation updates from https://translatewiki.net.
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* Localisation updates from https://translatewiki.net.
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Localisation updates from https://translatewiki.net.
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 #661
* 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. (#934)
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 #946. Don't check for presence of constants.js
* Fix #945 (annotations) and an eslint issue (constant condition)
* Localisation updates from https://translatewiki.net.
* Fix #950: 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 #937.
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() (#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.
* Annotation fixes
* Fix bug #904 by explicitly grabbing focus on the workspace svg element. (#964)
* Potential fix for #888. Stops checking whether we are mid workspace drag since we do not always get mosue up events when blockly is in an iframe. (#899)
* Adding new minimap demo
* Basic code style changes. Adding a few more comments. Return early if disableScrollChange in onScrollChange listener.
* `unction` to `function` corrects #962 (#970)
* Cross browser friendly fix for #904. This calls blur and focus from … (#972)
* Cross browser friendly fix for #904. 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 #904 to keep the page from jumping to the focused workspace in IE 11 (#974)
* 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 #967 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 d55d9cbd9ff308ff5e361cf77acabb61a4bf4695). IIUC, updateWidth/getCachedWidth was only called from render before which is overridden in FieldImage to be a no-op already. (#979)
* Fix #969
* Localisation updates from https://translatewiki.net.
* Fix #986. Looks like the original PR just forgot this block. (#992)
* rebuild develop (#996)
* Added the variable modal and component and implemented basic renaming functionality. (#991)
* Fixing commenting from the last commit. (#1000)
* 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. (#1011)
* Minimap position bug fix for browsers other than chrome. Added touch support.
* Adding an add variable modal to accessible Blockly. (#1015)
* 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. (#1017)
Centralizes accessible modal behavior.
* - Changed error message referencing 'procedure' instead of 'function' (#1019)
- 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,… (#1028)
...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). (#1027)
* Enable google/blockly with continuous build on travis ci (#1023) (#1035)
* 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 #880.
* Ensure useDragSurface is a boolean.
Fixed #988
* use pretest instead of preinstall in package.json (#1043)
* 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 #973
* bumpNeighbours_ function moved to block_svg.
Fixed #1009
* Update RegEx in js-to-json to match windowi eol (#1050)
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 (#1053)
"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. (#1054)
* Correcting #1054 (#1056)
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… (#1057)
* Change how blockly handles cursors. The old way was quite slow because it changed the stylesheet directly. See issue #981 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. (#1059)
* Merge master into develop (#1063)
- pick up translation changes
- clean up trailing spaces
* use goog.string.startswith instead of string.startswith (#1065)
* New jsinterpreter demo includes wait block. Both demos have improved UI for clarity. (#1001)
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 #1069 (#1073)
* VariableMap and functions added.
* Fix #1051 (#1084)
* Improve errors when validating JSON block definitions. (#1086)
goog.asserts to not run from blockly_compressed.js. User data validation should always run.
* Dragging changes, rebased on develop (#1078)
* 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 (#1026)
-- 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 (#1048)
- Removed gestureDB
- Removing uses of terminateDrag
- Cleaned up disposal code
* Dragging bugfixes (#1058)
- 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 (#1060)
* 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. (#1081)
* add osx travis test run job (#1074)
* Names are correctly fetched from VariableModels!
* add more wait time for test setup (#1091)
* Work around timing issue with travis osx issue (#1092)
* add more wait time for test setup
* increase selenium wait time
* add more wait
* Fix #1077 by adding a rule to cover the toolbox labels too. (#1099)
* Assign variable UUID to field_variable dropdown.
* Change registration link to a static one (#1106)
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 (#1111)
* Click events on shadow blocks have the correct id (#1089)
* Add image_onclick option (#1080)
* Cleanup: semicolons, spacing, etc. (#1116)
* Spelling. Spelling is hard.
* Add variable info to xml generated in variables.js
* Add missing CLAs info to the contributing file (#1119)
* Add missing CLAs info to the contributing file
* Added larger changes paragraph
* Replacing latest prettifier hosted in repo with latest version at rawgit CDN. (#1120)
* Forgot update code demo (#1121)
* Move audio code to a new file (#1122)
* 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 (#1126)
* Include variables at top of serialization.
* Move blockSvg.getHeightWidth to block_render_svg.js (#1118)
* Deserialization variables at top.
* Create grid object (#1131)
* 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
|
|
|
goog.require('Blockly.WorkspaceAudio');
|
2018-05-11 16:35:31 -07:00
|
|
|
goog.require('Blockly.WorkspaceComment');
|
|
|
|
goog.require('Blockly.WorkspaceCommentSvg');
|
2018-05-21 11:35:31 -04:00
|
|
|
goog.require('Blockly.WorkspaceCommentSvg.render');
|
2017-02-02 14:17:43 -05:00
|
|
|
goog.require('Blockly.WorkspaceDragSurfaceSvg');
|
2014-12-23 11:22:02 -08:00
|
|
|
goog.require('Blockly.Xml');
|
2016-03-18 15:19:26 -07:00
|
|
|
goog.require('Blockly.ZoomControls');
|
2015-04-28 13:51:25 -07:00
|
|
|
|
2016-10-26 18:39:56 -07:00
|
|
|
goog.require('goog.array');
|
2015-02-06 15:27:25 -08:00
|
|
|
goog.require('goog.dom');
|
2014-12-23 11:22:02 -08:00
|
|
|
goog.require('goog.math.Coordinate');
|
2015-04-28 13:51:25 -07:00
|
|
|
goog.require('goog.userAgent');
|
2018-02-16 17:32:13 -05:00
|
|
|
goog.require('goog.math.Rect');
|
2014-12-23 11:22:02 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class for a workspace. This is an onscreen area with optional trashcan,
|
|
|
|
* scrollbars, bubbles, and dragging.
|
2016-03-29 14:26:56 -07:00
|
|
|
* @param {!Blockly.Options} options Dictionary of options.
|
2017-02-02 14:17:43 -05:00
|
|
|
* @param {Blockly.BlockDragSurfaceSvg=} opt_blockDragSurface Drag surface for
|
|
|
|
* blocks.
|
Merge google/blockly, May 2017 (#881)
* Move createDom call into the constructor of block drag surface. (#790)
* 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. (#805)
* Don't connect to blocks under the flyout.
* recompile again. (#806)
* 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 #813 by ademenev
* Localisation updates from https://translatewiki.net.
* PR #818: 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. (#820)
From commits b77f8cbebc5cef247116d3df6a428df8addbe53d and 4ecdedec9f8a69f78abf246e7a5db1e1a0be6b85
* Naming changes in mirror demo
* Adding support for untranslated messages. (#819)
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. (#825)
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 #828.
* 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" (#832)
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. (#836)
Fixes commits in #832.
* Adding extensions for JSON support of dynamic blocks. (#834)
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 … (#837)
* 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 #816 so that layering of the flyout and workspace scrollbars
are done correctly.
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Localisation updates from https://translatewiki.net.
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* Localisation updates from https://translatewiki.net.
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Localisation updates from https://translatewiki.net.
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 #661
* 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. (#934)
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 #946. Don't check for presence of constants.js
* Fix #945 (annotations) and an eslint issue (constant condition)
* Localisation updates from https://translatewiki.net.
* Fix #950: 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 #937.
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() (#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.
* Annotation fixes
* Fix bug #904 by explicitly grabbing focus on the workspace svg element. (#964)
* Potential fix for #888. Stops checking whether we are mid workspace drag since we do not always get mosue up events when blockly is in an iframe. (#899)
* Adding new minimap demo
* Basic code style changes. Adding a few more comments. Return early if disableScrollChange in onScrollChange listener.
* `unction` to `function` corrects #962 (#970)
* Cross browser friendly fix for #904. This calls blur and focus from … (#972)
* Cross browser friendly fix for #904. 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 #904 to keep the page from jumping to the focused workspace in IE 11 (#974)
* 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 #967 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 d55d9cbd9ff308ff5e361cf77acabb61a4bf4695). IIUC, updateWidth/getCachedWidth was only called from render before which is overridden in FieldImage to be a no-op already. (#979)
* Fix #969
* Localisation updates from https://translatewiki.net.
* Fix #986. Looks like the original PR just forgot this block. (#992)
* rebuild develop (#996)
* Added the variable modal and component and implemented basic renaming functionality. (#991)
* Fixing commenting from the last commit. (#1000)
* 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. (#1011)
* Minimap position bug fix for browsers other than chrome. Added touch support.
* Adding an add variable modal to accessible Blockly. (#1015)
* 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. (#1017)
Centralizes accessible modal behavior.
* - Changed error message referencing 'procedure' instead of 'function' (#1019)
- 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,… (#1028)
...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). (#1027)
* Enable google/blockly with continuous build on travis ci (#1023) (#1035)
* 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 #880.
* Ensure useDragSurface is a boolean.
Fixed #988
* use pretest instead of preinstall in package.json (#1043)
* 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 #973
* bumpNeighbours_ function moved to block_svg.
Fixed #1009
* Update RegEx in js-to-json to match windowi eol (#1050)
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 (#1053)
"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. (#1054)
* Correcting #1054 (#1056)
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… (#1057)
* Change how blockly handles cursors. The old way was quite slow because it changed the stylesheet directly. See issue #981 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. (#1059)
* Merge master into develop (#1063)
- pick up translation changes
- clean up trailing spaces
* use goog.string.startswith instead of string.startswith (#1065)
* New jsinterpreter demo includes wait block. Both demos have improved UI for clarity. (#1001)
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 #1069 (#1073)
* 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
|
|
|
* @param {Blockly.WorkspaceDragSurfaceSvg=} opt_wsDragSurface Drag surface for
|
2017-02-02 14:17:43 -05:00
|
|
|
* the workspace.
|
2014-12-23 11:22:02 -08:00
|
|
|
* @extends {Blockly.Workspace}
|
|
|
|
* @constructor
|
|
|
|
*/
|
2017-02-02 14:17:43 -05:00
|
|
|
Blockly.WorkspaceSvg = function(options, opt_blockDragSurface, opt_wsDragSurface) {
|
2015-04-28 13:51:25 -07:00
|
|
|
Blockly.WorkspaceSvg.superClass_.constructor.call(this, options);
|
2016-08-19 14:13:20 -07:00
|
|
|
this.getMetrics =
|
|
|
|
options.getMetrics || Blockly.WorkspaceSvg.getTopLevelWorkspaceMetrics_;
|
|
|
|
this.setMetrics =
|
|
|
|
options.setMetrics || Blockly.WorkspaceSvg.setTopLevelWorkspaceMetrics_;
|
2014-12-23 11:22:02 -08:00
|
|
|
|
2016-04-26 13:09:11 -04:00
|
|
|
Blockly.ConnectionDB.init(this);
|
Merge google/blockly, May 2017 (#881)
* Move createDom call into the constructor of block drag surface. (#790)
* 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. (#805)
* Don't connect to blocks under the flyout.
* recompile again. (#806)
* 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 #813 by ademenev
* Localisation updates from https://translatewiki.net.
* PR #818: 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. (#820)
From commits b77f8cbebc5cef247116d3df6a428df8addbe53d and 4ecdedec9f8a69f78abf246e7a5db1e1a0be6b85
* Naming changes in mirror demo
* Adding support for untranslated messages. (#819)
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. (#825)
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 #828.
* 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" (#832)
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. (#836)
Fixes commits in #832.
* Adding extensions for JSON support of dynamic blocks. (#834)
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 … (#837)
* 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 #816 so that layering of the flyout and workspace scrollbars
are done correctly.
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Localisation updates from https://translatewiki.net.
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* Localisation updates from https://translatewiki.net.
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Localisation updates from https://translatewiki.net.
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 #661
* 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. (#934)
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 #946. Don't check for presence of constants.js
* Fix #945 (annotations) and an eslint issue (constant condition)
* Localisation updates from https://translatewiki.net.
* Fix #950: 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 #937.
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() (#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.
* Annotation fixes
* Fix bug #904 by explicitly grabbing focus on the workspace svg element. (#964)
* Potential fix for #888. Stops checking whether we are mid workspace drag since we do not always get mosue up events when blockly is in an iframe. (#899)
* Adding new minimap demo
* Basic code style changes. Adding a few more comments. Return early if disableScrollChange in onScrollChange listener.
* `unction` to `function` corrects #962 (#970)
* Cross browser friendly fix for #904. This calls blur and focus from … (#972)
* Cross browser friendly fix for #904. 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 #904 to keep the page from jumping to the focused workspace in IE 11 (#974)
* 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 #967 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 d55d9cbd9ff308ff5e361cf77acabb61a4bf4695). IIUC, updateWidth/getCachedWidth was only called from render before which is overridden in FieldImage to be a no-op already. (#979)
* Fix #969
* Localisation updates from https://translatewiki.net.
* Fix #986. Looks like the original PR just forgot this block. (#992)
* rebuild develop (#996)
* Added the variable modal and component and implemented basic renaming functionality. (#991)
* Fixing commenting from the last commit. (#1000)
* 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. (#1011)
* Minimap position bug fix for browsers other than chrome. Added touch support.
* Adding an add variable modal to accessible Blockly. (#1015)
* 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. (#1017)
Centralizes accessible modal behavior.
* - Changed error message referencing 'procedure' instead of 'function' (#1019)
- 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,… (#1028)
...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). (#1027)
* Enable google/blockly with continuous build on travis ci (#1023) (#1035)
* 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 #880.
* Ensure useDragSurface is a boolean.
Fixed #988
* use pretest instead of preinstall in package.json (#1043)
* 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 #973
* bumpNeighbours_ function moved to block_svg.
Fixed #1009
* Update RegEx in js-to-json to match windowi eol (#1050)
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 (#1053)
"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. (#1054)
* Correcting #1054 (#1056)
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… (#1057)
* Change how blockly handles cursors. The old way was quite slow because it changed the stylesheet directly. See issue #981 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. (#1059)
* Merge master into develop (#1063)
- pick up translation changes
- clean up trailing spaces
* use goog.string.startswith instead of string.startswith (#1065)
* New jsinterpreter demo includes wait block. Both demos have improved UI for clarity. (#1001)
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 #1069 (#1073)
* 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
|
|
|
|
|
|
|
if (opt_blockDragSurface) {
|
|
|
|
this.blockDragSurface_ = opt_blockDragSurface;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (opt_wsDragSurface) {
|
|
|
|
this.workspaceDragSurface_ = opt_wsDragSurface;
|
|
|
|
}
|
|
|
|
|
2017-02-02 14:17:43 -05:00
|
|
|
this.useWorkspaceDragSurface_ =
|
|
|
|
this.workspaceDragSurface_ && Blockly.utils.is3dSupported();
|
|
|
|
|
2016-10-26 18:39:56 -07:00
|
|
|
/**
|
2017-02-02 14:17:43 -05:00
|
|
|
* List of currently highlighted blocks. Block highlighting is often used to
|
|
|
|
* visually mark blocks currently being executed.
|
2016-10-26 18:39:56 -07:00
|
|
|
* @type !Array.<!Blockly.BlockSvg>
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
this.highlightedBlocks_ = [];
|
Feature/merge feb 2017 (#791)
* 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 c8ca24a0007b70e137417e843459c87185141a55.
* 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… (#732)
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. (#748)
* 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 (#741)
* 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. (#749)
* 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 #758.
* Split the scrollbar and flyout out into their own SVG elements. They (#771)
* 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. (#699)
* Fix #698 by adjusting the regex to not have \. Still not 100% sure w… (#700)
* Fix #698 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… (#777)
* 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… (#778)
* 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 #748 and stop using contains since it is not supported in IE
* Fixes #786 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. (#787)
* 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 #791.
* Localisation updates from https://translatewiki.net.
* Localisation updates from https://translatewiki.net.
* Use the drag surface when scrolling using the scrollbars. #783 (#789)
* End event groups when you finish editing a field
* Fix #794 and make the workspace grid drag along with the workspace. (#801)
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. (#790)
* 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. (#805)
* Don't connect to blocks under the flyout.
* recompile again. (#806)
* 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 #813 by ademenev
* PR #818: 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. (#820)
From commits b77f8cbebc5cef247116d3df6a428df8addbe53d and 4ecdedec9f8a69f78abf246e7a5db1e1a0be6b85
* Naming changes in mirror demo
* Adding support for untranslated messages. (#819)
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. (#825)
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 #828.
* 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" (#832)
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. (#836)
Fixes commits in #832.
* Adding extensions for JSON support of dynamic blocks. (#834)
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 … (#837)
* 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 #816 so that layering of the flyout and workspace scrollbars
are done correctly.
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 12:09:23 -08:00
|
|
|
|
Merge/05 24 (#903)
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Localisation updates from https://translatewiki.net.
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* Localisation updates from https://translatewiki.net.
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Localisation updates from https://translatewiki.net.
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 #661
* 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. (#934)
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 #946. Don't check for presence of constants.js
* Fix #945 (annotations) and an eslint issue (constant condition)
* Localisation updates from https://translatewiki.net.
* Fix #950: 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 #937.
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() (#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.
* Annotation fixes
* Fix bug #904 by explicitly grabbing focus on the workspace svg element. (#964)
* Potential fix for #888. Stops checking whether we are mid workspace drag since we do not always get mosue up events when blockly is in an iframe. (#899)
* Adding new minimap demo
* Basic code style changes. Adding a few more comments. Return early if disableScrollChange in onScrollChange listener.
* `unction` to `function` corrects #962 (#970)
* Cross browser friendly fix for #904. This calls blur and focus from … (#972)
* Cross browser friendly fix for #904. 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 #904 to keep the page from jumping to the focused workspace in IE 11 (#974)
* 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 #967 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 d55d9cbd9ff308ff5e361cf77acabb61a4bf4695). IIUC, updateWidth/getCachedWidth was only called from render before which is overridden in FieldImage to be a no-op already. (#979)
* Fix #969
* Localisation updates from https://translatewiki.net.
* Fix #986. Looks like the original PR just forgot this block. (#992)
* rebuild develop (#996)
* Added the variable modal and component and implemented basic renaming functionality. (#991)
* Fixing commenting from the last commit. (#1000)
* 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. (#1011)
* Minimap position bug fix for browsers other than chrome. Added touch support.
* Adding an add variable modal to accessible Blockly. (#1015)
* 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. (#1017)
Centralizes accessible modal behavior.
* - Changed error message referencing 'procedure' instead of 'function' (#1019)
- 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,… (#1028)
...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). (#1027)
* Enable google/blockly with continuous build on travis ci (#1023) (#1035)
* 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 #880.
* Ensure useDragSurface is a boolean.
Fixed #988
* use pretest instead of preinstall in package.json (#1043)
* 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 #973
* bumpNeighbours_ function moved to block_svg.
Fixed #1009
* Update RegEx in js-to-json to match windowi eol (#1050)
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 (#1053)
"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. (#1054)
* Correcting #1054 (#1056)
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… (#1057)
* Change how blockly handles cursors. The old way was quite slow because it changed the stylesheet directly. See issue #981 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. (#1059)
* Merge master into develop (#1063)
- pick up translation changes
- clean up trailing spaces
* use goog.string.startswith instead of string.startswith (#1065)
* New jsinterpreter demo includes wait block. Both demos have improved UI for clarity. (#1001)
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 #1069 (#1073)
* VariableMap and functions added.
* Fix #1051 (#1084)
* Improve errors when validating JSON block definitions. (#1086)
goog.asserts to not run from blockly_compressed.js. User data validation should always run.
* Dragging changes, rebased on develop (#1078)
* 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 (#1026)
-- 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 (#1048)
- Removed gestureDB
- Removing uses of terminateDrag
- Cleaned up disposal code
* Dragging bugfixes (#1058)
- 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 (#1060)
* 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. (#1081)
* add osx travis test run job (#1074)
* Names are correctly fetched from VariableModels!
* add more wait time for test setup (#1091)
* Work around timing issue with travis osx issue (#1092)
* add more wait time for test setup
* increase selenium wait time
* add more wait
* Fix #1077 by adding a rule to cover the toolbox labels too. (#1099)
* Assign variable UUID to field_variable dropdown.
* Change registration link to a static one (#1106)
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 (#1111)
* Click events on shadow blocks have the correct id (#1089)
* Add image_onclick option (#1080)
* Cleanup: semicolons, spacing, etc. (#1116)
* Spelling. Spelling is hard.
* Add variable info to xml generated in variables.js
* Add missing CLAs info to the contributing file (#1119)
* Add missing CLAs info to the contributing file
* Added larger changes paragraph
* Replacing latest prettifier hosted in repo with latest version at rawgit CDN. (#1120)
* Forgot update code demo (#1121)
* Move audio code to a new file (#1122)
* 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 (#1126)
* Include variables at top of serialization.
* Move blockSvg.getHeightWidth to block_render_svg.js (#1118)
* Deserialization variables at top.
* Create grid object (#1131)
* 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
|
|
|
/**
|
|
|
|
* Object in charge of loading, storing, and playing audio for a workspace.
|
|
|
|
* @type {Blockly.WorkspaceAudio}
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
this.audioManager_ = new Blockly.WorkspaceAudio(options.parentWorkspace);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This workspace's grid object or null.
|
|
|
|
* @type {Blockly.Grid}
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
this.grid_ = this.options.gridPattern ?
|
|
|
|
new Blockly.Grid(options.gridPattern, options.gridOptions) : null;
|
|
|
|
|
Feature/merge feb 2017 (#791)
* 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 c8ca24a0007b70e137417e843459c87185141a55.
* 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… (#732)
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. (#748)
* 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 (#741)
* 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. (#749)
* 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 #758.
* Split the scrollbar and flyout out into their own SVG elements. They (#771)
* 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. (#699)
* Fix #698 by adjusting the regex to not have \. Still not 100% sure w… (#700)
* Fix #698 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… (#777)
* 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… (#778)
* 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 #748 and stop using contains since it is not supported in IE
* Fixes #786 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. (#787)
* 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 #791.
* Localisation updates from https://translatewiki.net.
* Localisation updates from https://translatewiki.net.
* Use the drag surface when scrolling using the scrollbars. #783 (#789)
* End event groups when you finish editing a field
* Fix #794 and make the workspace grid drag along with the workspace. (#801)
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. (#790)
* 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. (#805)
* Don't connect to blocks under the flyout.
* recompile again. (#806)
* 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 #813 by ademenev
* PR #818: 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. (#820)
From commits b77f8cbebc5cef247116d3df6a428df8addbe53d and 4ecdedec9f8a69f78abf246e7a5db1e1a0be6b85
* Naming changes in mirror demo
* Adding support for untranslated messages. (#819)
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. (#825)
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 #828.
* 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" (#832)
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. (#836)
Fixes commits in #832.
* Adding extensions for JSON support of dynamic blocks. (#834)
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 … (#837)
* 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 #816 so that layering of the flyout and workspace scrollbars
are done correctly.
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 12:09:23 -08:00
|
|
|
this.registerToolboxCategoryCallback(Blockly.VARIABLE_CATEGORY_NAME,
|
2017-07-06 18:00:33 -07:00
|
|
|
Blockly.DataCategory);
|
Feature/merge feb 2017 (#791)
* 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 c8ca24a0007b70e137417e843459c87185141a55.
* 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… (#732)
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. (#748)
* 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 (#741)
* 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. (#749)
* 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 #758.
* Split the scrollbar and flyout out into their own SVG elements. They (#771)
* 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. (#699)
* Fix #698 by adjusting the regex to not have \. Still not 100% sure w… (#700)
* Fix #698 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… (#777)
* 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… (#778)
* 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 #748 and stop using contains since it is not supported in IE
* Fixes #786 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. (#787)
* 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 #791.
* Localisation updates from https://translatewiki.net.
* Localisation updates from https://translatewiki.net.
* Use the drag surface when scrolling using the scrollbars. #783 (#789)
* End event groups when you finish editing a field
* Fix #794 and make the workspace grid drag along with the workspace. (#801)
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. (#790)
* 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. (#805)
* Don't connect to blocks under the flyout.
* recompile again. (#806)
* 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 #813 by ademenev
* PR #818: 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. (#820)
From commits b77f8cbebc5cef247116d3df6a428df8addbe53d and 4ecdedec9f8a69f78abf246e7a5db1e1a0be6b85
* Naming changes in mirror demo
* Adding support for untranslated messages. (#819)
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. (#825)
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 #828.
* 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" (#832)
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. (#836)
Fixes commits in #832.
* Adding extensions for JSON support of dynamic blocks. (#834)
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 … (#837)
* 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 #816 so that layering of the flyout and workspace scrollbars
are done correctly.
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 12:09:23 -08:00
|
|
|
this.registerToolboxCategoryCallback(Blockly.PROCEDURE_CATEGORY_NAME,
|
|
|
|
Blockly.Procedures.flyoutCategory);
|
2014-12-23 11:22:02 -08:00
|
|
|
};
|
|
|
|
goog.inherits(Blockly.WorkspaceSvg, Blockly.Workspace);
|
|
|
|
|
Merge google/develop June 22 (#441)
* Localisation updates from https://translatewiki.net.
* test page that creates random blocks and randomly drags them around the page
* Localisation updates from https://translatewiki.net.
* add missing return in fake drag
* get rid of drag_tests file:
* Generated JS helper functions should be camelCase.
Complying with Google style guide.
* Localisation updates from https://translatewiki.net.
* Fix extra category error. Clean up code, rename variables, reduce line lengths, fix lint issues.
* Remove claim that good.string.quote should be used.
* Change the blockly workspace resizing strategy. (#386)
* Add a new method to be called when the contents of the workspace change and
the scrollbars need to be adjusted but the the chrome (trash, toolbox, etc)
are expected to stay in the same place.
Change a bunch of calls to svgResize to either be removed or call the new
method instead. This is a nice performance win since the offsetHeight/Width
call in svgResize can be expensive, especially when called as often as we do -
there was some layout thrashing.
This also paves the way for moving calls to recordDeleteAreas
(which is also expensive) to a more cacheable spot than on every
mouse down/touch event.
of things (namely the scrollbars)
* Fix size of graph demo when it first loads by calling svgResize.
The graph starts with fixed width and was relying on a resize event
to fire (which I believe was removed in commit
217c681b86b0f2df76c479c9efae62e6e).
* Fix the resizing of the code demo. The demo's tab min-width used to
match the toolbox's width was only being set on a resize event, but
commit 217c681b86b0f2df76c479c9efae62e6e changed how that worked.
* Fix up some comments.
* Use specific workspaces rather than Blockly.getMainWorkspace().
* Make workspace required for resizeSvgContents and update
some calls to send real workspaces rather than ones that are
null.
Remove the private tag on terminateDrag_ because it is only
actually called from outside the BlockSvg object.
* Remove a rogue period.
* Recategorize BlockSvg.terminateDrag_ to @package instead of @private so that
other developers don't use it, but it still can be used by other Blockly classes.
* Add a TODO to fix issue #307.
* Add @package to workspace resizeContents.
* Routine recompile
* Fix unit tests.
* Fix inheritance on rendered connection.
Closure compiler on maximum compression breaks badly due to lack of
@extends attribute.
* Add toolbox location and toolbox mode options to playground.
* Increase commonality between playgrounds.
* Properly deal with shadow statement blocks in stacks.
* Localisation updates from https://translatewiki.net.
* Use a comment block for function comments in generated JS, Python and Dart.
* Fix typo in flyout.js (#403)
* Fix typo in flyout.js (#402)
* Line wrap comments in generated code.
* Remove reference to undefined variable (#413)
REASON_MUST_DISCONNECT was removed by a refactor in 2a1ffa1.
* Fix airstrike by grabbing the correct toolbox element. (#411)
Probably broken in 266e2ffa9a017d21d7ca2f151730d6ecfcecf173.
* Localisation updates from https://translatewiki.net.
* Fix issue #406 by calling resize from the keypress handler on text inputs. (#408)
* Remove shadow blocks from Accessible Blockly demo. Update README.
* Generate for loops on one line.
* Introduce a common translation pipe; remove local stringMap attributes. Fix variable name error in paste functions. Minor linting.
* Fix precedence on isIndex blocks.
* Add indexing setting for JavaScript Generation (#419)
Adding setting to allow for switching between zero and one based indexing for Blockly Blocks such that the generated code will use this flag to determine whether one based or zero based indexing should be used. One based indexing is enabled by default.
* Remove unused functions and dependencies.
* Remove the unnecessary construction of new services.
* Fix sort block in JS to satisfy tests.
* Trigger a contents resize in block's moveBy. (#422)
This fixes #420 but and it also fixes some other similar problems
with copy/paste and other users of moveBy.
* Consolidate the usages of the 'blockly-disabled' label.
* Fix error when undoing a shadow block replacement. Issue #415.
* Unify setActiveDesc() and updateSelectedNode() in the TreeService. Move function calls made directly within the template to the correct hooks.
* Standardize naming of components.
* Prevent collisions between user functions and helper functions.
* Localisation updates from https://translatewiki.net.
* Fix #425. Attash the resize handler to the workspace so it can be removed (#429)
when workspace.dispose() is called.
* Change the TreeService to a singleton.
* Remove unneeded generated parens around function calls in indexOf blocks.
* Fix #423 by calling workspace's resize when the flyout reflows. (#430)
* Updating URLs to reflect new docs. (#418)
* Updating URLs to reflect new docs. Removing -blockly in URLs.
* Rebuilt.
* Routine recompile
* Prevent selected block from ending up underneath a bumped block.
* Fix undo on fields with validators with side effects.
* Don't fire change event on fields that haven't been named yet.
* Localisation updates from https://translatewiki.net.
* Fix tree focus issues.
* Fix remaining focus issues on block deletion.
* cache delete areas instead of recalculating them onMouseDown
* Cache screen CTM for performance improvement.
* Call svgResizeContents from block_svg's dipose so that deleting blocks (#434)
from the context menu (or anywhere really) causes the workspace to
recalculate its size.
Remove the call to svgResizeContents from onMouseUp's logic for
determining whether the block is being dropped in the trash
since it calls dispose.
One side effect of this is that when you delete multiple blocks
resize gets called for each of them and the scrollbars move during
the operation. This is most obviously seen by doing an airstrike
in the playground and then deleting all the blocks at once.
* Allow terminal blocks to replace other terminal blocks (#433)
* Allow terminal blocks to replace other terminal blocks
* Updated test to allow replacing terminal blocks
* Refactor how activeDescendant is set. Introduce helper functions to ensure that calls like pasteAbove() preserve the focus.
* Localisation updates from https://translatewiki.net.
* Remove unnecessary logging.
* Reduce unneeded parentheses in JS and Python.
* Start using field_number.
* Make it easy to disable unconnected blocks.
* Routine recompile.
* Check if matrix is null in mouseToSvg
* Remove js/ localizations pre-merge
* Fix change to block_render_svg
* Fix error in xml.js
* Playground merge
* Add simple toolboxes to playgrounds
* Fix flyout reference in events listener
* Move tokenizeIntepolation into Blockly.utils namespace.
* Use simpler message interpolation in Code demo.
* Create console stub for IE 9.
* Don't output blockId if not set (e.g., toolbox category event). (#443)
* Fix block in multi-playground
* Increase commonality between playgrounds.
# Conflicts:
# tests/multi_playground.html
# tests/playground.html
* Remove "show flyouts" button
* Recompile for merge June 22
2016-06-22 17:50:16 -04:00
|
|
|
/**
|
2017-02-02 14:17:43 -05:00
|
|
|
* A wrapper function called when a resize event occurs.
|
|
|
|
* You can pass the result to `unbindEvent_`.
|
2016-09-27 17:47:36 -04:00
|
|
|
* @type {Array.<!Array>}
|
Merge google/develop June 22 (#441)
* Localisation updates from https://translatewiki.net.
* test page that creates random blocks and randomly drags them around the page
* Localisation updates from https://translatewiki.net.
* add missing return in fake drag
* get rid of drag_tests file:
* Generated JS helper functions should be camelCase.
Complying with Google style guide.
* Localisation updates from https://translatewiki.net.
* Fix extra category error. Clean up code, rename variables, reduce line lengths, fix lint issues.
* Remove claim that good.string.quote should be used.
* Change the blockly workspace resizing strategy. (#386)
* Add a new method to be called when the contents of the workspace change and
the scrollbars need to be adjusted but the the chrome (trash, toolbox, etc)
are expected to stay in the same place.
Change a bunch of calls to svgResize to either be removed or call the new
method instead. This is a nice performance win since the offsetHeight/Width
call in svgResize can be expensive, especially when called as often as we do -
there was some layout thrashing.
This also paves the way for moving calls to recordDeleteAreas
(which is also expensive) to a more cacheable spot than on every
mouse down/touch event.
of things (namely the scrollbars)
* Fix size of graph demo when it first loads by calling svgResize.
The graph starts with fixed width and was relying on a resize event
to fire (which I believe was removed in commit
217c681b86b0f2df76c479c9efae62e6e).
* Fix the resizing of the code demo. The demo's tab min-width used to
match the toolbox's width was only being set on a resize event, but
commit 217c681b86b0f2df76c479c9efae62e6e changed how that worked.
* Fix up some comments.
* Use specific workspaces rather than Blockly.getMainWorkspace().
* Make workspace required for resizeSvgContents and update
some calls to send real workspaces rather than ones that are
null.
Remove the private tag on terminateDrag_ because it is only
actually called from outside the BlockSvg object.
* Remove a rogue period.
* Recategorize BlockSvg.terminateDrag_ to @package instead of @private so that
other developers don't use it, but it still can be used by other Blockly classes.
* Add a TODO to fix issue #307.
* Add @package to workspace resizeContents.
* Routine recompile
* Fix unit tests.
* Fix inheritance on rendered connection.
Closure compiler on maximum compression breaks badly due to lack of
@extends attribute.
* Add toolbox location and toolbox mode options to playground.
* Increase commonality between playgrounds.
* Properly deal with shadow statement blocks in stacks.
* Localisation updates from https://translatewiki.net.
* Use a comment block for function comments in generated JS, Python and Dart.
* Fix typo in flyout.js (#403)
* Fix typo in flyout.js (#402)
* Line wrap comments in generated code.
* Remove reference to undefined variable (#413)
REASON_MUST_DISCONNECT was removed by a refactor in 2a1ffa1.
* Fix airstrike by grabbing the correct toolbox element. (#411)
Probably broken in 266e2ffa9a017d21d7ca2f151730d6ecfcecf173.
* Localisation updates from https://translatewiki.net.
* Fix issue #406 by calling resize from the keypress handler on text inputs. (#408)
* Remove shadow blocks from Accessible Blockly demo. Update README.
* Generate for loops on one line.
* Introduce a common translation pipe; remove local stringMap attributes. Fix variable name error in paste functions. Minor linting.
* Fix precedence on isIndex blocks.
* Add indexing setting for JavaScript Generation (#419)
Adding setting to allow for switching between zero and one based indexing for Blockly Blocks such that the generated code will use this flag to determine whether one based or zero based indexing should be used. One based indexing is enabled by default.
* Remove unused functions and dependencies.
* Remove the unnecessary construction of new services.
* Fix sort block in JS to satisfy tests.
* Trigger a contents resize in block's moveBy. (#422)
This fixes #420 but and it also fixes some other similar problems
with copy/paste and other users of moveBy.
* Consolidate the usages of the 'blockly-disabled' label.
* Fix error when undoing a shadow block replacement. Issue #415.
* Unify setActiveDesc() and updateSelectedNode() in the TreeService. Move function calls made directly within the template to the correct hooks.
* Standardize naming of components.
* Prevent collisions between user functions and helper functions.
* Localisation updates from https://translatewiki.net.
* Fix #425. Attash the resize handler to the workspace so it can be removed (#429)
when workspace.dispose() is called.
* Change the TreeService to a singleton.
* Remove unneeded generated parens around function calls in indexOf blocks.
* Fix #423 by calling workspace's resize when the flyout reflows. (#430)
* Updating URLs to reflect new docs. (#418)
* Updating URLs to reflect new docs. Removing -blockly in URLs.
* Rebuilt.
* Routine recompile
* Prevent selected block from ending up underneath a bumped block.
* Fix undo on fields with validators with side effects.
* Don't fire change event on fields that haven't been named yet.
* Localisation updates from https://translatewiki.net.
* Fix tree focus issues.
* Fix remaining focus issues on block deletion.
* cache delete areas instead of recalculating them onMouseDown
* Cache screen CTM for performance improvement.
* Call svgResizeContents from block_svg's dipose so that deleting blocks (#434)
from the context menu (or anywhere really) causes the workspace to
recalculate its size.
Remove the call to svgResizeContents from onMouseUp's logic for
determining whether the block is being dropped in the trash
since it calls dispose.
One side effect of this is that when you delete multiple blocks
resize gets called for each of them and the scrollbars move during
the operation. This is most obviously seen by doing an airstrike
in the playground and then deleting all the blocks at once.
* Allow terminal blocks to replace other terminal blocks (#433)
* Allow terminal blocks to replace other terminal blocks
* Updated test to allow replacing terminal blocks
* Refactor how activeDescendant is set. Introduce helper functions to ensure that calls like pasteAbove() preserve the focus.
* Localisation updates from https://translatewiki.net.
* Remove unnecessary logging.
* Reduce unneeded parentheses in JS and Python.
* Start using field_number.
* Make it easy to disable unconnected blocks.
* Routine recompile.
* Check if matrix is null in mouseToSvg
* Remove js/ localizations pre-merge
* Fix change to block_render_svg
* Fix error in xml.js
* Playground merge
* Add simple toolboxes to playgrounds
* Fix flyout reference in events listener
* Move tokenizeIntepolation into Blockly.utils namespace.
* Use simpler message interpolation in Code demo.
* Create console stub for IE 9.
* Don't output blockId if not set (e.g., toolbox category event). (#443)
* Fix block in multi-playground
* Increase commonality between playgrounds.
# Conflicts:
# tests/multi_playground.html
# tests/playground.html
* Remove "show flyouts" button
* Recompile for merge June 22
2016-06-22 17:50:16 -04:00
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.resizeHandlerWrapper_ = null;
|
|
|
|
|
2014-12-23 11:22:02 -08:00
|
|
|
/**
|
2016-10-11 12:16:17 -07:00
|
|
|
* The render status of an SVG workspace.
|
2018-08-07 17:35:27 -04:00
|
|
|
* Returns `false` for headless workspaces and true for instances of
|
|
|
|
* `Blockly.WorkspaceSvg`.
|
2016-09-27 17:47:36 -04:00
|
|
|
* @type {boolean}
|
2014-12-23 11:22:02 -08:00
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.rendered = true;
|
|
|
|
|
2018-08-07 17:35:27 -04:00
|
|
|
/**
|
|
|
|
* Whether the workspace is visible. False if the workspace has been hidden
|
2018-08-08 20:32:22 -04:00
|
|
|
* by calling `setVisible(false)`.
|
2018-08-07 17:35:27 -04:00
|
|
|
* @type {boolean}
|
2018-08-08 20:32:22 -04:00
|
|
|
* @private
|
2018-08-07 17:35:27 -04:00
|
|
|
*/
|
2018-08-08 20:32:22 -04:00
|
|
|
Blockly.WorkspaceSvg.prototype.isVisible_ = true;
|
2018-08-07 17:35:27 -04:00
|
|
|
|
2014-12-23 11:22:02 -08:00
|
|
|
/**
|
|
|
|
* Is this workspace the surface for a flyout?
|
|
|
|
* @type {boolean}
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.isFlyout = false;
|
|
|
|
|
2016-08-11 16:09:22 -07:00
|
|
|
/**
|
|
|
|
* Is this workspace the surface for a mutator?
|
|
|
|
* @type {boolean}
|
|
|
|
* @package
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.isMutator = false;
|
|
|
|
|
2016-10-03 20:15:54 -04:00
|
|
|
/**
|
|
|
|
* Whether this workspace has resizes enabled.
|
|
|
|
* Disable during batch operations for a performance improvement.
|
|
|
|
* @type {boolean}
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.resizesEnabled_ = true;
|
|
|
|
|
2017-10-24 14:31:21 -07:00
|
|
|
/**
|
|
|
|
* Whether this workspace has toolbox/flyout refreshes enabled.
|
|
|
|
* Disable during batch operations for a performance improvement.
|
|
|
|
* @type {boolean}
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.toolboxRefreshEnabled_ = true;
|
|
|
|
|
2014-12-23 11:22:02 -08:00
|
|
|
/**
|
2017-05-22 13:08:22 -07:00
|
|
|
* Current horizontal scrolling offset in pixel units.
|
2014-12-23 11:22:02 -08:00
|
|
|
* @type {number}
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.scrollX = 0;
|
|
|
|
|
|
|
|
/**
|
2017-05-22 13:08:22 -07:00
|
|
|
* Current vertical scrolling offset in pixel units.
|
2014-12-23 11:22:02 -08:00
|
|
|
* @type {number}
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.scrollY = 0;
|
|
|
|
|
2015-10-25 23:50:20 -07:00
|
|
|
/**
|
2017-05-22 13:08:22 -07:00
|
|
|
* Horizontal scroll value when scrolling started in pixel units.
|
2015-10-25 23:50:20 -07:00
|
|
|
* @type {number}
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.startScrollX = 0;
|
|
|
|
|
|
|
|
/**
|
2017-05-22 13:08:22 -07:00
|
|
|
* Vertical scroll value when scrolling started in pixel units.
|
2015-10-25 23:50:20 -07:00
|
|
|
* @type {number}
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.startScrollY = 0;
|
|
|
|
|
2015-08-19 17:21:05 -07:00
|
|
|
/**
|
2016-04-19 23:24:42 -07:00
|
|
|
* Distance from mouse to object being dragged.
|
|
|
|
* @type {goog.math.Coordinate}
|
2015-08-19 17:21:05 -07:00
|
|
|
* @private
|
|
|
|
*/
|
2016-04-19 23:24:42 -07:00
|
|
|
Blockly.WorkspaceSvg.prototype.dragDeltaXY_ = null;
|
2015-08-19 17:21:05 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Current scale.
|
|
|
|
* @type {number}
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.scale = 1;
|
|
|
|
|
2014-12-23 11:22:02 -08:00
|
|
|
/**
|
|
|
|
* The workspace's trashcan (if any).
|
|
|
|
* @type {Blockly.Trashcan}
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.trashcan = null;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This workspace's scrollbars, if they exist.
|
|
|
|
* @type {Blockly.ScrollbarPair}
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.scrollbar = null;
|
|
|
|
|
2017-05-22 13:08:22 -07:00
|
|
|
/**
|
|
|
|
* The current gesture in progress on this workspace, if any.
|
|
|
|
* @type {Blockly.Gesture}
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.currentGesture_ = null;
|
|
|
|
|
2017-02-02 14:17:43 -05:00
|
|
|
/**
|
|
|
|
* This workspace's surface for dragging blocks, if it exists.
|
|
|
|
* @type {Blockly.BlockDragSurfaceSvg}
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.blockDragSurface_ = null;
|
|
|
|
|
2016-04-01 16:32:56 -04:00
|
|
|
/**
|
|
|
|
* This workspace's drag surface, if it exists.
|
2017-02-02 14:17:43 -05:00
|
|
|
* @type {Blockly.WorkspaceDragSurfaceSvg}
|
Merge upstream may 24 (#352)
* Localisation updates from https://translatewiki.net.
* Initialize generated JS and Dart variables in one line.
* proxy option for build.py
* Localisation updates from https://translatewiki.net.
* Revert "proxy option for build.py"
* Prevent sounds from playing on top of each other.
* Routine recompile.
* Remove sound and animation on delete during undo/redo.
* Accessible demo (#373)
* adding a folder in demos for blind and setting up the package.json file for development. Adding package.json to .gitignore
* removing gitignore~ file
* copied blind blockly demo code over. set up a new dev environment. Up for review: the blind blockly demo code. Much of the drop downs don't actually do anything, but a general look at the way angular is used would be helpful in shaping future development.
* adding an index file that was being ignored by .gitignore
* adding required angular files and libraries previously ignored by git add --a for some unknown reason.
* starting work on toolbox
* got workspace and toolbox connected. Copy to workspace annd copy to clipboard working at 80%.
* cleaning up autogenerated files
* adding my own files. Not sure why the test files are being added.
* cleaning up comments
* removed empty html_formatter.html file from project and put on git ignore list. The file is used on my end to help with formatting the html in javascript files.
* getting rid of unnecessary html_formatter file
* removing merge conflicts
* cleaned up comments
* cleaned up comments, organized file structure, made ToolboxXML a file that can be changed by other developers porting this code, added copyright and file summaries to js files, linted files, moved third party libraries to lib folder
* removing lint files that shouldn't be tracked.
* Made the clipboard a service instead of multiple pieces embedded within the app. Not sold on the name ClipboardService. Open to suggestions.
* syncing up demo updates
* adding insert block menus above and below appropriate blocks.
* hacky version of getting code to run.
* changing toolbox to be a menu. making both the toolbox and workspace ordered lists
* adding new folder dev-old containing a version of blind blockly that uses nested lists for the toolbox
* getting rid of menubar experiment
* adding treeview shenanigans part 1
* adding treeview experiment page and finishing up treeview.
* getting a treeview implementation working in the toolbox
* creating a fishfood folder for fishfood development
* making first level of fishfood
* fixing something
* adding index file for fishfood
* beginning merging the treeview system.
* creating two treeviews
* fishfood level 1 without working music blocks
* fixes to treeview navigation
* final fishfood features done
* adding support for toolboxes without categories
* beginning integration of Sean's new music code
* adding Sean's music blocks and beginning music_player integration.
* merged Sean's music block code into fishfood
* merged Sean's music code and fixed treeview bug with toolbox when no categories
* adding blank_demo
* fixing tab navigation.
* fixing bug with shift-tab. New bug found in alt+tab not opening dropdown?
* fixing labels
* fixing bugs and finding more.
* removing dropdowns in favor of buttons part 1. Still need to change field options.
* index.html for blank_demo
* beginning cleanup
* adding blockly- prefix to label ids.
* integrating AccessibleBlockly with Blockly library.
* remove closure library
* removing testing files that aren't in develop
* removing all demo stuff for a later pull request
* removing gitignore file that doesn't exist in developer branch
* syncing with develop branch files
* removing music files from this pull request
* doing some lint cleanup
* rolling back accidental package.json change
* removing var blocklyApp = blocklyApp || {} from each extraneous file
* adding last debug statement
* changed name of inputType function
* renaming _service arguments
* fixing function names
* fixing all comments.
* fixing minor comments
* renaming variables, etc
* fixing bugs that break demo. Adding the run code and clear workspace buttons back to the workspaceview as their current position breaks tab navigation.
* fixing minor comments
* fixing function names, etc.
* adding comments to getInputTypeLabel function
* removing addClass() calls from the template
* small change to clipboardService
* splitting getCategoryDependantId into two functions: getCategoryId and setActiveDesc
* fixing minor bug with last commit
* using conditional attributes to remove setActiveAttributes function from treeService and do same work in template.
* deleting unnecessary comment created in previous commit.
* adding a utilsService to remove duplicated code.
* changing function names in utilsService
* changing delete to [delete] to allow HTMLText functions to return an empty string instead of undefined. Also renaming concatStringWithSpaces to generateAriaLabelledByAttr
* generating ids in ngOnInit instead of on the fly, allowing us to use [attr.aria-labelledBy] in the template instead of using setLabelledBy(element). Deleting function utilsService.setLabelledBy.
* fixing small bug with tree service left arrow: was throwing an error when you can't go any further left.
* reformatting html to make it easier to read.
* moving from importing the xml file to using an xml toolbox in the demo.
* fixing minor bugs and removing code relevant only to the music game.
* minor fixes
* adding alerts to copy, paste, and mark actions. renaming blocklyApp.TreeView to blocklyApp.WorkspaceTreeView
* Beginning to add Blockly.msg strings.
* making sure index file is being tracked
* adding all demo bits
* removing demo files from this pull request
* fixing providers, some linting, and removing getInfo() function.
* adding small todo comment for sll@
* adding minimal blockly accessible demo
* removing unnecessary files
* putting package file back
* fixing package file
* fixing msg file
* fixing boot.js file
* fixing boot.js file
* fixing indentation on boot
* fixing indentation on index file.
* AccessibleBlockly (#354)
* adding a folder in demos for blind and setting up the package.json file for development. Adding package.json to .gitignore
* removing gitignore~ file
* copied blind blockly demo code over. set up a new dev environment. Up for review: the blind blockly demo code. Much of the drop downs don't actually do anything, but a general look at the way angular is used would be helpful in shaping future development.
* adding an index file that was being ignored by .gitignore
* adding required angular files and libraries previously ignored by git add --a for some unknown reason.
* starting work on toolbox
* got workspace and toolbox connected. Copy to workspace annd copy to clipboard working at 80%.
* cleaning up autogenerated files
* adding my own files. Not sure why the test files are being added.
* cleaning up comments
* removed empty html_formatter.html file from project and put on git ignore list. The file is used on my end to help with formatting the html in javascript files.
* getting rid of unnecessary html_formatter file
* removing merge conflicts
* cleaned up comments
* cleaned up comments, organized file structure, made ToolboxXML a file that can be changed by other developers porting this code, added copyright and file summaries to js files, linted files, moved third party libraries to lib folder
* removing lint files that shouldn't be tracked.
* Made the clipboard a service instead of multiple pieces embedded within the app. Not sold on the name ClipboardService. Open to suggestions.
* syncing up demo updates
* adding insert block menus above and below appropriate blocks.
* hacky version of getting code to run.
* changing toolbox to be a menu. making both the toolbox and workspace ordered lists
* adding new folder dev-old containing a version of blind blockly that uses nested lists for the toolbox
* getting rid of menubar experiment
* adding treeview shenanigans part 1
* adding treeview experiment page and finishing up treeview.
* getting a treeview implementation working in the toolbox
* creating a fishfood folder for fishfood development
* making first level of fishfood
* fixing something
* adding index file for fishfood
* beginning merging the treeview system.
* creating two treeviews
* fishfood level 1 without working music blocks
* fixes to treeview navigation
* final fishfood features done
* adding support for toolboxes without categories
* beginning integration of Sean's new music code
* adding Sean's music blocks and beginning music_player integration.
* merged Sean's music block code into fishfood
* merged Sean's music code and fixed treeview bug with toolbox when no categories
* adding blank_demo
* fixing tab navigation.
* fixing bug with shift-tab. New bug found in alt+tab not opening dropdown?
* fixing labels
* fixing bugs and finding more.
* removing dropdowns in favor of buttons part 1. Still need to change field options.
* index.html for blank_demo
* beginning cleanup
* adding blockly- prefix to label ids.
* integrating AccessibleBlockly with Blockly library.
* remove closure library
* removing testing files that aren't in develop
* removing all demo stuff for a later pull request
* removing gitignore file that doesn't exist in developer branch
* syncing with develop branch files
* removing music files from this pull request
* doing some lint cleanup
* rolling back accidental package.json change
* removing var blocklyApp = blocklyApp || {} from each extraneous file
* adding last debug statement
* changed name of inputType function
* renaming _service arguments
* fixing function names
* fixing all comments.
* fixing minor comments
* renaming variables, etc
* fixing bugs that break demo. Adding the run code and clear workspace buttons back to the workspaceview as their current position breaks tab navigation.
* fixing minor comments
* fixing function names, etc.
* adding comments to getInputTypeLabel function
* removing addClass() calls from the template
* small change to clipboardService
* splitting getCategoryDependantId into two functions: getCategoryId and setActiveDesc
* fixing minor bug with last commit
* using conditional attributes to remove setActiveAttributes function from treeService and do same work in template.
* deleting unnecessary comment created in previous commit.
* adding a utilsService to remove duplicated code.
* changing function names in utilsService
* changing delete to [delete] to allow HTMLText functions to return an empty string instead of undefined. Also renaming concatStringWithSpaces to generateAriaLabelledByAttr
* generating ids in ngOnInit instead of on the fly, allowing us to use [attr.aria-labelledBy] in the template instead of using setLabelledBy(element). Deleting function utilsService.setLabelledBy.
* fixing small bug with tree service left arrow: was throwing an error when you can't go any further left.
* reformatting html to make it easier to read.
* moving from importing the xml file to using an xml toolbox in the demo.
* fixing minor bugs and removing code relevant only to the music game.
* minor fixes
* adding alerts to copy, paste, and mark actions. renaming blocklyApp.TreeView to blocklyApp.WorkspaceTreeView
* Beginning to add Blockly.msg strings.
* making sure index file is being tracked
* adding all demo bits
* removing demo files from this pull request
* fixing providers, some linting, and removing getInfo() function.
* adding small todo comment for sll@
* adding minimal Accessible Blockly demo
* removing demo: accidentally committed to wrong branch
* fixing Blockly.Msg string bugs
* fixing TODOs
* package file changed by an automerge. Changing back.
* addressing sll's comments. Creating shim for utilsService functions.
* fixing comments, changing fieldview to deal with this.field.
* fixing clipboard service bug
* fixing focus bug when editing a text input.
* fixed clipboard bug and added README
* fixing workspaceview not to implement on runCode() function and adding note to README
* Cleanup accessible Blockly.
* Recompile May 24
2016-05-24 14:44:04 -04:00
|
|
|
* @private
|
2016-04-01 16:32:56 -04:00
|
|
|
*/
|
2017-02-02 14:17:43 -05:00
|
|
|
Blockly.WorkspaceSvg.prototype.workspaceDragSurface_ = null;
|
2016-04-01 16:32:56 -04:00
|
|
|
|
Merge upstream may 24 (#352)
* Localisation updates from https://translatewiki.net.
* Initialize generated JS and Dart variables in one line.
* proxy option for build.py
* Localisation updates from https://translatewiki.net.
* Revert "proxy option for build.py"
* Prevent sounds from playing on top of each other.
* Routine recompile.
* Remove sound and animation on delete during undo/redo.
* Accessible demo (#373)
* adding a folder in demos for blind and setting up the package.json file for development. Adding package.json to .gitignore
* removing gitignore~ file
* copied blind blockly demo code over. set up a new dev environment. Up for review: the blind blockly demo code. Much of the drop downs don't actually do anything, but a general look at the way angular is used would be helpful in shaping future development.
* adding an index file that was being ignored by .gitignore
* adding required angular files and libraries previously ignored by git add --a for some unknown reason.
* starting work on toolbox
* got workspace and toolbox connected. Copy to workspace annd copy to clipboard working at 80%.
* cleaning up autogenerated files
* adding my own files. Not sure why the test files are being added.
* cleaning up comments
* removed empty html_formatter.html file from project and put on git ignore list. The file is used on my end to help with formatting the html in javascript files.
* getting rid of unnecessary html_formatter file
* removing merge conflicts
* cleaned up comments
* cleaned up comments, organized file structure, made ToolboxXML a file that can be changed by other developers porting this code, added copyright and file summaries to js files, linted files, moved third party libraries to lib folder
* removing lint files that shouldn't be tracked.
* Made the clipboard a service instead of multiple pieces embedded within the app. Not sold on the name ClipboardService. Open to suggestions.
* syncing up demo updates
* adding insert block menus above and below appropriate blocks.
* hacky version of getting code to run.
* changing toolbox to be a menu. making both the toolbox and workspace ordered lists
* adding new folder dev-old containing a version of blind blockly that uses nested lists for the toolbox
* getting rid of menubar experiment
* adding treeview shenanigans part 1
* adding treeview experiment page and finishing up treeview.
* getting a treeview implementation working in the toolbox
* creating a fishfood folder for fishfood development
* making first level of fishfood
* fixing something
* adding index file for fishfood
* beginning merging the treeview system.
* creating two treeviews
* fishfood level 1 without working music blocks
* fixes to treeview navigation
* final fishfood features done
* adding support for toolboxes without categories
* beginning integration of Sean's new music code
* adding Sean's music blocks and beginning music_player integration.
* merged Sean's music block code into fishfood
* merged Sean's music code and fixed treeview bug with toolbox when no categories
* adding blank_demo
* fixing tab navigation.
* fixing bug with shift-tab. New bug found in alt+tab not opening dropdown?
* fixing labels
* fixing bugs and finding more.
* removing dropdowns in favor of buttons part 1. Still need to change field options.
* index.html for blank_demo
* beginning cleanup
* adding blockly- prefix to label ids.
* integrating AccessibleBlockly with Blockly library.
* remove closure library
* removing testing files that aren't in develop
* removing all demo stuff for a later pull request
* removing gitignore file that doesn't exist in developer branch
* syncing with develop branch files
* removing music files from this pull request
* doing some lint cleanup
* rolling back accidental package.json change
* removing var blocklyApp = blocklyApp || {} from each extraneous file
* adding last debug statement
* changed name of inputType function
* renaming _service arguments
* fixing function names
* fixing all comments.
* fixing minor comments
* renaming variables, etc
* fixing bugs that break demo. Adding the run code and clear workspace buttons back to the workspaceview as their current position breaks tab navigation.
* fixing minor comments
* fixing function names, etc.
* adding comments to getInputTypeLabel function
* removing addClass() calls from the template
* small change to clipboardService
* splitting getCategoryDependantId into two functions: getCategoryId and setActiveDesc
* fixing minor bug with last commit
* using conditional attributes to remove setActiveAttributes function from treeService and do same work in template.
* deleting unnecessary comment created in previous commit.
* adding a utilsService to remove duplicated code.
* changing function names in utilsService
* changing delete to [delete] to allow HTMLText functions to return an empty string instead of undefined. Also renaming concatStringWithSpaces to generateAriaLabelledByAttr
* generating ids in ngOnInit instead of on the fly, allowing us to use [attr.aria-labelledBy] in the template instead of using setLabelledBy(element). Deleting function utilsService.setLabelledBy.
* fixing small bug with tree service left arrow: was throwing an error when you can't go any further left.
* reformatting html to make it easier to read.
* moving from importing the xml file to using an xml toolbox in the demo.
* fixing minor bugs and removing code relevant only to the music game.
* minor fixes
* adding alerts to copy, paste, and mark actions. renaming blocklyApp.TreeView to blocklyApp.WorkspaceTreeView
* Beginning to add Blockly.msg strings.
* making sure index file is being tracked
* adding all demo bits
* removing demo files from this pull request
* fixing providers, some linting, and removing getInfo() function.
* adding small todo comment for sll@
* adding minimal blockly accessible demo
* removing unnecessary files
* putting package file back
* fixing package file
* fixing msg file
* fixing boot.js file
* fixing boot.js file
* fixing indentation on boot
* fixing indentation on index file.
* AccessibleBlockly (#354)
* adding a folder in demos for blind and setting up the package.json file for development. Adding package.json to .gitignore
* removing gitignore~ file
* copied blind blockly demo code over. set up a new dev environment. Up for review: the blind blockly demo code. Much of the drop downs don't actually do anything, but a general look at the way angular is used would be helpful in shaping future development.
* adding an index file that was being ignored by .gitignore
* adding required angular files and libraries previously ignored by git add --a for some unknown reason.
* starting work on toolbox
* got workspace and toolbox connected. Copy to workspace annd copy to clipboard working at 80%.
* cleaning up autogenerated files
* adding my own files. Not sure why the test files are being added.
* cleaning up comments
* removed empty html_formatter.html file from project and put on git ignore list. The file is used on my end to help with formatting the html in javascript files.
* getting rid of unnecessary html_formatter file
* removing merge conflicts
* cleaned up comments
* cleaned up comments, organized file structure, made ToolboxXML a file that can be changed by other developers porting this code, added copyright and file summaries to js files, linted files, moved third party libraries to lib folder
* removing lint files that shouldn't be tracked.
* Made the clipboard a service instead of multiple pieces embedded within the app. Not sold on the name ClipboardService. Open to suggestions.
* syncing up demo updates
* adding insert block menus above and below appropriate blocks.
* hacky version of getting code to run.
* changing toolbox to be a menu. making both the toolbox and workspace ordered lists
* adding new folder dev-old containing a version of blind blockly that uses nested lists for the toolbox
* getting rid of menubar experiment
* adding treeview shenanigans part 1
* adding treeview experiment page and finishing up treeview.
* getting a treeview implementation working in the toolbox
* creating a fishfood folder for fishfood development
* making first level of fishfood
* fixing something
* adding index file for fishfood
* beginning merging the treeview system.
* creating two treeviews
* fishfood level 1 without working music blocks
* fixes to treeview navigation
* final fishfood features done
* adding support for toolboxes without categories
* beginning integration of Sean's new music code
* adding Sean's music blocks and beginning music_player integration.
* merged Sean's music block code into fishfood
* merged Sean's music code and fixed treeview bug with toolbox when no categories
* adding blank_demo
* fixing tab navigation.
* fixing bug with shift-tab. New bug found in alt+tab not opening dropdown?
* fixing labels
* fixing bugs and finding more.
* removing dropdowns in favor of buttons part 1. Still need to change field options.
* index.html for blank_demo
* beginning cleanup
* adding blockly- prefix to label ids.
* integrating AccessibleBlockly with Blockly library.
* remove closure library
* removing testing files that aren't in develop
* removing all demo stuff for a later pull request
* removing gitignore file that doesn't exist in developer branch
* syncing with develop branch files
* removing music files from this pull request
* doing some lint cleanup
* rolling back accidental package.json change
* removing var blocklyApp = blocklyApp || {} from each extraneous file
* adding last debug statement
* changed name of inputType function
* renaming _service arguments
* fixing function names
* fixing all comments.
* fixing minor comments
* renaming variables, etc
* fixing bugs that break demo. Adding the run code and clear workspace buttons back to the workspaceview as their current position breaks tab navigation.
* fixing minor comments
* fixing function names, etc.
* adding comments to getInputTypeLabel function
* removing addClass() calls from the template
* small change to clipboardService
* splitting getCategoryDependantId into two functions: getCategoryId and setActiveDesc
* fixing minor bug with last commit
* using conditional attributes to remove setActiveAttributes function from treeService and do same work in template.
* deleting unnecessary comment created in previous commit.
* adding a utilsService to remove duplicated code.
* changing function names in utilsService
* changing delete to [delete] to allow HTMLText functions to return an empty string instead of undefined. Also renaming concatStringWithSpaces to generateAriaLabelledByAttr
* generating ids in ngOnInit instead of on the fly, allowing us to use [attr.aria-labelledBy] in the template instead of using setLabelledBy(element). Deleting function utilsService.setLabelledBy.
* fixing small bug with tree service left arrow: was throwing an error when you can't go any further left.
* reformatting html to make it easier to read.
* moving from importing the xml file to using an xml toolbox in the demo.
* fixing minor bugs and removing code relevant only to the music game.
* minor fixes
* adding alerts to copy, paste, and mark actions. renaming blocklyApp.TreeView to blocklyApp.WorkspaceTreeView
* Beginning to add Blockly.msg strings.
* making sure index file is being tracked
* adding all demo bits
* removing demo files from this pull request
* fixing providers, some linting, and removing getInfo() function.
* adding small todo comment for sll@
* adding minimal Accessible Blockly demo
* removing demo: accidentally committed to wrong branch
* fixing Blockly.Msg string bugs
* fixing TODOs
* package file changed by an automerge. Changing back.
* addressing sll's comments. Creating shim for utilsService functions.
* fixing comments, changing fieldview to deal with this.field.
* fixing clipboard service bug
* fixing focus bug when editing a text input.
* fixed clipboard bug and added README
* fixing workspaceview not to implement on runCode() function and adding note to README
* Cleanup accessible Blockly.
* Recompile May 24
2016-05-24 14:44:04 -04:00
|
|
|
/**
|
2017-02-02 14:17:43 -05:00
|
|
|
* Whether to move workspace to the drag surface when it is dragged.
|
|
|
|
* True if it should move, false if it should be translated directly.
|
|
|
|
* @type {boolean}
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.useWorkspaceDragSurface_ = false;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether the drag surface is actively in use. When true, calls to
|
|
|
|
* translate will translate the drag surface instead of the translating the
|
|
|
|
* workspace directly.
|
|
|
|
* This is set to true in setupDragSurface and to false in resetDragSurface.
|
|
|
|
* @type {boolean}
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.isDragSurfaceActive_ = false;
|
|
|
|
|
2018-05-11 16:35:31 -07:00
|
|
|
/**
|
|
|
|
* The first parent div with 'injectionDiv' in the name, or null if not set.
|
|
|
|
* Access this with getInjectionDiv.
|
|
|
|
* @type {!Element}
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.injectionDiv_ = null;
|
|
|
|
|
2016-08-10 18:00:15 -07:00
|
|
|
/**
|
|
|
|
* Last known position of the page scroll.
|
|
|
|
* This is used to determine whether we have recalculated screen coordinate
|
|
|
|
* stuff since the page scrolled.
|
|
|
|
* @type {!goog.math.Coordinate}
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.lastRecordedPageScroll_ = null;
|
|
|
|
|
2017-02-02 14:17:43 -05:00
|
|
|
/**
|
|
|
|
* Map from function names to callbacks, for deciding what to do when a button
|
|
|
|
* is clicked.
|
2018-04-26 17:06:12 -07:00
|
|
|
* @type {!Object.<string, function(!Blockly.FlyoutButton)>}
|
2017-02-02 14:17:43 -05:00
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.flyoutButtonCallbacks_ = {};
|
|
|
|
|
Feature/merge feb 2017 (#791)
* 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 c8ca24a0007b70e137417e843459c87185141a55.
* 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… (#732)
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. (#748)
* 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 (#741)
* 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. (#749)
* 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 #758.
* Split the scrollbar and flyout out into their own SVG elements. They (#771)
* 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. (#699)
* Fix #698 by adjusting the regex to not have \. Still not 100% sure w… (#700)
* Fix #698 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… (#777)
* 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… (#778)
* 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 #748 and stop using contains since it is not supported in IE
* Fixes #786 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. (#787)
* 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 #791.
* Localisation updates from https://translatewiki.net.
* Localisation updates from https://translatewiki.net.
* Use the drag surface when scrolling using the scrollbars. #783 (#789)
* End event groups when you finish editing a field
* Fix #794 and make the workspace grid drag along with the workspace. (#801)
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. (#790)
* 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. (#805)
* Don't connect to blocks under the flyout.
* recompile again. (#806)
* 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 #813 by ademenev
* PR #818: 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. (#820)
From commits b77f8cbebc5cef247116d3df6a428df8addbe53d and 4ecdedec9f8a69f78abf246e7a5db1e1a0be6b85
* Naming changes in mirror demo
* Adding support for untranslated messages. (#819)
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. (#825)
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 #828.
* 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" (#832)
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. (#836)
Fixes commits in #832.
* Adding extensions for JSON support of dynamic blocks. (#834)
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 … (#837)
* 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 #816 so that layering of the flyout and workspace scrollbars
are done correctly.
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 12:09:23 -08:00
|
|
|
/**
|
|
|
|
* Map from function names to callbacks, for deciding what to do when a custom
|
|
|
|
* toolbox category is opened.
|
2018-04-26 17:06:12 -07:00
|
|
|
* @type {!Object.<string, function(!Blockly.Workspace):!Array.<!Element>>}
|
Feature/merge feb 2017 (#791)
* 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 c8ca24a0007b70e137417e843459c87185141a55.
* 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… (#732)
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. (#748)
* 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 (#741)
* 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. (#749)
* 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 #758.
* Split the scrollbar and flyout out into their own SVG elements. They (#771)
* 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. (#699)
* Fix #698 by adjusting the regex to not have \. Still not 100% sure w… (#700)
* Fix #698 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… (#777)
* 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… (#778)
* 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 #748 and stop using contains since it is not supported in IE
* Fixes #786 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. (#787)
* 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 #791.
* Localisation updates from https://translatewiki.net.
* Localisation updates from https://translatewiki.net.
* Use the drag surface when scrolling using the scrollbars. #783 (#789)
* End event groups when you finish editing a field
* Fix #794 and make the workspace grid drag along with the workspace. (#801)
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. (#790)
* 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. (#805)
* Don't connect to blocks under the flyout.
* recompile again. (#806)
* 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 #813 by ademenev
* PR #818: 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. (#820)
From commits b77f8cbebc5cef247116d3df6a428df8addbe53d and 4ecdedec9f8a69f78abf246e7a5db1e1a0be6b85
* Naming changes in mirror demo
* Adding support for untranslated messages. (#819)
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. (#825)
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 #828.
* 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" (#832)
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. (#836)
Fixes commits in #832.
* Adding extensions for JSON support of dynamic blocks. (#834)
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 … (#837)
* 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 #816 so that layering of the flyout and workspace scrollbars
are done correctly.
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 12:09:23 -08:00
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.toolboxCategoryCallbacks_ = {};
|
|
|
|
|
2016-06-17 14:26:04 -07:00
|
|
|
/**
|
|
|
|
* Inverted screen CTM, for use in mouseToSvg.
|
|
|
|
* @type {SVGMatrix}
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.inverseScreenCTM_ = null;
|
|
|
|
|
2018-05-07 15:37:13 -04:00
|
|
|
/**
|
|
|
|
* Inverted screen CTM is dirty.
|
|
|
|
* @type {Boolean}
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.inverseScreenCTMDirty_ = true;
|
2016-06-17 14:26:04 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Getter for the inverted screen CTM.
|
|
|
|
* @return {SVGMatrix} The matrix to use in mouseToSvg
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.getInverseScreenCTM = function() {
|
2018-05-04 13:23:41 -04:00
|
|
|
|
|
|
|
// Defer getting the screen CTM until we actually need it, this should
|
|
|
|
// avoid forced reflows from any calls to updateInverseScreenCTM.
|
2018-05-07 15:37:13 -04:00
|
|
|
if (this.inverseScreenCTMDirty_) {
|
2018-05-04 13:23:41 -04:00
|
|
|
var ctm = this.getParentSvg().getScreenCTM();
|
|
|
|
if (ctm) {
|
|
|
|
this.inverseScreenCTM_ = ctm.inverse();
|
2018-05-07 15:37:13 -04:00
|
|
|
this.inverseScreenCTMDirty_ = false;
|
2018-05-04 13:23:41 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-17 14:26:04 -07:00
|
|
|
return this.inverseScreenCTM_;
|
|
|
|
};
|
|
|
|
|
2018-08-08 20:32:22 -04:00
|
|
|
/**
|
|
|
|
* Getter for isVisible
|
|
|
|
* @return {boolean} Whether the workspace is visible. False if the workspace has been hidden
|
|
|
|
* by calling `setVisible(false)`.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.isVisible = function() {
|
|
|
|
return this.isVisible_;
|
|
|
|
};
|
|
|
|
|
2016-06-17 14:26:04 -07:00
|
|
|
/**
|
2018-05-04 13:23:41 -04:00
|
|
|
* Mark the inverse screen CTM as dirty.
|
2016-06-17 14:26:04 -07:00
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.updateInverseScreenCTM = function() {
|
2018-05-07 15:37:13 -04:00
|
|
|
this.inverseScreenCTMDirty_ = true;
|
2016-06-17 14:26:04 -07:00
|
|
|
};
|
|
|
|
|
2017-02-02 14:17:43 -05:00
|
|
|
/**
|
|
|
|
* Return the absolute coordinates of the top-left corner of this element,
|
|
|
|
* scales that after canvas SVG element, if it's a descendant.
|
|
|
|
* The origin (0,0) is the top-left corner of the Blockly SVG.
|
|
|
|
* @param {!Element} element Element to find the coordinates of.
|
|
|
|
* @return {!goog.math.Coordinate} Object with .x and .y properties.
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.getSvgXY = function(element) {
|
|
|
|
var x = 0;
|
|
|
|
var y = 0;
|
|
|
|
var scale = 1;
|
|
|
|
if (goog.dom.contains(this.getCanvas(), element) ||
|
|
|
|
goog.dom.contains(this.getBubbleCanvas(), element)) {
|
|
|
|
// Before the SVG canvas, scale the coordinates.
|
|
|
|
scale = this.scale;
|
|
|
|
}
|
|
|
|
do {
|
|
|
|
// Loop through this block and every parent.
|
|
|
|
var xy = Blockly.utils.getRelativeXY(element);
|
|
|
|
if (element == this.getCanvas() ||
|
|
|
|
element == this.getBubbleCanvas()) {
|
|
|
|
// After the SVG canvas, don't scale the coordinates.
|
|
|
|
scale = 1;
|
|
|
|
}
|
|
|
|
x += xy.x * scale;
|
|
|
|
y += xy.y * scale;
|
|
|
|
element = element.parentNode;
|
|
|
|
} while (element && element != this.getParentSvg());
|
|
|
|
return new goog.math.Coordinate(x, y);
|
|
|
|
};
|
|
|
|
|
2017-07-07 11:03:25 -07:00
|
|
|
/**
|
|
|
|
* Return the position of the workspace origin relative to the injection div
|
|
|
|
* origin in pixels.
|
|
|
|
* The workspace origin is where a block would render at position (0, 0).
|
|
|
|
* It is not the upper left corner of the workspace SVG.
|
|
|
|
* @return {!goog.math.Coordinate} Offset in pixels.
|
|
|
|
* @package
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.getOriginOffsetInPixels = function() {
|
|
|
|
return Blockly.utils.getInjectionDivXY_(this.svgBlockCanvas_);
|
|
|
|
};
|
|
|
|
|
2017-07-17 11:28:12 -07:00
|
|
|
/**
|
|
|
|
* Return the injection div that is a parent of this workspace.
|
|
|
|
* Walks the DOM the first time it's called, then returns a cached value.
|
|
|
|
* @return {!Element} The first parent div with 'injectionDiv' in the name.
|
|
|
|
* @package
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.getInjectionDiv = function() {
|
|
|
|
// NB: it would be better to pass this in at createDom, but is more likely to
|
|
|
|
// break existing uses of Blockly.
|
|
|
|
if (!this.injectionDiv_) {
|
|
|
|
var element = this.svgGroup_;
|
|
|
|
while (element) {
|
|
|
|
var classes = element.getAttribute('class') || '';
|
|
|
|
if ((' ' + classes + ' ').indexOf(' injectionDiv ') != -1) {
|
|
|
|
this.injectionDiv_ = element;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
element = element.parentNode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return this.injectionDiv_;
|
|
|
|
};
|
|
|
|
|
2016-06-13 14:46:58 -07:00
|
|
|
/**
|
|
|
|
* Save resize handler data so we can delete it later in dispose.
|
|
|
|
* @param {!Array.<!Array>} handler Data that can be passed to unbindEvent_.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.setResizeHandlerWrapper = function(handler) {
|
|
|
|
this.resizeHandlerWrapper_ = handler;
|
|
|
|
};
|
|
|
|
|
2014-12-23 11:22:02 -08:00
|
|
|
/**
|
2015-09-28 14:17:53 -07:00
|
|
|
* Create the workspace DOM elements.
|
2015-03-26 20:47:36 -07:00
|
|
|
* @param {string=} opt_backgroundClass Either 'blocklyMainBackground' or
|
2015-03-07 19:44:58 -06:00
|
|
|
* 'blocklyMutatorBackground'.
|
2014-12-23 11:22:02 -08:00
|
|
|
* @return {!Element} The workspace's SVG group.
|
|
|
|
*/
|
2015-03-07 19:44:58 -06:00
|
|
|
Blockly.WorkspaceSvg.prototype.createDom = function(opt_backgroundClass) {
|
2015-12-02 11:09:50 -06:00
|
|
|
/**
|
|
|
|
* <g class="blocklyWorkspace">
|
|
|
|
* <rect class="blocklyMainBackground" height="100%" width="100%"></rect>
|
|
|
|
* [Trashcan and/or flyout may go here]
|
|
|
|
* <g class="blocklyBlockCanvas"></g>
|
|
|
|
* <g class="blocklyBubbleCanvas"></g>
|
|
|
|
* </g>
|
|
|
|
* @type {SVGElement}
|
|
|
|
*/
|
2017-02-02 14:17:43 -05:00
|
|
|
this.svgGroup_ = Blockly.utils.createSvgElement('g',
|
2015-09-28 12:17:54 -07:00
|
|
|
{'class': 'blocklyWorkspace'}, null);
|
2017-05-22 13:08:22 -07:00
|
|
|
|
|
|
|
// Note that a <g> alone does not receive mouse events--it must have a
|
|
|
|
// valid target inside it. If no background class is specified, as in the
|
|
|
|
// flyout, the workspace will not receive mouse events.
|
2015-03-07 19:44:58 -06:00
|
|
|
if (opt_backgroundClass) {
|
2015-12-01 14:04:54 -06:00
|
|
|
/** @type {SVGElement} */
|
2017-02-02 14:17:43 -05:00
|
|
|
this.svgBackground_ = Blockly.utils.createSvgElement('rect',
|
2016-01-07 17:01:01 -08:00
|
|
|
{'height': '100%', 'width': '100%', 'class': opt_backgroundClass},
|
|
|
|
this.svgGroup_);
|
2017-05-22 13:08:22 -07:00
|
|
|
|
Merge/05 24 (#903)
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Localisation updates from https://translatewiki.net.
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* Localisation updates from https://translatewiki.net.
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Localisation updates from https://translatewiki.net.
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 #661
* 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. (#934)
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 #946. Don't check for presence of constants.js
* Fix #945 (annotations) and an eslint issue (constant condition)
* Localisation updates from https://translatewiki.net.
* Fix #950: 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 #937.
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() (#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.
* Annotation fixes
* Fix bug #904 by explicitly grabbing focus on the workspace svg element. (#964)
* Potential fix for #888. Stops checking whether we are mid workspace drag since we do not always get mosue up events when blockly is in an iframe. (#899)
* Adding new minimap demo
* Basic code style changes. Adding a few more comments. Return early if disableScrollChange in onScrollChange listener.
* `unction` to `function` corrects #962 (#970)
* Cross browser friendly fix for #904. This calls blur and focus from … (#972)
* Cross browser friendly fix for #904. 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 #904 to keep the page from jumping to the focused workspace in IE 11 (#974)
* 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 #967 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 d55d9cbd9ff308ff5e361cf77acabb61a4bf4695). IIUC, updateWidth/getCachedWidth was only called from render before which is overridden in FieldImage to be a no-op already. (#979)
* Fix #969
* Localisation updates from https://translatewiki.net.
* Fix #986. Looks like the original PR just forgot this block. (#992)
* rebuild develop (#996)
* Added the variable modal and component and implemented basic renaming functionality. (#991)
* Fixing commenting from the last commit. (#1000)
* 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. (#1011)
* Minimap position bug fix for browsers other than chrome. Added touch support.
* Adding an add variable modal to accessible Blockly. (#1015)
* 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. (#1017)
Centralizes accessible modal behavior.
* - Changed error message referencing 'procedure' instead of 'function' (#1019)
- 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,… (#1028)
...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). (#1027)
* Enable google/blockly with continuous build on travis ci (#1023) (#1035)
* 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 #880.
* Ensure useDragSurface is a boolean.
Fixed #988
* use pretest instead of preinstall in package.json (#1043)
* 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 #973
* bumpNeighbours_ function moved to block_svg.
Fixed #1009
* Update RegEx in js-to-json to match windowi eol (#1050)
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 (#1053)
"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. (#1054)
* Correcting #1054 (#1056)
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… (#1057)
* Change how blockly handles cursors. The old way was quite slow because it changed the stylesheet directly. See issue #981 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. (#1059)
* Merge master into develop (#1063)
- pick up translation changes
- clean up trailing spaces
* use goog.string.startswith instead of string.startswith (#1065)
* New jsinterpreter demo includes wait block. Both demos have improved UI for clarity. (#1001)
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 #1069 (#1073)
* VariableMap and functions added.
* Fix #1051 (#1084)
* Improve errors when validating JSON block definitions. (#1086)
goog.asserts to not run from blockly_compressed.js. User data validation should always run.
* Dragging changes, rebased on develop (#1078)
* 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 (#1026)
-- 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 (#1048)
- Removed gestureDB
- Removing uses of terminateDrag
- Cleaned up disposal code
* Dragging bugfixes (#1058)
- 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 (#1060)
* 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. (#1081)
* add osx travis test run job (#1074)
* Names are correctly fetched from VariableModels!
* add more wait time for test setup (#1091)
* Work around timing issue with travis osx issue (#1092)
* add more wait time for test setup
* increase selenium wait time
* add more wait
* Fix #1077 by adding a rule to cover the toolbox labels too. (#1099)
* Assign variable UUID to field_variable dropdown.
* Change registration link to a static one (#1106)
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 (#1111)
* Click events on shadow blocks have the correct id (#1089)
* Add image_onclick option (#1080)
* Cleanup: semicolons, spacing, etc. (#1116)
* Spelling. Spelling is hard.
* Add variable info to xml generated in variables.js
* Add missing CLAs info to the contributing file (#1119)
* Add missing CLAs info to the contributing file
* Added larger changes paragraph
* Replacing latest prettifier hosted in repo with latest version at rawgit CDN. (#1120)
* Forgot update code demo (#1121)
* Move audio code to a new file (#1122)
* 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 (#1126)
* Include variables at top of serialization.
* Move blockSvg.getHeightWidth to block_render_svg.js (#1118)
* Deserialization variables at top.
* Create grid object (#1131)
* 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
|
|
|
if (opt_backgroundClass == 'blocklyMainBackground' && this.grid_) {
|
2015-04-28 13:51:25 -07:00
|
|
|
this.svgBackground_.style.fill =
|
Merge/05 24 (#903)
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Localisation updates from https://translatewiki.net.
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* Localisation updates from https://translatewiki.net.
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Localisation updates from https://translatewiki.net.
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 #661
* 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. (#934)
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 #946. Don't check for presence of constants.js
* Fix #945 (annotations) and an eslint issue (constant condition)
* Localisation updates from https://translatewiki.net.
* Fix #950: 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 #937.
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() (#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.
* Annotation fixes
* Fix bug #904 by explicitly grabbing focus on the workspace svg element. (#964)
* Potential fix for #888. Stops checking whether we are mid workspace drag since we do not always get mosue up events when blockly is in an iframe. (#899)
* Adding new minimap demo
* Basic code style changes. Adding a few more comments. Return early if disableScrollChange in onScrollChange listener.
* `unction` to `function` corrects #962 (#970)
* Cross browser friendly fix for #904. This calls blur and focus from … (#972)
* Cross browser friendly fix for #904. 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 #904 to keep the page from jumping to the focused workspace in IE 11 (#974)
* 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 #967 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 d55d9cbd9ff308ff5e361cf77acabb61a4bf4695). IIUC, updateWidth/getCachedWidth was only called from render before which is overridden in FieldImage to be a no-op already. (#979)
* Fix #969
* Localisation updates from https://translatewiki.net.
* Fix #986. Looks like the original PR just forgot this block. (#992)
* rebuild develop (#996)
* Added the variable modal and component and implemented basic renaming functionality. (#991)
* Fixing commenting from the last commit. (#1000)
* 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. (#1011)
* Minimap position bug fix for browsers other than chrome. Added touch support.
* Adding an add variable modal to accessible Blockly. (#1015)
* 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. (#1017)
Centralizes accessible modal behavior.
* - Changed error message referencing 'procedure' instead of 'function' (#1019)
- 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,… (#1028)
...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). (#1027)
* Enable google/blockly with continuous build on travis ci (#1023) (#1035)
* 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 #880.
* Ensure useDragSurface is a boolean.
Fixed #988
* use pretest instead of preinstall in package.json (#1043)
* 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 #973
* bumpNeighbours_ function moved to block_svg.
Fixed #1009
* Update RegEx in js-to-json to match windowi eol (#1050)
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 (#1053)
"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. (#1054)
* Correcting #1054 (#1056)
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… (#1057)
* Change how blockly handles cursors. The old way was quite slow because it changed the stylesheet directly. See issue #981 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. (#1059)
* Merge master into develop (#1063)
- pick up translation changes
- clean up trailing spaces
* use goog.string.startswith instead of string.startswith (#1065)
* New jsinterpreter demo includes wait block. Both demos have improved UI for clarity. (#1001)
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 #1069 (#1073)
* VariableMap and functions added.
* Fix #1051 (#1084)
* Improve errors when validating JSON block definitions. (#1086)
goog.asserts to not run from blockly_compressed.js. User data validation should always run.
* Dragging changes, rebased on develop (#1078)
* 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 (#1026)
-- 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 (#1048)
- Removed gestureDB
- Removing uses of terminateDrag
- Cleaned up disposal code
* Dragging bugfixes (#1058)
- 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 (#1060)
* 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. (#1081)
* add osx travis test run job (#1074)
* Names are correctly fetched from VariableModels!
* add more wait time for test setup (#1091)
* Work around timing issue with travis osx issue (#1092)
* add more wait time for test setup
* increase selenium wait time
* add more wait
* Fix #1077 by adding a rule to cover the toolbox labels too. (#1099)
* Assign variable UUID to field_variable dropdown.
* Change registration link to a static one (#1106)
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 (#1111)
* Click events on shadow blocks have the correct id (#1089)
* Add image_onclick option (#1080)
* Cleanup: semicolons, spacing, etc. (#1116)
* Spelling. Spelling is hard.
* Add variable info to xml generated in variables.js
* Add missing CLAs info to the contributing file (#1119)
* Add missing CLAs info to the contributing file
* Added larger changes paragraph
* Replacing latest prettifier hosted in repo with latest version at rawgit CDN. (#1120)
* Forgot update code demo (#1121)
* Move audio code to a new file (#1122)
* 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 (#1126)
* Include variables at top of serialization.
* Move blockSvg.getHeightWidth to block_render_svg.js (#1118)
* Deserialization variables at top.
* Create grid object (#1131)
* 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
|
|
|
'url(#' + this.grid_.getPatternId() + ')';
|
2015-04-28 13:51:25 -07:00
|
|
|
}
|
2015-03-07 19:44:58 -06:00
|
|
|
}
|
2015-12-01 14:04:54 -06:00
|
|
|
/** @type {SVGElement} */
|
2017-02-02 14:17:43 -05:00
|
|
|
this.svgBlockCanvas_ = Blockly.utils.createSvgElement('g',
|
2015-08-19 17:21:05 -07:00
|
|
|
{'class': 'blocklyBlockCanvas'}, this.svgGroup_, this);
|
2015-12-01 14:04:54 -06:00
|
|
|
/** @type {SVGElement} */
|
2017-02-02 14:17:43 -05:00
|
|
|
this.svgBubbleCanvas_ = Blockly.utils.createSvgElement('g',
|
2015-08-19 17:21:05 -07:00
|
|
|
{'class': 'blocklyBubbleCanvas'}, this.svgGroup_, this);
|
2015-09-01 22:44:33 +01:00
|
|
|
var bottom = Blockly.Scrollbar.scrollbarThickness;
|
2015-04-28 13:51:25 -07:00
|
|
|
if (this.options.hasTrashcan) {
|
2015-09-01 22:44:33 +01:00
|
|
|
bottom = this.addTrashcan_(bottom);
|
2015-04-28 13:51:25 -07:00
|
|
|
}
|
2015-08-19 17:21:05 -07:00
|
|
|
if (this.options.zoomOptions && this.options.zoomOptions.controls) {
|
2018-05-02 15:32:28 -07:00
|
|
|
this.addZoomControls_(bottom);
|
2015-08-19 17:21:05 -07:00
|
|
|
}
|
2016-07-01 13:36:20 -07:00
|
|
|
|
|
|
|
if (!this.isFlyout) {
|
2016-09-23 13:46:11 -07:00
|
|
|
Blockly.bindEventWithChecks_(this.svgGroup_, 'mousedown', this,
|
|
|
|
this.onMouseDown_);
|
2016-07-01 13:36:20 -07:00
|
|
|
if (this.options.zoomOptions && this.options.zoomOptions.wheel) {
|
|
|
|
// Mouse-wheel.
|
2016-09-23 13:46:11 -07:00
|
|
|
Blockly.bindEventWithChecks_(this.svgGroup_, 'wheel', this,
|
|
|
|
this.onMouseWheel_);
|
2016-07-01 13:36:20 -07:00
|
|
|
}
|
2015-08-19 17:21:05 -07:00
|
|
|
}
|
2015-04-28 13:51:25 -07:00
|
|
|
|
|
|
|
// Determine if there needs to be a category tree, or a simple list of
|
|
|
|
// blocks. This cannot be changed later, since the UI is very different.
|
|
|
|
if (this.options.hasCategories) {
|
2016-10-26 18:39:56 -07:00
|
|
|
/**
|
2016-09-30 16:26:44 -05:00
|
|
|
* @type {Blockly.Toolbox}
|
|
|
|
* @private
|
|
|
|
*/
|
2015-04-28 13:51:25 -07:00
|
|
|
this.toolbox_ = new Blockly.Toolbox(this);
|
|
|
|
}
|
Merge/05 24 (#903)
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Localisation updates from https://translatewiki.net.
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* Localisation updates from https://translatewiki.net.
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Localisation updates from https://translatewiki.net.
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 #661
* 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. (#934)
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 #946. Don't check for presence of constants.js
* Fix #945 (annotations) and an eslint issue (constant condition)
* Localisation updates from https://translatewiki.net.
* Fix #950: 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 #937.
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() (#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.
* Annotation fixes
* Fix bug #904 by explicitly grabbing focus on the workspace svg element. (#964)
* Potential fix for #888. Stops checking whether we are mid workspace drag since we do not always get mosue up events when blockly is in an iframe. (#899)
* Adding new minimap demo
* Basic code style changes. Adding a few more comments. Return early if disableScrollChange in onScrollChange listener.
* `unction` to `function` corrects #962 (#970)
* Cross browser friendly fix for #904. This calls blur and focus from … (#972)
* Cross browser friendly fix for #904. 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 #904 to keep the page from jumping to the focused workspace in IE 11 (#974)
* 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 #967 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 d55d9cbd9ff308ff5e361cf77acabb61a4bf4695). IIUC, updateWidth/getCachedWidth was only called from render before which is overridden in FieldImage to be a no-op already. (#979)
* Fix #969
* Localisation updates from https://translatewiki.net.
* Fix #986. Looks like the original PR just forgot this block. (#992)
* rebuild develop (#996)
* Added the variable modal and component and implemented basic renaming functionality. (#991)
* Fixing commenting from the last commit. (#1000)
* 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. (#1011)
* Minimap position bug fix for browsers other than chrome. Added touch support.
* Adding an add variable modal to accessible Blockly. (#1015)
* 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. (#1017)
Centralizes accessible modal behavior.
* - Changed error message referencing 'procedure' instead of 'function' (#1019)
- 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,… (#1028)
...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). (#1027)
* Enable google/blockly with continuous build on travis ci (#1023) (#1035)
* 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 #880.
* Ensure useDragSurface is a boolean.
Fixed #988
* use pretest instead of preinstall in package.json (#1043)
* 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 #973
* bumpNeighbours_ function moved to block_svg.
Fixed #1009
* Update RegEx in js-to-json to match windowi eol (#1050)
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 (#1053)
"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. (#1054)
* Correcting #1054 (#1056)
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… (#1057)
* Change how blockly handles cursors. The old way was quite slow because it changed the stylesheet directly. See issue #981 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. (#1059)
* Merge master into develop (#1063)
- pick up translation changes
- clean up trailing spaces
* use goog.string.startswith instead of string.startswith (#1065)
* New jsinterpreter demo includes wait block. Both demos have improved UI for clarity. (#1001)
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 #1069 (#1073)
* VariableMap and functions added.
* Fix #1051 (#1084)
* Improve errors when validating JSON block definitions. (#1086)
goog.asserts to not run from blockly_compressed.js. User data validation should always run.
* Dragging changes, rebased on develop (#1078)
* 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 (#1026)
-- 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 (#1048)
- Removed gestureDB
- Removing uses of terminateDrag
- Cleaned up disposal code
* Dragging bugfixes (#1058)
- 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 (#1060)
* 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. (#1081)
* add osx travis test run job (#1074)
* Names are correctly fetched from VariableModels!
* add more wait time for test setup (#1091)
* Work around timing issue with travis osx issue (#1092)
* add more wait time for test setup
* increase selenium wait time
* add more wait
* Fix #1077 by adding a rule to cover the toolbox labels too. (#1099)
* Assign variable UUID to field_variable dropdown.
* Change registration link to a static one (#1106)
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 (#1111)
* Click events on shadow blocks have the correct id (#1089)
* Add image_onclick option (#1080)
* Cleanup: semicolons, spacing, etc. (#1116)
* Spelling. Spelling is hard.
* Add variable info to xml generated in variables.js
* Add missing CLAs info to the contributing file (#1119)
* Add missing CLAs info to the contributing file
* Added larger changes paragraph
* Replacing latest prettifier hosted in repo with latest version at rawgit CDN. (#1120)
* Forgot update code demo (#1121)
* Move audio code to a new file (#1122)
* 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 (#1126)
* Include variables at top of serialization.
* Move blockSvg.getHeightWidth to block_render_svg.js (#1118)
* Deserialization variables at top.
* Create grid object (#1131)
* 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
|
|
|
if (this.grid_) {
|
|
|
|
this.grid_.update(this.scale);
|
|
|
|
}
|
2018-02-16 17:32:13 -05:00
|
|
|
this.recordCachedAreas();
|
2014-12-23 11:22:02 -08:00
|
|
|
return this.svgGroup_;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Dispose of this workspace.
|
|
|
|
* Unlink from all DOM elements to prevent memory leaks.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.dispose = function() {
|
|
|
|
// Stop rerendering.
|
|
|
|
this.rendered = false;
|
2017-05-22 13:08:22 -07:00
|
|
|
if (this.currentGesture_) {
|
|
|
|
this.currentGesture_.cancel();
|
|
|
|
}
|
2014-12-23 11:22:02 -08:00
|
|
|
Blockly.WorkspaceSvg.superClass_.dispose.call(this);
|
|
|
|
if (this.svgGroup_) {
|
|
|
|
goog.dom.removeNode(this.svgGroup_);
|
|
|
|
this.svgGroup_ = null;
|
|
|
|
}
|
|
|
|
this.svgBlockCanvas_ = null;
|
|
|
|
this.svgBubbleCanvas_ = null;
|
2015-06-04 12:04:43 -07:00
|
|
|
if (this.toolbox_) {
|
|
|
|
this.toolbox_.dispose();
|
|
|
|
this.toolbox_ = null;
|
|
|
|
}
|
2014-12-23 11:22:02 -08:00
|
|
|
if (this.flyout_) {
|
|
|
|
this.flyout_.dispose();
|
|
|
|
this.flyout_ = null;
|
|
|
|
}
|
|
|
|
if (this.trashcan) {
|
|
|
|
this.trashcan.dispose();
|
|
|
|
this.trashcan = null;
|
|
|
|
}
|
2015-08-20 15:46:44 -07:00
|
|
|
if (this.scrollbar) {
|
|
|
|
this.scrollbar.dispose();
|
|
|
|
this.scrollbar = null;
|
|
|
|
}
|
|
|
|
if (this.zoomControls_) {
|
|
|
|
this.zoomControls_.dispose();
|
|
|
|
this.zoomControls_ = null;
|
2015-08-19 17:21:05 -07:00
|
|
|
}
|
Feature/merge feb 2017 (#791)
* 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 c8ca24a0007b70e137417e843459c87185141a55.
* 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… (#732)
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. (#748)
* 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 (#741)
* 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. (#749)
* 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 #758.
* Split the scrollbar and flyout out into their own SVG elements. They (#771)
* 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. (#699)
* Fix #698 by adjusting the regex to not have \. Still not 100% sure w… (#700)
* Fix #698 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… (#777)
* 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… (#778)
* 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 #748 and stop using contains since it is not supported in IE
* Fixes #786 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. (#787)
* 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 #791.
* Localisation updates from https://translatewiki.net.
* Localisation updates from https://translatewiki.net.
* Use the drag surface when scrolling using the scrollbars. #783 (#789)
* End event groups when you finish editing a field
* Fix #794 and make the workspace grid drag along with the workspace. (#801)
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. (#790)
* 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. (#805)
* Don't connect to blocks under the flyout.
* recompile again. (#806)
* 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 #813 by ademenev
* PR #818: 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. (#820)
From commits b77f8cbebc5cef247116d3df6a428df8addbe53d and 4ecdedec9f8a69f78abf246e7a5db1e1a0be6b85
* Naming changes in mirror demo
* Adding support for untranslated messages. (#819)
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. (#825)
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 #828.
* 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" (#832)
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. (#836)
Fixes commits in #832.
* Adding extensions for JSON support of dynamic blocks. (#834)
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 … (#837)
* 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 #816 so that layering of the flyout and workspace scrollbars
are done correctly.
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 12:09:23 -08:00
|
|
|
|
Merge/05 24 (#903)
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Localisation updates from https://translatewiki.net.
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* Localisation updates from https://translatewiki.net.
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Localisation updates from https://translatewiki.net.
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 #661
* 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. (#934)
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 #946. Don't check for presence of constants.js
* Fix #945 (annotations) and an eslint issue (constant condition)
* Localisation updates from https://translatewiki.net.
* Fix #950: 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 #937.
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() (#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.
* Annotation fixes
* Fix bug #904 by explicitly grabbing focus on the workspace svg element. (#964)
* Potential fix for #888. Stops checking whether we are mid workspace drag since we do not always get mosue up events when blockly is in an iframe. (#899)
* Adding new minimap demo
* Basic code style changes. Adding a few more comments. Return early if disableScrollChange in onScrollChange listener.
* `unction` to `function` corrects #962 (#970)
* Cross browser friendly fix for #904. This calls blur and focus from … (#972)
* Cross browser friendly fix for #904. 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 #904 to keep the page from jumping to the focused workspace in IE 11 (#974)
* 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 #967 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 d55d9cbd9ff308ff5e361cf77acabb61a4bf4695). IIUC, updateWidth/getCachedWidth was only called from render before which is overridden in FieldImage to be a no-op already. (#979)
* Fix #969
* Localisation updates from https://translatewiki.net.
* Fix #986. Looks like the original PR just forgot this block. (#992)
* rebuild develop (#996)
* Added the variable modal and component and implemented basic renaming functionality. (#991)
* Fixing commenting from the last commit. (#1000)
* 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. (#1011)
* Minimap position bug fix for browsers other than chrome. Added touch support.
* Adding an add variable modal to accessible Blockly. (#1015)
* 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. (#1017)
Centralizes accessible modal behavior.
* - Changed error message referencing 'procedure' instead of 'function' (#1019)
- 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,… (#1028)
...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). (#1027)
* Enable google/blockly with continuous build on travis ci (#1023) (#1035)
* 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 #880.
* Ensure useDragSurface is a boolean.
Fixed #988
* use pretest instead of preinstall in package.json (#1043)
* 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 #973
* bumpNeighbours_ function moved to block_svg.
Fixed #1009
* Update RegEx in js-to-json to match windowi eol (#1050)
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 (#1053)
"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. (#1054)
* Correcting #1054 (#1056)
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… (#1057)
* Change how blockly handles cursors. The old way was quite slow because it changed the stylesheet directly. See issue #981 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. (#1059)
* Merge master into develop (#1063)
- pick up translation changes
- clean up trailing spaces
* use goog.string.startswith instead of string.startswith (#1065)
* New jsinterpreter demo includes wait block. Both demos have improved UI for clarity. (#1001)
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 #1069 (#1073)
* VariableMap and functions added.
* Fix #1051 (#1084)
* Improve errors when validating JSON block definitions. (#1086)
goog.asserts to not run from blockly_compressed.js. User data validation should always run.
* Dragging changes, rebased on develop (#1078)
* 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 (#1026)
-- 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 (#1048)
- Removed gestureDB
- Removing uses of terminateDrag
- Cleaned up disposal code
* Dragging bugfixes (#1058)
- 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 (#1060)
* 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. (#1081)
* add osx travis test run job (#1074)
* Names are correctly fetched from VariableModels!
* add more wait time for test setup (#1091)
* Work around timing issue with travis osx issue (#1092)
* add more wait time for test setup
* increase selenium wait time
* add more wait
* Fix #1077 by adding a rule to cover the toolbox labels too. (#1099)
* Assign variable UUID to field_variable dropdown.
* Change registration link to a static one (#1106)
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 (#1111)
* Click events on shadow blocks have the correct id (#1089)
* Add image_onclick option (#1080)
* Cleanup: semicolons, spacing, etc. (#1116)
* Spelling. Spelling is hard.
* Add variable info to xml generated in variables.js
* Add missing CLAs info to the contributing file (#1119)
* Add missing CLAs info to the contributing file
* Added larger changes paragraph
* Replacing latest prettifier hosted in repo with latest version at rawgit CDN. (#1120)
* Forgot update code demo (#1121)
* Move audio code to a new file (#1122)
* 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 (#1126)
* Include variables at top of serialization.
* Move blockSvg.getHeightWidth to block_render_svg.js (#1118)
* Deserialization variables at top.
* Create grid object (#1131)
* 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
|
|
|
if (this.audioManager_) {
|
|
|
|
this.audioManager_.dispose();
|
|
|
|
this.audioManager_ = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.grid_) {
|
|
|
|
this.grid_.dispose();
|
|
|
|
this.grid_ = null;
|
|
|
|
}
|
|
|
|
|
Feature/merge feb 2017 (#791)
* 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 c8ca24a0007b70e137417e843459c87185141a55.
* 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… (#732)
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. (#748)
* 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 (#741)
* 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. (#749)
* 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 #758.
* Split the scrollbar and flyout out into their own SVG elements. They (#771)
* 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. (#699)
* Fix #698 by adjusting the regex to not have \. Still not 100% sure w… (#700)
* Fix #698 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… (#777)
* 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… (#778)
* 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 #748 and stop using contains since it is not supported in IE
* Fixes #786 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. (#787)
* 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 #791.
* Localisation updates from https://translatewiki.net.
* Localisation updates from https://translatewiki.net.
* Use the drag surface when scrolling using the scrollbars. #783 (#789)
* End event groups when you finish editing a field
* Fix #794 and make the workspace grid drag along with the workspace. (#801)
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. (#790)
* 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. (#805)
* Don't connect to blocks under the flyout.
* recompile again. (#806)
* 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 #813 by ademenev
* PR #818: 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. (#820)
From commits b77f8cbebc5cef247116d3df6a428df8addbe53d and 4ecdedec9f8a69f78abf246e7a5db1e1a0be6b85
* Naming changes in mirror demo
* Adding support for untranslated messages. (#819)
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. (#825)
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 #828.
* 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" (#832)
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. (#836)
Fixes commits in #832.
* Adding extensions for JSON support of dynamic blocks. (#834)
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 … (#837)
* 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 #816 so that layering of the flyout and workspace scrollbars
are done correctly.
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 12:09:23 -08:00
|
|
|
if (this.toolboxCategoryCallbacks_) {
|
|
|
|
this.toolboxCategoryCallbacks_ = null;
|
|
|
|
}
|
|
|
|
if (this.flyoutButtonCallbacks_) {
|
|
|
|
this.flyoutButtonCallbacks_ = null;
|
|
|
|
}
|
2015-05-02 21:08:18 -07:00
|
|
|
if (!this.options.parentWorkspace) {
|
2016-08-11 11:00:02 -07:00
|
|
|
// Top-most workspace. Dispose of the div that the
|
2018-04-26 17:06:12 -07:00
|
|
|
// SVG is injected into (i.e. injectionDiv).
|
2016-08-11 11:00:02 -07:00
|
|
|
goog.dom.removeNode(this.getParentSvg().parentNode);
|
2015-05-02 21:08:18 -07:00
|
|
|
}
|
Merge google/develop June 22 (#441)
* Localisation updates from https://translatewiki.net.
* test page that creates random blocks and randomly drags them around the page
* Localisation updates from https://translatewiki.net.
* add missing return in fake drag
* get rid of drag_tests file:
* Generated JS helper functions should be camelCase.
Complying with Google style guide.
* Localisation updates from https://translatewiki.net.
* Fix extra category error. Clean up code, rename variables, reduce line lengths, fix lint issues.
* Remove claim that good.string.quote should be used.
* Change the blockly workspace resizing strategy. (#386)
* Add a new method to be called when the contents of the workspace change and
the scrollbars need to be adjusted but the the chrome (trash, toolbox, etc)
are expected to stay in the same place.
Change a bunch of calls to svgResize to either be removed or call the new
method instead. This is a nice performance win since the offsetHeight/Width
call in svgResize can be expensive, especially when called as often as we do -
there was some layout thrashing.
This also paves the way for moving calls to recordDeleteAreas
(which is also expensive) to a more cacheable spot than on every
mouse down/touch event.
of things (namely the scrollbars)
* Fix size of graph demo when it first loads by calling svgResize.
The graph starts with fixed width and was relying on a resize event
to fire (which I believe was removed in commit
217c681b86b0f2df76c479c9efae62e6e).
* Fix the resizing of the code demo. The demo's tab min-width used to
match the toolbox's width was only being set on a resize event, but
commit 217c681b86b0f2df76c479c9efae62e6e changed how that worked.
* Fix up some comments.
* Use specific workspaces rather than Blockly.getMainWorkspace().
* Make workspace required for resizeSvgContents and update
some calls to send real workspaces rather than ones that are
null.
Remove the private tag on terminateDrag_ because it is only
actually called from outside the BlockSvg object.
* Remove a rogue period.
* Recategorize BlockSvg.terminateDrag_ to @package instead of @private so that
other developers don't use it, but it still can be used by other Blockly classes.
* Add a TODO to fix issue #307.
* Add @package to workspace resizeContents.
* Routine recompile
* Fix unit tests.
* Fix inheritance on rendered connection.
Closure compiler on maximum compression breaks badly due to lack of
@extends attribute.
* Add toolbox location and toolbox mode options to playground.
* Increase commonality between playgrounds.
* Properly deal with shadow statement blocks in stacks.
* Localisation updates from https://translatewiki.net.
* Use a comment block for function comments in generated JS, Python and Dart.
* Fix typo in flyout.js (#403)
* Fix typo in flyout.js (#402)
* Line wrap comments in generated code.
* Remove reference to undefined variable (#413)
REASON_MUST_DISCONNECT was removed by a refactor in 2a1ffa1.
* Fix airstrike by grabbing the correct toolbox element. (#411)
Probably broken in 266e2ffa9a017d21d7ca2f151730d6ecfcecf173.
* Localisation updates from https://translatewiki.net.
* Fix issue #406 by calling resize from the keypress handler on text inputs. (#408)
* Remove shadow blocks from Accessible Blockly demo. Update README.
* Generate for loops on one line.
* Introduce a common translation pipe; remove local stringMap attributes. Fix variable name error in paste functions. Minor linting.
* Fix precedence on isIndex blocks.
* Add indexing setting for JavaScript Generation (#419)
Adding setting to allow for switching between zero and one based indexing for Blockly Blocks such that the generated code will use this flag to determine whether one based or zero based indexing should be used. One based indexing is enabled by default.
* Remove unused functions and dependencies.
* Remove the unnecessary construction of new services.
* Fix sort block in JS to satisfy tests.
* Trigger a contents resize in block's moveBy. (#422)
This fixes #420 but and it also fixes some other similar problems
with copy/paste and other users of moveBy.
* Consolidate the usages of the 'blockly-disabled' label.
* Fix error when undoing a shadow block replacement. Issue #415.
* Unify setActiveDesc() and updateSelectedNode() in the TreeService. Move function calls made directly within the template to the correct hooks.
* Standardize naming of components.
* Prevent collisions between user functions and helper functions.
* Localisation updates from https://translatewiki.net.
* Fix #425. Attash the resize handler to the workspace so it can be removed (#429)
when workspace.dispose() is called.
* Change the TreeService to a singleton.
* Remove unneeded generated parens around function calls in indexOf blocks.
* Fix #423 by calling workspace's resize when the flyout reflows. (#430)
* Updating URLs to reflect new docs. (#418)
* Updating URLs to reflect new docs. Removing -blockly in URLs.
* Rebuilt.
* Routine recompile
* Prevent selected block from ending up underneath a bumped block.
* Fix undo on fields with validators with side effects.
* Don't fire change event on fields that haven't been named yet.
* Localisation updates from https://translatewiki.net.
* Fix tree focus issues.
* Fix remaining focus issues on block deletion.
* cache delete areas instead of recalculating them onMouseDown
* Cache screen CTM for performance improvement.
* Call svgResizeContents from block_svg's dipose so that deleting blocks (#434)
from the context menu (or anywhere really) causes the workspace to
recalculate its size.
Remove the call to svgResizeContents from onMouseUp's logic for
determining whether the block is being dropped in the trash
since it calls dispose.
One side effect of this is that when you delete multiple blocks
resize gets called for each of them and the scrollbars move during
the operation. This is most obviously seen by doing an airstrike
in the playground and then deleting all the blocks at once.
* Allow terminal blocks to replace other terminal blocks (#433)
* Allow terminal blocks to replace other terminal blocks
* Updated test to allow replacing terminal blocks
* Refactor how activeDescendant is set. Introduce helper functions to ensure that calls like pasteAbove() preserve the focus.
* Localisation updates from https://translatewiki.net.
* Remove unnecessary logging.
* Reduce unneeded parentheses in JS and Python.
* Start using field_number.
* Make it easy to disable unconnected blocks.
* Routine recompile.
* Check if matrix is null in mouseToSvg
* Remove js/ localizations pre-merge
* Fix change to block_render_svg
* Fix error in xml.js
* Playground merge
* Add simple toolboxes to playgrounds
* Fix flyout reference in events listener
* Move tokenizeIntepolation into Blockly.utils namespace.
* Use simpler message interpolation in Code demo.
* Create console stub for IE 9.
* Don't output blockId if not set (e.g., toolbox category event). (#443)
* Fix block in multi-playground
* Increase commonality between playgrounds.
# Conflicts:
# tests/multi_playground.html
# tests/playground.html
* Remove "show flyouts" button
* Recompile for merge June 22
2016-06-22 17:50:16 -04:00
|
|
|
if (this.resizeHandlerWrapper_) {
|
|
|
|
Blockly.unbindEvent_(this.resizeHandlerWrapper_);
|
|
|
|
this.resizeHandlerWrapper_ = null;
|
|
|
|
}
|
2014-12-23 11:22:02 -08:00
|
|
|
};
|
|
|
|
|
2015-12-07 16:40:45 +01:00
|
|
|
/**
|
|
|
|
* Obtain a newly created block.
|
|
|
|
* @param {?string} prototypeName Name of the language object containing
|
|
|
|
* type-specific functions for this block.
|
2016-05-10 13:08:56 -04:00
|
|
|
* @param {string=} opt_id Optional ID. Use this ID if provided, otherwise
|
2016-10-11 12:16:17 -07:00
|
|
|
* create a new ID.
|
2015-12-07 16:40:45 +01:00
|
|
|
* @return {!Blockly.BlockSvg} The created block.
|
|
|
|
*/
|
2015-12-09 10:02:42 +01:00
|
|
|
Blockly.WorkspaceSvg.prototype.newBlock = function(prototypeName, opt_id) {
|
|
|
|
return new Blockly.BlockSvg(this, prototypeName, opt_id);
|
2015-12-07 16:40:45 +01:00
|
|
|
};
|
|
|
|
|
2014-12-23 11:22:02 -08:00
|
|
|
/**
|
|
|
|
* Add a trashcan.
|
2015-09-01 22:44:33 +01:00
|
|
|
* @param {number} bottom Distance from workspace bottom to bottom of trashcan.
|
|
|
|
* @return {number} Distance from workspace bottom to the top of trashcan.
|
2015-04-28 13:51:25 -07:00
|
|
|
* @private
|
2014-12-23 11:22:02 -08:00
|
|
|
*/
|
2015-09-01 22:44:33 +01:00
|
|
|
Blockly.WorkspaceSvg.prototype.addTrashcan_ = function(bottom) {
|
2015-08-20 15:46:44 -07:00
|
|
|
/** @type {Blockly.Trashcan} */
|
2015-04-28 13:51:25 -07:00
|
|
|
this.trashcan = new Blockly.Trashcan(this);
|
|
|
|
var svgTrashcan = this.trashcan.createDom();
|
|
|
|
this.svgGroup_.insertBefore(svgTrashcan, this.svgBlockCanvas_);
|
2015-09-01 22:44:33 +01:00
|
|
|
return this.trashcan.init(bottom);
|
2014-12-23 11:22:02 -08:00
|
|
|
};
|
|
|
|
|
2015-08-19 17:21:05 -07:00
|
|
|
/**
|
|
|
|
* Add zoom controls.
|
2015-09-01 22:44:33 +01:00
|
|
|
* @param {number} bottom Distance from workspace bottom to bottom of controls.
|
|
|
|
* @return {number} Distance from workspace bottom to the top of controls.
|
2015-08-19 17:21:05 -07:00
|
|
|
* @private
|
|
|
|
*/
|
2015-09-01 22:44:33 +01:00
|
|
|
Blockly.WorkspaceSvg.prototype.addZoomControls_ = function(bottom) {
|
2015-08-20 15:46:44 -07:00
|
|
|
/** @type {Blockly.ZoomControls} */
|
|
|
|
this.zoomControls_ = new Blockly.ZoomControls(this);
|
|
|
|
var svgZoomControls = this.zoomControls_.createDom();
|
2015-08-19 17:21:05 -07:00
|
|
|
this.svgGroup_.appendChild(svgZoomControls);
|
2015-09-01 22:44:33 +01:00
|
|
|
return this.zoomControls_.init(bottom);
|
2015-08-19 17:21:05 -07:00
|
|
|
};
|
|
|
|
|
2015-03-06 15:27:41 -06:00
|
|
|
/**
|
2017-02-02 14:17:43 -05:00
|
|
|
* Add a flyout element in an element with the given tag name.
|
|
|
|
* @param {string} tagName What type of tag the flyout belongs in.
|
2018-04-26 17:06:12 -07:00
|
|
|
* @return {!Element} The element containing the flyout DOM.
|
2015-04-28 13:51:25 -07:00
|
|
|
* @private
|
2015-03-06 15:27:41 -06:00
|
|
|
*/
|
2017-02-02 14:17:43 -05:00
|
|
|
Blockly.WorkspaceSvg.prototype.addFlyout_ = function(tagName) {
|
2015-04-28 13:51:25 -07:00
|
|
|
var workspaceOptions = {
|
2015-10-21 15:21:51 -07:00
|
|
|
disabledPatternId: this.options.disabledPatternId,
|
2015-04-28 13:51:25 -07:00
|
|
|
parentWorkspace: this,
|
2016-02-11 14:46:51 -08:00
|
|
|
RTL: this.RTL,
|
2016-10-11 11:03:03 -07:00
|
|
|
oneBasedIndex: this.options.oneBasedIndex,
|
2016-02-12 10:57:33 -08:00
|
|
|
horizontalLayout: this.horizontalLayout,
|
2018-06-01 10:13:37 -04:00
|
|
|
toolboxPosition: this.options.toolboxPosition,
|
|
|
|
stackGlowFilterId: this.options.stackGlowFilterId
|
2015-04-28 13:51:25 -07:00
|
|
|
};
|
2016-09-08 16:54:10 -07:00
|
|
|
if (this.horizontalLayout) {
|
|
|
|
this.flyout_ = new Blockly.HorizontalFlyout(workspaceOptions);
|
|
|
|
} else {
|
|
|
|
this.flyout_ = new Blockly.VerticalFlyout(workspaceOptions);
|
|
|
|
}
|
2015-03-07 19:44:58 -06:00
|
|
|
this.flyout_.autoClose = false;
|
2017-02-02 14:17:43 -05:00
|
|
|
|
|
|
|
// Return the element so that callers can place it in their desired
|
2018-04-26 17:06:12 -07:00
|
|
|
// spot in the DOM. For example, mutator flyouts do not go in the same place
|
2017-02-02 14:17:43 -05:00
|
|
|
// as main workspace flyouts.
|
|
|
|
return this.flyout_.createDom(tagName);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Getter for the flyout associated with this workspace. This flyout may be
|
|
|
|
* owned by either the toolbox or the workspace, depending on toolbox
|
|
|
|
* configuration. It will be null if there is no flyout.
|
|
|
|
* @return {Blockly.Flyout} The flyout on this workspace.
|
Merge google/blockly, May 2017 (#881)
* Move createDom call into the constructor of block drag surface. (#790)
* 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. (#805)
* Don't connect to blocks under the flyout.
* recompile again. (#806)
* 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 #813 by ademenev
* Localisation updates from https://translatewiki.net.
* PR #818: 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. (#820)
From commits b77f8cbebc5cef247116d3df6a428df8addbe53d and 4ecdedec9f8a69f78abf246e7a5db1e1a0be6b85
* Naming changes in mirror demo
* Adding support for untranslated messages. (#819)
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. (#825)
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 #828.
* 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" (#832)
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. (#836)
Fixes commits in #832.
* Adding extensions for JSON support of dynamic blocks. (#834)
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 … (#837)
* 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 #816 so that layering of the flyout and workspace scrollbars
are done correctly.
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Localisation updates from https://translatewiki.net.
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* Localisation updates from https://translatewiki.net.
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Localisation updates from https://translatewiki.net.
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 #661
* 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. (#934)
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 #946. Don't check for presence of constants.js
* Fix #945 (annotations) and an eslint issue (constant condition)
* Localisation updates from https://translatewiki.net.
* Fix #950: 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 #937.
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() (#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.
* Annotation fixes
* Fix bug #904 by explicitly grabbing focus on the workspace svg element. (#964)
* Potential fix for #888. Stops checking whether we are mid workspace drag since we do not always get mosue up events when blockly is in an iframe. (#899)
* Adding new minimap demo
* Basic code style changes. Adding a few more comments. Return early if disableScrollChange in onScrollChange listener.
* `unction` to `function` corrects #962 (#970)
* Cross browser friendly fix for #904. This calls blur and focus from … (#972)
* Cross browser friendly fix for #904. 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 #904 to keep the page from jumping to the focused workspace in IE 11 (#974)
* 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 #967 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 d55d9cbd9ff308ff5e361cf77acabb61a4bf4695). IIUC, updateWidth/getCachedWidth was only called from render before which is overridden in FieldImage to be a no-op already. (#979)
* Fix #969
* Localisation updates from https://translatewiki.net.
* Fix #986. Looks like the original PR just forgot this block. (#992)
* rebuild develop (#996)
* Added the variable modal and component and implemented basic renaming functionality. (#991)
* Fixing commenting from the last commit. (#1000)
* 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. (#1011)
* Minimap position bug fix for browsers other than chrome. Added touch support.
* Adding an add variable modal to accessible Blockly. (#1015)
* 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. (#1017)
Centralizes accessible modal behavior.
* - Changed error message referencing 'procedure' instead of 'function' (#1019)
- 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,… (#1028)
...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). (#1027)
* Enable google/blockly with continuous build on travis ci (#1023) (#1035)
* 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 #880.
* Ensure useDragSurface is a boolean.
Fixed #988
* use pretest instead of preinstall in package.json (#1043)
* 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 #973
* bumpNeighbours_ function moved to block_svg.
Fixed #1009
* Update RegEx in js-to-json to match windowi eol (#1050)
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 (#1053)
"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. (#1054)
* Correcting #1054 (#1056)
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… (#1057)
* Change how blockly handles cursors. The old way was quite slow because it changed the stylesheet directly. See issue #981 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. (#1059)
* Merge master into develop (#1063)
- pick up translation changes
- clean up trailing spaces
* use goog.string.startswith instead of string.startswith (#1065)
* New jsinterpreter demo includes wait block. Both demos have improved UI for clarity. (#1001)
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 #1069 (#1073)
* 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
|
|
|
* @package
|
2017-02-02 14:17:43 -05:00
|
|
|
*/
|
Feature/merge feb 2017 (#791)
* 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 c8ca24a0007b70e137417e843459c87185141a55.
* 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… (#732)
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. (#748)
* 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 (#741)
* 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. (#749)
* 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 #758.
* Split the scrollbar and flyout out into their own SVG elements. They (#771)
* 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. (#699)
* Fix #698 by adjusting the regex to not have \. Still not 100% sure w… (#700)
* Fix #698 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… (#777)
* 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… (#778)
* 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 #748 and stop using contains since it is not supported in IE
* Fixes #786 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. (#787)
* 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 #791.
* Localisation updates from https://translatewiki.net.
* Localisation updates from https://translatewiki.net.
* Use the drag surface when scrolling using the scrollbars. #783 (#789)
* End event groups when you finish editing a field
* Fix #794 and make the workspace grid drag along with the workspace. (#801)
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. (#790)
* 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. (#805)
* Don't connect to blocks under the flyout.
* recompile again. (#806)
* 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 #813 by ademenev
* PR #818: 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. (#820)
From commits b77f8cbebc5cef247116d3df6a428df8addbe53d and 4ecdedec9f8a69f78abf246e7a5db1e1a0be6b85
* Naming changes in mirror demo
* Adding support for untranslated messages. (#819)
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. (#825)
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 #828.
* 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" (#832)
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. (#836)
Fixes commits in #832.
* Adding extensions for JSON support of dynamic blocks. (#834)
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 … (#837)
* 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 #816 so that layering of the flyout and workspace scrollbars
are done correctly.
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 12:09:23 -08:00
|
|
|
Blockly.WorkspaceSvg.prototype.getFlyout = function() {
|
2017-02-02 14:17:43 -05:00
|
|
|
if (this.flyout_) {
|
|
|
|
return this.flyout_;
|
|
|
|
}
|
|
|
|
if (this.toolbox_) {
|
|
|
|
return this.toolbox_.flyout_;
|
|
|
|
}
|
|
|
|
return null;
|
2015-03-06 15:27:41 -06:00
|
|
|
};
|
|
|
|
|
2018-05-11 16:35:31 -07:00
|
|
|
/**
|
|
|
|
* Getter for the toolbox associated with this workspace, if one exists.
|
|
|
|
* @return {Blockly.Toolbox} The toolbox on this workspace.
|
|
|
|
* @package
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.getToolbox = function() {
|
|
|
|
return this.toolbox_;
|
|
|
|
};
|
|
|
|
|
2016-08-10 18:00:15 -07:00
|
|
|
/**
|
|
|
|
* Update items that use screen coordinate calculations
|
|
|
|
* because something has changed (e.g. scroll position, window size).
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.updateScreenCalculations_ = function() {
|
|
|
|
this.updateInverseScreenCTM();
|
2018-02-16 17:32:13 -05:00
|
|
|
this.recordCachedAreas();
|
2016-08-10 18:00:15 -07:00
|
|
|
};
|
|
|
|
|
2015-04-28 17:55:45 -07:00
|
|
|
/**
|
2016-10-03 20:15:54 -04:00
|
|
|
* If enabled, resize the parts of the workspace that change when the workspace
|
Merge google/develop June 22 (#441)
* Localisation updates from https://translatewiki.net.
* test page that creates random blocks and randomly drags them around the page
* Localisation updates from https://translatewiki.net.
* add missing return in fake drag
* get rid of drag_tests file:
* Generated JS helper functions should be camelCase.
Complying with Google style guide.
* Localisation updates from https://translatewiki.net.
* Fix extra category error. Clean up code, rename variables, reduce line lengths, fix lint issues.
* Remove claim that good.string.quote should be used.
* Change the blockly workspace resizing strategy. (#386)
* Add a new method to be called when the contents of the workspace change and
the scrollbars need to be adjusted but the the chrome (trash, toolbox, etc)
are expected to stay in the same place.
Change a bunch of calls to svgResize to either be removed or call the new
method instead. This is a nice performance win since the offsetHeight/Width
call in svgResize can be expensive, especially when called as often as we do -
there was some layout thrashing.
This also paves the way for moving calls to recordDeleteAreas
(which is also expensive) to a more cacheable spot than on every
mouse down/touch event.
of things (namely the scrollbars)
* Fix size of graph demo when it first loads by calling svgResize.
The graph starts with fixed width and was relying on a resize event
to fire (which I believe was removed in commit
217c681b86b0f2df76c479c9efae62e6e).
* Fix the resizing of the code demo. The demo's tab min-width used to
match the toolbox's width was only being set on a resize event, but
commit 217c681b86b0f2df76c479c9efae62e6e changed how that worked.
* Fix up some comments.
* Use specific workspaces rather than Blockly.getMainWorkspace().
* Make workspace required for resizeSvgContents and update
some calls to send real workspaces rather than ones that are
null.
Remove the private tag on terminateDrag_ because it is only
actually called from outside the BlockSvg object.
* Remove a rogue period.
* Recategorize BlockSvg.terminateDrag_ to @package instead of @private so that
other developers don't use it, but it still can be used by other Blockly classes.
* Add a TODO to fix issue #307.
* Add @package to workspace resizeContents.
* Routine recompile
* Fix unit tests.
* Fix inheritance on rendered connection.
Closure compiler on maximum compression breaks badly due to lack of
@extends attribute.
* Add toolbox location and toolbox mode options to playground.
* Increase commonality between playgrounds.
* Properly deal with shadow statement blocks in stacks.
* Localisation updates from https://translatewiki.net.
* Use a comment block for function comments in generated JS, Python and Dart.
* Fix typo in flyout.js (#403)
* Fix typo in flyout.js (#402)
* Line wrap comments in generated code.
* Remove reference to undefined variable (#413)
REASON_MUST_DISCONNECT was removed by a refactor in 2a1ffa1.
* Fix airstrike by grabbing the correct toolbox element. (#411)
Probably broken in 266e2ffa9a017d21d7ca2f151730d6ecfcecf173.
* Localisation updates from https://translatewiki.net.
* Fix issue #406 by calling resize from the keypress handler on text inputs. (#408)
* Remove shadow blocks from Accessible Blockly demo. Update README.
* Generate for loops on one line.
* Introduce a common translation pipe; remove local stringMap attributes. Fix variable name error in paste functions. Minor linting.
* Fix precedence on isIndex blocks.
* Add indexing setting for JavaScript Generation (#419)
Adding setting to allow for switching between zero and one based indexing for Blockly Blocks such that the generated code will use this flag to determine whether one based or zero based indexing should be used. One based indexing is enabled by default.
* Remove unused functions and dependencies.
* Remove the unnecessary construction of new services.
* Fix sort block in JS to satisfy tests.
* Trigger a contents resize in block's moveBy. (#422)
This fixes #420 but and it also fixes some other similar problems
with copy/paste and other users of moveBy.
* Consolidate the usages of the 'blockly-disabled' label.
* Fix error when undoing a shadow block replacement. Issue #415.
* Unify setActiveDesc() and updateSelectedNode() in the TreeService. Move function calls made directly within the template to the correct hooks.
* Standardize naming of components.
* Prevent collisions between user functions and helper functions.
* Localisation updates from https://translatewiki.net.
* Fix #425. Attash the resize handler to the workspace so it can be removed (#429)
when workspace.dispose() is called.
* Change the TreeService to a singleton.
* Remove unneeded generated parens around function calls in indexOf blocks.
* Fix #423 by calling workspace's resize when the flyout reflows. (#430)
* Updating URLs to reflect new docs. (#418)
* Updating URLs to reflect new docs. Removing -blockly in URLs.
* Rebuilt.
* Routine recompile
* Prevent selected block from ending up underneath a bumped block.
* Fix undo on fields with validators with side effects.
* Don't fire change event on fields that haven't been named yet.
* Localisation updates from https://translatewiki.net.
* Fix tree focus issues.
* Fix remaining focus issues on block deletion.
* cache delete areas instead of recalculating them onMouseDown
* Cache screen CTM for performance improvement.
* Call svgResizeContents from block_svg's dipose so that deleting blocks (#434)
from the context menu (or anywhere really) causes the workspace to
recalculate its size.
Remove the call to svgResizeContents from onMouseUp's logic for
determining whether the block is being dropped in the trash
since it calls dispose.
One side effect of this is that when you delete multiple blocks
resize gets called for each of them and the scrollbars move during
the operation. This is most obviously seen by doing an airstrike
in the playground and then deleting all the blocks at once.
* Allow terminal blocks to replace other terminal blocks (#433)
* Allow terminal blocks to replace other terminal blocks
* Updated test to allow replacing terminal blocks
* Refactor how activeDescendant is set. Introduce helper functions to ensure that calls like pasteAbove() preserve the focus.
* Localisation updates from https://translatewiki.net.
* Remove unnecessary logging.
* Reduce unneeded parentheses in JS and Python.
* Start using field_number.
* Make it easy to disable unconnected blocks.
* Routine recompile.
* Check if matrix is null in mouseToSvg
* Remove js/ localizations pre-merge
* Fix change to block_render_svg
* Fix error in xml.js
* Playground merge
* Add simple toolboxes to playgrounds
* Fix flyout reference in events listener
* Move tokenizeIntepolation into Blockly.utils namespace.
* Use simpler message interpolation in Code demo.
* Create console stub for IE 9.
* Don't output blockId if not set (e.g., toolbox category event). (#443)
* Fix block in multi-playground
* Increase commonality between playgrounds.
# Conflicts:
# tests/multi_playground.html
# tests/playground.html
* Remove "show flyouts" button
* Recompile for merge June 22
2016-06-22 17:50:16 -04:00
|
|
|
* contents (e.g. block positions) change. This will also scroll the
|
|
|
|
* workspace contents if needed.
|
|
|
|
* @package
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.resizeContents = function() {
|
2017-02-02 14:17:43 -05:00
|
|
|
if (!this.resizesEnabled_ || !this.rendered) {
|
2016-10-03 20:15:54 -04:00
|
|
|
return;
|
|
|
|
}
|
Merge google/develop June 22 (#441)
* Localisation updates from https://translatewiki.net.
* test page that creates random blocks and randomly drags them around the page
* Localisation updates from https://translatewiki.net.
* add missing return in fake drag
* get rid of drag_tests file:
* Generated JS helper functions should be camelCase.
Complying with Google style guide.
* Localisation updates from https://translatewiki.net.
* Fix extra category error. Clean up code, rename variables, reduce line lengths, fix lint issues.
* Remove claim that good.string.quote should be used.
* Change the blockly workspace resizing strategy. (#386)
* Add a new method to be called when the contents of the workspace change and
the scrollbars need to be adjusted but the the chrome (trash, toolbox, etc)
are expected to stay in the same place.
Change a bunch of calls to svgResize to either be removed or call the new
method instead. This is a nice performance win since the offsetHeight/Width
call in svgResize can be expensive, especially when called as often as we do -
there was some layout thrashing.
This also paves the way for moving calls to recordDeleteAreas
(which is also expensive) to a more cacheable spot than on every
mouse down/touch event.
of things (namely the scrollbars)
* Fix size of graph demo when it first loads by calling svgResize.
The graph starts with fixed width and was relying on a resize event
to fire (which I believe was removed in commit
217c681b86b0f2df76c479c9efae62e6e).
* Fix the resizing of the code demo. The demo's tab min-width used to
match the toolbox's width was only being set on a resize event, but
commit 217c681b86b0f2df76c479c9efae62e6e changed how that worked.
* Fix up some comments.
* Use specific workspaces rather than Blockly.getMainWorkspace().
* Make workspace required for resizeSvgContents and update
some calls to send real workspaces rather than ones that are
null.
Remove the private tag on terminateDrag_ because it is only
actually called from outside the BlockSvg object.
* Remove a rogue period.
* Recategorize BlockSvg.terminateDrag_ to @package instead of @private so that
other developers don't use it, but it still can be used by other Blockly classes.
* Add a TODO to fix issue #307.
* Add @package to workspace resizeContents.
* Routine recompile
* Fix unit tests.
* Fix inheritance on rendered connection.
Closure compiler on maximum compression breaks badly due to lack of
@extends attribute.
* Add toolbox location and toolbox mode options to playground.
* Increase commonality between playgrounds.
* Properly deal with shadow statement blocks in stacks.
* Localisation updates from https://translatewiki.net.
* Use a comment block for function comments in generated JS, Python and Dart.
* Fix typo in flyout.js (#403)
* Fix typo in flyout.js (#402)
* Line wrap comments in generated code.
* Remove reference to undefined variable (#413)
REASON_MUST_DISCONNECT was removed by a refactor in 2a1ffa1.
* Fix airstrike by grabbing the correct toolbox element. (#411)
Probably broken in 266e2ffa9a017d21d7ca2f151730d6ecfcecf173.
* Localisation updates from https://translatewiki.net.
* Fix issue #406 by calling resize from the keypress handler on text inputs. (#408)
* Remove shadow blocks from Accessible Blockly demo. Update README.
* Generate for loops on one line.
* Introduce a common translation pipe; remove local stringMap attributes. Fix variable name error in paste functions. Minor linting.
* Fix precedence on isIndex blocks.
* Add indexing setting for JavaScript Generation (#419)
Adding setting to allow for switching between zero and one based indexing for Blockly Blocks such that the generated code will use this flag to determine whether one based or zero based indexing should be used. One based indexing is enabled by default.
* Remove unused functions and dependencies.
* Remove the unnecessary construction of new services.
* Fix sort block in JS to satisfy tests.
* Trigger a contents resize in block's moveBy. (#422)
This fixes #420 but and it also fixes some other similar problems
with copy/paste and other users of moveBy.
* Consolidate the usages of the 'blockly-disabled' label.
* Fix error when undoing a shadow block replacement. Issue #415.
* Unify setActiveDesc() and updateSelectedNode() in the TreeService. Move function calls made directly within the template to the correct hooks.
* Standardize naming of components.
* Prevent collisions between user functions and helper functions.
* Localisation updates from https://translatewiki.net.
* Fix #425. Attash the resize handler to the workspace so it can be removed (#429)
when workspace.dispose() is called.
* Change the TreeService to a singleton.
* Remove unneeded generated parens around function calls in indexOf blocks.
* Fix #423 by calling workspace's resize when the flyout reflows. (#430)
* Updating URLs to reflect new docs. (#418)
* Updating URLs to reflect new docs. Removing -blockly in URLs.
* Rebuilt.
* Routine recompile
* Prevent selected block from ending up underneath a bumped block.
* Fix undo on fields with validators with side effects.
* Don't fire change event on fields that haven't been named yet.
* Localisation updates from https://translatewiki.net.
* Fix tree focus issues.
* Fix remaining focus issues on block deletion.
* cache delete areas instead of recalculating them onMouseDown
* Cache screen CTM for performance improvement.
* Call svgResizeContents from block_svg's dipose so that deleting blocks (#434)
from the context menu (or anywhere really) causes the workspace to
recalculate its size.
Remove the call to svgResizeContents from onMouseUp's logic for
determining whether the block is being dropped in the trash
since it calls dispose.
One side effect of this is that when you delete multiple blocks
resize gets called for each of them and the scrollbars move during
the operation. This is most obviously seen by doing an airstrike
in the playground and then deleting all the blocks at once.
* Allow terminal blocks to replace other terminal blocks (#433)
* Allow terminal blocks to replace other terminal blocks
* Updated test to allow replacing terminal blocks
* Refactor how activeDescendant is set. Introduce helper functions to ensure that calls like pasteAbove() preserve the focus.
* Localisation updates from https://translatewiki.net.
* Remove unnecessary logging.
* Reduce unneeded parentheses in JS and Python.
* Start using field_number.
* Make it easy to disable unconnected blocks.
* Routine recompile.
* Check if matrix is null in mouseToSvg
* Remove js/ localizations pre-merge
* Fix change to block_render_svg
* Fix error in xml.js
* Playground merge
* Add simple toolboxes to playgrounds
* Fix flyout reference in events listener
* Move tokenizeIntepolation into Blockly.utils namespace.
* Use simpler message interpolation in Code demo.
* Create console stub for IE 9.
* Don't output blockId if not set (e.g., toolbox category event). (#443)
* Fix block in multi-playground
* Increase commonality between playgrounds.
# Conflicts:
# tests/multi_playground.html
# tests/playground.html
* Remove "show flyouts" button
* Recompile for merge June 22
2016-06-22 17:50:16 -04:00
|
|
|
if (this.scrollbar) {
|
|
|
|
// TODO(picklesrus): Once rachel-fenichel's scrollbar refactoring
|
|
|
|
// is complete, call the method that only resizes scrollbar
|
|
|
|
// based on contents.
|
|
|
|
this.scrollbar.resize();
|
|
|
|
}
|
|
|
|
this.updateInverseScreenCTM();
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Resize and reposition all of the workspace chrome (toolbox,
|
|
|
|
* trash, scrollbars etc.)
|
|
|
|
* This should be called when something changes that
|
|
|
|
* requires recalculating dimensions and positions of the
|
|
|
|
* trash, zoom, toolbox, etc. (e.g. window resize).
|
2015-04-28 17:55:45 -07:00
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.resize = function() {
|
|
|
|
if (this.toolbox_) {
|
|
|
|
this.toolbox_.position();
|
|
|
|
}
|
|
|
|
if (this.flyout_) {
|
|
|
|
this.flyout_.position();
|
|
|
|
}
|
|
|
|
if (this.trashcan) {
|
|
|
|
this.trashcan.position();
|
|
|
|
}
|
2015-08-20 15:46:44 -07:00
|
|
|
if (this.zoomControls_) {
|
|
|
|
this.zoomControls_.position();
|
2015-08-19 17:21:05 -07:00
|
|
|
}
|
2015-04-28 17:55:45 -07:00
|
|
|
if (this.scrollbar) {
|
|
|
|
this.scrollbar.resize();
|
|
|
|
}
|
2016-08-10 18:00:15 -07:00
|
|
|
this.updateScreenCalculations_();
|
2015-04-28 17:55:45 -07:00
|
|
|
};
|
|
|
|
|
2016-08-10 18:00:15 -07:00
|
|
|
/**
|
|
|
|
* Resizes and repositions workspace chrome if the page has a new
|
|
|
|
* scroll position.
|
|
|
|
* @package
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.updateScreenCalculationsIfScrolled
|
|
|
|
= function() {
|
|
|
|
/* eslint-disable indent */
|
|
|
|
var currScroll = goog.dom.getDocumentScroll();
|
|
|
|
if (!goog.math.Coordinate.equals(this.lastRecordedPageScroll_,
|
|
|
|
currScroll)) {
|
|
|
|
this.lastRecordedPageScroll_ = currScroll;
|
|
|
|
this.updateScreenCalculations_();
|
|
|
|
}
|
|
|
|
}; /* eslint-enable indent */
|
|
|
|
|
2014-12-23 11:22:02 -08:00
|
|
|
/**
|
|
|
|
* Get the SVG element that forms the drawing surface.
|
|
|
|
* @return {!Element} SVG element.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.getCanvas = function() {
|
|
|
|
return this.svgBlockCanvas_;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the SVG element that forms the bubble surface.
|
|
|
|
* @return {!SVGGElement} SVG element.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.getBubbleCanvas = function() {
|
|
|
|
return this.svgBubbleCanvas_;
|
|
|
|
};
|
|
|
|
|
2016-01-07 17:01:01 -08:00
|
|
|
/**
|
2016-01-08 13:03:22 -08:00
|
|
|
* Get the SVG element that contains this workspace.
|
2016-01-07 17:01:01 -08:00
|
|
|
* @return {!Element} SVG element.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.getParentSvg = function() {
|
2016-01-08 13:58:18 -08:00
|
|
|
if (this.cachedParentSvg_) {
|
|
|
|
return this.cachedParentSvg_;
|
2016-01-07 17:01:01 -08:00
|
|
|
}
|
|
|
|
var element = this.svgGroup_;
|
|
|
|
while (element) {
|
|
|
|
if (element.tagName == 'svg') {
|
2016-01-08 13:58:18 -08:00
|
|
|
this.cachedParentSvg_ = element;
|
2016-01-07 17:01:01 -08:00
|
|
|
return element;
|
|
|
|
}
|
|
|
|
element = element.parentNode;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
};
|
|
|
|
|
2015-03-06 15:27:41 -06:00
|
|
|
/**
|
|
|
|
* Translate this workspace to new coordinates.
|
|
|
|
* @param {number} x Horizontal translation.
|
|
|
|
* @param {number} y Vertical translation.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.translate = function(x, y) {
|
2017-02-02 14:17:43 -05:00
|
|
|
if (this.useWorkspaceDragSurface_ && this.isDragSurfaceActive_) {
|
|
|
|
this.workspaceDragSurface_.translateSurface(x,y);
|
|
|
|
} else {
|
|
|
|
var translation = 'translate(' + x + ',' + y + ') ' +
|
|
|
|
'scale(' + this.scale + ')';
|
|
|
|
this.svgBlockCanvas_.setAttribute('transform', translation);
|
|
|
|
this.svgBubbleCanvas_.setAttribute('transform', translation);
|
|
|
|
}
|
|
|
|
// Now update the block drag surface if we're using one.
|
|
|
|
if (this.blockDragSurface_) {
|
|
|
|
this.blockDragSurface_.translateAndScaleGroup(x, y, this.scale);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called at the end of a workspace drag to take the contents
|
2018-04-26 17:06:12 -07:00
|
|
|
* out of the drag surface and put them back into the workspace SVG.
|
2017-02-02 14:17:43 -05:00
|
|
|
* Does nothing if the workspace drag surface is not enabled.
|
|
|
|
* @package
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.resetDragSurface = function() {
|
|
|
|
// Don't do anything if we aren't using a drag surface.
|
|
|
|
if (!this.useWorkspaceDragSurface_) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.isDragSurfaceActive_ = false;
|
|
|
|
|
|
|
|
var trans = this.workspaceDragSurface_.getSurfaceTranslation();
|
|
|
|
this.workspaceDragSurface_.clearAndHide(this.svgGroup_);
|
|
|
|
var translation = 'translate(' + trans.x + ',' + trans.y + ') ' +
|
2018-04-26 17:06:12 -07:00
|
|
|
'scale(' + this.scale + ')';
|
2015-03-06 15:27:41 -06:00
|
|
|
this.svgBlockCanvas_.setAttribute('transform', translation);
|
|
|
|
this.svgBubbleCanvas_.setAttribute('transform', translation);
|
2017-02-02 14:17:43 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called at the beginning of a workspace drag to move contents of
|
|
|
|
* the workspace to the drag surface.
|
|
|
|
* Does nothing if the drag surface is not enabled.
|
|
|
|
* @package
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.setupDragSurface = function() {
|
|
|
|
// Don't do anything if we aren't using a drag surface.
|
|
|
|
if (!this.useWorkspaceDragSurface_) {
|
|
|
|
return;
|
2016-04-01 16:40:59 -04:00
|
|
|
}
|
2017-02-02 14:17:43 -05:00
|
|
|
|
Merge google/blockly, May 2017 (#881)
* Move createDom call into the constructor of block drag surface. (#790)
* 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. (#805)
* Don't connect to blocks under the flyout.
* recompile again. (#806)
* 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 #813 by ademenev
* Localisation updates from https://translatewiki.net.
* PR #818: 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. (#820)
From commits b77f8cbebc5cef247116d3df6a428df8addbe53d and 4ecdedec9f8a69f78abf246e7a5db1e1a0be6b85
* Naming changes in mirror demo
* Adding support for untranslated messages. (#819)
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. (#825)
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 #828.
* 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" (#832)
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. (#836)
Fixes commits in #832.
* Adding extensions for JSON support of dynamic blocks. (#834)
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 … (#837)
* 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 #816 so that layering of the flyout and workspace scrollbars
are done correctly.
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Localisation updates from https://translatewiki.net.
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* Localisation updates from https://translatewiki.net.
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Localisation updates from https://translatewiki.net.
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 #661
* 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. (#934)
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 #946. Don't check for presence of constants.js
* Fix #945 (annotations) and an eslint issue (constant condition)
* Localisation updates from https://translatewiki.net.
* Fix #950: 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 #937.
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() (#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.
* Annotation fixes
* Fix bug #904 by explicitly grabbing focus on the workspace svg element. (#964)
* Potential fix for #888. Stops checking whether we are mid workspace drag since we do not always get mosue up events when blockly is in an iframe. (#899)
* Adding new minimap demo
* Basic code style changes. Adding a few more comments. Return early if disableScrollChange in onScrollChange listener.
* `unction` to `function` corrects #962 (#970)
* Cross browser friendly fix for #904. This calls blur and focus from … (#972)
* Cross browser friendly fix for #904. 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 #904 to keep the page from jumping to the focused workspace in IE 11 (#974)
* 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 #967 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 d55d9cbd9ff308ff5e361cf77acabb61a4bf4695). IIUC, updateWidth/getCachedWidth was only called from render before which is overridden in FieldImage to be a no-op already. (#979)
* Fix #969
* Localisation updates from https://translatewiki.net.
* Fix #986. Looks like the original PR just forgot this block. (#992)
* rebuild develop (#996)
* Added the variable modal and component and implemented basic renaming functionality. (#991)
* Fixing commenting from the last commit. (#1000)
* 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. (#1011)
* Minimap position bug fix for browsers other than chrome. Added touch support.
* Adding an add variable modal to accessible Blockly. (#1015)
* 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. (#1017)
Centralizes accessible modal behavior.
* - Changed error message referencing 'procedure' instead of 'function' (#1019)
- 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,… (#1028)
...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). (#1027)
* Enable google/blockly with continuous build on travis ci (#1023) (#1035)
* 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 #880.
* Ensure useDragSurface is a boolean.
Fixed #988
* use pretest instead of preinstall in package.json (#1043)
* 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 #973
* bumpNeighbours_ function moved to block_svg.
Fixed #1009
* Update RegEx in js-to-json to match windowi eol (#1050)
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 (#1053)
"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. (#1054)
* Correcting #1054 (#1056)
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… (#1057)
* Change how blockly handles cursors. The old way was quite slow because it changed the stylesheet directly. See issue #981 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. (#1059)
* Merge master into develop (#1063)
- pick up translation changes
- clean up trailing spaces
* use goog.string.startswith instead of string.startswith (#1065)
* New jsinterpreter demo includes wait block. Both demos have improved UI for clarity. (#1001)
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 #1069 (#1073)
* 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
|
|
|
// This can happen if the user starts a drag, mouses up outside of the
|
|
|
|
// document where the mouseup listener is registered (e.g. outside of an
|
|
|
|
// iframe) and then moves the mouse back in the workspace. On mobile and ff,
|
|
|
|
// we get the mouseup outside the frame. On chrome and safari desktop we do
|
|
|
|
// not.
|
|
|
|
if (this.isDragSurfaceActive_) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-02-02 14:17:43 -05:00
|
|
|
this.isDragSurfaceActive_ = true;
|
|
|
|
|
|
|
|
// Figure out where we want to put the canvas back. The order
|
|
|
|
// in the is important because things are layered.
|
|
|
|
var previousElement = this.svgBlockCanvas_.previousSibling;
|
2018-04-26 17:06:12 -07:00
|
|
|
var width = parseInt(this.getParentSvg().getAttribute('width'), 10);
|
|
|
|
var height = parseInt(this.getParentSvg().getAttribute('height'), 10);
|
2017-02-02 14:17:43 -05:00
|
|
|
var coord = Blockly.utils.getRelativeXY(this.svgBlockCanvas_);
|
|
|
|
this.workspaceDragSurface_.setContentsAndShow(this.svgBlockCanvas_,
|
|
|
|
this.svgBubbleCanvas_, previousElement, width, height, this.scale);
|
|
|
|
this.workspaceDragSurface_.translateSurface(coord.x, coord.y);
|
2015-03-06 15:27:41 -06:00
|
|
|
};
|
|
|
|
|
2018-05-11 16:35:31 -07:00
|
|
|
/**
|
|
|
|
* @return {?Blockly.BlockDragSurfaceSvg} This workspace's block drag surface,
|
|
|
|
* if one is in use.
|
|
|
|
* @package
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.getBlockDragSurface = function() {
|
|
|
|
return this.blockDragSurface_;
|
|
|
|
};
|
|
|
|
|
2014-12-23 11:22:02 -08:00
|
|
|
/**
|
|
|
|
* Returns the horizontal offset of the workspace.
|
|
|
|
* Intended for LTR/RTL compatibility in XML.
|
|
|
|
* @return {number} Width.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.getWidth = function() {
|
2016-02-24 16:52:55 -08:00
|
|
|
var metrics = this.getMetrics();
|
2016-02-25 11:08:50 -08:00
|
|
|
return metrics ? metrics.viewWidth / this.scale : 0;
|
2014-12-23 11:22:02 -08:00
|
|
|
};
|
|
|
|
|
2015-05-22 17:08:59 -07:00
|
|
|
/**
|
|
|
|
* Toggles the visibility of the workspace.
|
|
|
|
* Currently only intended for main workspace.
|
|
|
|
* @param {boolean} isVisible True if workspace should be visible.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.setVisible = function(isVisible) {
|
2017-02-02 14:17:43 -05:00
|
|
|
|
|
|
|
// Tell the scrollbar whether its container is visible so it can
|
|
|
|
// tell when to hide itself.
|
|
|
|
if (this.scrollbar) {
|
|
|
|
this.scrollbar.setContainerVisible(isVisible);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Tell the flyout whether its container is visible so it can
|
|
|
|
// tell when to hide itself.
|
Feature/merge feb 2017 (#791)
* 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 c8ca24a0007b70e137417e843459c87185141a55.
* 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… (#732)
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. (#748)
* 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 (#741)
* 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. (#749)
* 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 #758.
* Split the scrollbar and flyout out into their own SVG elements. They (#771)
* 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. (#699)
* Fix #698 by adjusting the regex to not have \. Still not 100% sure w… (#700)
* Fix #698 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… (#777)
* 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… (#778)
* 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 #748 and stop using contains since it is not supported in IE
* Fixes #786 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. (#787)
* 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 #791.
* Localisation updates from https://translatewiki.net.
* Localisation updates from https://translatewiki.net.
* Use the drag surface when scrolling using the scrollbars. #783 (#789)
* End event groups when you finish editing a field
* Fix #794 and make the workspace grid drag along with the workspace. (#801)
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. (#790)
* 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. (#805)
* Don't connect to blocks under the flyout.
* recompile again. (#806)
* 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 #813 by ademenev
* PR #818: 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. (#820)
From commits b77f8cbebc5cef247116d3df6a428df8addbe53d and 4ecdedec9f8a69f78abf246e7a5db1e1a0be6b85
* Naming changes in mirror demo
* Adding support for untranslated messages. (#819)
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. (#825)
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 #828.
* 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" (#832)
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. (#836)
Fixes commits in #832.
* Adding extensions for JSON support of dynamic blocks. (#834)
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 … (#837)
* 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 #816 so that layering of the flyout and workspace scrollbars
are done correctly.
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 12:09:23 -08:00
|
|
|
if (this.getFlyout()) {
|
|
|
|
this.getFlyout().setContainerVisible(isVisible);
|
2017-02-02 14:17:43 -05:00
|
|
|
}
|
|
|
|
|
2016-01-07 17:01:01 -08:00
|
|
|
this.getParentSvg().style.display = isVisible ? 'block' : 'none';
|
2015-05-22 17:08:59 -07:00
|
|
|
if (this.toolbox_) {
|
|
|
|
// Currently does not support toolboxes in mutators.
|
|
|
|
this.toolbox_.HtmlDiv.style.display = isVisible ? 'block' : 'none';
|
|
|
|
}
|
|
|
|
if (isVisible) {
|
|
|
|
this.render();
|
2017-06-07 17:23:05 -07:00
|
|
|
// The window may have changed size while the workspace was hidden.
|
|
|
|
// Resize recalculates scrollbar position, delete areas, etc.
|
|
|
|
this.resize();
|
2015-05-22 17:08:59 -07:00
|
|
|
} else {
|
|
|
|
Blockly.hideChaff(true);
|
2016-04-21 15:33:28 -04:00
|
|
|
Blockly.DropDownDiv.hideWithoutAnimation();
|
2015-05-22 17:08:59 -07:00
|
|
|
}
|
2018-08-08 20:32:22 -04:00
|
|
|
this.isVisible_ = isVisible;
|
2015-05-22 17:08:59 -07:00
|
|
|
};
|
|
|
|
|
2014-12-23 11:22:02 -08:00
|
|
|
/**
|
|
|
|
* Render all blocks in workspace.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.render = function() {
|
2015-10-24 23:51:27 -04:00
|
|
|
// Generate list of all blocks.
|
|
|
|
var blocks = this.getAllBlocks();
|
|
|
|
// Render each block.
|
|
|
|
for (var i = blocks.length - 1; i >= 0; i--) {
|
|
|
|
blocks[i].render(false);
|
2014-12-23 11:22:02 -08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2016-10-26 18:39:56 -07:00
|
|
|
* Was used back when block highlighting (for execution) and block selection
|
|
|
|
* (for editing) were the same thing.
|
|
|
|
* Any calls of this function can be deleted.
|
|
|
|
* @deprecated October 2016
|
2014-12-23 11:22:02 -08:00
|
|
|
*/
|
2016-10-26 18:39:56 -07:00
|
|
|
Blockly.WorkspaceSvg.prototype.traceOn = function() {
|
|
|
|
console.warn('Deprecated call to traceOn, delete this.');
|
2014-12-23 11:22:02 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2017-02-02 14:17:43 -05:00
|
|
|
* Highlight or unhighlight a block in the workspace. Block highlighting is
|
|
|
|
* often used to visually mark blocks currently being executed.
|
2016-10-26 18:39:56 -07:00
|
|
|
* @param {?string} id ID of block to highlight/unhighlight,
|
|
|
|
* or null for no block (used to unhighlight all blocks).
|
|
|
|
* @param {boolean=} opt_state If undefined, highlight specified block and
|
|
|
|
* automatically unhighlight all others. If true or false, manually
|
|
|
|
* highlight/unhighlight the specified block.
|
2014-12-23 11:22:02 -08:00
|
|
|
*/
|
2016-10-26 18:39:56 -07:00
|
|
|
Blockly.WorkspaceSvg.prototype.highlightBlock = function(id, opt_state) {
|
|
|
|
if (opt_state === undefined) {
|
|
|
|
// Unhighlight all blocks.
|
|
|
|
for (var i = 0, block; block = this.highlightedBlocks_[i]; i++) {
|
|
|
|
block.setHighlighted(false);
|
2014-12-23 11:22:02 -08:00
|
|
|
}
|
2016-10-26 18:39:56 -07:00
|
|
|
this.highlightedBlocks_.length = 0;
|
2014-12-23 11:22:02 -08:00
|
|
|
}
|
2016-10-26 18:39:56 -07:00
|
|
|
// Highlight/unhighlight the specified block.
|
|
|
|
var block = id ? this.getBlockById(id) : null;
|
2014-12-23 11:22:02 -08:00
|
|
|
if (block) {
|
2016-10-26 18:39:56 -07:00
|
|
|
var state = (opt_state === undefined) || opt_state;
|
|
|
|
// Using Set here would be great, but at the cost of IE10 support.
|
|
|
|
if (!state) {
|
2018-08-22 15:29:43 -04:00
|
|
|
goog.array.remove(this.highlightedBlocks_, block);
|
2016-10-26 18:39:56 -07:00
|
|
|
} else if (this.highlightedBlocks_.indexOf(block) == -1) {
|
|
|
|
this.highlightedBlocks_.push(block);
|
|
|
|
}
|
|
|
|
block.setHighlighted(state);
|
2014-12-23 11:22:02 -08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-03-04 10:27:57 -05:00
|
|
|
/**
|
|
|
|
* Glow/unglow a block in the workspace.
|
|
|
|
* @param {?string} id ID of block to find.
|
2016-04-26 13:04:37 -04:00
|
|
|
* @param {boolean} isGlowingBlock Whether to glow the block.
|
2016-03-04 10:27:57 -05:00
|
|
|
*/
|
2016-04-26 13:04:37 -04:00
|
|
|
Blockly.WorkspaceSvg.prototype.glowBlock = function(id, isGlowingBlock) {
|
2016-03-04 10:27:57 -05:00
|
|
|
var block = null;
|
|
|
|
if (id) {
|
2016-05-12 21:58:33 -04:00
|
|
|
block = this.getBlockById(id);
|
2016-03-04 10:27:57 -05:00
|
|
|
if (!block) {
|
2016-03-11 13:27:20 -05:00
|
|
|
throw 'Tried to glow block that does not exist.';
|
2016-03-04 10:27:57 -05:00
|
|
|
}
|
|
|
|
}
|
2016-04-26 13:04:37 -04:00
|
|
|
block.setGlowBlock(isGlowingBlock);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Glow/unglow a stack in the workspace.
|
|
|
|
* @param {?string} id ID of block which starts the stack.
|
|
|
|
* @param {boolean} isGlowingStack Whether to glow the stack.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.glowStack = function(id, isGlowingStack) {
|
|
|
|
var block = null;
|
|
|
|
if (id) {
|
2016-05-12 21:58:33 -04:00
|
|
|
block = this.getBlockById(id);
|
2016-04-26 13:04:37 -04:00
|
|
|
if (!block) {
|
|
|
|
throw 'Tried to glow stack on block that does not exist.';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
block.setGlowStack(isGlowingStack);
|
2016-03-04 10:27:57 -05:00
|
|
|
};
|
|
|
|
|
2016-07-07 18:35:41 -04:00
|
|
|
/**
|
|
|
|
* Visually report a value associated with a block.
|
|
|
|
* In Scratch, appears as a pop-up next to the block when a reporter block is clicked.
|
|
|
|
* @param {?string} id ID of block to report associated value.
|
|
|
|
* @param {?string} value String value to visually report.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.reportValue = function(id, value) {
|
|
|
|
var block = this.getBlockById(id);
|
|
|
|
if (!block) {
|
|
|
|
throw 'Tried to report value on block that does not exist.';
|
|
|
|
}
|
|
|
|
Blockly.DropDownDiv.hideWithoutAnimation();
|
|
|
|
Blockly.DropDownDiv.clearContent();
|
|
|
|
var contentDiv = Blockly.DropDownDiv.getContentDiv();
|
|
|
|
var valueReportBox = goog.dom.createElement('div');
|
|
|
|
valueReportBox.setAttribute('class', 'valueReportBox');
|
2018-04-30 15:55:31 -07:00
|
|
|
valueReportBox.innerHTML = Blockly.scratchBlocksUtils.encodeEntities(value);
|
2016-07-07 18:35:41 -04:00
|
|
|
contentDiv.appendChild(valueReportBox);
|
|
|
|
Blockly.DropDownDiv.setColour(
|
2018-05-02 11:05:43 -07:00
|
|
|
Blockly.Colours.valueReportBackground,
|
|
|
|
Blockly.Colours.valueReportBorder
|
2016-07-07 18:35:41 -04:00
|
|
|
);
|
|
|
|
Blockly.DropDownDiv.showPositionedByBlock(this, block);
|
|
|
|
};
|
|
|
|
|
2014-12-23 11:22:02 -08:00
|
|
|
/**
|
|
|
|
* Paste the provided block onto the workspace.
|
|
|
|
* @param {!Element} xmlBlock XML block element.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.paste = function(xmlBlock) {
|
2016-06-21 15:54:03 -04:00
|
|
|
if (!this.rendered) {
|
2014-12-23 11:22:02 -08:00
|
|
|
return;
|
|
|
|
}
|
2017-05-22 13:08:22 -07:00
|
|
|
if (this.currentGesture_) {
|
|
|
|
this.currentGesture_.cancel(); // Dragging while pasting? No.
|
|
|
|
}
|
2018-05-11 17:18:19 -07:00
|
|
|
if (xmlBlock.tagName.toLowerCase() == 'comment') {
|
|
|
|
this.pasteWorkspaceComment_(xmlBlock);
|
|
|
|
} else {
|
|
|
|
this.pasteBlock_(xmlBlock);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Paste the provided block onto the workspace.
|
|
|
|
* @param {!Element} xmlBlock XML block element.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.pasteBlock_ = function(xmlBlock) {
|
2016-02-16 21:57:22 -08:00
|
|
|
Blockly.Events.disable();
|
2016-04-27 14:21:22 +02:00
|
|
|
try {
|
|
|
|
var block = Blockly.Xml.domToBlock(xmlBlock, this);
|
2017-08-05 13:37:10 -04:00
|
|
|
// Scratch-specific: Give shadow dom new IDs to prevent duplicating on paste
|
2018-04-30 15:55:31 -07:00
|
|
|
Blockly.scratchBlocksUtils.changeObscuredShadowIds(block);
|
2017-10-19 17:10:42 -04:00
|
|
|
// Move the duplicate to original position.
|
2016-04-27 14:21:22 +02:00
|
|
|
var blockX = parseInt(xmlBlock.getAttribute('x'), 10);
|
|
|
|
var blockY = parseInt(xmlBlock.getAttribute('y'), 10);
|
|
|
|
if (!isNaN(blockX) && !isNaN(blockY)) {
|
|
|
|
if (this.RTL) {
|
|
|
|
blockX = -blockX;
|
2014-12-23 11:22:02 -08:00
|
|
|
}
|
2016-04-27 14:21:22 +02:00
|
|
|
// Offset block until not clobbering another block and not in connection
|
|
|
|
// distance with neighbouring blocks.
|
|
|
|
do {
|
|
|
|
var collide = false;
|
|
|
|
var allBlocks = this.getAllBlocks();
|
|
|
|
for (var i = 0, otherBlock; otherBlock = allBlocks[i]; i++) {
|
|
|
|
var otherXY = otherBlock.getRelativeToSurfaceXY();
|
|
|
|
if (Math.abs(blockX - otherXY.x) <= 1 &&
|
|
|
|
Math.abs(blockY - otherXY.y) <= 1) {
|
2015-07-04 05:34:59 +01:00
|
|
|
collide = true;
|
2015-07-12 15:38:59 -07:00
|
|
|
break;
|
2015-07-04 05:34:59 +01:00
|
|
|
}
|
|
|
|
}
|
2016-04-27 14:21:22 +02:00
|
|
|
if (!collide) {
|
|
|
|
// Check for blocks in snap range to any of its connections.
|
|
|
|
var connections = block.getConnections_(false);
|
|
|
|
for (var i = 0, connection; connection = connections[i]; i++) {
|
|
|
|
var neighbour = connection.closest(Blockly.SNAP_RADIUS,
|
|
|
|
new goog.math.Coordinate(blockX, blockY));
|
|
|
|
if (neighbour.connection) {
|
|
|
|
collide = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2015-07-04 05:34:59 +01:00
|
|
|
}
|
2016-04-27 14:21:22 +02:00
|
|
|
if (collide) {
|
|
|
|
if (this.RTL) {
|
|
|
|
blockX -= Blockly.SNAP_RADIUS;
|
|
|
|
} else {
|
|
|
|
blockX += Blockly.SNAP_RADIUS;
|
|
|
|
}
|
|
|
|
blockY += Blockly.SNAP_RADIUS * 2;
|
|
|
|
}
|
|
|
|
} while (collide);
|
|
|
|
block.moveBy(blockX, blockY);
|
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
Blockly.Events.enable();
|
2014-12-23 11:22:02 -08:00
|
|
|
}
|
2016-02-16 21:57:22 -08:00
|
|
|
if (Blockly.Events.isEnabled() && !block.isShadow()) {
|
2017-06-22 10:38:20 -04:00
|
|
|
Blockly.Events.fire(new Blockly.Events.BlockCreate(block));
|
2016-02-16 21:57:22 -08:00
|
|
|
}
|
2014-12-23 11:22:02 -08:00
|
|
|
block.select();
|
|
|
|
};
|
|
|
|
|
2018-05-11 17:18:19 -07:00
|
|
|
/**
|
|
|
|
* Paste the provided comment onto the workspace.
|
|
|
|
* @param {!Element} xmlComment XML workspace comment element.
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.pasteWorkspaceComment_ = function(xmlComment) {
|
|
|
|
Blockly.Events.disable();
|
|
|
|
try {
|
|
|
|
var comment = Blockly.WorkspaceCommentSvg.fromXml(xmlComment, this);
|
|
|
|
// Move the duplicate to original position.
|
|
|
|
var commentX = parseInt(xmlComment.getAttribute('x'), 10);
|
|
|
|
var commentY = parseInt(xmlComment.getAttribute('y'), 10);
|
|
|
|
if (!isNaN(commentX) && !isNaN(commentY)) {
|
|
|
|
if (this.RTL) {
|
|
|
|
commentX = -commentX;
|
|
|
|
}
|
|
|
|
// Offset workspace comment.
|
2018-05-15 17:02:35 -07:00
|
|
|
// TODO: (github.com/google/blockly/issues/1719) properly offset comment
|
|
|
|
// such that it's not interfereing with any blocks
|
2018-05-11 17:18:19 -07:00
|
|
|
commentX += 50;
|
|
|
|
commentY += 50;
|
|
|
|
comment.moveBy(commentX, commentY);
|
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
Blockly.Events.enable();
|
|
|
|
}
|
|
|
|
if (Blockly.Events.isEnabled()) {
|
2018-05-15 17:02:35 -07:00
|
|
|
Blockly.WorkspaceComment.fireCreateEvent(comment);
|
2018-05-11 17:18:19 -07:00
|
|
|
}
|
|
|
|
comment.select();
|
|
|
|
};
|
|
|
|
|
2017-06-15 15:22:08 -07:00
|
|
|
/**
|
|
|
|
* Refresh the toolbox unless there's a drag in progress.
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.refreshToolboxSelection_ = function() {
|
2017-10-24 14:31:21 -07:00
|
|
|
// Updating the toolbox can be expensive. Don't do it when when it is
|
|
|
|
// disabled.
|
2018-01-12 12:21:46 -05:00
|
|
|
if (this.toolbox_) {
|
|
|
|
if (this.toolbox_.flyout_ && !this.currentGesture_ &&
|
2017-10-24 14:31:21 -07:00
|
|
|
this.toolboxRefreshEnabled_) {
|
2018-01-12 12:21:46 -05:00
|
|
|
this.toolbox_.refreshSelection();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
var thisTarget = this.targetWorkspace;
|
|
|
|
if (thisTarget && thisTarget.toolbox_ && thisTarget.toolbox_.flyout_ &&
|
|
|
|
!thisTarget.currentGesture_ && thisTarget.toolboxRefreshEnabled_) {
|
|
|
|
thisTarget.toolbox_.refreshSelection();
|
|
|
|
}
|
2017-06-15 15:22:08 -07:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Rename a variable by updating its name in the variable map. Update the
|
|
|
|
* flyout to show the renamed variable immediately.
|
2018-04-26 17:06:12 -07:00
|
|
|
* @param {string} id ID of the variable to rename.
|
2017-06-15 15:22:08 -07:00
|
|
|
* @param {string} newName New variable name.
|
|
|
|
* @package
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.renameVariableById = function(id, newName) {
|
|
|
|
Blockly.WorkspaceSvg.superClass_.renameVariableById.call(this, id, newName);
|
|
|
|
this.refreshToolboxSelection_();
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2018-01-12 12:03:28 -08:00
|
|
|
* Delete a variable by the passed in ID. Update the flyout to show
|
2017-06-15 15:22:08 -07:00
|
|
|
* immediately that the variable is deleted.
|
2018-04-26 17:06:12 -07:00
|
|
|
* @param {string} id ID of variable to delete.
|
2017-06-15 15:22:08 -07:00
|
|
|
* @package
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.deleteVariableById = function(id) {
|
|
|
|
Blockly.WorkspaceSvg.superClass_.deleteVariableById.call(this, id);
|
|
|
|
this.refreshToolboxSelection_();
|
2017-02-22 13:49:39 -08:00
|
|
|
};
|
|
|
|
|
2016-07-01 15:51:59 -07:00
|
|
|
/**
|
|
|
|
* Create a new variable with the given name. Update the flyout to show the new
|
|
|
|
* variable immediately.
|
|
|
|
* @param {string} name The new variable's name.
|
2017-06-19 16:16:04 -07:00
|
|
|
* @param {string=} opt_type The type of the variable like 'int' or 'string'.
|
|
|
|
* Does not need to be unique. Field_variable can filter variables based on
|
|
|
|
* their type. This will default to '' which is a specific type.
|
2018-04-26 17:06:12 -07:00
|
|
|
* @param {string=} opt_id The unique ID of the variable. This will default to
|
2017-06-19 16:16:04 -07:00
|
|
|
* a UUID.
|
2018-07-03 14:01:49 -04:00
|
|
|
* @param {boolean=} opt_isLocal Whether the variable is locally scoped.
|
2018-11-13 16:42:28 -05:00
|
|
|
* @param {boolean=} opt_isCloud Whether the variable is a cloud variable.
|
Merge/05 24 (#903)
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Localisation updates from https://translatewiki.net.
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* Localisation updates from https://translatewiki.net.
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Localisation updates from https://translatewiki.net.
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 #661
* 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. (#934)
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 #946. Don't check for presence of constants.js
* Fix #945 (annotations) and an eslint issue (constant condition)
* Localisation updates from https://translatewiki.net.
* Fix #950: 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 #937.
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() (#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.
* Annotation fixes
* Fix bug #904 by explicitly grabbing focus on the workspace svg element. (#964)
* Potential fix for #888. Stops checking whether we are mid workspace drag since we do not always get mosue up events when blockly is in an iframe. (#899)
* Adding new minimap demo
* Basic code style changes. Adding a few more comments. Return early if disableScrollChange in onScrollChange listener.
* `unction` to `function` corrects #962 (#970)
* Cross browser friendly fix for #904. This calls blur and focus from … (#972)
* Cross browser friendly fix for #904. 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 #904 to keep the page from jumping to the focused workspace in IE 11 (#974)
* 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 #967 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 d55d9cbd9ff308ff5e361cf77acabb61a4bf4695). IIUC, updateWidth/getCachedWidth was only called from render before which is overridden in FieldImage to be a no-op already. (#979)
* Fix #969
* Localisation updates from https://translatewiki.net.
* Fix #986. Looks like the original PR just forgot this block. (#992)
* rebuild develop (#996)
* Added the variable modal and component and implemented basic renaming functionality. (#991)
* Fixing commenting from the last commit. (#1000)
* 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. (#1011)
* Minimap position bug fix for browsers other than chrome. Added touch support.
* Adding an add variable modal to accessible Blockly. (#1015)
* 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. (#1017)
Centralizes accessible modal behavior.
* - Changed error message referencing 'procedure' instead of 'function' (#1019)
- 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,… (#1028)
...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). (#1027)
* Enable google/blockly with continuous build on travis ci (#1023) (#1035)
* 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 #880.
* Ensure useDragSurface is a boolean.
Fixed #988
* use pretest instead of preinstall in package.json (#1043)
* 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 #973
* bumpNeighbours_ function moved to block_svg.
Fixed #1009
* Update RegEx in js-to-json to match windowi eol (#1050)
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 (#1053)
"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. (#1054)
* Correcting #1054 (#1056)
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… (#1057)
* Change how blockly handles cursors. The old way was quite slow because it changed the stylesheet directly. See issue #981 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. (#1059)
* Merge master into develop (#1063)
- pick up translation changes
- clean up trailing spaces
* use goog.string.startswith instead of string.startswith (#1065)
* New jsinterpreter demo includes wait block. Both demos have improved UI for clarity. (#1001)
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 #1069 (#1073)
* VariableMap and functions added.
* Fix #1051 (#1084)
* Improve errors when validating JSON block definitions. (#1086)
goog.asserts to not run from blockly_compressed.js. User data validation should always run.
* Dragging changes, rebased on develop (#1078)
* 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 (#1026)
-- 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 (#1048)
- Removed gestureDB
- Removing uses of terminateDrag
- Cleaned up disposal code
* Dragging bugfixes (#1058)
- 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 (#1060)
* 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. (#1081)
* add osx travis test run job (#1074)
* Names are correctly fetched from VariableModels!
* add more wait time for test setup (#1091)
* Work around timing issue with travis osx issue (#1092)
* add more wait time for test setup
* increase selenium wait time
* add more wait
* Fix #1077 by adding a rule to cover the toolbox labels too. (#1099)
* Assign variable UUID to field_variable dropdown.
* Change registration link to a static one (#1106)
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 (#1111)
* Click events on shadow blocks have the correct id (#1089)
* Add image_onclick option (#1080)
* Cleanup: semicolons, spacing, etc. (#1116)
* Spelling. Spelling is hard.
* Add variable info to xml generated in variables.js
* Add missing CLAs info to the contributing file (#1119)
* Add missing CLAs info to the contributing file
* Added larger changes paragraph
* Replacing latest prettifier hosted in repo with latest version at rawgit CDN. (#1120)
* Forgot update code demo (#1121)
* Move audio code to a new file (#1122)
* 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 (#1126)
* Include variables at top of serialization.
* Move blockSvg.getHeightWidth to block_render_svg.js (#1118)
* Deserialization variables at top.
* Create grid object (#1131)
* 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
|
|
|
* @return {?Blockly.VariableModel} The newly created variable.
|
2017-06-15 15:22:08 -07:00
|
|
|
* @package
|
2016-07-01 15:51:59 -07:00
|
|
|
*/
|
2018-07-03 14:01:49 -04:00
|
|
|
Blockly.WorkspaceSvg.prototype.createVariable = function(name, opt_type, opt_id,
|
2018-11-13 16:42:28 -05:00
|
|
|
opt_isLocal, opt_isCloud) {
|
2018-01-17 13:08:20 -05:00
|
|
|
var variableInMap = (this.getVariable(name, opt_type) != null);
|
2018-05-02 11:05:43 -07:00
|
|
|
var newVar = Blockly.WorkspaceSvg.superClass_.createVariable.call(
|
2018-11-13 16:42:28 -05:00
|
|
|
this, name, opt_type, opt_id, opt_isLocal, opt_isCloud);
|
2017-10-24 12:40:22 -07:00
|
|
|
// For performance reasons, only refresh the the toolbox for new variables.
|
|
|
|
// Variables that already exist should already be there.
|
2017-12-22 10:18:19 -05:00
|
|
|
if (!variableInMap && (opt_type != Blockly.BROADCAST_MESSAGE_VARIABLE_TYPE)) {
|
2017-10-24 12:40:22 -07:00
|
|
|
this.refreshToolboxSelection_();
|
|
|
|
}
|
Merge/05 24 (#903)
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Localisation updates from https://translatewiki.net.
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* Localisation updates from https://translatewiki.net.
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Localisation updates from https://translatewiki.net.
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 #661
* 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. (#934)
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 #946. Don't check for presence of constants.js
* Fix #945 (annotations) and an eslint issue (constant condition)
* Localisation updates from https://translatewiki.net.
* Fix #950: 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 #937.
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() (#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.
* Annotation fixes
* Fix bug #904 by explicitly grabbing focus on the workspace svg element. (#964)
* Potential fix for #888. Stops checking whether we are mid workspace drag since we do not always get mosue up events when blockly is in an iframe. (#899)
* Adding new minimap demo
* Basic code style changes. Adding a few more comments. Return early if disableScrollChange in onScrollChange listener.
* `unction` to `function` corrects #962 (#970)
* Cross browser friendly fix for #904. This calls blur and focus from … (#972)
* Cross browser friendly fix for #904. 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 #904 to keep the page from jumping to the focused workspace in IE 11 (#974)
* 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 #967 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 d55d9cbd9ff308ff5e361cf77acabb61a4bf4695). IIUC, updateWidth/getCachedWidth was only called from render before which is overridden in FieldImage to be a no-op already. (#979)
* Fix #969
* Localisation updates from https://translatewiki.net.
* Fix #986. Looks like the original PR just forgot this block. (#992)
* rebuild develop (#996)
* Added the variable modal and component and implemented basic renaming functionality. (#991)
* Fixing commenting from the last commit. (#1000)
* 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. (#1011)
* Minimap position bug fix for browsers other than chrome. Added touch support.
* Adding an add variable modal to accessible Blockly. (#1015)
* 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. (#1017)
Centralizes accessible modal behavior.
* - Changed error message referencing 'procedure' instead of 'function' (#1019)
- 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,… (#1028)
...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). (#1027)
* Enable google/blockly with continuous build on travis ci (#1023) (#1035)
* 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 #880.
* Ensure useDragSurface is a boolean.
Fixed #988
* use pretest instead of preinstall in package.json (#1043)
* 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 #973
* bumpNeighbours_ function moved to block_svg.
Fixed #1009
* Update RegEx in js-to-json to match windowi eol (#1050)
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 (#1053)
"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. (#1054)
* Correcting #1054 (#1056)
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… (#1057)
* Change how blockly handles cursors. The old way was quite slow because it changed the stylesheet directly. See issue #981 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. (#1059)
* Merge master into develop (#1063)
- pick up translation changes
- clean up trailing spaces
* use goog.string.startswith instead of string.startswith (#1065)
* New jsinterpreter demo includes wait block. Both demos have improved UI for clarity. (#1001)
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 #1069 (#1073)
* VariableMap and functions added.
* Fix #1051 (#1084)
* Improve errors when validating JSON block definitions. (#1086)
goog.asserts to not run from blockly_compressed.js. User data validation should always run.
* Dragging changes, rebased on develop (#1078)
* 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 (#1026)
-- 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 (#1048)
- Removed gestureDB
- Removing uses of terminateDrag
- Cleaned up disposal code
* Dragging bugfixes (#1058)
- 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 (#1060)
* 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. (#1081)
* add osx travis test run job (#1074)
* Names are correctly fetched from VariableModels!
* add more wait time for test setup (#1091)
* Work around timing issue with travis osx issue (#1092)
* add more wait time for test setup
* increase selenium wait time
* add more wait
* Fix #1077 by adding a rule to cover the toolbox labels too. (#1099)
* Assign variable UUID to field_variable dropdown.
* Change registration link to a static one (#1106)
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 (#1111)
* Click events on shadow blocks have the correct id (#1089)
* Add image_onclick option (#1080)
* Cleanup: semicolons, spacing, etc. (#1116)
* Spelling. Spelling is hard.
* Add variable info to xml generated in variables.js
* Add missing CLAs info to the contributing file (#1119)
* Add missing CLAs info to the contributing file
* Added larger changes paragraph
* Replacing latest prettifier hosted in repo with latest version at rawgit CDN. (#1120)
* Forgot update code demo (#1121)
* Move audio code to a new file (#1122)
* 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 (#1126)
* Include variables at top of serialization.
* Move blockSvg.getHeightWidth to block_render_svg.js (#1118)
* Deserialization variables at top.
* Create grid object (#1131)
* 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
|
|
|
return newVar;
|
2016-07-01 15:51:59 -07:00
|
|
|
};
|
|
|
|
|
2018-02-16 17:32:13 -05:00
|
|
|
/**
|
|
|
|
* Update cached areas for this workspace.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.recordCachedAreas = function() {
|
|
|
|
this.recordBlocksArea_();
|
|
|
|
this.recordDeleteAreas_();
|
|
|
|
};
|
|
|
|
|
2014-12-23 11:22:02 -08:00
|
|
|
/**
|
|
|
|
* Make a list of all the delete areas for this workspace.
|
2018-02-21 18:31:34 -05:00
|
|
|
* @private
|
2014-12-23 11:22:02 -08:00
|
|
|
*/
|
2018-02-16 17:32:13 -05:00
|
|
|
Blockly.WorkspaceSvg.prototype.recordDeleteAreas_ = function() {
|
2014-12-23 11:22:02 -08:00
|
|
|
if (this.trashcan) {
|
2016-02-03 15:28:29 -08:00
|
|
|
this.deleteAreaTrash_ = this.trashcan.getClientRect();
|
2014-12-23 11:22:02 -08:00
|
|
|
} else {
|
|
|
|
this.deleteAreaTrash_ = null;
|
|
|
|
}
|
|
|
|
if (this.flyout_) {
|
2016-02-03 15:28:29 -08:00
|
|
|
this.deleteAreaToolbox_ = this.flyout_.getClientRect();
|
2014-12-23 11:22:02 -08:00
|
|
|
} else if (this.toolbox_) {
|
2016-02-03 15:28:29 -08:00
|
|
|
this.deleteAreaToolbox_ = this.toolbox_.getClientRect();
|
2014-12-23 11:22:02 -08:00
|
|
|
} else {
|
|
|
|
this.deleteAreaToolbox_ = null;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-02-16 17:32:13 -05:00
|
|
|
/**
|
|
|
|
* Record where all of blocks GUI is on the screen
|
2018-02-21 18:31:34 -05:00
|
|
|
* @private
|
2018-02-16 17:32:13 -05:00
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.recordBlocksArea_ = function() {
|
2018-03-05 15:52:31 -05:00
|
|
|
var parentSvg = this.getParentSvg();
|
|
|
|
if (parentSvg) {
|
|
|
|
var bounds = parentSvg.getBoundingClientRect();
|
|
|
|
this.blocksArea_ = new goog.math.Rect(bounds.left, bounds.top, bounds.width, bounds.height);
|
|
|
|
} else {
|
2018-03-05 14:34:41 -05:00
|
|
|
this.blocksArea_ = null;
|
|
|
|
}
|
2018-02-16 17:32:13 -05:00
|
|
|
};
|
|
|
|
|
2014-12-23 11:22:02 -08:00
|
|
|
/**
|
2016-05-04 14:49:00 -07:00
|
|
|
* Is the mouse event over a delete area (toolbox or non-closing flyout)?
|
2014-12-23 11:22:02 -08:00
|
|
|
* @param {!Event} e Mouse move event.
|
2017-02-02 14:17:43 -05:00
|
|
|
* @return {?number} Null if not over a delete area, or an enum representing
|
|
|
|
* which delete area the event is over.
|
2014-12-23 11:22:02 -08:00
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.isDeleteArea = function(e) {
|
2016-02-03 15:28:29 -08:00
|
|
|
var xy = new goog.math.Coordinate(e.clientX, e.clientY);
|
2017-02-02 14:17:43 -05:00
|
|
|
if (this.deleteAreaTrash_ && this.deleteAreaTrash_.contains(xy)) {
|
|
|
|
return Blockly.DELETE_AREA_TRASH;
|
2014-12-23 11:22:02 -08:00
|
|
|
}
|
2017-02-02 14:17:43 -05:00
|
|
|
if (this.deleteAreaToolbox_ && this.deleteAreaToolbox_.contains(xy)) {
|
|
|
|
return Blockly.DELETE_AREA_TOOLBOX;
|
2014-12-23 11:22:02 -08:00
|
|
|
}
|
2017-05-22 13:08:22 -07:00
|
|
|
return Blockly.DELETE_AREA_NONE;
|
2014-12-23 11:22:02 -08:00
|
|
|
};
|
|
|
|
|
2018-02-12 10:28:46 -05:00
|
|
|
/**
|
2018-02-16 17:32:13 -05:00
|
|
|
* Is the mouse event inside the blocks UI?
|
2018-02-12 10:28:46 -05:00
|
|
|
* @param {!Event} e Mouse move event.
|
2018-02-16 17:32:13 -05:00
|
|
|
* @return {boolean} True if event is within the bounds of the blocks UI or delete area
|
2018-02-12 10:28:46 -05:00
|
|
|
*/
|
2018-02-16 17:32:13 -05:00
|
|
|
Blockly.WorkspaceSvg.prototype.isInsideBlocksArea = function(e) {
|
|
|
|
var xy = new goog.math.Coordinate(e.clientX, e.clientY);
|
|
|
|
if (this.isDeleteArea(e) || (this.blocksArea_ && this.blocksArea_.contains(xy))) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2018-02-12 10:28:46 -05:00
|
|
|
};
|
|
|
|
|
2015-04-28 13:51:25 -07:00
|
|
|
/**
|
|
|
|
* Handle a mouse-down on SVG drawing surface.
|
|
|
|
* @param {!Event} e Mouse down event.
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.onMouseDown_ = function(e) {
|
2017-05-22 13:08:22 -07:00
|
|
|
var gesture = this.getGesture(e);
|
|
|
|
if (gesture) {
|
|
|
|
gesture.handleWsStart(e, this);
|
2015-04-28 13:51:25 -07:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-08-19 17:21:05 -07:00
|
|
|
/**
|
|
|
|
* Start tracking a drag of an object on this workspace.
|
|
|
|
* @param {!Event} e Mouse down event.
|
2016-04-19 23:24:42 -07:00
|
|
|
* @param {!goog.math.Coordinate} xy Starting location of object.
|
2015-08-19 17:21:05 -07:00
|
|
|
*/
|
2016-04-19 23:24:42 -07:00
|
|
|
Blockly.WorkspaceSvg.prototype.startDrag = function(e, xy) {
|
2015-08-19 17:21:05 -07:00
|
|
|
// Record the starting offset between the bubble's location and the mouse.
|
2017-02-02 14:17:43 -05:00
|
|
|
var point = Blockly.utils.mouseToSvg(e, this.getParentSvg(),
|
Merge google/develop June 22 (#441)
* Localisation updates from https://translatewiki.net.
* test page that creates random blocks and randomly drags them around the page
* Localisation updates from https://translatewiki.net.
* add missing return in fake drag
* get rid of drag_tests file:
* Generated JS helper functions should be camelCase.
Complying with Google style guide.
* Localisation updates from https://translatewiki.net.
* Fix extra category error. Clean up code, rename variables, reduce line lengths, fix lint issues.
* Remove claim that good.string.quote should be used.
* Change the blockly workspace resizing strategy. (#386)
* Add a new method to be called when the contents of the workspace change and
the scrollbars need to be adjusted but the the chrome (trash, toolbox, etc)
are expected to stay in the same place.
Change a bunch of calls to svgResize to either be removed or call the new
method instead. This is a nice performance win since the offsetHeight/Width
call in svgResize can be expensive, especially when called as often as we do -
there was some layout thrashing.
This also paves the way for moving calls to recordDeleteAreas
(which is also expensive) to a more cacheable spot than on every
mouse down/touch event.
of things (namely the scrollbars)
* Fix size of graph demo when it first loads by calling svgResize.
The graph starts with fixed width and was relying on a resize event
to fire (which I believe was removed in commit
217c681b86b0f2df76c479c9efae62e6e).
* Fix the resizing of the code demo. The demo's tab min-width used to
match the toolbox's width was only being set on a resize event, but
commit 217c681b86b0f2df76c479c9efae62e6e changed how that worked.
* Fix up some comments.
* Use specific workspaces rather than Blockly.getMainWorkspace().
* Make workspace required for resizeSvgContents and update
some calls to send real workspaces rather than ones that are
null.
Remove the private tag on terminateDrag_ because it is only
actually called from outside the BlockSvg object.
* Remove a rogue period.
* Recategorize BlockSvg.terminateDrag_ to @package instead of @private so that
other developers don't use it, but it still can be used by other Blockly classes.
* Add a TODO to fix issue #307.
* Add @package to workspace resizeContents.
* Routine recompile
* Fix unit tests.
* Fix inheritance on rendered connection.
Closure compiler on maximum compression breaks badly due to lack of
@extends attribute.
* Add toolbox location and toolbox mode options to playground.
* Increase commonality between playgrounds.
* Properly deal with shadow statement blocks in stacks.
* Localisation updates from https://translatewiki.net.
* Use a comment block for function comments in generated JS, Python and Dart.
* Fix typo in flyout.js (#403)
* Fix typo in flyout.js (#402)
* Line wrap comments in generated code.
* Remove reference to undefined variable (#413)
REASON_MUST_DISCONNECT was removed by a refactor in 2a1ffa1.
* Fix airstrike by grabbing the correct toolbox element. (#411)
Probably broken in 266e2ffa9a017d21d7ca2f151730d6ecfcecf173.
* Localisation updates from https://translatewiki.net.
* Fix issue #406 by calling resize from the keypress handler on text inputs. (#408)
* Remove shadow blocks from Accessible Blockly demo. Update README.
* Generate for loops on one line.
* Introduce a common translation pipe; remove local stringMap attributes. Fix variable name error in paste functions. Minor linting.
* Fix precedence on isIndex blocks.
* Add indexing setting for JavaScript Generation (#419)
Adding setting to allow for switching between zero and one based indexing for Blockly Blocks such that the generated code will use this flag to determine whether one based or zero based indexing should be used. One based indexing is enabled by default.
* Remove unused functions and dependencies.
* Remove the unnecessary construction of new services.
* Fix sort block in JS to satisfy tests.
* Trigger a contents resize in block's moveBy. (#422)
This fixes #420 but and it also fixes some other similar problems
with copy/paste and other users of moveBy.
* Consolidate the usages of the 'blockly-disabled' label.
* Fix error when undoing a shadow block replacement. Issue #415.
* Unify setActiveDesc() and updateSelectedNode() in the TreeService. Move function calls made directly within the template to the correct hooks.
* Standardize naming of components.
* Prevent collisions between user functions and helper functions.
* Localisation updates from https://translatewiki.net.
* Fix #425. Attash the resize handler to the workspace so it can be removed (#429)
when workspace.dispose() is called.
* Change the TreeService to a singleton.
* Remove unneeded generated parens around function calls in indexOf blocks.
* Fix #423 by calling workspace's resize when the flyout reflows. (#430)
* Updating URLs to reflect new docs. (#418)
* Updating URLs to reflect new docs. Removing -blockly in URLs.
* Rebuilt.
* Routine recompile
* Prevent selected block from ending up underneath a bumped block.
* Fix undo on fields with validators with side effects.
* Don't fire change event on fields that haven't been named yet.
* Localisation updates from https://translatewiki.net.
* Fix tree focus issues.
* Fix remaining focus issues on block deletion.
* cache delete areas instead of recalculating them onMouseDown
* Cache screen CTM for performance improvement.
* Call svgResizeContents from block_svg's dipose so that deleting blocks (#434)
from the context menu (or anywhere really) causes the workspace to
recalculate its size.
Remove the call to svgResizeContents from onMouseUp's logic for
determining whether the block is being dropped in the trash
since it calls dispose.
One side effect of this is that when you delete multiple blocks
resize gets called for each of them and the scrollbars move during
the operation. This is most obviously seen by doing an airstrike
in the playground and then deleting all the blocks at once.
* Allow terminal blocks to replace other terminal blocks (#433)
* Allow terminal blocks to replace other terminal blocks
* Updated test to allow replacing terminal blocks
* Refactor how activeDescendant is set. Introduce helper functions to ensure that calls like pasteAbove() preserve the focus.
* Localisation updates from https://translatewiki.net.
* Remove unnecessary logging.
* Reduce unneeded parentheses in JS and Python.
* Start using field_number.
* Make it easy to disable unconnected blocks.
* Routine recompile.
* Check if matrix is null in mouseToSvg
* Remove js/ localizations pre-merge
* Fix change to block_render_svg
* Fix error in xml.js
* Playground merge
* Add simple toolboxes to playgrounds
* Fix flyout reference in events listener
* Move tokenizeIntepolation into Blockly.utils namespace.
* Use simpler message interpolation in Code demo.
* Create console stub for IE 9.
* Don't output blockId if not set (e.g., toolbox category event). (#443)
* Fix block in multi-playground
* Increase commonality between playgrounds.
# Conflicts:
# tests/multi_playground.html
# tests/playground.html
* Remove "show flyouts" button
* Recompile for merge June 22
2016-06-22 17:50:16 -04:00
|
|
|
this.getInverseScreenCTM());
|
2015-08-19 17:21:05 -07:00
|
|
|
// Fix scale of mouse event.
|
|
|
|
point.x /= this.scale;
|
|
|
|
point.y /= this.scale;
|
2016-04-19 23:24:42 -07:00
|
|
|
this.dragDeltaXY_ = goog.math.Coordinate.difference(xy, point);
|
2015-08-19 17:21:05 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Track a drag of an object on this workspace.
|
|
|
|
* @param {!Event} e Mouse move event.
|
|
|
|
* @return {!goog.math.Coordinate} New location of object.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.moveDrag = function(e) {
|
2017-02-02 14:17:43 -05:00
|
|
|
var point = Blockly.utils.mouseToSvg(e, this.getParentSvg(),
|
Merge google/develop June 22 (#441)
* Localisation updates from https://translatewiki.net.
* test page that creates random blocks and randomly drags them around the page
* Localisation updates from https://translatewiki.net.
* add missing return in fake drag
* get rid of drag_tests file:
* Generated JS helper functions should be camelCase.
Complying with Google style guide.
* Localisation updates from https://translatewiki.net.
* Fix extra category error. Clean up code, rename variables, reduce line lengths, fix lint issues.
* Remove claim that good.string.quote should be used.
* Change the blockly workspace resizing strategy. (#386)
* Add a new method to be called when the contents of the workspace change and
the scrollbars need to be adjusted but the the chrome (trash, toolbox, etc)
are expected to stay in the same place.
Change a bunch of calls to svgResize to either be removed or call the new
method instead. This is a nice performance win since the offsetHeight/Width
call in svgResize can be expensive, especially when called as often as we do -
there was some layout thrashing.
This also paves the way for moving calls to recordDeleteAreas
(which is also expensive) to a more cacheable spot than on every
mouse down/touch event.
of things (namely the scrollbars)
* Fix size of graph demo when it first loads by calling svgResize.
The graph starts with fixed width and was relying on a resize event
to fire (which I believe was removed in commit
217c681b86b0f2df76c479c9efae62e6e).
* Fix the resizing of the code demo. The demo's tab min-width used to
match the toolbox's width was only being set on a resize event, but
commit 217c681b86b0f2df76c479c9efae62e6e changed how that worked.
* Fix up some comments.
* Use specific workspaces rather than Blockly.getMainWorkspace().
* Make workspace required for resizeSvgContents and update
some calls to send real workspaces rather than ones that are
null.
Remove the private tag on terminateDrag_ because it is only
actually called from outside the BlockSvg object.
* Remove a rogue period.
* Recategorize BlockSvg.terminateDrag_ to @package instead of @private so that
other developers don't use it, but it still can be used by other Blockly classes.
* Add a TODO to fix issue #307.
* Add @package to workspace resizeContents.
* Routine recompile
* Fix unit tests.
* Fix inheritance on rendered connection.
Closure compiler on maximum compression breaks badly due to lack of
@extends attribute.
* Add toolbox location and toolbox mode options to playground.
* Increase commonality between playgrounds.
* Properly deal with shadow statement blocks in stacks.
* Localisation updates from https://translatewiki.net.
* Use a comment block for function comments in generated JS, Python and Dart.
* Fix typo in flyout.js (#403)
* Fix typo in flyout.js (#402)
* Line wrap comments in generated code.
* Remove reference to undefined variable (#413)
REASON_MUST_DISCONNECT was removed by a refactor in 2a1ffa1.
* Fix airstrike by grabbing the correct toolbox element. (#411)
Probably broken in 266e2ffa9a017d21d7ca2f151730d6ecfcecf173.
* Localisation updates from https://translatewiki.net.
* Fix issue #406 by calling resize from the keypress handler on text inputs. (#408)
* Remove shadow blocks from Accessible Blockly demo. Update README.
* Generate for loops on one line.
* Introduce a common translation pipe; remove local stringMap attributes. Fix variable name error in paste functions. Minor linting.
* Fix precedence on isIndex blocks.
* Add indexing setting for JavaScript Generation (#419)
Adding setting to allow for switching between zero and one based indexing for Blockly Blocks such that the generated code will use this flag to determine whether one based or zero based indexing should be used. One based indexing is enabled by default.
* Remove unused functions and dependencies.
* Remove the unnecessary construction of new services.
* Fix sort block in JS to satisfy tests.
* Trigger a contents resize in block's moveBy. (#422)
This fixes #420 but and it also fixes some other similar problems
with copy/paste and other users of moveBy.
* Consolidate the usages of the 'blockly-disabled' label.
* Fix error when undoing a shadow block replacement. Issue #415.
* Unify setActiveDesc() and updateSelectedNode() in the TreeService. Move function calls made directly within the template to the correct hooks.
* Standardize naming of components.
* Prevent collisions between user functions and helper functions.
* Localisation updates from https://translatewiki.net.
* Fix #425. Attash the resize handler to the workspace so it can be removed (#429)
when workspace.dispose() is called.
* Change the TreeService to a singleton.
* Remove unneeded generated parens around function calls in indexOf blocks.
* Fix #423 by calling workspace's resize when the flyout reflows. (#430)
* Updating URLs to reflect new docs. (#418)
* Updating URLs to reflect new docs. Removing -blockly in URLs.
* Rebuilt.
* Routine recompile
* Prevent selected block from ending up underneath a bumped block.
* Fix undo on fields with validators with side effects.
* Don't fire change event on fields that haven't been named yet.
* Localisation updates from https://translatewiki.net.
* Fix tree focus issues.
* Fix remaining focus issues on block deletion.
* cache delete areas instead of recalculating them onMouseDown
* Cache screen CTM for performance improvement.
* Call svgResizeContents from block_svg's dipose so that deleting blocks (#434)
from the context menu (or anywhere really) causes the workspace to
recalculate its size.
Remove the call to svgResizeContents from onMouseUp's logic for
determining whether the block is being dropped in the trash
since it calls dispose.
One side effect of this is that when you delete multiple blocks
resize gets called for each of them and the scrollbars move during
the operation. This is most obviously seen by doing an airstrike
in the playground and then deleting all the blocks at once.
* Allow terminal blocks to replace other terminal blocks (#433)
* Allow terminal blocks to replace other terminal blocks
* Updated test to allow replacing terminal blocks
* Refactor how activeDescendant is set. Introduce helper functions to ensure that calls like pasteAbove() preserve the focus.
* Localisation updates from https://translatewiki.net.
* Remove unnecessary logging.
* Reduce unneeded parentheses in JS and Python.
* Start using field_number.
* Make it easy to disable unconnected blocks.
* Routine recompile.
* Check if matrix is null in mouseToSvg
* Remove js/ localizations pre-merge
* Fix change to block_render_svg
* Fix error in xml.js
* Playground merge
* Add simple toolboxes to playgrounds
* Fix flyout reference in events listener
* Move tokenizeIntepolation into Blockly.utils namespace.
* Use simpler message interpolation in Code demo.
* Create console stub for IE 9.
* Don't output blockId if not set (e.g., toolbox category event). (#443)
* Fix block in multi-playground
* Increase commonality between playgrounds.
# Conflicts:
# tests/multi_playground.html
# tests/playground.html
* Remove "show flyouts" button
* Recompile for merge June 22
2016-06-22 17:50:16 -04:00
|
|
|
this.getInverseScreenCTM());
|
2015-08-19 17:21:05 -07:00
|
|
|
// Fix scale of mouse event.
|
|
|
|
point.x /= this.scale;
|
|
|
|
point.y /= this.scale;
|
2016-04-19 23:24:42 -07:00
|
|
|
return goog.math.Coordinate.sum(this.dragDeltaXY_, point);
|
2015-08-19 17:21:05 -07:00
|
|
|
};
|
|
|
|
|
2016-06-29 03:11:48 +02:00
|
|
|
/**
|
2016-07-15 10:35:45 +02:00
|
|
|
* Is the user currently dragging a block or scrolling the flyout/workspace?
|
2016-06-29 17:44:12 -07:00
|
|
|
* @return {boolean} True if currently dragging or scrolling.
|
2016-06-29 03:11:48 +02:00
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.isDragging = function() {
|
2017-05-22 13:08:22 -07:00
|
|
|
return this.currentGesture_ && this.currentGesture_.isDragging();
|
2016-06-29 03:11:48 +02:00
|
|
|
};
|
|
|
|
|
Feature/merge feb 2017 (#791)
* 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 c8ca24a0007b70e137417e843459c87185141a55.
* 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… (#732)
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. (#748)
* 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 (#741)
* 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. (#749)
* 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 #758.
* Split the scrollbar and flyout out into their own SVG elements. They (#771)
* 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. (#699)
* Fix #698 by adjusting the regex to not have \. Still not 100% sure w… (#700)
* Fix #698 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… (#777)
* 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… (#778)
* 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 #748 and stop using contains since it is not supported in IE
* Fixes #786 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. (#787)
* 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 #791.
* Localisation updates from https://translatewiki.net.
* Localisation updates from https://translatewiki.net.
* Use the drag surface when scrolling using the scrollbars. #783 (#789)
* End event groups when you finish editing a field
* Fix #794 and make the workspace grid drag along with the workspace. (#801)
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. (#790)
* 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. (#805)
* Don't connect to blocks under the flyout.
* recompile again. (#806)
* 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 #813 by ademenev
* PR #818: 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. (#820)
From commits b77f8cbebc5cef247116d3df6a428df8addbe53d and 4ecdedec9f8a69f78abf246e7a5db1e1a0be6b85
* Naming changes in mirror demo
* Adding support for untranslated messages. (#819)
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. (#825)
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 #828.
* 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" (#832)
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. (#836)
Fixes commits in #832.
* Adding extensions for JSON support of dynamic blocks. (#834)
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 … (#837)
* 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 #816 so that layering of the flyout and workspace scrollbars
are done correctly.
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 12:09:23 -08:00
|
|
|
/**
|
|
|
|
* Is this workspace draggable and scrollable?
|
|
|
|
* @return {boolean} True if this workspace may be dragged.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.isDraggable = function() {
|
|
|
|
return !!this.scrollbar;
|
|
|
|
};
|
|
|
|
|
2015-08-19 17:21:05 -07:00
|
|
|
/**
|
|
|
|
* Handle a mouse-wheel on SVG drawing surface.
|
|
|
|
* @param {!Event} e Mouse wheel event.
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.onMouseWheel_ = function(e) {
|
2017-05-22 13:08:22 -07:00
|
|
|
// TODO: Remove gesture cancellation and compensate for coordinate skew during
|
|
|
|
// zoom.
|
|
|
|
if (this.currentGesture_) {
|
|
|
|
this.currentGesture_.cancel();
|
|
|
|
}
|
2018-03-31 22:17:07 -03:00
|
|
|
|
|
|
|
// Multiplier variable, so that non-pixel-deltaModes are supported.
|
|
|
|
// See LLK/scratch-blocks#1190.
|
2018-07-23 14:00:29 -03:00
|
|
|
var multiplier = e.deltaMode === 0x1 ? Blockly.LINE_SCROLL_MULTIPLIER : 1;
|
2018-03-31 22:17:07 -03:00
|
|
|
|
2016-03-29 12:53:47 -04:00
|
|
|
if (e.ctrlKey) {
|
2017-02-02 14:17:43 -05:00
|
|
|
// The vertical scroll distance that corresponds to a click of a zoom button.
|
|
|
|
var PIXELS_PER_ZOOM_STEP = 50;
|
2018-03-31 22:17:07 -03:00
|
|
|
var delta = -e.deltaY / PIXELS_PER_ZOOM_STEP * multiplier;
|
2017-02-02 14:17:43 -05:00
|
|
|
var position = Blockly.utils.mouseToSvg(e, this.getParentSvg(),
|
Feature/merge feb 2017 (#791)
* 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 c8ca24a0007b70e137417e843459c87185141a55.
* 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… (#732)
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. (#748)
* 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 (#741)
* 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. (#749)
* 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 #758.
* Split the scrollbar and flyout out into their own SVG elements. They (#771)
* 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. (#699)
* Fix #698 by adjusting the regex to not have \. Still not 100% sure w… (#700)
* Fix #698 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… (#777)
* 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… (#778)
* 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 #748 and stop using contains since it is not supported in IE
* Fixes #786 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. (#787)
* 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 #791.
* Localisation updates from https://translatewiki.net.
* Localisation updates from https://translatewiki.net.
* Use the drag surface when scrolling using the scrollbars. #783 (#789)
* End event groups when you finish editing a field
* Fix #794 and make the workspace grid drag along with the workspace. (#801)
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. (#790)
* 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. (#805)
* Don't connect to blocks under the flyout.
* recompile again. (#806)
* 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 #813 by ademenev
* PR #818: 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. (#820)
From commits b77f8cbebc5cef247116d3df6a428df8addbe53d and 4ecdedec9f8a69f78abf246e7a5db1e1a0be6b85
* Naming changes in mirror demo
* Adding support for untranslated messages. (#819)
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. (#825)
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 #828.
* 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" (#832)
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. (#836)
Fixes commits in #832.
* Adding extensions for JSON support of dynamic blocks. (#834)
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 … (#837)
* 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 #816 so that layering of the flyout and workspace scrollbars
are done correctly.
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 12:09:23 -08:00
|
|
|
this.getInverseScreenCTM());
|
2016-03-29 12:53:47 -04:00
|
|
|
this.zoom(position.x, position.y, delta);
|
|
|
|
} else {
|
|
|
|
// This is a regular mouse wheel event - scroll the workspace
|
2016-04-15 14:09:15 -04:00
|
|
|
// First hide the WidgetDiv without animation
|
|
|
|
// (mouse scroll makes field out of place with div)
|
|
|
|
Blockly.WidgetDiv.hide(true);
|
2016-04-21 15:33:28 -04:00
|
|
|
Blockly.DropDownDiv.hideWithoutAnimation();
|
2018-03-31 22:02:28 -03:00
|
|
|
|
|
|
|
var x = this.scrollX - e.deltaX * multiplier;
|
|
|
|
var y = this.scrollY - e.deltaY * multiplier;
|
|
|
|
|
2018-08-03 18:25:56 -03:00
|
|
|
if (e.shiftKey && e.deltaX === 0) {
|
|
|
|
// Scroll horizontally (based on vertical scroll delta)
|
|
|
|
// This is needed as for some browser/system combinations which do not
|
|
|
|
// set deltaX. See #1662.
|
|
|
|
x = this.scrollX - e.deltaY * multiplier;
|
|
|
|
y = this.scrollY; // Don't scroll vertically
|
|
|
|
}
|
|
|
|
|
2016-03-29 14:23:34 -04:00
|
|
|
this.startDragMetrics = this.getMetrics();
|
|
|
|
this.scroll(x, y);
|
2016-03-29 12:53:47 -04:00
|
|
|
}
|
2015-08-19 17:21:05 -07:00
|
|
|
e.preventDefault();
|
|
|
|
};
|
|
|
|
|
2016-02-29 12:52:38 -08:00
|
|
|
/**
|
|
|
|
* Calculate the bounding box for the blocks on the workspace.
|
2017-05-22 13:08:22 -07:00
|
|
|
* Coordinate system: workspace coordinates.
|
2016-02-29 12:52:38 -08:00
|
|
|
*
|
|
|
|
* @return {Object} Contains the position and size of the bounding box
|
|
|
|
* containing the blocks on the workspace.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.getBlocksBoundingBox = function() {
|
2016-07-08 15:50:09 -07:00
|
|
|
var topBlocks = this.getTopBlocks(false);
|
2018-05-11 16:35:31 -07:00
|
|
|
var topComments = this.getTopComments(false);
|
|
|
|
var topElements = topBlocks.concat(topComments);
|
2016-02-29 12:52:38 -08:00
|
|
|
// There are no blocks, return empty rectangle.
|
2018-05-11 16:35:31 -07:00
|
|
|
if (!topElements.length) {
|
2016-02-29 12:52:38 -08:00
|
|
|
return {x: 0, y: 0, width: 0, height: 0};
|
|
|
|
}
|
|
|
|
|
|
|
|
// Initialize boundary using the first block.
|
2018-05-11 16:35:31 -07:00
|
|
|
var boundary = topElements[0].getBoundingRectangle();
|
2016-02-29 12:52:38 -08:00
|
|
|
|
|
|
|
// Start at 1 since the 0th block was used for initialization
|
2018-05-11 16:35:31 -07:00
|
|
|
for (var i = 1; i < topElements.length; i++) {
|
|
|
|
var blockBoundary = topElements[i].getBoundingRectangle();
|
2016-02-29 12:52:38 -08:00
|
|
|
if (blockBoundary.topLeft.x < boundary.topLeft.x) {
|
|
|
|
boundary.topLeft.x = blockBoundary.topLeft.x;
|
|
|
|
}
|
|
|
|
if (blockBoundary.bottomRight.x > boundary.bottomRight.x) {
|
2016-03-18 15:19:26 -07:00
|
|
|
boundary.bottomRight.x = blockBoundary.bottomRight.x;
|
2016-02-29 12:52:38 -08:00
|
|
|
}
|
|
|
|
if (blockBoundary.topLeft.y < boundary.topLeft.y) {
|
|
|
|
boundary.topLeft.y = blockBoundary.topLeft.y;
|
|
|
|
}
|
|
|
|
if (blockBoundary.bottomRight.y > boundary.bottomRight.y) {
|
|
|
|
boundary.bottomRight.y = blockBoundary.bottomRight.y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
x: boundary.topLeft.x,
|
|
|
|
y: boundary.topLeft.y,
|
|
|
|
width: boundary.bottomRight.x - boundary.topLeft.x,
|
|
|
|
height: boundary.bottomRight.y - boundary.topLeft.y
|
|
|
|
};
|
2015-08-19 17:21:05 -07:00
|
|
|
};
|
|
|
|
|
2015-10-09 19:22:22 -07:00
|
|
|
/**
|
|
|
|
* Clean up the workspace by ordering all the blocks in a column.
|
|
|
|
*/
|
2016-08-02 17:18:12 -07:00
|
|
|
Blockly.WorkspaceSvg.prototype.cleanUp = function() {
|
2017-08-24 15:51:31 -07:00
|
|
|
this.setResizesEnabled(false);
|
2016-03-03 17:48:54 -08:00
|
|
|
Blockly.Events.setGroup(true);
|
2015-10-09 19:22:22 -07:00
|
|
|
var topBlocks = this.getTopBlocks(true);
|
|
|
|
var cursorY = 0;
|
|
|
|
for (var i = 0, block; block = topBlocks[i]; i++) {
|
|
|
|
var xy = block.getRelativeToSurfaceXY();
|
|
|
|
block.moveBy(-xy.x, cursorY - xy.y);
|
|
|
|
block.snapToGrid();
|
2015-10-12 16:14:03 -07:00
|
|
|
cursorY = block.getRelativeToSurfaceXY().y +
|
|
|
|
block.getHeightWidth().height + Blockly.BlockSvg.MIN_BLOCK_Y;
|
2015-10-09 19:22:22 -07:00
|
|
|
}
|
2016-03-03 17:48:54 -08:00
|
|
|
Blockly.Events.setGroup(false);
|
2017-08-24 15:51:31 -07:00
|
|
|
this.setResizesEnabled(true);
|
2015-10-09 19:22:22 -07:00
|
|
|
};
|
|
|
|
|
2015-04-28 13:51:25 -07:00
|
|
|
/**
|
|
|
|
* Show the context menu for the workspace.
|
|
|
|
* @param {!Event} e Mouse event.
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.showContextMenu_ = function(e) {
|
2015-12-17 14:16:04 -08:00
|
|
|
if (this.options.readOnly || this.isFlyout) {
|
2015-04-28 13:51:25 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
var menuOptions = [];
|
2015-10-09 19:22:22 -07:00
|
|
|
var topBlocks = this.getTopBlocks(true);
|
2017-02-02 14:17:43 -05:00
|
|
|
var eventGroup = Blockly.utils.genUid();
|
2017-05-22 13:08:22 -07:00
|
|
|
var ws = this;
|
2016-03-17 14:44:26 -07:00
|
|
|
|
|
|
|
// Options to undo/redo previous action.
|
2017-10-13 13:36:37 -07:00
|
|
|
menuOptions.push(Blockly.ContextMenu.wsUndoOption(this));
|
|
|
|
menuOptions.push(Blockly.ContextMenu.wsRedoOption(this));
|
2016-03-17 14:44:26 -07:00
|
|
|
|
2015-10-09 19:22:22 -07:00
|
|
|
// Option to clean up blocks.
|
2016-03-24 21:31:13 -07:00
|
|
|
if (this.scrollbar) {
|
2017-10-13 13:36:37 -07:00
|
|
|
menuOptions.push(
|
|
|
|
Blockly.ContextMenu.wsCleanupOption(this,topBlocks.length));
|
2016-03-24 21:31:13 -07:00
|
|
|
}
|
2015-10-09 19:22:22 -07:00
|
|
|
|
2015-04-28 13:51:25 -07:00
|
|
|
if (this.options.collapse) {
|
|
|
|
var hasCollapsedBlocks = false;
|
|
|
|
var hasExpandedBlocks = false;
|
|
|
|
for (var i = 0; i < topBlocks.length; i++) {
|
|
|
|
var block = topBlocks[i];
|
|
|
|
while (block) {
|
|
|
|
if (block.isCollapsed()) {
|
|
|
|
hasCollapsedBlocks = true;
|
|
|
|
} else {
|
|
|
|
hasExpandedBlocks = true;
|
|
|
|
}
|
|
|
|
block = block.getNextBlock();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-13 13:36:37 -07:00
|
|
|
menuOptions.push(Blockly.ContextMenu.wsCollapseOption(hasExpandedBlocks,
|
|
|
|
topBlocks));
|
2015-10-05 21:26:16 +08:00
|
|
|
|
2017-10-13 13:36:37 -07:00
|
|
|
menuOptions.push(Blockly.ContextMenu.wsExpandOption(hasCollapsedBlocks,
|
|
|
|
topBlocks));
|
2015-04-28 13:51:25 -07:00
|
|
|
}
|
|
|
|
|
2018-05-11 16:35:31 -07:00
|
|
|
// Option to add a workspace comment.
|
|
|
|
if (this.options.comments) {
|
|
|
|
menuOptions.push(Blockly.ContextMenu.workspaceCommentOption(ws, e));
|
|
|
|
}
|
|
|
|
|
2015-12-02 22:10:09 -08:00
|
|
|
// Option to delete all blocks.
|
|
|
|
// Count the number of blocks that are deletable.
|
2017-10-13 13:36:37 -07:00
|
|
|
var deleteList = Blockly.WorkspaceSvg.buildDeleteList_(topBlocks);
|
2016-05-24 17:38:10 -04:00
|
|
|
// Scratch-specific: don't count shadow blocks in delete count
|
|
|
|
var deleteCount = 0;
|
|
|
|
for (var i = 0; i < deleteList.length; i++) {
|
|
|
|
if (!deleteList[i].isShadow()) {
|
|
|
|
deleteCount++;
|
|
|
|
}
|
|
|
|
}
|
2017-10-13 13:36:37 -07:00
|
|
|
|
|
|
|
var DELAY = 10;
|
2015-12-02 22:10:09 -08:00
|
|
|
function deleteNext() {
|
2016-03-17 14:44:26 -07:00
|
|
|
Blockly.Events.setGroup(eventGroup);
|
2015-12-02 22:10:09 -08:00
|
|
|
var block = deleteList.shift();
|
|
|
|
if (block) {
|
|
|
|
if (block.workspace) {
|
|
|
|
block.dispose(false, true);
|
|
|
|
setTimeout(deleteNext, DELAY);
|
|
|
|
} else {
|
|
|
|
deleteNext();
|
|
|
|
}
|
|
|
|
}
|
2016-03-17 14:44:26 -07:00
|
|
|
Blockly.Events.setGroup(false);
|
2015-12-02 22:10:09 -08:00
|
|
|
}
|
2016-05-25 12:53:42 -07:00
|
|
|
|
|
|
|
var deleteOption = {
|
2016-06-06 17:20:27 -04:00
|
|
|
text: deleteCount == 1 ? Blockly.Msg.DELETE_BLOCK :
|
|
|
|
Blockly.Msg.DELETE_X_BLOCKS.replace('%1', String(deleteCount)),
|
|
|
|
enabled: deleteCount > 0,
|
2016-05-25 12:53:42 -07:00
|
|
|
callback: function() {
|
2017-05-22 13:08:22 -07:00
|
|
|
if (ws.currentGesture_) {
|
|
|
|
ws.currentGesture_.cancel();
|
|
|
|
}
|
2019-08-13 13:56:44 +02:00
|
|
|
if (deleteCount < 2 ) {
|
2016-05-25 12:53:42 -07:00
|
|
|
deleteNext();
|
2016-10-20 09:30:45 -07:00
|
|
|
} else {
|
2018-05-02 11:05:43 -07:00
|
|
|
Blockly.confirm(
|
|
|
|
Blockly.Msg.DELETE_ALL_BLOCKS.replace('%1', String(deleteCount)),
|
2016-10-20 09:30:45 -07:00
|
|
|
function(ok) {
|
|
|
|
if (ok) {
|
|
|
|
deleteNext();
|
|
|
|
}
|
|
|
|
});
|
2016-05-25 12:53:42 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2015-12-02 22:10:09 -08:00
|
|
|
menuOptions.push(deleteOption);
|
|
|
|
|
2015-04-28 13:51:25 -07:00
|
|
|
Blockly.ContextMenu.show(e, menuOptions, this.RTL);
|
|
|
|
};
|
|
|
|
|
2017-10-13 13:36:37 -07:00
|
|
|
/**
|
|
|
|
* Build a list of all deletable blocks that are reachable from the given
|
|
|
|
* list of top blocks.
|
|
|
|
* @param {!Array.<!Blockly.BlockSvg>} topBlocks The list of top blocks on the
|
|
|
|
* workspace.
|
|
|
|
* @return {!Array.<!Blockly.BlockSvg>} A list of deletable blocks on the
|
|
|
|
* workspace.
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.buildDeleteList_ = function(topBlocks) {
|
|
|
|
var deleteList = [];
|
|
|
|
function addDeletableBlocks(block) {
|
|
|
|
if (block.isDeletable()) {
|
2018-05-16 12:51:41 -07:00
|
|
|
deleteList = deleteList.concat(block.getDescendants(false));
|
2017-10-13 13:36:37 -07:00
|
|
|
} else {
|
|
|
|
var children = block.getChildren();
|
|
|
|
for (var i = 0; i < children.length; i++) {
|
|
|
|
addDeletableBlocks(children[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (var i = 0; i < topBlocks.length; i++) {
|
|
|
|
addDeletableBlocks(topBlocks[i]);
|
|
|
|
}
|
|
|
|
return deleteList;
|
|
|
|
};
|
|
|
|
|
2015-07-09 11:57:06 -07:00
|
|
|
/**
|
|
|
|
* Modify the block tree on the existing toolbox.
|
|
|
|
* @param {Node|string} tree DOM tree of blocks, or text representation of same.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.updateToolbox = function(tree) {
|
2016-04-07 13:38:36 -07:00
|
|
|
tree = Blockly.Options.parseToolboxTree(tree);
|
2015-07-09 11:57:06 -07:00
|
|
|
if (!tree) {
|
|
|
|
if (this.options.languageTree) {
|
2018-08-22 15:29:43 -04:00
|
|
|
throw 'Can\'t nullify an existing toolbox.';
|
2015-07-09 11:57:06 -07:00
|
|
|
}
|
2016-02-05 18:41:47 -08:00
|
|
|
return; // No change (null to null).
|
2015-07-09 11:57:06 -07:00
|
|
|
}
|
|
|
|
if (!this.options.languageTree) {
|
2018-08-22 15:29:43 -04:00
|
|
|
throw 'Existing toolbox is null. Can\'t create new toolbox.';
|
2015-07-09 11:57:06 -07:00
|
|
|
}
|
2016-02-05 18:41:47 -08:00
|
|
|
if (tree.getElementsByTagName('category').length) {
|
2015-07-09 11:57:06 -07:00
|
|
|
if (!this.toolbox_) {
|
2018-08-22 15:29:43 -04:00
|
|
|
throw 'Existing toolbox has no categories. Can\'t change mode.';
|
2015-07-09 11:57:06 -07:00
|
|
|
}
|
|
|
|
this.options.languageTree = tree;
|
|
|
|
this.toolbox_.populate_(tree);
|
2017-04-07 14:12:37 -04:00
|
|
|
this.toolbox_.position();
|
2015-07-09 11:57:06 -07:00
|
|
|
} else {
|
|
|
|
if (!this.flyout_) {
|
2018-08-22 15:29:43 -04:00
|
|
|
throw 'Existing toolbox has categories. Can\'t change mode.';
|
2015-07-09 11:57:06 -07:00
|
|
|
}
|
|
|
|
this.options.languageTree = tree;
|
|
|
|
this.flyout_.show(tree.childNodes);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-04-28 13:51:25 -07:00
|
|
|
/**
|
|
|
|
* Mark this workspace as the currently focused main workspace.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.markFocused = function() {
|
2015-09-23 14:46:29 -07:00
|
|
|
if (this.options.parentWorkspace) {
|
|
|
|
this.options.parentWorkspace.markFocused();
|
|
|
|
} else {
|
|
|
|
Blockly.mainWorkspace = this;
|
Merge google/blockly, May 2017 (#881)
* Move createDom call into the constructor of block drag surface. (#790)
* 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. (#805)
* Don't connect to blocks under the flyout.
* recompile again. (#806)
* 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 #813 by ademenev
* Localisation updates from https://translatewiki.net.
* PR #818: 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. (#820)
From commits b77f8cbebc5cef247116d3df6a428df8addbe53d and 4ecdedec9f8a69f78abf246e7a5db1e1a0be6b85
* Naming changes in mirror demo
* Adding support for untranslated messages. (#819)
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. (#825)
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 #828.
* 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" (#832)
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. (#836)
Fixes commits in #832.
* Adding extensions for JSON support of dynamic blocks. (#834)
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 … (#837)
* 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 #816 so that layering of the flyout and workspace scrollbars
are done correctly.
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Localisation updates from https://translatewiki.net.
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* Localisation updates from https://translatewiki.net.
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Localisation updates from https://translatewiki.net.
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 #661
* 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. (#934)
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 #946. Don't check for presence of constants.js
* Fix #945 (annotations) and an eslint issue (constant condition)
* Localisation updates from https://translatewiki.net.
* Fix #950: 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 #937.
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() (#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.
* Annotation fixes
* Fix bug #904 by explicitly grabbing focus on the workspace svg element. (#964)
* Potential fix for #888. Stops checking whether we are mid workspace drag since we do not always get mosue up events when blockly is in an iframe. (#899)
* Adding new minimap demo
* Basic code style changes. Adding a few more comments. Return early if disableScrollChange in onScrollChange listener.
* `unction` to `function` corrects #962 (#970)
* Cross browser friendly fix for #904. This calls blur and focus from … (#972)
* Cross browser friendly fix for #904. 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 #904 to keep the page from jumping to the focused workspace in IE 11 (#974)
* 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 #967 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 d55d9cbd9ff308ff5e361cf77acabb61a4bf4695). IIUC, updateWidth/getCachedWidth was only called from render before which is overridden in FieldImage to be a no-op already. (#979)
* Fix #969
* Localisation updates from https://translatewiki.net.
* Fix #986. Looks like the original PR just forgot this block. (#992)
* rebuild develop (#996)
* Added the variable modal and component and implemented basic renaming functionality. (#991)
* Fixing commenting from the last commit. (#1000)
* 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. (#1011)
* Minimap position bug fix for browsers other than chrome. Added touch support.
* Adding an add variable modal to accessible Blockly. (#1015)
* 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. (#1017)
Centralizes accessible modal behavior.
* - Changed error message referencing 'procedure' instead of 'function' (#1019)
- 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,… (#1028)
...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). (#1027)
* Enable google/blockly with continuous build on travis ci (#1023) (#1035)
* 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 #880.
* Ensure useDragSurface is a boolean.
Fixed #988
* use pretest instead of preinstall in package.json (#1043)
* 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 #973
* bumpNeighbours_ function moved to block_svg.
Fixed #1009
* Update RegEx in js-to-json to match windowi eol (#1050)
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 (#1053)
"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. (#1054)
* Correcting #1054 (#1056)
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… (#1057)
* Change how blockly handles cursors. The old way was quite slow because it changed the stylesheet directly. See issue #981 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. (#1059)
* Merge master into develop (#1063)
- pick up translation changes
- clean up trailing spaces
* use goog.string.startswith instead of string.startswith (#1065)
* New jsinterpreter demo includes wait block. Both demos have improved UI for clarity. (#1001)
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 #1069 (#1073)
* 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
|
|
|
// We call e.preventDefault in many event handlers which means we
|
|
|
|
// need to explicitly grab focus (e.g from a textarea) because
|
|
|
|
// the browser will not do it for us. How to do this is browser dependant.
|
|
|
|
this.setBrowserFocus();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the workspace to have focus in the browser.
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.setBrowserFocus = function() {
|
|
|
|
// Blur whatever was focused since explcitly grabbing focus below does not
|
|
|
|
// work in Edge.
|
|
|
|
if (document.activeElement) {
|
|
|
|
document.activeElement.blur();
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
// Focus the workspace SVG - this is for Chrome and Firefox.
|
|
|
|
this.getParentSvg().focus();
|
2018-08-22 15:29:43 -04:00
|
|
|
} catch (e) {
|
Merge google/blockly, May 2017 (#881)
* Move createDom call into the constructor of block drag surface. (#790)
* 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. (#805)
* Don't connect to blocks under the flyout.
* recompile again. (#806)
* 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 #813 by ademenev
* Localisation updates from https://translatewiki.net.
* PR #818: 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. (#820)
From commits b77f8cbebc5cef247116d3df6a428df8addbe53d and 4ecdedec9f8a69f78abf246e7a5db1e1a0be6b85
* Naming changes in mirror demo
* Adding support for untranslated messages. (#819)
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. (#825)
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 #828.
* 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" (#832)
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. (#836)
Fixes commits in #832.
* Adding extensions for JSON support of dynamic blocks. (#834)
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 … (#837)
* 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 #816 so that layering of the flyout and workspace scrollbars
are done correctly.
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Localisation updates from https://translatewiki.net.
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* Localisation updates from https://translatewiki.net.
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Localisation updates from https://translatewiki.net.
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 #661
* 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. (#934)
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 #946. Don't check for presence of constants.js
* Fix #945 (annotations) and an eslint issue (constant condition)
* Localisation updates from https://translatewiki.net.
* Fix #950: 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 #937.
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() (#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.
* Annotation fixes
* Fix bug #904 by explicitly grabbing focus on the workspace svg element. (#964)
* Potential fix for #888. Stops checking whether we are mid workspace drag since we do not always get mosue up events when blockly is in an iframe. (#899)
* Adding new minimap demo
* Basic code style changes. Adding a few more comments. Return early if disableScrollChange in onScrollChange listener.
* `unction` to `function` corrects #962 (#970)
* Cross browser friendly fix for #904. This calls blur and focus from … (#972)
* Cross browser friendly fix for #904. 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 #904 to keep the page from jumping to the focused workspace in IE 11 (#974)
* 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 #967 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 d55d9cbd9ff308ff5e361cf77acabb61a4bf4695). IIUC, updateWidth/getCachedWidth was only called from render before which is overridden in FieldImage to be a no-op already. (#979)
* Fix #969
* Localisation updates from https://translatewiki.net.
* Fix #986. Looks like the original PR just forgot this block. (#992)
* rebuild develop (#996)
* Added the variable modal and component and implemented basic renaming functionality. (#991)
* Fixing commenting from the last commit. (#1000)
* 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. (#1011)
* Minimap position bug fix for browsers other than chrome. Added touch support.
* Adding an add variable modal to accessible Blockly. (#1015)
* 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. (#1017)
Centralizes accessible modal behavior.
* - Changed error message referencing 'procedure' instead of 'function' (#1019)
- 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,… (#1028)
...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). (#1027)
* Enable google/blockly with continuous build on travis ci (#1023) (#1035)
* 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 #880.
* Ensure useDragSurface is a boolean.
Fixed #988
* use pretest instead of preinstall in package.json (#1043)
* 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 #973
* bumpNeighbours_ function moved to block_svg.
Fixed #1009
* Update RegEx in js-to-json to match windowi eol (#1050)
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 (#1053)
"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. (#1054)
* Correcting #1054 (#1056)
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… (#1057)
* Change how blockly handles cursors. The old way was quite slow because it changed the stylesheet directly. See issue #981 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. (#1059)
* Merge master into develop (#1063)
- pick up translation changes
- clean up trailing spaces
* use goog.string.startswith instead of string.startswith (#1065)
* New jsinterpreter demo includes wait block. Both demos have improved UI for clarity. (#1001)
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 #1069 (#1073)
* 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
|
|
|
// IE and Edge do not support focus on SVG elements. When that fails
|
|
|
|
// above, get the injectionDiv (the workspace's parent) and focus that
|
|
|
|
// instead. This doesn't work in Chrome.
|
|
|
|
try {
|
|
|
|
// In IE11, use setActive (which is IE only) so the page doesn't scroll
|
|
|
|
// to the workspace gaining focus.
|
|
|
|
this.getParentSvg().parentNode.setActive();
|
|
|
|
} catch (e) {
|
|
|
|
// setActive support was discontinued in Edge so when that fails, call
|
|
|
|
// focus instead.
|
|
|
|
this.getParentSvg().parentNode.focus();
|
|
|
|
}
|
2015-09-23 14:46:29 -07:00
|
|
|
}
|
2015-04-28 13:51:25 -07:00
|
|
|
};
|
|
|
|
|
2015-08-19 17:21:05 -07:00
|
|
|
/**
|
|
|
|
* Zooming the blocks centered in (x, y) coordinate with zooming in or out.
|
|
|
|
* @param {number} x X coordinate of center.
|
|
|
|
* @param {number} y Y coordinate of center.
|
2017-02-02 14:17:43 -05:00
|
|
|
* @param {number} amount Amount of zooming
|
|
|
|
* (negative zooms out and positive zooms in).
|
2015-08-19 17:21:05 -07:00
|
|
|
*/
|
2017-02-02 14:17:43 -05:00
|
|
|
Blockly.WorkspaceSvg.prototype.zoom = function(x, y, amount) {
|
2015-08-19 17:21:05 -07:00
|
|
|
var speed = this.options.zoomOptions.scaleSpeed;
|
|
|
|
var metrics = this.getMetrics();
|
2016-01-07 17:01:01 -08:00
|
|
|
var center = this.getParentSvg().createSVGPoint();
|
2015-08-19 17:21:05 -07:00
|
|
|
center.x = x;
|
|
|
|
center.y = y;
|
|
|
|
center = center.matrixTransform(this.getCanvas().getCTM().inverse());
|
|
|
|
x = center.x;
|
|
|
|
y = center.y;
|
|
|
|
var canvas = this.getCanvas();
|
|
|
|
// Scale factor.
|
2017-02-02 14:17:43 -05:00
|
|
|
var scaleChange = Math.pow(speed, amount);
|
2015-08-19 17:21:05 -07:00
|
|
|
// Clamp scale within valid range.
|
|
|
|
var newScale = this.scale * scaleChange;
|
|
|
|
if (newScale > this.options.zoomOptions.maxScale) {
|
|
|
|
scaleChange = this.options.zoomOptions.maxScale / this.scale;
|
|
|
|
} else if (newScale < this.options.zoomOptions.minScale) {
|
|
|
|
scaleChange = this.options.zoomOptions.minScale / this.scale;
|
|
|
|
}
|
2016-04-14 00:23:17 -07:00
|
|
|
if (this.scale == newScale) {
|
2015-09-01 20:00:13 +01:00
|
|
|
return; // No change in zoom.
|
|
|
|
}
|
2015-10-21 14:38:39 -07:00
|
|
|
if (this.scrollbar) {
|
2016-04-14 00:23:17 -07:00
|
|
|
var matrix = canvas.getCTM()
|
|
|
|
.translate(x * (1 - scaleChange), y * (1 - scaleChange))
|
|
|
|
.scale(scaleChange);
|
|
|
|
// newScale and matrix.a should be identical (within a rounding error).
|
2017-08-24 15:51:31 -07:00
|
|
|
// ScrollX and scrollY are in pixels.
|
2016-04-14 00:23:17 -07:00
|
|
|
this.scrollX = matrix.e - metrics.absoluteLeft;
|
|
|
|
this.scrollY = matrix.f - metrics.absoluteTop;
|
|
|
|
}
|
|
|
|
this.setScale(newScale);
|
2016-04-15 14:09:15 -04:00
|
|
|
// Hide the WidgetDiv without animation (zoom makes field out of place with div)
|
|
|
|
Blockly.WidgetDiv.hide(true);
|
2016-04-21 15:33:28 -04:00
|
|
|
Blockly.DropDownDiv.hideWithoutAnimation();
|
2015-08-19 17:21:05 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Zooming the blocks centered in the center of view with zooming in or out.
|
|
|
|
* @param {number} type Type of zooming (-1 zooming out and 1 zooming in).
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.zoomCenter = function(type) {
|
|
|
|
var metrics = this.getMetrics();
|
|
|
|
var x = metrics.viewWidth / 2;
|
|
|
|
var y = metrics.viewHeight / 2;
|
|
|
|
this.zoom(x, y, type);
|
|
|
|
};
|
|
|
|
|
2015-10-15 17:51:52 -05:00
|
|
|
/**
|
2016-02-04 13:25:30 -08:00
|
|
|
* Zoom the blocks to fit in the workspace if possible.
|
|
|
|
*/
|
2015-10-15 17:51:52 -05:00
|
|
|
Blockly.WorkspaceSvg.prototype.zoomToFit = function() {
|
2016-04-14 00:23:17 -07:00
|
|
|
var metrics = this.getMetrics();
|
|
|
|
var blocksBox = this.getBlocksBoundingBox();
|
|
|
|
var blocksWidth = blocksBox.width;
|
|
|
|
var blocksHeight = blocksBox.height;
|
|
|
|
if (!blocksWidth) {
|
2016-02-04 13:25:30 -08:00
|
|
|
return; // Prevents zooming to infinity.
|
2015-10-15 17:51:52 -05:00
|
|
|
}
|
2016-04-14 00:23:17 -07:00
|
|
|
var workspaceWidth = metrics.viewWidth;
|
|
|
|
var workspaceHeight = metrics.viewHeight;
|
2015-10-15 17:51:52 -05:00
|
|
|
if (this.flyout_) {
|
2016-04-14 00:23:17 -07:00
|
|
|
workspaceWidth -= this.flyout_.width_;
|
2015-10-15 17:51:52 -05:00
|
|
|
}
|
2016-04-14 00:23:17 -07:00
|
|
|
if (!this.scrollbar) {
|
2017-02-02 14:17:43 -05:00
|
|
|
// Origin point of 0,0 is fixed, blocks will not scroll to center.
|
2016-04-14 00:23:17 -07:00
|
|
|
blocksWidth += metrics.contentLeft;
|
|
|
|
blocksHeight += metrics.contentTop;
|
|
|
|
}
|
2015-10-15 17:51:52 -05:00
|
|
|
var ratioX = workspaceWidth / blocksWidth;
|
|
|
|
var ratioY = workspaceHeight / blocksHeight;
|
2016-04-14 00:23:17 -07:00
|
|
|
this.setScale(Math.min(ratioX, ratioY));
|
2016-04-21 04:52:43 -07:00
|
|
|
this.scrollCenter();
|
2016-04-14 00:23:17 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Center the workspace.
|
|
|
|
*/
|
2016-04-21 04:52:43 -07:00
|
|
|
Blockly.WorkspaceSvg.prototype.scrollCenter = function() {
|
2016-04-14 00:23:17 -07:00
|
|
|
if (!this.scrollbar) {
|
|
|
|
// Can't center a non-scrolling workspace.
|
2018-04-26 17:06:12 -07:00
|
|
|
console.warn('Tried to scroll a non-scrollable workspace.');
|
2016-04-14 00:23:17 -07:00
|
|
|
return;
|
2015-10-15 17:51:52 -05:00
|
|
|
}
|
2016-04-15 14:09:15 -04:00
|
|
|
// Hide the WidgetDiv without animation (zoom makes field out of place with div)
|
|
|
|
Blockly.WidgetDiv.hide(true);
|
2016-04-21 15:33:28 -04:00
|
|
|
Blockly.DropDownDiv.hideWithoutAnimation();
|
2015-10-15 17:51:52 -05:00
|
|
|
Blockly.hideChaff(false);
|
2016-04-14 00:23:17 -07:00
|
|
|
var metrics = this.getMetrics();
|
|
|
|
var x = (metrics.contentWidth - metrics.viewWidth) / 2;
|
2015-10-15 17:51:52 -05:00
|
|
|
if (this.flyout_) {
|
2016-04-14 00:23:17 -07:00
|
|
|
x -= this.flyout_.width_ / 2;
|
2015-10-15 17:51:52 -05:00
|
|
|
}
|
2016-04-14 00:23:17 -07:00
|
|
|
var y = (metrics.contentHeight - metrics.viewHeight) / 2;
|
|
|
|
this.scrollbar.set(x, y);
|
2015-10-15 17:51:52 -05:00
|
|
|
};
|
|
|
|
|
2018-04-26 17:12:17 -07:00
|
|
|
/**
|
|
|
|
* Scroll the workspace to center on the given block.
|
|
|
|
* @param {?string} id ID of block center on.
|
|
|
|
* @public
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.centerOnBlock = function(id) {
|
|
|
|
if (!this.scrollbar) {
|
|
|
|
console.warn('Tried to scroll a non-scrollable workspace.');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var block = this.getBlockById(id);
|
|
|
|
if (!block) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// XY is in workspace coordinates.
|
|
|
|
var xy = block.getRelativeToSurfaceXY();
|
|
|
|
// Height/width is in workspace units.
|
|
|
|
var heightWidth = block.getHeightWidth();
|
|
|
|
|
|
|
|
// Find the enter of the block in workspace units.
|
|
|
|
var blockCenterY = xy.y + heightWidth.height / 2;
|
|
|
|
|
|
|
|
// In RTL the block's position is the top right of the block, not top left.
|
|
|
|
var multiplier = this.RTL ? -1 : 1;
|
|
|
|
var blockCenterX = xy.x + (multiplier * heightWidth.width / 2);
|
|
|
|
|
|
|
|
// Workspace scale, used to convert from workspace coordinates to pixels.
|
|
|
|
var scale = this.scale;
|
|
|
|
|
|
|
|
// Center in pixels. 0, 0 is at the workspace origin. These numbers may
|
|
|
|
// be negative.
|
|
|
|
var pixelX = blockCenterX * scale;
|
|
|
|
var pixelY = blockCenterY * scale;
|
|
|
|
|
|
|
|
var metrics = this.getMetrics();
|
|
|
|
|
|
|
|
// Scrolling to here would put the block in the top-left corner of the
|
|
|
|
// visible workspace.
|
|
|
|
var scrollToBlockX = pixelX - metrics.contentLeft;
|
|
|
|
var scrollToBlockY = pixelY - metrics.contentTop;
|
|
|
|
|
|
|
|
// viewHeight and viewWidth are in pixels.
|
|
|
|
var halfViewWidth = metrics.viewWidth / 2;
|
|
|
|
var halfViewHeight = metrics.viewHeight / 2;
|
|
|
|
|
|
|
|
// Put the block in the center of the visible workspace instead.
|
|
|
|
var scrollToCenterX = scrollToBlockX - halfViewWidth;
|
|
|
|
var scrollToCenterY = scrollToBlockY - halfViewHeight;
|
|
|
|
|
|
|
|
Blockly.hideChaff();
|
|
|
|
this.scrollbar.set(scrollToCenterX, scrollToCenterY);
|
|
|
|
};
|
|
|
|
|
2015-08-19 17:21:05 -07:00
|
|
|
/**
|
2016-04-14 00:23:17 -07:00
|
|
|
* Set the workspace's zoom factor.
|
|
|
|
* @param {number} newScale Zoom factor.
|
2015-08-19 17:21:05 -07:00
|
|
|
*/
|
2016-04-14 00:23:17 -07:00
|
|
|
Blockly.WorkspaceSvg.prototype.setScale = function(newScale) {
|
|
|
|
if (this.options.zoomOptions.maxScale &&
|
|
|
|
newScale > this.options.zoomOptions.maxScale) {
|
|
|
|
newScale = this.options.zoomOptions.maxScale;
|
|
|
|
} else if (this.options.zoomOptions.minScale &&
|
|
|
|
newScale < this.options.zoomOptions.minScale) {
|
|
|
|
newScale = this.options.zoomOptions.minScale;
|
2015-09-22 17:51:21 -07:00
|
|
|
}
|
2016-04-14 00:23:17 -07:00
|
|
|
this.scale = newScale;
|
Merge/05 24 (#903)
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Localisation updates from https://translatewiki.net.
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* Localisation updates from https://translatewiki.net.
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Localisation updates from https://translatewiki.net.
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 #661
* 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. (#934)
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 #946. Don't check for presence of constants.js
* Fix #945 (annotations) and an eslint issue (constant condition)
* Localisation updates from https://translatewiki.net.
* Fix #950: 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 #937.
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() (#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.
* Annotation fixes
* Fix bug #904 by explicitly grabbing focus on the workspace svg element. (#964)
* Potential fix for #888. Stops checking whether we are mid workspace drag since we do not always get mosue up events when blockly is in an iframe. (#899)
* Adding new minimap demo
* Basic code style changes. Adding a few more comments. Return early if disableScrollChange in onScrollChange listener.
* `unction` to `function` corrects #962 (#970)
* Cross browser friendly fix for #904. This calls blur and focus from … (#972)
* Cross browser friendly fix for #904. 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 #904 to keep the page from jumping to the focused workspace in IE 11 (#974)
* 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 #967 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 d55d9cbd9ff308ff5e361cf77acabb61a4bf4695). IIUC, updateWidth/getCachedWidth was only called from render before which is overridden in FieldImage to be a no-op already. (#979)
* Fix #969
* Localisation updates from https://translatewiki.net.
* Fix #986. Looks like the original PR just forgot this block. (#992)
* rebuild develop (#996)
* Added the variable modal and component and implemented basic renaming functionality. (#991)
* Fixing commenting from the last commit. (#1000)
* 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. (#1011)
* Minimap position bug fix for browsers other than chrome. Added touch support.
* Adding an add variable modal to accessible Blockly. (#1015)
* 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. (#1017)
Centralizes accessible modal behavior.
* - Changed error message referencing 'procedure' instead of 'function' (#1019)
- 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,… (#1028)
...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). (#1027)
* Enable google/blockly with continuous build on travis ci (#1023) (#1035)
* 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 #880.
* Ensure useDragSurface is a boolean.
Fixed #988
* use pretest instead of preinstall in package.json (#1043)
* 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 #973
* bumpNeighbours_ function moved to block_svg.
Fixed #1009
* Update RegEx in js-to-json to match windowi eol (#1050)
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 (#1053)
"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. (#1054)
* Correcting #1054 (#1056)
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… (#1057)
* Change how blockly handles cursors. The old way was quite slow because it changed the stylesheet directly. See issue #981 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. (#1059)
* Merge master into develop (#1063)
- pick up translation changes
- clean up trailing spaces
* use goog.string.startswith instead of string.startswith (#1065)
* New jsinterpreter demo includes wait block. Both demos have improved UI for clarity. (#1001)
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 #1069 (#1073)
* VariableMap and functions added.
* Fix #1051 (#1084)
* Improve errors when validating JSON block definitions. (#1086)
goog.asserts to not run from blockly_compressed.js. User data validation should always run.
* Dragging changes, rebased on develop (#1078)
* 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 (#1026)
-- 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 (#1048)
- Removed gestureDB
- Removing uses of terminateDrag
- Cleaned up disposal code
* Dragging bugfixes (#1058)
- 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 (#1060)
* 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. (#1081)
* add osx travis test run job (#1074)
* Names are correctly fetched from VariableModels!
* add more wait time for test setup (#1091)
* Work around timing issue with travis osx issue (#1092)
* add more wait time for test setup
* increase selenium wait time
* add more wait
* Fix #1077 by adding a rule to cover the toolbox labels too. (#1099)
* Assign variable UUID to field_variable dropdown.
* Change registration link to a static one (#1106)
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 (#1111)
* Click events on shadow blocks have the correct id (#1089)
* Add image_onclick option (#1080)
* Cleanup: semicolons, spacing, etc. (#1116)
* Spelling. Spelling is hard.
* Add variable info to xml generated in variables.js
* Add missing CLAs info to the contributing file (#1119)
* Add missing CLAs info to the contributing file
* Added larger changes paragraph
* Replacing latest prettifier hosted in repo with latest version at rawgit CDN. (#1120)
* Forgot update code demo (#1121)
* Move audio code to a new file (#1122)
* 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 (#1126)
* Include variables at top of serialization.
* Move blockSvg.getHeightWidth to block_render_svg.js (#1118)
* Deserialization variables at top.
* Create grid object (#1131)
* 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
|
|
|
if (this.grid_) {
|
|
|
|
this.grid_.update(this.scale);
|
|
|
|
}
|
2015-10-21 14:38:39 -07:00
|
|
|
if (this.scrollbar) {
|
2016-04-14 00:23:17 -07:00
|
|
|
this.scrollbar.resize();
|
2015-10-21 14:38:39 -07:00
|
|
|
} else {
|
2016-04-14 00:23:17 -07:00
|
|
|
this.translate(this.scrollX, this.scrollY);
|
|
|
|
}
|
2015-09-02 00:09:49 +01:00
|
|
|
Blockly.hideChaff(false);
|
|
|
|
if (this.flyout_) {
|
|
|
|
// No toolbox, resize flyout.
|
|
|
|
this.flyout_.reflow();
|
|
|
|
}
|
2015-08-19 17:21:05 -07:00
|
|
|
};
|
|
|
|
|
2016-03-29 14:23:34 -04:00
|
|
|
/**
|
2016-03-30 14:14:02 -04:00
|
|
|
* Scroll the workspace by a specified amount, keeping in the bounds.
|
|
|
|
* Be sure to set this.startDragMetrics with cached metrics before calling.
|
2016-03-29 14:23:34 -04:00
|
|
|
* @param {number} x Target X to scroll to
|
|
|
|
* @param {number} y Target Y to scroll to
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.scroll = function(x, y) {
|
2016-03-30 14:14:02 -04:00
|
|
|
var metrics = this.startDragMetrics; // Cached values
|
2016-03-29 14:23:34 -04:00
|
|
|
x = Math.min(x, -metrics.contentLeft);
|
|
|
|
y = Math.min(y, -metrics.contentTop);
|
|
|
|
x = Math.max(x, metrics.viewWidth - metrics.contentLeft -
|
|
|
|
metrics.contentWidth);
|
|
|
|
y = Math.max(y, metrics.viewHeight - metrics.contentTop -
|
|
|
|
metrics.contentHeight);
|
2018-05-02 11:05:43 -07:00
|
|
|
// When the workspace starts scrolling, hide the WidgetDiv without animation.
|
|
|
|
// This is to prevent a dispoal animation from happening in the wrong location.
|
2016-05-10 13:08:56 -04:00
|
|
|
Blockly.WidgetDiv.hide(true);
|
|
|
|
Blockly.DropDownDiv.hideWithoutAnimation();
|
2016-03-29 14:23:34 -04:00
|
|
|
// Move the scrollbars and the page will scroll automatically.
|
2018-05-02 11:05:43 -07:00
|
|
|
this.scrollbar.set(-x - metrics.contentLeft, -y - metrics.contentTop);
|
2016-03-30 14:14:02 -04:00
|
|
|
};
|
2016-03-29 14:23:34 -04:00
|
|
|
|
2016-09-21 13:21:13 -04:00
|
|
|
/**
|
|
|
|
* Update the workspace's stack glow radius to be proportional to scale.
|
|
|
|
* Ensures that stack glows always appear to be a fixed size.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.updateStackGlowScale_ = function() {
|
|
|
|
// No such def in the flyout workspace.
|
|
|
|
if (this.options.stackGlowBlur) {
|
|
|
|
this.options.stackGlowBlur.setAttribute('stdDeviation',
|
2018-05-02 11:05:43 -07:00
|
|
|
Blockly.Colours.stackGlowSize / this.scale);
|
2016-09-21 13:21:13 -04:00
|
|
|
}
|
|
|
|
};
|
2016-08-19 14:13:20 -07:00
|
|
|
|
2017-08-24 15:51:31 -07:00
|
|
|
/**
|
|
|
|
* Get the dimensions of the given workspace component, in pixels.
|
|
|
|
* @param {Blockly.Toolbox|Blockly.Flyout} elem The element to get the
|
|
|
|
* dimensions of, or null. It should be a toolbox or flyout, and should
|
|
|
|
* implement getWidth() and getHeight().
|
|
|
|
* @return {!Object} An object containing width and height attributes, which
|
|
|
|
* will both be zero if elem did not exist.
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.getDimensionsPx_ = function(elem) {
|
|
|
|
var width = 0;
|
|
|
|
var height = 0;
|
|
|
|
if (elem) {
|
|
|
|
width = elem.getWidth();
|
|
|
|
height = elem.getHeight();
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
width: width,
|
|
|
|
height: height
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the content dimensions of the given workspace, taking into account
|
|
|
|
* whether or not it is scrollable and what size the workspace div is on screen.
|
|
|
|
* @param {!Blockly.WorkspaceSvg} ws The workspace to measure.
|
|
|
|
* @param {!Object} svgSize An object containing height and width attributes in
|
|
|
|
* CSS pixels. Together they specify the size of the visible workspace, not
|
|
|
|
* including areas covered up by the toolbox.
|
|
|
|
* @return {!Object} The dimensions of the contents of the given workspace, as
|
|
|
|
* an object containing at least
|
|
|
|
* - height and width in pixels
|
|
|
|
* - left and top in pixels relative to the workspace origin.
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.getContentDimensions_ = function(ws, svgSize) {
|
|
|
|
if (ws.scrollbar) {
|
|
|
|
return Blockly.WorkspaceSvg.getContentDimensionsBounded_(ws, svgSize);
|
|
|
|
} else {
|
|
|
|
return Blockly.WorkspaceSvg.getContentDimensionsExact_(ws);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the bounding box for all workspace contents, in pixels.
|
|
|
|
* @param {!Blockly.WorkspaceSvg} ws The workspace to inspect.
|
|
|
|
* @return {!Object} The dimensions of the contents of the given workspace, as
|
|
|
|
* an object containing
|
|
|
|
* - height and width in pixels
|
|
|
|
* - left, right, top and bottom in pixels relative to the workspace origin.
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.getContentDimensionsExact_ = function(ws) {
|
|
|
|
// Block bounding box is in workspace coordinates.
|
|
|
|
var blockBox = ws.getBlocksBoundingBox();
|
|
|
|
var scale = ws.scale;
|
|
|
|
|
|
|
|
// Convert to pixels.
|
|
|
|
var width = blockBox.width * scale;
|
|
|
|
var height = blockBox.height * scale;
|
|
|
|
var left = blockBox.x * scale;
|
|
|
|
var top = blockBox.y * scale;
|
|
|
|
|
|
|
|
return {
|
|
|
|
left: left,
|
|
|
|
top: top,
|
|
|
|
right: left + width,
|
|
|
|
bottom: top + height,
|
|
|
|
width: width,
|
|
|
|
height: height
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Calculate the size of a scrollable workspace, which should include room for a
|
|
|
|
* half screen border around the workspace contents.
|
|
|
|
* @param {!Blockly.WorkspaceSvg} ws The workspace to measure.
|
|
|
|
* @param {!Object} svgSize An object containing height and width attributes in
|
|
|
|
* CSS pixels. Together they specify the size of the visible workspace, not
|
|
|
|
* including areas covered up by the toolbox.
|
|
|
|
* @return {!Object} The dimensions of the contents of the given workspace, as
|
|
|
|
* an object containing
|
|
|
|
* - height and width in pixels
|
|
|
|
* - left and top in pixels relative to the workspace origin.
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.getContentDimensionsBounded_ = function(ws, svgSize) {
|
|
|
|
var content = Blockly.WorkspaceSvg.getContentDimensionsExact_(ws);
|
|
|
|
|
2018-04-26 17:06:12 -07:00
|
|
|
// View height and width are both in pixels, and are the same as the SVG size.
|
2017-08-24 15:51:31 -07:00
|
|
|
var viewWidth = svgSize.width;
|
|
|
|
var viewHeight = svgSize.height;
|
|
|
|
var halfWidth = viewWidth / 2;
|
|
|
|
var halfHeight = viewHeight / 2;
|
|
|
|
|
|
|
|
// Add a border around the content that is at least half a screenful wide.
|
|
|
|
// Ensure border is wide enough that blocks can scroll over entire screen.
|
|
|
|
var left = Math.min(content.left - halfWidth, content.right - viewWidth);
|
|
|
|
var right = Math.max(content.right + halfWidth, content.left + viewWidth);
|
|
|
|
|
|
|
|
var top = Math.min(content.top - halfHeight, content.bottom - viewHeight);
|
|
|
|
var bottom = Math.max(content.bottom + halfHeight, content.top + viewHeight);
|
|
|
|
|
|
|
|
var dimensions = {
|
|
|
|
left: left,
|
|
|
|
top: top,
|
|
|
|
height: bottom - top,
|
|
|
|
width: right - left
|
|
|
|
};
|
|
|
|
return dimensions;
|
|
|
|
};
|
|
|
|
|
2016-08-19 14:13:20 -07:00
|
|
|
/**
|
|
|
|
* Return an object with all the metrics required to size scrollbars for a
|
|
|
|
* top level workspace. The following properties are computed:
|
2017-05-22 13:08:22 -07:00
|
|
|
* Coordinate system: pixel coordinates.
|
2016-08-19 14:13:20 -07:00
|
|
|
* .viewHeight: Height of the visible rectangle,
|
|
|
|
* .viewWidth: Width of the visible rectangle,
|
|
|
|
* .contentHeight: Height of the contents,
|
|
|
|
* .contentWidth: Width of the content,
|
|
|
|
* .viewTop: Offset of top edge of visible rectangle from parent,
|
|
|
|
* .viewLeft: Offset of left edge of visible rectangle from parent,
|
|
|
|
* .contentTop: Offset of the top-most content from the y=0 coordinate,
|
|
|
|
* .contentLeft: Offset of the left-most content from the x=0 coordinate.
|
|
|
|
* .absoluteTop: Top-edge of view.
|
|
|
|
* .absoluteLeft: Left-edge of view.
|
|
|
|
* .toolboxWidth: Width of toolbox, if it exists. Otherwise zero.
|
|
|
|
* .toolboxHeight: Height of toolbox, if it exists. Otherwise zero.
|
|
|
|
* .flyoutWidth: Width of the flyout if it is always open. Otherwise zero.
|
|
|
|
* .flyoutHeight: Height of flyout if it is always open. Otherwise zero.
|
|
|
|
* .toolboxPosition: Top, bottom, left or right.
|
2016-10-06 18:52:25 -07:00
|
|
|
* @return {!Object} Contains size and position metrics of a top level
|
|
|
|
* workspace.
|
2016-08-19 14:13:20 -07:00
|
|
|
* @private
|
2016-10-06 18:06:41 -07:00
|
|
|
* @this Blockly.WorkspaceSvg
|
2016-08-19 14:13:20 -07:00
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.getTopLevelWorkspaceMetrics_ = function() {
|
2017-08-24 15:51:31 -07:00
|
|
|
|
|
|
|
var toolboxDimensions =
|
|
|
|
Blockly.WorkspaceSvg.getDimensionsPx_(this.toolbox_);
|
|
|
|
var flyoutDimensions =
|
|
|
|
Blockly.WorkspaceSvg.getDimensionsPx_(this.flyout_);
|
|
|
|
|
|
|
|
// Contains height and width in CSS pixels.
|
|
|
|
// svgSize is equivalent to the size of the injectionDiv at this point.
|
2016-08-19 14:13:20 -07:00
|
|
|
var svgSize = Blockly.svgSize(this.getParentSvg());
|
|
|
|
if (this.toolbox_) {
|
|
|
|
if (this.toolboxPosition == Blockly.TOOLBOX_AT_TOP ||
|
|
|
|
this.toolboxPosition == Blockly.TOOLBOX_AT_BOTTOM) {
|
2017-08-24 15:51:31 -07:00
|
|
|
svgSize.height -= toolboxDimensions.height;
|
2016-08-19 14:13:20 -07:00
|
|
|
} else if (this.toolboxPosition == Blockly.TOOLBOX_AT_LEFT ||
|
|
|
|
this.toolboxPosition == Blockly.TOOLBOX_AT_RIGHT) {
|
2017-08-24 15:51:31 -07:00
|
|
|
svgSize.width -= toolboxDimensions.width;
|
2016-08-19 14:13:20 -07:00
|
|
|
}
|
|
|
|
}
|
2017-05-22 13:08:22 -07:00
|
|
|
|
2017-08-24 15:51:31 -07:00
|
|
|
// svgSize is now the space taken up by the Blockly workspace, not including
|
|
|
|
// the toolbox.
|
|
|
|
var contentDimensions =
|
|
|
|
Blockly.WorkspaceSvg.getContentDimensions_(this, svgSize);
|
2016-08-19 14:13:20 -07:00
|
|
|
|
|
|
|
var absoluteLeft = 0;
|
|
|
|
if (this.toolbox_ && this.toolboxPosition == Blockly.TOOLBOX_AT_LEFT) {
|
2017-08-24 15:51:31 -07:00
|
|
|
absoluteLeft = toolboxDimensions.width;
|
2016-08-19 14:13:20 -07:00
|
|
|
}
|
|
|
|
var absoluteTop = 0;
|
|
|
|
if (this.toolbox_ && this.toolboxPosition == Blockly.TOOLBOX_AT_TOP) {
|
2017-08-24 15:51:31 -07:00
|
|
|
absoluteTop = toolboxDimensions.height;
|
2016-08-19 14:13:20 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
var metrics = {
|
2017-08-24 15:51:31 -07:00
|
|
|
contentHeight: contentDimensions.height,
|
|
|
|
contentWidth: contentDimensions.width,
|
|
|
|
contentTop: contentDimensions.top,
|
|
|
|
contentLeft: contentDimensions.left,
|
|
|
|
|
2016-08-19 14:13:20 -07:00
|
|
|
viewHeight: svgSize.height,
|
|
|
|
viewWidth: svgSize.width,
|
2017-08-24 15:51:31 -07:00
|
|
|
viewTop: -this.scrollY, // Must be in pixels, somehow.
|
|
|
|
viewLeft: -this.scrollX, // Must be in pixels, somehow.
|
|
|
|
|
2016-08-19 14:13:20 -07:00
|
|
|
absoluteTop: absoluteTop,
|
|
|
|
absoluteLeft: absoluteLeft,
|
2017-08-24 15:51:31 -07:00
|
|
|
|
|
|
|
toolboxWidth: toolboxDimensions.width,
|
|
|
|
toolboxHeight: toolboxDimensions.height,
|
|
|
|
|
|
|
|
flyoutWidth: flyoutDimensions.width,
|
|
|
|
flyoutHeight: flyoutDimensions.height,
|
|
|
|
|
2016-08-19 14:13:20 -07:00
|
|
|
toolboxPosition: this.toolboxPosition
|
|
|
|
};
|
|
|
|
return metrics;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the X/Y translations of a top level workspace to match the scrollbars.
|
|
|
|
* @param {!Object} xyRatio Contains an x and/or y property which is a float
|
|
|
|
* between 0 and 1 specifying the degree of scrolling.
|
|
|
|
* @private
|
2016-10-06 18:06:41 -07:00
|
|
|
* @this Blockly.WorkspaceSvg
|
2016-08-19 14:13:20 -07:00
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.setTopLevelWorkspaceMetrics_ = function(xyRatio) {
|
|
|
|
if (!this.scrollbar) {
|
2018-08-22 15:29:43 -04:00
|
|
|
throw 'Attempt to set top level workspace scroll without scrollbars.';
|
2016-08-19 14:13:20 -07:00
|
|
|
}
|
|
|
|
var metrics = this.getMetrics();
|
2018-08-22 15:29:43 -04:00
|
|
|
if (goog.isNumber(xyRatio.x)) {
|
2016-08-19 14:13:20 -07:00
|
|
|
this.scrollX = -metrics.contentWidth * xyRatio.x - metrics.contentLeft;
|
|
|
|
}
|
2018-08-22 15:29:43 -04:00
|
|
|
if (goog.isNumber(xyRatio.y)) {
|
2016-08-19 14:13:20 -07:00
|
|
|
this.scrollY = -metrics.contentHeight * xyRatio.y - metrics.contentTop;
|
|
|
|
}
|
|
|
|
var x = this.scrollX + metrics.absoluteLeft;
|
|
|
|
var y = this.scrollY + metrics.absoluteTop;
|
|
|
|
this.translate(x, y);
|
Merge/05 24 (#903)
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Localisation updates from https://translatewiki.net.
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* Localisation updates from https://translatewiki.net.
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Localisation updates from https://translatewiki.net.
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 #661
* 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. (#934)
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 #946. Don't check for presence of constants.js
* Fix #945 (annotations) and an eslint issue (constant condition)
* Localisation updates from https://translatewiki.net.
* Fix #950: 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 #937.
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() (#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.
* Annotation fixes
* Fix bug #904 by explicitly grabbing focus on the workspace svg element. (#964)
* Potential fix for #888. Stops checking whether we are mid workspace drag since we do not always get mosue up events when blockly is in an iframe. (#899)
* Adding new minimap demo
* Basic code style changes. Adding a few more comments. Return early if disableScrollChange in onScrollChange listener.
* `unction` to `function` corrects #962 (#970)
* Cross browser friendly fix for #904. This calls blur and focus from … (#972)
* Cross browser friendly fix for #904. 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 #904 to keep the page from jumping to the focused workspace in IE 11 (#974)
* 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 #967 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 d55d9cbd9ff308ff5e361cf77acabb61a4bf4695). IIUC, updateWidth/getCachedWidth was only called from render before which is overridden in FieldImage to be a no-op already. (#979)
* Fix #969
* Localisation updates from https://translatewiki.net.
* Fix #986. Looks like the original PR just forgot this block. (#992)
* rebuild develop (#996)
* Added the variable modal and component and implemented basic renaming functionality. (#991)
* Fixing commenting from the last commit. (#1000)
* 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. (#1011)
* Minimap position bug fix for browsers other than chrome. Added touch support.
* Adding an add variable modal to accessible Blockly. (#1015)
* 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. (#1017)
Centralizes accessible modal behavior.
* - Changed error message referencing 'procedure' instead of 'function' (#1019)
- 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,… (#1028)
...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). (#1027)
* Enable google/blockly with continuous build on travis ci (#1023) (#1035)
* 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 #880.
* Ensure useDragSurface is a boolean.
Fixed #988
* use pretest instead of preinstall in package.json (#1043)
* 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 #973
* bumpNeighbours_ function moved to block_svg.
Fixed #1009
* Update RegEx in js-to-json to match windowi eol (#1050)
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 (#1053)
"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. (#1054)
* Correcting #1054 (#1056)
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… (#1057)
* Change how blockly handles cursors. The old way was quite slow because it changed the stylesheet directly. See issue #981 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. (#1059)
* Merge master into develop (#1063)
- pick up translation changes
- clean up trailing spaces
* use goog.string.startswith instead of string.startswith (#1065)
* New jsinterpreter demo includes wait block. Both demos have improved UI for clarity. (#1001)
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 #1069 (#1073)
* VariableMap and functions added.
* Fix #1051 (#1084)
* Improve errors when validating JSON block definitions. (#1086)
goog.asserts to not run from blockly_compressed.js. User data validation should always run.
* Dragging changes, rebased on develop (#1078)
* 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 (#1026)
-- 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 (#1048)
- Removed gestureDB
- Removing uses of terminateDrag
- Cleaned up disposal code
* Dragging bugfixes (#1058)
- 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 (#1060)
* 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. (#1081)
* add osx travis test run job (#1074)
* Names are correctly fetched from VariableModels!
* add more wait time for test setup (#1091)
* Work around timing issue with travis osx issue (#1092)
* add more wait time for test setup
* increase selenium wait time
* add more wait
* Fix #1077 by adding a rule to cover the toolbox labels too. (#1099)
* Assign variable UUID to field_variable dropdown.
* Change registration link to a static one (#1106)
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 (#1111)
* Click events on shadow blocks have the correct id (#1089)
* Add image_onclick option (#1080)
* Cleanup: semicolons, spacing, etc. (#1116)
* Spelling. Spelling is hard.
* Add variable info to xml generated in variables.js
* Add missing CLAs info to the contributing file (#1119)
* Add missing CLAs info to the contributing file
* Added larger changes paragraph
* Replacing latest prettifier hosted in repo with latest version at rawgit CDN. (#1120)
* Forgot update code demo (#1121)
* Move audio code to a new file (#1122)
* 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 (#1126)
* Include variables at top of serialization.
* Move blockSvg.getHeightWidth to block_render_svg.js (#1118)
* Deserialization variables at top.
* Create grid object (#1131)
* 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
|
|
|
if (this.grid_) {
|
|
|
|
this.grid_.moveTo(x, y);
|
2016-08-19 14:13:20 -07:00
|
|
|
}
|
|
|
|
};
|
2016-10-03 20:15:54 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Update whether this workspace has resizes enabled.
|
|
|
|
* If enabled, workspace will resize when appropriate.
|
|
|
|
* If disabled, workspace will not resize until re-enabled.
|
|
|
|
* Use to avoid resizing during a batch operation, for performance.
|
|
|
|
* @param {boolean} enabled Whether resizes should be enabled.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.setResizesEnabled = function(enabled) {
|
|
|
|
var reenabled = (!this.resizesEnabled_ && enabled);
|
|
|
|
this.resizesEnabled_ = enabled;
|
|
|
|
if (reenabled) {
|
2016-10-21 14:30:30 -07:00
|
|
|
// Newly enabled. Trigger a resize.
|
2016-10-03 20:15:54 -04:00
|
|
|
this.resizeContents();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-10-24 14:31:21 -07:00
|
|
|
/**
|
|
|
|
* Update whether this workspace has toolbox refreshes enabled.
|
|
|
|
* If enabled, the toolbox will refresh when appropriate.
|
|
|
|
* If disabled, workspace will not refresh until re-enabled.
|
|
|
|
* Use to avoid refreshing during a batch operation, for performance.
|
|
|
|
* @param {boolean} enabled Whether refreshes should be enabled.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.setToolboxRefreshEnabled = function(enabled) {
|
|
|
|
var reenabled = (!this.toolboxRefreshEnabled_ && enabled);
|
|
|
|
this.toolboxRefreshEnabled_ = enabled;
|
|
|
|
if (reenabled) {
|
|
|
|
// Newly enabled. Trigger a refresh.
|
|
|
|
this.refreshToolboxSelection_();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-10-09 12:04:59 -07:00
|
|
|
|
2016-10-03 20:15:54 -04:00
|
|
|
/**
|
|
|
|
* Dispose of all blocks in workspace, with an optimization to prevent resizes.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.clear = function() {
|
2017-10-20 17:53:14 -07:00
|
|
|
this.setResizesEnabled(false);
|
2016-10-03 20:15:54 -04:00
|
|
|
Blockly.WorkspaceSvg.superClass_.clear.call(this);
|
2017-10-20 17:53:14 -07:00
|
|
|
this.setResizesEnabled(true);
|
2016-10-03 20:15:54 -04:00
|
|
|
};
|
|
|
|
|
2017-02-02 14:17:43 -05:00
|
|
|
/**
|
|
|
|
* Register a callback function associated with a given key, for clicks on
|
|
|
|
* buttons and labels in the flyout.
|
|
|
|
* For instance, a button specified by the XML
|
|
|
|
* <button text="create variable" callbackKey="CREATE_VARIABLE"></button>
|
|
|
|
* should be matched by a call to
|
|
|
|
* registerButtonCallback("CREATE_VARIABLE", yourCallbackFunction).
|
|
|
|
* @param {string} key The name to use to look up this function.
|
|
|
|
* @param {function(!Blockly.FlyoutButton)} func The function to call when the
|
|
|
|
* given button is clicked.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.registerButtonCallback = function(key, func) {
|
2018-08-22 15:29:43 -04:00
|
|
|
goog.asserts.assert(goog.isFunction(func),
|
|
|
|
'Button callbacks must be functions.');
|
2017-02-02 14:17:43 -05:00
|
|
|
this.flyoutButtonCallbacks_[key] = func;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the callback function associated with a given key, for clicks on buttons
|
|
|
|
* and labels in the flyout.
|
|
|
|
* @param {string} key The name to use to look up the function.
|
Feature/merge feb 2017 (#791)
* 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 c8ca24a0007b70e137417e843459c87185141a55.
* 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… (#732)
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. (#748)
* 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 (#741)
* 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. (#749)
* 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 #758.
* Split the scrollbar and flyout out into their own SVG elements. They (#771)
* 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. (#699)
* Fix #698 by adjusting the regex to not have \. Still not 100% sure w… (#700)
* Fix #698 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… (#777)
* 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… (#778)
* 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 #748 and stop using contains since it is not supported in IE
* Fixes #786 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. (#787)
* 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 #791.
* Localisation updates from https://translatewiki.net.
* Localisation updates from https://translatewiki.net.
* Use the drag surface when scrolling using the scrollbars. #783 (#789)
* End event groups when you finish editing a field
* Fix #794 and make the workspace grid drag along with the workspace. (#801)
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. (#790)
* 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. (#805)
* Don't connect to blocks under the flyout.
* recompile again. (#806)
* 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 #813 by ademenev
* PR #818: 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. (#820)
From commits b77f8cbebc5cef247116d3df6a428df8addbe53d and 4ecdedec9f8a69f78abf246e7a5db1e1a0be6b85
* Naming changes in mirror demo
* Adding support for untranslated messages. (#819)
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. (#825)
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 #828.
* 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" (#832)
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. (#836)
Fixes commits in #832.
* Adding extensions for JSON support of dynamic blocks. (#834)
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 … (#837)
* 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 #816 so that layering of the flyout and workspace scrollbars
are done correctly.
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 12:09:23 -08:00
|
|
|
* @return {?function(!Blockly.FlyoutButton)} The function corresponding to the
|
|
|
|
* given key for this workspace; null if no callback is registered.
|
2017-02-02 14:17:43 -05:00
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.getButtonCallback = function(key) {
|
Feature/merge feb 2017 (#791)
* 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 c8ca24a0007b70e137417e843459c87185141a55.
* 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… (#732)
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. (#748)
* 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 (#741)
* 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. (#749)
* 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 #758.
* Split the scrollbar and flyout out into their own SVG elements. They (#771)
* 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. (#699)
* Fix #698 by adjusting the regex to not have \. Still not 100% sure w… (#700)
* Fix #698 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… (#777)
* 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… (#778)
* 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 #748 and stop using contains since it is not supported in IE
* Fixes #786 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. (#787)
* 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 #791.
* Localisation updates from https://translatewiki.net.
* Localisation updates from https://translatewiki.net.
* Use the drag surface when scrolling using the scrollbars. #783 (#789)
* End event groups when you finish editing a field
* Fix #794 and make the workspace grid drag along with the workspace. (#801)
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. (#790)
* 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. (#805)
* Don't connect to blocks under the flyout.
* recompile again. (#806)
* 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 #813 by ademenev
* PR #818: 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. (#820)
From commits b77f8cbebc5cef247116d3df6a428df8addbe53d and 4ecdedec9f8a69f78abf246e7a5db1e1a0be6b85
* Naming changes in mirror demo
* Adding support for untranslated messages. (#819)
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. (#825)
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 #828.
* 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" (#832)
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. (#836)
Fixes commits in #832.
* Adding extensions for JSON support of dynamic blocks. (#834)
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 … (#837)
* 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 #816 so that layering of the flyout and workspace scrollbars
are done correctly.
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 12:09:23 -08:00
|
|
|
var result = this.flyoutButtonCallbacks_[key];
|
|
|
|
return result ? result : null;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a callback for a click on a button in the flyout.
|
|
|
|
* @param {string} key The name associated with the callback function.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.removeButtonCallback = function(key) {
|
|
|
|
this.flyoutButtonCallbacks_[key] = null;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register a callback function associated with a given key, for populating
|
|
|
|
* custom toolbox categories in this workspace. See the variable and procedure
|
|
|
|
* categories as an example.
|
|
|
|
* @param {string} key The name to use to look up this function.
|
2018-04-26 17:06:12 -07:00
|
|
|
* @param {function(!Blockly.Workspace):!Array.<!Element>} func The function to
|
Feature/merge feb 2017 (#791)
* 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 c8ca24a0007b70e137417e843459c87185141a55.
* 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… (#732)
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. (#748)
* 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 (#741)
* 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. (#749)
* 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 #758.
* Split the scrollbar and flyout out into their own SVG elements. They (#771)
* 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. (#699)
* Fix #698 by adjusting the regex to not have \. Still not 100% sure w… (#700)
* Fix #698 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… (#777)
* 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… (#778)
* 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 #748 and stop using contains since it is not supported in IE
* Fixes #786 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. (#787)
* 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 #791.
* Localisation updates from https://translatewiki.net.
* Localisation updates from https://translatewiki.net.
* Use the drag surface when scrolling using the scrollbars. #783 (#789)
* End event groups when you finish editing a field
* Fix #794 and make the workspace grid drag along with the workspace. (#801)
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. (#790)
* 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. (#805)
* Don't connect to blocks under the flyout.
* recompile again. (#806)
* 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 #813 by ademenev
* PR #818: 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. (#820)
From commits b77f8cbebc5cef247116d3df6a428df8addbe53d and 4ecdedec9f8a69f78abf246e7a5db1e1a0be6b85
* Naming changes in mirror demo
* Adding support for untranslated messages. (#819)
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. (#825)
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 #828.
* 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" (#832)
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. (#836)
Fixes commits in #832.
* Adding extensions for JSON support of dynamic blocks. (#834)
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 … (#837)
* 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 #816 so that layering of the flyout and workspace scrollbars
are done correctly.
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 12:09:23 -08:00
|
|
|
* call when the given toolbox category is opened.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.registerToolboxCategoryCallback = function(key,
|
|
|
|
func) {
|
2018-08-22 15:29:43 -04:00
|
|
|
goog.asserts.assert(goog.isFunction(func),
|
|
|
|
'Toolbox category callbacks must be functions.');
|
Feature/merge feb 2017 (#791)
* 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 c8ca24a0007b70e137417e843459c87185141a55.
* 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… (#732)
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. (#748)
* 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 (#741)
* 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. (#749)
* 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 #758.
* Split the scrollbar and flyout out into their own SVG elements. They (#771)
* 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. (#699)
* Fix #698 by adjusting the regex to not have \. Still not 100% sure w… (#700)
* Fix #698 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… (#777)
* 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… (#778)
* 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 #748 and stop using contains since it is not supported in IE
* Fixes #786 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. (#787)
* 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 #791.
* Localisation updates from https://translatewiki.net.
* Localisation updates from https://translatewiki.net.
* Use the drag surface when scrolling using the scrollbars. #783 (#789)
* End event groups when you finish editing a field
* Fix #794 and make the workspace grid drag along with the workspace. (#801)
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. (#790)
* 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. (#805)
* Don't connect to blocks under the flyout.
* recompile again. (#806)
* 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 #813 by ademenev
* PR #818: 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. (#820)
From commits b77f8cbebc5cef247116d3df6a428df8addbe53d and 4ecdedec9f8a69f78abf246e7a5db1e1a0be6b85
* Naming changes in mirror demo
* Adding support for untranslated messages. (#819)
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. (#825)
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 #828.
* 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" (#832)
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. (#836)
Fixes commits in #832.
* Adding extensions for JSON support of dynamic blocks. (#834)
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 … (#837)
* 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 #816 so that layering of the flyout and workspace scrollbars
are done correctly.
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 12:09:23 -08:00
|
|
|
this.toolboxCategoryCallbacks_[key] = func;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the callback function associated with a given key, for populating
|
|
|
|
* custom toolbox categories in this workspace.
|
|
|
|
* @param {string} key The name to use to look up the function.
|
2018-04-26 17:06:12 -07:00
|
|
|
* @return {?function(!Blockly.Workspace):!Array.<!Element>} The function
|
Feature/merge feb 2017 (#791)
* 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 c8ca24a0007b70e137417e843459c87185141a55.
* 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… (#732)
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. (#748)
* 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 (#741)
* 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. (#749)
* 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 #758.
* Split the scrollbar and flyout out into their own SVG elements. They (#771)
* 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. (#699)
* Fix #698 by adjusting the regex to not have \. Still not 100% sure w… (#700)
* Fix #698 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… (#777)
* 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… (#778)
* 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 #748 and stop using contains since it is not supported in IE
* Fixes #786 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. (#787)
* 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 #791.
* Localisation updates from https://translatewiki.net.
* Localisation updates from https://translatewiki.net.
* Use the drag surface when scrolling using the scrollbars. #783 (#789)
* End event groups when you finish editing a field
* Fix #794 and make the workspace grid drag along with the workspace. (#801)
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. (#790)
* 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. (#805)
* Don't connect to blocks under the flyout.
* recompile again. (#806)
* 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 #813 by ademenev
* PR #818: 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. (#820)
From commits b77f8cbebc5cef247116d3df6a428df8addbe53d and 4ecdedec9f8a69f78abf246e7a5db1e1a0be6b85
* Naming changes in mirror demo
* Adding support for untranslated messages. (#819)
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. (#825)
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 #828.
* 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" (#832)
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. (#836)
Fixes commits in #832.
* Adding extensions for JSON support of dynamic blocks. (#834)
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 … (#837)
* 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 #816 so that layering of the flyout and workspace scrollbars
are done correctly.
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 12:09:23 -08:00
|
|
|
* corresponding to the given key for this workspace, or null if no function
|
|
|
|
* is registered.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.getToolboxCategoryCallback = function(key) {
|
|
|
|
var result = this.toolboxCategoryCallbacks_[key];
|
|
|
|
return result ? result : null;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a callback for a click on a custom category's name in the toolbox.
|
|
|
|
* @param {string} key The name associated with the callback function.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.removeToolboxCategoryCallback = function(key) {
|
|
|
|
this.toolboxCategoryCallbacks_[key] = null;
|
2017-02-02 14:17:43 -05:00
|
|
|
};
|
|
|
|
|
2017-05-22 13:08:22 -07:00
|
|
|
/**
|
|
|
|
* Look up the gesture that is tracking this touch stream on this workspace.
|
|
|
|
* May create a new gesture.
|
|
|
|
* @param {!Event} e Mouse event or touch event
|
|
|
|
* @return {Blockly.Gesture} The gesture that is tracking this touch stream,
|
|
|
|
* or null if no valid gesture exists.
|
|
|
|
* @package
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.getGesture = function(e) {
|
|
|
|
var isStart = (e.type == 'mousedown' || e.type == 'touchstart');
|
|
|
|
|
|
|
|
var gesture = this.currentGesture_;
|
|
|
|
if (gesture) {
|
|
|
|
if (isStart && gesture.hasStarted()) {
|
|
|
|
// That's funny. We must have missed a mouse up.
|
|
|
|
// Cancel it, rather than try to retrieve all of the state we need.
|
|
|
|
gesture.cancel();
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return gesture;
|
|
|
|
}
|
|
|
|
|
|
|
|
// No gesture existed on this workspace, but this looks like the start of a
|
|
|
|
// new gesture.
|
|
|
|
if (isStart) {
|
|
|
|
this.currentGesture_ = new Blockly.Gesture(e, this);
|
|
|
|
return this.currentGesture_;
|
|
|
|
}
|
|
|
|
// No gesture existed and this event couldn't be the start of a new gesture.
|
|
|
|
return null;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clear the reference to the current gesture.
|
|
|
|
* @package
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.clearGesture = function() {
|
|
|
|
this.currentGesture_ = null;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cancel the current gesture, if one exists.
|
|
|
|
* @package
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.cancelCurrentGesture = function() {
|
|
|
|
if (this.currentGesture_) {
|
|
|
|
this.currentGesture_.cancel();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-07-17 11:28:12 -07:00
|
|
|
/**
|
|
|
|
* Don't even think about using this function before talking to rachel-fenichel.
|
|
|
|
*
|
|
|
|
* Force a drag to start without clicking and dragging the block itself. Used
|
|
|
|
* to attach duplicated blocks to the mouse pointer.
|
|
|
|
* @param {!Object} fakeEvent An object with the properties needed to start a
|
|
|
|
* drag, including clientX and clientY.
|
|
|
|
* @param {!Blockly.BlockSvg} block The block to start dragging.
|
|
|
|
* @package
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.startDragWithFakeEvent = function(fakeEvent,
|
|
|
|
block) {
|
|
|
|
Blockly.Touch.clearTouchIdentifier();
|
|
|
|
Blockly.Touch.checkTouchIdentifier(fakeEvent);
|
|
|
|
var gesture = block.workspace.getGesture(fakeEvent);
|
|
|
|
gesture.forceStartBlockDrag(fakeEvent, block);
|
|
|
|
};
|
|
|
|
|
Merge/05 24 (#903)
* JSON definitions for colour blocks (#838)
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) (#850)
* 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 (#830)
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 (#844)
* Localisation updates from https://translatewiki.net.
* Porting math.js blocks to JSON (#846)
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. (#851)
Fixes #848.
* 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). (#861)
* Localisation updates from https://translatewiki.net.
* .getOptions_() to .getOptions() (#869)
Fixes #867.
* Blockly.Extensions.buildTooltipForDropdown(..): Deferred validation. (#870)
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 (#874)
* Remove use of Array.prototype.includes which is not implemented in IE or Edge < 14. Fixes google/blockly#876.
* 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 (#879)
* 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 #892. I incorrectly converted one CSS transform setting to use the cross-browser setting function in 40a063763c74b3f712c3057565966c25d5cfdb10. (#895)
* Adding @namespace annotations for JSDoc. (#900)
* Fix typo causing TypeError (#901)
* Pinning the angular2 dependency, and including licenses. (#893)
* Add skeleton for tests on rendered workspaces
* Fix some lint errors
* Localisation updates from https://translatewiki.net.
* Correct changedState in setWarningText() (#908)
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(). (#907)
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 (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
* Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
* Add isEditable to field, and add tests
* Separate tests
* Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
* Correction to logic_ternary type check (#920)
* Porting Loop blocks to JSON (#919)
* 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. (#923)
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 #661
* 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. (#934)
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 #946. Don't check for presence of constants.js
* Fix #945 (annotations) and an eslint issue (constant condition)
* Localisation updates from https://translatewiki.net.
* Fix #950: 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 #937.
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() (#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.
* Annotation fixes
* Fix bug #904 by explicitly grabbing focus on the workspace svg element. (#964)
* Potential fix for #888. Stops checking whether we are mid workspace drag since we do not always get mosue up events when blockly is in an iframe. (#899)
* Adding new minimap demo
* Basic code style changes. Adding a few more comments. Return early if disableScrollChange in onScrollChange listener.
* `unction` to `function` corrects #962 (#970)
* Cross browser friendly fix for #904. This calls blur and focus from … (#972)
* Cross browser friendly fix for #904. 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 #904 to keep the page from jumping to the focused workspace in IE 11 (#974)
* 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 #967 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 d55d9cbd9ff308ff5e361cf77acabb61a4bf4695). IIUC, updateWidth/getCachedWidth was only called from render before which is overridden in FieldImage to be a no-op already. (#979)
* Fix #969
* Localisation updates from https://translatewiki.net.
* Fix #986. Looks like the original PR just forgot this block. (#992)
* rebuild develop (#996)
* Added the variable modal and component and implemented basic renaming functionality. (#991)
* Fixing commenting from the last commit. (#1000)
* 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. (#1011)
* Minimap position bug fix for browsers other than chrome. Added touch support.
* Adding an add variable modal to accessible Blockly. (#1015)
* 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. (#1017)
Centralizes accessible modal behavior.
* - Changed error message referencing 'procedure' instead of 'function' (#1019)
- 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,… (#1028)
...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). (#1027)
* Enable google/blockly with continuous build on travis ci (#1023) (#1035)
* 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 #880.
* Ensure useDragSurface is a boolean.
Fixed #988
* use pretest instead of preinstall in package.json (#1043)
* 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 #973
* bumpNeighbours_ function moved to block_svg.
Fixed #1009
* Update RegEx in js-to-json to match windowi eol (#1050)
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 (#1053)
"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. (#1054)
* Correcting #1054 (#1056)
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… (#1057)
* Change how blockly handles cursors. The old way was quite slow because it changed the stylesheet directly. See issue #981 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. (#1059)
* Merge master into develop (#1063)
- pick up translation changes
- clean up trailing spaces
* use goog.string.startswith instead of string.startswith (#1065)
* New jsinterpreter demo includes wait block. Both demos have improved UI for clarity. (#1001)
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 #1069 (#1073)
* VariableMap and functions added.
* Fix #1051 (#1084)
* Improve errors when validating JSON block definitions. (#1086)
goog.asserts to not run from blockly_compressed.js. User data validation should always run.
* Dragging changes, rebased on develop (#1078)
* 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 (#1026)
-- 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 (#1048)
- Removed gestureDB
- Removing uses of terminateDrag
- Cleaned up disposal code
* Dragging bugfixes (#1058)
- 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 (#1060)
* 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. (#1081)
* add osx travis test run job (#1074)
* Names are correctly fetched from VariableModels!
* add more wait time for test setup (#1091)
* Work around timing issue with travis osx issue (#1092)
* add more wait time for test setup
* increase selenium wait time
* add more wait
* Fix #1077 by adding a rule to cover the toolbox labels too. (#1099)
* Assign variable UUID to field_variable dropdown.
* Change registration link to a static one (#1106)
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 (#1111)
* Click events on shadow blocks have the correct id (#1089)
* Add image_onclick option (#1080)
* Cleanup: semicolons, spacing, etc. (#1116)
* Spelling. Spelling is hard.
* Add variable info to xml generated in variables.js
* Add missing CLAs info to the contributing file (#1119)
* Add missing CLAs info to the contributing file
* Added larger changes paragraph
* Replacing latest prettifier hosted in repo with latest version at rawgit CDN. (#1120)
* Forgot update code demo (#1121)
* Move audio code to a new file (#1122)
* 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 (#1126)
* Include variables at top of serialization.
* Move blockSvg.getHeightWidth to block_render_svg.js (#1118)
* Deserialization variables at top.
* Create grid object (#1131)
* 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
|
|
|
/**
|
|
|
|
* Get the audio manager for this workspace.
|
|
|
|
* @return {Blockly.WorkspaceAudio} The audio manager for this workspace.
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.getAudioManager = function() {
|
|
|
|
return this.audioManager_;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the grid object for this workspace, or null if there is none.
|
|
|
|
* @return {Blockly.Grid} The grid object for this workspace.
|
|
|
|
* @package
|
|
|
|
*/
|
|
|
|
Blockly.WorkspaceSvg.prototype.getGrid = function() {
|
|
|
|
return this.grid_;
|
|
|
|
};
|
|
|
|
|
2014-12-23 11:22:02 -08:00
|
|
|
// Export symbols that would otherwise be renamed by Closure compiler.
|
2015-05-22 17:08:59 -07:00
|
|
|
Blockly.WorkspaceSvg.prototype['setVisible'] =
|
|
|
|
Blockly.WorkspaceSvg.prototype.setVisible;
|