This commit is contained in:
Rainer Simon 2020-09-24 14:55:01 +02:00
parent a3e95454ef
commit 6507ef4b73
1 changed files with 6 additions and 3 deletions

View File

@ -51,9 +51,12 @@ const TagWidget = props => {
}
const onSubmit = tag => {
// Just 'undraft' the current draft tag
const { draft, ...undrafted } = draftTag;
props.onUpdateBody(draftTag, undrafted);
const { draft, ...toSubmit } = { ...draftTag, value: tag };
if (draftTag.value.trim().length === 0) {
props.onAppendBody(toSubmit);
} else {
props.onUpdateBody(draftTag, toSubmit);
}
}
return (