Skip to content

Commit

Permalink
fix: 保存时,诗词的原文中删除所有的空格 #129
Browse files Browse the repository at this point in the history
  • Loading branch information
meetqy committed Apr 21, 2024
1 parent 64484e1 commit 9a8a917
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/app/create/poem/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,11 @@ export default function CreatePage() {
required
value={content}
className="h-32"
onBlur={() => {
setContent((v) => {
return v.replace(/\n+|(\n\s+)|(\s+\n)/g, "\n");
});
}}
onChange={(e) => setContent(e.target.value)}
/>
</div>
Expand Down Expand Up @@ -354,6 +359,11 @@ export default function CreatePage() {
placeholder="白话文"
required
value={translation}
onBlur={() => {
setTranslation((v) => {
return v.replace(/\n+|(\n\s+)|(\s+\n)/g, "\n");
});
}}
onChange={(e) => setTranslation(e.target.value)}
/>
</div>
Expand Down

0 comments on commit 9a8a917

Please sign in to comment.