提交 505f4b37 编写于 作者: R Rachel Macfarlane

Disable add comment button when textbox is empty, fixes...

Disable add comment button when textbox is empty, fixes https://github.com/Microsoft/vscode-pull-request-github/issues/128
上级 e39b1f07
......@@ -25,7 +25,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { IModelService } from 'vs/editor/common/services/modelService';
import { SimpleCommentEditor } from './simpleCommentEditor';
import URI from 'vs/base/common/uri';
import { transparent, editorForeground, inputValidationErrorBorder, textLinkActiveForeground, textLinkForeground, focusBorder, textBlockQuoteBackground, textBlockQuoteBorder, contrastBorder } from 'vs/platform/theme/common/colorRegistry';
import { transparent, editorForeground, textLinkActiveForeground, textLinkForeground, focusBorder, textBlockQuoteBackground, textBlockQuoteBorder, contrastBorder } from 'vs/platform/theme/common/colorRegistry';
import { IModeService } from 'vs/editor/common/services/modeService';
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { KeyCode } from 'vs/base/common/keyCodes';
......@@ -371,23 +371,17 @@ export class ReviewZoneWidget extends ZoneWidget {
const button = new Button(formActions);
attachButtonStyler(button, this.themeService);
button.label = 'Add comment';
button.onDidClick(async () => {
if (!this._commentEditor.getValue()) {
this._commentEditor.focus();
this._commentEditor.getDomNode().style.outline = `1px solid ${this.themeService.getTheme().getColor(inputValidationErrorBorder)}`;
this._disposables.push(this._commentEditor.onDidChangeModelContent(_ => {
if (!this._commentEditor.getValue()) {
this._commentEditor.getDomNode().style.outline = `1px solid ${this.themeService.getTheme().getColor(inputValidationErrorBorder)}`;
} else {
this._commentEditor.getDomNode().style.outline = '';
}
}));
return;
button.enabled = false;
this._localToDispose.push(this._commentEditor.onDidChangeModelContent(_ => {
if (this._commentEditor.getValue()) {
button.enabled = true;
} else {
button.enabled = false;
}
}));
button.onDidClick(async () => {
let newCommentThread;
if (this._commentThread.threadId) {
// reply
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册