Merge ctrl-enter to post

Ethan Tuttle (1):
      feat: ctrl+enter when creating a new note, sends the note, the same way clicking the "Post Now" button.
This commit is contained in:
William Casarin
2025-02-10 16:44:52 -08:00

View File

@@ -332,12 +332,18 @@ impl<'a> PostView<'a> {
); );
ui.with_layout(egui::Layout::right_to_left(egui::Align::BOTTOM), |ui| { ui.with_layout(egui::Layout::right_to_left(egui::Align::BOTTOM), |ui| {
if ui let post_button_clicked = ui
.add_sized( .add_sized(
[91.0, 32.0], [91.0, 32.0],
post_button(!self.draft.buffer.is_empty()), post_button(!self.draft.buffer.is_empty()),
) )
.clicked() .clicked();
let ctrl_enter_pressed = ui
.input(|i| i.modifiers.ctrl && i.key_pressed(egui::Key::Enter));
if post_button_clicked
|| (!self.draft.buffer.is_empty() && ctrl_enter_pressed)
{ {
let output = self.draft.buffer.output(); let output = self.draft.buffer.output();
let new_post = NewPost::new( let new_post = NewPost::new(