@kids-reporter/draft-renderer 0.4.16 → 0.4.18
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 +20 -23
- package/lib/block-renderers/blockquote.js +3 -5
- package/lib/block-renderers/embedded-code-block.js +3 -5
- package/lib/block-renderers/image-block.js +26 -13
- package/lib/block-renderers/info-box-block.js +11 -12
- package/lib/block-renderers/multimedia.js +12 -17
- package/lib/block-renderers/slideshow-block.js +90 -97
- package/package.json +1 -2
- package/lib/theme/index.js +0 -28
package/lib/block-render-map.js
CHANGED
|
@@ -8,12 +8,10 @@ var _immutable = _interopRequireDefault(require("immutable"));
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
10
10
|
var _draftJs = require("draft-js");
|
|
11
|
-
var _mediaQuery =
|
|
11
|
+
var _mediaQuery = require("./utils/media-query");
|
|
12
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
// @ts-ignore pkg does not contain ts header file
|
|
16
|
-
|
|
17
15
|
const Paragraph = _styledComponents.default.div`
|
|
18
16
|
width: 100%;
|
|
19
17
|
max-width: 700px;
|
|
@@ -24,12 +22,12 @@ const Paragraph = _styledComponents.default.div`
|
|
|
24
22
|
line-height: 2;
|
|
25
23
|
margin: 0 auto;
|
|
26
24
|
|
|
27
|
-
${_mediaQuery.
|
|
25
|
+
${_mediaQuery.mediaQuery.smallOnly} {
|
|
28
26
|
padding-left: 15px;
|
|
29
27
|
padding-right: 15px;
|
|
30
|
-
|
|
28
|
+
}
|
|
31
29
|
|
|
32
|
-
> div[data-block=
|
|
30
|
+
> div[data-block='true'] {
|
|
33
31
|
margin-bottom: 27px;
|
|
34
32
|
}
|
|
35
33
|
`;
|
|
@@ -64,10 +62,10 @@ const Heading = _styledComponents.default.div`
|
|
|
64
62
|
font-size: 20px;
|
|
65
63
|
}
|
|
66
64
|
|
|
67
|
-
${_mediaQuery.
|
|
65
|
+
${_mediaQuery.mediaQuery.smallOnly} {
|
|
68
66
|
padding-left: 15px;
|
|
69
67
|
padding-right: 15px;
|
|
70
|
-
|
|
68
|
+
}
|
|
71
69
|
`;
|
|
72
70
|
const List = _styledComponents.default.ol`
|
|
73
71
|
width: 100%;
|
|
@@ -82,21 +80,9 @@ const List = _styledComponents.default.ol`
|
|
|
82
80
|
margin-bottom: 6px;
|
|
83
81
|
}
|
|
84
82
|
`;
|
|
85
|
-
const Atomic = _styledComponents.default.div`
|
|
86
|
-
/* hide empty block which immediately follows atomic block */
|
|
87
|
-
/*
|
|
88
|
-
& + ${Paragraph} {
|
|
89
|
-
> div[data-block='true']:first-child {
|
|
90
|
-
line-height: 0;
|
|
91
|
-
margin-bottom: 0;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
*/
|
|
95
|
-
`;
|
|
96
83
|
const _blockRenderMap = _immutable.default.Map({
|
|
97
84
|
atomic: {
|
|
98
|
-
element: 'div'
|
|
99
|
-
wrapper: /*#__PURE__*/_react.default.createElement(Atomic, null)
|
|
85
|
+
element: 'div'
|
|
100
86
|
},
|
|
101
87
|
'header-two': {
|
|
102
88
|
element: 'h2',
|
|
@@ -201,7 +187,18 @@ const HeadingForInfoBox = (0, _styledComponents.default)(Heading)`
|
|
|
201
187
|
margin-top: 30px;
|
|
202
188
|
margin-bottom: 30px;
|
|
203
189
|
`;
|
|
190
|
+
const Atomic = _styledComponents.default.div`
|
|
191
|
+
/* hide last empty block which immediately follows an atomic block */
|
|
192
|
+
& + ${Paragraph}:last-of-type {
|
|
193
|
+
line-height: 0;
|
|
194
|
+
margin-bottom: 0;
|
|
195
|
+
}
|
|
196
|
+
`;
|
|
204
197
|
const blockRenderMapForInfoBox = blockRenderMapForAnnotation.merge(_immutable.default.Map({
|
|
198
|
+
atomic: {
|
|
199
|
+
element: 'div',
|
|
200
|
+
wrapper: /*#__PURE__*/_react.default.createElement(Atomic, null)
|
|
201
|
+
},
|
|
205
202
|
'header-four': {
|
|
206
203
|
element: 'h4',
|
|
207
204
|
wrapper: /*#__PURE__*/_react.default.createElement(HeadingForInfoBox, null)
|
|
@@ -220,8 +217,8 @@ const dividerStyles = (0, _styledComponents.css)`
|
|
|
220
217
|
`;
|
|
221
218
|
const HeadingForInfoBoxWithHeaderBorder = (0, _styledComponents.default)(HeadingForInfoBox)`
|
|
222
219
|
h4 {
|
|
223
|
-
margin-top:
|
|
224
|
-
margin-bottom:
|
|
220
|
+
margin-top: 12px;
|
|
221
|
+
margin-bottom: 12px;
|
|
225
222
|
}
|
|
226
223
|
|
|
227
224
|
&::before {
|
|
@@ -7,12 +7,10 @@ exports.BlockquoteInArticleBody = BlockquoteInArticleBody;
|
|
|
7
7
|
exports.BorderLeftBlockquote = BorderLeftBlockquote;
|
|
8
8
|
exports.QuoteLeftBlockquote = QuoteLeftBlockquote;
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
|
|
11
10
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
12
11
|
var _index = require("../utils/index");
|
|
12
|
+
var _mediaQuery = require("../utils/media-query");
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
// @ts-ignore pkg does not contain ts header file
|
|
15
|
-
|
|
16
14
|
const BorderLeftContainer = _styledComponents.default.blockquote`
|
|
17
15
|
margin: 0;
|
|
18
16
|
padding-left: 30px;
|
|
@@ -69,11 +67,11 @@ const ArticleBodyContainer = _styledComponents.default.div`
|
|
|
69
67
|
max-width: 700px;
|
|
70
68
|
margin: 0 auto 27px auto;
|
|
71
69
|
|
|
72
|
-
${_mediaQuery.
|
|
70
|
+
${_mediaQuery.mediaQuery.smallOnly} {
|
|
73
71
|
width: calc(100vw - 30px);
|
|
74
72
|
margin-left: auto;
|
|
75
73
|
margin-right: auto;
|
|
76
|
-
|
|
74
|
+
}
|
|
77
75
|
`;
|
|
78
76
|
var BlockquoteTypeEnum = /*#__PURE__*/function (BlockquoteTypeEnum) {
|
|
79
77
|
BlockquoteTypeEnum["borderLeft"] = "border_left";
|
|
@@ -6,14 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.EmbeddedCodeBlock = exports.Caption = exports.Block = void 0;
|
|
7
7
|
exports.EmbeddedCodeInArticleBody = EmbeddedCodeInArticleBody;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
|
|
10
9
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
10
|
+
var _mediaQuery = require("../utils/media-query");
|
|
11
11
|
var _nodeHtmlParser = require("node-html-parser");
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
-
// @ts-ignore pkg does not contain ts header file
|
|
16
|
-
|
|
17
15
|
const Block = _styledComponents.default.div`
|
|
18
16
|
position: relative;
|
|
19
17
|
white-space: normal;
|
|
@@ -111,11 +109,11 @@ const ArticleBodyContainer = _styledComponents.default.div`
|
|
|
111
109
|
max-width: 700px;
|
|
112
110
|
margin: 0 auto 27px auto;
|
|
113
111
|
|
|
114
|
-
${_mediaQuery.
|
|
112
|
+
${_mediaQuery.mediaQuery.smallOnly} {
|
|
115
113
|
width: calc(100vw - 30px);
|
|
116
114
|
margin-left: auto;
|
|
117
115
|
margin-right: auto;
|
|
118
|
-
|
|
116
|
+
}
|
|
119
117
|
`;
|
|
120
118
|
function EmbeddedCodeInArticleBody({
|
|
121
119
|
className = '',
|
|
@@ -8,7 +8,7 @@ exports.ImageInArticleBody = ImageInArticleBody;
|
|
|
8
8
|
exports.ImageInInfoBox = ImageInInfoBox;
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
-
var
|
|
11
|
+
var _mediaQuery = require("../utils/media-query");
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
const Figure = _styledComponents.default.figure`
|
|
14
14
|
width: 100%;
|
|
@@ -59,14 +59,14 @@ const ArticleBodyContainer = _styledComponents.default.div`
|
|
|
59
59
|
margin: 0;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
max-width:
|
|
62
|
+
max-width: 72vw;
|
|
63
63
|
margin: 0 auto 27px auto;
|
|
64
64
|
|
|
65
|
-
${
|
|
66
|
-
max-width:
|
|
65
|
+
${_mediaQuery.mediaQuery.smallOnly} {
|
|
66
|
+
max-width: 100%;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
${
|
|
69
|
+
${_mediaQuery.mediaQuery.largeOnly} {
|
|
70
70
|
max-width: 1000px;
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -74,13 +74,13 @@ const ArticleBodyContainer = _styledComponents.default.div`
|
|
|
74
74
|
switch (props.$alignment) {
|
|
75
75
|
case 'paragraph-width':
|
|
76
76
|
return `
|
|
77
|
-
${
|
|
77
|
+
${_mediaQuery.mediaQuery.mediumAbove} {
|
|
78
78
|
max-width: 700px;
|
|
79
79
|
}
|
|
80
80
|
`;
|
|
81
81
|
case 'right':
|
|
82
82
|
return `
|
|
83
|
-
${
|
|
83
|
+
${_mediaQuery.mediaQuery.mediumAbove} {
|
|
84
84
|
width: 361px;
|
|
85
85
|
float: right;
|
|
86
86
|
margin: 5px 0px 5px 27px;
|
|
@@ -88,7 +88,7 @@ const ArticleBodyContainer = _styledComponents.default.div`
|
|
|
88
88
|
`;
|
|
89
89
|
case 'left':
|
|
90
90
|
return `
|
|
91
|
-
${
|
|
91
|
+
${_mediaQuery.mediaQuery.mediumAbove} {
|
|
92
92
|
width: 361px;
|
|
93
93
|
float: left;
|
|
94
94
|
margin: 5px 27px 5px 0px;
|
|
@@ -113,18 +113,31 @@ const InfoBoxContainer = _styledComponents.default.div`
|
|
|
113
113
|
figure {
|
|
114
114
|
margin: 0;
|
|
115
115
|
}
|
|
116
|
-
margin-bottom: 30px;
|
|
117
|
-
width: fit-content;
|
|
118
116
|
|
|
119
117
|
${props => {
|
|
120
118
|
switch (props.$alignment) {
|
|
121
|
-
case '
|
|
119
|
+
case 'left':
|
|
122
120
|
{
|
|
123
|
-
return `
|
|
121
|
+
return `
|
|
122
|
+
width: 200px;
|
|
123
|
+
margin-right: auto;
|
|
124
|
+
`;
|
|
124
125
|
}
|
|
125
126
|
case 'right':
|
|
126
127
|
{
|
|
127
|
-
return `
|
|
128
|
+
return `
|
|
129
|
+
width: 200px;
|
|
130
|
+
margin-left: auto;
|
|
131
|
+
`;
|
|
132
|
+
}
|
|
133
|
+
case 'paragraph-width':
|
|
134
|
+
default:
|
|
135
|
+
{
|
|
136
|
+
return `
|
|
137
|
+
width: fit-content;
|
|
138
|
+
margin-left: auto;
|
|
139
|
+
margin-right: auto;
|
|
140
|
+
`;
|
|
128
141
|
}
|
|
129
142
|
}
|
|
130
143
|
}}
|
|
@@ -6,16 +6,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.InfoBoxInArticleBody = InfoBoxInArticleBody;
|
|
7
7
|
var _draftJs = require("draft-js");
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
|
|
10
9
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
11
10
|
var _blockRenderMap = require("../block-render-map");
|
|
12
11
|
var _imageBlock = require("../block-renderers/image-block");
|
|
13
|
-
var _index = require("../
|
|
14
|
-
var _index2 = require("../
|
|
12
|
+
var _index = require("../utils/index");
|
|
13
|
+
var _index2 = require("../entity-decorators/index");
|
|
14
|
+
var _mediaQuery = require("../utils/media-query");
|
|
15
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
-
// @ts-ignore pkg does not contain ts header file
|
|
19
18
|
var InfoBoxTypeEnum = /*#__PURE__*/function (InfoBoxTypeEnum) {
|
|
20
19
|
InfoBoxTypeEnum["newsChargeStation"] = "news-charge-station";
|
|
21
20
|
InfoBoxTypeEnum["headerBorder"] = "header-border";
|
|
@@ -27,9 +26,9 @@ const containerStyles = (0, _styledComponents.css)`
|
|
|
27
26
|
border-radius: 30px;
|
|
28
27
|
position: relative;
|
|
29
28
|
|
|
30
|
-
${_mediaQuery.
|
|
29
|
+
${_mediaQuery.mediaQuery.smallOnly} {
|
|
31
30
|
padding: 20px;
|
|
32
|
-
|
|
31
|
+
}
|
|
33
32
|
`;
|
|
34
33
|
const NewsChargeStationContainer = _styledComponents.default.div`
|
|
35
34
|
${containerStyles}
|
|
@@ -59,19 +58,19 @@ const HeaderBorderContainer = _styledComponents.default.div`
|
|
|
59
58
|
let logoColor;
|
|
60
59
|
let bgColor;
|
|
61
60
|
switch (theme === null || theme === void 0 ? void 0 : theme.themeColor) {
|
|
62
|
-
case
|
|
61
|
+
case _index.ThemeColorEnum.YELLOW:
|
|
63
62
|
{
|
|
64
63
|
logoColor = 'red';
|
|
65
64
|
bgColor = '#fff0d2';
|
|
66
65
|
break;
|
|
67
66
|
}
|
|
68
|
-
case
|
|
67
|
+
case _index.ThemeColorEnum.RED:
|
|
69
68
|
{
|
|
70
69
|
logoColor = 'blue';
|
|
71
70
|
bgColor = '#ffd2d2';
|
|
72
71
|
break;
|
|
73
72
|
}
|
|
74
|
-
case
|
|
73
|
+
case _index.ThemeColorEnum.BLUE:
|
|
75
74
|
default:
|
|
76
75
|
{
|
|
77
76
|
logoColor = 'yellow';
|
|
@@ -136,11 +135,11 @@ const ArticleBodyContainer = _styledComponents.default.div`
|
|
|
136
135
|
max-width: 700px;
|
|
137
136
|
margin: 60px auto;
|
|
138
137
|
|
|
139
|
-
${_mediaQuery.
|
|
138
|
+
${_mediaQuery.mediaQuery.smallOnly} {
|
|
140
139
|
width: calc(100vw - 30px);
|
|
141
140
|
margin-left: auto;
|
|
142
141
|
margin-right: auto;
|
|
143
|
-
|
|
142
|
+
}
|
|
144
143
|
`;
|
|
145
144
|
const EditorContainer = _styledComponents.default.div`
|
|
146
145
|
position: relative;
|
|
@@ -154,7 +153,7 @@ function InfoBoxInArticleBody({
|
|
|
154
153
|
rawContentState
|
|
155
154
|
} = data;
|
|
156
155
|
const contentState = (0, _draftJs.convertFromRaw)(rawContentState);
|
|
157
|
-
const editorState = _draftJs.EditorState.createWithContent(contentState,
|
|
156
|
+
const editorState = _draftJs.EditorState.createWithContent(contentState, _index2.decorator);
|
|
158
157
|
let Component;
|
|
159
158
|
let blockRenderMap = _blockRenderMap.blockRenderMapForInfoBox;
|
|
160
159
|
switch (type) {
|
|
@@ -4,12 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _mediaQuery =
|
|
7
|
+
var _mediaQuery = require("../utils/media-query");
|
|
8
8
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
9
|
var _index = require("../utils/index");
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
// @ts-ignore @twreporter/core does not provide ts header file
|
|
12
|
-
|
|
13
11
|
const mockup = {
|
|
14
12
|
mobile: {
|
|
15
13
|
figure: {
|
|
@@ -83,24 +81,20 @@ const Caption = _styledComponents.default.figcaption`
|
|
|
83
81
|
border-style: solid;
|
|
84
82
|
}
|
|
85
83
|
|
|
86
|
-
${_mediaQuery.
|
|
84
|
+
${_mediaQuery.mediaQuery.smallOnly} {
|
|
87
85
|
position: relative;
|
|
88
86
|
margin-left: auto;
|
|
89
87
|
padding: 15px 15px 15px 0;
|
|
90
88
|
&:after {
|
|
91
89
|
width: calc(100% - 15px);
|
|
92
90
|
}
|
|
93
|
-
|
|
91
|
+
}
|
|
94
92
|
|
|
95
|
-
${_mediaQuery.
|
|
93
|
+
${_mediaQuery.mediaQuery.smallOnly} {
|
|
96
94
|
max-width: ${mockup.mobile.caption.width}px;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
${_mediaQuery.default.tabletOnly`
|
|
100
|
-
max-width: ${mockup.tablet.caption.width}px;
|
|
101
|
-
`}
|
|
95
|
+
}
|
|
102
96
|
|
|
103
|
-
${_mediaQuery.
|
|
97
|
+
${_mediaQuery.mediaQuery.mediumAbove} {
|
|
104
98
|
/* clear float */
|
|
105
99
|
clear: both;
|
|
106
100
|
|
|
@@ -110,16 +104,17 @@ const Caption = _styledComponents.default.figcaption`
|
|
|
110
104
|
&:after {
|
|
111
105
|
width: 100%;
|
|
112
106
|
}
|
|
113
|
-
|
|
107
|
+
}
|
|
114
108
|
|
|
115
|
-
${_mediaQuery.
|
|
109
|
+
${_mediaQuery.mediaQuery.mediumOnly} {
|
|
116
110
|
width: ${mockup.desktop.caption.width}px;
|
|
117
111
|
padding: 15px 0 15px 0;
|
|
118
|
-
|
|
119
|
-
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
${_mediaQuery.mediaQuery.largeOnly} {
|
|
120
115
|
width: ${mockup.hd.caption.width}px;
|
|
121
116
|
padding: 25px 0 20px 0;
|
|
122
|
-
|
|
117
|
+
}
|
|
123
118
|
`;
|
|
124
119
|
var _default = {
|
|
125
120
|
Caption
|
|
@@ -7,14 +7,12 @@ exports.SlideshowBlock = SlideshowBlock;
|
|
|
7
7
|
exports.SlideshowInArticleBody = SlideshowInArticleBody;
|
|
8
8
|
var _multimedia = _interopRequireDefault(require("./multimedia"));
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
|
|
11
10
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
12
11
|
var _index = require("../utils/index");
|
|
12
|
+
var _mediaQuery = require("../utils/media-query");
|
|
13
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
// @ts-ignore pkg does not contain ts header file
|
|
17
|
-
|
|
18
16
|
const mockup = {
|
|
19
17
|
mobile: {
|
|
20
18
|
container: {
|
|
@@ -113,40 +111,42 @@ const SlidesSection = _styledComponents.default.div`
|
|
|
113
111
|
overflow: hidden;
|
|
114
112
|
position: relative;
|
|
115
113
|
|
|
116
|
-
${_mediaQuery.
|
|
114
|
+
${_mediaQuery.mediaQuery.smallOnly} {
|
|
117
115
|
order: 2;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
${_mediaQuery.default.mobileOnly`
|
|
121
|
-
padding-bottom: calc(${mockup.mobile.slide.height}/${mockup.mobile.container.width}*100%);
|
|
122
|
-
`}
|
|
116
|
+
}
|
|
123
117
|
|
|
124
|
-
${_mediaQuery.
|
|
125
|
-
padding-bottom: calc(
|
|
126
|
-
|
|
118
|
+
${_mediaQuery.mediaQuery.smallOnly} {
|
|
119
|
+
padding-bottom: calc(
|
|
120
|
+
${mockup.mobile.slide.height} / ${mockup.mobile.container.width}*100%
|
|
121
|
+
);
|
|
122
|
+
}
|
|
127
123
|
|
|
128
|
-
${_mediaQuery.
|
|
129
|
-
padding-bottom: calc(
|
|
130
|
-
|
|
124
|
+
${_mediaQuery.mediaQuery.mediumOnly} {
|
|
125
|
+
padding-bottom: calc(
|
|
126
|
+
${mockup.desktop.slide.height} / ${mockup.desktop.container.width}*100%
|
|
127
|
+
);
|
|
128
|
+
}
|
|
131
129
|
|
|
132
|
-
${_mediaQuery.
|
|
133
|
-
padding-bottom: calc(
|
|
134
|
-
|
|
130
|
+
${_mediaQuery.mediaQuery.largeOnly} {
|
|
131
|
+
padding-bottom: calc(
|
|
132
|
+
${mockup.hd.slide.height} / ${mockup.hd.container.width}*100%
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
135
|
`;
|
|
136
136
|
const PrevNextSection = _styledComponents.default.div`
|
|
137
137
|
margin-top: 20px;
|
|
138
138
|
|
|
139
|
-
${_mediaQuery.
|
|
139
|
+
${_mediaQuery.mediaQuery.smallOnly} {
|
|
140
140
|
order: 3;
|
|
141
|
-
|
|
141
|
+
}
|
|
142
142
|
|
|
143
|
-
${_mediaQuery.
|
|
143
|
+
${_mediaQuery.mediaQuery.smallOnly} {
|
|
144
144
|
margin-left: 25px;
|
|
145
|
-
|
|
145
|
+
}
|
|
146
146
|
|
|
147
|
-
${_mediaQuery.
|
|
147
|
+
${_mediaQuery.mediaQuery.mediumAbove} {
|
|
148
148
|
margin-left: 47px;
|
|
149
|
-
|
|
149
|
+
}
|
|
150
150
|
`;
|
|
151
151
|
const PrevButton = _styledComponents.default.div`
|
|
152
152
|
cursor: pointer;
|
|
@@ -160,14 +160,14 @@ const PrevButton = _styledComponents.default.div`
|
|
|
160
160
|
width: 21px;
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
${_mediaQuery.
|
|
163
|
+
${_mediaQuery.mediaQuery.largeOnly} {
|
|
164
164
|
width: 83px;
|
|
165
165
|
height: 83px;
|
|
166
166
|
|
|
167
167
|
> svg {
|
|
168
168
|
width: 31px;
|
|
169
169
|
}
|
|
170
|
-
|
|
170
|
+
}
|
|
171
171
|
|
|
172
172
|
&:hover {
|
|
173
173
|
> svg {
|
|
@@ -205,23 +205,23 @@ const ImageNumberCircle = _styledComponents.default.div`
|
|
|
205
205
|
left: 7px;
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
-
${_mediaQuery.
|
|
208
|
+
${_mediaQuery.mediaQuery.smallOnly} {
|
|
209
209
|
order: 1;
|
|
210
210
|
|
|
211
211
|
/* align right */
|
|
212
212
|
margin-left: auto;
|
|
213
213
|
/* 10px is the border-right width of body */
|
|
214
214
|
margin-right: 10px;
|
|
215
|
-
|
|
215
|
+
}
|
|
216
216
|
|
|
217
|
-
${_mediaQuery.
|
|
217
|
+
${_mediaQuery.mediaQuery.mediumAbove} {
|
|
218
218
|
margin-top: 6px;
|
|
219
219
|
|
|
220
220
|
/* align right */
|
|
221
221
|
margin-left: auto;
|
|
222
|
-
|
|
222
|
+
}
|
|
223
223
|
|
|
224
|
-
${_mediaQuery.
|
|
224
|
+
${_mediaQuery.mediaQuery.largeOnly} {
|
|
225
225
|
margin-right: -18px;
|
|
226
226
|
width: 110px;
|
|
227
227
|
height: 110px;
|
|
@@ -231,7 +231,7 @@ const ImageNumberCircle = _styledComponents.default.div`
|
|
|
231
231
|
top: 93px;
|
|
232
232
|
left: 10px;
|
|
233
233
|
}
|
|
234
|
-
|
|
234
|
+
}
|
|
235
235
|
`;
|
|
236
236
|
const ImageNumber = _styledComponents.default.span`
|
|
237
237
|
position: absolute;
|
|
@@ -241,19 +241,19 @@ const ImageNumber = _styledComponents.default.span`
|
|
|
241
241
|
font-weight: bold;
|
|
242
242
|
line-height: 0.79;
|
|
243
243
|
|
|
244
|
-
${_mediaQuery.
|
|
244
|
+
${_mediaQuery.mediaQuery.largeOnly} {
|
|
245
245
|
top: 35px;
|
|
246
246
|
left: 10px;
|
|
247
|
-
|
|
247
|
+
}
|
|
248
248
|
`;
|
|
249
249
|
const ImageTotal = (0, _styledComponents.default)(ImageNumber)`
|
|
250
250
|
top: 46px;
|
|
251
251
|
left: 36px;
|
|
252
252
|
|
|
253
|
-
${_mediaQuery.
|
|
253
|
+
${_mediaQuery.mediaQuery.largeOnly} {
|
|
254
254
|
top: 71px;
|
|
255
255
|
left: 50px;
|
|
256
|
-
|
|
256
|
+
}
|
|
257
257
|
`;
|
|
258
258
|
const Desc = (0, _styledComponents.default)(_multimedia.default.Caption)`
|
|
259
259
|
align-self: flex-start;
|
|
@@ -262,21 +262,21 @@ const Desc = (0, _styledComponents.default)(_multimedia.default.Caption)`
|
|
|
262
262
|
/* overwrite Multimedia.Caption styles */
|
|
263
263
|
margin-bottom: 0;
|
|
264
264
|
|
|
265
|
-
${_mediaQuery.
|
|
265
|
+
${_mediaQuery.mediaQuery.smallOnly} {
|
|
266
266
|
order: 4;
|
|
267
267
|
padding-top: 15px;
|
|
268
|
-
|
|
268
|
+
}
|
|
269
269
|
|
|
270
|
-
${_mediaQuery.
|
|
271
|
-
width: calc(180/355*100%);
|
|
272
|
-
|
|
270
|
+
${_mediaQuery.mediaQuery.smallOnly} {
|
|
271
|
+
width: calc(180 / 355 * 100%);
|
|
272
|
+
}
|
|
273
273
|
|
|
274
|
-
${_mediaQuery.
|
|
274
|
+
${_mediaQuery.mediaQuery.mediumAbove} {
|
|
275
275
|
padding-top: 30px;
|
|
276
276
|
|
|
277
277
|
/* overwrite Multimedia.Caption styles */
|
|
278
278
|
float: none;
|
|
279
|
-
|
|
279
|
+
}
|
|
280
280
|
`;
|
|
281
281
|
const EmptyDesc = (0, _styledComponents.default)(Desc)`
|
|
282
282
|
&::after {
|
|
@@ -297,46 +297,47 @@ const SlidesFlexBox = _styledComponents.default.div`
|
|
|
297
297
|
}
|
|
298
298
|
}}
|
|
299
299
|
|
|
300
|
-
${_mediaQuery.
|
|
301
|
-
transform: translateX(
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
transform: translateX(${props => getTranslateX(mockup.tablet, props.translateXUint) / getContainerWidth(mockup.tablet) * 100}%);
|
|
306
|
-
`}
|
|
300
|
+
${_mediaQuery.mediaQuery.smallOnly} {
|
|
301
|
+
transform: translateX(
|
|
302
|
+
${props => getTranslateX(mockup.mobile, props.translateXUint) / getContainerWidth(mockup.mobile) * 100}%
|
|
303
|
+
);
|
|
304
|
+
}
|
|
307
305
|
|
|
308
|
-
${_mediaQuery.
|
|
309
|
-
transform: translateX(
|
|
310
|
-
|
|
306
|
+
${_mediaQuery.mediaQuery.mediumOnly} {
|
|
307
|
+
transform: translateX(
|
|
308
|
+
${props => getTranslateX(mockup.desktop, props.translateXUint)}px
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
311
|
|
|
312
|
-
${_mediaQuery.
|
|
313
|
-
transform: translateX(
|
|
314
|
-
|
|
312
|
+
${_mediaQuery.mediaQuery.largeOnly} {
|
|
313
|
+
transform: translateX(
|
|
314
|
+
${props => getTranslateX(mockup.hd, props.translateXUint)}px
|
|
315
|
+
);
|
|
316
|
+
}
|
|
315
317
|
`;
|
|
316
318
|
const SlideFlexItem = _styledComponents.default.div`
|
|
317
319
|
height: 100%;
|
|
318
320
|
flex-shrink: 0;
|
|
319
321
|
|
|
320
|
-
${_mediaQuery.
|
|
321
|
-
flex-basis: calc(
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
322
|
+
${_mediaQuery.mediaQuery.smallOnly} {
|
|
323
|
+
flex-basis: calc(
|
|
324
|
+
${getSlideWidth(mockup.mobile)} / ${getContainerWidth(mockup.mobile)}*100%
|
|
325
|
+
);
|
|
326
|
+
padding-right: calc(
|
|
327
|
+
${mockup.mobile.slide.paddingRight} /
|
|
328
|
+
${getContainerWidth(mockup.mobile)}*100%
|
|
329
|
+
);
|
|
330
|
+
}
|
|
330
331
|
|
|
331
|
-
${_mediaQuery.
|
|
332
|
+
${_mediaQuery.mediaQuery.mediumOnly} {
|
|
332
333
|
flex-basis: ${getSlideWidth(mockup.desktop)}px;
|
|
333
334
|
padding-right: ${mockup.desktop.slide.paddingRight}px;
|
|
334
|
-
|
|
335
|
+
}
|
|
335
336
|
|
|
336
|
-
${_mediaQuery.
|
|
337
|
+
${_mediaQuery.mediaQuery.largeOnly} {
|
|
337
338
|
flex-basis: ${getSlideWidth(mockup.hd)}px;
|
|
338
339
|
padding-right: ${mockup.hd.slide.paddingRight}px;
|
|
339
|
-
|
|
340
|
+
}
|
|
340
341
|
`;
|
|
341
342
|
const SlideMask = _styledComponents.default.div`
|
|
342
343
|
position: absolute;
|
|
@@ -347,40 +348,32 @@ const SlideMask = _styledComponents.default.div`
|
|
|
347
348
|
const LeftSlideMask = (0, _styledComponents.default)(SlideMask)`
|
|
348
349
|
left: 0;
|
|
349
350
|
|
|
350
|
-
${_mediaQuery.
|
|
351
|
+
${_mediaQuery.mediaQuery.smallOnly} {
|
|
351
352
|
width: ${getLeftMaskWidth(mockup.mobile) / getContainerWidth(mockup.mobile) * 100}%;
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
${_mediaQuery.default.tabletOnly`
|
|
355
|
-
width: ${getLeftMaskWidth(mockup.tablet) / getContainerWidth(mockup.tablet) * 100}%;
|
|
356
|
-
`}
|
|
353
|
+
}
|
|
357
354
|
|
|
358
|
-
${_mediaQuery.
|
|
355
|
+
${_mediaQuery.mediaQuery.mediumOnly} {
|
|
359
356
|
width: ${getLeftMaskWidth(mockup.desktop)}px;
|
|
360
|
-
|
|
357
|
+
}
|
|
361
358
|
|
|
362
|
-
${_mediaQuery.
|
|
359
|
+
${_mediaQuery.mediaQuery.largeOnly} {
|
|
363
360
|
width: ${getLeftMaskWidth(mockup.hd)}px;
|
|
364
|
-
|
|
361
|
+
}
|
|
365
362
|
`;
|
|
366
363
|
const RightSlideMask = (0, _styledComponents.default)(SlideMask)`
|
|
367
364
|
right: 0;
|
|
368
365
|
|
|
369
|
-
${_mediaQuery.
|
|
366
|
+
${_mediaQuery.mediaQuery.smallOnly} {
|
|
370
367
|
width: ${getRightMaskWidth(mockup.mobile) / getContainerWidth(mockup.mobile) * 100}%;
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
${_mediaQuery.default.tabletOnly`
|
|
374
|
-
width: ${getRightMaskWidth(mockup.tablet) / getContainerWidth(mockup.tablet) * 100}%;
|
|
375
|
-
`}
|
|
368
|
+
}
|
|
376
369
|
|
|
377
|
-
${_mediaQuery.
|
|
370
|
+
${_mediaQuery.mediaQuery.mediumOnly} {
|
|
378
371
|
width: ${getRightMaskWidth(mockup.desktop)}px;
|
|
379
|
-
|
|
372
|
+
}
|
|
380
373
|
|
|
381
|
-
${_mediaQuery.
|
|
374
|
+
${_mediaQuery.mediaQuery.largeOnly} {
|
|
382
375
|
width: ${getRightMaskWidth(mockup.hd)}px;
|
|
383
|
-
|
|
376
|
+
}
|
|
384
377
|
`;
|
|
385
378
|
const SlideshowFlexBox = _styledComponents.default.div`
|
|
386
379
|
${PrevButton} {
|
|
@@ -404,21 +397,22 @@ const SlideshowFlexBox = _styledComponents.default.div`
|
|
|
404
397
|
}
|
|
405
398
|
|
|
406
399
|
width: 100%;
|
|
400
|
+
margin: 0 auto;
|
|
407
401
|
display: flex;
|
|
408
402
|
justify-content: space-between;
|
|
409
403
|
flex-wrap: wrap;
|
|
410
404
|
|
|
411
|
-
${_mediaQuery.
|
|
405
|
+
${_mediaQuery.mediaQuery.smallOnly} {
|
|
412
406
|
width: 100%;
|
|
413
|
-
|
|
407
|
+
}
|
|
414
408
|
|
|
415
|
-
${_mediaQuery.
|
|
409
|
+
${_mediaQuery.mediaQuery.mediumOnly} {
|
|
416
410
|
width: ${mockup.desktop.container.width}px;
|
|
417
|
-
|
|
411
|
+
}
|
|
418
412
|
|
|
419
|
-
${_mediaQuery.
|
|
413
|
+
${_mediaQuery.mediaQuery.largeOnly} {
|
|
420
414
|
width: ${mockup.hd.container.width}px;
|
|
421
|
-
|
|
415
|
+
}
|
|
422
416
|
`;
|
|
423
417
|
function getTranslateX(deviceMockup, unit) {
|
|
424
418
|
const slideWidth = getSlideWidth(deviceMockup);
|
|
@@ -591,7 +585,6 @@ function PreArrowSvg() {
|
|
|
591
585
|
}));
|
|
592
586
|
}
|
|
593
587
|
const ArticleBodyContainer = _styledComponents.default.div`
|
|
594
|
-
width: fit-content;
|
|
595
588
|
margin: 0 auto 27px auto;
|
|
596
589
|
`;
|
|
597
590
|
function SlideshowInArticleBody({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kids-reporter/draft-renderer",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.18",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@readr-media/react-image": "1.6.0",
|
|
26
|
-
"@twreporter/core": "^1.10.0",
|
|
27
26
|
"babel-loader": "^8.2.5",
|
|
28
27
|
"body-scroll-lock": "3.1.5",
|
|
29
28
|
"html-webpack-plugin": "^5.5.0",
|
package/lib/theme/index.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.theme = exports.mediaSize = exports.default = void 0;
|
|
7
|
-
const mediaSize = {
|
|
8
|
-
xs: 0,
|
|
9
|
-
sm: 576,
|
|
10
|
-
md: 768,
|
|
11
|
-
lg: 960,
|
|
12
|
-
xl: 1200,
|
|
13
|
-
xxl: 1400
|
|
14
|
-
};
|
|
15
|
-
exports.mediaSize = mediaSize;
|
|
16
|
-
const theme = {
|
|
17
|
-
breakpoint: {
|
|
18
|
-
xs: `@media (min-width: ${mediaSize.xs}px)`,
|
|
19
|
-
sm: `@media (min-width: ${mediaSize.sm}px)`,
|
|
20
|
-
md: `@media (min-width: ${mediaSize.md}px)`,
|
|
21
|
-
lg: `@media (min-width: ${mediaSize.lg}px)`,
|
|
22
|
-
xl: `@media (min-width: ${mediaSize.xl}px)`,
|
|
23
|
-
xxl: `@media (min-width: ${mediaSize.xxl}px)`
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
exports.theme = theme;
|
|
27
|
-
var _default = theme;
|
|
28
|
-
exports.default = _default;
|