@@ -46,13 +46,13 @@ import { useCapabilities } from '$hooks/useCapabilities';
4646import { profilesCacheAtom } from '$state/userRoomProfile' ;
4747import { SequenceCardStyle } from '$features/settings/styles.css' ;
4848import { useUserPresence } from '$hooks/useUserPresence' ;
49+ import { MSC1767Text } from '$types/matrix/common' ;
4950import { TimezoneEditor } from './TimezoneEditor' ;
5051import { PronounEditor } from './PronounEditor' ;
5152import { BioEditor } from './BioEditor' ;
5253import { NameColorEditor } from './NameColorEditor' ;
5354import { StatusEditor } from './StatusEditor' ;
5455import { AnimalCosmetics } from './AnimalCosmetics' ;
55- import { toPlainText } from '$components/editor' ;
5656
5757type PronounSet = {
5858 summary : string ;
@@ -585,14 +585,21 @@ function ProfileExtended({ profile, userId }: Readonly<ProfileProps>) {
585585 onSave = { ( htmlBio ) => {
586586 handleSaveField ( 'moe.sable.app.bio' , htmlBio ) ;
587587
588+ const plainTextBio : string = htmlBio
589+ . replaceAll ( '<br>' , '\n' )
590+ . replaceAll ( '<li>' , '\n- ' )
591+ . replaceAll ( / < [ ^ > ] * > / g, '' ) ;
588592 // MSC4440
589593 handleSaveField ( 'gay.fomx.biography' , {
590- body : htmlBio
591- . replaceAll ( '<br>' , '\n' )
592- . replaceAll ( '<li>' , '\n- ' )
593- . replaceAll ( / < [ ^ > ] * > / g, '' ) ,
594- format : 'org.matrix.custom.html' ,
595- formatted_body : htmlBio ,
594+ 'm.text' : [
595+ {
596+ body : htmlBio ,
597+ mimetype : 'text/html' ,
598+ } satisfies MSC1767Text ,
599+ {
600+ body : plainTextBio ,
601+ } satisfies MSC1767Text ,
602+ ] ,
596603 } satisfies MSC4440Bio ) ;
597604
598605 const cleanedHtml = htmlBio . replaceAll ( '<br/></blockquote>' , '</blockquote>' ) ;
0 commit comments