1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-24 20:36:40 +07:00

tag fixes

This commit is contained in:
Fedor Katurov 2019-10-09 21:29:02 +07:00
parent 69c7b71237
commit a227231b90

View file

@ -39,13 +39,18 @@ export const Tags: FC<IProps> = ({ tags, is_editable, onTagsChange, ...props })
setInput(data[data.length - 1].title);
}
if (key === 'Enter' || key === ',') {
if (key === 'Enter' || key === ',' || key === 'Comma') {
setData(
uniq([
...data,
...input
.split(',')
.map((title: string) => title.trim().substr(0, 32))
.map((title: string) =>
title
.trim()
.substr(0, 32)
.toLowerCase()
)
.filter(el => el.length > 0)
.filter(el => !tags.some(tag => tag.title.trim() === el.trim()))
.map(title => ({