Skip to content

Commit

Permalink
Merge pull request #48756 from daledah/fix/47899
Browse files Browse the repository at this point in the history
fix: The top of emojis are cut off on applying quote markdown
  • Loading branch information
aldo-expensify authored Sep 16, 2024
2 parents 12779f1 + bec5376 commit 6c82111
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
22 changes: 21 additions & 1 deletion src/components/HTMLEngineProvider/BaseHTMLEngineProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,28 @@ function BaseHTMLEngineProvider({textSelectable = false, children, enableExperim
mixedUAStyles: {...styles.textSupporting, ...styles.textLineThrough},
contentModel: HTMLContentModel.textual,
}),
blockquote: HTMLElementModel.fromCustomModel({
tagName: 'blockquote',
contentModel: HTMLContentModel.block,
getMixedUAStyles: (tnode) => {
if (tnode.attributes.isemojisonly === undefined) {
return;
}
return styles.onlyEmojisTextLineHeight;
},
}),
}),
[styles.formError, styles.mb0, styles.colorMuted, styles.textLabelSupporting, styles.lh16, styles.textSupporting, styles.textLineThrough, styles.mutedNormalTextLabel],
[
styles.formError,
styles.mb0,
styles.colorMuted,
styles.textLabelSupporting,
styles.lh16,
styles.textSupporting,
styles.textLineThrough,
styles.mutedNormalTextLabel,
styles.onlyEmojisTextLineHeight,
],
);
/* eslint-enable @typescript-eslint/naming-convention */

Expand Down
6 changes: 5 additions & 1 deletion src/pages/home/report/comment/TextCommentFragment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ function TextCommentFragment({fragment, styleAsDeleted, styleAsMuted = false, so
const editedTag = fragment?.isEdited ? `<edited ${styleAsDeleted ? 'deleted' : ''} ${containsOnlyEmojis ? 'islarge' : ''}></edited>` : '';
const htmlWithDeletedTag = styleAsDeleted ? `<del>${html}</del>` : html;

const htmlContent = containsOnlyEmojis ? Str.replaceAll(htmlWithDeletedTag, '<emoji>', '<emoji islarge>') : htmlWithDeletedTag;
let htmlContent = htmlWithDeletedTag;
if (containsOnlyEmojis) {
htmlContent = Str.replaceAll(htmlContent, '<emoji>', '<emoji islarge>');
htmlContent = Str.replaceAll(htmlContent, '<blockquote>', '<blockquote isemojisonly>');
}
let htmlWithTag = editedTag ? `${htmlContent}${editedTag}` : htmlContent;

if (styleAsMuted) {
Expand Down

0 comments on commit 6c82111

Please sign in to comment.