提交 c432bc46 编写于 作者: J Joao Moreno

scm: move placeholder format to the outside

上级 0a42516d
......@@ -470,7 +470,7 @@ export class Repository implements Disposable {
onRelevantGitChange(this._onDidChangeRepository.fire, this._onDidChangeRepository, this.disposables);
this._sourceControl = scm.createSourceControl('git', 'Git', Uri.file(repository.root));
this._sourceControl.inputBox.placeholder = localize('commitMessage', "Message (press {0} to commit)", process.platform === 'darwin' ? 'Cmd+Enter' : 'Ctrl+Enter');
this._sourceControl.inputBox.placeholder = localize('commitMessage', "Message (press {0} to commit)");
this._sourceControl.acceptInputCommand = { command: 'git.commitWithInput', title: localize('commit', "Commit"), arguments: [this._sourceControl] };
this._sourceControl.quickDiffProvider = this;
this.disposables.push(this._sourceControl);
......
......@@ -52,6 +52,8 @@ import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
import { Command } from 'vs/editor/common/modes';
import { render as renderOcticons } from 'vs/base/browser/ui/octiconLabel/octiconLabel';
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
import * as platform from 'vs/base/common/platform';
import { format } from 'vs/base/common/strings';
// TODO@Joao
// Need to subclass MenuItemActionItem in order to respect
......@@ -565,17 +567,22 @@ export class RepositoryPanel extends ViewletPanel {
// Input
this.inputBoxContainer = append(container, $('.scm-editor'));
this.inputBox = new InputBox(this.inputBoxContainer, this.contextViewService, {
flexibleHeight: true
});
const updatePlaceholder = () => {
const placeholder = format(this.repository.input.placeholder, platform.isMacintosh ? 'Cmd+Enter' : 'Ctrl+Enter');
this.inputBox.setPlaceHolder(placeholder);
};
this.inputBox = new InputBox(this.inputBoxContainer, this.contextViewService, { flexibleHeight: true });
this.disposables.push(attachInputBoxStyler(this.inputBox, this.themeService));
this.disposables.push(this.inputBox);
this.inputBox.value = this.repository.input.value;
this.inputBox.setPlaceHolder(this.repository.input.placeholder);
this.inputBox.onDidChange(value => this.repository.input.value = value, null, this.disposables);
this.repository.input.onDidChange(value => this.inputBox.value = value, null, this.disposables);
this.repository.input.onDidChangePlaceholder(placeholder => this.inputBox.setPlaceHolder(placeholder), null, this.disposables);
updatePlaceholder();
this.repository.input.onDidChangePlaceholder(updatePlaceholder, null, this.disposables);
this.disposables.push(this.inputBox.onDidHeightChange(() => this.layoutBody()));
chain(domEvent(this.inputBox.inputElement, 'keydown'))
......
......@@ -79,7 +79,7 @@ export interface ISCMProvider extends IDisposable {
export interface ISCMInput {
value: string;
readonly onDidChange: Event<string>;
placeholder: string;
readonly placeholder: string;
readonly onDidChangePlaceholder: Event<string>;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册