NattapongSiri / covid_cb

MIT License
2 stars 1 forks source link

Support preview link surround by text #6

Closed NattapongSiri closed 4 years ago

NattapongSiri commented 4 years ago

By current design, it'll require a link to be the first element in the text. It'd be more useful to be able to preview a link that is surround by other text as well.

Some questions needed to be answer is:

Potential code area to be affected:

  1. https://github.com/NattapongSiri/covid_cb/blob/468811f9b80c5749739928995b26516463b69b29/covid-client/react/src/components/ChatDialog.tsx#L59-L79
  2. https://github.com/NattapongSiri/covid_cb/blob/468811f9b80c5749739928995b26516463b69b29/covid-client/react/src/components/ChatMessage/index.tsx#L71-L83
NattapongSiri commented 4 years ago

End up fix by using regex to detect all possible http(s)://url patterns then create each message with previewUrl for each extracted pattern.