Skip to content

Commit

Permalink
Allow plugins to customize number of suggestions in autocomplete (#9616)
Browse files Browse the repository at this point in the history
  • Loading branch information
zbynek authored Aug 21, 2024
1 parent b064be0 commit 94aadfc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion war/src/main/js/components/autocomplete/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@ function init() {
};
}

function getMaxSuggestionCount(e) {
return parseInt(e.dataset["maxsuggestions"]) || 10;
}

function createAndShowDropdown(e, suggestions) {
const items = suggestions
.splice(0, 10)
.splice(0, getMaxSuggestionCount(e))
.map((s) => convertSuggestionToItem(s, e));
if (!e.dropdown) {
Utils.generateDropdown(
Expand Down

0 comments on commit 94aadfc

Please sign in to comment.