mirror of
https://github.com/aljazceru/notedeck.git
synced 2025-12-18 17:14:21 +01:00
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:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user