Linkify room topic (#11631)

This commit is contained in:
Germain
2023-09-20 11:51:15 +00:00
committed by GitHub
parent 1c16eab1cd
commit fc9caa3269
3 changed files with 15 additions and 2 deletions
+5
View File
@@ -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) => {