@mirrormedia/lilith-draft-editor 1.1.0-alpha.11 → 1.1.0-alpha.13
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.
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.BGImageBlock = BGImageBlock;
|
|
6
7
|
exports.BGImageEditorBlock = BGImageEditorBlock;
|
|
7
8
|
|
|
8
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -13,17 +14,64 @@ var _draftConverter = _interopRequireDefault(require("../../../draft-js/draft-co
|
|
|
13
14
|
|
|
14
15
|
var _backgroundImage = require("../../../draft-js/buttons/background-image");
|
|
15
16
|
|
|
16
|
-
var _readr = _interopRequireDefault(require("@mirrormedia/lilith-draft-renderer/lib/website/readr"));
|
|
17
|
-
|
|
18
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
18
|
|
|
20
19
|
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); }
|
|
21
20
|
|
|
22
21
|
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; }
|
|
23
22
|
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
const BGImageRenderWrapper = _styledComponents.default.div`
|
|
24
|
+
padding: 30px;
|
|
25
|
+
position: relative;
|
|
26
|
+
width: 100%;
|
|
27
|
+
height: 100%;
|
|
28
|
+
background-image: url(${({
|
|
29
|
+
image
|
|
30
|
+
}) => image});
|
|
31
|
+
background-size: cover;
|
|
32
|
+
background-position: center center;
|
|
33
|
+
${({
|
|
34
|
+
textBlockAlign
|
|
35
|
+
}) => {
|
|
36
|
+
if (textBlockAlign === 'left') {
|
|
37
|
+
return `padding-right: 50%;`;
|
|
38
|
+
} else if (textBlockAlign === 'right') {
|
|
39
|
+
return `padding-left: 50%;`;
|
|
40
|
+
} else if (textBlockAlign === 'bottom') {
|
|
41
|
+
return `padding-top: 50%;`;
|
|
42
|
+
}
|
|
43
|
+
}}
|
|
44
|
+
`;
|
|
45
|
+
const BGImageRenderBody = _styledComponents.default.div`
|
|
46
|
+
background: rgba(0, 0, 0, 0.5);
|
|
47
|
+
padding: 4px 20px;
|
|
48
|
+
margin-bottom: 10px;
|
|
49
|
+
`;
|
|
50
|
+
|
|
51
|
+
function BGImageBlock(props) {
|
|
52
|
+
var _image$imageFile, _image$resized, _image$resized2;
|
|
53
|
+
|
|
54
|
+
const {
|
|
55
|
+
block,
|
|
56
|
+
contentState
|
|
57
|
+
} = props;
|
|
58
|
+
const entityKey = block.getEntityAt(0);
|
|
59
|
+
const entity = contentState.getEntity(entityKey);
|
|
60
|
+
const {
|
|
61
|
+
textBlockAlign,
|
|
62
|
+
image,
|
|
63
|
+
body
|
|
64
|
+
} = entity.getData();
|
|
65
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(BGImageRenderWrapper, {
|
|
66
|
+
image: (image === null || image === void 0 ? void 0 : (_image$imageFile = image.imageFile) === null || _image$imageFile === void 0 ? void 0 : _image$imageFile.url) || (image === null || image === void 0 ? void 0 : (_image$resized = image.resized) === null || _image$resized === void 0 ? void 0 : _image$resized.w800) || (image === null || image === void 0 ? void 0 : (_image$resized2 = image.resized) === null || _image$resized2 === void 0 ? void 0 : _image$resized2.original),
|
|
67
|
+
textBlockAlign: textBlockAlign
|
|
68
|
+
}, /*#__PURE__*/_react.default.createElement(BGImageRenderBody, {
|
|
69
|
+
dangerouslySetInnerHTML: {
|
|
70
|
+
__html: body
|
|
71
|
+
}
|
|
72
|
+
})));
|
|
73
|
+
}
|
|
74
|
+
|
|
27
75
|
const BGImageRenderButton = _styledComponents.default.span`
|
|
28
76
|
cursor: pointer;
|
|
29
77
|
background-color: white;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.BGVideoBlock = BGVideoBlock;
|
|
6
7
|
exports.BGVideoEditorBlock = BGVideoEditorBlock;
|
|
7
8
|
|
|
8
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -13,17 +14,74 @@ var _draftConverter = _interopRequireDefault(require("../../../draft-js/draft-co
|
|
|
13
14
|
|
|
14
15
|
var _backgroundVideo = require("../../../draft-js/buttons/background-video");
|
|
15
16
|
|
|
16
|
-
var _readr = _interopRequireDefault(require("@mirrormedia/lilith-draft-renderer/lib/website/readr"));
|
|
17
|
-
|
|
18
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
18
|
|
|
20
19
|
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); }
|
|
21
20
|
|
|
22
21
|
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; }
|
|
23
22
|
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
const BGVideoRenderWrapper = _styledComponents.default.div`
|
|
24
|
+
position: relative;
|
|
25
|
+
padding: 30px;
|
|
26
|
+
width: 100%;
|
|
27
|
+
${({
|
|
28
|
+
textBlockAlign
|
|
29
|
+
}) => {
|
|
30
|
+
if (textBlockAlign === 'left') {
|
|
31
|
+
return `padding-right: 50%;`;
|
|
32
|
+
} else if (textBlockAlign === 'right') {
|
|
33
|
+
return `padding-left: 50%;`;
|
|
34
|
+
} else if (textBlockAlign === 'bottom') {
|
|
35
|
+
return `padding-top: 50%;`;
|
|
36
|
+
}
|
|
37
|
+
}}
|
|
38
|
+
`;
|
|
39
|
+
const BGVideoRednerVideo = _styledComponents.default.video`
|
|
40
|
+
position: absolute;
|
|
41
|
+
width: 100%;
|
|
42
|
+
height: 100%;
|
|
43
|
+
top: 0;
|
|
44
|
+
left: 0;
|
|
45
|
+
z-index: -1;
|
|
46
|
+
background-color: black;
|
|
47
|
+
`;
|
|
48
|
+
const BGVideoRenderBody = _styledComponents.default.div`
|
|
49
|
+
background: rgba(0, 0, 0, 0.5);
|
|
50
|
+
padding: 4px 20px;
|
|
51
|
+
margin-bottom: 10px;
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
function BGVideoBlock(props) {
|
|
55
|
+
var _video$file;
|
|
56
|
+
|
|
57
|
+
const {
|
|
58
|
+
block,
|
|
59
|
+
contentState
|
|
60
|
+
} = props;
|
|
61
|
+
const entityKey = block.getEntityAt(0);
|
|
62
|
+
const entity = contentState.getEntity(entityKey);
|
|
63
|
+
const {
|
|
64
|
+
textBlockAlign,
|
|
65
|
+
video,
|
|
66
|
+
body
|
|
67
|
+
} = entity.getData();
|
|
68
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(BGVideoRenderWrapper, {
|
|
69
|
+
textBlockAlign: textBlockAlign
|
|
70
|
+
}, /*#__PURE__*/_react.default.createElement(BGVideoRednerVideo, {
|
|
71
|
+
muted: true,
|
|
72
|
+
autoPlay: true,
|
|
73
|
+
loop: true
|
|
74
|
+
}, /*#__PURE__*/_react.default.createElement("source", {
|
|
75
|
+
src: video === null || video === void 0 ? void 0 : video.url
|
|
76
|
+
}), /*#__PURE__*/_react.default.createElement("source", {
|
|
77
|
+
src: video === null || video === void 0 ? void 0 : (_video$file = video.file) === null || _video$file === void 0 ? void 0 : _video$file.url
|
|
78
|
+
})), /*#__PURE__*/_react.default.createElement(BGVideoRenderBody, {
|
|
79
|
+
dangerouslySetInnerHTML: {
|
|
80
|
+
__html: body
|
|
81
|
+
}
|
|
82
|
+
})));
|
|
83
|
+
}
|
|
84
|
+
|
|
27
85
|
const BGVideoRenderButton = _styledComponents.default.span`
|
|
28
86
|
cursor: pointer;
|
|
29
87
|
background-color: white;
|
|
@@ -206,8 +206,7 @@ function PostSelector(props) {
|
|
|
206
206
|
const {
|
|
207
207
|
onChange,
|
|
208
208
|
enableMultiSelect = false,
|
|
209
|
-
minSelectCount = 1
|
|
210
|
-
maxSelectCount = 3
|
|
209
|
+
minSelectCount = 1
|
|
211
210
|
} = props;
|
|
212
211
|
|
|
213
212
|
const onSave = () => {
|
|
@@ -242,15 +241,9 @@ function PostSelector(props) {
|
|
|
242
241
|
|
|
243
242
|
|
|
244
243
|
if (enableMultiSelect) {
|
|
245
|
-
|
|
244
|
+
return selected.concat([{
|
|
246
245
|
post: postEntity
|
|
247
246
|
}]);
|
|
248
|
-
|
|
249
|
-
if (maxSelectCount && newSelected.length >= maxSelectCount) {
|
|
250
|
-
newSelected = newSelected.slice(-maxSelectCount);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
return newSelected;
|
|
254
247
|
} // single select
|
|
255
248
|
|
|
256
249
|
|
|
@@ -21,6 +21,17 @@ const theme = {
|
|
|
21
21
|
lg: `@media (min-width: ${mediaSize.lg}px)`,
|
|
22
22
|
xl: `@media (min-width: ${mediaSize.xl}px)`,
|
|
23
23
|
xxl: `@media (min-width: ${mediaSize.xxl}px)`
|
|
24
|
+
},
|
|
25
|
+
fontSize: {
|
|
26
|
+
xs: 'font-size: 14px;',
|
|
27
|
+
sm: 'font-size: 16px;',
|
|
28
|
+
md: 'font-size: 18px;',
|
|
29
|
+
lg: 'font-size: 24px;',
|
|
30
|
+
xl: 'font-size: 28px;'
|
|
31
|
+
},
|
|
32
|
+
margin: {
|
|
33
|
+
default: 'margin: 32px auto;',
|
|
34
|
+
narrow: 'margin: 16px auto;'
|
|
24
35
|
}
|
|
25
36
|
};
|
|
26
37
|
exports.theme = theme;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mirrormedia/lilith-draft-editor",
|
|
3
|
-
"version": "1.1.0-alpha.
|
|
3
|
+
"version": "1.1.0-alpha.13",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"draft-js": "^0.11.7",
|
|
26
|
-
"@mirrormedia/lilith-draft-renderer": "1.
|
|
26
|
+
"@mirrormedia/lilith-draft-renderer": "1.2.0-alpha.9"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"react": "18.1.0",
|