Intermediate bugfix to autocomplete

This commit is contained in:
Rainer Simon 2020-10-12 09:39:14 +02:00
parent 6b5a572b64
commit 607cd707dc
2 changed files with 4 additions and 6 deletions

View File

@ -267,6 +267,7 @@ export default class TextAnnotator extends Component {
annotation={this.state.selectedAnnotation}
selectedElement={this.state.selectedDOMElement}
config={this.props.config}
env={this.props.env}
applyTemplate={this.state.applyTemplate}
onAnnotationCreated={this.onCreateOrUpdateAnnotation('onAnnotationCreated')}
onAnnotationUpdated={this.onCreateOrUpdateAnnotation('onAnnotationUpdated')}

View File

@ -1,10 +1,8 @@
import React, { useState, useRef } from 'react'
import React, { useState } from 'react'
import { useCombobox } from 'downshift'
const Autocomplete = props => {
const element = useRef();
const [ inputItems, setInputItems ] = useState(props.vocabulary);
const onInputValueChange = ({ inputValue }) => {
@ -58,12 +56,11 @@ const Autocomplete = props => {
}
return (
<div ref={element} className="r6o-autocomplete">
<div className="r6o-autocomplete">
<div {...getComboboxProps()}>
<input
{...getInputProps({ onKeyUp })}
placeholder={props.placeholder}
defaultValue={props.initialValue} />
placeholder={props.placeholder} />
</div>
<ul {...getMenuProps()}>
{isOpen && inputItems.map((item, index) => (