@kids-reporter/draft-renderer 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/block-render-map.js +183 -0
- package/lib/block-renderer-fn.js +16 -75
- package/lib/block-renderers/embedded-code-block.js +33 -21
- package/lib/block-renderers/image-block.js +90 -46
- package/lib/block-renderers/index.js +3 -31
- package/lib/block-renderers/info-box-block.js +2 -115
- package/lib/block-renderers/multimedia.js +127 -0
- package/lib/block-renderers/slideshow-block.js +574 -199
- package/lib/draft-renderer.js +10 -194
- package/lib/entity-decorators/annotation-decorator.js +58 -100
- package/lib/entity-decorators/index.js +17 -6
- package/lib/entity-decorators/link-decorator.js +4 -7
- package/lib/index.js +39 -14
- package/lib/theme/index.js +0 -11
- package/package.json +10 -6
- package/lib/assets/annotation-arrow.png +0 -0
- package/lib/assets/audio-pause.png +0 -0
- package/lib/assets/audio-play.png +0 -0
- package/lib/assets/citation-download.png +0 -0
- package/lib/assets/default-og-img.png +0 -0
- package/lib/assets/slideshow-arrow-down-dark.png +0 -0
- package/lib/assets/slideshow-arrow-down.png +0 -0
- package/lib/assets/slideshow-arrow-up.png +0 -0
- package/lib/assets/slideshow-close-cross.png +0 -0
- package/lib/block-renderers/audio-block.js +0 -162
- package/lib/block-renderers/background-image-block.js +0 -257
- package/lib/block-renderers/background-video-block.js +0 -272
- package/lib/block-renderers/color-box-block.js +0 -94
- package/lib/block-renderers/divider-block.js +0 -27
- package/lib/block-renderers/media-block.js +0 -65
- package/lib/block-renderers/related-post-block.js +0 -73
- package/lib/block-renderers/side-index-block.js +0 -49
- package/lib/block-renderers/table-block.js +0 -455
- package/lib/block-renderers/video-block.js +0 -37
- package/lib/components/slideshow-lightbox.js +0 -134
- package/lib/components/slideshow-sidebar.js +0 -148
- package/lib/const.js +0 -10
- package/lib/entity-decorator.js +0 -18
- package/lib/public/07d1287fd390346af0c15b930148a5e4.png +0 -0
- package/lib/public/5b3cb1a908786c8750f1041860699cc1.png +0 -0
- package/lib/public/679d63b1846e81ada28c2f76edbd2931.png +0 -0
- package/lib/public/722f90c535fa64c27555ec6ee5f22393.png +0 -0
- package/lib/public/903cf84ef5c5ad76634c30bdc0ff8c49.png +0 -0
- package/lib/public/dc249b3412c5af890a004508287a3c3d.png +0 -0
- package/lib/public/dd45f0788d9c70cabe72430bf08e7413.png +0 -0
- package/lib/public/f96d4b486ba2061c460962ae694f4670.png +0 -0
- package/lib/shared-style/content-type.js +0 -163
- package/lib/shared-style/index.js +0 -108
- package/lib/types/index.js +0 -32
- package/lib/utils/common.js +0 -44
- package/lib/utils/post.js +0 -147
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.blockRenderMapForAnnotation = exports.blockRenderMap = void 0;
|
|
7
|
+
|
|
8
|
+
var _immutable = _interopRequireDefault(require("immutable"));
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
+
|
|
14
|
+
var _draftJs = require("draft-js");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
const ParagraphBlock = _styledComponents.default.div`
|
|
19
|
+
width: 100%;
|
|
20
|
+
max-width: 700px;
|
|
21
|
+
margin: 0 auto 27px auto;
|
|
22
|
+
font-size: 18px;
|
|
23
|
+
font-weight: 500;
|
|
24
|
+
color: #3a4f66;
|
|
25
|
+
letter-spacing: 0.9px;
|
|
26
|
+
line-height: 2;
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
function Paragraph({
|
|
30
|
+
className,
|
|
31
|
+
children
|
|
32
|
+
}) {
|
|
33
|
+
return /*#__PURE__*/_react.default.createElement(ParagraphBlock, {
|
|
34
|
+
className: className
|
|
35
|
+
}, children);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const HeadingBlock = _styledComponents.default.div`
|
|
39
|
+
font-weight: 700;
|
|
40
|
+
line-height: 1.5;
|
|
41
|
+
color: #232323;
|
|
42
|
+
width: 100%;
|
|
43
|
+
max-width: 700px;
|
|
44
|
+
margin: 45px auto 20px auto;
|
|
45
|
+
|
|
46
|
+
h2,
|
|
47
|
+
h3,
|
|
48
|
+
h4 {
|
|
49
|
+
margin: 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
h2 {
|
|
53
|
+
font-size: 30px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
h3 {
|
|
57
|
+
font-size: 28px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
h4 {
|
|
61
|
+
font-size: 26px;
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
|
|
65
|
+
function Heading({
|
|
66
|
+
className,
|
|
67
|
+
children
|
|
68
|
+
}) {
|
|
69
|
+
return /*#__PURE__*/_react.default.createElement(HeadingBlock, {
|
|
70
|
+
className: className
|
|
71
|
+
}, children);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const ListBlock = _styledComponents.default.ol`
|
|
75
|
+
width: 100%;
|
|
76
|
+
max-width: 700px;
|
|
77
|
+
margin: 0 auto 27px auto;
|
|
78
|
+
font-size: 18px;
|
|
79
|
+
line-height: 2;
|
|
80
|
+
letter-spacing: 0.9px;
|
|
81
|
+
color: #3a4f66;
|
|
82
|
+
|
|
83
|
+
> li {
|
|
84
|
+
margin-bottom: 6px;
|
|
85
|
+
}
|
|
86
|
+
`;
|
|
87
|
+
|
|
88
|
+
function OrderdedList({
|
|
89
|
+
children,
|
|
90
|
+
className
|
|
91
|
+
}) {
|
|
92
|
+
return /*#__PURE__*/_react.default.createElement(ListBlock, {
|
|
93
|
+
className: className
|
|
94
|
+
}, children);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function UnorderdedList({
|
|
98
|
+
children,
|
|
99
|
+
className
|
|
100
|
+
}) {
|
|
101
|
+
return /*#__PURE__*/_react.default.createElement(ListBlock, {
|
|
102
|
+
as: "ul",
|
|
103
|
+
className: className
|
|
104
|
+
}, children);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const _blockRenderMap = _immutable.default.Map({
|
|
108
|
+
atomic: {
|
|
109
|
+
element: 'div'
|
|
110
|
+
},
|
|
111
|
+
'header-two': {
|
|
112
|
+
element: 'h2',
|
|
113
|
+
wrapper: /*#__PURE__*/_react.default.createElement(Heading, null)
|
|
114
|
+
},
|
|
115
|
+
'header-three': {
|
|
116
|
+
element: 'h3',
|
|
117
|
+
wrapper: /*#__PURE__*/_react.default.createElement(Heading, null)
|
|
118
|
+
},
|
|
119
|
+
'header-four': {
|
|
120
|
+
element: 'h4',
|
|
121
|
+
wrapper: /*#__PURE__*/_react.default.createElement(Heading, null)
|
|
122
|
+
},
|
|
123
|
+
'ordered-list-item': {
|
|
124
|
+
element: 'li',
|
|
125
|
+
wrapper: /*#__PURE__*/_react.default.createElement(OrderdedList, null)
|
|
126
|
+
},
|
|
127
|
+
'unordered-list-item': {
|
|
128
|
+
element: 'li',
|
|
129
|
+
wrapper: /*#__PURE__*/_react.default.createElement(UnorderdedList, null)
|
|
130
|
+
},
|
|
131
|
+
unstyled: {
|
|
132
|
+
element: 'div',
|
|
133
|
+
wrapper: /*#__PURE__*/_react.default.createElement(Paragraph, null)
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const blockRenderMap = _draftJs.DefaultDraftBlockRenderMap.merge(_blockRenderMap);
|
|
138
|
+
|
|
139
|
+
exports.blockRenderMap = blockRenderMap;
|
|
140
|
+
const HeadingForAnnotation = (0, _styledComponents.default)(Heading)`
|
|
141
|
+
h4 {
|
|
142
|
+
font-size: 20px;
|
|
143
|
+
}
|
|
144
|
+
`;
|
|
145
|
+
const OrderdedListForAnnotation = (0, _styledComponents.default)(OrderdedList)`
|
|
146
|
+
li {
|
|
147
|
+
font-size: 16px;
|
|
148
|
+
}
|
|
149
|
+
`;
|
|
150
|
+
const UnorderdedListForAnnotation = (0, _styledComponents.default)(UnorderdedList)`
|
|
151
|
+
li {
|
|
152
|
+
font-size: 16px;
|
|
153
|
+
}
|
|
154
|
+
`;
|
|
155
|
+
const ParagraphForAnnotation = (0, _styledComponents.default)(Paragraph)`
|
|
156
|
+
/* overwrite css */
|
|
157
|
+
font-size: 16px;
|
|
158
|
+
font-weight: 400;
|
|
159
|
+
margin-bottom: 0;
|
|
160
|
+
`;
|
|
161
|
+
|
|
162
|
+
const _blockRenderMapForAnnotation = _immutable.default.Map({
|
|
163
|
+
'header-four': {
|
|
164
|
+
element: 'h4',
|
|
165
|
+
wrapper: /*#__PURE__*/_react.default.createElement(HeadingForAnnotation, null)
|
|
166
|
+
},
|
|
167
|
+
'ordered-list-item': {
|
|
168
|
+
element: 'li',
|
|
169
|
+
wrapper: /*#__PURE__*/_react.default.createElement(OrderdedListForAnnotation, null)
|
|
170
|
+
},
|
|
171
|
+
'unordered-list-item': {
|
|
172
|
+
element: 'li',
|
|
173
|
+
wrapper: /*#__PURE__*/_react.default.createElement(UnorderdedListForAnnotation, null)
|
|
174
|
+
},
|
|
175
|
+
unstyled: {
|
|
176
|
+
element: 'div',
|
|
177
|
+
wrapper: /*#__PURE__*/_react.default.createElement(ParagraphForAnnotation, null)
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
const blockRenderMapForAnnotation = _draftJs.DefaultDraftBlockRenderMap.merge(_blockRenderMapForAnnotation);
|
|
182
|
+
|
|
183
|
+
exports.blockRenderMapForAnnotation = blockRenderMapForAnnotation;
|
package/lib/block-renderer-fn.js
CHANGED
|
@@ -8,103 +8,44 @@ exports.atomicBlockRenderer = atomicBlockRenderer;
|
|
|
8
8
|
var _blockRenderers = require("./block-renderers");
|
|
9
9
|
|
|
10
10
|
const {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
ImageBlock,
|
|
11
|
+
EmbeddedCodeInArticleBody,
|
|
12
|
+
ImageInArticleBody,
|
|
14
13
|
InfoBoxBlock,
|
|
15
|
-
|
|
16
|
-
SlideshowBlockV2,
|
|
17
|
-
DividerBlock,
|
|
18
|
-
TableBlock,
|
|
19
|
-
ColorBoxBlock,
|
|
20
|
-
BGImageBlock,
|
|
21
|
-
BGVideoBlock,
|
|
22
|
-
RelatedPostBlock,
|
|
23
|
-
SideIndexBlock,
|
|
24
|
-
VideoBlock,
|
|
25
|
-
AudioBlock
|
|
14
|
+
SlideshowInArticleBody
|
|
26
15
|
} = _blockRenderers.blockRenderers;
|
|
27
16
|
|
|
28
17
|
const AtomicBlock = props => {
|
|
29
18
|
const entity = props.contentState.getEntity(props.block.getEntityAt(0));
|
|
30
19
|
const entityType = entity.getType();
|
|
20
|
+
const entityData = entity.getData();
|
|
31
21
|
|
|
32
22
|
switch (entityType) {
|
|
33
|
-
case 'audioLink':
|
|
34
|
-
case 'imageLink':
|
|
35
|
-
case 'videoLink':
|
|
36
|
-
{
|
|
37
|
-
return MediaBlock(entity);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
23
|
case 'image':
|
|
41
24
|
{
|
|
42
|
-
return
|
|
25
|
+
return ImageInArticleBody({
|
|
26
|
+
data: entityData
|
|
27
|
+
});
|
|
43
28
|
}
|
|
44
29
|
|
|
45
30
|
case 'slideshow':
|
|
46
31
|
{
|
|
47
|
-
return
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
case 'slideshow-v2':
|
|
51
|
-
{
|
|
52
|
-
return SlideshowBlockV2(entity);
|
|
32
|
+
return SlideshowInArticleBody({
|
|
33
|
+
data: entityData
|
|
34
|
+
});
|
|
53
35
|
}
|
|
54
36
|
|
|
55
37
|
case 'EMBEDDEDCODE':
|
|
56
38
|
{
|
|
57
|
-
return
|
|
39
|
+
return EmbeddedCodeInArticleBody({
|
|
40
|
+
data: entityData
|
|
41
|
+
});
|
|
58
42
|
}
|
|
59
43
|
|
|
60
44
|
case 'INFOBOX':
|
|
61
45
|
{
|
|
62
|
-
return InfoBoxBlock(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
case 'DIVIDER':
|
|
66
|
-
{
|
|
67
|
-
return DividerBlock();
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
case 'TABLE':
|
|
71
|
-
{
|
|
72
|
-
return TableBlock(props);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
case 'COLORBOX':
|
|
76
|
-
{
|
|
77
|
-
return ColorBoxBlock(props);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
case 'BACKGROUNDIMAGE':
|
|
81
|
-
{
|
|
82
|
-
return BGImageBlock(props);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
case 'BACKGROUNDVIDEO':
|
|
86
|
-
{
|
|
87
|
-
return BGVideoBlock(props);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
case 'RELATEDPOST':
|
|
91
|
-
{
|
|
92
|
-
return RelatedPostBlock(entity);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
case 'SIDEINDEX':
|
|
96
|
-
{
|
|
97
|
-
return SideIndexBlock(props);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
case 'VIDEO':
|
|
101
|
-
{
|
|
102
|
-
return VideoBlock(entity);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
case 'AUDIO':
|
|
106
|
-
{
|
|
107
|
-
return AudioBlock(entity);
|
|
46
|
+
return InfoBoxBlock({
|
|
47
|
+
data: entityData
|
|
48
|
+
});
|
|
108
49
|
}
|
|
109
50
|
}
|
|
110
51
|
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.EmbeddedCodeBlock = exports.Caption = exports.Block = void 0;
|
|
7
|
+
exports.EmbeddedCodeInArticleBody = EmbeddedCodeInArticleBody;
|
|
7
8
|
|
|
8
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
10
|
|
|
@@ -40,11 +41,14 @@ const Caption = _styledComponents.default.div`
|
|
|
40
41
|
`;
|
|
41
42
|
exports.Caption = Caption;
|
|
42
43
|
|
|
43
|
-
const EmbeddedCodeBlock =
|
|
44
|
+
const EmbeddedCodeBlock = ({
|
|
45
|
+
className,
|
|
46
|
+
data
|
|
47
|
+
}) => {
|
|
44
48
|
const {
|
|
45
49
|
caption,
|
|
46
50
|
embeddedCode
|
|
47
|
-
} =
|
|
51
|
+
} = data;
|
|
48
52
|
const embedded = (0, _react.useRef)(null); // `embeddedCode` is a string, which may includes
|
|
49
53
|
// multiple script tags and other html tags.
|
|
50
54
|
// Here we separate script tags and other html tags
|
|
@@ -98,24 +102,32 @@ const EmbeddedCodeBlock = entity => {
|
|
|
98
102
|
node.appendChild(fragment);
|
|
99
103
|
}
|
|
100
104
|
}, [scripts]);
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
},
|
|
113
|
-
ref: embedded,
|
|
114
|
-
dangerouslySetInnerHTML: {
|
|
115
|
-
__html: nonScriptsHtml
|
|
116
|
-
}
|
|
117
|
-
}), shouldShowCaption ? /*#__PURE__*/_react.default.createElement(Caption, null, caption) : null)
|
|
118
|
-
);
|
|
105
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
106
|
+
className: className
|
|
107
|
+
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
108
|
+
hidden: true,
|
|
109
|
+
disabled: true
|
|
110
|
+
}), /*#__PURE__*/_react.default.createElement(Block, {
|
|
111
|
+
ref: embedded,
|
|
112
|
+
dangerouslySetInnerHTML: {
|
|
113
|
+
__html: nonScriptsHtml
|
|
114
|
+
}
|
|
115
|
+
}), caption && /*#__PURE__*/_react.default.createElement(Caption, null, caption));
|
|
119
116
|
};
|
|
120
117
|
|
|
121
|
-
exports.EmbeddedCodeBlock = EmbeddedCodeBlock;
|
|
118
|
+
exports.EmbeddedCodeBlock = EmbeddedCodeBlock;
|
|
119
|
+
const ArticleBodyContainer = _styledComponents.default.div`
|
|
120
|
+
max-width: 700px;
|
|
121
|
+
margin: 0 auto 27px auto;
|
|
122
|
+
`;
|
|
123
|
+
|
|
124
|
+
function EmbeddedCodeInArticleBody({
|
|
125
|
+
className = '',
|
|
126
|
+
data
|
|
127
|
+
}) {
|
|
128
|
+
return /*#__PURE__*/_react.default.createElement(ArticleBodyContainer, {
|
|
129
|
+
className: className
|
|
130
|
+
}, /*#__PURE__*/_react.default.createElement(EmbeddedCodeBlock, {
|
|
131
|
+
data: data
|
|
132
|
+
}));
|
|
133
|
+
}
|
|
@@ -4,69 +4,113 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ImageBlock = ImageBlock;
|
|
7
|
+
exports.ImageInArticleBody = ImageInArticleBody;
|
|
7
8
|
|
|
8
9
|
var _react = _interopRequireDefault(require("react"));
|
|
9
10
|
|
|
10
11
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
12
|
|
|
12
|
-
var
|
|
13
|
+
var _index = require("../theme/index");
|
|
13
14
|
|
|
14
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
16
|
|
|
16
|
-
// import defaultImage from '../assets/default-og-img.png'
|
|
17
17
|
const Figure = _styledComponents.default.figure`
|
|
18
|
-
width:
|
|
19
|
-
transform: translateX(-20px);
|
|
20
|
-
${({
|
|
21
|
-
theme
|
|
22
|
-
}) => theme.margin.default};
|
|
18
|
+
width: 100%;
|
|
23
19
|
`;
|
|
24
20
|
const FigureCaption = _styledComponents.default.figcaption`
|
|
25
|
-
width:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
color:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
${({
|
|
36
|
-
theme
|
|
37
|
-
}) => theme.breakpoint.xl} {
|
|
38
|
-
line-height: 24px;
|
|
39
|
-
${({
|
|
40
|
-
theme
|
|
41
|
-
}) => theme.fontSize.sm};
|
|
42
|
-
}
|
|
21
|
+
width: fit-content;
|
|
22
|
+
max-width: 100%;
|
|
23
|
+
font-size: 14px;
|
|
24
|
+
margin-left: auto;
|
|
25
|
+
margin-right: auto;
|
|
26
|
+
margin-top: 0.5em;
|
|
27
|
+
color: rgb(58, 79, 102);
|
|
28
|
+
letter-spacing: 0.7px;
|
|
29
|
+
line-height: 28px;
|
|
43
30
|
`;
|
|
44
|
-
const
|
|
45
|
-
|
|
31
|
+
const Img = _styledComponents.default.img`
|
|
32
|
+
width: 100%;
|
|
46
33
|
`;
|
|
47
34
|
|
|
48
|
-
function ImageBlock(
|
|
35
|
+
function ImageBlock({
|
|
36
|
+
className = '',
|
|
37
|
+
data
|
|
38
|
+
}) {
|
|
49
39
|
const {
|
|
50
40
|
desc,
|
|
51
|
-
|
|
52
|
-
resized
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
41
|
+
imageFile,
|
|
42
|
+
resized
|
|
43
|
+
} = data || {};
|
|
44
|
+
const imgSrcSetArr = [];
|
|
45
|
+
|
|
46
|
+
if (resized !== null && resized !== void 0 && resized.medium) {
|
|
47
|
+
imgSrcSetArr.push(`${resized.medium} 500w`);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (resized !== null && resized !== void 0 && resized.large) {
|
|
51
|
+
imgSrcSetArr.push(`${resized.large} 1000w`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const imgBlock = /*#__PURE__*/_react.default.createElement(Figure, {
|
|
55
|
+
className: className
|
|
56
|
+
}, /*#__PURE__*/_react.default.createElement(Img, {
|
|
57
|
+
alt: desc,
|
|
58
|
+
src: imageFile === null || imageFile === void 0 ? void 0 : imageFile.url,
|
|
59
|
+
srcSet: imgSrcSetArr.join(','),
|
|
60
|
+
sizes: "(min-width: 1200px) 1000px, 100vw"
|
|
69
61
|
}), /*#__PURE__*/_react.default.createElement(FigureCaption, null, desc));
|
|
70
62
|
|
|
71
63
|
return imgBlock;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const ArticleBodyContainer = _styledComponents.default.div`
|
|
67
|
+
/* reset browser default styles */
|
|
68
|
+
figure {
|
|
69
|
+
margin: 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
max-width: 100%;
|
|
73
|
+
margin: 0 auto 27px auto;
|
|
74
|
+
|
|
75
|
+
${_index.theme.breakpoint.sm} {
|
|
76
|
+
max-width: 72vw;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
${_index.theme.breakpoint.xl} {
|
|
80
|
+
max-width: 1000px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
${props => {
|
|
84
|
+
switch (props.$alignment) {
|
|
85
|
+
case 'right':
|
|
86
|
+
return `
|
|
87
|
+
${_index.theme.breakpoint.xl} {
|
|
88
|
+
width: 361px;
|
|
89
|
+
float: right;
|
|
90
|
+
margin: 5px 0px 5px 27px;
|
|
91
|
+
}
|
|
92
|
+
`;
|
|
93
|
+
|
|
94
|
+
case 'left':
|
|
95
|
+
return `
|
|
96
|
+
${_index.theme.breakpoint.xl} {
|
|
97
|
+
width: 361px;
|
|
98
|
+
float: left;
|
|
99
|
+
margin: 5px 27px 5px 0px;
|
|
100
|
+
}
|
|
101
|
+
`;
|
|
102
|
+
}
|
|
103
|
+
}}
|
|
104
|
+
`;
|
|
105
|
+
|
|
106
|
+
function ImageInArticleBody({
|
|
107
|
+
className = '',
|
|
108
|
+
data
|
|
109
|
+
}) {
|
|
110
|
+
return /*#__PURE__*/_react.default.createElement(ArticleBodyContainer, {
|
|
111
|
+
$alignment: data.alignment,
|
|
112
|
+
className: className
|
|
113
|
+
}, /*#__PURE__*/_react.default.createElement(ImageBlock, {
|
|
114
|
+
data: data
|
|
115
|
+
}));
|
|
72
116
|
}
|
|
@@ -5,49 +5,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.blockRenderers = void 0;
|
|
7
7
|
|
|
8
|
-
var _backgroundImageBlock = require("./background-image-block");
|
|
9
|
-
|
|
10
|
-
var _backgroundVideoBlock = require("./background-video-block");
|
|
11
|
-
|
|
12
|
-
var _colorBoxBlock = require("./color-box-block");
|
|
13
|
-
|
|
14
|
-
var _dividerBlock = require("./divider-block");
|
|
15
|
-
|
|
16
8
|
var _embeddedCodeBlock = require("./embedded-code-block");
|
|
17
9
|
|
|
18
10
|
var _imageBlock = require("./image-block");
|
|
19
11
|
|
|
20
12
|
var _infoBoxBlock = require("./info-box-block");
|
|
21
13
|
|
|
22
|
-
var _mediaBlock = require("./media-block");
|
|
23
|
-
|
|
24
|
-
var _relatedPostBlock = require("./related-post-block");
|
|
25
|
-
|
|
26
|
-
var _sideIndexBlock = require("./side-index-block");
|
|
27
|
-
|
|
28
14
|
var _slideshowBlock = require("./slideshow-block");
|
|
29
15
|
|
|
30
|
-
var _tableBlock = require("./table-block");
|
|
31
|
-
|
|
32
|
-
var _videoBlock = require("./video-block");
|
|
33
|
-
|
|
34
|
-
var _audioBlock = require("./audio-block");
|
|
35
|
-
|
|
36
16
|
const blockRenderers = {
|
|
37
|
-
BGImageBlock: _backgroundImageBlock.BGImageBlock,
|
|
38
|
-
BGVideoBlock: _backgroundVideoBlock.BGVideoBlock,
|
|
39
|
-
ColorBoxBlock: _colorBoxBlock.ColorBoxBlock,
|
|
40
|
-
DividerBlock: _dividerBlock.DividerBlock,
|
|
41
17
|
EmbeddedCodeBlock: _embeddedCodeBlock.EmbeddedCodeBlock,
|
|
18
|
+
EmbeddedCodeInArticleBody: _embeddedCodeBlock.EmbeddedCodeInArticleBody,
|
|
42
19
|
ImageBlock: _imageBlock.ImageBlock,
|
|
20
|
+
ImageInArticleBody: _imageBlock.ImageInArticleBody,
|
|
43
21
|
InfoBoxBlock: _infoBoxBlock.InfoBoxBlock,
|
|
44
|
-
MediaBlock: _mediaBlock.MediaBlock,
|
|
45
|
-
RelatedPostBlock: _relatedPostBlock.RelatedPostBlock,
|
|
46
|
-
SideIndexBlock: _sideIndexBlock.SideIndexBlock,
|
|
47
22
|
SlideshowBlock: _slideshowBlock.SlideshowBlock,
|
|
48
|
-
|
|
49
|
-
TableBlock: _tableBlock.TableBlock,
|
|
50
|
-
VideoBlock: _videoBlock.VideoBlock,
|
|
51
|
-
AudioBlock: _audioBlock.AudioBlock
|
|
23
|
+
SlideshowInArticleBody: _slideshowBlock.SlideshowInArticleBody
|
|
52
24
|
};
|
|
53
25
|
exports.blockRenderers = blockRenderers;
|