@mirrormedia/lilith-draft-editor 1.1.0-alpha.33 → 1.1.0-alpha.35
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/draft-js/buttons/audio.js +3 -2
- package/lib/draft-js/draft-converter/atomic-block-processor.js +14 -36
- package/lib/draft-js/draft-converter/entities.js +3 -0
- package/lib/website/mirrormedia/block-renderer-fn.js +6 -0
- package/lib/website/mirrormedia/selector/audio-selector.js +0 -5
- package/package.json +2 -2
|
@@ -38,8 +38,9 @@ function AudioButton(props) {
|
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
const contentState = editorState.getCurrentContent();
|
|
42
|
-
|
|
41
|
+
const contentState = editorState.getCurrentContent(); // since 202310, only AUDIO-V2 will be created
|
|
42
|
+
|
|
43
|
+
const contentStateWithEntity = contentState.createEntity('AUDIO-V2', 'IMMUTABLE', {
|
|
43
44
|
audio
|
|
44
45
|
});
|
|
45
46
|
const entityKey = contentStateWithEntity.getLastCreatedEntityKey();
|
|
@@ -7,14 +7,10 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
9
9
|
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
10
|
var _apiDataInstance = _interopRequireDefault(require("./api-data-instance"));
|
|
13
11
|
|
|
14
12
|
var _entities = _interopRequireDefault(require("./entities"));
|
|
15
13
|
|
|
16
|
-
var _server = _interopRequireDefault(require("react-dom/server"));
|
|
17
|
-
|
|
18
14
|
var _draftJs = require("draft-js");
|
|
19
15
|
|
|
20
16
|
var _draftConvert = require("draft-convert");
|
|
@@ -80,44 +76,25 @@ const processor = {
|
|
|
80
76
|
|
|
81
77
|
case _entities.default.TABLE.type:
|
|
82
78
|
{
|
|
83
|
-
var _content
|
|
79
|
+
var _content;
|
|
84
80
|
|
|
85
81
|
// About TABLE atomic block entity data structure,
|
|
86
82
|
// see `../views/editor/table.tsx` for more information.
|
|
87
83
|
content = entity === null || entity === void 0 ? void 0 : entity.data;
|
|
88
|
-
/** @type DraftEditor.TableEntity.TableStyles */
|
|
89
|
-
|
|
90
|
-
const tableStyles = (_content = content) === null || _content === void 0 ? void 0 : _content.tableStyles;
|
|
91
84
|
/** @type DraftEditor.TableEntity.TableData */
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const cellStyle = tableStyles === null || tableStyles === void 0 ? void 0 : (_tableStyles$cells = tableStyles.cells) === null || _tableStyles$cells === void 0 ? void 0 : (_tableStyles$cells$rI = _tableStyles$cells[rIndex]) === null || _tableStyles$cells$rI === void 0 ? void 0 : _tableStyles$cells$rI[cIndex];
|
|
102
|
-
return /*#__PURE__*/_react.default.createElement("td", {
|
|
103
|
-
key: `col_${cIndex}`,
|
|
104
|
-
style: Object.assign({}, colStyle, cellStyle),
|
|
105
|
-
dangerouslySetInnerHTML: {
|
|
106
|
-
__html: (0, _draftConvert.convertToHTML)((0, _draftJs.convertFromRaw)(col))
|
|
107
|
-
}
|
|
108
|
-
});
|
|
85
|
+
// since apiData is now only for app,
|
|
86
|
+
// keep the rows data structure for app to style the table
|
|
87
|
+
|
|
88
|
+
const tableData = (_content = content) === null || _content === void 0 ? void 0 : _content.tableData;
|
|
89
|
+
const rows = tableData === null || tableData === void 0 ? void 0 : tableData.map(row => {
|
|
90
|
+
const cols = row === null || row === void 0 ? void 0 : row.map(col => {
|
|
91
|
+
return {
|
|
92
|
+
html: (0, _draftConvert.convertToHTML)((0, _draftJs.convertFromRaw)(col))
|
|
93
|
+
};
|
|
109
94
|
});
|
|
110
|
-
return
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}, colsJsx);
|
|
114
|
-
}); // Use `React.renderToStsaticMarkup` to generate plain HTML string
|
|
115
|
-
|
|
116
|
-
const html = _server.default.renderToStaticMarkup( /*#__PURE__*/_react.default.createElement("table", null, /*#__PURE__*/_react.default.createElement("tbody", null, rowsJsx)));
|
|
117
|
-
|
|
118
|
-
content = [{
|
|
119
|
-
html
|
|
120
|
-
}];
|
|
95
|
+
return cols;
|
|
96
|
+
});
|
|
97
|
+
content = rows;
|
|
121
98
|
break;
|
|
122
99
|
}
|
|
123
100
|
|
|
@@ -135,6 +112,7 @@ const processor = {
|
|
|
135
112
|
break;
|
|
136
113
|
|
|
137
114
|
case _entities.default.AUDIO.type:
|
|
115
|
+
case _entities.default['AUDIO-V2'].type:
|
|
138
116
|
case _entities.default.IMAGE.type:
|
|
139
117
|
case _entities.default.IMAGEDIFF.type:
|
|
140
118
|
case _entities.default.SLIDESHOW.type:
|
|
@@ -34,6 +34,7 @@ const {
|
|
|
34
34
|
VideoBlock,
|
|
35
35
|
VideoBlockV2,
|
|
36
36
|
AudioBlock,
|
|
37
|
+
AudioBlockV2,
|
|
37
38
|
YoutubeBlock
|
|
38
39
|
} = _mirrormedia.default.blockRenderers;
|
|
39
40
|
|
|
@@ -124,6 +125,11 @@ const AtomicBlock = props => {
|
|
|
124
125
|
return AudioBlock(entity);
|
|
125
126
|
}
|
|
126
127
|
|
|
128
|
+
case 'AUDIO-V2':
|
|
129
|
+
{
|
|
130
|
+
return AudioBlockV2(entity);
|
|
131
|
+
}
|
|
132
|
+
|
|
127
133
|
case 'YOUTUBE':
|
|
128
134
|
{
|
|
129
135
|
return YoutubeBlock(entity);
|
|
@@ -102,8 +102,6 @@ function AudioGrid(props) {
|
|
|
102
102
|
}) : null), /*#__PURE__*/_react.default.createElement(Audio, {
|
|
103
103
|
controls: true
|
|
104
104
|
}, /*#__PURE__*/_react.default.createElement("source", {
|
|
105
|
-
src: audio === null || audio === void 0 ? void 0 : audio.urlOriginal
|
|
106
|
-
}), /*#__PURE__*/_react.default.createElement("source", {
|
|
107
105
|
src: audio === null || audio === void 0 ? void 0 : audio.audioSrc
|
|
108
106
|
}), /*#__PURE__*/_react.default.createElement("source", {
|
|
109
107
|
src: audio === null || audio === void 0 ? void 0 : (_audio$file = audio.file) === null || _audio$file === void 0 ? void 0 : _audio$file.url
|
|
@@ -136,8 +134,6 @@ function AudioMetaGrid(props) {
|
|
|
136
134
|
return /*#__PURE__*/_react.default.createElement(AudioMetaGridWrapper, null, /*#__PURE__*/_react.default.createElement(Audio, {
|
|
137
135
|
controls: true
|
|
138
136
|
}, /*#__PURE__*/_react.default.createElement("source", {
|
|
139
|
-
src: audio === null || audio === void 0 ? void 0 : audio.urlOriginal
|
|
140
|
-
}), /*#__PURE__*/_react.default.createElement("source", {
|
|
141
137
|
src: audio === null || audio === void 0 ? void 0 : audio.audioSrc
|
|
142
138
|
}), /*#__PURE__*/_react.default.createElement("source", {
|
|
143
139
|
src: audio === null || audio === void 0 ? void 0 : (_audio$file2 = audio.file) === null || _audio$file2 === void 0 ? void 0 : _audio$file2.url
|
|
@@ -155,7 +151,6 @@ const AudiosQuery = (0, _apollo.gql)`
|
|
|
155
151
|
) {
|
|
156
152
|
id
|
|
157
153
|
name
|
|
158
|
-
urlOriginal
|
|
159
154
|
audioSrc
|
|
160
155
|
file {
|
|
161
156
|
url
|
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.35",
|
|
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.3.0-alpha.
|
|
26
|
+
"@mirrormedia/lilith-draft-renderer": "1.3.0-alpha.26"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"react": "18.2.0",
|