mirror of
https://github.com/logos-messaging/OpChan.git
synced 2026-01-02 12:53:10 +00:00
chore: UI commenting keyboard help
This commit is contained in:
parent
8cc956682c
commit
af59b9000a
@ -105,7 +105,9 @@ const PostDetail = () => {
|
||||
|
||||
// Handle keyboard shortcuts
|
||||
const handleKeyDown = (e: React.KeyboardEvent) => {
|
||||
if ((e.ctrlKey || e.metaKey) && e.key === 'Enter') {
|
||||
// Enter inserts newline by default. Send on Ctrl+Enter or Shift+Enter.
|
||||
const isSendCombo = (e.ctrlKey || e.metaKey || e.shiftKey) && e.key === 'Enter';
|
||||
if (isSendCombo) {
|
||||
e.preventDefault();
|
||||
if (!isCreatingComment && newComment.trim()) {
|
||||
handleCreateComment(e as React.FormEvent);
|
||||
@ -287,6 +289,10 @@ const PostDetail = () => {
|
||||
initialHeight={140}
|
||||
maxHeight={600}
|
||||
/>
|
||||
<div className="flex items-center justify-between text-xs text-muted-foreground mt-1 mb-2">
|
||||
<span>Press Enter for newline • Ctrl+Enter or Shift+Enter to send</span>
|
||||
<span />
|
||||
</div>
|
||||
<div className="flex justify-end">
|
||||
<Button
|
||||
type="submit"
|
||||
|
||||
@ -126,7 +126,9 @@ const PostList = () => {
|
||||
|
||||
// Handle keyboard shortcuts
|
||||
const handleKeyDown = (e: React.KeyboardEvent) => {
|
||||
if ((e.ctrlKey || e.metaKey) && e.key === 'Enter') {
|
||||
// Enter inserts newline by default. Send on Ctrl+Enter or Shift+Enter.
|
||||
const isSendCombo = (e.ctrlKey || e.metaKey || e.shiftKey) && e.key === 'Enter';
|
||||
if (isSendCombo) {
|
||||
e.preventDefault();
|
||||
if (!isCreatingPost && newPostContent.trim() && newPostTitle.trim()) {
|
||||
handleCreatePost(e as React.FormEvent);
|
||||
@ -229,6 +231,10 @@ const PostList = () => {
|
||||
disabled={isCreatingPost}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-center justify-between text-xs text-muted-foreground mt-1 mb-2">
|
||||
<span>Press Enter for newline • Ctrl+Enter or Shift+Enter to post</span>
|
||||
<span />
|
||||
</div>
|
||||
<div className="flex justify-end">
|
||||
<Button
|
||||
type="submit"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user