约束可编辑标题不可为空。
This commit is contained in:
parent
f0dcb75b50
commit
df836a9b6d
|
@ -1,4 +1,5 @@
|
|||
import { Icon } from '@iconify/react/dist/iconify.js';
|
||||
import { isEmpty } from 'lodash-es';
|
||||
import { useRef, useState } from 'react';
|
||||
import styles from './EditableTitle.module.css';
|
||||
|
||||
|
@ -16,7 +17,7 @@ export function EditableTitle({ title, onChange }: EditableTitleProps) {
|
|||
};
|
||||
const handleSubmit = (data: FormData) => {
|
||||
const newTitle = data.get('title') as string;
|
||||
if (newTitle !== title && onChange) {
|
||||
if (!isEmpty(newTitle) && newTitle !== title) {
|
||||
onChange?.(newTitle);
|
||||
}
|
||||
cancelEdit();
|
||||
|
|
Loading…
Reference in New Issue
Block a user