From 1917dad8cd0ceee96075521ab5d89c9abcfce76a Mon Sep 17 00:00:00 2001 From: Zsolt Viczian Date: Sun, 10 Oct 2021 18:10:35 +0200 Subject: [PATCH] onKeyDown to reject events except from canvas --- src/ExcalidrawView.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ExcalidrawView.ts b/src/ExcalidrawView.ts index 1300be1..1f29c25 100644 --- a/src/ExcalidrawView.ts +++ b/src/ExcalidrawView.ts @@ -752,6 +752,8 @@ export default class ExcalidrawView extends TextFileView { key: "abc", tabIndex: 0, onKeyDown: (e:any) => { + //@ts-ignore + if(e.target === excalidrawDiv.ref.current) return; //event should originate from the canvas if(document.fullscreenEnabled && document.fullscreenElement == this.contentEl && e.keyCode==27) { document.exitFullscreen(); this.zoomToFit();