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
compose: Allow ctrl + enter to send in preview mode as well. #22705
Conversation
Hello @zulip/server-compose members, this pull request was labeled with the "area: compose" label, so you may want to check it out! |
We already have this function:
So the question is why that code isn't handling this; we shouldn't add a duplicate. |
Oh, but this is |
@@ -1137,7 +1135,7 @@ test("initialize", ({override, mock_template}) => { | |||
user_settings.enter_sends = false; | |||
event.metaKey = true; | |||
let compose_finish_called = false; | |||
override(compose, "finish", () => { | |||
override_rewire(compose, "finish", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're generally trying to avoid new use of rewire
; is this necessary?
4987fc3
to
aebd8cf
Compare
@timabbott Thank you for the feedback! I was initially trying to use the Anyway, I thought through it all again and have a much smaller and simpler PR now, using that 1 function only, just with an optional parameter and more specific conditions. The original tests remain untouched. Please have another look, and let me know if anything else can be improved! |
I'm not sure whether the bug this fixes was a regression resulting from d6d3683, or an old bug, but focusing the compose box is not sufficient to end preview mode; we should be calling the function that's explicitly for that.
When the user chose to send the composebox message on pressing ctrl + enter instead of just enter, it only worked in writing mode but not in the preview mode. This change makes ctrl + enter send the message even in preview mode, when that setting is chosen. Fixes: zulip#21670.
This seemed to not work for me -- when I hit I also changed it back to a simple else statement, since I think we Ctrl+Enter and Enter to have their behavior swap when the "Enter sends" setting is toggled. Merged with those changes, thanks @N-Shar-ma! |
aebd8cf
to
87a6c39
Compare
When the user chose to send the composebox message on pressing ctrl +
enter instead of just enter, it only worked in writing mode but not
the preview mode.
This change makes ctrl + enter send the message even in preview mode,
when that setting is chosen.
Fixes: #21670.
Self-review checklist
(variable names, code reuse, readability, etc.).
Communicate decisions, questions, and potential concerns.
Individual commits are ready for review (see commit discipline).
Completed manual review and testing of the following: