diff --git a/src/relations/editor/RelationAutocomplete.js b/src/editor/widgets/Autocomplete.js similarity index 92% rename from src/relations/editor/RelationAutocomplete.js rename to src/editor/widgets/Autocomplete.js index 30ecc84..911132b 100644 --- a/src/relations/editor/RelationAutocomplete.js +++ b/src/editor/widgets/Autocomplete.js @@ -1,7 +1,7 @@ import React, { useState, useEffect, useRef } from 'react' import { useCombobox } from 'downshift' -const RelationAutocomplete = props => { +const Autocomplete = props => { const element = useRef(); @@ -33,7 +33,7 @@ const RelationAutocomplete = props => { } return ( -
+
{ } -export default RelationAutocomplete; \ No newline at end of file +export default Autocomplete; \ No newline at end of file diff --git a/src/editor/widgets/tag/TagWidget.jsx b/src/editor/widgets/tag/TagWidget.jsx index 2f679dd..2cf372b 100644 --- a/src/editor/widgets/tag/TagWidget.jsx +++ b/src/editor/widgets/tag/TagWidget.jsx @@ -3,6 +3,7 @@ import { useState } from 'preact/hooks'; import { CSSTransition } from 'react-transition-group'; import { CloseIcon } from '../../../Icons'; import i18n from '../../../i18n'; +import Autocomplete from '../Autocomplete'; /** The basic freetext tag control from original Recogito **/ const TagWidget = props => { @@ -34,9 +35,9 @@ const TagWidget = props => { } return ( -
+
{ tagBodies.length > 0 && -
    +
      { tagBodies.map(tag =>
    • {tag.value} @@ -56,12 +57,12 @@ const TagWidget = props => { } { !props.readOnly && - setNewTag(evt.target.value)} - onKeyDown={onKeyDown} - placeholder={i18n.t('Add tag...')} /> + }
) diff --git a/src/relations/editor/RelationEditor.jsx b/src/relations/editor/RelationEditor.jsx index e435366..ef39faa 100644 --- a/src/relations/editor/RelationEditor.jsx +++ b/src/relations/editor/RelationEditor.jsx @@ -1,6 +1,6 @@ import React, { Component } from 'preact/compat'; import { TrashIcon, CheckIcon } from '../../Icons'; -import RelationAutocomplete from './RelationAutocomplete'; +import Autocomplete from '../../editor/widgets/Autocomplete'; /** * Shorthand to get the label (= first tag body value) from the @@ -101,7 +101,7 @@ export default class RelationEditor extends Component { return(
-