@@ -29,7 +29,7 @@ import { useSetAtom } from 'jotai';
2929import { SequenceCard } from '$components/sequence-card' ;
3030import { SettingTile } from '$components/setting-tile' ;
3131import { useMatrixClient } from '$hooks/useMatrixClient' ;
32- import { UserProfile , useUserProfile } from '$hooks/useUserProfile' ;
32+ import { UserProfile , useUserProfile , MSC4440Bio } from '$hooks/useUserProfile' ;
3333import { getMxIdLocalPart , mxcUrlToHttp } from '$utils/matrix' ;
3434import { UserAvatar } from '$components/user-avatar' ;
3535import { useMediaAuthentication } from '$hooks/useMediaAuthentication' ;
@@ -52,6 +52,7 @@ import { BioEditor } from './BioEditor';
5252import { NameColorEditor } from './NameColorEditor' ;
5353import { StatusEditor } from './StatusEditor' ;
5454import { AnimalCosmetics } from './AnimalCosmetics' ;
55+ import { toPlainText } from '$components/editor' ;
5556
5657type PronounSet = {
5758 summary : string ;
@@ -576,13 +577,24 @@ function ProfileExtended({ profile, userId }: Readonly<ProfileProps>) {
576577 >
577578 < BioEditor
578579 value = {
580+ ( profile . extended ?. [ 'gay.fomx.biography' ] satisfies MSC4440Bio ) ?. formatted_body ||
579581 profile . extended ?. [ 'moe.sable.app.bio' ] ||
580582 profile . extended ?. [ 'chat.commet.profile_bio' ] ||
581583 profile . bio
582584 }
583585 onSave = { ( htmlBio ) => {
584586 handleSaveField ( 'moe.sable.app.bio' , htmlBio ) ;
585587
588+ // MSC4440
589+ 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 ,
596+ } satisfies MSC4440Bio ) ;
597+
586598 const cleanedHtml = htmlBio . replaceAll ( '<br/></blockquote>' , '</blockquote>' ) ;
587599 handleSaveField ( 'chat.commet.profile_bio' , {
588600 format : 'org.matrix.custom.html' ,
0 commit comments