Skip to content

Commit 800a08d

Browse files
[Chat] Update storybook descriptions for RTE and call out limitations (#5012)
* Update RTE Image upload description * Call out limitations * Update storybook 8
1 parent c0dd43a commit 800a08d

File tree

3 files changed

+52
-17
lines changed

3 files changed

+52
-17
lines changed

packages/storybook/stories/MessageThread/MessageThread.stories.tsx

+18-6
Original file line numberDiff line numberDiff line change
@@ -446,12 +446,24 @@ const Docs: () => JSX.Element = () => {
446446
<SingleLineBetaBanner />
447447
<Description>
448448
The following examples show how to enable image insert functionality for message editing with rich text
449-
editor. Under the `richTextEditorOptions` prop, an `onInsertInlineImage` callback to handle an inline image
450-
that is inserted into the MessageThread component. This callback can be used to implement custom logic, such
451-
as uploading the image to a server. After processing each inserted image in the callback, the results should
452-
be passed back to the component through the `messagesInlineImagesWithProgress` prop for each message that has
453-
inserted inline images. This prop will be used to render inline images in the MessageThread and submit them
454-
with the message.
449+
editor. Under the `richTextEditorOptions` prop, the `onInsertInlineImage` callback is used to handle each
450+
inline image that is inserted into the editor. When not provided, pasting images into the rich text editor
451+
will be disabled. This callback can be used to manipulate the imageAttributes src URL (which is a local blob
452+
URL), and implement any other custom logic. After processing each inserted image in the callback, the results
453+
should be passed back to the component through the `messagesInlineImagesWithProgress` prop. This prop will be
454+
used to render the error bar to the end user. Note that for the error of content exceeds the maximum length,
455+
the `id` and `url` props provided in the `inlineImagesWithProgress` will be used in the calculation to achieve
456+
a more accurate result. The content provided in the `onSendMessage` does not contain any information from the
457+
`inlineImagesWithProgress`. To add or replace image attributes, manually parse the HTML content and update the
458+
image attributes. After an inline image is removed from the editor, the `onRemoveInlineImage` callback will be
459+
triggered. At this point, the image is already removed from the UI and the local blob of the image has already
460+
been revoked. This callback can be used to implement custom logic such as deleting the image from the server.
461+
When the inline images are displayed in the message thread, we restrict the max-width on each image, but not
462+
the height. Long images will take up vertical space in the message thread. Also, when inserting images between
463+
text, images will be on the same line as the text. If you wish to change this behavior so that each image is
464+
always on a new line, you can set the display property to block for all image tags. For certain Android
465+
devices, pasting of a single image is only supported by long pressing on the rich text editor and choosing
466+
paste. Selecting from the clipboard view from keyboard may not be supported.
455467
</Description>
456468
<Canvas mdxSource={MessageThreadWithRichTextEditorInlineImagesText}>
457469
<MessageThreadWithRichTextEditorInlineImagesExample />

packages/storybook/stories/SendBox/RichTextSendBox.stories.tsx

+16-5
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,22 @@ const getDocs: () => JSX.Element = () => {
6666

6767
<Heading>Enable Inserting Inline Images</Heading>
6868
<Description>
69-
The RichTextSendBox component provides an `onInsertInlineImage` callback to handle an inline image that is
70-
inserted into the RichTextSendBox component. This callback can be used to implement custom logic, such as
71-
uploading the image to a server. After processing each inserted image in the callback, the results should be
72-
passed back to the component through the `inlineImagesWithProgress` prop. This prop will be used to render
73-
inline images in the RichTextSendBox and send them with the message.
69+
The RichTextSendBox component provides an `onInsertInlineImage` callback to handle each inline image that is
70+
inserted into the editor. When not provided, pasting images into the rich text editor will be disabled. This
71+
callback can be used to manipulate the imageAttributes src URL (which is a local blob URL), and implement any
72+
other custom logic. After processing each inserted image in the callback, the results should be passed back to
73+
the component through the `inlineImagesWithProgress` prop. This prop will be used to render the error bar to the
74+
end user. Note that for the error of content exceeds the maximum length, the `id` and `url` props provided in
75+
the `inlineImagesWithProgress` will be used in the calculation to achieve a more accurate result. The content
76+
provided in the `onSendMessage` does not contain any information from the `inlineImagesWithProgress`. To add or
77+
replace image attributes, manually parse the HTML content and update the image attributes. After an inline image
78+
is removed from the editor, the `onRemoveInlineImage` callback will be triggered. At this point, the image is
79+
already removed from the UI and the local blob of the image has already been revoked. This callback can be used
80+
to implement custom logic such as deleting the image from the server. When inserting images between text, images
81+
will be on the same line as the text. If you wish to change this behavior so that each image is always on a new
82+
line, you can set the display property to block for all image tags. For certain Android devices, pasting of a
83+
single image is only supported by long pressing on the rich text editor and choosing paste. Selecting from the
84+
clipboard view from keyboard may not be supported.
7485
</Description>
7586
<Canvas mdxSource={RichTextSendBoxWithInlineImagesExampleText}>
7687
<RichTextSendBoxWithInlineImagesExample />

packages/storybook8/stories/Components/MessageThread/Docs.mdx

+18-6
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,24 @@ Enabling the rich text editor for message editing, without customizing its behav
222222
<SingleLineBetaBanner />
223223

224224
The following examples show how to enable image insert functionality for message editing with rich text
225-
editor. Under the `richTextEditorOptions` prop, an `onInsertInlineImage` callback to handle an inline image
226-
that is inserted into the MessageThread component. This callback can be used to implement custom logic, such
227-
as uploading the image to a server. After processing each inserted image in the callback, the results should
228-
be passed back to the component through the `messagesInlineImagesWithProgress` prop for each message that has inserted
229-
inline images. This prop will be used to render inline images in the MessageThread and submit them with the
230-
message.
225+
editor. Under the `richTextEditorOptions` prop, the `onInsertInlineImage` callback is used to handle each
226+
inline image that is inserted into the editor. When not provided, pasting images into the rich text editor
227+
will be disabled. This callback can be used to manipulate the imageAttributes src URL (which is a local blob
228+
URL), and implement any other custom logic. After processing each inserted image in the callback, the results
229+
should be passed back to the component through the `messagesInlineImagesWithProgress` prop. This prop will be
230+
used to render the error bar to the end user. Note that for the error of content exceeds the maximum length,
231+
the `id` and `url` props provided in the `inlineImagesWithProgress` will be used in the calculation to achieve
232+
a more accurate result. The content provided in the `onSendMessage` does not contain any information from the
233+
`inlineImagesWithProgress`. To add or replace image attributes, manually parse the HTML content and update the
234+
image attributes. After an inline image is removed from the editor, the `onRemoveInlineImage` callback will be
235+
triggered. At this point, the image is already removed from the UI and the local blob of the image has already
236+
been revoked. This callback can be used to implement custom logic such as deleting the image from the server.
237+
When the inline images are displayed in the message thread, we restrict the max-width on each image, but not
238+
the height. Long images will take up vertical space in the message thread. Also, when inserting images between
239+
text, images will be on the same line as the text. If you wish to change this behavior so that each image is
240+
always on a new line, you can set the display property to block for all image tags. For certain Android
241+
devices, pasting of a single image is only supported by long pressing on the rich text editor and choosing
242+
paste. Selecting from the clipboard view from keyboard may not be supported.
231243

232244
<Canvas
233245
of={MessageThreadStories.RichTextEditorInlineImagesTextDocsOnly}

0 commit comments

Comments
 (0)