Skip to content

Commit

Permalink
[FIX] Markdown not rendering as preview for threaded messages (Rocket…
Browse files Browse the repository at this point in the history
…Chat#3465)

* Use older preview logic

* Stories
  • Loading branch information
diegolmello authored Oct 27, 2021
1 parent 99f6f2d commit 567b71e
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
20 changes: 20 additions & 0 deletions __tests__/__snapshots__/Storyshots.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -18121,6 +18121,26 @@ exports[`Storyshots Markdown Preview 1`] = `
>
Testing: 😃 👍 :marioparty:
</Text>
<Text
accessibilityLabel="Fallback from new md to old"
numberOfLines={1}
style={
Array [
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
Object {
"color": "#2f343d",
},
]
}
>
Fallback from new md to old
</Text>
</View>
`;

Expand Down
2 changes: 1 addition & 1 deletion app/containers/markdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ class Markdown extends PureComponent<IMarkdownProps, any> {
return null;
}

if (this.isNewMarkdown) {
if (this.isNewMarkdown && !preview) {
return (
<NewMarkdown
username={username}
Expand Down
18 changes: 18 additions & 0 deletions storybook/stories/Markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,24 @@ stories.add('Preview', () => (
username='rocket.cat'
/>
<Markdown msg='Testing: 😃 :+1: :marioparty:' getCustomEmoji={getCustomEmoji} theme={theme} numberOfLines={1} preview />
<Markdown
msg='Fallback from new md to old'
getCustomEmoji={getCustomEmoji}
theme={theme}
numberOfLines={1}
preview
md={[
{
type: 'PARAGRAPH',
value: [
{
type: 'PLAIN_TEXT',
value: 'This is Rocket.Chat'
}
]
}
]}
/>
</View>
));

Expand Down

0 comments on commit 567b71e

Please sign in to comment.