- m("td",
- vnode.attrs.editMode ?
- m("div", {key: 'value-'+vnode.attrs.name()}, [m(SelectOrAutocomplete, {
- options: (vnode.attrs.name() in vnode.attrs.vocabulary().types)
- ? vnode.attrs.vocabulary().types[vnode.attrs.name()].options.concat(vnode.attrs.value())
- : [vnode.attrs.value()],
- value: vnode.attrs.value,
- create: (vnode.attrs.name() in vnode.attrs.vocabulary().types)
- ? vnode.attrs.vocabulary().types[vnode.attrs.name()].overridable || false
- : true, // If tag not in vocabulary, we should accept any value
- })
+ m("td", [
+ vnode.attrs.editMode ?
+ m("div", {key: 'value-'+vnode.attrs.name()}, [
+ m(inputComponent, {
+ options: valueOpts,
+ value: vnode.attrs.value,
+ placeholder: 'new value',
+ // Allow any value on tags not listed on the vocabulary.
+ // Allow any value on tags without values, or the ones
+ // that aren't explicitly declared to be strict.
+ create: !(vnode.attrs.name() in vnode.attrs.vocabulary().tags)
+ || !vnode.attrs.vocabulary().tags[vnode.attrs.name()].values
+ || vnode.attrs.vocabulary().tags[vnode.attrs.name()].values.length === 0
+ || !vnode.attrs.vocabulary().tags[vnode.attrs.name()].strict,
+ // Focus on tag value field when new tag name is set
+ setFocus: vnode.attrs.name() !== '' && vnode.attrs.value() === ''
+ })
+ ])
+ : vnode.attrs.value