@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.
@@ -38,8 +38,9 @@ function AudioButton(props) {
38
38
  return;
39
39
  }
40
40
 
41
- const contentState = editorState.getCurrentContent();
42
- const contentStateWithEntity = contentState.createEntity('AUDIO', 'IMMUTABLE', {
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, _content2;
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
- const tableData = (_content2 = content) === null || _content2 === void 0 ? void 0 : _content2.tableData;
94
- const rowsJsx = tableData === null || tableData === void 0 ? void 0 : tableData.map((row, rIndex) => {
95
- var _tableStyles$rows;
96
-
97
- const colsJsx = row === null || row === void 0 ? void 0 : row.map((col, cIndex) => {
98
- var _tableStyles$columns, _tableStyles$cells, _tableStyles$cells$rI;
99
-
100
- const colStyle = tableStyles === null || tableStyles === void 0 ? void 0 : (_tableStyles$columns = tableStyles.columns) === null || _tableStyles$columns === void 0 ? void 0 : _tableStyles$columns[cIndex];
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 /*#__PURE__*/_react.default.createElement("tr", {
111
- key: `row_${rIndex}`,
112
- style: tableStyles === null || tableStyles === void 0 ? void 0 : (_tableStyles$rows = tableStyles.rows) === null || _tableStyles$rows === void 0 ? void 0 : _tableStyles$rows[rIndex]
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:
@@ -30,6 +30,9 @@ const ENTITY = {
30
30
  AUDIO: {
31
31
  type: 'AUDIO'
32
32
  },
33
+ ['AUDIO-V2']: {
34
+ type: 'AUDIO-V2'
35
+ },
33
36
  VIDEO: {
34
37
  type: 'VIDEO'
35
38
  },
@@ -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.33",
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.17"
26
+ "@mirrormedia/lilith-draft-renderer": "1.3.0-alpha.26"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "react": "18.2.0",