From 138c3f1ebe2a55dd64f25e2840f9cf9ac02bab46 Mon Sep 17 00:00:00 2001 From: Apoorv Mishra Date: Sat, 15 Apr 2023 02:36:53 +0530 Subject: [PATCH] Cursor should remain at the start and title should remain editable (#5199) --- app/components/ContentEditable.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/components/ContentEditable.tsx b/app/components/ContentEditable.tsx index 7bf75bcba..c0f9dfb2b 100644 --- a/app/components/ContentEditable.tsx +++ b/app/components/ContentEditable.tsx @@ -57,7 +57,13 @@ const ContentEditable = React.forwardRef( React.useImperativeHandle(ref, () => ({ focus: () => { - contentRef.current?.focus(); + if (contentRef.current) { + contentRef.current.focus(); + // looks unnecessary but required because of https://github.com/outline/outline/issues/5198 + if (!contentRef.current.innerText) { + placeCaret(contentRef.current, true); + } + } }, focusAtStart: () => { if (contentRef.current) {