Skip to content

Commit 19d01dd

Browse files
committed
Remove builder from comments part. microsoft#57196.
1 parent ca7a20d commit 19d01dd

1 file changed

Lines changed: 20 additions & 22 deletions

File tree

src/vs/workbench/parts/comments/electron-browser/commentThreadWidget.ts

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
'use strict';
66

77
import * as nls from 'vs/nls';
8-
import { $ } from 'vs/base/browser/builder';
98
import * as dom from 'vs/base/browser/dom';
109
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
1110
import { Button } from 'vs/base/browser/ui/button/button';
@@ -15,6 +14,7 @@ import { Color } from 'vs/base/common/color';
1514
import { Emitter, Event } from 'vs/base/common/event';
1615
import { IDisposable } from 'vs/base/common/lifecycle';
1716
import * as platform from 'vs/base/common/platform';
17+
import * as strings from 'vs/base/common/strings';
1818
import { ICodeEditor, IEditorMouseEvent, MouseTargetType } from 'vs/editor/browser/editorBrowser';
1919
import * as modes from 'vs/editor/common/modes';
2020
import { peekViewBorder } from 'vs/editor/contrib/referenceSearch/referencesWidget';
@@ -57,17 +57,17 @@ export class CommentNode {
5757
public comment: modes.Comment,
5858
private markdownRenderer: MarkdownRenderer,
5959
) {
60-
this._domNode = $('div.review-comment').getHTMLElement();
60+
this._domNode = dom.$('div.review-comment');
6161
this._domNode.tabIndex = 0;
62-
let avatar = $('div.avatar-container').appendTo(this._domNode).getHTMLElement();
63-
let img = <HTMLImageElement>$('img.avatar').appendTo(avatar).getHTMLElement();
62+
let avatar = dom.append(this._domNode, dom.$('div.avatar-container'));
63+
let img = <HTMLImageElement>dom.append(avatar, dom.$('img.avatar'));
6464
img.src = comment.gravatar;
65-
let commentDetailsContainer = $('.review-comment-contents').appendTo(this._domNode).getHTMLElement();
65+
let commentDetailsContainer = dom.append(this._domNode, dom.$('.review-comment-contents'));
6666

67-
let header = $('div').appendTo(commentDetailsContainer).getHTMLElement();
68-
let author = $('strong.author').appendTo(header).getHTMLElement();
67+
let header = dom.append(commentDetailsContainer, dom.$('div'));
68+
let author = dom.append(header, dom.$('strong.author'));
6969
author.innerText = comment.userName;
70-
this._body = $('div.comment-body').appendTo(commentDetailsContainer).getHTMLElement();
70+
this._body = dom.append(commentDetailsContainer, dom.$('div.comment-body'));
7171
this._md = this.markdownRenderer.render(comment.body).element;
7272
this._body.appendChild(this._md);
7373

@@ -197,24 +197,22 @@ export class ReviewZoneWidget extends ZoneWidget {
197197

198198
protected _fillContainer(container: HTMLElement): void {
199199
this.setCssClass('review-widget');
200-
this._headElement = <HTMLDivElement>$('.head').getHTMLElement();
200+
this._headElement = <HTMLDivElement>dom.$('.head');
201201
container.appendChild(this._headElement);
202202
this._fillHead(this._headElement);
203203

204-
this._bodyElement = <HTMLDivElement>$('.body').getHTMLElement();
204+
this._bodyElement = <HTMLDivElement>dom.$('.body');
205205
container.appendChild(this._bodyElement);
206206
}
207207

208208
protected _fillHead(container: HTMLElement): void {
209-
var titleElement = $('.review-title').
210-
appendTo(this._headElement).
211-
getHTMLElement();
209+
var titleElement = dom.append(this._headElement, dom.$('.review-title'));
212210

213-
this._headingLabel = $('span.filename').appendTo(titleElement).getHTMLElement();
211+
this._headingLabel = dom.append(titleElement, dom.$('span.filename'));
214212
this.createThreadLabel();
215213

216-
const actionsContainer = $('.review-actions').appendTo(this._headElement);
217-
this._actionbarWidget = new ActionBar(actionsContainer.getHTMLElement(), {});
214+
const actionsContainer = dom.append(this._headElement, dom.$('.review-actions'));
215+
this._actionbarWidget = new ActionBar(actionsContainer, {});
218216
this._disposables.push(this._actionbarWidget);
219217

220218
this._toggleAction = new Action('review.expand', nls.localize('label.collapse', "Collapse"), this._isCollapsed ? EXPAND_ACTION_CLASS : COLLAPSE_ACTION_CLASS, true, () => {
@@ -306,7 +304,7 @@ export class ReviewZoneWidget extends ZoneWidget {
306304
this._headElement.style.height = `${headHeight}px`;
307305
this._headElement.style.lineHeight = this._headElement.style.height;
308306

309-
this._commentsElement = $('div.comments-container').appendTo(this._bodyElement).getHTMLElement();
307+
this._commentsElement = dom.append(this._bodyElement, dom.$('div.comments-container'));
310308
this._commentsElement.setAttribute('role', 'presentation');
311309

312310
this._commentElements = [];
@@ -317,7 +315,7 @@ export class ReviewZoneWidget extends ZoneWidget {
317315
}
318316

319317
const hasExistingComments = this._commentThread.comments.length > 0;
320-
this._commentForm = $('.comment-form').appendTo(this._bodyElement).getHTMLElement();
318+
this._commentForm = dom.append(this._bodyElement, dom.$('.comment-form'));
321319
this._commentEditor = this.instantiationService.createInstance(SimpleCommentEditor, this._commentForm, SimpleCommentEditor.getEditorOptions());
322320
const modeId = hasExistingComments ? this._commentThread.threadId : ++INMEM_MODEL_ID;
323321
const resource = URI.parse(`${COMMENT_SCHEME}:commentinput-${modeId}.md`);
@@ -358,9 +356,9 @@ export class ReviewZoneWidget extends ZoneWidget {
358356
}
359357
}));
360358

361-
this._error = $('.validation-error.hidden').appendTo(this._commentForm).getHTMLElement();
359+
this._error = dom.append(this._commentForm, dom.$('.validation-error.hidden'));
362360

363-
const formActions = $('.form-actions').appendTo(this._commentForm).getHTMLElement();
361+
const formActions = dom.append(this._commentForm, dom.$('.form-actions'));
364362

365363
const button = new Button(formActions);
366364
attachButtonStyler(button, this.themeService);
@@ -457,12 +455,12 @@ export class ReviewZoneWidget extends ZoneWidget {
457455
label = nls.localize('startThread', "Start discussion");
458456
}
459457

460-
$(this._headingLabel).safeInnerHtml(label);
458+
this._headingLabel.innerHTML = strings.escape(label);
461459
this._headingLabel.setAttribute('aria-label', label);
462460
}
463461

464462
private createReplyButton() {
465-
this._reviewThreadReplyButton = <HTMLButtonElement>$('button.review-thread-reply-button').appendTo(this._commentForm).getHTMLElement();
463+
this._reviewThreadReplyButton = <HTMLButtonElement>dom.append(this._commentForm, dom.$('button.review-thread-reply-button'));
466464
this._reviewThreadReplyButton.title = nls.localize('reply', "Reply...");
467465
this._reviewThreadReplyButton.textContent = nls.localize('reply', "Reply...");
468466
// bind click/escape actions for reviewThreadReplyButton and textArea

0 commit comments

Comments
 (0)