提交 40a80d01 编写于 作者: R Rob Lourens

Fix "can't read 'focus' of undefined' error when resizing settings editor...

Fix "can't read 'focus' of undefined' error when resizing settings editor while exclude 'add' input is visible
上级 26365c89
......@@ -305,6 +305,15 @@ export function timeout(millis: number, token?: CancellationToken): CancelablePr
});
}
export function disposableTimeout(handler: TimerHandler, timeout = 0): IDisposable {
const timer = setTimeout(handler, timeout);
return {
dispose() {
clearTimeout(timer);
}
};
}
/**
* Returns a new promise that joins the provided promise. Upon completion of
* the provided promise the provided function will always be called. This
......
......@@ -19,6 +19,7 @@ import { IContextViewService } from 'vs/platform/contextview/browser/contextView
import { foreground, inputBackground, inputBorder, inputForeground, listActiveSelectionBackground, listActiveSelectionForeground, listHoverBackground, listHoverForeground, listInactiveSelectionBackground, listInactiveSelectionForeground, registerColor, selectBackground, selectBorder, selectForeground, textLinkForeground, textPreformatForeground, editorWidgetBorder } from 'vs/platform/theme/common/colorRegistry';
import { attachButtonStyler, attachInputBoxStyler } from 'vs/platform/theme/common/styler';
import { ICssStyleCollector, ITheme, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { disposableTimeout } from 'vs/base/common/async';
const $ = DOM.$;
export const settingsHeaderForeground = registerColor('settings.headerForeground', { light: '#444444', dark: '#e7e7e7', hc: '#ffffff' }, localize('headerForeground', "(For settings editor preview) The foreground color for a section header or active title."));
......@@ -457,10 +458,11 @@ export class ExcludeSettingWidget extends Disposable {
this.listDisposables.push(attachButtonStyler(cancelButton, this.themeService));
this.listDisposables.push(cancelButton.onDidClick(() => onSubmit(false)));
setTimeout(() => {
patternInput.focus();
patternInput.select();
}, 0);
this.listDisposables.push(
disposableTimeout(() => {
patternInput.focus();
patternInput.select();
}));
return rowElement;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册