@comet/admin-rte 8.11.0-canary-20251222063855 → 8.11.0-canary-20251222095546

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.
@@ -1,5 +1,2 @@
1
- /**
2
- * @jest-environment jsdom
3
- */
4
1
  export {};
5
2
  //# sourceMappingURL=htmlToState.spec.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"htmlToState.spec.d.ts","sourceRoot":"","sources":["../../../src/core/translation/htmlToState.spec.ts"],"names":[],"mappings":"AAAA;;GAEG"}
1
+ {"version":3,"file":"htmlToState.spec.d.ts","sourceRoot":"","sources":["../../../src/core/translation/htmlToState.spec.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comet/admin-rte",
3
- "version": "8.11.0-canary-20251222063855",
3
+ "version": "8.11.0-canary-20251222095546",
4
4
  "description": "Comet Admin Rich Text Editor component",
5
5
  "repository": {
6
6
  "directory": "packages/admin/admin-rte",
@@ -20,22 +20,19 @@
20
20
  "draft-js-import-html": "^1.4.1",
21
21
  "draftjs-conductor": "^3.0.0",
22
22
  "immutable": "~3.8.2",
23
- "@comet/admin": "8.11.0-canary-20251222063855",
24
- "@comet/admin-icons": "8.11.0-canary-20251222063855"
23
+ "@comet/admin": "8.11.0-canary-20251222095546",
24
+ "@comet/admin-icons": "8.11.0-canary-20251222095546"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@babel/cli": "^7.28.3",
28
28
  "@babel/core": "^7.28.5",
29
29
  "@mui/material": "^7.3.5",
30
30
  "@types/draft-js": "^0.11.20",
31
- "@types/jest": "^29.5.14",
32
31
  "@types/react": "^18.3.27",
33
32
  "@types/react-dom": "^18.3.7",
34
33
  "draft-js": "^0.11.7",
35
34
  "eslint": "^9.30.1",
36
35
  "final-form": "^4.20.10",
37
- "jest": "^29.7.0",
38
- "jest-junit": "^16.0.0",
39
36
  "npm-run-all2": "^8.0.0",
40
37
  "prettier": "^3.6.2",
41
38
  "react": "^18.3.1",
@@ -43,10 +40,10 @@
43
40
  "react-final-form": "^6.5.9",
44
41
  "react-intl": "^7.1.11",
45
42
  "rimraf": "^6.1.2",
46
- "ts-jest": "^29.4.0",
47
43
  "typescript": "5.9.3",
48
- "@comet/admin-babel-preset": "8.11.0-canary-20251222063855",
49
- "@comet/eslint-config": "8.11.0-canary-20251222063855"
44
+ "vitest": "^4.0.16",
45
+ "@comet/admin-babel-preset": "8.11.0-canary-20251222095546",
46
+ "@comet/eslint-config": "8.11.0-canary-20251222095546"
50
47
  },
51
48
  "peerDependencies": {
52
49
  "@mui/material": "^7.0.0",
@@ -77,7 +74,7 @@
77
74
  "start": "run-p start:babel start:types",
78
75
  "start:babel": "pnpm exec babel ./src -x \".ts,.tsx\" -d lib -w",
79
76
  "start:types": "tsc --project ./tsconfig.json --emitDeclarationOnly --watch --preserveWatchOutput",
80
- "test": "jest",
81
- "test:watch": "jest --watch"
77
+ "test": "vitest --run",
78
+ "test:watch": "vitest --watch"
82
79
  }
83
80
  }
@@ -1,306 +0,0 @@
1
- "use strict";
2
-
3
- var _draftJs = require("draft-js");
4
- var _htmlToState = require("./htmlToState");
5
- var _stateToHtml3 = require("./stateToHtml");
6
- /**
7
- * @jest-environment jsdom
8
- */
9
-
10
- // TODO Remove mock once we've updated the test setup to support ESM modules
11
- jest.mock("../BlockElement", function () {
12
- return {
13
- BlockElement: function BlockElement() {
14
- return null;
15
- }
16
- };
17
- });
18
- describe("htmlToState", function () {
19
- var options = {
20
- customInlineStyles: {
21
- HIGHLIGHT: {
22
- label: "Highlight!",
23
- style: {
24
- backgroundColor: "yellow"
25
- }
26
- }
27
- }
28
- };
29
- it("should convert html to state to html with the html staying the same", function () {
30
- var blocks = [
31
- // Basic stylings
32
- {
33
- key: "52cmg",
34
- text: "Normal Text",
35
- type: "unstyled",
36
- depth: 0,
37
- inlineStyleRanges: [],
38
- entityRanges: [],
39
- data: {}
40
- }, {
41
- key: "8psic",
42
- text: "Bold Text",
43
- type: "unstyled",
44
- depth: 0,
45
- inlineStyleRanges: [{
46
- offset: 0,
47
- length: 9,
48
- style: "BOLD"
49
- }],
50
- entityRanges: [],
51
- data: {}
52
- }, {
53
- key: "4m6ou",
54
- text: "Italic Text",
55
- type: "unstyled",
56
- depth: 0,
57
- inlineStyleRanges: [{
58
- offset: 0,
59
- length: 11,
60
- style: "ITALIC"
61
- }],
62
- entityRanges: [],
63
- data: {}
64
- }, {
65
- key: "fask6",
66
- text: "Bold Italic Text",
67
- type: "unstyled",
68
- depth: 0,
69
- inlineStyleRanges: [{
70
- offset: 0,
71
- length: 16,
72
- style: "ITALIC"
73
- }, {
74
- offset: 0,
75
- length: 16,
76
- style: "BOLD"
77
- }],
78
- entityRanges: [],
79
- data: {}
80
- }, {
81
- key: "fm23u",
82
- text: "Strikethrough Text",
83
- type: "unstyled",
84
- depth: 0,
85
- inlineStyleRanges: [{
86
- offset: 0,
87
- length: 18,
88
- style: "STRIKETHROUGH"
89
- }],
90
- entityRanges: [],
91
- data: {}
92
- }, {
93
- key: "9q8m5",
94
- text: "A Subscript Text",
95
- type: "unstyled",
96
- depth: 0,
97
- inlineStyleRanges: [{
98
- offset: 2,
99
- length: 14,
100
- style: "SUB"
101
- }],
102
- entityRanges: [],
103
- data: {}
104
- }, {
105
- key: "t3nk",
106
- text: "B Superscript Text",
107
- type: "unstyled",
108
- depth: 0,
109
- inlineStyleRanges: [{
110
- offset: 2,
111
- length: 16,
112
- style: "SUP"
113
- }],
114
- entityRanges: [],
115
- data: {}
116
- }, {
117
- key: "e6k04",
118
- text: "Headline 1",
119
- type: "header-one",
120
- depth: 0,
121
- inlineStyleRanges: [],
122
- entityRanges: [],
123
- data: {}
124
- }, {
125
- key: "ect4f",
126
- text: "Headline 2",
127
- type: "header-two",
128
- depth: 0,
129
- inlineStyleRanges: [],
130
- entityRanges: [],
131
- data: {}
132
- }, {
133
- key: "e038j",
134
- text: "Headline 3",
135
- type: "header-three",
136
- depth: 0,
137
- inlineStyleRanges: [],
138
- entityRanges: [],
139
- data: {}
140
- }, {
141
- key: "4bha8",
142
- text: "Headline 4",
143
- type: "header-four",
144
- depth: 0,
145
- inlineStyleRanges: [],
146
- entityRanges: [],
147
- data: {}
148
- }, {
149
- key: "aje6k",
150
- text: "Headline 5",
151
- type: "header-five",
152
- depth: 0,
153
- inlineStyleRanges: [],
154
- entityRanges: [],
155
- data: {}
156
- }, {
157
- key: "7u6on",
158
- text: "Headline 6",
159
- type: "header-six",
160
- depth: 0,
161
- inlineStyleRanges: [],
162
- entityRanges: [],
163
- data: {}
164
- },
165
- // Unordered List
166
- {
167
- key: "a9t3",
168
- text: "Unordered List",
169
- type: "unordered-list-item",
170
- depth: 0,
171
- inlineStyleRanges: [],
172
- entityRanges: [],
173
- data: {}
174
- }, {
175
- key: "f4o2c",
176
- text: "123456",
177
- type: "unordered-list-item",
178
- depth: 1,
179
- inlineStyleRanges: [{
180
- offset: 3,
181
- length: 3,
182
- style: "SUB"
183
- }],
184
- entityRanges: [],
185
- data: {}
186
- }, {
187
- key: "7v61p",
188
- text: "234",
189
- type: "unordered-list-item",
190
- depth: 2,
191
- inlineStyleRanges: [{
192
- offset: 0,
193
- length: 3,
194
- style: "ITALIC"
195
- }],
196
- entityRanges: [],
197
- data: {}
198
- }, {
199
- key: "1duir",
200
- text: "345",
201
- type: "unordered-list-item",
202
- depth: 2,
203
- inlineStyleRanges: [{
204
- offset: 0,
205
- length: 3,
206
- style: "BOLD"
207
- }],
208
- entityRanges: [],
209
- data: {}
210
- },
211
- // Ordered List
212
- {
213
- key: "1iahs",
214
- text: "List",
215
- type: "ordered-list-item",
216
- depth: 0,
217
- inlineStyleRanges: [],
218
- entityRanges: [],
219
- data: {}
220
- }, {
221
- key: "aqjhb",
222
- text: "123456",
223
- type: "ordered-list-item",
224
- depth: 1,
225
- inlineStyleRanges: [{
226
- offset: 3,
227
- length: 3,
228
- style: "SUP"
229
- }],
230
- entityRanges: [],
231
- data: {}
232
- }, {
233
- key: "c4js6",
234
- text: "234",
235
- type: "ordered-list-item",
236
- depth: 2,
237
- inlineStyleRanges: [{
238
- offset: 0,
239
- length: 3,
240
- style: "ITALIC"
241
- }],
242
- entityRanges: [],
243
- data: {}
244
- }, {
245
- key: "3qjfc",
246
- text: "345",
247
- type: "ordered-list-item",
248
- depth: 2,
249
- inlineStyleRanges: [{
250
- offset: 0,
251
- length: 3,
252
- style: "BOLD"
253
- }],
254
- entityRanges: [],
255
- data: {}
256
- },
257
- // Custom Style
258
- {
259
- key: "7l333",
260
- text: "A rte text with custom styling",
261
- type: "unstyled",
262
- depth: 0,
263
- inlineStyleRanges: [{
264
- offset: 0,
265
- length: 30,
266
- style: "HIGHLIGHT"
267
- }],
268
- entityRanges: [],
269
- data: {}
270
- },
271
- // Custom Block Style
272
- {
273
- key: "7l334",
274
- text: "A rte text with custom block styling",
275
- type: "header-custom-green",
276
- depth: 0,
277
- inlineStyleRanges: [],
278
- entityRanges: [],
279
- data: {}
280
- }];
281
- var rawContent = {
282
- entityMap: {},
283
- blocks: blocks
284
- };
285
- var content = (0, _draftJs.convertFromRaw)(rawContent);
286
- var editorState = _draftJs.EditorState.createWithContent(content);
287
- var _stateToHtml = (0, _stateToHtml3.stateToHtml)({
288
- editorState: editorState,
289
- options: options
290
- }),
291
- html = _stateToHtml.html,
292
- entities = _stateToHtml.entities;
293
- var state = (0, _htmlToState.htmlToState)({
294
- html: html,
295
- entities: entities
296
- });
297
- var _stateToHtml2 = (0, _stateToHtml3.stateToHtml)({
298
- editorState: state,
299
- options: options
300
- }),
301
- html2 = _stateToHtml2.html,
302
- linkDataList2 = _stateToHtml2.entities;
303
- expect(html).toEqual(html2);
304
- expect(entities).toEqual(linkDataList2);
305
- });
306
- });
@@ -1,498 +0,0 @@
1
- "use strict";
2
-
3
- var _draftJs = require("draft-js");
4
- var _stateToHtml7 = require("./stateToHtml");
5
- // Remove all newlines and spaces to compare the html strings
6
- function trimHtml(html) {
7
- return html.replace(/\s|\n/g, "");
8
- }
9
-
10
- // TODO Remove mock once we've updated the test setup to support ESM modules
11
- jest.mock("../BlockElement", function () {
12
- return {
13
- BlockElement: function BlockElement() {
14
- return null;
15
- }
16
- };
17
- });
18
- describe("stateToHtml", function () {
19
- var options = {
20
- customInlineStyles: {
21
- HIGHLIGHT: {
22
- label: "Highlight!",
23
- style: {
24
- backgroundColor: "yellow"
25
- }
26
- }
27
- },
28
- blocktypeMap: {
29
- "header-custom-green": {
30
- label: "Header Custom Green",
31
- renderConfig: {
32
- element: "p"
33
- }
34
- }
35
- }
36
- };
37
- it("should convert the rte editor state with styling into html while keeping the format via tags - formats part 1", function () {
38
- var blocks = [{
39
- key: "52cmg",
40
- text: "Normal Text",
41
- type: "unstyled",
42
- depth: 0,
43
- inlineStyleRanges: [],
44
- entityRanges: [],
45
- data: {}
46
- }, {
47
- key: "8psic",
48
- text: "Bold Text",
49
- type: "unstyled",
50
- depth: 0,
51
- inlineStyleRanges: [{
52
- offset: 0,
53
- length: 9,
54
- style: "BOLD"
55
- }],
56
- entityRanges: [],
57
- data: {}
58
- }, {
59
- key: "4m6ou",
60
- text: "Italic Text",
61
- type: "unstyled",
62
- depth: 0,
63
- inlineStyleRanges: [{
64
- offset: 0,
65
- length: 11,
66
- style: "ITALIC"
67
- }],
68
- entityRanges: [],
69
- data: {}
70
- }, {
71
- key: "fask6",
72
- text: "Bold Italic Text",
73
- type: "unstyled",
74
- depth: 0,
75
- inlineStyleRanges: [{
76
- offset: 0,
77
- length: 16,
78
- style: "ITALIC"
79
- }, {
80
- offset: 0,
81
- length: 16,
82
- style: "BOLD"
83
- }],
84
- entityRanges: [],
85
- data: {}
86
- }, {
87
- key: "fm23u",
88
- text: "Strikethrough Text",
89
- type: "unstyled",
90
- depth: 0,
91
- inlineStyleRanges: [{
92
- offset: 0,
93
- length: 18,
94
- style: "STRIKETHROUGH"
95
- }],
96
- entityRanges: [],
97
- data: {}
98
- }, {
99
- key: "9q8m5",
100
- text: "A Subscript Text",
101
- type: "unstyled",
102
- depth: 0,
103
- inlineStyleRanges: [{
104
- offset: 2,
105
- length: 14,
106
- style: "SUB"
107
- }],
108
- entityRanges: [],
109
- data: {}
110
- }, {
111
- key: "t3nk",
112
- text: "B Superscript Text",
113
- type: "unstyled",
114
- depth: 0,
115
- inlineStyleRanges: [{
116
- offset: 2,
117
- length: 16,
118
- style: "SUP"
119
- }],
120
- entityRanges: [],
121
- data: {}
122
- }, {
123
- key: "e6k04",
124
- text: "Headline 1",
125
- type: "header-one",
126
- depth: 0,
127
- inlineStyleRanges: [],
128
- entityRanges: [],
129
- data: {}
130
- }, {
131
- key: "ect4f",
132
- text: "Headline 2",
133
- type: "header-two",
134
- depth: 0,
135
- inlineStyleRanges: [],
136
- entityRanges: [],
137
- data: {}
138
- }, {
139
- key: "e038j",
140
- text: "Headline 3",
141
- type: "header-three",
142
- depth: 0,
143
- inlineStyleRanges: [],
144
- entityRanges: [],
145
- data: {}
146
- }, {
147
- key: "4bha8",
148
- text: "Headline 4",
149
- type: "header-four",
150
- depth: 0,
151
- inlineStyleRanges: [],
152
- entityRanges: [],
153
- data: {}
154
- }, {
155
- key: "aje6k",
156
- text: "Headline 5",
157
- type: "header-five",
158
- depth: 0,
159
- inlineStyleRanges: [],
160
- entityRanges: [],
161
- data: {}
162
- }, {
163
- key: "7u6on",
164
- text: "Headline 6",
165
- type: "header-six",
166
- depth: 0,
167
- inlineStyleRanges: [],
168
- entityRanges: [],
169
- data: {}
170
- }];
171
- var rawContent = {
172
- entityMap: {},
173
- blocks: blocks
174
- };
175
- var content = (0, _draftJs.convertFromRaw)(rawContent);
176
- var editorState = _draftJs.EditorState.createWithContent(content);
177
- var _stateToHtml = (0, _stateToHtml7.stateToHtml)({
178
- editorState: editorState,
179
- options: options
180
- }),
181
- html = _stateToHtml.html;
182
- var expectedHtml = "<p>Normal Text</p><p><strong>Bold Text</strong></p><p><em>Italic Text</em></p><p><em><strong>Bold Italic Text</strong></em></p><p><del>Strikethrough Text</del></p><p>A <sub>Subscript Text</sub></p><p>B <sup>Superscript Text</sup></p><h1>Headline 1</h1><h2>Headline 2</h2><h3>Headline 3</h3><h4>Headline 4</h4><h5>Headline 5</h5><h6>Headline 6</h6>";
183
- expect(trimHtml(html)).toEqual(trimHtml(expectedHtml));
184
- });
185
- it("should convert the rte editor state with formating into html while keeping the format via tags - formats part 2 (unordered list)", function () {
186
- var blocks = [{
187
- key: "a9t3",
188
- text: "Unordered List",
189
- type: "unordered-list-item",
190
- depth: 0,
191
- inlineStyleRanges: [],
192
- entityRanges: [],
193
- data: {}
194
- }, {
195
- key: "f4o2c",
196
- text: "123456",
197
- type: "unordered-list-item",
198
- depth: 1,
199
- inlineStyleRanges: [{
200
- offset: 3,
201
- length: 3,
202
- style: "SUB"
203
- }],
204
- entityRanges: [],
205
- data: {}
206
- }, {
207
- key: "7v61p",
208
- text: "234",
209
- type: "unordered-list-item",
210
- depth: 2,
211
- inlineStyleRanges: [{
212
- offset: 0,
213
- length: 3,
214
- style: "ITALIC"
215
- }],
216
- entityRanges: [],
217
- data: {}
218
- }, {
219
- key: "1duir",
220
- text: "345",
221
- type: "unordered-list-item",
222
- depth: 2,
223
- inlineStyleRanges: [{
224
- offset: 0,
225
- length: 3,
226
- style: "BOLD"
227
- }],
228
- entityRanges: [],
229
- data: {}
230
- }];
231
- var rawContent = {
232
- entityMap: {},
233
- blocks: blocks
234
- };
235
- var content = (0, _draftJs.convertFromRaw)(rawContent);
236
- var editorState = _draftJs.EditorState.createWithContent(content);
237
- var _stateToHtml2 = (0, _stateToHtml7.stateToHtml)({
238
- editorState: editorState,
239
- options: options
240
- }),
241
- html = _stateToHtml2.html;
242
- var expectedHtml = "<ul><li>Unordered List<ul><li>123<sub>456</sub><ul><li><em>234</em></li><li><strong>345</strong></li></ul></li></ul></li></ul>";
243
- expect(trimHtml(html)).toEqual(trimHtml(expectedHtml));
244
- });
245
- it("should convert the rte editor state with formating into html while keeping the format via tags - formats part 3 (ordered list)", function () {
246
- var blocks = [{
247
- key: "1iahs",
248
- text: "List",
249
- type: "ordered-list-item",
250
- depth: 0,
251
- inlineStyleRanges: [],
252
- entityRanges: [],
253
- data: {}
254
- }, {
255
- key: "aqjhb",
256
- text: "123456",
257
- type: "ordered-list-item",
258
- depth: 1,
259
- inlineStyleRanges: [{
260
- offset: 3,
261
- length: 3,
262
- style: "SUP"
263
- }],
264
- entityRanges: [],
265
- data: {}
266
- }, {
267
- key: "c4js6",
268
- text: "234",
269
- type: "ordered-list-item",
270
- depth: 2,
271
- inlineStyleRanges: [{
272
- offset: 0,
273
- length: 3,
274
- style: "ITALIC"
275
- }],
276
- entityRanges: [],
277
- data: {}
278
- }, {
279
- key: "3qjfc",
280
- text: "345",
281
- type: "ordered-list-item",
282
- depth: 2,
283
- inlineStyleRanges: [{
284
- offset: 0,
285
- length: 3,
286
- style: "BOLD"
287
- }],
288
- entityRanges: [],
289
- data: {}
290
- }];
291
- var rawContent = {
292
- entityMap: {},
293
- blocks: blocks
294
- };
295
- var content = (0, _draftJs.convertFromRaw)(rawContent);
296
- var editorState = _draftJs.EditorState.createWithContent(content);
297
- var _stateToHtml3 = (0, _stateToHtml7.stateToHtml)({
298
- editorState: editorState,
299
- options: options
300
- }),
301
- html = _stateToHtml3.html;
302
- var expectedHtml = "<ol><li>List<ol><li>123<sup>456</sup><ol><li><em>234</em></li><li><strong>345</strong></li></ol></li></ol></li></ol>";
303
- expect(trimHtml(html)).toEqual(trimHtml(expectedHtml));
304
- });
305
- it("should convert the rte editor state with formating into html while keeping the format via tags - formats part 4 (links)", function () {
306
- var entityMap = {
307
- "0": {
308
- type: "LINK",
309
- mutability: "MUTABLE",
310
- data: {
311
- activeType: "external",
312
- attachedBlocks: [{
313
- type: "external",
314
- props: {
315
- targetUrl: "https://www.vivid-planet.com/",
316
- openInNewWindow: false
317
- }
318
- }]
319
- }
320
- },
321
- "1": {
322
- type: "LINK",
323
- mutability: "MUTABLE",
324
- data: {
325
- activeType: "internal",
326
- attachedBlocks: [{
327
- type: "internal",
328
- props: {
329
- targetPage: {
330
- id: "5aab378c-7a8f-4442-aa33-4aff950d0233",
331
- name: "RTE Save",
332
- path: "/rte-save",
333
- documentType: "Page"
334
- }
335
- }
336
- }]
337
- }
338
- },
339
- "2": {
340
- type: "LINK",
341
- mutability: "MUTABLE",
342
- data: {
343
- activeType: "news",
344
- attachedBlocks: [{
345
- type: "news",
346
- props: {
347
- id: "3d90dd58-f880-4fd8-a4b8-9ff690655a5b"
348
- }
349
- }]
350
- }
351
- }
352
- };
353
- var blocks = [{
354
- key: "b40ve",
355
- text: "External Link",
356
- type: "unstyled",
357
- depth: 0,
358
- inlineStyleRanges: [],
359
- entityRanges: [{
360
- offset: 0,
361
- length: 13,
362
- key: 0
363
- }],
364
- data: {}
365
- }, {
366
- key: "67hve",
367
- text: "Internal Link",
368
- type: "unstyled",
369
- depth: 0,
370
- inlineStyleRanges: [],
371
- entityRanges: [{
372
- offset: 0,
373
- length: 13,
374
- key: 1
375
- }],
376
- data: {}
377
- }, {
378
- key: "8mn26",
379
- text: "Internal News Link",
380
- type: "unstyled",
381
- depth: 0,
382
- inlineStyleRanges: [],
383
- entityRanges: [{
384
- offset: 0,
385
- length: 18,
386
- key: 2
387
- }],
388
- data: {}
389
- }];
390
- var rawContent = {
391
- entityMap: entityMap,
392
- blocks: blocks
393
- };
394
- var content = (0, _draftJs.convertFromRaw)(rawContent);
395
- var editorState = _draftJs.EditorState.createWithContent(content);
396
- var _stateToHtml4 = (0, _stateToHtml7.stateToHtml)({
397
- editorState: editorState,
398
- options: options
399
- }),
400
- html = _stateToHtml4.html,
401
- entities = _stateToHtml4.entities;
402
- var expectedHtml = "<p><a id=\"0\">External Link</a></p><p><a id=\"1\">Internal Link</a></p><p><a id=\"2\">Internal News Link</a></p>";
403
- expect(trimHtml(html)).toEqual(trimHtml(expectedHtml));
404
- var expectedLinkDataList = [{
405
- id: "0",
406
- data: {
407
- activeType: "external",
408
- attachedBlocks: [{
409
- type: "external",
410
- props: {
411
- targetUrl: "https://www.vivid-planet.com/",
412
- openInNewWindow: false
413
- }
414
- }]
415
- }
416
- }, {
417
- id: "1",
418
- data: {
419
- activeType: "internal",
420
- attachedBlocks: [{
421
- type: "internal",
422
- props: {
423
- targetPage: {
424
- id: "5aab378c-7a8f-4442-aa33-4aff950d0233",
425
- name: "RTE Save",
426
- path: "/rte-save",
427
- documentType: "Page"
428
- }
429
- }
430
- }]
431
- }
432
- }, {
433
- id: "2",
434
- data: {
435
- activeType: "news",
436
- attachedBlocks: [{
437
- type: "news",
438
- props: {
439
- id: "3d90dd58-f880-4fd8-a4b8-9ff690655a5b"
440
- }
441
- }]
442
- }
443
- }];
444
- expect(entities).toEqual(expectedLinkDataList);
445
- });
446
- it("should convert the rte editor state with formating into html while keeping the format via tags - formats part 5 (custom styles)", function () {
447
- var blocks = [{
448
- key: "7l333",
449
- text: "A rte text with custom styling",
450
- type: "unstyled",
451
- depth: 0,
452
- inlineStyleRanges: [{
453
- offset: 0,
454
- length: 30,
455
- style: "HIGHLIGHT"
456
- }],
457
- entityRanges: [],
458
- data: {}
459
- }];
460
- var rawContent = {
461
- entityMap: {},
462
- blocks: blocks
463
- };
464
- var content = (0, _draftJs.convertFromRaw)(rawContent);
465
- var editorState = _draftJs.EditorState.createWithContent(content);
466
- var _stateToHtml5 = (0, _stateToHtml7.stateToHtml)({
467
- editorState: editorState,
468
- options: options
469
- }),
470
- html = _stateToHtml5.html;
471
- var expectedHtml = "<p><span class=\"HIGHLIGHT\">A rte text with custom styling</span></p>";
472
- expect(trimHtml(html)).toEqual(trimHtml(expectedHtml));
473
- });
474
- it("should convert the rte editor state with formating into html while keeping the format via tags - formats part 6 (custom block styles)", function () {
475
- var blocks = [{
476
- key: "7l334",
477
- text: "A rte text with custom block styling",
478
- type: "header-custom-green",
479
- depth: 0,
480
- inlineStyleRanges: [],
481
- entityRanges: [],
482
- data: {}
483
- }];
484
- var rawContent = {
485
- entityMap: {},
486
- blocks: blocks
487
- };
488
- var content = (0, _draftJs.convertFromRaw)(rawContent);
489
- var editorState = _draftJs.EditorState.createWithContent(content);
490
- var _stateToHtml6 = (0, _stateToHtml7.stateToHtml)({
491
- editorState: editorState,
492
- options: options
493
- }),
494
- html = _stateToHtml6.html;
495
- var expectedHtml = "<p class=\"header-custom-green\">A rte text with custom block styling</p>";
496
- expect(trimHtml(html)).toEqual(trimHtml(expectedHtml));
497
- });
498
- });