Commit graph

72 commits

Author SHA1 Message Date
Rachel Fenichel
844b7771e2 Merge branch 'develop' of https://github.com/google/blockly into feature/merge_nov_1 2016-11-01 18:00:26 -07:00
Tim Mickel
d1a9b6d31a Remove workspace resize from FieldTextInput onchange () 2016-10-20 22:25:32 -04:00
Andrew n marshall
81499e4392 Merge pull request from AnmAtAnm/alert-confirm-prompt
Adding hooks to support custom alert, confirm, and prompt dialogs
2016-10-20 17:20:00 -07:00
Andrew n marshall
8f3b4bcb5e Replaces calls to window.alert(), window.confirm(), and window.prompt() with Blockly.alert(), Blockly.confirm(), and Blockly.prompt(). These are designed to allow app developers to replace the dialogs with versions that match their own open app, possibly avoiding modal browser dialogs. They each take a callback, so the developer has the opportunity to implement non-modal behavior. 2016-10-20 16:30:40 -07:00
Tim Mickel
d65c274652 Text+drop-downs and number+drop-downs ()
* Don't force text-centering around FIELD_WIDTH if arrow present

* Add dark arrow asset

* Refactor FieldNumber restrictor generator to be static

* Allow disabling of FieldDropDown colour changing

* Add FieldTextDropDown and FieldNumberDropDown

* Add number drop-downs to list blocks

* Add docs

* Update `setArgType` -> `addArgType`

* Ensure arrow only created once

* Update list index min

* Refactor shared components of num restriction

* Line breaks

* Clear touch identifier

* Clear touch identifier when text drop-down closed

* Inheritance simplification
2016-10-05 17:14:33 -04:00
Airhogs777
3bafc2e2fb Switch from Replacing argType to Appending To It ()
* switch from replacing argType to appending to it

* switch argType to array, rename function to addArgType
2016-10-05 13:28:44 -04:00
Airhogs777
bac07dc65a Add attribute for argument type (take 2) ()
* a more robust way to add an attribute to arguments

* always run superclass constructor before setting argtype
2016-10-02 13:36:32 -04:00
Rachel Fenichel
ed983333eb bindEventWithChecks_ for internal use, and bindEvent_ with old behaviour but deprecated 2016-09-23 13:46:11 -07:00
Tim Mickel
b2c84cb802 Import procedures from Blockly ()
* Import procedures from Blockly

* Give mutators the dragSurface

* Draw a box behind non-shadow text fields

* ifreturn -> report

* Non-reporting proc -> next; reporting -> statement. Remove mutator for statement.

* Remove align_right in call

* Lints

* procedures_defnoreturn outputShape

* Revert rect CSS for event blocks
2016-09-16 18:29:15 -04:00
Rachel Fenichel
a979a422e4 Merge branch 'develop' of https://github.com/google/blockly into merge_sept_01 2016-09-01 16:52:08 -07:00
Rodrigo Queiro
88eac2480b Convert string tag name to goog.dom.TagName ()
in createDom calls only. This improves the type information of the
created objects.
2016-08-19 03:55:45 -07:00
Rachel Fenichel
4b5d4d4c26 Merge branch 'feature/variable_management' of https://github.com/google/blockly into feature/variable_management 2016-08-12 15:52:48 -07:00
Rachel Fenichel
c7a5944ea3 Create variables from procedure definitions 2016-08-11 14:59:11 -07:00
Tim Mickel
3f3862a5a8 Various tweaks to shape and size ()
* Align text by consistent baseline

* Helvetica

* CORNER_RADIUS in grid units

* Separate MIN_BLOCK_X for reporters from single-field shadows

* Update Blockly.BlockSvg.FIELD_WIDTH

* Remove padding on htmlInput

* Also apply border-radius to htmlInput_ to avoid weird edge effect in Chrome

* Update MIN_BLOCK_X to spec

* Fix horizontal sizing of blocks to include right corner.

* Add EDITABLE_FIELD_PADDING

This gives extra width to editable text fields.

* Add correct height for reporters

* Fix INLINE_PADDING_Y and reporter sizing to spec

* Remove unused case for input.renderWidth

* Instrument vertical rendering with right/left row padding.

* Revert renderWidth change

* Fix calculation of input shape widths

* Output padding to spec, fixing 

* Update horizontal FIELD_TOP_PADDING for new dominant baseline

* Update padding language to be LTR/RTL neutral

* Remove broken RTL SEP_SPACE_X from input shape drawing
2016-07-26 11:52:05 -04:00
Rachel Fenichel
8e652db9fe Merge branch 'develop' of https://github.com/google/blockly into feature/pull_google/7_11 2016-07-11 15:53:14 -07:00
Tim Mickel
30880a085c Browser consistency for keycode special events ()
* Browser consistency for keycode special events

