feat: Step4 标题库选择与手动输入合并为单一输入框 #1253

Merged
xiaoxia merged 2 commits from feat/step4-title-autocomplete into develop 2026-08-07 12:35:31 +08:00
@@ -2,7 +2,7 @@
* Step 4 标题设置组件
*/
import React from "react"
import { Select } from "antd"
import { AutoComplete } from "antd"
import { POSITION_OPTIONS, FONT_OPTIONS } from "../constants"
import type { TitleSettings } from "../types"
import { useStep4Title } from "../hooks/useStep4Title"
@@ -75,10 +75,6 @@ const Step4TitleSettings: React.FC<Step4TitleSettingsProps> = (props) => {
onRefresh={t.handleRefreshAiTitles}
/>
<div className="xx-divider">
<span></span>
</div>
<div className="xx-title-ai-toggle">
<span className="xx-toggle-label">AI </span>
<div className="xx-switch" onClick={t.toggleAiAutoSelect}>
@@ -87,11 +83,11 @@ const Step4TitleSettings: React.FC<Step4TitleSettingsProps> = (props) => {
</div>
<div className="xx-form-field">
<label></label>
<Select
placeholder="请选择标题…"
<label></label>
<AutoComplete
placeholder="输入或从标题库选择…"
allowClear
showSearch
maxLength={50}
style={{ width: "100%" }}
value={t.titleSettings.title || undefined}
onChange={(val) => t.updateTitle(val || "")}
@@ -99,9 +95,10 @@ const Step4TitleSettings: React.FC<Step4TitleSettingsProps> = (props) => {
label: ut.content,
value: ut.content,
}))}
filterOption={(input, option) =>
((option?.label as string) || "").toLowerCase().includes(input.toLowerCase())
}
filterOption={(inputValue, option) => {
const title = (option?.label || option?.value || "") as string
return title.toLowerCase().includes((inputValue || "").toLowerCase())
}}
notFoundContent={
t.userTitles.length === 0 ? (
<span style={{ color: "var(--text-tertiary)", fontSize: 13 }}>
@@ -111,15 +108,6 @@ const Step4TitleSettings: React.FC<Step4TitleSettingsProps> = (props) => {
}
/>
</div>
<div className="xx-form-field" style={{ marginTop: 14 }}>
<label></label>
<input
placeholder="输入自定义标题…"
value={t.titleSettings.title}
onChange={(e) => t.updateTitle(e.target.value)}
maxLength={50}
/>
</div>
</>
)}