Commit Graph

64 Commits

Author SHA1 Message Date
Rachel Fenichel
f14a1c8034 chore: fix more lint (#5676)
* chore: fix assorted lint

* chore: clang-format

* chore: clang-format
2021-11-08 16:41:52 -08:00
Rachel Fenichel
e8d6f7f408 chore: auto-fix violations of comma-dangle rule (#5625) 2021-10-21 09:01:51 -07:00
Aaron Dodson
3851b14627 refactor: Migrate to named exports (#5623)
* refactor: Migrate to named exports

* fix: Sort requires

* fix: Remove duplicate deps
2021-10-20 15:53:23 -07:00
Neil Fraser
90b3f75d82 Remove @author tags (#5601)
Our files are up to a decade old, and have churned so much, that the initial author of the file no longer has much meaning.

Furthermore, this will encourage developers to post to the developer group, rather than emailing Googlers (usually me) directly.
2021-10-15 09:50:46 -07:00
Monica Kozbial
49bc2b1ae4 Replace namespace annotation with class annotation in files that define a class (#5566) 2021-09-28 15:57:09 -07:00
Monica Kozbial
d8fbe1b05b Add namespace and alias annotations to jsdoc (#5550)
* Add annotations to files under core/events

* Add annotations to files under core/interfaces

* Add annotations to files under core/keyboard_nav

* Add annotations to files under core/renderers

* Add annotations to files under core/serialization

* Add annotations to files under core/theme

* Add annotations to files under core/toolbox

* Add annotations to files under core/utils

* Add annotations to files under core
2021-09-27 14:42:54 -07:00
Aaron Dodson
e0693a65d2 chore: Remove declareLegacyNamespace() from files in core (#5525)
* chore: Remove declareLegacyNamespace() from files in core

* fix: Update missing/errant re-exports in blockly.js
2021-09-23 14:48:52 -07:00
Rachel Fenichel
3adfaaf6d9 chore: named exports for block* files (#5512)
* chore: named export for block.js

* chore: named export for block_drag_surface.js

* chore: named export for block_dragger.js

* chore: named export for block_svg.js

* Fix import ordering

* chore: fix imports using requireType

* Remove extra require
2021-09-22 08:46:19 -07:00
Christopher Allen
e7955084ae refactor: Remove remaining references to Blockly.* from goog.modules (#5505) 2021-09-21 17:51:35 +01:00
alschmiedt
0fa81f33de PR comments and clang format after rebase 2021-08-19 17:23:18 -07:00
alschmiedt
168b71e964 Updates to the new pattern for testing private 2021-08-19 17:07:05 -07:00
alschmiedt
9939915252 Address PR comments 2021-08-19 17:07:04 -07:00
alschmiedt
3d75bd6493 Attempt to fix tests 2021-08-19 17:03:55 -07:00
alschmiedt
4c270c0e9d clang-format core/dropdowndiv.js 2021-08-19 17:03:52 -07:00
alschmiedt
cbd5e86291 Migrate core/dropdowndiv.js to goog.module 2021-08-19 17:02:19 -07:00
alschmiedt
f29d795a7e Migrate core/dropdowndiv.js to goog.module 2021-08-19 16:58:45 -07:00
alschmiedt
72c0a55ad9 Migrate core/dropdowndiv.js to ES6 const/let 2021-08-19 16:56:04 -07:00
Rachel Fenichel
1eabe91fa6 Move set/getParentContainer into common 2021-08-04 15:59:41 -07:00
Rachel Fenichel
2e30bbe7ce Update uses of mainWorkspace in core 2021-07-30 11:30:34 -07:00
Neil Fraser
cff7b359f4 Make comments more consistent. 2021-06-09 11:41:42 -07:00
Rachel Fenichel
994fc2ce1f Fix missing requires in dropdown div and widget div 2021-02-09 14:47:14 -08:00
Sam El-Husseini
acfc335870 Type fixes for Dropdown / Widget divs (#3911)
* Stricter typechecks in dropdown and widget div
2020-05-28 08:42:26 -07:00
Neil Fraser
a65afdc189 Simplify Closure-sourced code for menus (#3880)
* Remove cargo-culted bloat from CSS

The `goog-menuitem-icon` and `goog-menuitem-noicon` classes are not present in Blockly.  Blockly doesn’t support the CSS compiler, so #noflip has no effect.  Shorten uncompressible warning string.

Also remove the “Copied from Closure” notes.  These were intended so that the CSS could be easily updated as the Closure Library evolved.  We are no longer linked to the Closure Library.

* Fix bug (in prod) where menu highlighting is lost

Previously, open playground.  Right-click on workspace.  Mouse-over “Add comment” (it highlights).  Mouse over “Download screenshot” (disabled option).  Mouse over “Add comment” (highlighting is lost).

Also remove `canHighlightItem` helper function.  In theory this helps abstract the concept of non-highlightable options.  But in practice it was only called in one of the several places that it should have been.  This was a false abstraction.

* Add support for Space/PgUp/PgDn/Home/End to menus

* Eliminate calls to clearHighlighted

The JSDoc for `setHighlightedIndex` specifically states, “If another item was previously highlighted, it is un-highlighted.”  This is not what was implemented, but it should be.  This commit adds the un-highlighting, and removes all the calls previously required to correct this bug.

* Stop wrapping at top or bottom of menu.

Real OS menus don’t wrap when one cursors off the top or bottom.

Also, replace the overly complicated helper function with a simple 1/-1 step value.

* Remove unused menu code

* Simplify menu roles

Remove unneeded sets to RTL on Menu (only MenuItem cares).

* Fix lack of disposal for context menus.

Context menus only disposed properly when an option was clicked.  If they were dismissed by clicking outside the menu there was no disposal.  This might result in a memory leak.
Also un-extract (inject?) several now trivial functions.

* Remove Component dependency from Menu & MenuItem

Component is now only used by the category tree.

* Remove unused functions in Component

These were used by Menu/MenuItem.

* Fix dependencies.

* Record highlighted menu item by object, not index

Less code, simpler.

* Rename CSS classes goog-menu* to blocklyMenu*

Old classes remain in DOM and are deprecated so that any custom CSS will continue to function.

* Remove unused focus tracker in tree.

* Add support for space/enter to toggle tree cats

* Delete unsettable .isUserCollapsible_ from tree

* Change visibility tags throughout menus.

The previous tags were inherited from Closure and don’t reflect current usage in the Blockly codebase.

The core/components/tree files are non-compliant in this regard, but I’m not going to update them since they need to be replaced and there’s no need to create an interim API change.

* Remove property on DOM element linking to JS obj

Performance is slower (O(n) rather than (O(1)), but ’n’ is the number of entries on the menu, so shouldn’t be more than a dozen or so.

* Fixes a compile error (node != element)

Usually we avoid parentElement in Blockly.  That’s because it has very spotty behaviour with SVG.  But in this case we are in pure HTML.
2020-05-06 23:55:17 -04:00
Sam El-Husseini
cfa198c6a0 Fix bug with dropdown divs in mutator dialogs. (#3835) 2020-04-17 13:19:40 -07:00
Sam El-Husseini
a3dbbfd7ab Support a custom container element for the dropdowndiv, widgetdiv and tooltip. (#3772)
* Support a custom container element for the dropdowndiv, widgetdiv and tooltip
2020-03-27 17:13:46 -07:00
alschmiedt
7f9539e64b Fix inner html (#3759)
* Fix ie11 bug by switching from innerHtml to innerText

* Change to textContent
2020-03-20 13:46:59 -07:00
Sam El-Husseini
1d3a1655c6 Support multiple renderer / theme combos on the same page. (#3732)
* Support multiple renderer / theme combos on the same page.
2020-03-11 20:09:00 -07:00
Neil Fraser
4e2f8e6e02 Use SPDX licences.
This is a followup to #3127.
At the time, SPDX licenses were pending approval by Google.
2020-02-11 13:27:20 -08:00
Sam El-Husseini
c1ff28fcd2 Rename arrowTop and arrowBottom css classes to blocklyArrowTop and blocklyArrowBottom (#3548) 2020-01-06 16:09:23 -08:00
Sam El-Husseini
f06d7b3cfd Fix scrolled text input widgetdiv positioning. (#3533)
* Fix scrolled text input widgetdiv positioning.

* Fix dropdown div bounds element when scrolled.
2020-01-02 17:19:32 -08:00
Sam El-Husseini
9fc995425a Support adjusting dropdowndiv default colours through CSS (#3469)
* Support setting the dropdown theme default colours through CSS. Update dark theme.
2019-11-25 14:18:28 -08:00
Sam El-Husseini
329a21c572 Add theme and renderer classnames onto the widget and dropdown div. (#3456)
* Add theme and renderer classnames onto the widget and dropdown div.
2019-11-20 11:07:39 -08:00
Sam El-Husseini
cff8e19699 Return focus to the workspace after hiding a widget or dropdown div (#3447) 2019-11-15 10:57:29 -08:00
Sam El-Husseini
8eba82b906 Fix 4 misc warnings (#3283) 2019-10-17 16:52:52 -05:00
Sam El-Husseini
3c2c4677df Fix 55 warnings related to flyouts. (#3211)
* Fix 55 warnings related to flyouts.
2019-10-16 12:13:37 -05:00
Neil Fraser
01b6992efd Normalize to one spelling of color/colour. 2019-10-16 09:46:47 -07:00
Sam El-Husseini
267deceb82 Dropdowndiv positioning (#3212)
* Fix positioning of the dropdown div
2019-10-16 10:20:40 -05:00
Sam El-Husseini
3368a9f713 Revert calling onHide before the animation is complete to avoid double click issues. (#3202) 2019-10-09 11:16:16 -07:00
Sam El-Husseini
1d113b5069 Add support for setting the direction in RTL. (#3192) 2019-10-07 17:28:18 -07:00
Sam El-Husseini
fba98fca5b Move the dropdown field into the dropdown div. (#3122)
* Move the dropdown field into the dropdown div.
2019-10-03 14:35:28 -07:00
Neil Fraser
b46a4fe286 Bring our license format up to date (#3127)
* Google changed from an Inc to an LLC.

This happened back in 2017 but we didn’t notice.  Officially we should update files from Inc to LLC when they are changed as part of regular edits, but this is a nightmare to remember for the next decade.

* Remove project description/titles from licenses

This is no longer part of Google’s header requirements.  Our existing descriptions were useless (“Visual Blocks Editor”) or grossly obselete (“Visual Blocks Language”).

* License no longer requires URL.

* Fix license regexps.
2019-10-02 14:46:56 -07:00
Sam El-Husseini
f22603f32a Call onHide before clearing content (#3131) 2019-10-02 11:41:34 -07:00
Monica Kozbial
40e0d55187 Removing obsolete TODO comment. (#3104) 2019-09-27 11:12:11 -07:00
Neil Fraser
a03660243e Code cleanup, drop some CSS.
Random improvements to require statements.

Removal of some obviously dead CSS.

.blocklyDropDownDiv no longer supresses text selection (see comment in PR).

This PR drops the compiled size by 4 KB, which is larger than I was expecting.
2019-09-25 10:34:34 -07:00
Neil Fraser
096959fde9 Cleanup of last fortnight’s commits. (#2865)
No functional changes.
2019-08-19 14:07:48 -07:00
Sam El-Husseini
8e4d904095 Listen to focus events on children and add a focused class in the dropdown (#2848) 2019-08-16 16:29:34 -07:00
Sam El-Husseini
f34f2beac7 Remove all calls to goog.style (#2781)
* Remove dependency on goog.style
2019-08-06 14:54:13 -07:00
Neil Fraser
45e5fb4157 More JSDoc and lint corrections 2019-07-30 17:00:40 -07:00
Beka Westberg
c43e001634 Fixed DropDownDiv Rendering On Small Workspaces (#2641)
* Fixed dropdown div rendering when the workspace is too small.
2019-07-30 13:29:52 -07:00
Sam El-Husseini
c1b49a1da7 Fix some jsdoc types (#2701)
* Fix JSDoc regarding type inconsistencies. Make image field src required and update image field tests.
2019-07-25 12:24:36 -07:00