mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
fixed empty tag commit
This commit is contained in:
parent
bcc6ba26ac
commit
bafa999195
1 changed files with 8 additions and 1 deletions
|
@ -14,7 +14,7 @@ const prepareInput = (input: string): string[] => {
|
||||||
.map((title: string) =>
|
.map((title: string) =>
|
||||||
title
|
title
|
||||||
.trim()
|
.trim()
|
||||||
.substr(0, 32)
|
.substring(0, 64)
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
)
|
)
|
||||||
.filter(el => el.length > 0);
|
.filter(el => el.length > 0);
|
||||||
|
@ -42,6 +42,7 @@ const TagInput: FC<IProps> = ({ exclude, onAppend, onClearTag, onSubmit }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const items = prepareInput(value);
|
const items = prepareInput(value);
|
||||||
|
console.log(items);
|
||||||
|
|
||||||
if (items.length > 1) {
|
if (items.length > 1) {
|
||||||
onAppend(items.slice(0, items.length - 1));
|
onAppend(items.slice(0, items.length - 1));
|
||||||
|
@ -69,6 +70,7 @@ const TagInput: FC<IProps> = ({ exclude, onAppend, onClearTag, onSubmit }) => {
|
||||||
const created = prepareInput(input);
|
const created = prepareInput(input);
|
||||||
|
|
||||||
if (created.length) {
|
if (created.length) {
|
||||||
|
console.log('appending?!!')
|
||||||
onAppend(created);
|
onAppend(created);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,6 +106,11 @@ const TagInput: FC<IProps> = ({ exclude, onAppend, onClearTag, onSubmit }) => {
|
||||||
const onAutocompleteSelect = useCallback(
|
const onAutocompleteSelect = useCallback(
|
||||||
(val: string) => {
|
(val: string) => {
|
||||||
setInput('');
|
setInput('');
|
||||||
|
|
||||||
|
if (!val.trim()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
onAppend([val]);
|
onAppend([val]);
|
||||||
},
|
},
|
||||||
[onAppend, setInput]
|
[onAppend, setInput]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue