Skip to content

Fix nested markdown not applied #59586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions src/components/HTMLEngineProvider/BaseHTMLEngineProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import useThemeStyles from '@hooks/useThemeStyles';
import convertToLTR from '@libs/convertToLTR';
import FontUtils from '@styles/utils/FontUtils';
import type ChildrenProps from '@src/types/utils/ChildrenProps';
import * as HTMLEngineUtils from './htmlEngineUtils';
import {computeEmbeddedMaxWidth, isChildOfTaskTitle} from './htmlEngineUtils';
import htmlRenderers from './HTMLRenderers';

type BaseHTMLEngineProviderProps = ChildrenProps & {
Expand Down Expand Up @@ -80,9 +80,19 @@ function BaseHTMLEngineProvider({textSelectable = false, children, enableExperim
}),
strong: HTMLElementModel.fromCustomModel({
tagName: 'strong',
mixedUAStyles: {whiteSpace: 'pre'},
getMixedUAStyles: (tnode) => (isChildOfTaskTitle(tnode as TNode) ? {} : styles.strong),
contentModel: HTMLContentModel.textual,
}),
em: HTMLElementModel.fromCustomModel({
tagName: 'em',
getMixedUAStyles: (tnode) => (isChildOfTaskTitle(tnode as TNode) ? styles.taskTitleMenuItemItalic : styles.em),
contentModel: HTMLContentModel.textual,
}),
h1: HTMLElementModel.fromCustomModel({
tagName: 'h1',
getMixedUAStyles: (tnode) => (isChildOfTaskTitle(tnode as TNode) ? {} : styles.h1),
contentModel: HTMLContentModel.block,
}),
'mention-user': HTMLElementModel.fromCustomModel({tagName: 'mention-user', contentModel: HTMLContentModel.textual}),
'mention-report': HTMLElementModel.fromCustomModel({tagName: 'mention-report', contentModel: HTMLContentModel.textual}),
'mention-here': HTMLElementModel.fromCustomModel({tagName: 'mention-here', contentModel: HTMLContentModel.textual}),
Expand All @@ -109,9 +119,9 @@ function BaseHTMLEngineProvider({textSelectable = false, children, enableExperim
contentModel: HTMLContentModel.block,
getMixedUAStyles: (tnode) => {
if (tnode.attributes.isemojisonly === undefined) {
return HTMLEngineUtils.isChildOfTaskTitle(tnode as TNode) ? {} : styles.blockquote;
return isChildOfTaskTitle(tnode as TNode) ? {} : styles.blockquote;
}
return HTMLEngineUtils.isChildOfTaskTitle(tnode as TNode) ? {} : {...styles.blockquote, ...styles.onlyEmojisTextLineHeight};
return isChildOfTaskTitle(tnode as TNode) ? {} : {...styles.blockquote, ...styles.onlyEmojisTextLineHeight};
},
}),
}),
Expand All @@ -127,6 +137,10 @@ function BaseHTMLEngineProvider({textSelectable = false, children, enableExperim
styles.onlyEmojisText,
styles.onlyEmojisTextLineHeight,
styles.taskTitleMenuItem,
styles.taskTitleMenuItemItalic,
styles.em,
styles.strong,
styles.h1,
styles.blockquote,
],
);
Expand Down Expand Up @@ -154,7 +168,7 @@ function BaseHTMLEngineProvider({textSelectable = false, children, enableExperim
defaultTextProps={defaultTextProps}
defaultViewProps={defaultViewProps}
renderers={htmlRenderers}
computeEmbeddedMaxWidth={HTMLEngineUtils.computeEmbeddedMaxWidth}
computeEmbeddedMaxWidth={computeEmbeddedMaxWidth}
enableExperimentalBRCollapsing={enableExperimentalBRCollapsing}
>
{children}
Expand Down
33 changes: 0 additions & 33 deletions src/components/HTMLEngineProvider/HTMLRenderers/EMRenderer.tsx

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function MentionReportRenderer({style, tnode, TDefaultRenderer, ...defaultRender
style={
isGroupPolicyReport && (!exactlyMatch || navigationRoute)
? [styles.link, styleWithoutColor, StyleUtils.getMentionStyle(isCurrentRoomMention), {color: StyleUtils.getMentionTextColor(isCurrentRoomMention)}]
: []
: [flattenStyle]
}
suppressHighlighting
onPress={
Expand Down

This file was deleted.

6 changes: 0 additions & 6 deletions src/components/HTMLEngineProvider/HTMLRenderers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@ import CodeRenderer from './CodeRenderer';
import DeletedActionRenderer from './DeletedActionRenderer';
import EditedRenderer from './EditedRenderer';
import EmojiRenderer from './EmojiRenderer';
import EMRenderer from './EMRenderer';
import HeadingRenderer from './HeadingRenderer';
import ImageRenderer from './ImageRenderer';
import MentionHereRenderer from './MentionHereRenderer';
import MentionReportRenderer from './MentionReportRenderer';
import MentionUserRenderer from './MentionUserRenderer';
import NextStepEmailRenderer from './NextStepEmailRenderer';
import PreRenderer from './PreRenderer';
import ShortMentionRenderer from './ShortMentionRenderer';
import StrongRenderer from './StrongRenderer';
import TaskTitleRenderer from './TaskTitleRenderer';
import VideoRenderer from './VideoRenderer';

Expand All @@ -26,9 +23,6 @@ const HTMLEngineProviderComponentList: CustomTagRendererRecord = {
code: CodeRenderer,
img: ImageRenderer,
video: VideoRenderer,
h1: HeadingRenderer,
strong: StrongRenderer,
em: EMRenderer,

// Custom tag renderers
edited: EditedRenderer,
Expand Down
19 changes: 5 additions & 14 deletions src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,18 +150,6 @@ const webViewStyles = (theme: ThemeColors) =>
// styles from the renderer, just pass the "style" prop to the underlying
// component.
tagStyles: {
em: {
// We set fontFamily and fontStyle directly in order to avoid overriding fontWeight.
fontFamily: FontUtils.fontFamily.platform.EXP_NEUE_ITALIC.fontFamily,
fontStyle: FontUtils.fontFamily.platform.EXP_NEUE_ITALIC.fontStyle,
},

strong: {
// We set fontFamily and fontWeight directly in order to avoid overriding fontStyle.
fontFamily: FontUtils.fontFamily.platform.EXP_NEUE_BOLD.fontFamily,
fontWeight: FontUtils.fontFamily.platform.EXP_NEUE_BOLD.fontWeight,
},

del: {
textDecorationLine: 'line-through',
textDecorationStyle: 'solid',
Expand Down Expand Up @@ -218,8 +206,6 @@ const webViewStyles = (theme: ThemeColors) =>
marginBottom: 0,
},
h1: {
fontSize: undefined,
fontWeight: undefined,
marginBottom: 8,
},
},
Expand Down Expand Up @@ -288,6 +274,11 @@ const styles = (theme: ThemeColors) =>
fontWeight: FontUtils.fontFamily.platform.EXP_NEUE_BOLD.fontWeight,
},

em: {
fontFamily: FontUtils.fontFamily.platform.EXP_NEUE_ITALIC.fontFamily,
fontStyle: FontUtils.fontFamily.platform.EXP_NEUE_ITALIC.fontStyle,
},

autoCompleteSuggestionContainer: {
flexDirection: 'row',
alignItems: 'center',
Expand Down