Support for sending formatting messages

This commit is contained in:
Scott Nonnenberg 2023-04-14 11:16:28 -07:00 committed by GitHub
parent 42e13aedcd
commit 9bfbee464b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
65 changed files with 1762 additions and 371 deletions

View file

@ -196,7 +196,7 @@ function renderNode({
);
}
const content = renderMentions({
let content = renderMentions({
direction,
disableLinks,
emojiSizeClass,
@ -206,13 +206,19 @@ function renderNode({
text: node.text,
});
// We use separate elements for these because we want screenreaders to understand them
if (node.isBold || node.isKeywordHighlight) {
content = <strong>{content}</strong>;
}
if (node.isItalic) {
content = <em>{content}</em>;
}
if (node.isStrikethrough) {
content = <s>{content}</s>;
}
const formattingClasses = classNames(
node.isBold ? 'MessageTextRenderer__formatting--bold' : null,
node.isItalic ? 'MessageTextRenderer__formatting--italic' : null,
node.isMonospace ? 'MessageTextRenderer__formatting--monospace' : null,
node.isStrikethrough
? 'MessageTextRenderer__formatting--strikethrough'
: null,
node.isKeywordHighlight
? 'MessageTextRenderer__formatting--keywordHighlight'
: null,