Intermediate bugfix to autocomplete
This commit is contained in:
parent
6b5a572b64
commit
607cd707dc
|
@ -267,6 +267,7 @@ export default class TextAnnotator extends Component {
|
||||||
annotation={this.state.selectedAnnotation}
|
annotation={this.state.selectedAnnotation}
|
||||||
selectedElement={this.state.selectedDOMElement}
|
selectedElement={this.state.selectedDOMElement}
|
||||||
config={this.props.config}
|
config={this.props.config}
|
||||||
|
env={this.props.env}
|
||||||
applyTemplate={this.state.applyTemplate}
|
applyTemplate={this.state.applyTemplate}
|
||||||
onAnnotationCreated={this.onCreateOrUpdateAnnotation('onAnnotationCreated')}
|
onAnnotationCreated={this.onCreateOrUpdateAnnotation('onAnnotationCreated')}
|
||||||
onAnnotationUpdated={this.onCreateOrUpdateAnnotation('onAnnotationUpdated')}
|
onAnnotationUpdated={this.onCreateOrUpdateAnnotation('onAnnotationUpdated')}
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
import React, { useState, useRef } from 'react'
|
import React, { useState } from 'react'
|
||||||
import { useCombobox } from 'downshift'
|
import { useCombobox } from 'downshift'
|
||||||
|
|
||||||
const Autocomplete = props => {
|
const Autocomplete = props => {
|
||||||
|
|
||||||
const element = useRef();
|
|
||||||
|
|
||||||
const [ inputItems, setInputItems ] = useState(props.vocabulary);
|
const [ inputItems, setInputItems ] = useState(props.vocabulary);
|
||||||
|
|
||||||
const onInputValueChange = ({ inputValue }) => {
|
const onInputValueChange = ({ inputValue }) => {
|
||||||
|
@ -58,12 +56,11 @@ const Autocomplete = props => {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div ref={element} className="r6o-autocomplete">
|
<div className="r6o-autocomplete">
|
||||||
<div {...getComboboxProps()}>
|
<div {...getComboboxProps()}>
|
||||||
<input
|
<input
|
||||||
{...getInputProps({ onKeyUp })}
|
{...getInputProps({ onKeyUp })}
|
||||||
placeholder={props.placeholder}
|
placeholder={props.placeholder} />
|
||||||
defaultValue={props.initialValue} />
|
|
||||||
</div>
|
</div>
|
||||||
<ul {...getMenuProps()}>
|
<ul {...getMenuProps()}>
|
||||||
{isOpen && inputItems.map((item, index) => (
|
{isOpen && inputItems.map((item, index) => (
|
||||||
|
|
Loading…
Reference in New Issue