提交 ae5ecf9e 编写于 作者: R Rob Lourens

Remove deprecated API usage from search #103454

上级 979f9f73
......@@ -138,7 +138,7 @@ export class PatternInputWidget extends Widget implements IThemable {
private render(options: IOptions): void {
this.domNode = document.createElement('div');
this.domNode.style.width = this.width + 'px';
dom.addClass(this.domNode, 'monaco-findInput');
this.domNode.classList.add('monaco-findInput');
this.inputBox = new ContextScopedHistoryInputBox(this.domNode, this.contextViewProvider, {
placeholder: this.placeholder || '',
......
......@@ -225,7 +225,7 @@ export class MatchRenderer extends Disposable implements ITreeRenderer<Match, vo
}
renderTemplate(container: HTMLElement): IMatchTemplate {
DOM.addClass(container, 'linematch');
container.classList.add('linematch');
const parent = DOM.append(container, DOM.$('a.plain.match'));
const before = DOM.append(parent, DOM.$('span'));
......@@ -254,7 +254,7 @@ export class MatchRenderer extends Disposable implements ITreeRenderer<Match, vo
templateData.before.textContent = preview.before;
templateData.match.textContent = preview.inside;
DOM.toggleClass(templateData.match, 'replace', replace);
templateData.match.classList.toggle('replace', replace);
templateData.replace.textContent = replace ? match.replaceString : '';
templateData.after.textContent = preview.after;
templateData.parent.title = (preview.before + (replace ? match.replaceString : preview.inside) + preview.after).trim().substr(0, 999);
......@@ -264,7 +264,7 @@ export class MatchRenderer extends Disposable implements ITreeRenderer<Match, vo
const showLineNumbers = this.configurationService.getValue<ISearchConfigurationProperties>('search').showLineNumbers;
const lineNumberStr = showLineNumbers ? `:${match.range().startLineNumber}` : '';
DOM.toggleClass(templateData.lineNumber, 'show', (numLines > 0) || showLineNumbers);
templateData.lineNumber.classList.toggle('show', (numLines > 0) || showLineNumbers);
templateData.lineNumber.textContent = lineNumberStr + extraLinesStr;
templateData.lineNumber.setAttribute('title', this.getMatchTitle(match, showLineNumbers));
......
......@@ -988,7 +988,7 @@ export class SearchView extends ViewPane {
}
const actionsPosition = this.searchConfig.actionsPosition;
dom.toggleClass(this.getContainer(), SearchView.ACTIONS_RIGHT_CLASS_NAME, actionsPosition === 'right');
this.getContainer().classList.toggle(SearchView.ACTIONS_RIGHT_CLASS_NAME, actionsPosition === 'right');
this.searchWidget.setWidth(this.size.width - 28 /* container margin */);
......
......@@ -293,7 +293,7 @@ export class SearchWidget extends Widget {
};
this.toggleReplaceButton = this._register(new Button(parent, opts));
this.toggleReplaceButton.element.setAttribute('aria-expanded', 'false');
dom.addClasses(this.toggleReplaceButton.element, searchHideReplaceIcon.classNames);
this.toggleReplaceButton.element.classList.add(...searchHideReplaceIcon.classNamesArray);
this.toggleReplaceButton.icon = 'toggle-replace-button';
// TODO@joh need to dispose this listener eventually
this.toggleReplaceButton.onDidClick(() => this.onToggleReplaceButton());
......@@ -356,7 +356,7 @@ export class SearchWidget extends Widget {
if (options.showContextToggle) {
this.contextLinesInput = new InputBox(searchInputContainer, this.contextViewService, { type: 'number' });
dom.addClass(this.contextLinesInput.element, 'context-lines-input');
this.contextLinesInput.element.classList.add('context-lines-input');
this.contextLinesInput.value = '' + (this.configurationService.getValue<ISearchConfigurationProperties>('search').searchEditor.defaultNumberOfContextLines ?? 1);
this._register(this.contextLinesInput.onDidChange(() => this.onContextLinesChanged()));
this._register(attachInputBoxStyler(this.contextLinesInput, this.themeService));
......@@ -365,7 +365,7 @@ export class SearchWidget extends Widget {
}
private onContextLinesChanged() {
dom.toggleClass(this.domNode, 'show-context', this.showContextCheckbox.checked);
this.domNode.classList.toggle('show-context', this.showContextCheckbox.checked);
this._onDidToggleContext.fire();
if (this.contextLinesInput.value.includes('-')) {
......@@ -383,7 +383,7 @@ export class SearchWidget extends Widget {
this.showContextCheckbox.checked = true;
this.contextLinesInput.value = '' + lines;
}
dom.toggleClass(this.domNode, 'show-context', this.showContextCheckbox.checked);
this.domNode.classList.toggle('show-context', this.showContextCheckbox.checked);
}
private renderReplaceInput(parent: HTMLElement, options: ISearchWidgetOptions): void {
......@@ -429,13 +429,13 @@ export class SearchWidget extends Widget {
}
private onToggleReplaceButton(): void {
dom.toggleClass(this.replaceContainer, 'disabled');
this.replaceContainer.classList.toggle('disabled');
if (this.isReplaceShown()) {
dom.removeClasses(this.toggleReplaceButton.element, searchHideReplaceIcon.classNames);
dom.addClasses(this.toggleReplaceButton.element, searchShowReplaceIcon.classNames);
this.toggleReplaceButton.element.classList.remove(...searchHideReplaceIcon.classNamesArray);
this.toggleReplaceButton.element.classList.add(...searchShowReplaceIcon.classNamesArray);
} else {
dom.removeClasses(this.toggleReplaceButton.element, searchShowReplaceIcon.classNames);
dom.addClasses(this.toggleReplaceButton.element, searchHideReplaceIcon.classNames);
this.toggleReplaceButton.element.classList.remove(...searchShowReplaceIcon.classNamesArray);
this.toggleReplaceButton.element.classList.add(...searchHideReplaceIcon.classNamesArray);
}
this.toggleReplaceButton.element.setAttribute('aria-expanded', this.isReplaceShown() ? 'true' : 'false');
this.updateReplaceActiveState();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册