From f0e6f4dbb86d5d6bf1fe53731ad089eabf68ade9 Mon Sep 17 00:00:00 2001 From: David Luzar Date: Thu, 12 Mar 2020 18:04:56 +0100 Subject: [PATCH] Text esc fixes (#925) * fix incorrectly resetting state on esc * confirm text on esc --- src/actions/actionFinalize.tsx | 1 + src/element/textWysiwyg.tsx | 8 +------- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/actions/actionFinalize.tsx b/src/actions/actionFinalize.tsx index 503f946c..e82c4c5e 100644 --- a/src/actions/actionFinalize.tsx +++ b/src/actions/actionFinalize.tsx @@ -47,6 +47,7 @@ export const actionFinalize = register({ : "selection", draggingElement: null, multiElement: null, + editingElement: null, selectedElementIds: {}, }, }; diff --git a/src/element/textWysiwyg.tsx b/src/element/textWysiwyg.tsx index 26e6fcf7..fe44a16e 100644 --- a/src/element/textWysiwyg.tsx +++ b/src/element/textWysiwyg.tsx @@ -92,13 +92,7 @@ export function textWysiwyg({ editable.onkeydown = ev => { if (ev.key === KEYS.ESCAPE) { ev.preventDefault(); - if (initText) { - editable.innerText = initText; - handleSubmit(); - return; - } - cleanup(); - return; + handleSubmit(); } if (ev.key === KEYS.ENTER && !ev.shiftKey) { ev.preventDefault();