webscopeio / react-textarea-autocomplete

📝 React component implements configurable GitHub's like textarea autocomplete.
MIT License
451 stars 80 forks source link

The doc about trigger option `output` does not match actual code. #67

Closed oklas closed 6 years ago

oklas commented 6 years ago

The doc about trigger option output does not match actual code.

The doc says that item must be unique. And the item unique id is received as result of calling function specified in trigger option output. This function must return object with optional field named key wich will be considered as item unique id. Doc declares a prototype:

      output?: (
        item: Object | string,
        trigger?: string
      ) =>
        | {|
            key?: ?string,
            text: string,
            caretPosition: "start" | "end" | "next" | number
          |}
        | string,

But the code currently ignore field key from object returned by this function. Same time code actually use field key of item itself instead of result of that function in the line:

https://github.com/webscopeio/react-textarea-autocomplete/blob/7bd61f93c572cdf7af4f3de1409d8fc2fd1a5816/src/List.jsx#L58

jukben commented 6 years ago

Great catch! We should update Readme in this case.

jukben commented 6 years ago

Released https://github.com/webscopeio/react-textarea-autocomplete/releases/tag/v2.2.1

Thanks 🙏

oklas commented 6 years ago

Thank you too for great work on this library and for quick accept merge and release!