fix: Save title change immediately on field blur

closes #3374
This commit is contained in:
Tom Moor
2022-04-13 16:26:22 -07:00
parent 9e08717d25
commit 7f58fbe71b
2 changed files with 9 additions and 0 deletions

View File

@@ -29,6 +29,8 @@ type Props = {
onGoToNextInput: (insertParagraph?: boolean) => void;
/** Callback called when the user expects to save (CMD+S) */
onSave?: (options: { publish?: boolean; done?: boolean }) => void;
/** Callback called when focus leaves the input */
onBlur?: React.FocusEventHandler<HTMLSpanElement>;
};
const lineHeight = "1.25";
@@ -43,6 +45,7 @@ const EditableTitle = React.forwardRef(
onChange,
onSave,
onGoToNextInput,
onBlur,
starrable,
placeholder,
}: Props,
@@ -123,6 +126,7 @@ const EditableTitle = React.forwardRef(
onClick={handleClick}
onChange={handleChange}
onKeyDown={handleKeyDown}
onBlur={onBlur}
placeholder={placeholder}
value={normalizedTitle}
$emojiWidth={emojiWidth}