refactor(workflow): simplify edge configuration
This commit is contained in:
@@ -93,12 +93,16 @@ export function EditableTitle({
|
||||
placeholder = "未命名助手",
|
||||
editLabel = "助手名称",
|
||||
variant = "page",
|
||||
allowEmpty = false,
|
||||
maxLength,
|
||||
}: {
|
||||
value: string;
|
||||
onChange: (value: string) => void;
|
||||
placeholder?: string;
|
||||
editLabel?: string;
|
||||
variant?: "page" | "panel";
|
||||
allowEmpty?: boolean;
|
||||
maxLength?: number;
|
||||
}) {
|
||||
const [editing, setEditing] = useState(false);
|
||||
const [draft, setDraft] = useState(value);
|
||||
@@ -118,7 +122,7 @@ export function EditableTitle({
|
||||
|
||||
function commit() {
|
||||
const next = draft.trim();
|
||||
if (next) {
|
||||
if (next || allowEmpty) {
|
||||
onChange(next);
|
||||
}
|
||||
setEditing(false);
|
||||
@@ -129,6 +133,7 @@ export function EditableTitle({
|
||||
<input
|
||||
ref={inputRef}
|
||||
value={draft}
|
||||
maxLength={maxLength}
|
||||
onChange={(event) => setDraft(event.target.value)}
|
||||
onBlur={commit}
|
||||
onKeyDown={(event) => {
|
||||
|
||||
Reference in New Issue
Block a user