@mirrormedia/lilith-draft-editor 1.3.3 → 2.1.0
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/@types/draft-js/buttons/annotation.d.ts +2 -0
- package/@types/draft-js/buttons/audio.d.ts +9 -0
- package/@types/draft-js/buttons/background-color.d.ts +2 -0
- package/@types/draft-js/buttons/background-image.d.ts +35 -0
- package/@types/draft-js/buttons/background-video.d.ts +35 -0
- package/@types/draft-js/buttons/color-box.d.ts +29 -0
- package/@types/draft-js/buttons/divider.d.ts +2 -0
- package/@types/draft-js/buttons/embedded-code.d.ts +2 -0
- package/@types/draft-js/buttons/enlarge.d.ts +2 -0
- package/@types/draft-js/buttons/font-color.d.ts +2 -0
- package/@types/draft-js/buttons/image.d.ts +9 -0
- package/@types/draft-js/buttons/info-box.d.ts +27 -0
- package/@types/draft-js/buttons/link.d.ts +2 -0
- package/@types/draft-js/buttons/media.d.ts +2 -0
- package/@types/draft-js/buttons/related-post.d.ts +13 -0
- package/@types/draft-js/buttons/selector/align-selector.d.ts +15 -0
- package/@types/draft-js/buttons/selector/audio-selector.d.ts +21 -0
- package/@types/draft-js/buttons/selector/image-selector.d.ts +34 -0
- package/@types/draft-js/buttons/selector/pagination.d.ts +7 -0
- package/@types/draft-js/buttons/selector/post-selector.d.ts +22 -0
- package/@types/draft-js/buttons/selector/search-box.d.ts +6 -0
- package/@types/draft-js/buttons/selector/video-selector.d.ts +24 -0
- package/@types/draft-js/buttons/side-index.d.ts +25 -0
- package/@types/draft-js/buttons/slideshow.d.ts +9 -0
- package/@types/draft-js/buttons/table.d.ts +2 -0
- package/@types/draft-js/buttons/text-align.d.ts +4 -0
- package/@types/draft-js/buttons/video.d.ts +9 -0
- package/@types/draft-js/buttons/youtube.d.ts +23 -0
- package/@types/draft-js/const.d.ts +1 -0
- package/@types/draft-js/draft-converter/api-data-instance.d.ts +11 -0
- package/@types/draft-js/draft-converter/atomic-block-processor.d.ts +17 -0
- package/@types/draft-js/draft-converter/entities.d.ts +74 -0
- package/@types/draft-js/draft-converter/index.d.ts +8 -0
- package/@types/draft-js/draft-converter/inline-styles-processor.d.ts +1 -0
- package/@types/draft-js/modifier.d.ts +6 -0
- package/@types/draft-js/util.d.ts +1 -0
- package/@types/index.d.ts +4 -0
- package/@types/website/mirrormedia/block-renderer/background-image-block.d.ts +17 -0
- package/@types/website/mirrormedia/block-renderer/background-video-block.d.ts +17 -0
- package/@types/website/mirrormedia/block-renderer/color-box-block.d.ts +17 -0
- package/@types/website/mirrormedia/block-renderer/embedded-code-block.d.ts +5 -0
- package/@types/website/mirrormedia/block-renderer/image-block.d.ts +15 -0
- package/@types/website/mirrormedia/block-renderer/info-box-block.d.ts +17 -0
- package/@types/website/mirrormedia/block-renderer/side-index-block.d.ts +15 -0
- package/@types/website/mirrormedia/block-renderer/slideshow-block.d.ts +16 -0
- package/@types/website/mirrormedia/block-renderer/table-block.d.ts +16 -0
- package/@types/website/mirrormedia/block-renderer-fn.d.ts +4 -0
- package/@types/website/mirrormedia/draft-editor.d.ts +75 -0
- package/@types/website/mirrormedia/entity-decorator.d.ts +3 -0
- package/@types/website/mirrormedia/index.d.ts +5 -0
- package/@types/website/mirrormedia/selector/align-selector.d.ts +15 -0
- package/@types/website/mirrormedia/selector/audio-selector.d.ts +20 -0
- package/@types/website/mirrormedia/selector/image-selector.d.ts +44 -0
- package/@types/website/mirrormedia/selector/pagination.d.ts +7 -0
- package/@types/website/mirrormedia/selector/post-selector.d.ts +21 -0
- package/@types/website/mirrormedia/selector/search-box.d.ts +6 -0
- package/@types/website/mirrormedia/selector/video-selector.d.ts +23 -0
- package/@types/website/mirrormedia/shared-style/index.d.ts +3 -0
- package/@types/website/mirrormedia/theme/index.d.ts +19 -0
- package/@types/website/readr/block-renderer/background-image-block.d.ts +29 -0
- package/@types/website/readr/block-renderer/background-video-block.d.ts +29 -0
- package/@types/website/readr/block-renderer/color-box-block.d.ts +17 -0
- package/@types/website/readr/block-renderer/image-block.d.ts +15 -0
- package/@types/website/readr/block-renderer/info-box-block.d.ts +17 -0
- package/@types/website/readr/block-renderer/side-index-block.d.ts +15 -0
- package/@types/website/readr/block-renderer/table-block.d.ts +16 -0
- package/@types/website/readr/block-renderer-fn.d.ts +4 -0
- package/@types/website/readr/draft-editor.d.ts +74 -0
- package/@types/website/readr/entity-decorator.d.ts +3 -0
- package/@types/website/readr/index.d.ts +5 -0
- package/@types/website/readr/selector/align-selector.d.ts +15 -0
- package/@types/website/readr/selector/audio-selector.d.ts +18 -0
- package/@types/website/readr/selector/image-selector.d.ts +36 -0
- package/@types/website/readr/selector/pagination.d.ts +7 -0
- package/@types/website/readr/selector/post-selector.d.ts +20 -0
- package/@types/website/readr/selector/search-box.d.ts +6 -0
- package/@types/website/readr/selector/video-selector.d.ts +23 -0
- package/@types/website/readr/theme/index.d.ts +30 -0
- package/README.md +8 -8
- package/lib/draft-js/buttons/annotation.js +4 -3
- package/lib/draft-js/buttons/audio.js +5 -9
- package/lib/draft-js/buttons/background-color.js +4 -3
- package/lib/draft-js/buttons/background-image.js +5 -3
- package/lib/draft-js/buttons/background-video.js +5 -3
- package/lib/draft-js/buttons/color-box.js +11 -15
- package/lib/draft-js/buttons/divider.js +6 -6
- package/lib/draft-js/buttons/embedded-code.js +8 -13
- package/lib/draft-js/buttons/enlarge.js +2 -6
- package/lib/draft-js/buttons/font-color.js +4 -3
- package/lib/draft-js/buttons/image.js +5 -9
- package/lib/draft-js/buttons/info-box.js +1 -1
- package/lib/draft-js/buttons/link.js +3 -2
- package/lib/draft-js/buttons/related-post.js +6 -10
- package/lib/draft-js/buttons/selector/align-selector.js +5 -9
- package/lib/draft-js/buttons/selector/audio-selector.js +17 -13
- package/lib/draft-js/buttons/selector/image-selector.js +29 -21
- package/lib/draft-js/buttons/selector/pagination.js +6 -8
- package/lib/draft-js/buttons/selector/post-selector.js +17 -13
- package/lib/draft-js/buttons/selector/video-selector.js +15 -10
- package/lib/draft-js/buttons/side-index.js +18 -22
- package/lib/draft-js/buttons/slideshow.js +5 -9
- package/lib/draft-js/buttons/table.js +3 -7
- package/lib/draft-js/buttons/text-align.js +17 -15
- package/lib/draft-js/buttons/type.js +5 -0
- package/lib/draft-js/buttons/video.js +5 -9
- package/lib/draft-js/buttons/youtube.js +12 -16
- package/lib/draft-js/draft-converter/api-data-instance.js +16 -2
- package/lib/draft-js/draft-converter/atomic-block-processor.js +24 -14
- package/lib/draft-js/draft-converter/index.js +68 -17
- package/lib/draft-js/draft-converter/inline-styles-processor.js +74 -26
- package/lib/draft-js/draft-converter/jsdoc.js +24 -0
- package/lib/draft-js/modifier.js +7 -7
- package/lib/draft-js/util.js +3 -1
- package/lib/website/mirrormedia/draft-editor.js +129 -93
- package/lib/website/mirrormedia/selector/align-selector.js +5 -9
- package/lib/website/mirrormedia/selector/audio-selector.js +4 -2
- package/lib/website/mirrormedia/selector/image-selector.js +16 -9
- package/lib/website/mirrormedia/selector/pagination.js +6 -8
- package/lib/website/mirrormedia/selector/post-selector.js +5 -3
- package/lib/website/mirrormedia/selector/video-selector.js +1 -1
- package/package.json +13 -11
- package/lib/draft-js/buttons/media.js +0 -121
|
@@ -5,16 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.SlideshowButton = SlideshowButton;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = require("react");
|
|
9
9
|
|
|
10
10
|
var _imageSelector = require("./selector/image-selector");
|
|
11
11
|
|
|
12
12
|
var _draftJs = require("draft-js");
|
|
13
13
|
|
|
14
|
-
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); }
|
|
15
|
-
|
|
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
|
-
|
|
18
14
|
function SlideshowButton(props) {
|
|
19
15
|
const {
|
|
20
16
|
editorState,
|
|
@@ -57,15 +53,15 @@ function SlideshowButton(props) {
|
|
|
57
53
|
setToShowImageSelector(false);
|
|
58
54
|
};
|
|
59
55
|
|
|
60
|
-
return /*#__PURE__*/
|
|
56
|
+
return /*#__PURE__*/React.createElement(_react.Fragment, null, toShowImageSelector && /*#__PURE__*/React.createElement(ImageSelector, {
|
|
61
57
|
onChange: onImageSelectorChange,
|
|
62
58
|
enableCaption: true,
|
|
63
59
|
enableDelay: true,
|
|
64
60
|
enableMultiSelect: true
|
|
65
|
-
}), /*#__PURE__*/
|
|
61
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
66
62
|
className: className,
|
|
67
63
|
onClick: promptForImageSelector
|
|
68
|
-
}, /*#__PURE__*/
|
|
64
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
69
65
|
className: "far fa-images"
|
|
70
|
-
}), /*#__PURE__*/
|
|
66
|
+
}), /*#__PURE__*/React.createElement("span", null, " Slideshow")));
|
|
71
67
|
}
|
|
@@ -5,12 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.TableButton = TableButton;
|
|
7
7
|
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _draftJs = require("draft-js");
|
|
11
9
|
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
10
|
function TableButton(props) {
|
|
15
11
|
const {
|
|
16
12
|
editorState,
|
|
@@ -58,10 +54,10 @@ function TableButton(props) {
|
|
|
58
54
|
onChange(_draftJs.AtomicBlockUtils.insertAtomicBlock(newEditorState, entityKey, ' '));
|
|
59
55
|
};
|
|
60
56
|
|
|
61
|
-
return /*#__PURE__*/
|
|
57
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
62
58
|
onClick: onClick,
|
|
63
59
|
className: className
|
|
64
|
-
}, /*#__PURE__*/
|
|
60
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
65
61
|
className: "fa fa-table"
|
|
66
|
-
}), /*#__PURE__*/
|
|
62
|
+
}), /*#__PURE__*/React.createElement("span", null, "Table"));
|
|
67
63
|
}
|
|
@@ -7,14 +7,12 @@ exports.AlignCenterButton = AlignCenterButton;
|
|
|
7
7
|
exports.AlignLeftButton = AlignLeftButton;
|
|
8
8
|
exports.getSelectionBlockData = void 0;
|
|
9
9
|
|
|
10
|
-
var _react =
|
|
10
|
+
var _react = require("react");
|
|
11
11
|
|
|
12
12
|
var _draftJs = require("draft-js");
|
|
13
13
|
|
|
14
14
|
var _modifier = require("../modifier");
|
|
15
15
|
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
16
|
const toggleSelectionTextAlign = (editorState, textAlign) => {
|
|
19
17
|
return setSelectionBlockData(editorState, {
|
|
20
18
|
textAlign: getSelectionBlockData(editorState, 'textAlign') !== textAlign ? textAlign : undefined
|
|
@@ -37,24 +35,26 @@ function AlignCenterButton(props) {
|
|
|
37
35
|
const {
|
|
38
36
|
isActive,
|
|
39
37
|
editorState,
|
|
40
|
-
onChange
|
|
38
|
+
onChange,
|
|
39
|
+
className
|
|
41
40
|
} = props;
|
|
42
41
|
|
|
43
42
|
const toggleTextAlign = () => {
|
|
44
43
|
const newContentState = toggleSelectionTextAlign(editorState, 'center');
|
|
45
|
-
onChange(
|
|
44
|
+
onChange( // @ts-ignore `change-block-style` is not EditoChangeType
|
|
45
|
+
_draftJs.EditorState.push(editorState, newContentState, 'change-block-style'));
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
return /*#__PURE__*/
|
|
49
|
-
className:
|
|
48
|
+
return /*#__PURE__*/React.createElement(_react.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
className: className,
|
|
50
50
|
onMouseDown: toggleTextAlign
|
|
51
|
-
}, /*#__PURE__*/
|
|
51
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
52
52
|
width: "16",
|
|
53
53
|
height: "16",
|
|
54
54
|
viewBox: "0 0 16 16",
|
|
55
55
|
fill: "none",
|
|
56
56
|
xmlns: "http://www.w3.org/2000/svg"
|
|
57
|
-
}, /*#__PURE__*/
|
|
57
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
58
58
|
d: "M11.4286 2.28571H4.57143C3.93929 2.28571 3.42857 1.77393 3.42857 1.14286C3.42857 0.511786 3.93929 0 4.57143 0H11.4286C12.0607 0 12.5714 0.511786 12.5714 1.14286C12.5714 1.77393 12.0607 2.28571 11.4286 2.28571ZM14.8571 6.85714H1.14286C0.511786 6.85714 0 6.34643 0 5.71429C0 5.08214 0.511786 4.57143 1.14286 4.57143H14.8571C15.4893 4.57143 16 5.08214 16 5.71429C16 6.34643 15.4893 6.85714 14.8571 6.85714ZM0 14.8571C0 14.225 0.511786 13.7143 1.14286 13.7143H14.8571C15.4893 13.7143 16 14.225 16 14.8571C16 15.4893 15.4893 16 14.8571 16H1.14286C0.511786 16 0 15.4893 0 14.8571ZM11.4286 11.4286H4.57143C3.93929 11.4286 3.42857 10.9179 3.42857 10.2857C3.42857 9.65357 3.93929 9.14286 4.57143 9.14286H11.4286C12.0607 9.14286 12.5714 9.65357 12.5714 10.2857C12.5714 10.9179 12.0607 11.4286 11.4286 11.4286Z",
|
|
59
59
|
fill: isActive ? '#ED8B00' : '#6b7280'
|
|
60
60
|
}))));
|
|
@@ -64,24 +64,26 @@ function AlignLeftButton(props) {
|
|
|
64
64
|
const {
|
|
65
65
|
isActive,
|
|
66
66
|
editorState,
|
|
67
|
-
onChange
|
|
67
|
+
onChange,
|
|
68
|
+
className
|
|
68
69
|
} = props;
|
|
69
70
|
|
|
70
71
|
const toggleTextAlign = () => {
|
|
71
72
|
const newContentState = toggleSelectionTextAlign(editorState, 'left');
|
|
72
|
-
onChange(
|
|
73
|
+
onChange( // @ts-ignore `change-block-style` is not EditoChangeType
|
|
74
|
+
_draftJs.EditorState.push(editorState, newContentState, 'change-block-style'));
|
|
73
75
|
};
|
|
74
76
|
|
|
75
|
-
return /*#__PURE__*/
|
|
76
|
-
className:
|
|
77
|
+
return /*#__PURE__*/React.createElement(_react.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
78
|
+
className: className,
|
|
77
79
|
onMouseDown: toggleTextAlign
|
|
78
|
-
}, /*#__PURE__*/
|
|
80
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
79
81
|
width: "16",
|
|
80
82
|
height: "16",
|
|
81
83
|
viewBox: "0 0 16 16",
|
|
82
84
|
fill: "none",
|
|
83
85
|
xmlns: "http://www.w3.org/2000/svg"
|
|
84
|
-
}, /*#__PURE__*/
|
|
86
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
85
87
|
d: "M9.14286 2.28571H1.14286C0.511786 2.28571 0 1.77393 0 1.14286C0 0.511786 0.511786 0 1.14286 0H9.14286C9.775 0 10.2857 0.511786 10.2857 1.14286C10.2857 1.77393 9.775 2.28571 9.14286 2.28571ZM9.14286 11.4286H1.14286C0.511786 11.4286 0 10.9179 0 10.2857C0 9.65357 0.511786 9.14286 1.14286 9.14286H9.14286C9.775 9.14286 10.2857 9.65357 10.2857 10.2857C10.2857 10.9179 9.775 11.4286 9.14286 11.4286ZM0 5.71429C0 5.08214 0.511786 4.57143 1.14286 4.57143H14.8571C15.4893 4.57143 16 5.08214 16 5.71429C16 6.34643 15.4893 6.85714 14.8571 6.85714H1.14286C0.511786 6.85714 0 6.34643 0 5.71429ZM14.8571 16H1.14286C0.511786 16 0 15.4893 0 14.8571C0 14.225 0.511786 13.7143 1.14286 13.7143H14.8571C15.4893 13.7143 16 14.225 16 14.8571C16 15.4893 15.4893 16 14.8571 16Z",
|
|
86
88
|
fill: isActive ? '#ED8B00' : '#6b7280'
|
|
87
89
|
}))));
|
|
@@ -5,16 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.VideoButton = VideoButton;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = require("react");
|
|
9
9
|
|
|
10
10
|
var _draftJs = require("draft-js");
|
|
11
11
|
|
|
12
12
|
var _videoSelector = require("./selector/video-selector");
|
|
13
13
|
|
|
14
|
-
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); }
|
|
15
|
-
|
|
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
|
-
|
|
18
14
|
function VideoButton(props) {
|
|
19
15
|
const {
|
|
20
16
|
editorState,
|
|
@@ -54,12 +50,12 @@ function VideoButton(props) {
|
|
|
54
50
|
setToShowVideoSelector(false);
|
|
55
51
|
};
|
|
56
52
|
|
|
57
|
-
return /*#__PURE__*/
|
|
53
|
+
return /*#__PURE__*/React.createElement(_react.Fragment, null, toShowVideoSelector && /*#__PURE__*/React.createElement(VideoSelector, {
|
|
58
54
|
onChange: onVideoSelectorChange
|
|
59
|
-
}), /*#__PURE__*/
|
|
55
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
60
56
|
className: className,
|
|
61
57
|
onClick: promptForVideoSelector
|
|
62
|
-
}, /*#__PURE__*/
|
|
58
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
63
59
|
className: "fa fa-video-camera"
|
|
64
|
-
}), /*#__PURE__*/
|
|
60
|
+
}), /*#__PURE__*/React.createElement("span", null, " Video")));
|
|
65
61
|
}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.YoutubeButton = YoutubeButton;
|
|
7
7
|
exports.YoutubeInput = YoutubeInput;
|
|
8
8
|
|
|
9
|
-
var _react =
|
|
9
|
+
var _react = require("react");
|
|
10
10
|
|
|
11
11
|
var _draftJs = require("draft-js");
|
|
12
12
|
|
|
@@ -18,10 +18,6 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
18
18
|
|
|
19
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
20
|
|
|
21
|
-
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); }
|
|
22
|
-
|
|
23
|
-
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; }
|
|
24
|
-
|
|
25
21
|
const Label = _styledComponents.default.label`
|
|
26
22
|
display: block;
|
|
27
23
|
font-weight: 600;
|
|
@@ -44,9 +40,9 @@ function YoutubeInput(props) {
|
|
|
44
40
|
setInputValue(initialInputValue);
|
|
45
41
|
};
|
|
46
42
|
|
|
47
|
-
return /*#__PURE__*/
|
|
43
|
+
return /*#__PURE__*/React.createElement(_modals.DrawerController, {
|
|
48
44
|
isOpen: isOpen
|
|
49
|
-
}, /*#__PURE__*/
|
|
45
|
+
}, /*#__PURE__*/React.createElement(_modals.Drawer, {
|
|
50
46
|
title: `Insert Youtube video`,
|
|
51
47
|
actions: {
|
|
52
48
|
cancel: {
|
|
@@ -67,9 +63,9 @@ function YoutubeInput(props) {
|
|
|
67
63
|
}
|
|
68
64
|
}
|
|
69
65
|
}
|
|
70
|
-
}, /*#__PURE__*/
|
|
66
|
+
}, /*#__PURE__*/React.createElement(Label, {
|
|
71
67
|
htmlFor: "description"
|
|
72
|
-
}, "Youtube Description"), /*#__PURE__*/
|
|
68
|
+
}, "Youtube Description"), /*#__PURE__*/React.createElement(_fields.TextInput, {
|
|
73
69
|
onChange: e => setInputValue({
|
|
74
70
|
description: e.target.value,
|
|
75
71
|
youtubeId: inputValue.youtubeId
|
|
@@ -78,9 +74,9 @@ function YoutubeInput(props) {
|
|
|
78
74
|
placeholder: "description",
|
|
79
75
|
id: "description",
|
|
80
76
|
value: inputValue.description
|
|
81
|
-
}), /*#__PURE__*/
|
|
77
|
+
}), /*#__PURE__*/React.createElement(Label, {
|
|
82
78
|
htmlFor: "youtubeId"
|
|
83
|
-
}, "Youtube Videi Id"), /*#__PURE__*/
|
|
79
|
+
}, "Youtube Videi Id"), /*#__PURE__*/React.createElement(_fields.TextInput, {
|
|
84
80
|
onChange: e => setInputValue({
|
|
85
81
|
description: inputValue.description,
|
|
86
82
|
youtubeId: e.target.value
|
|
@@ -122,26 +118,26 @@ function YoutubeButton(props) {
|
|
|
122
118
|
setToShowInput(false);
|
|
123
119
|
};
|
|
124
120
|
|
|
125
|
-
return /*#__PURE__*/
|
|
121
|
+
return /*#__PURE__*/React.createElement(_react.Fragment, null, /*#__PURE__*/React.createElement(YoutubeInput, {
|
|
126
122
|
onChange: onChange,
|
|
127
123
|
onCancel: () => {
|
|
128
124
|
setToShowInput(false);
|
|
129
125
|
},
|
|
130
126
|
isOpen: toShowInput
|
|
131
|
-
}), /*#__PURE__*/
|
|
127
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
132
128
|
className: className,
|
|
133
129
|
onClick: () => {
|
|
134
130
|
setToShowInput(true);
|
|
135
131
|
}
|
|
136
|
-
}, /*#__PURE__*/
|
|
132
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
137
133
|
height: "16px",
|
|
138
134
|
width: "14px",
|
|
139
135
|
version: "1.1",
|
|
140
136
|
id: "Layer_1",
|
|
141
137
|
xmlns: "http://www.w3.org/2000/svg",
|
|
142
138
|
viewBox: "0 0 461.001 461.001"
|
|
143
|
-
}, /*#__PURE__*/
|
|
139
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
144
140
|
fill: "#6b7280",
|
|
145
141
|
d: "M365.257,67.393H95.744C42.866,67.393,0,110.259,0,163.137v134.728 c0,52.878,42.866,95.744,95.744,95.744h269.513c52.878,0,95.744-42.866,95.744-95.744V163.137 C461.001,110.259,418.135,67.393,365.257,67.393z M300.506,237.056l-126.06,60.123c-3.359,1.602-7.239-0.847-7.239-4.568V168.607 c0-3.774,3.982-6.22,7.348-4.514l126.06,63.881C304.363,229.873,304.298,235.248,300.506,237.056z"
|
|
146
|
-
})), /*#__PURE__*/
|
|
142
|
+
})), /*#__PURE__*/React.createElement("span", null, "Youtube")));
|
|
147
143
|
}
|
|
@@ -11,7 +11,18 @@ var _shortid = _interopRequireDefault(require("shortid"));
|
|
|
11
11
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* @typedef Property
|
|
16
|
+
* @property {string} [id]
|
|
17
|
+
* @property {string} [type]
|
|
18
|
+
* @property {string} [alignment]
|
|
19
|
+
* @property {any[]} [content]
|
|
20
|
+
* @property {Record<string, any>} [styles]
|
|
21
|
+
* @property {string} [textAlign]
|
|
22
|
+
*/
|
|
23
|
+
const ApiDataInstanceRecord = (0, _immutable.Record)(
|
|
24
|
+
/** @type {Property} */
|
|
25
|
+
{
|
|
15
26
|
id: _shortid.default.generate(),
|
|
16
27
|
type: 'paragraph',
|
|
17
28
|
alignment: 'center',
|
|
@@ -21,8 +32,11 @@ const ApiDataInstanceRecord = (0, _immutable.Record)({
|
|
|
21
32
|
});
|
|
22
33
|
|
|
23
34
|
class ApiDataInstance extends ApiDataInstanceRecord {
|
|
35
|
+
/**
|
|
36
|
+
* @param {Property} props
|
|
37
|
+
*/
|
|
24
38
|
constructor(props) {
|
|
25
|
-
|
|
39
|
+
const id = props && props.id || _shortid.default.generate();
|
|
26
40
|
|
|
27
41
|
props.id = id;
|
|
28
42
|
super(props);
|
|
@@ -19,7 +19,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
19
19
|
|
|
20
20
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
21
21
|
// import sizeOf from 'image-size';
|
|
22
|
-
// eslint-disable-line
|
|
23
22
|
// import htmlparser2 from 'htmlparser2'
|
|
24
23
|
// eslint-disable-next-line no-undef
|
|
25
24
|
const htmlparser2 = require('htmlparser2');
|
|
@@ -31,16 +30,23 @@ const htmlparser2 = require('htmlparser2');
|
|
|
31
30
|
*/
|
|
32
31
|
|
|
33
32
|
/**
|
|
33
|
+
* @typedef {import('./jsdoc').RawDraftContentState} RawDraftContentState
|
|
34
|
+
* @typedef {import('./jsdoc').RawDraftContentBlock} RawDraftContentBlock
|
|
35
|
+
* @typedef {import('./jsdoc').EntityMap} EntityMap
|
|
34
36
|
* @typedef {RawDraftContentState[][]} DraftEditor.TableEntity.TableData
|
|
35
37
|
*/
|
|
36
38
|
|
|
37
39
|
|
|
38
40
|
const processor = {
|
|
41
|
+
/**
|
|
42
|
+
* @param {EntityMap} entityMap
|
|
43
|
+
* @param {RawDraftContentBlock} block
|
|
44
|
+
*/
|
|
39
45
|
convertBlock(entityMap, block) {
|
|
40
46
|
let alignment = 'center';
|
|
41
47
|
let content;
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
const entityRange = block.entityRanges[0];
|
|
49
|
+
const styles = {}; // current block's entity data
|
|
44
50
|
// ex:
|
|
45
51
|
// entity.type = IMAGE, entity.data={id,name,url...}
|
|
46
52
|
|
|
@@ -106,7 +112,7 @@ const processor = {
|
|
|
106
112
|
// this is different from default blockquote of draftjs
|
|
107
113
|
// so we name our specific blockquote as 'quoteby'
|
|
108
114
|
type = 'quoteby';
|
|
109
|
-
alignment = entity.data && entity.data.alignment || alignment;
|
|
115
|
+
alignment = (entity === null || entity === void 0 ? void 0 : entity.data) && (entity === null || entity === void 0 ? void 0 : entity.data.alignment) || alignment;
|
|
110
116
|
content = _lodash.default.get(entity, 'data');
|
|
111
117
|
content = Array.isArray(content) ? content : [content];
|
|
112
118
|
break;
|
|
@@ -124,7 +130,7 @@ const processor = {
|
|
|
124
130
|
case _entities.default.BACKGROUNDVIDEO.type:
|
|
125
131
|
case _entities.default.RELATEDPOST.type:
|
|
126
132
|
case _entities.default.SIDEINDEX.type:
|
|
127
|
-
alignment = entity.data && entity.data.alignment || alignment;
|
|
133
|
+
alignment = (entity === null || entity === void 0 ? void 0 : entity.data) && (entity === null || entity === void 0 ? void 0 : entity.data.alignment) || alignment;
|
|
128
134
|
content = _lodash.default.get(entity, 'data');
|
|
129
135
|
content = Array.isArray(content) ? content : [content];
|
|
130
136
|
break;
|
|
@@ -133,11 +139,11 @@ const processor = {
|
|
|
133
139
|
{
|
|
134
140
|
// use Embedded component to dangerouslySetInnerHTML
|
|
135
141
|
type = _entities.default.EMBEDDEDCODE.type;
|
|
136
|
-
alignment = entity.data && entity.data.alignment || alignment;
|
|
142
|
+
alignment = (entity === null || entity === void 0 ? void 0 : entity.data) && (entity === null || entity === void 0 ? void 0 : entity.data.alignment) || alignment;
|
|
137
143
|
|
|
138
|
-
|
|
144
|
+
const description = _lodash.default.get(entity, ['data', 'description'], '');
|
|
139
145
|
|
|
140
|
-
|
|
146
|
+
const url = _lodash.default.get(entity, ['data', 'url'], '');
|
|
141
147
|
|
|
142
148
|
content = [{
|
|
143
149
|
caption: description,
|
|
@@ -149,18 +155,22 @@ const processor = {
|
|
|
149
155
|
|
|
150
156
|
case _entities.default.EMBEDDEDCODE.type:
|
|
151
157
|
{
|
|
152
|
-
alignment = entity.data && entity.data.alignment || alignment;
|
|
158
|
+
alignment = (entity === null || entity === void 0 ? void 0 : entity.data) && (entity === null || entity === void 0 ? void 0 : entity.data.alignment) || alignment;
|
|
153
159
|
|
|
154
|
-
|
|
160
|
+
const caption = _lodash.default.get(entity, ['data', 'caption'], '');
|
|
155
161
|
|
|
156
|
-
|
|
162
|
+
const embeddedCode = _lodash.default.get(entity, ['data', 'embeddedCode'], '');
|
|
163
|
+
/** @type {Record<string, any>} */
|
|
157
164
|
|
|
158
|
-
|
|
159
|
-
|
|
165
|
+
|
|
166
|
+
const script = {};
|
|
167
|
+
/** @type {typeof script[]} */
|
|
168
|
+
|
|
169
|
+
const scripts = [];
|
|
160
170
|
let scriptTagStart = false;
|
|
161
171
|
let height;
|
|
162
172
|
let width;
|
|
163
|
-
|
|
173
|
+
const parser = new htmlparser2.Parser({
|
|
164
174
|
onopentag: (name, attribs) => {
|
|
165
175
|
if (name === 'script') {
|
|
166
176
|
scriptTagStart = true;
|
|
@@ -25,7 +25,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
25
25
|
|
|
26
26
|
// Modified from https://github.com/dburrows/draft-js-basic-html-editor/blob/master/src/utils/draftRawToHtml.js
|
|
27
27
|
// 'use strict';
|
|
28
|
-
|
|
28
|
+
const defaultBlockTagMap = {
|
|
29
29
|
atomic: `<div>%content%</div>`,
|
|
30
30
|
blockquote: `<blockquote>%content%</blockquote>`,
|
|
31
31
|
'code-block': `<code>%content%</code>`,
|
|
@@ -38,14 +38,14 @@ let defaultBlockTagMap = {
|
|
|
38
38
|
'unordered-list-item': `<li>%content%</li>`,
|
|
39
39
|
unstyled: `<p>%content%</p>`
|
|
40
40
|
};
|
|
41
|
-
|
|
41
|
+
const inlineTagMap = {
|
|
42
42
|
BOLD: ['<strong>', '</strong>'],
|
|
43
43
|
CODE: ['<code>', '</code>'],
|
|
44
44
|
default: ['<span>', '</span>'],
|
|
45
45
|
ITALIC: ['<em>', '</em>'],
|
|
46
46
|
UNDERLINE: ['<u>', '</u>']
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
const defaultEntityTagMap = {
|
|
49
49
|
[_entities.default.DIVIDER.type]: ['<hr>', ''],
|
|
50
50
|
[_entities.default.ANNOTATION.type]: ['<abbr title="<%= data.body %>"><%= data.text %>', '</abbr>'],
|
|
51
51
|
[_entities.default.AUDIO.type]: ['<div class="audio-container center"><div class="audio-title"><%= data.name %></div><!-- <div class="audio-desc"><%= data.description %></div> --><audio src="<%= data.url %>" />', '</div>'],
|
|
@@ -62,23 +62,48 @@ let defaultEntityTagMap = {
|
|
|
62
62
|
[_entities.default.VIDEO.type]: ['<div controls class="video-container <%= data.alignment %>"><div class="video-name"><%= data.title %></div><div class="video-desc"><%= data.description %></div><video src="<%= data.url %>" />', '</div>'],
|
|
63
63
|
[_entities.default.YOUTUBE.type]: ['<iframe width="560" alt="<%= data.description %>" height="315" src="https://www.youtube.com/embed/<%= data.id %>" frameborder="0" allowfullscreen>', '</iframe>']
|
|
64
64
|
};
|
|
65
|
-
|
|
65
|
+
const nestedTagMap = {
|
|
66
66
|
'ordered-list-item': ['<ol>', '</ol>'],
|
|
67
67
|
'unordered-list-item': ['<ul>', '</ul>']
|
|
68
68
|
};
|
|
69
|
+
/**
|
|
70
|
+
* @typedef {import('./jsdoc').RawDraftContentState} RawDraftContentState
|
|
71
|
+
* @typedef {import('./jsdoc').RawDraftContentBlock} RawDraftContentBlock
|
|
72
|
+
* @typedef {import('./jsdoc').EntityMap} EntityMap
|
|
73
|
+
* @typedef {import('./jsdoc').BlockTagMap} BlockTagMap
|
|
74
|
+
* @typedef {import('./jsdoc').EntityTagMap} EntityTagMap
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* @param {RawDraftContentBlock} block
|
|
79
|
+
* @param {EntityMap} entityMap
|
|
80
|
+
* @param {BlockTagMap} blockTagMap
|
|
81
|
+
* @param {EntityTagMap} entityTagMap
|
|
82
|
+
*/
|
|
69
83
|
|
|
70
84
|
function _convertInlineStyle(block, entityMap, blockTagMap, entityTagMap) {
|
|
71
|
-
return blockTagMap[block.type] ? blockTagMap[block.type].replace('%content%', InlineStylesProcessor.convertToHtml(inlineTagMap, entityTagMap, entityMap, block)) : blockTagMap.default.replace('%content%', InlineStylesProcessor.convertToHtml(inlineTagMap, block));
|
|
85
|
+
return blockTagMap[block.type] ? blockTagMap[block.type].replace('%content%', InlineStylesProcessor.convertToHtml(inlineTagMap, entityTagMap, entityMap, block)) : blockTagMap.default.replace('%content%', InlineStylesProcessor.convertToHtml(inlineTagMap, entityTagMap, entityMap, block));
|
|
72
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* @param {RawDraftContentBlock[]} blocks
|
|
89
|
+
* @param {EntityMap} entityMap
|
|
90
|
+
* @param {BlockTagMap} blockTagMap
|
|
91
|
+
* @param {EntityTagMap} entityTagMap
|
|
92
|
+
*/
|
|
93
|
+
|
|
73
94
|
|
|
74
95
|
function _convertBlocksToHtml(blocks, entityMap, blockTagMap, entityTagMap) {
|
|
75
96
|
let html = '';
|
|
76
|
-
|
|
97
|
+
/** @type {string[]} */
|
|
98
|
+
|
|
99
|
+
const nestLevel = []; // store the list type of the previous item: null/ol/ul
|
|
77
100
|
|
|
78
101
|
blocks.forEach(block => {
|
|
79
102
|
// create tag for <ol> or <ul>: deal with ordered/unordered list item
|
|
80
103
|
// if the block is a list-item && the previous block is not a list-item
|
|
81
|
-
if (
|
|
104
|
+
if (block.type in nestedTagMap && // @ts-ignore: block.type is nestedTagMap property
|
|
105
|
+
nestedTagMap[block.type] && nestLevel[0] !== block.type) {
|
|
106
|
+
// @ts-ignore: block.type is nestedTagMap property
|
|
82
107
|
html += nestedTagMap[block.type][0]; // start with <ol> or <ul>
|
|
83
108
|
|
|
84
109
|
nestLevel.unshift(block.type);
|
|
@@ -86,26 +111,39 @@ function _convertBlocksToHtml(blocks, entityMap, blockTagMap, entityTagMap) {
|
|
|
86
111
|
|
|
87
112
|
|
|
88
113
|
if (nestLevel.length > 0 && nestLevel[0] !== block.type) {
|
|
114
|
+
// @ts-ignore: nestLevel.shift() is not undefined
|
|
89
115
|
html += nestedTagMap[nestLevel.shift()][1]; // close with </ol> or </ul>
|
|
90
116
|
}
|
|
91
117
|
|
|
92
118
|
html += _convertInlineStyle(block, entityMap, blockTagMap, entityTagMap);
|
|
93
119
|
}); // end tag with </ol> or </ul>: or if it is the last block
|
|
120
|
+
// @ts-ignore: blocks[blocks.length - 1] is not undefined
|
|
94
121
|
|
|
95
122
|
if (blocks.length > 0 && nestedTagMap[blocks[blocks.length - 1].type]) {
|
|
123
|
+
// @ts-ignore: nestLevel.shift() should not be undefined
|
|
96
124
|
html += nestedTagMap[nestLevel.shift()][1]; // close with </ol> or </ul>
|
|
97
125
|
}
|
|
98
126
|
|
|
99
127
|
return html;
|
|
100
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* @param {RawDraftContentBlock[]} blocks
|
|
131
|
+
* @param {EntityMap} entityMap
|
|
132
|
+
* @param {EntityTagMap} entityTagMap
|
|
133
|
+
*/
|
|
134
|
+
|
|
101
135
|
|
|
102
136
|
function convertBlocksToApiData(blocks, entityMap, entityTagMap) {
|
|
103
137
|
let apiDataArr = (0, _immutable.List)();
|
|
138
|
+
/** @type {any[]} */
|
|
139
|
+
|
|
104
140
|
let content = [];
|
|
105
|
-
|
|
141
|
+
/** @type {string[]} */
|
|
142
|
+
|
|
143
|
+
const nestLevel = [];
|
|
106
144
|
blocks.forEach(block => {
|
|
107
145
|
// block is not a list-item
|
|
108
|
-
if (!
|
|
146
|
+
if (!(block.type in nestedTagMap)) {
|
|
109
147
|
// if previous block is a list-item
|
|
110
148
|
if (content.length > 0 && nestLevel.length > 0) {
|
|
111
149
|
apiDataArr = apiDataArr.push(new _apiDataInstance.default({
|
|
@@ -125,7 +163,7 @@ function convertBlocksToApiData(blocks, entityMap, entityTagMap) {
|
|
|
125
163
|
} else {
|
|
126
164
|
var _block$data;
|
|
127
165
|
|
|
128
|
-
|
|
166
|
+
const converted = InlineStylesProcessor.convertToHtml(inlineTagMap, entityTagMap, entityMap, block);
|
|
129
167
|
const type = block.type;
|
|
130
168
|
const textAlign = (_block$data = block.data) === null || _block$data === void 0 ? void 0 : _block$data.textAlign;
|
|
131
169
|
apiDataArr = apiDataArr.push(new _apiDataInstance.default({
|
|
@@ -136,7 +174,7 @@ function convertBlocksToApiData(blocks, entityMap, entityTagMap) {
|
|
|
136
174
|
}));
|
|
137
175
|
}
|
|
138
176
|
} else {
|
|
139
|
-
|
|
177
|
+
const converted = InlineStylesProcessor.convertToHtml(inlineTagMap, entityTagMap, entityMap, block); // previous block is not an item-list block
|
|
140
178
|
|
|
141
179
|
if (nestLevel.length === 0) {
|
|
142
180
|
nestLevel.unshift(block.type);
|
|
@@ -158,7 +196,7 @@ function convertBlocksToApiData(blocks, entityMap, entityTagMap) {
|
|
|
158
196
|
}); // last block is a item-list
|
|
159
197
|
|
|
160
198
|
if (blocks.length > 0 && nestLevel.length > 0) {
|
|
161
|
-
|
|
199
|
+
const block = blocks[blocks.length - 1];
|
|
162
200
|
apiDataArr = apiDataArr.push(new _apiDataInstance.default({
|
|
163
201
|
id: block.key,
|
|
164
202
|
type: block.type,
|
|
@@ -168,29 +206,42 @@ function convertBlocksToApiData(blocks, entityMap, entityTagMap) {
|
|
|
168
206
|
|
|
169
207
|
return apiDataArr;
|
|
170
208
|
}
|
|
209
|
+
/**
|
|
210
|
+
* @param {RawDraftContentState} raw
|
|
211
|
+
* @param {BlockTagMap} [blockTagMap]
|
|
212
|
+
* @param {EntityTagMap} [entityTagMap]
|
|
213
|
+
*/
|
|
214
|
+
|
|
171
215
|
|
|
172
216
|
function convertRawToHtml(raw, blockTagMap, entityTagMap) {
|
|
173
217
|
blockTagMap = _lodash.default.merge({}, defaultBlockTagMap, blockTagMap);
|
|
174
218
|
entityTagMap = entityTagMap || defaultEntityTagMap;
|
|
175
219
|
let html = '';
|
|
176
|
-
raw = raw ||
|
|
220
|
+
raw = raw ||
|
|
221
|
+
/** @type {RawDraftContentState} */
|
|
222
|
+
{};
|
|
177
223
|
const blocks = Array.isArray(raw.blocks) ? raw.blocks : [];
|
|
178
224
|
const entityMap = typeof raw.entityMap === 'object' ? raw.entityMap : {};
|
|
179
225
|
html = _convertBlocksToHtml(blocks, entityMap, blockTagMap, entityTagMap);
|
|
180
226
|
return html;
|
|
181
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* @param {RawDraftContentState} raw
|
|
230
|
+
*/
|
|
231
|
+
|
|
182
232
|
|
|
183
233
|
function convertRawToApiData(raw) {
|
|
184
|
-
|
|
185
|
-
|
|
234
|
+
raw = raw ||
|
|
235
|
+
/** @type {RawDraftContentState} */
|
|
236
|
+
{};
|
|
186
237
|
const blocks = Array.isArray(raw.blocks) ? raw.blocks : [];
|
|
187
238
|
const entityMap = typeof raw.entityMap === 'object' ? raw.entityMap : {};
|
|
188
239
|
|
|
189
|
-
|
|
240
|
+
const entityTagMap = _lodash.default.merge({}, defaultEntityTagMap, {
|
|
190
241
|
[_entities.default.ANNOTATION.type]: [`<span data-entity-type="annotation" data-annotation-body="<%= data.bodyEscapedHTML %>">`, '</span>']
|
|
191
242
|
});
|
|
192
243
|
|
|
193
|
-
apiData = convertBlocksToApiData(blocks, entityMap, entityTagMap);
|
|
244
|
+
const apiData = convertBlocksToApiData(blocks, entityMap, entityTagMap);
|
|
194
245
|
return apiData;
|
|
195
246
|
}
|
|
196
247
|
|