Linkify room topic (#11631)

This commit is contained in:
Germain 2023-09-20 12:51:15 +01:00 committed by GitHub
parent 1c16eab1cd
commit fc9caa3269
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 2 deletions

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) => {