mirror of
https://github.com/google/blockly.git
synced 2026-01-07 09:00:11 +01:00
fix: adding and removing css classes that contained spaces (#6455)
* fix: adding CSS classes * fix: removing css classes * fix: add a test for multiple icon classes * chore: format
This commit is contained in:
@@ -18,6 +18,7 @@ import './events/events_block_change.js';
|
||||
import type {BlockSvg} from './block_svg.js';
|
||||
import * as browserEvents from './browser_events.js';
|
||||
import * as dialog from './dialog.js';
|
||||
import * as dom from './utils/dom.js';
|
||||
import * as dropDownDiv from './dropdowndiv.js';
|
||||
import * as eventUtils from './events/utils.js';
|
||||
import {FieldConfig, Field} from './field.js';
|
||||
@@ -244,10 +245,10 @@ export class FieldTextInput extends Field {
|
||||
this.resizeEditor_();
|
||||
const htmlInput = this.htmlInput_ as HTMLElement;
|
||||
if (!this.isTextValid_) {
|
||||
htmlInput.classList.add('blocklyInvalidInput');
|
||||
dom.addClass(htmlInput, 'blocklyInvalidInput');
|
||||
aria.setState(htmlInput, aria.State.INVALID, true);
|
||||
} else {
|
||||
htmlInput.classList.remove('blocklyInvalidInput');
|
||||
dom.removeClass(htmlInput, 'blocklyInvalidInput');
|
||||
aria.setState(htmlInput, aria.State.INVALID, false);
|
||||
}
|
||||
}
|
||||
@@ -331,7 +332,7 @@ export class FieldTextInput extends Field {
|
||||
eventUtils.setGroup(true);
|
||||
const div = WidgetDiv.getDiv();
|
||||
|
||||
this.getClickTarget_().classList.add('editing');
|
||||
dom.addClass(this.getClickTarget_(), 'editing');
|
||||
|
||||
const htmlInput = (document.createElement('input'));
|
||||
htmlInput.className = 'blocklyHtmlInput';
|
||||
@@ -400,7 +401,7 @@ export class FieldTextInput extends Field {
|
||||
style.boxShadow = '';
|
||||
this.htmlInput_ = null;
|
||||
|
||||
this.getClickTarget_().classList.remove('editing');
|
||||
dom.removeClass(this.getClickTarget_(), 'editing');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user