diff --git a/client/homebrew/editor/metadataEditor/metadataEditor.jsx b/client/homebrew/editor/metadataEditor/metadataEditor.jsx index 97b4df2ea..7df2e44b6 100644 --- a/client/homebrew/editor/metadataEditor/metadataEditor.jsx +++ b/client/homebrew/editor/metadataEditor/metadataEditor.jsx @@ -347,7 +347,7 @@ const MetadataEditor = createClass({ this.handleFieldChange('tags', e)} + onChange={(e)=>this.handleFieldChange('tags', e)} />
@@ -373,9 +373,8 @@ const MetadataEditor = createClass({ validators={[(v)=>!this.props.metadata.authors?.includes(v)]} placeholder='invite author' unique={true} values={this.props.metadata.invitedAuthors} - values={['cat', 'dog', 'fish']} notes={['Invited author usernames are case sensitive.', 'After adding an invited author, send them the edit link. There, they can choose to accept or decline the invitation.']} - // onChange={(e)=>this.handleFieldChange('invitedAuthors', e)} + onChange={(e)=>this.handleFieldChange('invitedAuthors', e)} />
diff --git a/client/homebrew/editor/tagInput/tagInput.jsx b/client/homebrew/editor/tagInput/tagInput.jsx index cfcb2be42..22760896a 100644 --- a/client/homebrew/editor/tagInput/tagInput.jsx +++ b/client/homebrew/editor/tagInput/tagInput.jsx @@ -1,16 +1,28 @@ const React = require('react'); -const { useState } = React; +const { useState, useEffect } = React; const TagInput = ({ unique = true, values = [], ...props }) => { const [temporaryValue, setTemporaryValue] = useState(''); const [valueContext, setValueContext] = useState(values.map((value) => ({ value, editing: false }))); + useEffect(()=>{ + handleChange(valueContext.map((context)=>context.value)) + }, [valueContext]) + + const handleChange = (value)=>{ + props.onChange({ + target : { value } + }) + }; + const handleInputKeyDown = (evt, value) => { if (evt.key === 'Enter') { submitTag(evt.target.value, value); } }; + + const submitTag = (newValue, originalValue) => { setValueContext((prevContext) => { return prevContext.map((context) => {