Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify Closure-sourced code for menus #3880

Merged
merged 30 commits into from May 7, 2020
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1067cab
Remove cargo-culted bloat from CSS
NeilFraser May 3, 2020
034768c
More CSS simplifications
NeilFraser May 3, 2020
fe10b21
Make menu ID map manditory.
NeilFraser May 3, 2020
f251042
Fix bug (in prod) where menu highlighting is lost
NeilFraser May 3, 2020
d79b8d1
Add support for Space/PgUp/PgDn/Home/End to menus
NeilFraser May 3, 2020
3100327
Eliminate calls to clearHighlighted
NeilFraser May 3, 2020
13e7b3c
Stop wrapping at top or bottom of menu.
NeilFraser May 4, 2020
47c2139
Fix JS Doc type.
NeilFraser May 4, 2020
56eaff6
Remove unused menu code
NeilFraser May 4, 2020
e216076
Simplify menu roles
NeilFraser May 4, 2020
5df126a
Replace menu item element map with a property.
NeilFraser May 4, 2020
e1ee161
Fix lack of disposal for context menus.
NeilFraser May 5, 2020
9b4529a
Fix lint error.
NeilFraser May 5, 2020
a41c52d
Remove Component dependency from Menu & MenuItem
NeilFraser May 5, 2020
6215dc4
Remove unused functions in Component
NeilFraser May 5, 2020
6c67a38
Fix dependencies.
NeilFraser May 5, 2020
10647ec
Fix compile errors.
NeilFraser May 5, 2020
518ab35
Record highlighted menu item by object, not index
NeilFraser May 6, 2020
76b5a36
Rename CSS classes goog-menu* to blocklyMenu*
NeilFraser May 6, 2020
3148ae3
Remove unused focus tracker in tree.
NeilFraser May 6, 2020
2e0e6df
Add support for space/enter to toggle tree cats
NeilFraser May 6, 2020
197f919
Delete unsettable .isUserCollapsible_ from tree
NeilFraser May 6, 2020
f269e12
Minor CSS cleanup
NeilFraser May 6, 2020
3e27d58
Fix bad type annotation.
NeilFraser May 6, 2020
2c973e1
Change visibility tags throughout menus.
NeilFraser May 6, 2020
881734b
Address review comments on changes to menu.
NeilFraser May 6, 2020
50bbfb1
Fix rollName types.
NeilFraser May 6, 2020
dd441ca
Remove property on DOM element linking to JS obj
NeilFraser May 7, 2020
2e8ef42
Event.target is never a Node. Fix types.
NeilFraser May 7, 2020
ef59a9a
Fixes a compile error (node != element)
NeilFraser May 7, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/block_dragger.js
Expand Up @@ -220,7 +220,7 @@ Blockly.BlockDragger.prototype.endBlockDrag = function(e, currentDragDeltaXY) {
this.dragBlock(e, currentDragDeltaXY);
this.dragIconData_ = [];
this.fireDragEndEvent_();

Blockly.utils.dom.stopTextWidthCache();

Blockly.blockAnimations.disconnectUiStop();
Expand Down
51 changes: 8 additions & 43 deletions core/components/component.js
Expand Up @@ -115,7 +115,12 @@ Blockly.Component.Error = {
* Error when an attempt is made to add a child component at an out-of-bounds
* index. We don't support sparse child arrays.
*/
CHILD_INDEX_OUT_OF_BOUNDS: 'Child component index out of bounds'
CHILD_INDEX_OUT_OF_BOUNDS: 'Child component index out of bounds',

/**
* Error when calling an abstract method that should be overriden.
*/
ABSTRACT_METHOD: 'Unimplemented abstract method'
};

/**
Expand Down Expand Up @@ -195,12 +200,11 @@ Blockly.Component.prototype.isInDocument = function() {
};

/**
* Creates the initial DOM representation for the component. The default
* implementation is to set this.element_ = div.
* Creates the initial DOM representation for the component.
* @protected
*/
Blockly.Component.prototype.createDom = function() {
this.element_ = document.createElement('div');
throw Error(Blockly.Component.Error.ABSTRACT_METHOD);
};

/**
Expand All @@ -223,19 +227,6 @@ Blockly.Component.prototype.render = function(opt_parentElement) {
this.render_(opt_parentElement);
};

/**
* Renders the component before another element. The other element should be in
* the document already.
*
* Throws an Error if the component is already rendered.
*
* @param {Node} sibling Node to render the component before.
* @protected
*/
Blockly.Component.prototype.renderBefore = function(sibling) {
this.render_(/** @type {Element} */ (sibling.parentNode), sibling);
};

/**
* Renders the component. If a parent element is supplied, the component's
* element will be appended to it. If there is no optional parent element and
Expand Down Expand Up @@ -497,21 +488,6 @@ Blockly.Component.prototype.getContentElement = function() {
return this.element_;
};

/**
* Set is right-to-left. This function should be used if the component needs
* to know the rendering direction during DOM creation (i.e. before
* {@link #enterDocument} is called and is right-to-left is set).
* @param {boolean} rightToLeft Whether the component is rendered
* right-to-left.
* @package
*/
Blockly.Component.prototype.setRightToLeft = function(rightToLeft) {
if (this.inDocument_) {
throw Error(Blockly.Component.Error.ALREADY_RENDERED);
}
this.rightToLeft_ = rightToLeft;
};

/**
* Returns true if the component has children.
* @return {boolean} True if the component has children.
Expand Down Expand Up @@ -569,14 +545,3 @@ Blockly.Component.prototype.forEachChild = function(f, opt_obj) {
f.call(/** @type {?} */ (opt_obj), this.children_[i], i);
}
};

/**
* Returns the 0-based index of the given child component, or -1 if no such
* child is found.
* @param {?Blockly.Component} child The child component.
* @return {number} 0-based index of the child component; -1 if not found.
* @protected
*/
Blockly.Component.prototype.indexOfChild = function(child) {
return this.children_.indexOf(child);
};