提交 8584f9df 编写于 作者: S Sandeep Somavarapu

#18095 Keybindings Editor

- Do not navigate by Enter from search box
上级 905db5d2
......@@ -194,7 +194,8 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
this.headerContainer = DOM.append(parent, $('.keybindings-header'));
this.searchWidget = this._register(this.instantiationService.createInstance(SearchWidget, DOM.append(this.headerContainer, $('.search-container')), {
ariaLabel: localize('SearchKeybindings.AriaLabel', "Search keybindings"),
placeholder: localize('SearchKeybindings.Placeholder', "Search keybindings")
placeholder: localize('SearchKeybindings.Placeholder', "Search keybindings"),
navigateByArrows: true
}));
this._register(this.searchWidget.onDidChange(searchValue => this.delayedFiltering.trigger(() => this.render())));
this._register(this.searchWidget.onNavigate(back => this._onNavigate(back)));
......
......@@ -125,7 +125,9 @@ export class PreferencesEditor extends BaseEditor {
this.searchWidget = this._register(this.instantiationService.createInstance(SearchWidget, this.headerContainer, {
ariaLabel: nls.localize('SearchSettingsWidget.AriaLabel', "Search settings"),
placeholder: nls.localize('SearchSettingsWidget.Placeholder', "Search Settings")
placeholder: nls.localize('SearchSettingsWidget.Placeholder', "Search Settings"),
navigateByArrows: true,
navigateByEnter: true
}));
this._register(this.searchWidget.onDidChange(value => this.filterPreferences(value.trim())));
this._register(this.searchWidget.onNavigate(shift => this.preferencesRenderers.focusNextPreference(!shift)));
......
......@@ -224,6 +224,11 @@ export class SettingsTabsWidget extends Widget {
}
}
export interface SearchOptions extends IInputOptions {
navigateByEnter?: boolean;
navigateByArrows?: boolean;
}
export class SearchWidget extends Widget {
public domNode: HTMLElement;
......@@ -238,7 +243,7 @@ export class SearchWidget extends Widget {
private _onNavigate = this._register(new Emitter<boolean>());
public onNavigate: Event<boolean> = this._onNavigate.event;
constructor(parent: HTMLElement, protected options: IInputOptions,
constructor(parent: HTMLElement, protected options: SearchOptions,
@IContextViewService private contextViewService: IContextViewService,
@IContextMenuService private contextMenuService: IContextMenuService,
@IInstantiationService protected instantiationService: IInstantiationService
......@@ -299,15 +304,21 @@ export class SearchWidget extends Widget {
let handled = false;
switch (keyboardEvent.keyCode) {
case KeyCode.Enter:
this._onNavigate.fire(keyboardEvent.shiftKey);
handled = true;
if (this.options.navigateByEnter) {
this._onNavigate.fire(keyboardEvent.shiftKey);
handled = true;
}
break;
case KeyCode.UpArrow:
this._onNavigate.fire(true);
if (this.options.navigateByArrows) {
this._onNavigate.fire(true);
}
handled = true;
break;
case KeyCode.DownArrow:
this._onNavigate.fire(false);
if (this.options.navigateByArrows) {
this._onNavigate.fire(false);
}
handled = true;
break;
case KeyCode.Escape:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册