keydown_util: Extract all 'Enter' events to one place.

This is a prep commit to fix #22062.
This commit is contained in:
Rohitt Vashishtha
2022-09-28 11:57:24 +05:30
committed by Tim Abbott
parent aeb9a27d0e
commit d4379f9528
21 changed files with 51 additions and 26 deletions

View File

@@ -6,6 +6,7 @@ import render_input_pill from "../templates/input_pill.hbs";
import * as blueslip from "./blueslip";
import * as compose from "./compose";
import * as keydown_util from "./keydown_util";
import * as ui_util from "./ui_util";
// See https://zulip.readthedocs.io/en/latest/subsystems/input-pills.html
@@ -243,7 +244,7 @@ export function create(opts) {
{
store.$parent.on("keydown", ".input", (e) => {
if (e.key === "Enter") {
if (keydown_util.is_enter_event(e)) {
// regardless of the value of the input, the ENTER keyword
// should be ignored in favor of keeping content to one line
// always.