Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Commit bf90c19

Browse files
authored
Merge pull request #4797 from withspectrum/messages-lists
Add support for lists to messages
2 parents d51957b + 57fc998 commit bf90c19

File tree

5 files changed

+23
-4
lines changed

5 files changed

+23
-4
lines changed

shared/clients/draft-js/message/renderer.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,20 @@ const messageRenderer = {
5454
children.map((child, index) => (
5555
<BlockQuote key={keys[index] || index}>{child}</BlockQuote>
5656
)),
57+
'unordered-list-item': (children: Array<Node>, { keys }: KeysObj) => (
58+
<ul key={keys.join('|')}>
59+
{children.map((child, index) => (
60+
<li key={keys[index]}>{child}</li>
61+
))}
62+
</ul>
63+
),
64+
'ordered-list-item': (children: Array<Node>, { keys }: KeysObj) => (
65+
<ol key={keys.join('|')}>
66+
{children.map((child, index) => (
67+
<li key={keys[index]}>{child}</li>
68+
))}
69+
</ol>
70+
),
5771
},
5872
entities: {
5973
LINK: (children: Array<Node>, data: DataObj, { key }: KeyObj) => (

shared/clients/draft-js/message/test/__snapshots__/renderer.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@ Array [
55
"unstyled",
66
"code-block",
77
"blockquote",
8+
"unordered-list-item",
9+
"ordered-list-item",
810
]
911
`;

src/components/message/style.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,12 @@ export const Text = styled(Bubble)`
251251
text-decoration: underline;
252252
word-break: break-word;
253253
}
254+
255+
ul,
256+
ol {
257+
margin-top: 0;
258+
margin-bottom: 0;
259+
}
254260
`;
255261

256262
export const Emoji = styled(Bubble)`

src/reset.css.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,6 @@ injectGlobal`
135135
margin-top: 16px;
136136
}
137137
138-
.markdown > *:first-of-type {
139-
margin-top: 16px;
140-
}
141-
142138
.markdown img {
143139
margin-top: 16px;
144140
max-width: 100%;

src/views/thread/style.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@ export const CommunityHeaderSubtitle = styled.span`
508508
export const ThreadSubtitle = styled(CommunityHeaderSubtitle)`
509509
font-size: 16px;
510510
margin-top: 8px;
511+
margin-bottom: 16px;
511512
display: flex;
512513
line-height: 1.5;
513514
flex-wrap: wrap;

0 commit comments

Comments
 (0)