Fix actionbar trigger key handling (#15488)

* Fix actionbar trigger key handling

* fix compile error
This commit is contained in:
Charles Gagnon
2021-05-14 16:31:15 -07:00
committed by GitHub
parent c6a8b80ce5
commit c54f991e60
2 changed files with 11 additions and 16 deletions

View File

@@ -22,7 +22,6 @@ import { InputBox } from 'sql/base/browser/ui/inputBox/inputBox';
import { attachCalloutDialogStyler } from 'sql/workbench/common/styler';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { escapeLabel, escapeUrl } from 'sql/workbench/contrib/notebook/browser/calloutDialog/common/utils';
import { KeyCode } from 'vs/base/common/keyCodes';
export interface ILinkCalloutDialogOptions {
insertTitle?: string,
@@ -101,13 +100,6 @@ export class LinkCalloutDialog extends Modal {
}
protected renderBody(container: HTMLElement) {
this._register(DOM.addDisposableListener(document, DOM.EventType.KEY_UP, (e: KeyboardEvent) => {
let event = new StandardKeyboardEvent(e);
if (event.equals(KeyCode.Enter)) {
DOM.EventHelper.stop(e, true);
this.hide('ok');
}
}));
let linkContentColumn = DOM.$('.column.insert-link');
DOM.append(container, linkContentColumn);
@@ -155,8 +147,7 @@ export class LinkCalloutDialog extends Modal {
protected onAccept(e?: StandardKeyboardEvent) {
// EventHelper.stop() will call preventDefault. Without it, text cell will insert an extra newline when pressing enter on dialog
DOM.EventHelper.stop(e, true);
const keyboardEventExists = !!e;
this.insert(keyboardEventExists);
this.insert();
}
protected onClose(e?: StandardKeyboardEvent) {
@@ -164,10 +155,8 @@ export class LinkCalloutDialog extends Modal {
this.cancel();
}
public insert(willHideByKeyboardEvent = false): void {
if (!willHideByKeyboardEvent) {
this.hide('ok');
}
public insert(): void {
this.hide('ok');
let escapedLabel = escapeLabel(this._linkTextInputBox.value);
let escapedUrl = escapeUrl(this._linkUrlInputBox.value);