mirror of https://github.com/zulip/zulip.git
composebox_typeahead: Remove DM blur handler.
Since #private_message_recipient is a <div contenteditable>,
not an <input> or <textarea>, it doesn’t make sense to call
.val() (it will always give the empty string).
It looks like this line is from over 10 years ago
(09deef9611 (diff-f2b22549dc2fb4824b37e787d964a2c9f4f580e767f86b6d7ded1d0ff37d5a62R291)
)
and probably before we had pills here. We can just remove this
whole block.
This commit is contained in:
parent
e08c7548af
commit
19a4810d53
|
@ -1262,10 +1262,4 @@ export function initialize({on_enter_send}) {
|
||||||
});
|
});
|
||||||
|
|
||||||
initialize_compose_typeahead("textarea#compose-textarea");
|
initialize_compose_typeahead("textarea#compose-textarea");
|
||||||
|
|
||||||
$("#private_message_recipient").on("blur", function () {
|
|
||||||
const val = $(this).val();
|
|
||||||
const recipients = typeahead_helper.get_cleaned_pm_recipients(val);
|
|
||||||
$(this).val(recipients.join(", "));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,14 +36,6 @@ export type CombinedPillItem =
|
||||||
| InputPillItem<UserGroupPill>
|
| InputPillItem<UserGroupPill>
|
||||||
| InputPillItem<StreamPill>;
|
| InputPillItem<StreamPill>;
|
||||||
|
|
||||||
// Returns an array of direct message recipients, removing empty elements.
|
|
||||||
// For example, "a,,b, " => ["a", "b"]
|
|
||||||
export function get_cleaned_pm_recipients(query_string: string): string[] {
|
|
||||||
let recipients = util.extract_pm_recipients(query_string);
|
|
||||||
recipients = recipients.filter((elem) => elem.match(/\S/));
|
|
||||||
return recipients;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function build_highlight_regex(query: string): RegExp {
|
export function build_highlight_regex(query: string): RegExp {
|
||||||
const regex = new RegExp("(" + _.escapeRegExp(query) + ")", "ig");
|
const regex = new RegExp("(" + _.escapeRegExp(query) + ")", "ig");
|
||||||
return regex;
|
return regex;
|
||||||
|
|
|
@ -1199,10 +1199,6 @@ test("initialize", ({override, override_rewire, mock_template}) => {
|
||||||
on_enter_send: finish,
|
on_enter_send: finish,
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#private_message_recipient").val("othello@zulip.com, ");
|
|
||||||
$("#private_message_recipient").trigger("blur");
|
|
||||||
assert.equal($("#private_message_recipient").val(), "othello@zulip.com");
|
|
||||||
|
|
||||||
// the UI of selecting a stream is tested in puppeteer tests.
|
// the UI of selecting a stream is tested in puppeteer tests.
|
||||||
compose_state.set_stream_id(sweden_stream.stream_id);
|
compose_state.set_stream_id(sweden_stream.stream_id);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue