diff --git a/client/homebrew/editor/metadataEditor/metadataEditor.jsx b/client/homebrew/editor/metadataEditor/metadataEditor.jsx index 6ee607eab..97b4df2ea 100644 --- a/client/homebrew/editor/metadataEditor/metadataEditor.jsx +++ b/client/homebrew/editor/metadataEditor/metadataEditor.jsx @@ -347,7 +347,8 @@ const MetadataEditor = createClass({ this.handleFieldChange('tags', e)}/> + // onChange={(e)=>this.handleFieldChange('tags', e)} + />
@@ -372,8 +373,10 @@ 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 289432175..9391b9c16 100644 --- a/client/homebrew/editor/tagInput/tagInput.jsx +++ b/client/homebrew/editor/tagInput/tagInput.jsx @@ -1,19 +1,29 @@ const React = require('react'); -const { useState, useRef, useEffect } = React; +const { useState } = React; const _ = require('lodash'); -const TagInput = ({unique, ...props})=>{ +const TagInput = ({unique = true, values = [], ...props})=>{ const [temporaryValue, setTemporaryValue] = useState(''); + const [valueContext, setValueContext] = useState(values.map((value)=>({ value: value, editing : false }))); + + const tagElement = (value)=>{ + return ( +
{value}
+ ) + } return ( -
- +
+ + + {Object.values(valueContext).map((context, i)=>{ return context.editing ? tagElement('editing') : tagElement(context.value) })} + + setTemporaryValue(e.target.value)} />
) }