fix(board): unable to create by clicking outside

This commit is contained in:
Elian Doran 2025-09-22 18:52:41 +03:00
parent 94e20c44e5
commit 3b06845a71
No known key found for this signature in database

View File

@ -228,7 +228,7 @@ export function TitleEditor({ currentValue, placeholder, save, dismiss, multilin
}) {
const inputRef = useRef<any>(null);
const dismissOnNextRefreshRef = useRef(false);
const shouldSave = useRef(false);
const shouldDismiss = useRef(false);
useEffect(() => {
inputRef.current?.focus();
@ -254,12 +254,12 @@ export function TitleEditor({ currentValue, placeholder, save, dismiss, multilin
onKeyDown={(e: TargetedKeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => {
if (e.key === "Enter" || e.key === "Escape") {
e.preventDefault();
shouldSave.current = (e.key === "Enter");
shouldDismiss.current = (e.key === "Escape");
e.currentTarget.blur();
}
}}
onBlur={(newValue) => {
if (shouldSave.current && newValue.trim() && (newValue !== currentValue || isNewItem)) {
if (!shouldDismiss.current && newValue.trim() && (newValue !== currentValue || isNewItem)) {
save(newValue);
dismissOnNextRefreshRef.current = true;
} else {