@kids-reporter/draft-renderer 1.0.21 → 1.0.22
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-maps/article-content.js +37 -3
- package/lib/block-render-maps/image-link.js +11 -1
- package/lib/block-renderers/blockquote.js +1 -0
- package/lib/block-renderers/image-block.js +2 -4
- package/lib/block-renderers/image-link.js +6 -7
- package/lib/block-renderers/slideshow-block.js +2 -2
- package/lib/entity-decorators/link-decorator.js +14 -0
- package/package.json +1 -1
|
@@ -28,6 +28,13 @@ const Paragraph = exports.Paragraph = _styledComponents.default.div`
|
|
|
28
28
|
> div[data-block='true'] {
|
|
29
29
|
margin-bottom: 38px;
|
|
30
30
|
}
|
|
31
|
+
|
|
32
|
+
&:has(+ div:not([data-paragraph-block='true'])) {
|
|
33
|
+
margin-bottom: 40px;
|
|
34
|
+
${_mediaQuery.mediaQuery.desktopAbove} {
|
|
35
|
+
margin-bottom: 60px;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
31
38
|
`;
|
|
32
39
|
const Heading = exports.Heading = _styledComponents.default.div`
|
|
33
40
|
width: 100%;
|
|
@@ -53,6 +60,14 @@ const Heading = exports.Heading = _styledComponents.default.div`
|
|
|
53
60
|
padding-left: 24px;
|
|
54
61
|
padding-right: 24px;
|
|
55
62
|
}
|
|
63
|
+
|
|
64
|
+
/* when the next sibling div contains a blockquote */
|
|
65
|
+
& + div:has(blockquote) {
|
|
66
|
+
margin-top: 0px;
|
|
67
|
+
${_mediaQuery.mediaQuery.desktopAbove} {
|
|
68
|
+
margin-top: 0px;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
56
71
|
`;
|
|
57
72
|
const List = exports.List = _styledComponents.default.ol`
|
|
58
73
|
width: 100%;
|
|
@@ -77,6 +92,13 @@ const List = exports.List = _styledComponents.default.ol`
|
|
|
77
92
|
> li {
|
|
78
93
|
margin-bottom: 6px;
|
|
79
94
|
}
|
|
95
|
+
|
|
96
|
+
&:has(+ div:not([data-paragraph-block='true'])) {
|
|
97
|
+
margin-bottom: 40px;
|
|
98
|
+
${_mediaQuery.mediaQuery.desktopAbove} {
|
|
99
|
+
margin-bottom: 60px;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
80
102
|
`;
|
|
81
103
|
const Atomic = exports.Atomic = _styledComponents.default.div`
|
|
82
104
|
/* reset browser default styles */
|
|
@@ -84,6 +106,13 @@ const Atomic = exports.Atomic = _styledComponents.default.div`
|
|
|
84
106
|
margin: 0;
|
|
85
107
|
}
|
|
86
108
|
|
|
109
|
+
&:has(blockquote) {
|
|
110
|
+
margin-top: -2px;
|
|
111
|
+
${_mediaQuery.mediaQuery.desktopAbove} {
|
|
112
|
+
margin-top: -22px;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
87
116
|
${_mediaQuery.mediaQuery.desktopAbove} {
|
|
88
117
|
div:has(+ div [data-image-block-caption-alignment='default'])
|
|
89
118
|
[data-image-block-caption-alignment='default'],
|
|
@@ -122,17 +151,22 @@ const _blockRenderMap = _immutable.default.Map({
|
|
|
122
151
|
},
|
|
123
152
|
'ordered-list-item': {
|
|
124
153
|
element: 'li',
|
|
125
|
-
wrapper: /*#__PURE__*/(0, _jsxRuntime.jsx)(List, {
|
|
154
|
+
wrapper: /*#__PURE__*/(0, _jsxRuntime.jsx)(List, {
|
|
155
|
+
"data-paragraph-block": "true"
|
|
156
|
+
})
|
|
126
157
|
},
|
|
127
158
|
'unordered-list-item': {
|
|
128
159
|
element: 'li',
|
|
129
160
|
wrapper: /*#__PURE__*/(0, _jsxRuntime.jsx)(List, {
|
|
130
|
-
as: "ul"
|
|
161
|
+
as: "ul",
|
|
162
|
+
"data-paragraph-block": "true"
|
|
131
163
|
})
|
|
132
164
|
},
|
|
133
165
|
unstyled: {
|
|
134
166
|
element: 'div',
|
|
135
|
-
wrapper: /*#__PURE__*/(0, _jsxRuntime.jsx)(Paragraph, {
|
|
167
|
+
wrapper: /*#__PURE__*/(0, _jsxRuntime.jsx)(Paragraph, {
|
|
168
|
+
"data-paragraph-block": "true"
|
|
169
|
+
})
|
|
136
170
|
}
|
|
137
171
|
});
|
|
138
172
|
const blockRenderMap = exports.blockRenderMap = _draftJs.DefaultDraftBlockRenderMap.merge(_blockRenderMap);
|
|
@@ -8,6 +8,7 @@ var _draftJs = require("draft-js");
|
|
|
8
8
|
var _immutable = _interopRequireDefault(require("immutable"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
+
var _mediaQuery = require("../utils/media-query");
|
|
11
12
|
var _articleContent = require("./article-content");
|
|
12
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -22,7 +23,16 @@ const ParagraphForImageLink = (0, _styledComponents.default)(_articleContent.Par
|
|
|
22
23
|
color: rgb(58, 79, 102);
|
|
23
24
|
letter-spacing: 0.7px;
|
|
24
25
|
line-height: 28px;
|
|
25
|
-
text-align:
|
|
26
|
+
text-align: left;
|
|
27
|
+
|
|
28
|
+
${_mediaQuery.mediaQuery.smallOnly} {
|
|
29
|
+
padding-left: 0px;
|
|
30
|
+
padding-right: 0px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
> div[data-block='true'] {
|
|
34
|
+
margin-bottom: 0px;
|
|
35
|
+
}
|
|
26
36
|
`;
|
|
27
37
|
const _blockRenderMapForAnnotation = _immutable.default.Map({
|
|
28
38
|
atomic: {
|
|
@@ -230,10 +230,10 @@ const ArticleBodyContainer = _styledComponents.default.div`
|
|
|
230
230
|
margin: 0;
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
margin: 40px auto;
|
|
233
|
+
margin: 0 auto 40px auto;
|
|
234
234
|
|
|
235
235
|
${_mediaQuery.mediaQuery.mediumAbove} {
|
|
236
|
-
margin: 60px auto;
|
|
236
|
+
margin: 0 auto 60px auto;
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
${_mediaQuery.mediaQuery.smallOnly} {
|
|
@@ -260,8 +260,6 @@ const ArticleBodyContainer = _styledComponents.default.div`
|
|
|
260
260
|
return `
|
|
261
261
|
${_mediaQuery.mediaQuery.smallOnly} {
|
|
262
262
|
max-width: 512px;
|
|
263
|
-
padding-left: 24px;
|
|
264
|
-
padding-right: 24px;
|
|
265
263
|
}
|
|
266
264
|
|
|
267
265
|
${_mediaQuery.mediaQuery.mediumAbove} {
|
|
@@ -39,7 +39,7 @@ const Figure = _styledComponents.default.figure`
|
|
|
39
39
|
}}
|
|
40
40
|
`;
|
|
41
41
|
const FigureCaption = _styledComponents.default.figcaption`
|
|
42
|
-
width:
|
|
42
|
+
width: 100%;
|
|
43
43
|
max-width: 100%;
|
|
44
44
|
font-size: ${({
|
|
45
45
|
theme
|
|
@@ -49,7 +49,7 @@ const FigureCaption = _styledComponents.default.figcaption`
|
|
|
49
49
|
color: #575757;
|
|
50
50
|
letter-spacing: 0.7px;
|
|
51
51
|
line-height: 28px;
|
|
52
|
-
text-align:
|
|
52
|
+
text-align: left;
|
|
53
53
|
padding: 16px 0 20px 0;
|
|
54
54
|
border-bottom: 2px solid #c6c6c6;
|
|
55
55
|
|
|
@@ -70,7 +70,7 @@ const FigureCaption = _styledComponents.default.figcaption`
|
|
|
70
70
|
${_mediaQuery.mediaQuery.mediumAbove} {
|
|
71
71
|
max-width: 340px;
|
|
72
72
|
margin-left: auto;
|
|
73
|
-
margin-right:
|
|
73
|
+
margin-right: 32px;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
${_mediaQuery.mediaQuery.desktopAbove} {
|
|
@@ -215,10 +215,10 @@ const ArticleBodyContainer = _styledComponents.default.div`
|
|
|
215
215
|
margin: 0;
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
margin: 40px auto;
|
|
218
|
+
margin: 0 auto 40px auto;
|
|
219
219
|
|
|
220
220
|
${_mediaQuery.mediaQuery.mediumAbove} {
|
|
221
|
-
margin: 60px auto;
|
|
221
|
+
margin: 0 auto 60px auto;
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
${_mediaQuery.mediaQuery.smallOnly} {
|
|
@@ -244,8 +244,6 @@ const ArticleBodyContainer = _styledComponents.default.div`
|
|
|
244
244
|
return `
|
|
245
245
|
${_mediaQuery.mediaQuery.smallOnly} {
|
|
246
246
|
max-width: 512px;
|
|
247
|
-
padding-left: 24px;
|
|
248
|
-
padding-right: 24px;
|
|
249
247
|
}
|
|
250
248
|
|
|
251
249
|
${_mediaQuery.mediaQuery.mediumAbove} {
|
|
@@ -292,6 +290,7 @@ const ImageLinkInArticleBody = ({
|
|
|
292
290
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ArticleBodyContainer, {
|
|
293
291
|
$alignment: data.alignment,
|
|
294
292
|
className: className,
|
|
293
|
+
"data-image-link-block": "true",
|
|
295
294
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ImageLinkBlock, {
|
|
296
295
|
data: data
|
|
297
296
|
})
|
|
@@ -550,11 +550,11 @@ function SlideshowBlock({
|
|
|
550
550
|
}
|
|
551
551
|
const ArticleBodyContainer = _styledComponents.default.div`
|
|
552
552
|
${_mediaQuery.mediaQuery.smallOnly} {
|
|
553
|
-
margin: 40px auto;
|
|
553
|
+
margin: 0 auto 40px auto;
|
|
554
554
|
}
|
|
555
555
|
|
|
556
556
|
${_mediaQuery.mediaQuery.mediumAbove} {
|
|
557
|
-
margin: 60px auto;
|
|
557
|
+
margin: 0 auto 60px auto;
|
|
558
558
|
}
|
|
559
559
|
`;
|
|
560
560
|
function SlideshowInArticleBody({
|
|
@@ -17,10 +17,24 @@ const LinkWrapper = _styledComponents.default.a`
|
|
|
17
17
|
cursor: pointer;
|
|
18
18
|
text-decoration-color: #c6c6c6;
|
|
19
19
|
text-underline-offset: 3px;
|
|
20
|
+
text-decoration-thickness: 1px;
|
|
20
21
|
|
|
21
22
|
&:hover {
|
|
22
23
|
text-decoration-color: #27b3f5;
|
|
23
24
|
}
|
|
25
|
+
|
|
26
|
+
& > span {
|
|
27
|
+
color: #27b3f5 !important;
|
|
28
|
+
text-decoration: underline !important;
|
|
29
|
+
text-decoration-color: #c6c6c6 !important;
|
|
30
|
+
text-underline-offset: 3px !important;
|
|
31
|
+
text-decoration-thickness: 1px !important;
|
|
32
|
+
transition: text-decoration-color 0.1s ease-in !important;
|
|
33
|
+
|
|
34
|
+
&:hover {
|
|
35
|
+
text-decoration-color: #27b3f5 !important;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
24
38
|
`;
|
|
25
39
|
const LinkInner = props => {
|
|
26
40
|
const {
|