mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-05 09:50:34 +03:00
Enable Escape key to close tag suggestion popup
closes #1893 - Checking the contents of search term after evaluating the keycode caused the suggestion box to be hidden and immediately reshown - Moving the if/else to the top of the function enables us to fix the issue without complicating the suggestion update logic
This commit is contained in:
parent
2705a28da9
commit
bafc27d454
@ -134,6 +134,12 @@
|
||||
var $target = $(e.currentTarget),
|
||||
searchTerm = $.trim($target.val());
|
||||
|
||||
if (searchTerm) {
|
||||
this.showSuggestions($target, searchTerm);
|
||||
} else {
|
||||
this.$suggestions.hide();
|
||||
}
|
||||
|
||||
if (e.keyCode === this.keys.UP) {
|
||||
e.preventDefault();
|
||||
if (this.$suggestions.is(":visible")) {
|
||||
@ -159,12 +165,6 @@
|
||||
if (e.keyCode === this.keys.UP || e.keyCode === this.keys.DOWN) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (searchTerm) {
|
||||
this.showSuggestions($target, searchTerm);
|
||||
} else {
|
||||
this.$suggestions.hide();
|
||||
}
|
||||
},
|
||||
|
||||
handleKeydown: function (e) {
|
||||
|
Loading…
Reference in New Issue
Block a user