mirror of
https://github.com/google/blockly.git
synced 2026-01-10 02:17:09 +01:00
fix!: Replace Closure UI CSS classes with Blockly CSS classes (#8339)
* fix!: Replace Closure UI CSS classes with Blockly CSS classes * chore: remove comments about deprecated goog-x class * chore: remove deprecated goog-x classes * fix: correct coding format to pass CI checks
This commit is contained in:
@@ -85,8 +85,7 @@ export class Menu {
|
||||
*/
|
||||
render(container: Element): HTMLDivElement {
|
||||
const element = document.createElement('div');
|
||||
// goog-menu is deprecated, use blocklyMenu. May 2020.
|
||||
element.className = 'blocklyMenu goog-menu blocklyNonSelectable';
|
||||
element.className = 'blocklyMenu blocklyNonSelectable';
|
||||
element.tabIndex = 0;
|
||||
if (this.roleName) {
|
||||
aria.setRole(element, this.roleName);
|
||||
|
||||
@@ -64,22 +64,19 @@ export class MenuItem {
|
||||
this.element = element;
|
||||
|
||||
// Set class and style
|
||||
// goog-menuitem* is deprecated, use blocklyMenuItem*. May 2020.
|
||||
element.className =
|
||||
'blocklyMenuItem goog-menuitem ' +
|
||||
(this.enabled ? '' : 'blocklyMenuItemDisabled goog-menuitem-disabled ') +
|
||||
(this.checked ? 'blocklyMenuItemSelected goog-option-selected ' : '') +
|
||||
(this.highlight
|
||||
? 'blocklyMenuItemHighlight goog-menuitem-highlight '
|
||||
: '') +
|
||||
(this.rightToLeft ? 'blocklyMenuItemRtl goog-menuitem-rtl ' : '');
|
||||
'blocklyMenuItem ' +
|
||||
(this.enabled ? '' : 'blocklyMenuItemDisabled ') +
|
||||
(this.checked ? 'blocklyMenuItemSelected ' : '') +
|
||||
(this.highlight ? 'blocklyMenuItemHighlight ' : '') +
|
||||
(this.rightToLeft ? 'blocklyMenuItemRtl ' : '');
|
||||
|
||||
const content = document.createElement('div');
|
||||
content.className = 'blocklyMenuItemContent goog-menuitem-content';
|
||||
content.className = 'blocklyMenuItemContent';
|
||||
// Add a checkbox for checkable menu items.
|
||||
if (this.checkable) {
|
||||
const checkbox = document.createElement('div');
|
||||
checkbox.className = 'blocklyMenuItemCheckbox goog-menuitem-checkbox';
|
||||
checkbox.className = 'blocklyMenuItemCheckbox ';
|
||||
content.appendChild(checkbox);
|
||||
}
|
||||
|
||||
@@ -188,19 +185,13 @@ export class MenuItem {
|
||||
*/
|
||||
setHighlighted(highlight: boolean) {
|
||||
this.highlight = highlight;
|
||||
|
||||
const el = this.getElement();
|
||||
if (el && this.isEnabled()) {
|
||||
// goog-menuitem-highlight is deprecated, use blocklyMenuItemHighlight.
|
||||
// May 2020.
|
||||
const name = 'blocklyMenuItemHighlight';
|
||||
const nameDep = 'goog-menuitem-highlight';
|
||||
if (highlight) {
|
||||
dom.addClass(el, name);
|
||||
dom.addClass(el, nameDep);
|
||||
} else {
|
||||
dom.removeClass(el, name);
|
||||
dom.removeClass(el, nameDep);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user