Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add <control> + <enter> to send mail #10

Open
wligtenberg opened this issue Mar 12, 2014 · 14 comments
Open

Add <control> + <enter> to send mail #10

wligtenberg opened this issue Mar 12, 2014 · 14 comments

Comments

@wligtenberg
Copy link

I have gotten used to sending mails with control+enter.
It works nearly everywhere.
Would be great if I could use this plugin to get it in roundcube as well.

@alexanderhaensch
Copy link

This would be a great addition!

@corbosman
Copy link
Owner

Just to make sure I understand. You mean when you're composing an email, and you hit ctrl-enter, it sends the mail?

@alexanderhaensch
Copy link

Exactly. This works in Thunderbird and in GMail.
I find it very handy.

@corbosman
Copy link
Owner

If you checkout master branch, I added some code that should do that. Can you try it out and see if it works ok?

@alexanderhaensch
Copy link

I tried master, but it does not seem to work.

@alexanderhaensch
Copy link

AHA. Works in Firefox, but not in chromium

@corbosman
Copy link
Owner

Thats weird. I use Chrome myself and it works for me.

@alexanderhaensch
Copy link

interesting. I will try with a different system later.
Gmail <ctlr+Enter> still works for me, but not in roundcube... hhmm

@corbosman
Copy link
Owner

Wow, keycode==10..how..weird.

@alexanderhaensch
Copy link

This works:
#13

@sdragnev
Copy link

#13 works for me as well. keycode == 13 alone didn't work for me.

@urusha
Copy link

urusha commented Mar 11, 2016

#13 works for me too with Chrome. Please, include to master.

@bostjan
Copy link

bostjan commented Apr 26, 2016

(content removed, as none of the provided URLs are working anymore)

@ADProperant
Copy link

ADProperant commented Apr 4, 2023

For ctrl+enter shortcut (to send email) there are some problems in different case.
When I try to switch beetwen plain and html editor, gets lost the event to listener the keypress and not found the element with id #composebody for the focus.

We can resolve that bug add the same code to listener keypress event into iframe contents (for html editor iframe), when $('#composebody_ifr') is ready BUT without element focus, because it's not possible get that focus.
So we can solve it and the email send shortcut works, although the focus is not in the compose body area...

In editor.js (when switch html/plain mode):

$('#composebody_ifr').ready(function(){
	$(window.setTimeout(function() {
	  $('#composebody_ifr').contents().keydown(function (e) {
		if (rcmail.env.action == 'compose' && (e.which == 13 || e.which == 10) && e.ctrlKey) {
			$('.button.send').click();
			return false;
		}
	  });
	}, 1000));
});

In keyboard_shortcuts.js:

$('#composebody_ifr').ready(function(){
	$(window.setTimeout(function() {
	  $('#composebody_ifr').contents().keydown(function (e) { return key_pressed(e); });
	}, 1000));
});

In key_pressed function hide control for the focus, because #composebody there is not inside html editor iframe:

if (rcmail.env.action == 'compose' && (e.which == 13 || e.which == 10) && e.ctrlKey /*&& $("*:focus").is("#composebody")*/) {
  $('.button.send').click();
  return false;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants