AUTOCOMPLETE_select_event-365241-54.patch 1.2 KB

123456789101112131415161718192021222324252627282930
  1. diff --git a/misc/autocomplete.js b/misc/autocomplete.js
  2. index 8f7ac60..5679081 100644
  3. --- a/misc/autocomplete.js
  4. +++ b/misc/autocomplete.js
  5. @@ -114,6 +114,7 @@ Drupal.jsAC.prototype.onkeyup = function (input, e) {
  6. */
  7. Drupal.jsAC.prototype.select = function (node) {
  8. this.input.value = $(node).data('autocompleteValue');
  9. + $(this.input).trigger('autocompleteSelect', [node]);
  10. };
  11. /**
  12. @@ -167,7 +168,7 @@ Drupal.jsAC.prototype.unhighlight = function (node) {
  13. Drupal.jsAC.prototype.hidePopup = function (keycode) {
  14. // Select item if the right key or mousebutton was pressed.
  15. if (this.selected && ((keycode && keycode != 46 && keycode != 8 && keycode != 27) || !keycode)) {
  16. - this.input.value = $(this.selected).data('autocompleteValue');
  17. + this.select(this.selected);
  18. }
  19. // Hide popup.
  20. var popup = this.popup;
  21. @@ -220,7 +221,7 @@ Drupal.jsAC.prototype.found = function (matches) {
  22. for (key in matches) {
  23. $('<li></li>')
  24. .html($('<div></div>').html(matches[key]))
  25. - .mousedown(function () { ac.select(this); })
  26. + .mousedown(function () { ac.hidePopup(this); })
  27. .mouseover(function () { ac.highlight(this); })
  28. .mouseout(function () { ac.unhighlight(this); })
  29. .data('autocompleteValue', key)