mirror of
https://github.com/aljazceru/notedeck.git
synced 2025-12-19 01:24: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();
|
.clicked();
|
||||||
|
|
||||||
let ctrl_enter_pressed = ui
|
let shortcut_pressed = ui.input(|i| {
|
||||||
.input(|i| i.modifiers.ctrl && i.key_pressed(egui::Key::Enter));
|
(i.modifiers.ctrl || i.modifiers.command)
|
||||||
|
&& i.key_pressed(egui::Key::Enter)
|
||||||
|
});
|
||||||
|
|
||||||
if post_button_clicked
|
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 output = self.draft.buffer.output();
|
||||||
let new_post = NewPost::new(
|
let new_post = NewPost::new(
|
||||||
|
|||||||
Reference in New Issue
Block a user