style(collections/board): better new item that creates only after enter

This commit is contained in:
Elian Doran
2025-09-12 16:57:23 +03:00
parent e99748e45f
commit ede4b99bcd
4 changed files with 45 additions and 17 deletions

View File

@@ -257,11 +257,12 @@ function AddNewColumn({ viewConfig, saveConfig }: { viewConfig?: BoardViewData,
)
}
export function TitleEditor({ currentValue, save, dismiss, multiline }: {
export function TitleEditor({ currentValue, save, dismiss, multiline, isNewItem }: {
currentValue: string,
save: (newValue: string) => void,
dismiss: () => void,
multiline?: boolean
multiline?: boolean,
isNewItem?: boolean
}) {
const inputRef = useRef<any>(null);
@@ -280,7 +281,7 @@ export function TitleEditor({ currentValue, save, dismiss, multiline }: {
onKeyDown={(e) => {
if (e.key === "Enter") {
const newValue = e.currentTarget.value;
if (newValue !== currentValue) {
if (newValue !== currentValue || isNewItem) {
save(newValue);
}
dismiss();