Commit 17a83969 authored by Chunchi Che's avatar Chunchi Che

fix chinese in input of deckname

parent c9c0a42f
...@@ -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