From a9b8f6f4d588d7b355717beaf00bee658c77a85a Mon Sep 17 00:00:00 2001
From: Ajay Bura <32841439+ajbura@users.noreply.github.com>
Date: Sat, 21 Oct 2023 12:15:02 +0530
Subject: [PATCH] exit formatting with escape

---
 src/app/components/editor/Toolbar.tsx | 4 +++-
 src/app/components/editor/keyboard.ts | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/app/components/editor/Toolbar.tsx b/src/app/components/editor/Toolbar.tsx
index 736fdafa..766a1d83 100644
--- a/src/app/components/editor/Toolbar.tsx
+++ b/src/app/components/editor/Toolbar.tsx
@@ -285,7 +285,9 @@ export function Toolbar() {
               <Line variant="SurfaceVariant" direction="Vertical" style={{ height: toRem(12) }} />
               <Box shrink="No" gap="100">
                 <ExitFormatting
-                  tooltip={<BtnTooltip text="Exit Formatting" shortCode={`${modKey} + E`} />}
+                  tooltip={
+                    <BtnTooltip text="Exit Formatting" shortCode={`Escape, ${modKey} + E`} />
+                  }
                 />
               </Box>
             </>
diff --git a/src/app/components/editor/keyboard.ts b/src/app/components/editor/keyboard.ts
index 0bcd3698..7031749e 100644
--- a/src/app/components/editor/keyboard.ts
+++ b/src/app/components/editor/keyboard.ts
@@ -55,7 +55,7 @@ export const toggleKeyboardShortcut = (editor: Editor, event: KeyboardEvent<Elem
     }
   }
 
-  if (isKeyHotkey('mod+e', event)) {
+  if (isKeyHotkey('mod+e', event) || isKeyHotkey('escape', event)) {
     if (isAnyMarkActive(editor)) {
       removeAllMark(editor);
       return true;