Revert "Align latex with text (#6900)" (#6911)

This commit is contained in:
Elias Nahum
2022-12-27 15:22:00 +02:00
committed by GitHub
parent c872f7ca8d
commit 4d039ae88b
5 changed files with 246 additions and 223 deletions

View File

@@ -39,6 +39,7 @@ import type {
type MarkdownProps = {
autolinkedUrlSchemes?: string[];
baseTextStyle: StyleProp<TextStyle>;
baseParagraphStyle?: StyleProp<TextStyle>;
blockStyles?: MarkdownBlockStyles;
channelId?: string;
channelMentions?: ChannelMentions;
@@ -85,7 +86,7 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => {
return {
block: {
alignItems: 'center',
alignItems: 'flex-start',
flexDirection: 'row',
flexWrap: 'wrap',
},
@@ -128,7 +129,7 @@ const Markdown = ({
enableInlineLatex, enableLatex,
imagesMetadata, isEdited, isReplyPost, isSearchResult, layoutHeight, layoutWidth,
location, mentionKeys, minimumHashtagLength = 3, onPostPress, postId, searchPatterns,
textStyles = {}, theme, value = '',
textStyles = {}, theme, value = '', baseParagraphStyle,
}: MarkdownProps) => {
const style = getStyleSheet(theme);
const managedConfig = useManagedConfig<ManagedConfig>();
@@ -383,11 +384,13 @@ const Markdown = ({
}
return (
<MarkdownLatexInline
content={latexCode}
maxMathWidth={Dimensions.get('window').width * 0.75}
theme={theme}
/>
<Text>
<MarkdownLatexInline
content={latexCode}
maxMathWidth={Dimensions.get('window').width * 0.75}
theme={theme}
/>
</Text>
);
};
@@ -440,7 +443,9 @@ const Markdown = ({
style={blockStyle}
testID='markdown_paragraph'
>
{children}
<Text style={baseParagraphStyle}>
{children}
</Text>
</View>
);
};

View File

@@ -3,7 +3,7 @@
import React from 'react';
import {useIntl} from 'react-intl';
import {Text, View} from 'react-native';
import {Platform, Text, View} from 'react-native';
import MathView from 'react-native-math-view';
import ErrorBoundary from '@components/markdown/error_boundary';
@@ -23,6 +23,7 @@ type MathViewErrorProps = {
const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => {
return {
mathStyle: {
marginBottom: Platform.select({default: -10, ios: 2.5}),
color: theme.centerChannelColor,
},
viewStyle: {

View File

@@ -12,7 +12,7 @@ exports[`renderSystemMessage uses renderer for Channel Display Name update 1`] =
style={
[
{
"alignItems": "center",
"alignItems": "flex-start",
"flexDirection": "row",
"flexWrap": "wrap",
},
@@ -20,42 +20,44 @@ exports[`renderSystemMessage uses renderer for Channel Display Name update 1`] =
}
testID="markdown_paragraph"
>
<Text
style={
[
<Text>
<Text
style={
[
{
"color": "rgba(63,67,80,0.6)",
"fontFamily": "OpenSans",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 24,
},
{
"opacity": 1,
},
]
}
>
<Text
style={[]}
>
@username
</Text>
</Text>
<Text
selectable={false}
style={
{
"color": "rgba(63,67,80,0.6)",
"fontFamily": "OpenSans",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 24,
},
{
"opacity": 1,
},
]
}
>
<Text
style={[]}
>
@username
</Text>
</Text>
<Text
selectable={false}
style={
{
"color": "rgba(63,67,80,0.6)",
"fontFamily": "OpenSans",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 24,
}
}
}
testID="markdown_text"
>
updated the channel display name from: old displayname to: new displayname
testID="markdown_text"
>
updated the channel display name from: old displayname to: new displayname
</Text>
</Text>
</View>
</View>
@@ -73,7 +75,7 @@ exports[`renderSystemMessage uses renderer for Channel Header update 1`] = `
style={
[
{
"alignItems": "center",
"alignItems": "flex-start",
"flexDirection": "row",
"flexWrap": "wrap",
},
@@ -81,42 +83,44 @@ exports[`renderSystemMessage uses renderer for Channel Header update 1`] = `
}
testID="markdown_paragraph"
>
<Text
style={
[
<Text>
<Text
style={
[
{
"color": "rgba(63,67,80,0.6)",
"fontFamily": "OpenSans",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 24,
},
{
"opacity": 1,
},
]
}
>
<Text
style={[]}
>
@username
</Text>
</Text>
<Text
selectable={false}
style={
{
"color": "rgba(63,67,80,0.6)",
"fontFamily": "OpenSans",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 24,
},
{
"opacity": 1,
},
]
}
>
<Text
style={[]}
>
@username
</Text>
</Text>
<Text
selectable={false}
style={
{
"color": "rgba(63,67,80,0.6)",
"fontFamily": "OpenSans",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 24,
}
}
}
testID="markdown_text"
>
updated the channel header from: old header to: new header
testID="markdown_text"
>
updated the channel header from: old header to: new header
</Text>
</Text>
</View>
</View>
@@ -150,7 +154,7 @@ exports[`renderSystemMessage uses renderer for Guest added and join to channel 1
style={
[
{
"alignItems": "center",
"alignItems": "flex-start",
"flexDirection": "row",
"flexWrap": "wrap",
},
@@ -158,42 +162,44 @@ exports[`renderSystemMessage uses renderer for Guest added and join to channel 1
}
testID="markdown_paragraph"
>
<Text
style={
[
<Text>
<Text
style={
[
{
"color": "rgba(63,67,80,0.6)",
"fontFamily": "OpenSans",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 24,
},
{
"opacity": 1,
},
]
}
>
<Text
style={[]}
>
@username
</Text>
</Text>
<Text
selectable={false}
style={
{
"color": "rgba(63,67,80,0.6)",
"fontFamily": "OpenSans",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 24,
},
{
"opacity": 1,
},
]
}
>
<Text
style={[]}
>
@username
</Text>
</Text>
<Text
selectable={false}
style={
{
"color": "rgba(63,67,80,0.6)",
"fontFamily": "OpenSans",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 24,
}
}
}
testID="markdown_text"
>
joined the channel as a guest.
testID="markdown_text"
>
joined the channel as a guest.
</Text>
</Text>
</View>
</View>
@@ -211,7 +217,7 @@ exports[`renderSystemMessage uses renderer for Guest added and join to channel 2
style={
[
{
"alignItems": "center",
"alignItems": "flex-start",
"flexDirection": "row",
"flexWrap": "wrap",
},
@@ -219,63 +225,65 @@ exports[`renderSystemMessage uses renderer for Guest added and join to channel 2
}
testID="markdown_paragraph"
>
<Text
style={
[
{
"color": "rgba(63,67,80,0.6)",
"fontFamily": "OpenSans",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 24,
},
{
"opacity": 1,
},
]
}
>
<Text>
<Text
style={[]}
>
@other.user
</Text>
</Text>
<Text
selectable={false}
style={
{
"color": "rgba(63,67,80,0.6)",
"fontFamily": "OpenSans",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 24,
style={
[
{
"color": "rgba(63,67,80,0.6)",
"fontFamily": "OpenSans",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 24,
},
{
"opacity": 1,
},
]
}
}
testID="markdown_text"
>
added to the channel as a guest by
</Text>
<Text
style={
[
>
<Text
style={[]}
>
@other.user
</Text>
</Text>
<Text
selectable={false}
style={
{
"color": "rgba(63,67,80,0.6)",
"fontFamily": "OpenSans",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 24,
},
{
"opacity": 1,
},
]
}
>
<Text
style={[]}
}
}
testID="markdown_text"
>
@username.
added to the channel as a guest by
</Text>
<Text
style={
[
{
"color": "rgba(63,67,80,0.6)",
"fontFamily": "OpenSans",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 24,
},
{
"opacity": 1,
},
]
}
>
<Text
style={[]}
>
@username.
</Text>
</Text>
</Text>
</View>
@@ -294,7 +302,7 @@ exports[`renderSystemMessage uses renderer for OLD archived channel without a us
style={
[
{
"alignItems": "center",
"alignItems": "flex-start",
"flexDirection": "row",
"flexWrap": "wrap",
},
@@ -302,20 +310,22 @@ exports[`renderSystemMessage uses renderer for OLD archived channel without a us
}
testID="markdown_paragraph"
>
<Text
selectable={false}
style={
{
"color": "rgba(63,67,80,0.6)",
"fontFamily": "OpenSans",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 24,
<Text>
<Text
selectable={false}
style={
{
"color": "rgba(63,67,80,0.6)",
"fontFamily": "OpenSans",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 24,
}
}
}
testID="markdown_text"
>
archived the channel
testID="markdown_text"
>
archived the channel
</Text>
</Text>
</View>
</View>
@@ -333,7 +343,7 @@ exports[`renderSystemMessage uses renderer for archived channel 1`] = `
style={
[
{
"alignItems": "center",
"alignItems": "flex-start",
"flexDirection": "row",
"flexWrap": "wrap",
},
@@ -341,42 +351,44 @@ exports[`renderSystemMessage uses renderer for archived channel 1`] = `
}
testID="markdown_paragraph"
>
<Text
style={
[
<Text>
<Text
style={
[
{
"color": "rgba(63,67,80,0.6)",
"fontFamily": "OpenSans",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 24,
},
{
"opacity": 1,
},
]
}
>
<Text
style={[]}
>
@username
</Text>
</Text>
<Text
selectable={false}
style={
{
"color": "rgba(63,67,80,0.6)",
"fontFamily": "OpenSans",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 24,
},
{
"opacity": 1,
},
]
}
>
<Text
style={[]}
>
@username
</Text>
</Text>
<Text
selectable={false}
style={
{
"color": "rgba(63,67,80,0.6)",
"fontFamily": "OpenSans",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 24,
}
}
}
testID="markdown_text"
>
archived the channel
testID="markdown_text"
>
archived the channel
</Text>
</Text>
</View>
</View>
@@ -394,7 +406,7 @@ exports[`renderSystemMessage uses renderer for unarchived channel 1`] = `
style={
[
{
"alignItems": "center",
"alignItems": "flex-start",
"flexDirection": "row",
"flexWrap": "wrap",
},
@@ -402,42 +414,44 @@ exports[`renderSystemMessage uses renderer for unarchived channel 1`] = `
}
testID="markdown_paragraph"
>
<Text
style={
[
<Text>
<Text
style={
[
{
"color": "rgba(63,67,80,0.6)",
"fontFamily": "OpenSans",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 24,
},
{
"opacity": 1,
},
]
}
>
<Text
style={[]}
>
@username
</Text>
</Text>
<Text
selectable={false}
style={
{
"color": "rgba(63,67,80,0.6)",
"fontFamily": "OpenSans",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 24,
},
{
"opacity": 1,
},
]
}
>
<Text
style={[]}
>
@username
</Text>
</Text>
<Text
selectable={false}
style={
{
"color": "rgba(63,67,80,0.6)",
"fontFamily": "OpenSans",
"fontSize": 16,
"fontWeight": "400",
"lineHeight": 24,
}
}
}
testID="markdown_text"
>
unarchived the channel
testID="markdown_text"
>
unarchived the channel
</Text>
</Text>
</View>
</View>

View File

@@ -42,6 +42,9 @@ const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => {
color: theme.centerChannelColor,
...typography('Body', 200, 'Regular'),
},
errorTextParagraph: {
textAlign: 'center',
},
errorButtonContainer: {
borderTopWidth: 1,
borderTopColor: changeOpacity(theme.centerChannelColor, 0.16),
@@ -128,6 +131,7 @@ function PermalinkError({
theme={theme}
value={text}
baseTextStyle={style.errorText}
baseParagraphStyle={style.errorTextParagraph}
disableAtMentions={true}
disableAtChannelMentionHighlight={true}
disableChannelLink={true}

View File

@@ -30,7 +30,6 @@ export const getMarkdownTextStyles = makeStyleSheetFromTheme((theme: Theme) => {
},
strong: {
fontFamily: 'OpenSans-SemiBold',
fontWeight: '600',
},
del: {
textDecorationLine: 'line-through',