Skip to content

Commit 11726ce

Browse files
auto: apply newest APITable commit
1 parent cf34853 commit 11726ce

File tree

6 files changed

+48
-14
lines changed

6 files changed

+48
-14
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.0.11",
2+
"version": "0.0.13",
33
"description": "a apitable widget",
44
"engines": {
55
"node": ">=8.x"
Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
import React, { FC } from 'react';
2-
import ReactMarkdown from 'react-markdown';
2+
import { StyleSheetManager } from 'styled-components';
3+
import { MarkdownStyled } from './styled';
4+
import { IContentWindow } from '../../render_base';
35

46
interface IMarkdownProps {
57
source: string;
8+
window: IContentWindow;
69
}
710

811
export const Markdown: FC<IMarkdownProps> = (props) => {
9-
const { source } = props;
12+
const { source, window } = props;
1013

1114
const LinkRenderer = (props) => {
1215
return (
@@ -17,8 +20,14 @@ export const Markdown: FC<IMarkdownProps> = (props) => {
1720
}
1821

1922
return (
20-
<ReactMarkdown components={{ a: LinkRenderer }}>
21-
{source}
22-
</ReactMarkdown>
23+
<StyleSheetManager
24+
target={window.document.head}
25+
>
26+
<MarkdownStyled
27+
components={{ a: LinkRenderer }}
28+
>
29+
{source}
30+
</MarkdownStyled>
31+
</StyleSheetManager>
2332
);
2433
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import styled, { css } from 'styled-components';
2+
import ReactMarkdown from 'react-markdown';
3+
import { applyDefaultTheme } from '../utils';
4+
5+
export const MarkdownStyled = styled(ReactMarkdown).attrs(applyDefaultTheme)`
6+
${props => {
7+
const { textCommonPrimary } = props.theme.color;
8+
9+
return css`
10+
color: ${textCommonPrimary};
11+
`;
12+
}}
13+
`;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import styled, { css } from 'styled-components';
2+
import { applyDefaultTheme } from '../utils';
3+
4+
export const TextContainer = styled.div.attrs(applyDefaultTheme)`
5+
${props => {
6+
const { textCommonPrimary } = props.theme.color;
7+
8+
return css`
9+
color: ${textCommonPrimary};
10+
`;
11+
}}
12+
`;
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
import React, { FC } from 'react';
2-
import { useTheme } from '@apitable/components';
32
import { StyleSheetManager } from 'styled-components';
3+
import { TextContainer } from './styled';
4+
import { IContentWindow } from '../../render_base';
45

56
interface ITextProps {
67
name: string;
8+
window: IContentWindow;
79
}
810

911
export const Text: FC<ITextProps> = (props) => {
10-
const { name } = props;
11-
const { color } = useTheme();
12+
const { name, window } = props;
1213

1314
return (
1415
<StyleSheetManager
1516
target={window.document.head}
1617
>
17-
<div style={{ color: color.textStaticPrimary }}>
18+
<TextContainer>
1819
{name}
19-
</div>
20+
</TextContainer>
2021
</StyleSheetManager>
2122
);
2223
}

src/render_components/output.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ export class OutputClass extends RenderBase implements Output {
1515
}
1616

1717
public markdown(source: string) {
18+
const props = { source };
1819
this.renderComponent(
19-
<Markdown
20-
source={source}
21-
/>
20+
<Markdown {...props as any} />
2221
);
2322
}
2423

0 commit comments

Comments
 (0)