Linkify room topic (#11631)
This commit is contained in:
parent
1c16eab1cd
commit
fc9caa3269
3 changed files with 15 additions and 2 deletions
|
@ -32,6 +32,11 @@ export const getTopic = (room?: Room): Optional<ContentHelpers.TopicState> => {
|
|||
return !!content ? ContentHelpers.parseTopicContent(content) : null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper to retrieve the room topic for given room
|
||||
* @param room
|
||||
* @returns the raw text and an html parsion version of the room topic
|
||||
*/
|
||||
export function useTopic(room?: Room): Optional<ContentHelpers.TopicState> {
|
||||
const [topic, setTopic] = useState(getTopic(room));
|
||||
useTypedEventEmitter(room?.currentState, RoomStateEvent.Events, (ev: MatrixEvent) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue