mirror of
https://github.com/google/blockly.git
synced 2026-01-05 16:10:09 +01:00
fix!: Remove the blocklyMenuItemHighlight CSS class and use the hover (#8536)
* fix!: Remove the blocklyMenuItemHighlight CSS class and use the hover * fix: Remove setHighlighted method in menuitem * fix: Remove blocklymenuitemhighlight css class
This commit is contained in:
@@ -445,8 +445,7 @@ input[type=number] {
|
|||||||
cursor: inherit;
|
cursor: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* State: hover. */
|
.blocklyMenuItem:hover {
|
||||||
.blocklyMenuItemHighlight {
|
|
||||||
background-color: rgba(0,0,0,.1);
|
background-color: rgba(0,0,0,.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -249,11 +249,9 @@ export class Menu {
|
|||||||
setHighlighted(item: MenuItem | null) {
|
setHighlighted(item: MenuItem | null) {
|
||||||
const currentHighlighted = this.highlightedItem;
|
const currentHighlighted = this.highlightedItem;
|
||||||
if (currentHighlighted) {
|
if (currentHighlighted) {
|
||||||
currentHighlighted.setHighlighted(false);
|
|
||||||
this.highlightedItem = null;
|
this.highlightedItem = null;
|
||||||
}
|
}
|
||||||
if (item) {
|
if (item) {
|
||||||
item.setHighlighted(true);
|
|
||||||
this.highlightedItem = item;
|
this.highlightedItem = item;
|
||||||
// Bring the highlighted item into view. This has no effect if the menu is
|
// Bring the highlighted item into view. This has no effect if the menu is
|
||||||
// not scrollable.
|
// not scrollable.
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
// Former goog.module ID: Blockly.MenuItem
|
// Former goog.module ID: Blockly.MenuItem
|
||||||
|
|
||||||
import * as aria from './utils/aria.js';
|
import * as aria from './utils/aria.js';
|
||||||
import * as dom from './utils/dom.js';
|
|
||||||
import * as idGenerator from './utils/idgenerator.js';
|
import * as idGenerator from './utils/idgenerator.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,7 +67,6 @@ export class MenuItem {
|
|||||||
'blocklyMenuItem ' +
|
'blocklyMenuItem ' +
|
||||||
(this.enabled ? '' : 'blocklyMenuItemDisabled ') +
|
(this.enabled ? '' : 'blocklyMenuItemDisabled ') +
|
||||||
(this.checked ? 'blocklyMenuItemSelected ' : '') +
|
(this.checked ? 'blocklyMenuItemSelected ' : '') +
|
||||||
(this.highlight ? 'blocklyMenuItemHighlight ' : '') +
|
|
||||||
(this.rightToLeft ? 'blocklyMenuItemRtl ' : '');
|
(this.rightToLeft ? 'blocklyMenuItemRtl ' : '');
|
||||||
|
|
||||||
const content = document.createElement('div');
|
const content = document.createElement('div');
|
||||||
@@ -177,25 +175,6 @@ export class MenuItem {
|
|||||||
this.checked = checked;
|
this.checked = checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Highlights or unhighlights the component.
|
|
||||||
*
|
|
||||||
* @param highlight Whether to highlight or unhighlight the component.
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
setHighlighted(highlight: boolean) {
|
|
||||||
this.highlight = highlight;
|
|
||||||
const el = this.getElement();
|
|
||||||
if (el && this.isEnabled()) {
|
|
||||||
const name = 'blocklyMenuItemHighlight';
|
|
||||||
if (highlight) {
|
|
||||||
dom.addClass(el, name);
|
|
||||||
} else {
|
|
||||||
dom.removeClass(el, name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the menu item is enabled, false otherwise.
|
* Returns true if the menu item is enabled, false otherwise.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user