2013-10-30 14:46:03 -07:00
|
|
|
/**
|
2014-01-28 03:00:09 -08:00
|
|
|
* @license
|
2013-10-30 14:46:03 -07:00
|
|
|
* Visual Blocks Editor
|
|
|
|
*
|
|
|
|
* Copyright 2012 Google Inc.
|
2014-10-07 13:09:55 -07:00
|
|
|
* https://developers.google.com/blockly/
|
2013-10-30 14:46:03 -07:00
|
|
|
*
|
|
|
|
* 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 Dropdown input field. Used for editable titles and variables.
|
|
|
|
* In the interests of a consistent UI, the toolbox shares some functions and
|
|
|
|
* properties with the context menu.
|
|
|
|
* @author fraser@google.com (Neil Fraser)
|
|
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
goog.provide('Blockly.FieldDropdown');
|
|
|
|
|
|
|
|
goog.require('Blockly.Field');
|
2016-06-14 17:08:14 -04:00
|
|
|
goog.require('Blockly.DropDownDiv');
|
2014-09-08 14:26:52 -07:00
|
|
|
goog.require('goog.dom');
|
2015-02-06 15:27:25 -08:00
|
|
|
goog.require('goog.events');
|
2014-09-08 14:26:52 -07:00
|
|
|
goog.require('goog.style');
|
|
|
|
goog.require('goog.ui.Menu');
|
|
|
|
goog.require('goog.ui.MenuItem');
|
|
|
|
goog.require('goog.userAgent');
|
2013-10-30 14:46:03 -07:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class for an editable dropdown field.
|
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
|
|
|
* @param {(!Array.<!Array>|!Function)} menuGenerator An array of options
|
|
|
|
* for a dropdown list, or a function which generates these options.
|
2016-02-10 14:33:13 -08:00
|
|
|
* @param {Function=} opt_validator A function that is executed when a new
|
2013-12-14 03:00:02 -08:00
|
|
|
* option is selected, with the newly selected value as its sole argument.
|
|
|
|
* If it returns a value, that value (which must be one of the options) will
|
|
|
|
* become selected in place of the newly selected option, unless the return
|
|
|
|
* value is null, in which case the change is aborted.
|
2013-10-30 14:46:03 -07:00
|
|
|
* @extends {Blockly.Field}
|
|
|
|
* @constructor
|
|
|
|
*/
|
2016-02-10 14:33:13 -08:00
|
|
|
Blockly.FieldDropdown = function(menuGenerator, opt_validator) {
|
2013-10-30 14:46:03 -07:00
|
|
|
this.menuGenerator_ = menuGenerator;
|
|
|
|
this.trimOptions_();
|
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 firstTuple = this.getOptions()[0];
|
2013-10-30 14:46:03 -07:00
|
|
|
|
|
|
|
// Call parent's constructor.
|
2016-02-10 14:33:13 -08:00
|
|
|
Blockly.FieldDropdown.superClass_.constructor.call(this, firstTuple[1],
|
|
|
|
opt_validator);
|
2016-10-05 11:28:44 -06:00
|
|
|
this.addArgType('dropdown');
|
2013-10-30 14:46:03 -07:00
|
|
|
};
|
|
|
|
goog.inherits(Blockly.FieldDropdown, Blockly.Field);
|
|
|
|
|
2018-04-17 14:15:18 -07:00
|
|
|
/**
|
|
|
|
* Construct a FieldDropdown from a JSON arg object.
|
|
|
|
* @param {!Object} element A JSON object with options.
|
|
|
|
* @returns {!Blockly.FieldDropdown} The new field instance.
|
|
|
|
* @package
|
|
|
|
* @nocollapse
|
|
|
|
*/
|
|
|
|
Blockly.FieldDropdown.fromJson = function(element) {
|
|
|
|
return new Blockly.FieldDropdown(element['options']);
|
|
|
|
};
|
|
|
|
|
2013-12-14 03:00:02 -08: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
|
|
|
* Horizontal distance that a checkmark overhangs the dropdown.
|
2013-12-14 03:00:02 -08:00
|
|
|
*/
|
2014-09-08 14:26:52 -07:00
|
|
|
Blockly.FieldDropdown.CHECKMARK_OVERHANG = 25;
|
2013-12-14 03:00:02 -08:00
|
|
|
|
2013-10-30 14:46:03 -07:00
|
|
|
/**
|
|
|
|
* Mouse cursor style when over the hotspot that initiates the editor.
|
|
|
|
*/
|
|
|
|
Blockly.FieldDropdown.prototype.CURSOR = 'default';
|
|
|
|
|
2016-09-28 16:42:42 -04:00
|
|
|
/**
|
|
|
|
* Closure menu item currently selected.
|
|
|
|
* @type {?goog.ui.MenuItem}
|
|
|
|
*/
|
|
|
|
Blockly.FieldDropdown.prototype.selectedItem = 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
|
|
|
/**
|
|
|
|
* Language-neutral currently selected string or image object.
|
|
|
|
* @type {string|!Object}
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.FieldDropdown.prototype.value_ = '';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SVG image element if currently selected option is an image, or null.
|
|
|
|
* @type {SVGElement}
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.FieldDropdown.prototype.imageElement_ = null;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Object with src, height, width, and alt attributes if currently selected
|
|
|
|
* option is an image, or null.
|
|
|
|
* @type {Object}
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.FieldDropdown.prototype.imageJson_ = null;
|
|
|
|
|
2015-01-06 15:23:45 -08:00
|
|
|
/**
|
|
|
|
* Install this dropdown on a block.
|
|
|
|
*/
|
2016-04-09 12:01:38 -03:00
|
|
|
Blockly.FieldDropdown.prototype.init = function() {
|
2016-04-04 17:47:15 -07:00
|
|
|
if (this.fieldGroup_) {
|
2015-01-06 15:23:45 -08:00
|
|
|
// Dropdown has already been initialized once.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// Add dropdown arrow: "option ▾" (LTR) or "▾ אופציה" (RTL)
|
2016-10-04 17:42:21 -04:00
|
|
|
// Positioned on render, after text size is calculated.
|
|
|
|
/** @type {Number} */
|
|
|
|
this.arrowSize_ = 12;
|
|
|
|
/** @type {Number} */
|
|
|
|
this.arrowX_ = 0;
|
|
|
|
/** @type {Number} */
|
|
|
|
this.arrowY_ = 11;
|
2017-02-02 14:17:43 -05:00
|
|
|
this.arrow_ = Blockly.utils.createSvgElement('image', {
|
2016-10-04 17:42:21 -04:00
|
|
|
'height': this.arrowSize_ + 'px',
|
|
|
|
'width': this.arrowSize_ + 'px'
|
|
|
|
});
|
|
|
|
this.arrow_.setAttributeNS('http://www.w3.org/1999/xlink',
|
|
|
|
'xlink:href', Blockly.mainWorkspace.options.pathToMedia + 'dropdown-arrow.svg');
|
2017-10-13 15:29:02 -04:00
|
|
|
this.className_ += ' blocklyDropdownText';
|
2015-01-06 15:23:45 -08:00
|
|
|
|
2016-04-09 12:01:38 -03:00
|
|
|
Blockly.FieldDropdown.superClass_.init.call(this);
|
2016-07-27 16:29:02 -04:00
|
|
|
// If not in a shadow block, draw a box.
|
|
|
|
if (!this.sourceBlock_.isShadow()) {
|
2017-02-02 14:17:43 -05:00
|
|
|
this.box_ = Blockly.utils.createSvgElement('rect', {
|
2016-07-27 16:29:02 -04:00
|
|
|
'rx': Blockly.BlockSvg.CORNER_RADIUS,
|
|
|
|
'ry': Blockly.BlockSvg.CORNER_RADIUS,
|
|
|
|
'x': 0,
|
|
|
|
'y': 0,
|
|
|
|
'width': this.size_.width,
|
|
|
|
'height': this.size_.height,
|
2016-10-04 10:06:45 -06:00
|
|
|
'stroke': this.sourceBlock_.getColourTertiary(),
|
2016-10-04 17:42:21 -04:00
|
|
|
'fill': this.sourceBlock_.getColour(),
|
|
|
|
'class': 'blocklyBlockBackground',
|
|
|
|
'fill-opacity': 1
|
2016-10-04 10:06:45 -06:00
|
|
|
}, null);
|
|
|
|
this.fieldGroup_.insertBefore(this.box_, this.textElement_);
|
2016-07-27 16:29:02 -04:00
|
|
|
}
|
2015-01-06 15:23:45 -08:00
|
|
|
// Force a reset of the text to add the arrow.
|
|
|
|
var text = this.text_;
|
|
|
|
this.text_ = null;
|
|
|
|
this.setText(text);
|
|
|
|
};
|
|
|
|
|
2013-10-30 14:46:03 -07:00
|
|
|
/**
|
|
|
|
* Create a dropdown menu under the text.
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.FieldDropdown.prototype.showEditor_ = function() {
|
2017-12-19 14:36:08 -05:00
|
|
|
var options = this.getOptions();
|
|
|
|
if (options.length == 0) return;
|
|
|
|
|
2016-10-05 17:14:33 -04:00
|
|
|
this.dropDownOpen_ = true;
|
2016-06-14 17:08:14 -04:00
|
|
|
// If there is an existing drop-down someone else owns, hide it immediately and clear it.
|
|
|
|
Blockly.DropDownDiv.hideWithoutAnimation();
|
|
|
|
Blockly.DropDownDiv.clearContent();
|
|
|
|
|
|
|
|
var contentDiv = Blockly.DropDownDiv.getContentDiv();
|
|
|
|
|
2014-09-08 14:26:52 -07:00
|
|
|
var thisField = this;
|
2013-10-30 14:46:03 -07:00
|
|
|
|
2014-09-08 14:26:52 -07:00
|
|
|
function callback(e) {
|
2016-11-01 16:32:10 -07:00
|
|
|
var menu = this;
|
2014-09-08 14:26:52 -07:00
|
|
|
var menuItem = e.target;
|
|
|
|
if (menuItem) {
|
2016-11-01 16:32:10 -07:00
|
|
|
thisField.onItemSelected(menu, menuItem);
|
2014-09-08 14:26:52 -07:00
|
|
|
}
|
2016-06-14 17:08:14 -04:00
|
|
|
Blockly.DropDownDiv.hide();
|
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.Events.setGroup(false);
|
2013-10-30 14:46:03 -07:00
|
|
|
}
|
|
|
|
|
2014-09-08 14:26:52 -07:00
|
|
|
var menu = new goog.ui.Menu();
|
2015-08-19 17:21:05 -07:00
|
|
|
menu.setRightToLeft(this.sourceBlock_.RTL);
|
Adding indexing settings, tests and fixing bugs (#464)
* Add indexing setting for JavaScript Generation
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.
* Updating js lists to do zero and one based index
Updated generated JavaScript to change depending on whether one based indexing is enabled or not.
* Updating js text to do zero and one based index
Change so that JavaScript generated for text blocks either assumes blocks use zero or one based index based on setting.
* Start of python indexing
Start of work on allowing one and zero indexing for generated python for lists.
* Fixing bug and lint fixed
Fixing bug caused by not setting the return of concat when concatenating lines for sublist and substring functions. Also renamed these functions to be getSubsequece. Fixed lint errors with spacing
* Converting from if to switch statements
Comverting if statements to switch statements when appropriate and adding spacing.
* Modified sublist JavaScript generation
Added case so that helper function is not generated if not necessary. Helper function is not generated if list length is not needed or if list is a simple block (such as a variable, as oppossed to a function call or list create).
* Stripping unecessary ids
Removing ids from xml file.
* Localisation updates from https://translatewiki.net.
* Fix typo in flyout.js (#403)
* Fix typo in flyout.js (#402)
* Localisation updates from https://translatewiki.net.
* Add indexing setting for JavaScript Generation
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.
* Updating js lists to do zero and one based index
Updated generated JavaScript to change depending on whether one based indexing is enabled or not.
* Updating js text to do zero and one based index
Change so that JavaScript generated for text blocks either assumes blocks use zero or one based index based on setting.
* Fixing bug and lint fixed
Fixing bug caused by not setting the return of concat when concatenating lines for sublist and substring functions. Also renamed these functions to be getSubsequece. Fixed lint errors with spacing
* Converting from if to switch statements
Comverting if statements to switch statements when appropriate and adding spacing.
* Modified sublist JavaScript generation
Added case so that helper function is not generated if not necessary. Helper function is not generated if list length is not needed or if list is a simple block (such as a variable, as oppossed to a function call or list create).
* Stripping unecessary ids
Removing ids from xml file.
* Updating generator test
Modifying sublist test and re-formatting spacing between blocks.
* Updating js lists to do zero and one based index
Updated generated JavaScript to change depending on whether one based indexing is enabled or not.
* Updating js text to do zero and one based index
Change so that JavaScript generated for text blocks either assumes blocks use zero or one based index based on setting.
* Fixing bug and lint fixed
Fixing bug caused by not setting the return of concat when concatenating lines for sublist and substring functions. Also renamed these functions to be getSubsequece. Fixed lint errors with spacing
* Converting from if to switch statements
Comverting if statements to switch statements when appropriate and adding spacing.
* Modified sublist JavaScript generation
Added case so that helper function is not generated if not necessary. Helper function is not generated if list length is not needed or if list is a simple block (such as a variable, as oppossed to a function call or list create).
* Stripping unecessary ids
Removing ids from xml file.
* Localisation updates from https://translatewiki.net.
* Localisation updates from https://translatewiki.net.
* Updating js lists to do zero and one based index
Updated generated JavaScript to change depending on whether one based indexing is enabled or not.
* Fixing bug and lint fixed
Fixing bug caused by not setting the return of concat when concatenating lines for sublist and substring functions. Also renamed these functions to be getSubsequece. Fixed lint errors with spacing
* Modified sublist JavaScript generation
Added case so that helper function is not generated if not necessary. Helper function is not generated if list length is not needed or if list is a simple block (such as a variable, as oppossed to a function call or list create).
* Stripping unecessary ids
Removing ids from xml file.
* Updating generator test
Modifying sublist test and re-formatting spacing between blocks.
* Adding tests for indexing and extra cases
Adding tests for indexing with custom block to adjust number based on what indexing is being generated.
* Adding tests and renaming tests
Adding tests for sublist and renaming tests.
* Fixes for order for sublists
Fixes so that parenthesis are generated properly for index for sublist
* Cleaning up test generated code
Changing order returned for unit test adjust index function to generate less unecessary parenthesis.
* Adding tests for order
Adding tests for order, relevant for methods that use index from start (because 1 is added)
* Fixing JS order for getIndex and setIndex
Changing to the correct order type when calling valueToCode in JS generation for getIndex and setIndex.
* Fixed unittest adjustIndex
Fixed uninttest adjustindex to also check whether the ONE_BASED_INDEXING variable has been defined to ensure proper behaviour.
* Fixing lint and formatting for JS/lists
Making line fixes and changing an if/elseif to case statement.
* Tests added to include case for bug found
Added tests with sublist combinations of different where's for the two indices after bug for this found in python.
* Adding and renaming tests
Adding test case for creating a sublist that encompasses the whole list but uses # and #-end instead of first last (applicable for python). Also, renaming tests.
* Adding contant and fixing python lists bugs
Adding contant for ONE_BASED_INDEXING and fixing bugs in python for lists.
* Fixing test get random
Fixing test get random to take into account indexing for return value.
* Adding indexing checkbox to test page
Adding checkbos on test page so that code can be generated for one and zero based indexing. Languages that are generated with zero based indexing that do not have it implemented will fail tests as expected.
* Fixing unittest getremove random
Fixing unittest getremove random to take into account the return value based on indexing.
* Change comparison for getremove random test
Fixed comparison to equal for the return value for getremove random.
* Fixing bugs with lists zero-indexing
Fixing getIndex and getSublist methods to pass for zero-indexed tests.
* Adding test cases and formatting
Adding test cases to text tests, reordering a couple list test, and formatting block spacing.
* Fixing unittest expected value
Fixing expected value fore unit tests for sublist.
* Cleanup
Removing obvious comments, formatting fixes, and naming in generated code in JS.
* Helper function for Python lists
Adding helper function for casting to int for indices.
* Expanding helper to reduce duplicated code
Expanding helper method to also get the property with the correct order and check indexing to reduce duplicated code.
* Cleaning up JS indexing with helper function
Adding helper function for indexing and used it in lists and text.
* Moving helper function and formatting fixes
Moving helper function, formatting fixes, and changing some generated code variable names.
* Fixing python generation for text
Fixing all failinng tests for python and using new helper method.
* Lint fixes and order in indexOf
Making lint fixes and correcting returned order in indexOf.
* Python variable renaming
Renaming a few generated variables.
* Fixing comment and order
Fixing comment to list Blockly.Block type and fixing order because it could be higher.
* Switching back to if
Switching switch back to if statements because there weren't enough cases to warrant for a switch.
* Adding order and fixing lists for Dart
Adding if null operator to operator precedence for Dart. Also, fixing lists implementation to pass unit tests and adding zero-indexing functionality.
* Formatting and lint fixes
Formatting and lint fixes
* Dart text fixed
Fixing Dart text generation to pass unit tests.
* Changing back to variable
Changing switch condition back to variable.
* Fixing ORDER_OVERRIDES
Inner and outer order was switched .
* Adding bug with order caused by generator change
Flooring order before comparision because of how the order constants were modified.
* Adding list tests
Adding tests for additional cases for lists/
* Adding comment for dart order
Adding comment for Dart ORDER_IF_NULL operator.
* Formatting fixes
Formatting fixes for line indentation.
* Fixing PHP order and lists generation
Fixing PHP order constants and fixing lists so that they pass unit tests.
* Fixing tests
Removing duplicate unit test
* Adding text tests
Adding tests for text.
* Renaming variable and removing unused variable
Renaming variables from exceptionIndex to errorIndex and removing unused at variable.
* Adding missing function call to test
Adding missing funciton call to test that was causing tests to fail when they shouldn't.
* Fixing PHP text generation
Fixing PHP text code generation so it passes unit tests.
* Formatting fixes
Cleaning up code, renamiing a variable.
* Fixing failing subsequence tests
Fixing JS code that failed for sublist/substring tests.
* Fixing intentation
Fixing indentation.
* Fixing Dart sublist/substring
Fixing sublist/substring to include condiiton where FROM_START (and not throw error by mistake) when zero-indexed.
* Adding order subtraction test
Adding test for checking order for subtraction x- (y - z) x - (y + z).
* Updating to new PHP power operator
Updating from pow function to ** operator to clean up code.
* Updating to new removeWhere
Updating removeMatching to removeWhere because new version of Dart now use removeWhere.
* Fix for lua rounding assertequals
Adding check for number in equlity check for comparing number for floats.
* Adding test for copy of list
Adding test that checks the list is copied when a sublist is made first-last.
* Formatting and order fixes
Fixing formatting such as indentation and order fixes.
* Adding comment for clarity
Adding comment about how Lua code generation is not supporting zero indexing.
* Changed variable names in code
Changed variable names to follow style guide and changed for loop variable from n to i as is typical.
* Reducing unecessarily generated functions and renaming variables
Reducing number of generated functions using gensym_ by adding parameters to provided function. Renaming variables to make functions more readble.
* Fixing sublist order and sort variable
Fixing order used for valueToCode for sublist and renaming list variable in sort to match rest of code..
* Fixing order constant order
Removing operator () that was incorrect and addiung ~,
* Fixing order and indentation
Fixing order return fro create lists blocks and fixing indentationn for string array.
* Fixing order and renaming variables
Fixing order to be the correct strength and renaming variables to be more readable/
* Changing assert blocks for unit tests
Changing assert blocks to have a value input instead of a field so there is more flexibility in writing tests.
* Cleaning up and adding missing order tests
Adding tests for order for paramters for list blocks that weren't being tested to uncover bugs. Test were also cleaned up/reorganized/renamed to be more readable and shorter vertically (but lines wider horizontally).
* Compile error fix and order in Dart generation.
Fixing compile error in generated code and incorrect order in get sublist for Dart.
* Fixing typo in getIndex and invalid parameter name
Fixing type in getIndex where list code should have been appended but instead an undefined variable was added. The parameter in lists_sort was changed to my_list because list is a reserved word in python.
* Fixing order, parenthesis bug, and variable declaration in Lua
Fixing incorrect order in Lua. Fixing bug caused by missing parenthesis around ternary operator in code. Variable code was declared with JavaScript syntax, this was fixed to be valid in Lua.
* Adding tests and formatting tests
Adding missing test for order in text/lists. Changing spacing/order of tests and updating comments.
* Fixing error in code
Changing to correct function call in empy tests and changing test name that was duplicated to be more clear.
* Renamed test helper function
* Fixing order and renaming variable in JS generator
Fixing order for charAt and renaming variable in code list_sort from listCode to list to be consistent with rest of code.
* Fixing order for dart text
Fixing roder for dart charAt
* Cleaning up generated code for Dart getIndex
Cleaning up generated code for Dart getIndex so that helper functions aren't generated unecessarily and adding comments.
* Fixing Dart remove random error
Fixing error caused by remove random implementation in Dart. index should have been x but instead was length - x.
* Fixing unit test blocks
Fixing Lua unit test block that should have just returned the number and removing unecessary checks in other blocks because the constant was defined.
* Fixing Lua assert equals block
string.format was throwing an error if one of the values happened to be a boolean.
* Adding tests for create text with number
Adding test for create text with numbers as parameters
* Fixing lua unit test block
Lua unit test block should have added 1
* Removing indexing setting for Lua tests
Removing setting index setting for Lua generation because it is always one-indexed.
* Fixing order and create text
Fixing failing test caused by improper order and fixed create text to properly convert to string when there is one element.
* Running linter on generator code
Running linter on generator code and fixing spacing/indentation problems.
* Editing comments and removing uneeded parenthesis
Editing and adding comments and removing uneeded parenthesis around ternary operator condition.
* Fixing order and changing variable names
Fixing orders that were incorrect and changing variable names to be more descriptive and consistent across code.
* Adding comment about list support and fixes for PHP
Adding comment about how lists are not fully supported for PHP. Adding missing order to PHP and fixing order errors throughout. Fixing regex for variable matching in lists. Cleaning up variable names to be more readable and consistent with other parts of code.
* Reducing complexity for getremove/remove in JS
Reducing complexity in generated code for getremove/remove in JavaScript by replacing unecessary helper function.
* Fixing spacing before inline comments
Ensuring there are two spaces before inline comments.
* Changing JS list copy for clarity
Changing JavaScript list copy to use slice(0) instead of concat for clarity and to use the same pattern as the other sublist methods.
* Changing generated variable name tmp_x
Changing tmp_x to tmpX to follow closer to the correct style for JavaScript.
* Prefixing empy lines between comment text
Prior to this change, comments with an empty line between text did not have a comment prefix before it, resulting in comment blocks that seemed disjoined although they were for the same block. This change affects how the prefix line function works so that those lines will have the prefix (if applicable) while still taking into account the trailing newline character.
* Changing for loops variable names
Changing most for loops to use i as the variable name (or j if applicable) or changing name to be more readable.
* Simplifying provided subsequence function
Simplifying subsequence function to generate a simpler function depending on where combination instead of a larger complex function that works for all where combinations.
* Style fixes
Fixing indentation, comments, and other formatting-type changes based on pull request comments.
* Fixing indentation
Fixing indentation and removing an extra newline.
* Fixing PHP mode implementation
Fixing PHP mode implementation to properlyu return multiple modes if applicable.
* Fixing line too long
Wrapping lines in php/math.js with lines longer than 80 characters.
* Wrapping long lines
Wrapping lines that are too long.
* Changing boolean casing
Changing boolean casing to be lowercase.
2016-07-08 11:43:48 -07:00
|
|
|
for (var i = 0; i < options.length; i++) {
|
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 content = options[i][0]; // Human-readable text or image.
|
|
|
|
var value = options[i][1]; // Language-neutral value.
|
|
|
|
if (typeof content == 'object') {
|
|
|
|
// An image, not text.
|
|
|
|
var image = new Image(content['width'], content['height']);
|
|
|
|
image.src = content['src'];
|
|
|
|
image.alt = content['alt'] || '';
|
|
|
|
content = image;
|
|
|
|
}
|
|
|
|
var menuItem = new goog.ui.MenuItem(content);
|
2015-08-19 17:21:05 -07:00
|
|
|
menuItem.setRightToLeft(this.sourceBlock_.RTL);
|
2014-09-08 14:26:52 -07:00
|
|
|
menuItem.setValue(value);
|
|
|
|
menuItem.setCheckable(true);
|
|
|
|
menu.addChild(menuItem, true);
|
2016-09-28 16:42:42 -04:00
|
|
|
var checked = (value == this.value_);
|
|
|
|
menuItem.setChecked(checked);
|
|
|
|
if (checked) {
|
|
|
|
this.selectedItem = menuItem;
|
|
|
|
}
|
2013-10-30 14:46:03 -07:00
|
|
|
}
|
2014-09-08 14:26:52 -07:00
|
|
|
// Listen for mouse/keyboard events.
|
|
|
|
goog.events.listen(menu, goog.ui.Component.EventType.ACTION, callback);
|
|
|
|
|
|
|
|
// Record windowSize and scrollOffset before adding menu.
|
2016-06-14 17:08:14 -04:00
|
|
|
menu.render(contentDiv);
|
2014-09-08 14:26:52 -07:00
|
|
|
var menuDom = menu.getElement();
|
2017-02-02 14:17:43 -05:00
|
|
|
Blockly.utils.addClass(menuDom, 'blocklyDropdownMenu');
|
2014-09-08 14:26:52 -07:00
|
|
|
// Record menuSize after adding menu.
|
|
|
|
var menuSize = goog.style.getSize(menuDom);
|
2015-07-16 22:08:50 +01:00
|
|
|
// Recalculate height for the total content, not only box height.
|
|
|
|
menuSize.height = menuDom.scrollHeight;
|
2014-09-08 14:26:52 -07:00
|
|
|
|
2016-07-27 16:29:02 -04:00
|
|
|
var primaryColour = (this.sourceBlock_.isShadow()) ?
|
|
|
|
this.sourceBlock_.parentBlock_.getColour() : this.sourceBlock_.getColour();
|
|
|
|
|
|
|
|
Blockly.DropDownDiv.setColour(primaryColour, this.sourceBlock_.getColourTertiary());
|
2016-10-04 17:42:21 -04:00
|
|
|
|
2016-10-03 06:17:45 -06:00
|
|
|
var category = (this.sourceBlock_.isShadow()) ?
|
|
|
|
this.sourceBlock_.parentBlock_.getCategory() : this.sourceBlock_.getCategory();
|
|
|
|
Blockly.DropDownDiv.setCategory(category);
|
2016-09-30 13:36:29 -04:00
|
|
|
|
|
|
|
// Calculate positioning based on the field position.
|
|
|
|
var scale = this.sourceBlock_.workspace.scale;
|
|
|
|
var bBox = {width: this.size_.width, height: this.size_.height};
|
|
|
|
bBox.width *= scale;
|
|
|
|
bBox.height *= scale;
|
2016-11-16 10:15:21 -08:00
|
|
|
var position = this.fieldGroup_.getBoundingClientRect();
|
|
|
|
var primaryX = position.left + bBox.width / 2;
|
|
|
|
var primaryY = position.top + bBox.height;
|
2016-09-30 13:36:29 -04:00
|
|
|
var secondaryX = primaryX;
|
2016-11-16 10:15:21 -08:00
|
|
|
var secondaryY = position.top;
|
2016-09-30 13:36:29 -04:00
|
|
|
// Set bounds to workspace; show the drop-down.
|
|
|
|
Blockly.DropDownDiv.setBoundsElement(this.sourceBlock_.workspace.getParentSvg().parentNode);
|
2018-05-02 15:32:28 -07:00
|
|
|
Blockly.DropDownDiv.show(
|
|
|
|
this, primaryX, primaryY, secondaryX, secondaryY, this.onHide.bind(this));
|
2016-06-14 17:08:14 -04:00
|
|
|
|
2014-09-08 14:26:52 -07:00
|
|
|
menu.setAllowAutoFocus(true);
|
|
|
|
menuDom.focus();
|
2016-10-04 17:42:21 -04:00
|
|
|
|
|
|
|
// Update colour to look selected.
|
2016-10-05 17:14:33 -04:00
|
|
|
if (!this.disableColourChange_) {
|
|
|
|
if (this.sourceBlock_.isShadow()) {
|
2023-03-02 13:46:07 -05:00
|
|
|
this.sourceBlock_.setShadowColour(this.sourceBlock_.getColourQuaternary());
|
2016-10-05 17:14:33 -04:00
|
|
|
} else if (this.box_) {
|
2023-03-02 13:46:07 -05:00
|
|
|
this.box_.setAttribute('fill', this.sourceBlock_.getColourQuaternary());
|
2016-10-05 17:14:33 -04:00
|
|
|
}
|
2016-10-04 17:42:21 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback for when the drop-down is hidden.
|
|
|
|
*/
|
|
|
|
Blockly.FieldDropdown.prototype.onHide = function() {
|
2016-10-05 17:14:33 -04:00
|
|
|
this.dropDownOpen_ = false;
|
2016-10-04 17:42:21 -04:00
|
|
|
// Update colour to look selected.
|
2017-02-22 16:52:54 -06:00
|
|
|
if (!this.disableColourChange_ && this.sourceBlock_) {
|
2016-10-05 17:14:33 -04:00
|
|
|
if (this.sourceBlock_.isShadow()) {
|
2018-10-23 13:55:28 -07:00
|
|
|
this.sourceBlock_.clearShadowColour();
|
2016-10-05 17:14:33 -04:00
|
|
|
} else if (this.box_) {
|
|
|
|
this.box_.setAttribute('fill', this.sourceBlock_.getColour());
|
|
|
|
}
|
2016-10-04 17:42:21 -04:00
|
|
|
}
|
2013-10-30 14:46:03 -07:00
|
|
|
};
|
|
|
|
|
2016-11-01 16:32:10 -07:00
|
|
|
/**
|
|
|
|
* Handle the selection of an item in the dropdown menu.
|
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
|
|
|
* @param {!goog.ui.Menu} menu The Menu component clicked.
|
|
|
|
* @param {!goog.ui.MenuItem} menuItem The MenuItem selected within menu.
|
2016-11-01 16:32:10 -07:00
|
|
|
*/
|
|
|
|
Blockly.FieldDropdown.prototype.onItemSelected = function(menu, menuItem) {
|
|
|
|
var value = menuItem.getValue();
|
|
|
|
if (this.sourceBlock_) {
|
|
|
|
// Call any validation function, and allow it to override.
|
|
|
|
value = this.callValidator(value);
|
|
|
|
}
|
2018-10-09 16:17:21 -04:00
|
|
|
// If the value of the menu item is a function, call it and do not select it.
|
|
|
|
if (typeof value == 'function') {
|
|
|
|
value();
|
|
|
|
return;
|
|
|
|
}
|
2016-11-01 16:32:10 -07:00
|
|
|
if (value !== null) {
|
|
|
|
this.setValue(value);
|
|
|
|
}
|
2016-11-02 13:56:27 -07:00
|
|
|
};
|
2016-11-01 16:32:10 -07:00
|
|
|
|
2013-10-30 14:46:03 -07:00
|
|
|
/**
|
|
|
|
* Factor out common words in statically defined options.
|
|
|
|
* Create prefix and/or suffix labels.
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Blockly.FieldDropdown.prototype.trimOptions_ = function() {
|
2013-12-20 16:25:26 -08:00
|
|
|
this.prefixField = null;
|
|
|
|
this.suffixField = null;
|
2013-10-30 14:46:03 -07:00
|
|
|
var options = this.menuGenerator_;
|
2018-08-22 15:29:43 -04:00
|
|
|
if (!goog.isArray(options)) {
|
2013-10-30 14:46:03 -07:00
|
|
|
return;
|
|
|
|
}
|
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 hasImages = false;
|
|
|
|
|
|
|
|
// Localize label text and image alt text.
|
|
|
|
for (var i = 0; i < options.length; i++) {
|
|
|
|
var label = options[i][0];
|
|
|
|
if (typeof label == 'string') {
|
|
|
|
options[i][0] = Blockly.utils.replaceMessageReferences(label);
|
|
|
|
} else {
|
|
|
|
if (label.alt != null) {
|
|
|
|
options[i][0].alt = Blockly.utils.replaceMessageReferences(label.alt);
|
|
|
|
}
|
|
|
|
hasImages = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (hasImages || options.length < 2) {
|
|
|
|
return; // Do nothing if too few items or at least one label is an image.
|
|
|
|
}
|
|
|
|
var strings = [];
|
|
|
|
for (var i = 0; i < options.length; i++) {
|
|
|
|
strings.push(options[i][0]);
|
|
|
|
}
|
2017-02-02 14:17:43 -05:00
|
|
|
var shortest = Blockly.utils.shortestStringLength(strings);
|
|
|
|
var prefixLength = Blockly.utils.commonWordPrefix(strings, shortest);
|
|
|
|
var suffixLength = Blockly.utils.commonWordSuffix(strings, shortest);
|
2013-10-30 14:46:03 -07:00
|
|
|
if (!prefixLength && !suffixLength) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (shortest <= prefixLength + suffixLength) {
|
|
|
|
// One or more strings will entirely vanish if we proceed. Abort.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (prefixLength) {
|
2013-12-20 16:25:26 -08:00
|
|
|
this.prefixField = strings[0].substring(0, prefixLength - 1);
|
2013-10-30 14:46:03 -07:00
|
|
|
}
|
|
|
|
if (suffixLength) {
|
2013-12-20 16:25:26 -08:00
|
|
|
this.suffixField = strings[0].substr(1 - suffixLength);
|
2013-10-30 14:46:03 -07:00
|
|
|
}
|
|
|
|
// Remove the prefix and suffix from the options.
|
|
|
|
var newOptions = [];
|
Adding indexing settings, tests and fixing bugs (#464)
* Add indexing setting for JavaScript Generation
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.
* Updating js lists to do zero and one based index
Updated generated JavaScript to change depending on whether one based indexing is enabled or not.
* Updating js text to do zero and one based index
Change so that JavaScript generated for text blocks either assumes blocks use zero or one based index based on setting.
* Start of python indexing
Start of work on allowing one and zero indexing for generated python for lists.
* Fixing bug and lint fixed
Fixing bug caused by not setting the return of concat when concatenating lines for sublist and substring functions. Also renamed these functions to be getSubsequece. Fixed lint errors with spacing
* Converting from if to switch statements
Comverting if statements to switch statements when appropriate and adding spacing.
* Modified sublist JavaScript generation
Added case so that helper function is not generated if not necessary. Helper function is not generated if list length is not needed or if list is a simple block (such as a variable, as oppossed to a function call or list create).
* Stripping unecessary ids
Removing ids from xml file.
* Localisation updates from https://translatewiki.net.
* Fix typo in flyout.js (#403)
* Fix typo in flyout.js (#402)
* Localisation updates from https://translatewiki.net.
* Add indexing setting for JavaScript Generation
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.
* Updating js lists to do zero and one based index
Updated generated JavaScript to change depending on whether one based indexing is enabled or not.
* Updating js text to do zero and one based index
Change so that JavaScript generated for text blocks either assumes blocks use zero or one based index based on setting.
* Fixing bug and lint fixed
Fixing bug caused by not setting the return of concat when concatenating lines for sublist and substring functions. Also renamed these functions to be getSubsequece. Fixed lint errors with spacing
* Converting from if to switch statements
Comverting if statements to switch statements when appropriate and adding spacing.
* Modified sublist JavaScript generation
Added case so that helper function is not generated if not necessary. Helper function is not generated if list length is not needed or if list is a simple block (such as a variable, as oppossed to a function call or list create).
* Stripping unecessary ids
Removing ids from xml file.
* Updating generator test
Modifying sublist test and re-formatting spacing between blocks.
* Updating js lists to do zero and one based index
Updated generated JavaScript to change depending on whether one based indexing is enabled or not.
* Updating js text to do zero and one based index
Change so that JavaScript generated for text blocks either assumes blocks use zero or one based index based on setting.
* Fixing bug and lint fixed
Fixing bug caused by not setting the return of concat when concatenating lines for sublist and substring functions. Also renamed these functions to be getSubsequece. Fixed lint errors with spacing
* Converting from if to switch statements
Comverting if statements to switch statements when appropriate and adding spacing.
* Modified sublist JavaScript generation
Added case so that helper function is not generated if not necessary. Helper function is not generated if list length is not needed or if list is a simple block (such as a variable, as oppossed to a function call or list create).
* Stripping unecessary ids
Removing ids from xml file.
* Localisation updates from https://translatewiki.net.
* Localisation updates from https://translatewiki.net.
* Updating js lists to do zero and one based index
Updated generated JavaScript to change depending on whether one based indexing is enabled or not.
* Fixing bug and lint fixed
Fixing bug caused by not setting the return of concat when concatenating lines for sublist and substring functions. Also renamed these functions to be getSubsequece. Fixed lint errors with spacing
* Modified sublist JavaScript generation
Added case so that helper function is not generated if not necessary. Helper function is not generated if list length is not needed or if list is a simple block (such as a variable, as oppossed to a function call or list create).
* Stripping unecessary ids
Removing ids from xml file.
* Updating generator test
Modifying sublist test and re-formatting spacing between blocks.
* Adding tests for indexing and extra cases
Adding tests for indexing with custom block to adjust number based on what indexing is being generated.
* Adding tests and renaming tests
Adding tests for sublist and renaming tests.
* Fixes for order for sublists
Fixes so that parenthesis are generated properly for index for sublist
* Cleaning up test generated code
Changing order returned for unit test adjust index function to generate less unecessary parenthesis.
* Adding tests for order
Adding tests for order, relevant for methods that use index from start (because 1 is added)
* Fixing JS order for getIndex and setIndex
Changing to the correct order type when calling valueToCode in JS generation for getIndex and setIndex.
* Fixed unittest adjustIndex
Fixed uninttest adjustindex to also check whether the ONE_BASED_INDEXING variable has been defined to ensure proper behaviour.
* Fixing lint and formatting for JS/lists
Making line fixes and changing an if/elseif to case statement.
* Tests added to include case for bug found
Added tests with sublist combinations of different where's for the two indices after bug for this found in python.
* Adding and renaming tests
Adding test case for creating a sublist that encompasses the whole list but uses # and #-end instead of first last (applicable for python). Also, renaming tests.
* Adding contant and fixing python lists bugs
Adding contant for ONE_BASED_INDEXING and fixing bugs in python for lists.
* Fixing test get random
Fixing test get random to take into account indexing for return value.
* Adding indexing checkbox to test page
Adding checkbos on test page so that code can be generated for one and zero based indexing. Languages that are generated with zero based indexing that do not have it implemented will fail tests as expected.
* Fixing unittest getremove random
Fixing unittest getremove random to take into account the return value based on indexing.
* Change comparison for getremove random test
Fixed comparison to equal for the return value for getremove random.
* Fixing bugs with lists zero-indexing
Fixing getIndex and getSublist methods to pass for zero-indexed tests.
* Adding test cases and formatting
Adding test cases to text tests, reordering a couple list test, and formatting block spacing.
* Fixing unittest expected value
Fixing expected value fore unit tests for sublist.
* Cleanup
Removing obvious comments, formatting fixes, and naming in generated code in JS.
* Helper function for Python lists
Adding helper function for casting to int for indices.
* Expanding helper to reduce duplicated code
Expanding helper method to also get the property with the correct order and check indexing to reduce duplicated code.
* Cleaning up JS indexing with helper function
Adding helper function for indexing and used it in lists and text.
* Moving helper function and formatting fixes
Moving helper function, formatting fixes, and changing some generated code variable names.
* Fixing python generation for text
Fixing all failinng tests for python and using new helper method.
* Lint fixes and order in indexOf
Making lint fixes and correcting returned order in indexOf.
* Python variable renaming
Renaming a few generated variables.
* Fixing comment and order
Fixing comment to list Blockly.Block type and fixing order because it could be higher.
* Switching back to if
Switching switch back to if statements because there weren't enough cases to warrant for a switch.
* Adding order and fixing lists for Dart
Adding if null operator to operator precedence for Dart. Also, fixing lists implementation to pass unit tests and adding zero-indexing functionality.
* Formatting and lint fixes
Formatting and lint fixes
* Dart text fixed
Fixing Dart text generation to pass unit tests.
* Changing back to variable
Changing switch condition back to variable.
* Fixing ORDER_OVERRIDES
Inner and outer order was switched .
* Adding bug with order caused by generator change
Flooring order before comparision because of how the order constants were modified.
* Adding list tests
Adding tests for additional cases for lists/
* Adding comment for dart order
Adding comment for Dart ORDER_IF_NULL operator.
* Formatting fixes
Formatting fixes for line indentation.
* Fixing PHP order and lists generation
Fixing PHP order constants and fixing lists so that they pass unit tests.
* Fixing tests
Removing duplicate unit test
* Adding text tests
Adding tests for text.
* Renaming variable and removing unused variable
Renaming variables from exceptionIndex to errorIndex and removing unused at variable.
* Adding missing function call to test
Adding missing funciton call to test that was causing tests to fail when they shouldn't.
* Fixing PHP text generation
Fixing PHP text code generation so it passes unit tests.
* Formatting fixes
Cleaning up code, renamiing a variable.
* Fixing failing subsequence tests
Fixing JS code that failed for sublist/substring tests.
* Fixing intentation
Fixing indentation.
* Fixing Dart sublist/substring
Fixing sublist/substring to include condiiton where FROM_START (and not throw error by mistake) when zero-indexed.
* Adding order subtraction test
Adding test for checking order for subtraction x- (y - z) x - (y + z).
* Updating to new PHP power operator
Updating from pow function to ** operator to clean up code.
* Updating to new removeWhere
Updating removeMatching to removeWhere because new version of Dart now use removeWhere.
* Fix for lua rounding assertequals
Adding check for number in equlity check for comparing number for floats.
* Adding test for copy of list
Adding test that checks the list is copied when a sublist is made first-last.
* Formatting and order fixes
Fixing formatting such as indentation and order fixes.
* Adding comment for clarity
Adding comment about how Lua code generation is not supporting zero indexing.
* Changed variable names in code
Changed variable names to follow style guide and changed for loop variable from n to i as is typical.
* Reducing unecessarily generated functions and renaming variables
Reducing number of generated functions using gensym_ by adding parameters to provided function. Renaming variables to make functions more readble.
* Fixing sublist order and sort variable
Fixing order used for valueToCode for sublist and renaming list variable in sort to match rest of code..
* Fixing order constant order
Removing operator () that was incorrect and addiung ~,
* Fixing order and indentation
Fixing order return fro create lists blocks and fixing indentationn for string array.
* Fixing order and renaming variables
Fixing order to be the correct strength and renaming variables to be more readable/
* Changing assert blocks for unit tests
Changing assert blocks to have a value input instead of a field so there is more flexibility in writing tests.
* Cleaning up and adding missing order tests
Adding tests for order for paramters for list blocks that weren't being tested to uncover bugs. Test were also cleaned up/reorganized/renamed to be more readable and shorter vertically (but lines wider horizontally).
* Compile error fix and order in Dart generation.
Fixing compile error in generated code and incorrect order in get sublist for Dart.
* Fixing typo in getIndex and invalid parameter name
Fixing type in getIndex where list code should have been appended but instead an undefined variable was added. The parameter in lists_sort was changed to my_list because list is a reserved word in python.
* Fixing order, parenthesis bug, and variable declaration in Lua
Fixing incorrect order in Lua. Fixing bug caused by missing parenthesis around ternary operator in code. Variable code was declared with JavaScript syntax, this was fixed to be valid in Lua.
* Adding tests and formatting tests
Adding missing test for order in text/lists. Changing spacing/order of tests and updating comments.
* Fixing error in code
Changing to correct function call in empy tests and changing test name that was duplicated to be more clear.
* Renamed test helper function
* Fixing order and renaming variable in JS generator
Fixing order for charAt and renaming variable in code list_sort from listCode to list to be consistent with rest of code.
* Fixing order for dart text
Fixing roder for dart charAt
* Cleaning up generated code for Dart getIndex
Cleaning up generated code for Dart getIndex so that helper functions aren't generated unecessarily and adding comments.
* Fixing Dart remove random error
Fixing error caused by remove random implementation in Dart. index should have been x but instead was length - x.
* Fixing unit test blocks
Fixing Lua unit test block that should have just returned the number and removing unecessary checks in other blocks because the constant was defined.
* Fixing Lua assert equals block
string.format was throwing an error if one of the values happened to be a boolean.
* Adding tests for create text with number
Adding test for create text with numbers as parameters
* Fixing lua unit test block
Lua unit test block should have added 1
* Removing indexing setting for Lua tests
Removing setting index setting for Lua generation because it is always one-indexed.
* Fixing order and create text
Fixing failing test caused by improper order and fixed create text to properly convert to string when there is one element.
* Running linter on generator code
Running linter on generator code and fixing spacing/indentation problems.
* Editing comments and removing uneeded parenthesis
Editing and adding comments and removing uneeded parenthesis around ternary operator condition.
* Fixing order and changing variable names
Fixing orders that were incorrect and changing variable names to be more descriptive and consistent across code.
* Adding comment about list support and fixes for PHP
Adding comment about how lists are not fully supported for PHP. Adding missing order to PHP and fixing order errors throughout. Fixing regex for variable matching in lists. Cleaning up variable names to be more readable and consistent with other parts of code.
* Reducing complexity for getremove/remove in JS
Reducing complexity in generated code for getremove/remove in JavaScript by replacing unecessary helper function.
* Fixing spacing before inline comments
Ensuring there are two spaces before inline comments.
* Changing JS list copy for clarity
Changing JavaScript list copy to use slice(0) instead of concat for clarity and to use the same pattern as the other sublist methods.
* Changing generated variable name tmp_x
Changing tmp_x to tmpX to follow closer to the correct style for JavaScript.
* Prefixing empy lines between comment text
Prior to this change, comments with an empty line between text did not have a comment prefix before it, resulting in comment blocks that seemed disjoined although they were for the same block. This change affects how the prefix line function works so that those lines will have the prefix (if applicable) while still taking into account the trailing newline character.
* Changing for loops variable names
Changing most for loops to use i as the variable name (or j if applicable) or changing name to be more readable.
* Simplifying provided subsequence function
Simplifying subsequence function to generate a simpler function depending on where combination instead of a larger complex function that works for all where combinations.
* Style fixes
Fixing indentation, comments, and other formatting-type changes based on pull request comments.
* Fixing indentation
Fixing indentation and removing an extra newline.
* Fixing PHP mode implementation
Fixing PHP mode implementation to properlyu return multiple modes if applicable.
* Fixing line too long
Wrapping lines in php/math.js with lines longer than 80 characters.
* Wrapping long lines
Wrapping lines that are too long.
* Changing boolean casing
Changing boolean casing to be lowercase.
2016-07-08 11:43:48 -07:00
|
|
|
for (var i = 0; i < options.length; i++) {
|
|
|
|
var text = options[i][0];
|
|
|
|
var value = options[i][1];
|
2013-10-30 14:46:03 -07:00
|
|
|
text = text.substring(prefixLength, text.length - suffixLength);
|
Adding indexing settings, tests and fixing bugs (#464)
* Add indexing setting for JavaScript Generation
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.
* Updating js lists to do zero and one based index
Updated generated JavaScript to change depending on whether one based indexing is enabled or not.
* Updating js text to do zero and one based index
Change so that JavaScript generated for text blocks either assumes blocks use zero or one based index based on setting.
* Start of python indexing
Start of work on allowing one and zero indexing for generated python for lists.
* Fixing bug and lint fixed
Fixing bug caused by not setting the return of concat when concatenating lines for sublist and substring functions. Also renamed these functions to be getSubsequece. Fixed lint errors with spacing
* Converting from if to switch statements
Comverting if statements to switch statements when appropriate and adding spacing.
* Modified sublist JavaScript generation
Added case so that helper function is not generated if not necessary. Helper function is not generated if list length is not needed or if list is a simple block (such as a variable, as oppossed to a function call or list create).
* Stripping unecessary ids
Removing ids from xml file.
* Localisation updates from https://translatewiki.net.
* Fix typo in flyout.js (#403)
* Fix typo in flyout.js (#402)
* Localisation updates from https://translatewiki.net.
* Add indexing setting for JavaScript Generation
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.
* Updating js lists to do zero and one based index
Updated generated JavaScript to change depending on whether one based indexing is enabled or not.
* Updating js text to do zero and one based index
Change so that JavaScript generated for text blocks either assumes blocks use zero or one based index based on setting.
* Fixing bug and lint fixed
Fixing bug caused by not setting the return of concat when concatenating lines for sublist and substring functions. Also renamed these functions to be getSubsequece. Fixed lint errors with spacing
* Converting from if to switch statements
Comverting if statements to switch statements when appropriate and adding spacing.
* Modified sublist JavaScript generation
Added case so that helper function is not generated if not necessary. Helper function is not generated if list length is not needed or if list is a simple block (such as a variable, as oppossed to a function call or list create).
* Stripping unecessary ids
Removing ids from xml file.
* Updating generator test
Modifying sublist test and re-formatting spacing between blocks.
* Updating js lists to do zero and one based index
Updated generated JavaScript to change depending on whether one based indexing is enabled or not.
* Updating js text to do zero and one based index
Change so that JavaScript generated for text blocks either assumes blocks use zero or one based index based on setting.
* Fixing bug and lint fixed
Fixing bug caused by not setting the return of concat when concatenating lines for sublist and substring functions. Also renamed these functions to be getSubsequece. Fixed lint errors with spacing
* Converting from if to switch statements
Comverting if statements to switch statements when appropriate and adding spacing.
* Modified sublist JavaScript generation
Added case so that helper function is not generated if not necessary. Helper function is not generated if list length is not needed or if list is a simple block (such as a variable, as oppossed to a function call or list create).
* Stripping unecessary ids
Removing ids from xml file.
* Localisation updates from https://translatewiki.net.
* Localisation updates from https://translatewiki.net.
* Updating js lists to do zero and one based index
Updated generated JavaScript to change depending on whether one based indexing is enabled or not.
* Fixing bug and lint fixed
Fixing bug caused by not setting the return of concat when concatenating lines for sublist and substring functions. Also renamed these functions to be getSubsequece. Fixed lint errors with spacing
* Modified sublist JavaScript generation
Added case so that helper function is not generated if not necessary. Helper function is not generated if list length is not needed or if list is a simple block (such as a variable, as oppossed to a function call or list create).
* Stripping unecessary ids
Removing ids from xml file.
* Updating generator test
Modifying sublist test and re-formatting spacing between blocks.
* Adding tests for indexing and extra cases
Adding tests for indexing with custom block to adjust number based on what indexing is being generated.
* Adding tests and renaming tests
Adding tests for sublist and renaming tests.
* Fixes for order for sublists
Fixes so that parenthesis are generated properly for index for sublist
* Cleaning up test generated code
Changing order returned for unit test adjust index function to generate less unecessary parenthesis.
* Adding tests for order
Adding tests for order, relevant for methods that use index from start (because 1 is added)
* Fixing JS order for getIndex and setIndex
Changing to the correct order type when calling valueToCode in JS generation for getIndex and setIndex.
* Fixed unittest adjustIndex
Fixed uninttest adjustindex to also check whether the ONE_BASED_INDEXING variable has been defined to ensure proper behaviour.
* Fixing lint and formatting for JS/lists
Making line fixes and changing an if/elseif to case statement.
* Tests added to include case for bug found
Added tests with sublist combinations of different where's for the two indices after bug for this found in python.
* Adding and renaming tests
Adding test case for creating a sublist that encompasses the whole list but uses # and #-end instead of first last (applicable for python). Also, renaming tests.
* Adding contant and fixing python lists bugs
Adding contant for ONE_BASED_INDEXING and fixing bugs in python for lists.
* Fixing test get random
Fixing test get random to take into account indexing for return value.
* Adding indexing checkbox to test page
Adding checkbos on test page so that code can be generated for one and zero based indexing. Languages that are generated with zero based indexing that do not have it implemented will fail tests as expected.
* Fixing unittest getremove random
Fixing unittest getremove random to take into account the return value based on indexing.
* Change comparison for getremove random test
Fixed comparison to equal for the return value for getremove random.
* Fixing bugs with lists zero-indexing
Fixing getIndex and getSublist methods to pass for zero-indexed tests.
* Adding test cases and formatting
Adding test cases to text tests, reordering a couple list test, and formatting block spacing.
* Fixing unittest expected value
Fixing expected value fore unit tests for sublist.
* Cleanup
Removing obvious comments, formatting fixes, and naming in generated code in JS.
* Helper function for Python lists
Adding helper function for casting to int for indices.
* Expanding helper to reduce duplicated code
Expanding helper method to also get the property with the correct order and check indexing to reduce duplicated code.
* Cleaning up JS indexing with helper function
Adding helper function for indexing and used it in lists and text.
* Moving helper function and formatting fixes
Moving helper function, formatting fixes, and changing some generated code variable names.
* Fixing python generation for text
Fixing all failinng tests for python and using new helper method.
* Lint fixes and order in indexOf
Making lint fixes and correcting returned order in indexOf.
* Python variable renaming
Renaming a few generated variables.
* Fixing comment and order
Fixing comment to list Blockly.Block type and fixing order because it could be higher.
* Switching back to if
Switching switch back to if statements because there weren't enough cases to warrant for a switch.
* Adding order and fixing lists for Dart
Adding if null operator to operator precedence for Dart. Also, fixing lists implementation to pass unit tests and adding zero-indexing functionality.
* Formatting and lint fixes
Formatting and lint fixes
* Dart text fixed
Fixing Dart text generation to pass unit tests.
* Changing back to variable
Changing switch condition back to variable.
* Fixing ORDER_OVERRIDES
Inner and outer order was switched .
* Adding bug with order caused by generator change
Flooring order before comparision because of how the order constants were modified.
* Adding list tests
Adding tests for additional cases for lists/
* Adding comment for dart order
Adding comment for Dart ORDER_IF_NULL operator.
* Formatting fixes
Formatting fixes for line indentation.
* Fixing PHP order and lists generation
Fixing PHP order constants and fixing lists so that they pass unit tests.
* Fixing tests
Removing duplicate unit test
* Adding text tests
Adding tests for text.
* Renaming variable and removing unused variable
Renaming variables from exceptionIndex to errorIndex and removing unused at variable.
* Adding missing function call to test
Adding missing funciton call to test that was causing tests to fail when they shouldn't.
* Fixing PHP text generation
Fixing PHP text code generation so it passes unit tests.
* Formatting fixes
Cleaning up code, renamiing a variable.
* Fixing failing subsequence tests
Fixing JS code that failed for sublist/substring tests.
* Fixing intentation
Fixing indentation.
* Fixing Dart sublist/substring
Fixing sublist/substring to include condiiton where FROM_START (and not throw error by mistake) when zero-indexed.
* Adding order subtraction test
Adding test for checking order for subtraction x- (y - z) x - (y + z).
* Updating to new PHP power operator
Updating from pow function to ** operator to clean up code.
* Updating to new removeWhere
Updating removeMatching to removeWhere because new version of Dart now use removeWhere.
* Fix for lua rounding assertequals
Adding check for number in equlity check for comparing number for floats.
* Adding test for copy of list
Adding test that checks the list is copied when a sublist is made first-last.
* Formatting and order fixes
Fixing formatting such as indentation and order fixes.
* Adding comment for clarity
Adding comment about how Lua code generation is not supporting zero indexing.
* Changed variable names in code
Changed variable names to follow style guide and changed for loop variable from n to i as is typical.
* Reducing unecessarily generated functions and renaming variables
Reducing number of generated functions using gensym_ by adding parameters to provided function. Renaming variables to make functions more readble.
* Fixing sublist order and sort variable
Fixing order used for valueToCode for sublist and renaming list variable in sort to match rest of code..
* Fixing order constant order
Removing operator () that was incorrect and addiung ~,
* Fixing order and indentation
Fixing order return fro create lists blocks and fixing indentationn for string array.
* Fixing order and renaming variables
Fixing order to be the correct strength and renaming variables to be more readable/
* Changing assert blocks for unit tests
Changing assert blocks to have a value input instead of a field so there is more flexibility in writing tests.
* Cleaning up and adding missing order tests
Adding tests for order for paramters for list blocks that weren't being tested to uncover bugs. Test were also cleaned up/reorganized/renamed to be more readable and shorter vertically (but lines wider horizontally).
* Compile error fix and order in Dart generation.
Fixing compile error in generated code and incorrect order in get sublist for Dart.
* Fixing typo in getIndex and invalid parameter name
Fixing type in getIndex where list code should have been appended but instead an undefined variable was added. The parameter in lists_sort was changed to my_list because list is a reserved word in python.
* Fixing order, parenthesis bug, and variable declaration in Lua
Fixing incorrect order in Lua. Fixing bug caused by missing parenthesis around ternary operator in code. Variable code was declared with JavaScript syntax, this was fixed to be valid in Lua.
* Adding tests and formatting tests
Adding missing test for order in text/lists. Changing spacing/order of tests and updating comments.
* Fixing error in code
Changing to correct function call in empy tests and changing test name that was duplicated to be more clear.
* Renamed test helper function
* Fixing order and renaming variable in JS generator
Fixing order for charAt and renaming variable in code list_sort from listCode to list to be consistent with rest of code.
* Fixing order for dart text
Fixing roder for dart charAt
* Cleaning up generated code for Dart getIndex
Cleaning up generated code for Dart getIndex so that helper functions aren't generated unecessarily and adding comments.
* Fixing Dart remove random error
Fixing error caused by remove random implementation in Dart. index should have been x but instead was length - x.
* Fixing unit test blocks
Fixing Lua unit test block that should have just returned the number and removing unecessary checks in other blocks because the constant was defined.
* Fixing Lua assert equals block
string.format was throwing an error if one of the values happened to be a boolean.
* Adding tests for create text with number
Adding test for create text with numbers as parameters
* Fixing lua unit test block
Lua unit test block should have added 1
* Removing indexing setting for Lua tests
Removing setting index setting for Lua generation because it is always one-indexed.
* Fixing order and create text
Fixing failing test caused by improper order and fixed create text to properly convert to string when there is one element.
* Running linter on generator code
Running linter on generator code and fixing spacing/indentation problems.
* Editing comments and removing uneeded parenthesis
Editing and adding comments and removing uneeded parenthesis around ternary operator condition.
* Fixing order and changing variable names
Fixing orders that were incorrect and changing variable names to be more descriptive and consistent across code.
* Adding comment about list support and fixes for PHP
Adding comment about how lists are not fully supported for PHP. Adding missing order to PHP and fixing order errors throughout. Fixing regex for variable matching in lists. Cleaning up variable names to be more readable and consistent with other parts of code.
* Reducing complexity for getremove/remove in JS
Reducing complexity in generated code for getremove/remove in JavaScript by replacing unecessary helper function.
* Fixing spacing before inline comments
Ensuring there are two spaces before inline comments.
* Changing JS list copy for clarity
Changing JavaScript list copy to use slice(0) instead of concat for clarity and to use the same pattern as the other sublist methods.
* Changing generated variable name tmp_x
Changing tmp_x to tmpX to follow closer to the correct style for JavaScript.
* Prefixing empy lines between comment text
Prior to this change, comments with an empty line between text did not have a comment prefix before it, resulting in comment blocks that seemed disjoined although they were for the same block. This change affects how the prefix line function works so that those lines will have the prefix (if applicable) while still taking into account the trailing newline character.
* Changing for loops variable names
Changing most for loops to use i as the variable name (or j if applicable) or changing name to be more readable.
* Simplifying provided subsequence function
Simplifying subsequence function to generate a simpler function depending on where combination instead of a larger complex function that works for all where combinations.
* Style fixes
Fixing indentation, comments, and other formatting-type changes based on pull request comments.
* Fixing indentation
Fixing indentation and removing an extra newline.
* Fixing PHP mode implementation
Fixing PHP mode implementation to properlyu return multiple modes if applicable.
* Fixing line too long
Wrapping lines in php/math.js with lines longer than 80 characters.
* Wrapping long lines
Wrapping lines that are too long.
* Changing boolean casing
Changing boolean casing to be lowercase.
2016-07-08 11:43:48 -07:00
|
|
|
newOptions[i] = [text, value];
|
2013-10-30 14:46:03 -07:00
|
|
|
}
|
|
|
|
this.menuGenerator_ = newOptions;
|
|
|
|
};
|
|
|
|
|
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
|
|
|
/**
|
2018-04-30 15:42:02 -07:00
|
|
|
* @return {boolean} True if the option list is generated by a function.
|
|
|
|
* Otherwise false.
|
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.FieldDropdown.prototype.isOptionListDynamic = function() {
|
2018-08-22 15:29:43 -04:00
|
|
|
return goog.isFunction(this.menuGenerator_);
|
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
|
|
|
};
|
|
|
|
|
2013-10-30 14:46:03 -07:00
|
|
|
/**
|
|
|
|
* Return a list of the options for this dropdown.
|
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 {!Array.<!Array>} Array of option tuples:
|
|
|
|
* (human-readable text or image, language-neutral name).
|
2013-10-30 14:46:03 -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
|
|
|
Blockly.FieldDropdown.prototype.getOptions = function() {
|
2013-10-30 14:46:03 -07:00
|
|
|
if (goog.isFunction(this.menuGenerator_)) {
|
|
|
|
return this.menuGenerator_.call(this);
|
|
|
|
}
|
|
|
|
return /** @type {!Array.<!Array.<string>>} */ (this.menuGenerator_);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the language-neutral value from this dropdown menu.
|
|
|
|
* @return {string} Current text.
|
|
|
|
*/
|
|
|
|
Blockly.FieldDropdown.prototype.getValue = function() {
|
|
|
|
return this.value_;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the language-neutral value for this dropdown menu.
|
|
|
|
* @param {string} newValue New value to set.
|
|
|
|
*/
|
|
|
|
Blockly.FieldDropdown.prototype.setValue = function(newValue) {
|
2016-01-15 15:36:06 -08:00
|
|
|
if (newValue === null || newValue === this.value_) {
|
|
|
|
return; // No change if null.
|
|
|
|
}
|
2016-01-20 19:11:03 -08:00
|
|
|
if (this.sourceBlock_ && Blockly.Events.isEnabled()) {
|
2017-06-22 10:38:20 -04:00
|
|
|
Blockly.Events.fire(new Blockly.Events.BlockChange(
|
2016-01-20 19:11:03 -08:00
|
|
|
this.sourceBlock_, 'field', this.name, this.value_, newValue));
|
|
|
|
}
|
2016-09-28 16:42:42 -04:00
|
|
|
// Clear menu item for old value.
|
|
|
|
if (this.selectedItem) {
|
|
|
|
this.selectedItem.setChecked(false);
|
|
|
|
this.selectedItem = null;
|
|
|
|
}
|
2013-10-30 14:46:03 -07:00
|
|
|
this.value_ = newValue;
|
|
|
|
// Look up and display the human-readable text.
|
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 options = this.getOptions();
|
Adding indexing settings, tests and fixing bugs (#464)
* Add indexing setting for JavaScript Generation
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.
* Updating js lists to do zero and one based index
Updated generated JavaScript to change depending on whether one based indexing is enabled or not.
* Updating js text to do zero and one based index
Change so that JavaScript generated for text blocks either assumes blocks use zero or one based index based on setting.
* Start of python indexing
Start of work on allowing one and zero indexing for generated python for lists.
* Fixing bug and lint fixed
Fixing bug caused by not setting the return of concat when concatenating lines for sublist and substring functions. Also renamed these functions to be getSubsequece. Fixed lint errors with spacing
* Converting from if to switch statements
Comverting if statements to switch statements when appropriate and adding spacing.
* Modified sublist JavaScript generation
Added case so that helper function is not generated if not necessary. Helper function is not generated if list length is not needed or if list is a simple block (such as a variable, as oppossed to a function call or list create).
* Stripping unecessary ids
Removing ids from xml file.
* Localisation updates from https://translatewiki.net.
* Fix typo in flyout.js (#403)
* Fix typo in flyout.js (#402)
* Localisation updates from https://translatewiki.net.
* Add indexing setting for JavaScript Generation
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.
* Updating js lists to do zero and one based index
Updated generated JavaScript to change depending on whether one based indexing is enabled or not.
* Updating js text to do zero and one based index
Change so that JavaScript generated for text blocks either assumes blocks use zero or one based index based on setting.
* Fixing bug and lint fixed
Fixing bug caused by not setting the return of concat when concatenating lines for sublist and substring functions. Also renamed these functions to be getSubsequece. Fixed lint errors with spacing
* Converting from if to switch statements
Comverting if statements to switch statements when appropriate and adding spacing.
* Modified sublist JavaScript generation
Added case so that helper function is not generated if not necessary. Helper function is not generated if list length is not needed or if list is a simple block (such as a variable, as oppossed to a function call or list create).
* Stripping unecessary ids
Removing ids from xml file.
* Updating generator test
Modifying sublist test and re-formatting spacing between blocks.
* Updating js lists to do zero and one based index
Updated generated JavaScript to change depending on whether one based indexing is enabled or not.
* Updating js text to do zero and one based index
Change so that JavaScript generated for text blocks either assumes blocks use zero or one based index based on setting.
* Fixing bug and lint fixed
Fixing bug caused by not setting the return of concat when concatenating lines for sublist and substring functions. Also renamed these functions to be getSubsequece. Fixed lint errors with spacing
* Converting from if to switch statements
Comverting if statements to switch statements when appropriate and adding spacing.
* Modified sublist JavaScript generation
Added case so that helper function is not generated if not necessary. Helper function is not generated if list length is not needed or if list is a simple block (such as a variable, as oppossed to a function call or list create).
* Stripping unecessary ids
Removing ids from xml file.
* Localisation updates from https://translatewiki.net.
* Localisation updates from https://translatewiki.net.
* Updating js lists to do zero and one based index
Updated generated JavaScript to change depending on whether one based indexing is enabled or not.
* Fixing bug and lint fixed
Fixing bug caused by not setting the return of concat when concatenating lines for sublist and substring functions. Also renamed these functions to be getSubsequece. Fixed lint errors with spacing
* Modified sublist JavaScript generation
Added case so that helper function is not generated if not necessary. Helper function is not generated if list length is not needed or if list is a simple block (such as a variable, as oppossed to a function call or list create).
* Stripping unecessary ids
Removing ids from xml file.
* Updating generator test
Modifying sublist test and re-formatting spacing between blocks.
* Adding tests for indexing and extra cases
Adding tests for indexing with custom block to adjust number based on what indexing is being generated.
* Adding tests and renaming tests
Adding tests for sublist and renaming tests.
* Fixes for order for sublists
Fixes so that parenthesis are generated properly for index for sublist
* Cleaning up test generated code
Changing order returned for unit test adjust index function to generate less unecessary parenthesis.
* Adding tests for order
Adding tests for order, relevant for methods that use index from start (because 1 is added)
* Fixing JS order for getIndex and setIndex
Changing to the correct order type when calling valueToCode in JS generation for getIndex and setIndex.
* Fixed unittest adjustIndex
Fixed uninttest adjustindex to also check whether the ONE_BASED_INDEXING variable has been defined to ensure proper behaviour.
* Fixing lint and formatting for JS/lists
Making line fixes and changing an if/elseif to case statement.
* Tests added to include case for bug found
Added tests with sublist combinations of different where's for the two indices after bug for this found in python.
* Adding and renaming tests
Adding test case for creating a sublist that encompasses the whole list but uses # and #-end instead of first last (applicable for python). Also, renaming tests.
* Adding contant and fixing python lists bugs
Adding contant for ONE_BASED_INDEXING and fixing bugs in python for lists.
* Fixing test get random
Fixing test get random to take into account indexing for return value.
* Adding indexing checkbox to test page
Adding checkbos on test page so that code can be generated for one and zero based indexing. Languages that are generated with zero based indexing that do not have it implemented will fail tests as expected.
* Fixing unittest getremove random
Fixing unittest getremove random to take into account the return value based on indexing.
* Change comparison for getremove random test
Fixed comparison to equal for the return value for getremove random.
* Fixing bugs with lists zero-indexing
Fixing getIndex and getSublist methods to pass for zero-indexed tests.
* Adding test cases and formatting
Adding test cases to text tests, reordering a couple list test, and formatting block spacing.
* Fixing unittest expected value
Fixing expected value fore unit tests for sublist.
* Cleanup
Removing obvious comments, formatting fixes, and naming in generated code in JS.
* Helper function for Python lists
Adding helper function for casting to int for indices.
* Expanding helper to reduce duplicated code
Expanding helper method to also get the property with the correct order and check indexing to reduce duplicated code.
* Cleaning up JS indexing with helper function
Adding helper function for indexing and used it in lists and text.
* Moving helper function and formatting fixes
Moving helper function, formatting fixes, and changing some generated code variable names.
* Fixing python generation for text
Fixing all failinng tests for python and using new helper method.
* Lint fixes and order in indexOf
Making lint fixes and correcting returned order in indexOf.
* Python variable renaming
Renaming a few generated variables.
* Fixing comment and order
Fixing comment to list Blockly.Block type and fixing order because it could be higher.
* Switching back to if
Switching switch back to if statements because there weren't enough cases to warrant for a switch.
* Adding order and fixing lists for Dart
Adding if null operator to operator precedence for Dart. Also, fixing lists implementation to pass unit tests and adding zero-indexing functionality.
* Formatting and lint fixes
Formatting and lint fixes
* Dart text fixed
Fixing Dart text generation to pass unit tests.
* Changing back to variable
Changing switch condition back to variable.
* Fixing ORDER_OVERRIDES
Inner and outer order was switched .
* Adding bug with order caused by generator change
Flooring order before comparision because of how the order constants were modified.
* Adding list tests
Adding tests for additional cases for lists/
* Adding comment for dart order
Adding comment for Dart ORDER_IF_NULL operator.
* Formatting fixes
Formatting fixes for line indentation.
* Fixing PHP order and lists generation
Fixing PHP order constants and fixing lists so that they pass unit tests.
* Fixing tests
Removing duplicate unit test
* Adding text tests
Adding tests for text.
* Renaming variable and removing unused variable
Renaming variables from exceptionIndex to errorIndex and removing unused at variable.
* Adding missing function call to test
Adding missing funciton call to test that was causing tests to fail when they shouldn't.
* Fixing PHP text generation
Fixing PHP text code generation so it passes unit tests.
* Formatting fixes
Cleaning up code, renamiing a variable.
* Fixing failing subsequence tests
Fixing JS code that failed for sublist/substring tests.
* Fixing intentation
Fixing indentation.
* Fixing Dart sublist/substring
Fixing sublist/substring to include condiiton where FROM_START (and not throw error by mistake) when zero-indexed.
* Adding order subtraction test
Adding test for checking order for subtraction x- (y - z) x - (y + z).
* Updating to new PHP power operator
Updating from pow function to ** operator to clean up code.
* Updating to new removeWhere
Updating removeMatching to removeWhere because new version of Dart now use removeWhere.
* Fix for lua rounding assertequals
Adding check for number in equlity check for comparing number for floats.
* Adding test for copy of list
Adding test that checks the list is copied when a sublist is made first-last.
* Formatting and order fixes
Fixing formatting such as indentation and order fixes.
* Adding comment for clarity
Adding comment about how Lua code generation is not supporting zero indexing.
* Changed variable names in code
Changed variable names to follow style guide and changed for loop variable from n to i as is typical.
* Reducing unecessarily generated functions and renaming variables
Reducing number of generated functions using gensym_ by adding parameters to provided function. Renaming variables to make functions more readble.
* Fixing sublist order and sort variable
Fixing order used for valueToCode for sublist and renaming list variable in sort to match rest of code..
* Fixing order constant order
Removing operator () that was incorrect and addiung ~,
* Fixing order and indentation
Fixing order return fro create lists blocks and fixing indentationn for string array.
* Fixing order and renaming variables
Fixing order to be the correct strength and renaming variables to be more readable/
* Changing assert blocks for unit tests
Changing assert blocks to have a value input instead of a field so there is more flexibility in writing tests.
* Cleaning up and adding missing order tests
Adding tests for order for paramters for list blocks that weren't being tested to uncover bugs. Test were also cleaned up/reorganized/renamed to be more readable and shorter vertically (but lines wider horizontally).
* Compile error fix and order in Dart generation.
Fixing compile error in generated code and incorrect order in get sublist for Dart.
* Fixing typo in getIndex and invalid parameter name
Fixing type in getIndex where list code should have been appended but instead an undefined variable was added. The parameter in lists_sort was changed to my_list because list is a reserved word in python.
* Fixing order, parenthesis bug, and variable declaration in Lua
Fixing incorrect order in Lua. Fixing bug caused by missing parenthesis around ternary operator in code. Variable code was declared with JavaScript syntax, this was fixed to be valid in Lua.
* Adding tests and formatting tests
Adding missing test for order in text/lists. Changing spacing/order of tests and updating comments.
* Fixing error in code
Changing to correct function call in empy tests and changing test name that was duplicated to be more clear.
* Renamed test helper function
* Fixing order and renaming variable in JS generator
Fixing order for charAt and renaming variable in code list_sort from listCode to list to be consistent with rest of code.
* Fixing order for dart text
Fixing roder for dart charAt
* Cleaning up generated code for Dart getIndex
Cleaning up generated code for Dart getIndex so that helper functions aren't generated unecessarily and adding comments.
* Fixing Dart remove random error
Fixing error caused by remove random implementation in Dart. index should have been x but instead was length - x.
* Fixing unit test blocks
Fixing Lua unit test block that should have just returned the number and removing unecessary checks in other blocks because the constant was defined.
* Fixing Lua assert equals block
string.format was throwing an error if one of the values happened to be a boolean.
* Adding tests for create text with number
Adding test for create text with numbers as parameters
* Fixing lua unit test block
Lua unit test block should have added 1
* Removing indexing setting for Lua tests
Removing setting index setting for Lua generation because it is always one-indexed.
* Fixing order and create text
Fixing failing test caused by improper order and fixed create text to properly convert to string when there is one element.
* Running linter on generator code
Running linter on generator code and fixing spacing/indentation problems.
* Editing comments and removing uneeded parenthesis
Editing and adding comments and removing uneeded parenthesis around ternary operator condition.
* Fixing order and changing variable names
Fixing orders that were incorrect and changing variable names to be more descriptive and consistent across code.
* Adding comment about list support and fixes for PHP
Adding comment about how lists are not fully supported for PHP. Adding missing order to PHP and fixing order errors throughout. Fixing regex for variable matching in lists. Cleaning up variable names to be more readable and consistent with other parts of code.
* Reducing complexity for getremove/remove in JS
Reducing complexity in generated code for getremove/remove in JavaScript by replacing unecessary helper function.
* Fixing spacing before inline comments
Ensuring there are two spaces before inline comments.
* Changing JS list copy for clarity
Changing JavaScript list copy to use slice(0) instead of concat for clarity and to use the same pattern as the other sublist methods.
* Changing generated variable name tmp_x
Changing tmp_x to tmpX to follow closer to the correct style for JavaScript.
* Prefixing empy lines between comment text
Prior to this change, comments with an empty line between text did not have a comment prefix before it, resulting in comment blocks that seemed disjoined although they were for the same block. This change affects how the prefix line function works so that those lines will have the prefix (if applicable) while still taking into account the trailing newline character.
* Changing for loops variable names
Changing most for loops to use i as the variable name (or j if applicable) or changing name to be more readable.
* Simplifying provided subsequence function
Simplifying subsequence function to generate a simpler function depending on where combination instead of a larger complex function that works for all where combinations.
* Style fixes
Fixing indentation, comments, and other formatting-type changes based on pull request comments.
* Fixing indentation
Fixing indentation and removing an extra newline.
* Fixing PHP mode implementation
Fixing PHP mode implementation to properlyu return multiple modes if applicable.
* Fixing line too long
Wrapping lines in php/math.js with lines longer than 80 characters.
* Wrapping long lines
Wrapping lines that are too long.
* Changing boolean casing
Changing boolean casing to be lowercase.
2016-07-08 11:43:48 -07:00
|
|
|
for (var i = 0; i < options.length; i++) {
|
2013-10-30 14:46:03 -07:00
|
|
|
// Options are tuples of human-readable text and language-neutral values.
|
Adding indexing settings, tests and fixing bugs (#464)
* Add indexing setting for JavaScript Generation
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.
* Updating js lists to do zero and one based index
Updated generated JavaScript to change depending on whether one based indexing is enabled or not.
* Updating js text to do zero and one based index
Change so that JavaScript generated for text blocks either assumes blocks use zero or one based index based on setting.
* Start of python indexing
Start of work on allowing one and zero indexing for generated python for lists.
* Fixing bug and lint fixed
Fixing bug caused by not setting the return of concat when concatenating lines for sublist and substring functions. Also renamed these functions to be getSubsequece. Fixed lint errors with spacing
* Converting from if to switch statements
Comverting if statements to switch statements when appropriate and adding spacing.
* Modified sublist JavaScript generation
Added case so that helper function is not generated if not necessary. Helper function is not generated if list length is not needed or if list is a simple block (such as a variable, as oppossed to a function call or list create).
* Stripping unecessary ids
Removing ids from xml file.
* Localisation updates from https://translatewiki.net.
* Fix typo in flyout.js (#403)
* Fix typo in flyout.js (#402)
* Localisation updates from https://translatewiki.net.
* Add indexing setting for JavaScript Generation
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.
* Updating js lists to do zero and one based index
Updated generated JavaScript to change depending on whether one based indexing is enabled or not.
* Updating js text to do zero and one based index
Change so that JavaScript generated for text blocks either assumes blocks use zero or one based index based on setting.
* Fixing bug and lint fixed
Fixing bug caused by not setting the return of concat when concatenating lines for sublist and substring functions. Also renamed these functions to be getSubsequece. Fixed lint errors with spacing
* Converting from if to switch statements
Comverting if statements to switch statements when appropriate and adding spacing.
* Modified sublist JavaScript generation
Added case so that helper function is not generated if not necessary. Helper function is not generated if list length is not needed or if list is a simple block (such as a variable, as oppossed to a function call or list create).
* Stripping unecessary ids
Removing ids from xml file.
* Updating generator test
Modifying sublist test and re-formatting spacing between blocks.
* Updating js lists to do zero and one based index
Updated generated JavaScript to change depending on whether one based indexing is enabled or not.
* Updating js text to do zero and one based index
Change so that JavaScript generated for text blocks either assumes blocks use zero or one based index based on setting.
* Fixing bug and lint fixed
Fixing bug caused by not setting the return of concat when concatenating lines for sublist and substring functions. Also renamed these functions to be getSubsequece. Fixed lint errors with spacing
* Converting from if to switch statements
Comverting if statements to switch statements when appropriate and adding spacing.
* Modified sublist JavaScript generation
Added case so that helper function is not generated if not necessary. Helper function is not generated if list length is not needed or if list is a simple block (such as a variable, as oppossed to a function call or list create).
* Stripping unecessary ids
Removing ids from xml file.
* Localisation updates from https://translatewiki.net.
* Localisation updates from https://translatewiki.net.
* Updating js lists to do zero and one based index
Updated generated JavaScript to change depending on whether one based indexing is enabled or not.
* Fixing bug and lint fixed
Fixing bug caused by not setting the return of concat when concatenating lines for sublist and substring functions. Also renamed these functions to be getSubsequece. Fixed lint errors with spacing
* Modified sublist JavaScript generation
Added case so that helper function is not generated if not necessary. Helper function is not generated if list length is not needed or if list is a simple block (such as a variable, as oppossed to a function call or list create).
* Stripping unecessary ids
Removing ids from xml file.
* Updating generator test
Modifying sublist test and re-formatting spacing between blocks.
* Adding tests for indexing and extra cases
Adding tests for indexing with custom block to adjust number based on what indexing is being generated.
* Adding tests and renaming tests
Adding tests for sublist and renaming tests.
* Fixes for order for sublists
Fixes so that parenthesis are generated properly for index for sublist
* Cleaning up test generated code
Changing order returned for unit test adjust index function to generate less unecessary parenthesis.
* Adding tests for order
Adding tests for order, relevant for methods that use index from start (because 1 is added)
* Fixing JS order for getIndex and setIndex
Changing to the correct order type when calling valueToCode in JS generation for getIndex and setIndex.
* Fixed unittest adjustIndex
Fixed uninttest adjustindex to also check whether the ONE_BASED_INDEXING variable has been defined to ensure proper behaviour.
* Fixing lint and formatting for JS/lists
Making line fixes and changing an if/elseif to case statement.
* Tests added to include case for bug found
Added tests with sublist combinations of different where's for the two indices after bug for this found in python.
* Adding and renaming tests
Adding test case for creating a sublist that encompasses the whole list but uses # and #-end instead of first last (applicable for python). Also, renaming tests.
* Adding contant and fixing python lists bugs
Adding contant for ONE_BASED_INDEXING and fixing bugs in python for lists.
* Fixing test get random
Fixing test get random to take into account indexing for return value.
* Adding indexing checkbox to test page
Adding checkbos on test page so that code can be generated for one and zero based indexing. Languages that are generated with zero based indexing that do not have it implemented will fail tests as expected.
* Fixing unittest getremove random
Fixing unittest getremove random to take into account the return value based on indexing.
* Change comparison for getremove random test
Fixed comparison to equal for the return value for getremove random.
* Fixing bugs with lists zero-indexing
Fixing getIndex and getSublist methods to pass for zero-indexed tests.
* Adding test cases and formatting
Adding test cases to text tests, reordering a couple list test, and formatting block spacing.
* Fixing unittest expected value
Fixing expected value fore unit tests for sublist.
* Cleanup
Removing obvious comments, formatting fixes, and naming in generated code in JS.
* Helper function for Python lists
Adding helper function for casting to int for indices.
* Expanding helper to reduce duplicated code
Expanding helper method to also get the property with the correct order and check indexing to reduce duplicated code.
* Cleaning up JS indexing with helper function
Adding helper function for indexing and used it in lists and text.
* Moving helper function and formatting fixes
Moving helper function, formatting fixes, and changing some generated code variable names.
* Fixing python generation for text
Fixing all failinng tests for python and using new helper method.
* Lint fixes and order in indexOf
Making lint fixes and correcting returned order in indexOf.
* Python variable renaming
Renaming a few generated variables.
* Fixing comment and order
Fixing comment to list Blockly.Block type and fixing order because it could be higher.
* Switching back to if
Switching switch back to if statements because there weren't enough cases to warrant for a switch.
* Adding order and fixing lists for Dart
Adding if null operator to operator precedence for Dart. Also, fixing lists implementation to pass unit tests and adding zero-indexing functionality.
* Formatting and lint fixes
Formatting and lint fixes
* Dart text fixed
Fixing Dart text generation to pass unit tests.
* Changing back to variable
Changing switch condition back to variable.
* Fixing ORDER_OVERRIDES
Inner and outer order was switched .
* Adding bug with order caused by generator change
Flooring order before comparision because of how the order constants were modified.
* Adding list tests
Adding tests for additional cases for lists/
* Adding comment for dart order
Adding comment for Dart ORDER_IF_NULL operator.
* Formatting fixes
Formatting fixes for line indentation.
* Fixing PHP order and lists generation
Fixing PHP order constants and fixing lists so that they pass unit tests.
* Fixing tests
Removing duplicate unit test
* Adding text tests
Adding tests for text.
* Renaming variable and removing unused variable
Renaming variables from exceptionIndex to errorIndex and removing unused at variable.
* Adding missing function call to test
Adding missing funciton call to test that was causing tests to fail when they shouldn't.
* Fixing PHP text generation
Fixing PHP text code generation so it passes unit tests.
* Formatting fixes
Cleaning up code, renamiing a variable.
* Fixing failing subsequence tests
Fixing JS code that failed for sublist/substring tests.
* Fixing intentation
Fixing indentation.
* Fixing Dart sublist/substring
Fixing sublist/substring to include condiiton where FROM_START (and not throw error by mistake) when zero-indexed.
* Adding order subtraction test
Adding test for checking order for subtraction x- (y - z) x - (y + z).
* Updating to new PHP power operator
Updating from pow function to ** operator to clean up code.
* Updating to new removeWhere
Updating removeMatching to removeWhere because new version of Dart now use removeWhere.
* Fix for lua rounding assertequals
Adding check for number in equlity check for comparing number for floats.
* Adding test for copy of list
Adding test that checks the list is copied when a sublist is made first-last.
* Formatting and order fixes
Fixing formatting such as indentation and order fixes.
* Adding comment for clarity
Adding comment about how Lua code generation is not supporting zero indexing.
* Changed variable names in code
Changed variable names to follow style guide and changed for loop variable from n to i as is typical.
* Reducing unecessarily generated functions and renaming variables
Reducing number of generated functions using gensym_ by adding parameters to provided function. Renaming variables to make functions more readble.
* Fixing sublist order and sort variable
Fixing order used for valueToCode for sublist and renaming list variable in sort to match rest of code..
* Fixing order constant order
Removing operator () that was incorrect and addiung ~,
* Fixing order and indentation
Fixing order return fro create lists blocks and fixing indentationn for string array.
* Fixing order and renaming variables
Fixing order to be the correct strength and renaming variables to be more readable/
* Changing assert blocks for unit tests
Changing assert blocks to have a value input instead of a field so there is more flexibility in writing tests.
* Cleaning up and adding missing order tests
Adding tests for order for paramters for list blocks that weren't being tested to uncover bugs. Test were also cleaned up/reorganized/renamed to be more readable and shorter vertically (but lines wider horizontally).
* Compile error fix and order in Dart generation.
Fixing compile error in generated code and incorrect order in get sublist for Dart.
* Fixing typo in getIndex and invalid parameter name
Fixing type in getIndex where list code should have been appended but instead an undefined variable was added. The parameter in lists_sort was changed to my_list because list is a reserved word in python.
* Fixing order, parenthesis bug, and variable declaration in Lua
Fixing incorrect order in Lua. Fixing bug caused by missing parenthesis around ternary operator in code. Variable code was declared with JavaScript syntax, this was fixed to be valid in Lua.
* Adding tests and formatting tests
Adding missing test for order in text/lists. Changing spacing/order of tests and updating comments.
* Fixing error in code
Changing to correct function call in empy tests and changing test name that was duplicated to be more clear.
* Renamed test helper function
* Fixing order and renaming variable in JS generator
Fixing order for charAt and renaming variable in code list_sort from listCode to list to be consistent with rest of code.
* Fixing order for dart text
Fixing roder for dart charAt
* Cleaning up generated code for Dart getIndex
Cleaning up generated code for Dart getIndex so that helper functions aren't generated unecessarily and adding comments.
* Fixing Dart remove random error
Fixing error caused by remove random implementation in Dart. index should have been x but instead was length - x.
* Fixing unit test blocks
Fixing Lua unit test block that should have just returned the number and removing unecessary checks in other blocks because the constant was defined.
* Fixing Lua assert equals block
string.format was throwing an error if one of the values happened to be a boolean.
* Adding tests for create text with number
Adding test for create text with numbers as parameters
* Fixing lua unit test block
Lua unit test block should have added 1
* Removing indexing setting for Lua tests
Removing setting index setting for Lua generation because it is always one-indexed.
* Fixing order and create text
Fixing failing test caused by improper order and fixed create text to properly convert to string when there is one element.
* Running linter on generator code
Running linter on generator code and fixing spacing/indentation problems.
* Editing comments and removing uneeded parenthesis
Editing and adding comments and removing uneeded parenthesis around ternary operator condition.
* Fixing order and changing variable names
Fixing orders that were incorrect and changing variable names to be more descriptive and consistent across code.
* Adding comment about list support and fixes for PHP
Adding comment about how lists are not fully supported for PHP. Adding missing order to PHP and fixing order errors throughout. Fixing regex for variable matching in lists. Cleaning up variable names to be more readable and consistent with other parts of code.
* Reducing complexity for getremove/remove in JS
Reducing complexity in generated code for getremove/remove in JavaScript by replacing unecessary helper function.
* Fixing spacing before inline comments
Ensuring there are two spaces before inline comments.
* Changing JS list copy for clarity
Changing JavaScript list copy to use slice(0) instead of concat for clarity and to use the same pattern as the other sublist methods.
* Changing generated variable name tmp_x
Changing tmp_x to tmpX to follow closer to the correct style for JavaScript.
* Prefixing empy lines between comment text
Prior to this change, comments with an empty line between text did not have a comment prefix before it, resulting in comment blocks that seemed disjoined although they were for the same block. This change affects how the prefix line function works so that those lines will have the prefix (if applicable) while still taking into account the trailing newline character.
* Changing for loops variable names
Changing most for loops to use i as the variable name (or j if applicable) or changing name to be more readable.
* Simplifying provided subsequence function
Simplifying subsequence function to generate a simpler function depending on where combination instead of a larger complex function that works for all where combinations.
* Style fixes
Fixing indentation, comments, and other formatting-type changes based on pull request comments.
* Fixing indentation
Fixing indentation and removing an extra newline.
* Fixing PHP mode implementation
Fixing PHP mode implementation to properlyu return multiple modes if applicable.
* Fixing line too long
Wrapping lines in php/math.js with lines longer than 80 characters.
* Wrapping long lines
Wrapping lines that are too long.
* Changing boolean casing
Changing boolean casing to be lowercase.
2016-07-08 11:43:48 -07:00
|
|
|
if (options[i][1] == newValue) {
|
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 content = options[i][0];
|
|
|
|
if (typeof content == 'object') {
|
|
|
|
this.imageJson_ = content;
|
2017-09-18 13:09:07 -07:00
|
|
|
this.text_ = content.alt;
|
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
|
|
|
} else {
|
|
|
|
this.imageJson_ = null;
|
2017-09-18 13:09:07 -07:00
|
|
|
this.text_ = content;
|
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
|
|
|
}
|
2017-09-18 13:09:07 -07:00
|
|
|
// Always rerender if either the value or the text has changed.
|
|
|
|
this.forceRerender();
|
2013-10-30 14:46:03 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Value not found. Add it, maybe it will become valid once set
|
|
|
|
// (like variable names).
|
2017-09-18 13:09:07 -07:00
|
|
|
this.text_ = newValue;
|
|
|
|
this.forceRerender();
|
2013-10-30 14:46:03 -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
|
|
|
* Sets the text in this field. Trigger a rerender of the source block.
|
2013-10-30 14:46:03 -07:00
|
|
|
* @param {?string} text New text.
|
|
|
|
*/
|
|
|
|
Blockly.FieldDropdown.prototype.setText = function(text) {
|
2014-09-08 14:26:52 -07:00
|
|
|
if (text === null || text === this.text_) {
|
2013-10-30 14:46:03 -07:00
|
|
|
// No change if null.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.text_ = text;
|
2014-09-08 14:26:52 -07:00
|
|
|
this.updateTextNode_();
|
2013-10-30 14:46:03 -07:00
|
|
|
|
2014-12-24 00:22:01 -08:00
|
|
|
if (this.textElement_) {
|
2016-10-04 17:42:21 -04:00
|
|
|
this.textElement_.parentNode.appendChild(this.arrow_);
|
2013-10-30 14:46:03 -07:00
|
|
|
}
|
|
|
|
if (this.sourceBlock_ && this.sourceBlock_.rendered) {
|
|
|
|
this.sourceBlock_.render();
|
|
|
|
this.sourceBlock_.bumpNeighbours_();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-10-05 17:14:33 -04:00
|
|
|
/**
|
|
|
|
* Position a drop-down arrow at the appropriate location at render-time.
|
|
|
|
* @param {number} x X position the arrow is being rendered at, in px.
|
|
|
|
* @return {number} Amount of space the arrow is taking up, in px.
|
|
|
|
*/
|
2016-10-04 17:42:21 -04:00
|
|
|
Blockly.FieldDropdown.prototype.positionArrow = function(x) {
|
2017-02-02 14:17:43 -05:00
|
|
|
if (!this.arrow_) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-10-04 17:42:21 -04:00
|
|
|
var addedWidth = 0;
|
|
|
|
if (this.sourceBlock_.RTL) {
|
|
|
|
this.arrowX_ = this.arrowSize_ - Blockly.BlockSvg.DROPDOWN_ARROW_PADDING;
|
|
|
|
addedWidth = this.arrowSize_ + Blockly.BlockSvg.DROPDOWN_ARROW_PADDING;
|
|
|
|
} else {
|
|
|
|
this.arrowX_ = x + Blockly.BlockSvg.DROPDOWN_ARROW_PADDING / 2;
|
|
|
|
addedWidth = this.arrowSize_ + Blockly.BlockSvg.DROPDOWN_ARROW_PADDING;
|
|
|
|
}
|
|
|
|
if (this.box_) {
|
|
|
|
// Bump positioning to the right for a box-type drop-down.
|
|
|
|
this.arrowX_ += Blockly.BlockSvg.BOX_FIELD_PADDING;
|
|
|
|
}
|
|
|
|
this.arrow_.setAttribute('transform',
|
2018-05-02 15:32:28 -07:00
|
|
|
'translate(' + this.arrowX_ + ',' + this.arrowY_ + ')');
|
2016-10-04 17:42:21 -04:00
|
|
|
return addedWidth;
|
|
|
|
};
|
|
|
|
|
2013-10-30 14:46:03 -07:00
|
|
|
/**
|
2014-09-08 14:26:52 -07:00
|
|
|
* Close the dropdown menu if this input is being deleted.
|
2013-10-30 14:46:03 -07:00
|
|
|
*/
|
2014-09-08 14:26:52 -07:00
|
|
|
Blockly.FieldDropdown.prototype.dispose = function() {
|
2016-09-28 16:42:42 -04:00
|
|
|
this.selectedItem = null;
|
2014-09-08 14:26:52 -07:00
|
|
|
Blockly.WidgetDiv.hideIfOwner(this);
|
|
|
|
Blockly.FieldDropdown.superClass_.dispose.call(this);
|
2013-10-30 14:46:03 -07:00
|
|
|
};
|
2018-04-17 14:15:18 -07:00
|
|
|
|
|
|
|
Blockly.Field.register('field_dropdown', Blockly.FieldDropdown);
|