support Cmd+Enter for posting on macOS

Add support for Command key (macOS) in addition to Ctrl key for submitting posts via keyboard shortcut
This commit is contained in:
Ethan Tuttle
2025-03-06 21:56:44 -05:00
parent e3eab0dfa8
commit 0d251bda9f

View File

@@ -362,11 +362,13 @@ impl<'a> PostView<'a> {
)
.clicked();
let ctrl_enter_pressed = ui
.input(|i| i.modifiers.ctrl && i.key_pressed(egui::Key::Enter));
let shortcut_pressed = ui.input(|i| {
(i.modifiers.ctrl || i.modifiers.command)
&& i.key_pressed(egui::Key::Enter)
});
if post_button_clicked
|| (!self.draft.buffer.is_empty() && ctrl_enter_pressed)
|| (!self.draft.buffer.is_empty() && shortcut_pressed)
{
let output = self.draft.buffer.output();
let new_post = NewPost::new(