Skip to content

Commit 4841905

Browse files
authored
ux(edit-ing): set ignoreFocusOut to true for quick-input (#95)
1 parent 58fd929 commit 4841905

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

src/commands/ing/comment-ing.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export class CommentIngCommandHandler extends CommandHandler {
3030
this._ingContent.length > maxIngContentLength ? '...' : ''
3131
}`,
3232
prompt: this._atUser ? `@${this._atUser.displayName}` : '',
33+
ignoreFocusOut: true,
3334
});
3435
this._content = input || '';
3536
const { id: atUserId, displayName: atUserAlias } = this._atUser ?? {};

src/commands/ing/publish-ing.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export class PublishIngCommandHandler extends CommandHandler {
2020
prompt: '你在做什么? 你在想什么?',
2121
totalSteps: Object.keys(this.inputStep).length,
2222
step: this.currentStep,
23+
ignoreFocusOut: true,
2324
validateInput: v => Promise.resolve(v.length > 2000 ? '最多输入2000个字符' : undefined),
2425
shouldResume: () => Promise.resolve(false),
2526
});
@@ -42,6 +43,7 @@ export class PublishIngCommandHandler extends CommandHandler {
4243
items: items,
4344
activeItems: activeItem,
4445
canSelectMany: false,
46+
ignoreFocusOut: true,
4547
shouldResume: () => Promise.resolve(false),
4648
});
4749
if (result && result.value != null) this.inputIsPrivate = result.value;
@@ -57,6 +59,7 @@ export class PublishIngCommandHandler extends CommandHandler {
5759
prompt: '输入标签, 以 "," 分隔',
5860
validateInput: () => Promise.resolve(undefined),
5961
value: this.inputTags.join(', '),
62+
ignoreFocusOut: true,
6063
});
6164
this.inputTags = value
6265
.split(/, ?/)

src/services/multi-step-input.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export interface QuickPickParameters<T extends QuickPickItem> {
3131
placeholder: string;
3232
buttons?: QuickInputButton[];
3333
canSelectMany: boolean;
34+
ignoreFocusOut?: boolean;
3435
shouldResume: () => Thenable<boolean>;
3536
onValueChange?: (input: QuickPick<T>) => Thenable<void>;
3637
onSelectionChange?: (input: QuickPick<T>) => Thenable<void>;
@@ -65,6 +66,7 @@ export class MultiStepInput {
6566
shouldResume,
6667
onValueChange,
6768
onSelectionChange,
69+
ignoreFocusOut: ignoreFocusout,
6870
}: TParameters) {
6971
const disposables: Disposable[] = [];
7072
try {
@@ -83,6 +85,7 @@ export class MultiStepInput {
8385
input.selectedItems = activeItems;
8486
}
8587
input.buttons = [...(this.steps.length > 1 ? [QuickInputButtons.Back] : []), ...(buttons || [])];
88+
input.ignoreFocusOut = ignoreFocusout ?? false;
8689
disposables.push(
8790
input.onDidTriggerButton(item => {
8891
if (item === QuickInputButtons.Back) reject(InputFlowAction.back);
@@ -126,6 +129,7 @@ export class MultiStepInput {
126129
shouldResume,
127130
placeHolder,
128131
password,
132+
ignoreFocusOut,
129133
}: TParameters): Promise<string | (TParameters extends { buttons: any[] } ? QuickInputButton : string)> {
130134
const disposables: Disposable[] = [];
131135
try {
@@ -138,6 +142,7 @@ export class MultiStepInput {
138142
input.totalSteps = totalSteps;
139143
input.value = value || '';
140144
input.prompt = prompt;
145+
input.ignoreFocusOut = ignoreFocusOut ?? false;
141146
input.buttons = [...(this.steps.length > 1 ? [QuickInputButtons.Back] : []), ...(buttons || [])];
142147
let validating = validateInput('');
143148
disposables.push(

0 commit comments

Comments
 (0)