diff --git a/src/common/components/inline-edit/inline-edit.tsx b/src/common/components/inline-edit/inline-edit.tsx index 83bbcf9a..453f593f 100644 --- a/src/common/components/inline-edit/inline-edit.tsx +++ b/src/common/components/inline-edit/inline-edit.tsx @@ -39,7 +39,10 @@ export const EditableComponent: React.FC = props => { }; const handleKeyDown = (event: KeyboardEvent) => { - if (isEditing && event.key === 'Enter') { + if (isEditing && event.key === 'Escape') { + setIsEditing(false); + setEditText(text); + } else if (isEditing && event.key === 'Enter') { setIsEditing(false); onTextSubmit(inputRef.current?.value || ''); } @@ -52,12 +55,12 @@ export const EditableComponent: React.FC = props => { document.addEventListener('keydown', handleKeyDown); } else { document.removeEventListener('mousedown', handleClickOutside); - document.addEventListener('keydown', handleKeyDown); + document.removeEventListener('keydown', handleKeyDown); } return () => { document.removeEventListener('mousedown', handleClickOutside); - document.addEventListener('keydown', handleKeyDown); + document.removeEventListener('keydown', handleKeyDown); }; }, [isEditing]); diff --git a/src/layout/main.layout.module.css b/src/layout/main.layout.module.css index 7da8755d..ddf41acc 100644 --- a/src/layout/main.layout.module.css +++ b/src/layout/main.layout.module.css @@ -1,9 +1,8 @@ .layout { display: grid; - grid-template-columns: minmax(var(--column-min-size), 2fr) minmax( - var(--canvas-min-size), - 8fr - ) minmax(var(--column-min-size), 2fr); + grid-template-columns: + minmax(var(--column-min-size), 2fr) minmax(var(--canvas-min-size), 8fr) + minmax(var(--column-min-size), 2fr); grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: 'toolbar toolbar toolbar'