@@ -59,6 +59,7 @@ import { MessageWithCustomMentionRenderer } from './snippets/MessageWithCustomMe
5959import  {  MessageThreadWithSystemMessagesExample  }  from  './snippets/SystemMessages.snippet' ; 
6060import  {  MessageThreadWithInlineImageExample  }  from  './snippets/WithInlineImageMessage.snippet' ; 
6161import  {  MessageThreadWithMessageDateExample  }  from  './snippets/WithMessageDate.snippet' ; 
62+ import  {  MessageThreadWithRichTextEditorExample  }  from  './snippets/WithRichTextEditor.snippet' ; 
6263
6364const  MessageThreadWithBlockedMessagesExampleText  = 
6465  require ( '!!raw-loader!./snippets/BlockedMessages.snippet.tsx' ) . default ; 
@@ -89,6 +90,7 @@ const MessageThreadWithSystemMessagesExampleText =
8990const  MessageThreadWithInlineImageExampleText  = 
9091  require ( '!!raw-loader!./snippets/WithInlineImageMessage.snippet.tsx' ) . default ; 
9192const  MessageThreadWithMessageDateExampleText  =  require ( '!!raw-loader!./snippets/WithMessageDate.snippet.tsx' ) . default ; 
93+ const  MessageThreadWithRichTextEditorText  =  require ( '!!raw-loader!./snippets/WithRichTextEditor.snippet.tsx' ) . default ; 
9294
9395const  importStatement  =  ` 
9496import { FluentThemeProvider, MessageThread } from '@azure/communication-react'; 
@@ -115,6 +117,7 @@ const Docs: () => JSX.Element = () => {
115117  const  refDisplayInlineImages  =  useRef ( null ) ; 
116118  const  refDisplayAttachments  =  useRef ( null ) ; 
117119  const  refMentionOfUsers  =  useRef ( null ) ; 
120+   const  refRichTextEditor  =  useRef ( null ) ; 
118121  const  refProps  =  useRef ( null ) ; 
119122
120123  const  scrollToRef  =  ( ref ) : void =>  { 
@@ -159,6 +162,8 @@ const Docs: () => JSX.Element = () => {
159162      scrollToRef ( refDisplayAttachments ) ; 
160163    }  else  if  ( url . includes ( 'mention-of-users-with-a-custom-renderer-within-messages' )  &&  refMentionOfUsers . current )  { 
161164      scrollToRef ( refMentionOfUsers ) ; 
165+     }  else  if  ( url . includes ( 'rich-text-editor-support-for-editing-messages' )  &&  refRichTextEditor . current )  { 
166+       scrollToRef ( refRichTextEditor ) ; 
162167    }  else  if  ( url . includes ( 'props' )  &&  refProps . current )  { 
163168      scrollToRef ( refProps ) ; 
164169    } 
@@ -192,6 +197,12 @@ const Docs: () => JSX.Element = () => {
192197        checkout the details about these components
193198        [here](https://microsoft.github.io/fluentui-contrib/react-chat/?path=/story/chat--default).
194199      </ Description > 
200+       < Description > 
201+         The MessageThread component supports lazy loading for the rich text editor used for editing messages. This means
202+         that the rich text editor and its dependencies can be excluded from the bundle if they're not required,
203+         utilizing tree-shaking techniques such as [the sideEffects
204+         option](https://webpack.js.org/guides/tree-shaking/#mark-the-file-as-side-effect-free) in webpack.
205+       </ Description > 
195206
196207      < Heading > Importing</ Heading > 
197208      < Source  code = { importStatement }  /> 
@@ -368,6 +379,18 @@ const Docs: () => JSX.Element = () => {
368379        </ Canvas > 
369380      </ div > 
370381
382+       < div  ref = { refRichTextEditor } > 
383+         < Heading > Rich Text Editor Support for Editing Messages</ Heading > 
384+         < DetailedBetaBanner  /> 
385+         < Description > 
386+           The following example shows how to enable rich text editor for message editing by providing the
387+           `richTextEditor`` property.
388+         </ Description > 
389+         < Canvas  mdxSource = { MessageThreadWithRichTextEditorText } > 
390+           < MessageThreadWithRichTextEditorExample  /> 
391+         </ Canvas > 
392+       </ div > 
393+ 
371394      < div  ref = { refProps } > 
372395        < Heading > Props</ Heading > 
373396        < Props  of = { MessageThreadComponent }  /> 
@@ -452,6 +475,9 @@ const MessageThreadStory = (args): JSX.Element => {
452475    if  ( message . messageType  ===  'chat' )  { 
453476      message . content  =  content ; 
454477      message . editedOn  =  new  Date ( Date . now ( ) ) ; 
478+       if  ( args . richTextEditor  ===  true )  { 
479+         message . contentType  =  'html' ; 
480+       } 
455481    } 
456482    updatedChatMessages [ msgIdx ]  =  message ; 
457483    setChatMessages ( updatedChatMessages ) ; 
@@ -553,6 +579,7 @@ const MessageThreadStory = (args): JSX.Element => {
553579        onRenderMessage = { onRenderMessage } 
554580        inlineImageOptions = { inlineImageOptions } 
555581        onUpdateMessage = { onUpdateMessageCallback } 
582+         richTextEditor = { args . richTextEditor } 
556583        onRenderAvatar = { ( userId ?: string )  =>  { 
557584          return  ( 
558585            < Persona 
@@ -608,6 +635,7 @@ export default {
608635    showMessageDate : controlsToAdd . showMessageDate , 
609636    showMessageStatus : controlsToAdd . showMessageStatus , 
610637    enableJumpToNewMessageButton : controlsToAdd . enableJumpToNewMessageButton , 
638+     richTextEditor : controlsToAdd . richTextEditor , 
611639    // Hiding auto-generated controls 
612640    styles : hiddenControl , 
613641    strings : hiddenControl , 
@@ -623,8 +651,7 @@ export default {
623651    onRenderMessage : hiddenControl , 
624652    onUpdateMessage : hiddenControl , 
625653    onDeleteMessage : hiddenControl , 
626-     disableEditing : hiddenControl , 
627-     richTextEditor : hiddenControl 
654+     disableEditing : hiddenControl 
628655  } , 
629656  parameters : { 
630657    docs : { 
0 commit comments