feat: add shortcut key support for posting

This commit is contained in:
codytseng
2025-05-25 16:45:20 +08:00
parent 8beb2430b2
commit bf7bb286af
2 changed files with 16 additions and 8 deletions

View File

@@ -38,13 +38,10 @@ export default function PostContent({
const [mentions, setMentions] = useState<string[]>([])
const canPost = !!text && !posting && !uploadingFiles
const post = async (e: React.MouseEvent) => {
e.stopPropagation()
const post = async (e?: React.MouseEvent) => {
e?.stopPropagation()
checkLogin(async () => {
if (!canPost) {
close()
return
}
if (!canPost) return
setPosting(true)
try {
@@ -105,6 +102,7 @@ export default function PostContent({
setText={setText}
defaultContent={defaultContent}
parentEvent={parentEvent}
onSubmit={() => post()}
/>
<SendOnlyToSwitch
parentEvent={parentEvent}