mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-21 20:16:26 +08:00
fix: ensure exact tag matching with enter key behavior refinement (#7387)
Co-authored-by: Peng Xiao <pengxiao@outlook.com>
This commit is contained in:
@@ -63,6 +63,12 @@ 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,4 +82,10 @@ export class TagList extends Entity {
|
||||
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));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user