Cursor should remain at the start and title should remain editable (#5199)

This commit is contained in:
Apoorv Mishra
2023-04-15 02:36:53 +05:30
committed by GitHub
parent 169a99f21e
commit 138c3f1ebe

View File

@@ -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) {