mirror of https://github.com/zulip/zulip.git
typeahead: Fix typeahead for custom selection triggers.
Now checking for custom trigger keys will happen during `keydown` instead of `keyup` so that if the key is printable, `preventDefault` can prevent it from appearing in the compose box. This fixes the case when jumping to topic, would eat up any space or new line after the cursor, due to wrong splitting around the cursor, which was a result of using the printable custom trigger key, the ">", in contrast to a non printable one like Enter. The problem was that custom trigger keys like `>` that the browser's default behavior is to type (vs. others like RightArrow where that isn't the case) can result in extra characters being emitted, which is not wanted.
This commit is contained in:
parent
cc712dbade
commit
ec25310654
|
@ -376,6 +376,11 @@
|
|||
}
|
||||
|
||||
, keydown: function (e) {
|
||||
if (this.trigger_selection(e)) {
|
||||
if (!this.shown) return;
|
||||
e.preventDefault();
|
||||
this.select(e);
|
||||
}
|
||||
this.suppressKeyPressRepeat = !~$.inArray(e.keyCode, [40,38,9,13,27])
|
||||
this.move(e)
|
||||
}
|
||||
|
@ -406,10 +411,6 @@
|
|||
break
|
||||
|
||||
default:
|
||||
if (this.trigger_selection(e)) {
|
||||
if (!this.shown) return;
|
||||
this.select(e);
|
||||
}
|
||||
var hideOnEmpty = false
|
||||
if (e.keyCode === 8 && this.options.helpOnEmptyStrings) { // backspace
|
||||
hideOnEmpty = true
|
||||
|
|
Loading…
Reference in New Issue