From 37a29934ec88cb50db4f1497aa7d5f046f4a2888 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sat, 22 Jan 2022 18:25:06 -0800 Subject: [PATCH] fix: Reduce clickable area on star in document header, make entire line clickable to focus title closes #2966 --- app/components/ContentEditable.tsx | 4 +++- app/scenes/Document/components/EditableTitle.tsx | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/components/ContentEditable.tsx b/app/components/ContentEditable.tsx index 1ec8e4d58..86729413a 100644 --- a/app/components/ContentEditable.tsx +++ b/app/components/ContentEditable.tsx @@ -5,6 +5,7 @@ import styled from "styled-components"; type Props = Omit, "ref" | "onChange"> & { disabled?: boolean; readOnly?: boolean; + onClick?: React.MouseEventHandler; onChange?: (text: string) => void; onBlur?: React.FocusEventHandler | undefined; onInput?: React.FormEventHandler | undefined; @@ -36,6 +37,7 @@ const ContentEditable = React.forwardRef( placeholder, readOnly, dir, + onClick, ...rest }: Props, forwardedRef: React.RefObject @@ -80,7 +82,7 @@ const ContentEditable = React.forwardRef( }, [value, ref]); return ( -
+
{ + ref.current?.focus(); + }, [ref]); + const handleKeyDown = React.useCallback( (event: React.KeyboardEvent) => { if (event.key === "Enter") { @@ -112,6 +116,7 @@ const EditableTitle = React.forwardRef( return ( ` border: 0; padding: 0; resize: none; + cursor: text; > span { outline: none;