onKeyDown to reject events except from canvas

This commit is contained in:
Zsolt Viczian
2021-10-10 18:10:35 +02:00
parent 3bbff7f8d5
commit 1917dad8cd

View File

@@ -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();