* Fix whitelisting max

* Update comments and charCode=127
2016-07-11 14:46:02 -04:00
Tim Mickel
0d91c15b31 Fix restrictor on Firefox () 2016-07-06 17:33:47 -04:00
Tim Mickel
5be060e9c7 Base FieldTextInput radius on output shape, not field type. () 2016-07-06 15:56:45 -04:00
Neil Fraser
555eac8b7f Simplify field validator chaining. 2016-06-29 17:44:12 -07:00
Tim Mickel
2fa746d408 Alternate version of with min/max/precision ()
* Add textinput restrictor and FieldNumber use

* Update FieldNumber to remove validator and add appropriate restrictor

* Update blocks for new restrictors

* Remove restriction on FIELD_WIDTH_MAX_EDIT

* Remove extra console.log

* Version of FieldNumber that brings back min/max/precision

* opt_validator order to match Blockly

* Math.floor(precision) == precision

* Fixing JSDoc

* Invert decimalAllowed_

* Reverse opt_validator positioning per Neil

* Don't allow typing 'e', per design meeting

* Update for agreed-upon API

* Allow NaN constraints per agreement

* Remove optional parameters from math.js blocks

* Recompile 2, June 23

* Correct JSDoc for optionals
2016-06-23 12:44:01 -04:00
Tim Mickel
ca3275eaf0 Merge google/develop June 22 ()
* Localisation updates from https://translatewiki.net.

* test page that creates random blocks and randomly drags them around the page

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

* add missing return in fake drag

* get rid of drag_tests file:

* Generated JS helper functions should be camelCase.

Complying with Google style guide.

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

* Fix extra category error. Clean up code, rename variables, reduce line lengths, fix lint issues.

* Remove claim that good.string.quote should be used.

* Change the blockly workspace resizing strategy. ()

* Add a new method to be called when the contents of the workspace change and
the scrollbars need to be adjusted but the the chrome (trash, toolbox, etc)
are expected to stay in the same place.

Change a bunch of calls to svgResize to either be removed or call the new
method instead.  This is a nice performance win since the offsetHeight/Width
call in svgResize can be expensive, especially when called as often as we do -
there was some layout thrashing.

This also paves the way for moving calls to recordDeleteAreas
(which is also expensive) to a more cacheable spot than on every
mouse down/touch event.

of things (namely the scrollbars)

* Fix size of graph demo when it first loads by calling svgResize.
The graph starts with fixed width and was relying on a resize event
to fire (which I believe was removed in commit
217c681b86).

* Fix the resizing of the code demo.  The demo's tab min-width used to
match the toolbox's width was only being set on a resize event, but
commit 217c681b86 changed how that worked.

* Fix up some comments.

* Use specific workspaces rather than Blockly.getMainWorkspace().

* Make workspace required for resizeSvgContents and update
some calls to send real workspaces rather than ones that are
null.

Remove the private tag on terminateDrag_ because it is only
actually called from outside the BlockSvg object.

* Remove a rogue period.

* Recategorize BlockSvg.terminateDrag_ to @package instead of @private so that
other developers don't use it, but it still can be used by other Blockly classes.

* Add a TODO to fix issue .

* Add @package to workspace resizeContents.

* Routine recompile

* Fix unit tests.

* Fix inheritance on rendered connection.

Closure compiler on maximum compression breaks badly due to lack of
@extends attribute.

* Add toolbox location and toolbox mode options to playground.

* Increase commonality between playgrounds.

* Properly deal with shadow statement blocks in stacks.

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

* Use a comment block for function comments in generated JS, Python and Dart.

* Fix typo in flyout.js ()

* Fix typo in flyout.js ()

* Line wrap comments in generated code.

* Remove reference to undefined variable ()

REASON_MUST_DISCONNECT was removed by a refactor in 2a1ffa1.

* Fix airstrike by grabbing the correct toolbox element. ()

Probably broken in 266e2ffa9a.

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

* Fix issue  by calling resize from the keypress handler on text inputs. ()

* Remove shadow blocks from Accessible Blockly demo. Update README.

* Generate for loops on one line.

* Introduce a common translation pipe; remove local stringMap attributes. Fix variable name error in paste functions. Minor linting.

* Fix precedence on isIndex blocks.

* Add indexing setting for JavaScript Generation ()

Adding setting to allow for switching between zero and one based indexing for Blockly Blocks such that the generated code will use this flag to determine whether one based or zero based indexing should be used. One based indexing is enabled by default.

