Update HomePage.tsx
This commit is contained in:
@@ -46,13 +46,6 @@ export default function HomePage() {
|
||||
}
|
||||
}
|
||||
|
||||
const handleContentKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
||||
if (e.key === 'Enter' && entry.trim()) {
|
||||
e.preventDefault()
|
||||
handleWrite()
|
||||
}
|
||||
}
|
||||
|
||||
const handleWrite = async () => {
|
||||
if (!userId || !title.trim() || !entry.trim()) {
|
||||
setMessage({ type: 'error', text: 'Please add a title and entry content' })
|
||||
@@ -127,6 +120,7 @@ export default function HomePage() {
|
||||
value={title}
|
||||
onChange={(e) => setTitle(e.target.value)}
|
||||
onKeyDown={handleTitleKeyDown}
|
||||
enterKeyHint="next"
|
||||
ref={titleInputRef}
|
||||
disabled={saving}
|
||||
/>
|
||||
@@ -135,7 +129,7 @@ export default function HomePage() {
|
||||
placeholder="Start writing your entry here..."
|
||||
value={entry}
|
||||
onChange={(e) => setEntry(e.target.value)}
|
||||
onKeyDown={handleContentKeyDown}
|
||||
enterKeyHint="enter"
|
||||
ref={contentTextareaRef}
|
||||
disabled={saving}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user