Commit Graph

188 Commits

Author SHA1 Message Date
Neil Fraser
98a98bcce6 Add Blockly.utils.dom.XLINK_NS
And fix provide/require mixup.
2019-06-07 10:32:57 -07:00
Neil Fraser
848d3a3509 Move setCssTransform & createSvgElement to dom.
Also move SVG_NS and HTML_NS properties.
2019-06-07 10:32:57 -07:00
Neil Fraser
3dfac9a2ba Alphabetize require statements.
Search and replace for userAgent didn’t take into account alphabetic ordering.
Also some line wraping.
2019-06-07 10:32:57 -07:00
Neil Fraser
566f182fa8 Move Blockly.userAgent to Blockly.utils.userAgent 2019-06-07 10:32:57 -07:00
Neil Fraser
d1a29739d8 Move utilities into own directory.
TODO: There are more functions which may be migrated into dom and string.
2019-06-07 10:32:57 -07:00
Beka Westberg
4b70215db8 Fixed dropdown arrow being to close to option. 2019-05-31 11:56:21 -07:00
Beka Westberg
f0d6fbd192 Reorganized field view initialization. 2019-05-31 10:38:18 -07:00
Beka Westberg
e1e746b845 Fixed how fields handle size. 2019-05-31 07:32:43 -07:00
Neil Fraser
9f528922a7 Fix some dependencies 2019-05-24 15:45:05 -07:00
Beka Westberg
f16c9c0beb Refactored field validation. 2019-05-24 14:23:42 -07:00
Neil Fraser
28ad3a9bd3 Blockly.utils.userAgent moved to Blockly.userAgent 2019-05-10 16:56:26 -07:00
Neil Fraser
4062030731 Remove goog.userAgent dependency. 2019-05-10 14:03:21 -07:00
Beka Westberg
354d402c49 Refactored field.init into field.initView and field.initModel 2019-05-03 07:12:46 -07:00
Beka Westberg
247aafae7e Added updateColour to field. 2019-04-29 16:53:59 -07:00
Beka Westberg
5c4c816a9b Removed setVisible from the public API (#2406) 2019-04-24 16:07:47 -07:00
Beka Westberg
e8573bc0db Added isSerializable function and SERIALIZABLE property to fields. 2019-04-21 08:28:37 -07:00
Neil Fraser
e9de083361 Fix @return JSDocs. 2019-03-29 15:24:37 -07:00
Bluefox
e84a740d3d Fix error by init of dropdown in case the value is "" (#2308)
I have following dropdown options

```
[
    ["no matter", ""]
    ["Update", "true"]
    ["Command", "false"]
]
```
In case my value is "" the text is not filled with "no matter" by the initial draw and the empty selector is shown. I expect the text "no matter"

This PR fixes that
2019-02-22 10:02:14 -08:00
Tianwei Du
f3bb0d827e fix #2090 (#2109) 2018-11-07 12:42:42 -08:00
Neil Fraser
aa09ad9175 Line wrap at 80. 2018-10-16 11:34:10 -07:00
Rachel Fenichel
d09c340c79 Mark some field properties protected 2018-09-11 16:19:34 -07:00
Andrew n marshall
411ec9724e Replacing node.parentNode.removeChild(node)
...with Blockly.utils.removeNode(..), which includes
a null/undefined check on parentNode before continuing.
2018-09-04 13:31:53 -07:00
Neil Fraser
dce60fd152 Replace ReferenceError with Error.
Change to 4-space indentation rather than aligning with parent structure.
2018-07-11 12:20:02 -07:00
Neil Fraser
c51cf0b79c Remove goog.dom.removeNode 2018-07-11 12:20:02 -07:00
Neil Fraser
f802859547 Remove goog.dom.removeChildren
HTML can be nullified with innerHTML, SVG needs a loop.
2018-07-11 12:20:02 -07:00
Neil Fraser
c8e08109f2 Correct requires for goog.style 2018-07-11 12:20:02 -07:00
Neil Fraser
3909bd420a Remove all goog.asserts and goog.isXxx
First step to reducing Closure’s footprint.
2018-07-11 12:20:02 -07:00
Rachel Fenichel
bae346963f Remove custom touch handling code for dropdown fields 2018-06-06 12:34:28 -07:00
Andrew n marshall
e9aae34388 Adaptive popup size for FieldDropdowns (#1897)
Replace the fixed dropdown height with one responsive to the document's viewport.

This is adapted from Bohdan-Tereta's proposed solution:
https://github.com/google/blockly/pull/1483#issuecomment-381638639

It is sub-optimal, in that is does not adapt to field height (variable
due to workspace zoom), and it does not fully utilize the space above
or below the field if the block is near the top or the bottom.
2018-05-31 16:37:09 -07:00
Andrew n marshall
ea6438de3e Adding Blockly.FieldDropdown.validateOptions_() (#1840)
* Adding Blockly.FieldDropdown.validateOptions_()

Verifies the datastructure of dropdown option lists.
Catches errors early, such as:
  https://groups.google.com/forum/#!topic/blockly/ae9WrvEcOP0
2018-05-04 19:12:10 -07:00
Rachel Fenichel
615c403b44 Use @nocompress annotation to fix advanced compilation. 2018-03-01 12:35:55 -08:00
Mark Gibson
54f0e06e21 Customising field types using a register of fields #1584 (#1594)
Implement #1584 - Fields now registered by their JSON type name, allowing new custom fields and overriding of the standard fields. Replaces the manual switch statement for loading fields from JSON block definitions.
2018-02-14 10:14:59 -08:00
Andrew n marshall
e1e3f273d2 Remove forceRerender() from FieldDropDown.
Errantly forced whole block to rerender, including fields that
had not yet been initialized.

Fixes #1609
2018-02-13 15:01:33 -08:00
Mark Gibson
2308ae8c22 Remove underscore from fromJson_ 2018-02-07 18:18:35 +00:00
Mark Gibson
d40ef474ae See issue #1486 - adds fromJson_ fn to every Blockly.Field, removing Block.newField*FromJson_ helpers 2018-02-07 12:22:26 +00:00
Rachel Fenichel
3e62ffc20a Split at higher level for multiline function calls 2018-01-24 11:26:41 -08:00
Rachel Fenichel
fb897d7786 Even more lint. 90 errors remaining. 2018-01-23 18:33:30 -08:00
Sandeep Dubey
2dd8c1f669 Made the changes asked by the reviewer 2017-12-03 02:40:11 +05:30
Rachel Fenichel
3b81eede3e Call forceRerender instead of setText 2017-11-17 14:39:12 -08:00
Rachel Fenichel
acd3a00f4a Unify code for positioning the widget div (#1334)
* New widget div functions, used in context menu code

* Make all widget div positioning functions use the same argument order

* Use new widget div functions for fields

* share code for measuring menu size

* Get rid of positionMenu

* Update copyright date

* Rebuild blockly_uncompressed because there's a new require in town
2017-09-22 16:07:32 -07:00
Rachel Fenichel
8050ce929c Code cleanup: widget creation (#1332) 2017-09-20 16:38:13 -07:00
Rachel Fenichel
dd50dde23d Make dropdowns update correctly when you switch between images. (#1321) 2017-09-18 13:09:07 -07:00
Rachel Fenichel
e669466475 Code cleanup in FieldDropdown (#1289)
* Helper functions for rendering an image or text option.

* Break showEditor_ into smaller helper functions

* More decomposition, and function comments.
2017-09-15 12:26:39 -07:00
Sam El-Husseini
4c4c8be142 Fix wrong width of field_dropdown with an image on Edge / IE (#1278) 2017-08-14 16:09:27 -07:00
marisaleung
aff9c4867c Correctly named block events called. 2017-06-08 15:44:43 -07:00
Andrew n marshall
0da5dda1f0 Fixing JSON support for images in dropdowns. Adding tests. (#851)
Fixes #848.
2017-01-23 13:39:14 -08:00
Andrew n marshall
7b0275cd70 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'.
2017-01-23 10:23:55 -08:00
Andrew n marshall
ac3df2759c 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.
2017-01-11 15:47:56 -08:00
Rachel Fenichel
20cf6abb5f End event groups when you finish editing a field 2017-01-03 14:09:41 -08:00
Neil Fraser
fbd9276e9c Lint 2016-11-18 20:26:56 -08:00