Просмотр исходного кода

update react-bootstrap-typeahead

yusuketk 7 лет назад
Родитель
Сommit
0ca829d439
4 измененных файлов с 5 добавлено и 142 удалено
  1. 1 1
      package.json
  2. 3 4
      src/client/js/components/PageTagForm.jsx
  3. 1 0
      src/client/js/components/SearchTypeahead.js
  4. 0 137
      yarn.lock

+ 1 - 1
package.json

@@ -195,7 +195,7 @@
     "prettier-stylelint": "^0.4.2",
     "react": "^16.8.3",
     "react-bootstrap": "^0.32.1",
-    "react-bootstrap-typeahead": "^3.3.4",
+    "react-bootstrap-typeahead": "^3.4.2",
     "react-clipboard.js": "^2.0.0",
     "react-codemirror2": "^5.1.0",
     "react-dom": "^16.8.3",

+ 3 - 4
src/client/js/components/PageTagForm.jsx

@@ -28,16 +28,15 @@ export default class PageTagForm extends React.Component {
     return (
       <div className="tag-typeahead">
         <AsyncTypeahead
-          allowNew
+          id="async-typeahead"
           caseSensitive={false}
           defaultSelected={this.props.currentPageTags}
-          emptyLabel=""
           isLoading={this.state.isLoading}
           minLength={1}
           multiple
           newSelectionPrefix=""
-          onChange={(selected) => {
-            this.setState({ selected }, () => {
+          onChange={(list) => { // list is a list of object about value. an element have customOption, id and label properties
+            this.setState({ selected: list.map((obj) => { return obj.label }) }, () => {
               this.props.addNewTag(this.state.selected);
             });
           }}

+ 1 - 0
src/client/js/components/SearchTypeahead.js

@@ -173,6 +173,7 @@ export default class SearchTypeahead extends React.Component {
       <div className="search-typeahead">
         <AsyncTypeahead
           {...this.props}
+          id="async-typeahead"
           ref={(c) => { this.typeahead = c }}
           inputProps={inputProps}
           isLoading={this.state.isLoading}

Разница между файлами не показана из-за своего большого размера
+ 0 - 137
yarn.lock


Некоторые файлы не были показаны из-за большого количества измененных файлов