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