Notebook cell and modal fix - follow up after Lucy's 14433. (#14457)

* Modal - added code to stop the keyboard event after it is handled. textCell and codeCell - onKey now fired on keydown.

* Moved stop method into the conditional with Escape key.
This commit is contained in:
Hale Rankin
2021-03-02 12:11:57 -08:00
committed by GitHub
parent 8b34e034fc
commit 3c38e0cc8b
3 changed files with 3 additions and 2 deletions

View File

@@ -472,6 +472,7 @@ export abstract class Modal extends Disposable implements IThemable {
if (event.equals(KeyCode.Enter)) {
this.onAccept(event);
} else if (event.equals(KeyCode.Escape)) {
DOM.EventHelper.stop(e, true);
this.onClose(event);
} else if (event.equals(KeyMod.Shift | KeyCode.Tab)) {
this.handleBackwardTab(e);

View File

@@ -4,7 +4,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
-->
<div style="width: 100%; height: 100%; display: flex; flex-flow: column" (keyup)="onKey($event)">
<div style="width: 100%; height: 100%; display: flex; flex-flow: column" (keydown)="onKey($event)">
<div style="flex: 0 0 auto;">
<code-component [cellModel]="cellModel" [model]="model" [activeCellId]="activeCellId"></code-component>
</div>

View File

@@ -4,7 +4,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
-->
<div style="width: 100%; height: 100%; display: flex; flex-flow: column" (keyup)="onKey($event)" (mouseover)="hover=true" (mouseleave)="hover=false">
<div style="width: 100%; height: 100%; display: flex; flex-flow: column" (keydown)="onKey($event)" (mouseover)="hover=true" (mouseleave)="hover=false">
<markdown-toolbar-component #markdownToolbar *ngIf="isEditMode" [cellModel]="cellModel"></markdown-toolbar-component>
<div class="notebook-text" [class.show-markdown]="markdownMode" [class.show-preview]="previewMode">
<code-component *ngIf="markdownMode" [cellModel]="cellModel" (onContentChanged)="handleContentChanged()" [model]="model" [activeCellId]="activeCellId">