* Remove unused functions and dependencies.

* Remove the unnecessary construction of new services.

* Fix sort block in JS to satisfy tests.

* Trigger a contents resize in block's moveBy. ()

This fixes  but and it also fixes some other similar problems
with copy/paste and other users of moveBy.

* Consolidate the usages of the 'blockly-disabled' label.

* Fix error when undoing a shadow block replacement.  Issue .

* Unify setActiveDesc() and updateSelectedNode() in the TreeService. Move function calls made directly within the template to the correct hooks.

* Standardize naming of components.

* Prevent collisions between user functions and helper functions.

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

* Fix . Attash the resize handler to the workspace so it can be removed ()

when workspace.dispose() is called.

* Change the TreeService to a singleton.

* Remove unneeded generated parens around function calls in indexOf blocks.

* Fix  by calling workspace's resize when the flyout reflows. ()

* Updating URLs to reflect new docs. ()

* Updating URLs to reflect new docs. Removing -blockly in URLs.

* Rebuilt.

* Routine recompile

* Prevent selected block from ending up underneath a bumped block.

* Fix undo on fields with validators with side effects.

* Don't fire change event on fields that haven't been named yet.

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

* Fix tree focus issues.

* Fix remaining focus issues on block deletion.

* cache delete areas instead of recalculating them onMouseDown

* Cache screen CTM for performance improvement.

* Call svgResizeContents from block_svg's dipose so that deleting blocks ()

from the context menu (or anywhere really) causes the workspace to
recalculate its size.
Remove the call to svgResizeContents from onMouseUp's logic for
determining whether the block is being dropped in the trash
since it calls dispose.

One side effect of this is that when you delete multiple blocks
resize gets called for each of them and the scrollbars move during
the operation. This is most obviously seen by doing an airstrike
in the playground and then deleting all the blocks at once.

* Allow terminal blocks to replace other terminal blocks ()

* Allow terminal blocks to replace other terminal blocks

* Updated test to allow replacing terminal blocks

* Refactor how activeDescendant is set. Introduce helper functions to ensure that calls like pasteAbove() preserve the focus.

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

* Remove unnecessary logging.

* Reduce unneeded parentheses in JS and Python.

* Start using field_number.

* Make it easy to disable unconnected blocks.

* Routine recompile.

* Check if matrix is null in mouseToSvg

* Remove js/ localizations pre-merge

* Fix change to block_render_svg

* Fix error in xml.js

* Playground merge

* Add simple toolboxes to playgrounds

* Fix flyout reference in events listener

* Move tokenizeIntepolation into Blockly.utils namespace.

* Use simpler message interpolation in Code demo.

* Create console stub for IE 9.

* Don't output blockId if not set (e.g., toolbox category event). ()

* Fix block in multi-playground

* Increase commonality between playgrounds.

# Conflicts:
#	tests/multi_playground.html
#	tests/playground.html

* Remove "show flyouts" button

* Recompile for merge June 22
2016-06-22 17:50:16 -04:00
Neil Fraser
732e9b0659 Start using field_number. 2016-06-21 04:10:32 -07:00
Tim Mickel
60b125f406 Add handler for DOM input event to field_textinput ()
* Add handler for DOM input event to field_textinput

* Move resizeEditor_ commands inside onHtmlInputChange_ conditionals
2016-06-16 14:32:39 -04:00
Tim Mickel
051921e1a0 Fix up vertical text field editor ()
* Move animated FONTSIZE properties to horizontal/vertical-specific rendering

* Set FIELD_WIDTH_MAX_EDIT in vertical until we fix truncation problem

* Conditional animation/truncation of field_textinputs

* Tinker with constants to get things in the right position

* Adjust FIELD_WIDTH_MAX_EDIT

* Prefix FONTSIZE_INITIAL and FONTSIZE_FINAL

* Fix no-op
2016-06-15 18:08:32 -04:00
Tim Mickel
7c35d4e6f5 Remove all styles when hiding text-input ()
Fixes 
2016-06-14 16:34:24 -04:00
picklesrus
1aecb78dd1 Fix issue by calling resize from the keypress handler on text inputs. () 2016-06-09 02:35:32 -07:00
Tim Mickel
2b092352fe Slight refactor of field radius determination () 2016-05-23 16:21:31 -04:00
Tim Mickel
50ff6e4654 Implement field_number stub and num-pad on mobile ()
* Implement basic field_number type

* Add whole number and positive number

* Remove bad arguments for showEditor_

* Basic implementation and styling of num-pad

* Remove virtual keyboards; add selection and read-only

* Add editing for the number pad

* Add backspace button to number pad

