forked from 77media/video-flow
修复 输入框 中文输入问题
This commit is contained in:
parent
260ce49cda
commit
dbf30e441e
@ -796,29 +796,20 @@ const RenderTemplateStoryMode = ({
|
|||||||
<div className="py-2 flex-1">
|
<div className="py-2 flex-1">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
value={selectedTemplate?.freeInputItem?.free_input_text}
|
value={selectedTemplate?.freeInputItem?.free_input_text || ""}
|
||||||
placeholder="How is coffee made?"
|
placeholder="How is coffee made?"
|
||||||
className="w-full px-3 py-2 pr-16 bg-white/0 border border-white/10 rounded-lg text-white placeholder-gray-400 focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500/30 transition-all duration-200 text-sm"
|
className="w-full px-3 py-2 pr-16 bg-white/0 border border-white/10 rounded-lg text-white placeholder-gray-400 focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500/30 transition-all duration-200 text-sm"
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
const value = e.target.value;
|
// 更新自由输入文字字段
|
||||||
// 限制输入长度为500字符
|
const updatedTemplate = {
|
||||||
if (value.length > 500) {
|
...selectedTemplate!,
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 立即更新UI显示
|
|
||||||
if (!selectedTemplate?.freeInputItem) return;
|
|
||||||
const updatedTemplate: StoryTemplateEntity = {
|
|
||||||
...selectedTemplate,
|
|
||||||
freeInputItem: {
|
freeInputItem: {
|
||||||
...selectedTemplate.freeInputItem,
|
...selectedTemplate!.freeInputItem,
|
||||||
free_input_text: value
|
free_input_text: e.target.value
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
setSelectedTemplate(updatedTemplate);
|
setSelectedTemplate(updatedTemplate as StoryTemplateEntity);
|
||||||
// 使用防抖函数处理实际的状态更新
|
|
||||||
debouncedUpdateInput(value);
|
|
||||||
}}
|
}}
|
||||||
maxLength={500}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user