mirror of https://github.com/zulip/zulip.git
typeahead: Stop using html() to set value from updater().
I confirmed that updater() only returns a string or undefined. composebox_typeahead.js - compsebox calls `content_typeahead_selected` which returns the composebox text content - stream and PM: implicitly returns undefined pill_typeahead.js - implicitly returns undefined search.js - narrow_or_search_for_term — returns `get_search_bar_text` or empty string custom_profile_fields.js, settings_playground.js - no updater function If no updater function is provided, then updater returns the value passed to it, which is `this.$menu.find(".active").data("typeahead-value")`, which is a string.
This commit is contained in:
parent
30ecf6fafd
commit
aa4e92ee18
|
@ -191,10 +191,10 @@ Typeahead.prototype = {
|
|||
select(e) {
|
||||
const val = this.$menu.find(".active").data("typeahead-value");
|
||||
if (this.$element.is("[contenteditable]")) {
|
||||
this.$element.html(this.updater(val, e)).trigger("change");
|
||||
// Empty textContent after the change event handler
|
||||
this.$element.text(this.updater(val, e)).trigger("change");
|
||||
// Empty text after the change event handler
|
||||
// converts the input text to html elements.
|
||||
this.$element.html("");
|
||||
this.$element.text("");
|
||||
} else {
|
||||
const after_text = this.updater(val, e);
|
||||
const [from, to_before, to_after] = get_string_diff(this.$element.val(), after_text);
|
||||
|
|
Loading…
Reference in New Issue