* Fix text padding for font-weight and extra magic

* Don't show decimal point for integers

* Re-update default WeDo numbers

* Refactor and improve documentation of field_number
2016-04-26 21:32:29 -04:00
Tim Mickel
33a71b112f Implement number and string field specs ()
* Animate the font-size of text fields

* Allow WidgetDiv to hide immediately, no animation

And add calls to this where the div animation may become out of sync with the field itself.

* Fix CSS colour substitution to replace all

* Add box-shadow to text field

* Fix padding on blocklyHtmlInput

* Add utility for measuring text using canvas

* Grow the input textbox based on the text size

* Fix the text field width to a maximum depending on render mode

* Fix text input field height for scaling

* Position text input field based width

* Animate out width, height, margin of text input

* Fix scale of marginLeft and extra 1px

* Fix height, padding, font-weight on text input field

* Make input field text smaller on truncation per spec

* Re-apply change to Blockly.WidgetDiv.disposeAnimationTimer_

* Add comment to Blockly.Field.maxDisplayLength
2016-04-15 16:44:30 -04:00
Tim Mickel
382a1f4f82 Keep text-input widget div options to CSS class 2016-04-06 21:01:55 -04:00
Tim Mickel
8c180f0c52 Add additonal X bump for WEBKIT 2016-04-05 19:43:41 -04:00
Tim Mickel
464946d358 Use calculated value for RTL offset 2016-04-05 19:41:04 -04:00
Tim Mickel
5d71c82203 Improve handling of field border radius and colour 2016-04-05 19:37:32 -04:00
Tim Mickel
154d4e1851 Draw text fields entirely using CSS during edit 2016-04-05 18:36:02 -04:00
Tim Mickel
a65109f423 Merge remote-tracking branch 'Google/master' into google-master-april-1
# Conflicts:
#	blockly_compressed_horizontal.js
#	blockly_uncompressed_vertical.js
#	blocks_compressed.js
#	core/block.js
#	core/block_svg.js
#	core/blockly.js
#	core/connection.js
#	core/field_textinput.js
#	core/workspace_svg.js
#	generators/lua/lists.js
#	generators/lua/text.js
#	msg/js/he.js
#	msg/js/id.js
#	msg/js/sr.js
#	msg/js/zh-hant.js
#	msg/json/en.json
2016-04-01 14:44:46 -04:00
Neil Fraser
2b71aacac6 Fix error in closing text input if block is deleted. See PR and Issue . 2016-03-29 21:41:20 -07:00
Neil Fraser
b567d6b0d7 Allow shadow blocks to be edited. 2016-02-26 00:22:31 -08:00
Rachel Fenichel
6ee0744b5c Refactor block_svg to share code between horizontal and vertical versionss. 2016-02-24 10:19:59 -08:00
Ray Schamp
9d82e79e9c Update inputs to match spec 2016-02-23 16:59:53 -05:00
Ray Schamp
1a6dff7f42 Merge branch 'master' of github.com:google/blockly into merge/google-2016
# Conflicts:
#	blockly_compressed_vertical.js
#	blockly_uncompressed_vertical.js
#	blocks/text.js
#	blocks_compressed.js
#	core/block_svg.js
#	core/connection.js
#	core/field_textinput.js
#	core/flyout.js
#	core/toolbox.js
#	tests/playground.html
2016-02-18 13:29:25 -05:00
Neil Fraser
0fab13400a Fire function events instead of DOM events. 2016-02-11 21:40:33 -08:00
Neil Fraser
63c112932b Rename Field.setChangeHandler to Field.setValidator 2016-02-10 14:33:13 -08:00
Andrew Sliwinski
6a708da899 Initial SVG rendering modifications. 2016-01-26 14:57:43 -05:00
Neil Fraser
c429949a4e Add Create, Delete, and Change events.
Not counting change for mutators.
2016-01-20 19:11:03 -08:00
Neil Fraser
36fe3994c9 Misc cleanup. 2016-01-15 15:36:06 -08:00
Neil Fraser
4b0ed0d372 Add custom event file. 2016-01-12 16:47:18 -08:00
Neil Fraser
9b26d0d260 De-shadow blocks that have been edited. 2015-10-14 18:20:53 -07:00
Neil Fraser
ded524ff3a Add tabbing between text fields. 2015-10-14 16:23:23 -07:00
Neil Fraser
f601bdc3c7 Fix FF editor location by a pixel. 2015-08-21 14:13:07 -07:00
carlosperate
17be3219ee Update FieldTextInput to not edit possible read-only attributes.
The SVGRect returned from getBBox can be have its attributes as read-only.
2015-08-21 19:20:00 +01:00