Skip to content

Commit

Permalink
JSONTagsControls can enter novel values
Browse files Browse the repository at this point in the history
fix #103
  • Loading branch information
cldellow committed Mar 4, 2023
1 parent ec475f8 commit e7e5bd0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion datasette_ui_extras/static/edit-row/JSONTagsControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,16 @@ window.JSONTagsControl = class JSONTagsControl {
const json = await rv.json();

const values = json.map(x => x.value);
awesomplete.list = json.map(x => x.value);

let exists = false;
for (const entry of json)
if (entry.value === e.target.value)
exists = true;

awesomplete.list = [
...(exists ? [] : [e.target.value]),
...json.map(x => x.value)
];
awesomplete.evaluate();
});

Expand Down

0 comments on commit e7e5bd0

Please sign in to comment.