@@ -38,7 +38,7 @@ export function contentStateToHTML(contentState: ContentState): string {
3838 ( ) => true , // always return true => don't filter any ranges out
3939 ( start , end ) => {
4040 // map style names to elements
41- let tags = block . getInlineStyleAt ( start ) . map ( style => STYLES [ style ] ) ;
41+ let tags = block . getInlineStyleAt ( start ) . map ( style => STYLES [ style ] ) . filter ( style => ! ! style ) ;
4242 // combine them to get well-nested HTML
4343 let open = tags . map ( tag => `<${ tag } >` ) . join ( '' ) ;
4444 let close = tags . map ( tag => `</${ tag } >` ) . reverse ( ) . join ( '' ) ;
@@ -67,10 +67,8 @@ export function getScopedRTDecorators(scope: any): CompositeDecorator {
6767 } ,
6868 component : ( props ) => {
6969 let member = scope . room . getMember ( props . children [ 0 ] . props . text ) ;
70- let name = null ;
71- if ( ! ! member ) {
72- name = member . name ; // unused until we make these decorators immutable (autocomplete needed)
73- }
70+ // unused until we make these decorators immutable (autocomplete needed)
71+ let name = member ? member . name : null ;
7472 let avatar = member ? < MemberAvatar member = { member } width = { 16 } height = { 16 } /> : null ;
7573 return < span className = "mx_UserPill" > { avatar } { props . children } </ span > ;
7674 }
@@ -131,7 +129,7 @@ function findWithRegex(regex, contentBlock: ContentBlock, callback: (start: numb
131129 * Passes rangeToReplace to modifyFn and replaces it in contentState with the result.
132130 */
133131export function modifyText ( contentState : ContentState , rangeToReplace : SelectionState ,
134- modifyFn : ( text : string ) = > string , ... rest ) : ContentState {
132+ modifyFn : ( text : string ) = > string , inlineStyle , entityKey ) : ContentState {
135133 let getText = ( key ) => contentState . getBlockForKey ( key ) . getText ( ) ,
136134 startKey = rangeToReplace . getStartKey ( ) ,
137135 startOffset = rangeToReplace . getStartOffset ( ) ,
@@ -152,5 +150,5 @@ export function modifyText(contentState: ContentState, rangeToReplace: Selection
152150 // add remaining part of last block
153151 text += getText ( endKey ) . substring ( startOffset , endOffset ) ;
154152
155- return Modifier . replaceText ( contentState , rangeToReplace , modifyFn ( text ) , ... rest ) ;
153+ return Modifier . replaceText ( contentState , rangeToReplace , modifyFn ( text ) , inlineStyle , entityKey ) ;
156154}
0 commit comments