Commit 625200f7 authored by Chunchi Che's avatar Chunchi Che

Merge branch 'fix/deckname_input' into 'main'

修复组卡页卡组名称无法输入中文的问题

See merge request !299
parents c9c0a42f 17a83969
Pipeline #23387 passed with stages
in 13 minutes and 32 seconds
...@@ -160,9 +160,15 @@ export const DeckEditor: React.FC<{ ...@@ -160,9 +160,15 @@ export const DeckEditor: React.FC<{
onSave: () => void; onSave: () => void;
}> = ({ deck, onClear, onReset, onSave }) => { }> = ({ deck, onClear, onReset, onSave }) => {
const snapEditDeck = useSnapshot(editDeckStore); const snapEditDeck = useSnapshot(editDeckStore);
const [deckName, setDeckName] = useState(editDeckStore.deckName);
useEffect(() => { useEffect(() => {
iDeckToEditingDeck(deck).then(editDeckStore.set); iDeckToEditingDeck(deck).then(editDeckStore.set);
setDeckName(deck.deckName);
}, [deck]); }, [deck]);
useEffect(() => {
editDeckStore.deckName = deckName;
}, [deckName]);
const handleSwitchCard = (type: Type, card: CardMeta) => { const handleSwitchCard = (type: Type, card: CardMeta) => {
const cardType = card.data.type ?? 0; const cardType = card.data.type ?? 0;
...@@ -218,13 +224,8 @@ export const DeckEditor: React.FC<{ ...@@ -218,13 +224,8 @@ export const DeckEditor: React.FC<{
bordered={false} bordered={false}
prefix={<EditOutlined />} prefix={<EditOutlined />}
style={{ width: 400 }} style={{ width: 400 }}
onChange={(e) => onChange={(e) => setDeckName(e.target.value)}
editDeckStore.set({ value={deckName}
...editDeckStore,
deckName: e.target.value,
})
}
value={snapEditDeck.deckName}
/> />
<Space style={{ marginRight: 6 }}> <Space style={{ marginRight: 6 }}>
<Button <Button
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment