| | |
| | | }); |
| | | } |
| | | |
| | | // Use stored current query instead of debounced one |
| | | // Only show create button if exact match doesn't exist |
| | | const currentQuery = field.currentAutocompleteQuery || query; |
| | | if (field.canCreate && currentQuery && window.jvbTaxCreator) { |
| | | const createOption = this.createNewTermOption(currentQuery); |
| | | dropdown.appendChild(createOption); |
| | | const exactMatch = terms.find(term => |
| | | term.name.toLowerCase() === currentQuery.toLowerCase() |
| | | ); |
| | | |
| | | if (!exactMatch) { |
| | | const createOption = this.createNewTermOption(currentQuery); |
| | | dropdown.appendChild(createOption); |
| | | } |
| | | } |
| | | |
| | | dropdown.hidden = false; |