feat(core): allow keyboard navigation in tags inline editor (#7378)

fix AF-966

- Allow using arrowup/down to navigate the tag list candidates; press enter to add the currently focused tag option;
- Allow using arrowleft/right to navigate the inline tag list (selected) and use backspace to delete focused tag.
This commit is contained in:
pengx17
2024-07-02 14:25:51 +00:00
parent c62d79ab14
commit 2a6ea3c9c6
6 changed files with 173 additions and 84 deletions

View File

@@ -63,12 +63,6 @@ export class TagList extends Entity {
return trimmedValue.includes(trimmedQuery);
}
private findfn(value: string, query?: string) {
const trimmedTagValue = query?.trim().toLowerCase();
const trimmedInputValue = value.trim().toLowerCase();
return trimmedTagValue === trimmedInputValue;
}
filterTagsByName$(name: string) {
return LiveData.computed(get => {
return get(this.tags$).filter(tag =>
@@ -76,16 +70,4 @@ export class TagList extends Entity {
);
});
}
tagByTagValue$(value: string) {
return LiveData.computed(get => {
return get(this.tags$).find(tag => this.filterFn(get(tag.value$), value));
});
}
excactTagByValue$(value: string) {
return LiveData.computed(get => {
return get(this.tags$).find(tag => this.findfn(get(tag.value$), value));
});
}
}