@zipify/wysiwyg 1.0.0-dev.1 → 1.0.0-dev.12

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.
Files changed (100) hide show
  1. package/.env.example +1 -0
  2. package/.eslintignore +1 -0
  3. package/.release-it.json +9 -0
  4. package/.stylelintignore +1 -0
  5. package/README.md +131 -11
  6. package/config/jest/setupTests.js +7 -1
  7. package/config/webpack/example.config.js +2 -0
  8. package/config/webpack/lib.config.js +44 -0
  9. package/config/webpack/loaders/style-loader.js +3 -1
  10. package/config/webpack/loaders/svg-loader.js +1 -1
  11. package/dist/wysiwyg.css +837 -0
  12. package/dist/wysiwyg.js +2 -0
  13. package/dist/wysiwyg.js.LICENSE.txt +1 -0
  14. package/example/ExampleApp.vue +47 -32
  15. package/example/example.js +26 -0
  16. package/example/presets.js +2 -0
  17. package/lib/Wysiwyg.vue +17 -17
  18. package/lib/assets/icons/alignment-center.svg +3 -0
  19. package/lib/assets/icons/alignment-justify.svg +3 -0
  20. package/lib/assets/icons/alignment-left.svg +3 -0
  21. package/lib/assets/icons/alignment-right.svg +3 -0
  22. package/lib/assets/icons/arrow.svg +3 -0
  23. package/lib/assets/icons/background-color.svg +3 -0
  24. package/lib/assets/icons/case-style.svg +3 -0
  25. package/lib/assets/icons/font-color.svg +5 -0
  26. package/lib/assets/icons/italic.svg +3 -0
  27. package/lib/assets/icons/line-height.svg +3 -0
  28. package/lib/assets/icons/list-circle.svg +3 -0
  29. package/lib/assets/icons/list-decimal.svg +3 -0
  30. package/lib/assets/icons/list-disc.svg +3 -0
  31. package/lib/assets/icons/list-latin.svg +3 -0
  32. package/lib/assets/icons/list-roman.svg +3 -0
  33. package/lib/assets/icons/list-square.svg +3 -0
  34. package/lib/assets/icons/remove-format.svg +3 -0
  35. package/lib/assets/icons/reset-styles.svg +3 -0
  36. package/lib/assets/icons/strike-through.svg +3 -0
  37. package/lib/assets/icons/superscript.svg +3 -0
  38. package/lib/assets/icons/underline.svg +3 -0
  39. package/lib/components/base/Icon.vue +17 -9
  40. package/lib/components/base/__tests__/Icon.test.js +6 -13
  41. package/lib/components/toolbar/Toolbar.vue +1 -1
  42. package/lib/components/toolbar/controls/ListControl.vue +1 -5
  43. package/lib/composables/__tests__/useEditor.test.js +12 -3
  44. package/lib/composables/useEditor.js +13 -7
  45. package/lib/composables/useToolbar.js +7 -18
  46. package/lib/extensions/Alignment.js +6 -0
  47. package/lib/extensions/BackgroundColor.js +8 -1
  48. package/lib/extensions/FontColor.js +8 -1
  49. package/lib/extensions/FontFamily.js +7 -0
  50. package/lib/extensions/FontSize.js +12 -0
  51. package/lib/extensions/FontStyle.js +11 -0
  52. package/lib/extensions/FontWeight.js +25 -1
  53. package/lib/extensions/LineHeight.js +17 -0
  54. package/lib/extensions/StylePreset.js +30 -3
  55. package/lib/extensions/TextDecoration.js +11 -0
  56. package/lib/extensions/__tests__/Alignment.test.js +22 -1
  57. package/lib/extensions/__tests__/BackgroundColor.test.js +30 -1
  58. package/lib/extensions/__tests__/CaseStyle.test.js +4 -1
  59. package/lib/extensions/__tests__/FontColor.test.js +30 -1
  60. package/lib/extensions/__tests__/FontFamily.test.js +30 -1
  61. package/lib/extensions/__tests__/FontSize.test.js +30 -1
  62. package/lib/extensions/__tests__/FontStyle.test.js +38 -1
  63. package/lib/extensions/__tests__/FontWeight.test.js +58 -1
  64. package/lib/extensions/__tests__/LineHeight.test.js +41 -1
  65. package/lib/extensions/__tests__/StylePreset.test.js +76 -1
  66. package/lib/extensions/__tests__/TextDecoration.test.js +63 -1
  67. package/lib/extensions/__tests__/__snapshots__/Alignment.test.js.snap +44 -0
  68. package/lib/extensions/__tests__/__snapshots__/BackgroundColor.test.js.snap +91 -0
  69. package/lib/extensions/__tests__/__snapshots__/FontColor.test.js.snap +91 -0
  70. package/lib/extensions/__tests__/__snapshots__/FontFamily.test.js.snap +91 -0
  71. package/lib/extensions/__tests__/__snapshots__/FontSize.test.js.snap +99 -0
  72. package/lib/extensions/__tests__/__snapshots__/FontStyle.test.js.snap +120 -0
  73. package/lib/extensions/__tests__/__snapshots__/FontWeight.test.js.snap +149 -0
  74. package/lib/extensions/__tests__/__snapshots__/LineHeight.test.js.snap +92 -0
  75. package/lib/extensions/__tests__/__snapshots__/StylePreset.test.js.snap +167 -2
  76. package/lib/extensions/__tests__/__snapshots__/TextDecoration.test.js.snap +207 -0
  77. package/lib/extensions/core/__tests__/NodeProcessor.test.js +4 -1
  78. package/lib/extensions/core/__tests__/SelectionProcessor.test.js +9 -4
  79. package/lib/extensions/core/__tests__/TextProcessor.test.js +4 -1
  80. package/lib/extensions/index.js +1 -0
  81. package/lib/extensions/list/List.js +34 -0
  82. package/lib/extensions/list/__tests__/List.test.js +115 -3
  83. package/lib/extensions/list/__tests__/__snapshots__/List.test.js.snap +457 -6
  84. package/lib/services/ContentNormalizer.js +113 -0
  85. package/lib/services/Storage.js +1 -13
  86. package/lib/services/__tests__/ContentNormalizer.test.js +41 -0
  87. package/lib/services/__tests__/FavoriteColors.test.js +20 -0
  88. package/lib/services/__tests__/JsonSerializer.test.js +23 -0
  89. package/lib/services/__tests__/Storage.test.js +79 -0
  90. package/lib/services/index.js +1 -0
  91. package/lib/utils/__tests__/convertColor.test.js +19 -0
  92. package/lib/utils/__tests__/createKeyboardShortcut.test.js +25 -0
  93. package/lib/utils/__tests__/renderInlineSetting.test.js +26 -0
  94. package/lib/utils/convertColor.js +7 -0
  95. package/lib/utils/importIcon.js +12 -0
  96. package/lib/utils/index.js +2 -0
  97. package/lib/utils/renderInlineSetting.js +1 -1
  98. package/package.json +10 -6
  99. package/lib/assets/icons.svg +0 -69
  100. package/lib/composables/__tests__/useToolbar.test.js +0 -56
@@ -5,6 +5,7 @@ import { createCommand } from '../../utils';
5
5
  import { CORE_EXTENSIONS } from '../core';
6
6
  import { DeviceManager } from '../DeviceManager';
7
7
  import { LineHeight } from '../LineHeight';
8
+ import { ContentNormalizer } from '../../services';
8
9
 
9
10
  const MockStylePreset = Extension.create({
10
11
  name: 'style_preset',
@@ -21,8 +22,10 @@ const MockStylePreset = Extension.create({
21
22
  });
22
23
 
23
24
  function createEditor({ content }) {
25
+ const normalizer = new ContentNormalizer();
26
+
24
27
  return new Editor({
25
- content,
28
+ content: normalizer.normalize(content),
26
29
  extensions: CORE_EXTENSIONS.concat(
27
30
  MockStylePreset,
28
31
  DeviceManager.configure({ deviceRef: ref('desktop') }),
@@ -104,3 +107,40 @@ describe('rendering', () => {
104
107
  expect(editor.getHTML()).toMatchSnapshot();
105
108
  });
106
109
  });
110
+
111
+ describe('parsing html', () => {
112
+ test('should get value from text in relative units', () => {
113
+ const editor = createEditor({
114
+ content: '<p style="line-height: 1.2">test</p>'
115
+ });
116
+
117
+ expect(editor.getJSON()).toMatchSnapshot();
118
+ });
119
+
120
+ test('should get value from text in px units with font size', () => {
121
+ const editor = createEditor({
122
+ content: '<p style="line-height: 24px; font-size: 20px;">test</p>'
123
+ });
124
+
125
+ expect(editor.getJSON()).toMatchSnapshot();
126
+ });
127
+
128
+ test('should get value from text in px units with no font size', () => {
129
+ global.document.body.style.fontSize = '20px';
130
+
131
+ const editor = createEditor({
132
+ content: '<p style="line-height: 24px">test</p>'
133
+ });
134
+
135
+ expect(editor.getJSON()).toMatchSnapshot();
136
+ global.document.body.style.removeProperty('font-size');
137
+ });
138
+
139
+ test('should set null if no alignment', () => {
140
+ const editor = createEditor({
141
+ content: '<p>test</p>'
142
+ });
143
+
144
+ expect(editor.getJSON()).toMatchSnapshot();
145
+ });
146
+ });
@@ -5,6 +5,7 @@ import { CORE_EXTENSIONS } from '../core';
5
5
  import { StylePreset } from '../StylePreset';
6
6
  import { List } from '../list';
7
7
  import { ListTypes, NodeTypes, TextSettings } from '../../enums';
8
+ import { ContentNormalizer } from '../../services';
8
9
 
9
10
  const MockFontSize = Mark.create({
10
11
  name: TextSettings.FONT_SIZE,
@@ -44,13 +45,16 @@ const MockAlignment = Extension.create({
44
45
 
45
46
  function createEditor({ content, presets, defaultId }) {
46
47
  return new Promise((resolve) => {
48
+ const normalizer = new ContentNormalizer();
49
+
47
50
  const editor = new Editor({
48
- content,
51
+ content: normalizer.normalize(content),
49
52
  onCreate: () => resolve(editor),
50
53
 
51
54
  extensions: CORE_EXTENSIONS.concat(
52
55
  StylePreset.configure({
53
56
  presetsRef: ref(presets),
57
+ baseClass: 'zw ts-',
54
58
  defaultId,
55
59
 
56
60
  makeVariable({ device, preset, property }) {
@@ -398,3 +402,74 @@ describe('remove preset customization', () => {
398
402
  );
399
403
  });
400
404
  });
405
+
406
+ describe('parsing html', () => {
407
+ test('should get by fallback class', async () => {
408
+ const editor = await createEditor({
409
+ content: '<p class="zpa-regular2">lorem ipsum</p>',
410
+ defaultId: 'regular-1',
411
+ presets: [
412
+ createPreset({ id: 'regular-1' }),
413
+ createPreset({ id: 'regular-2', fallbackClass: 'zpa-regular2' })
414
+ ]
415
+ });
416
+
417
+ expect(editor.getJSON()).toMatchSnapshot();
418
+ });
419
+
420
+ test('should get by preset class', async () => {
421
+ const editor = await createEditor({
422
+ content: '<p class="zw ts-regular-2">lorem ipsum</p>',
423
+ defaultId: 'regular-1',
424
+ presets: [
425
+ createPreset({ id: 'regular-1' }),
426
+ createPreset({ id: 'regular-2' })
427
+ ]
428
+ });
429
+
430
+ expect(editor.getJSON()).toMatchSnapshot();
431
+ });
432
+
433
+ test('should get by heading tag', async () => {
434
+ const editor = await createEditor({
435
+ content: '<h3>lorem ipsum</h3>',
436
+ defaultId: 'regular-1',
437
+ presets: [
438
+ createPreset({ id: 'regular-1' }),
439
+ createPreset({ id: 'h3', node: { type: 'heading', level: 3 } })
440
+ ]
441
+ });
442
+
443
+ expect(editor.getJSON()).toMatchSnapshot();
444
+ });
445
+
446
+ test('should set default preset to unstyled paragraph', async () => {
447
+ const editor = await createEditor({
448
+ content: '<p>lorem ipsum</p>',
449
+ defaultId: 'regular-1',
450
+ presets: [createPreset({ id: 'regular-1' })]
451
+ });
452
+
453
+ expect(editor.getJSON()).toMatchSnapshot();
454
+ });
455
+
456
+ test('should set null to list item', async () => {
457
+ const editor = await createEditor({
458
+ content: '<ul><li>lorem ipsum</li></ul>',
459
+ defaultId: 'regular-1',
460
+ presets: [createPreset({ id: 'regular-1' })]
461
+ });
462
+
463
+ expect(editor.getJSON()).toMatchSnapshot();
464
+ });
465
+
466
+ test('should set null to list item with preset', async () => {
467
+ const editor = await createEditor({
468
+ content: '<ul class="zw regular-1"><li>lorem ipsum</li></ul>',
469
+ defaultId: 'regular-1',
470
+ presets: [createPreset({ id: 'regular-1' })]
471
+ });
472
+
473
+ expect(editor.getJSON()).toMatchSnapshot();
474
+ });
475
+ });
@@ -4,6 +4,7 @@ import { NodeFactory } from '../../__tests__/utils';
4
4
  import { createCommand } from '../../utils';
5
5
  import { CORE_EXTENSIONS } from '../core';
6
6
  import { TextDecoration } from '../TextDecoration';
7
+ import { ContentNormalizer } from '../../services';
7
8
 
8
9
  const MockStylePreset = Extension.create({
9
10
  name: 'style_preset',
@@ -18,8 +19,10 @@ const MockStylePreset = Extension.create({
18
19
  });
19
20
 
20
21
  function createEditor({ content }) {
22
+ const normalizer = new ContentNormalizer();
23
+
21
24
  return new Editor({
22
- content,
25
+ content: normalizer.normalize(content),
23
26
  extensions: CORE_EXTENSIONS.concat(MockStylePreset, TextDecoration)
24
27
  });
25
28
  }
@@ -256,3 +259,62 @@ describe('rendering', () => {
256
259
  expect(editor.getHTML()).toMatchSnapshot();
257
260
  });
258
261
  });
262
+
263
+
264
+ describe('parsing html', () => {
265
+ test('should get underline from paragraph', () => {
266
+ const editor = createEditor({
267
+ content: '<p style="text-decoration-line: underline">test</p>'
268
+ });
269
+
270
+ expect(editor.getJSON()).toMatchSnapshot();
271
+ });
272
+
273
+ test('should get strike through from paragraph', () => {
274
+ const editor = createEditor({
275
+ content: '<p style="text-decoration-line: line-through">test</p>'
276
+ });
277
+
278
+ expect(editor.getJSON()).toMatchSnapshot();
279
+ });
280
+
281
+ test('should get both from paragraph', () => {
282
+ const editor = createEditor({
283
+ content: '<p style="text-decoration-line: line-through underline">test</p>'
284
+ });
285
+
286
+ expect(editor.getJSON()).toMatchSnapshot();
287
+ });
288
+
289
+ test('should get underline from text', () => {
290
+ const editor = createEditor({
291
+ content: '<p><span style="text-decoration-line: underline">lorem</span> ipsum</p>'
292
+ });
293
+
294
+ expect(editor.getJSON()).toMatchSnapshot();
295
+ });
296
+
297
+ test('should get strike through from text', () => {
298
+ const editor = createEditor({
299
+ content: '<p><span style="text-decoration-line: line-through">lorem</span> ipsum</p>'
300
+ });
301
+
302
+ expect(editor.getJSON()).toMatchSnapshot();
303
+ });
304
+
305
+ test('should get both from text', () => {
306
+ const editor = createEditor({
307
+ content: '<p><span style="text-decoration-line: underline line-through">lorem</span> ipsum</p>'
308
+ });
309
+
310
+ expect(editor.getJSON()).toMatchSnapshot();
311
+ });
312
+
313
+ test('should merge paragraph and text settings', () => {
314
+ const editor = createEditor({
315
+ content: '<p style="text-decoration-line: underline"><span style="text-decoration-line: line-through">lorem</span> ipsum</p>'
316
+ });
317
+
318
+ expect(editor.getJSON()).toMatchSnapshot();
319
+ });
320
+ });
@@ -24,6 +24,50 @@ Object {
24
24
  }
25
25
  `;
26
26
 
27
+ exports[`parsing html should get alignment from text 1`] = `
28
+ Object {
29
+ "content": Array [
30
+ Object {
31
+ "attrs": Object {
32
+ "alignment": Object {
33
+ "desktop": "center",
34
+ "mobile": "center",
35
+ "tablet": "center",
36
+ },
37
+ },
38
+ "content": Array [
39
+ Object {
40
+ "text": "test",
41
+ "type": "text",
42
+ },
43
+ ],
44
+ "type": "paragraph",
45
+ },
46
+ ],
47
+ "type": "doc",
48
+ }
49
+ `;
50
+
51
+ exports[`parsing html should set null if no alignment 1`] = `
52
+ Object {
53
+ "content": Array [
54
+ Object {
55
+ "attrs": Object {
56
+ "alignment": null,
57
+ },
58
+ "content": Array [
59
+ Object {
60
+ "text": "test",
61
+ "type": "text",
62
+ },
63
+ ],
64
+ "type": "paragraph",
65
+ },
66
+ ],
67
+ "type": "doc",
68
+ }
69
+ `;
70
+
27
71
  exports[`rendering should render all devices 1`] = `"<p class=\\"zw-style\\" style=\\"--zw-mobile-text-align: left; --zw-tablet-text-align: right; --zw-desktop-text-align: center;\\">hello world</p>"`;
28
72
 
29
73
  exports[`rendering should render only desktop 1`] = `"<p class=\\"zw-style\\" style=\\"--zw-desktop-text-align: center;\\">hello world</p>"`;
@@ -25,4 +25,95 @@ Object {
25
25
  }
26
26
  `;
27
27
 
28
+ exports[`parsing html should get value from paragraph 1`] = `
29
+ Object {
30
+ "content": Array [
31
+ Object {
32
+ "content": Array [
33
+ Object {
34
+ "marks": Array [
35
+ Object {
36
+ "attrs": Object {
37
+ "value": "#FF0000",
38
+ },
39
+ "type": "background_color",
40
+ },
41
+ ],
42
+ "text": "test",
43
+ "type": "text",
44
+ },
45
+ ],
46
+ "type": "paragraph",
47
+ },
48
+ ],
49
+ "type": "doc",
50
+ }
51
+ `;
52
+
53
+ exports[`parsing html should get value from text 1`] = `
54
+ Object {
55
+ "content": Array [
56
+ Object {
57
+ "content": Array [
58
+ Object {
59
+ "marks": Array [
60
+ Object {
61
+ "attrs": Object {
62
+ "value": "#FF0000",
63
+ },
64
+ "type": "background_color",
65
+ },
66
+ ],
67
+ "text": "lorem",
68
+ "type": "text",
69
+ },
70
+ Object {
71
+ "text": " ipsum",
72
+ "type": "text",
73
+ },
74
+ ],
75
+ "type": "paragraph",
76
+ },
77
+ ],
78
+ "type": "doc",
79
+ }
80
+ `;
81
+
82
+ exports[`parsing html should merge paragraph and text settings 1`] = `
83
+ Object {
84
+ "content": Array [
85
+ Object {
86
+ "content": Array [
87
+ Object {
88
+ "marks": Array [
89
+ Object {
90
+ "attrs": Object {
91
+ "value": "#000000",
92
+ },
93
+ "type": "background_color",
94
+ },
95
+ ],
96
+ "text": "lorem",
97
+ "type": "text",
98
+ },
99
+ Object {
100
+ "marks": Array [
101
+ Object {
102
+ "attrs": Object {
103
+ "value": "#FF0000",
104
+ },
105
+ "type": "background_color",
106
+ },
107
+ ],
108
+ "text": " ipsum",
109
+ "type": "text",
110
+ },
111
+ ],
112
+ "type": "paragraph",
113
+ },
114
+ ],
115
+ "type": "doc",
116
+ }
117
+ `;
118
+
28
119
  exports[`rendering should render html 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-background-color: green;\\" class=\\"zw-style\\">hello world</span></p>"`;
@@ -25,4 +25,95 @@ Object {
25
25
  }
26
26
  `;
27
27
 
28
+ exports[`parsing html should get value from paragraph 1`] = `
29
+ Object {
30
+ "content": Array [
31
+ Object {
32
+ "content": Array [
33
+ Object {
34
+ "marks": Array [
35
+ Object {
36
+ "attrs": Object {
37
+ "value": "#FF0000",
38
+ },
39
+ "type": "font_color",
40
+ },
41
+ ],
42
+ "text": "test",
43
+ "type": "text",
44
+ },
45
+ ],
46
+ "type": "paragraph",
47
+ },
48
+ ],
49
+ "type": "doc",
50
+ }
51
+ `;
52
+
53
+ exports[`parsing html should get value from text 1`] = `
54
+ Object {
55
+ "content": Array [
56
+ Object {
57
+ "content": Array [
58
+ Object {
59
+ "marks": Array [
60
+ Object {
61
+ "attrs": Object {
62
+ "value": "#FF0000",
63
+ },
64
+ "type": "font_color",
65
+ },
66
+ ],
67
+ "text": "lorem",
68
+ "type": "text",
69
+ },
70
+ Object {
71
+ "text": " ipsum",
72
+ "type": "text",
73
+ },
74
+ ],
75
+ "type": "paragraph",
76
+ },
77
+ ],
78
+ "type": "doc",
79
+ }
80
+ `;
81
+
82
+ exports[`parsing html should merge paragraph and text settings 1`] = `
83
+ Object {
84
+ "content": Array [
85
+ Object {
86
+ "content": Array [
87
+ Object {
88
+ "marks": Array [
89
+ Object {
90
+ "attrs": Object {
91
+ "value": "#000000",
92
+ },
93
+ "type": "font_color",
94
+ },
95
+ ],
96
+ "text": "lorem",
97
+ "type": "text",
98
+ },
99
+ Object {
100
+ "marks": Array [
101
+ Object {
102
+ "attrs": Object {
103
+ "value": "#FF0000",
104
+ },
105
+ "type": "font_color",
106
+ },
107
+ ],
108
+ "text": " ipsum",
109
+ "type": "text",
110
+ },
111
+ ],
112
+ "type": "paragraph",
113
+ },
114
+ ],
115
+ "type": "doc",
116
+ }
117
+ `;
118
+
28
119
  exports[`rendering should render html 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-font-color: green;\\" class=\\"zw-style\\">hello world</span></p>"`;
@@ -155,4 +155,95 @@ Object {
155
155
  }
156
156
  `;
157
157
 
158
+ exports[`parsing html should get value from paragraph 1`] = `
159
+ Object {
160
+ "content": Array [
161
+ Object {
162
+ "content": Array [
163
+ Object {
164
+ "marks": Array [
165
+ Object {
166
+ "attrs": Object {
167
+ "value": "Lato",
168
+ },
169
+ "type": "font_family",
170
+ },
171
+ ],
172
+ "text": "test",
173
+ "type": "text",
174
+ },
175
+ ],
176
+ "type": "paragraph",
177
+ },
178
+ ],
179
+ "type": "doc",
180
+ }
181
+ `;
182
+
183
+ exports[`parsing html should get value from text 1`] = `
184
+ Object {
185
+ "content": Array [
186
+ Object {
187
+ "content": Array [
188
+ Object {
189
+ "marks": Array [
190
+ Object {
191
+ "attrs": Object {
192
+ "value": "Lato",
193
+ },
194
+ "type": "font_family",
195
+ },
196
+ ],
197
+ "text": "lorem",
198
+ "type": "text",
199
+ },
200
+ Object {
201
+ "text": " ipsum",
202
+ "type": "text",
203
+ },
204
+ ],
205
+ "type": "paragraph",
206
+ },
207
+ ],
208
+ "type": "doc",
209
+ }
210
+ `;
211
+
212
+ exports[`parsing html should merge paragraph and text settings 1`] = `
213
+ Object {
214
+ "content": Array [
215
+ Object {
216
+ "content": Array [
217
+ Object {
218
+ "marks": Array [
219
+ Object {
220
+ "attrs": Object {
221
+ "value": "Roboto",
222
+ },
223
+ "type": "font_family",
224
+ },
225
+ ],
226
+ "text": "lorem",
227
+ "type": "text",
228
+ },
229
+ Object {
230
+ "marks": Array [
231
+ Object {
232
+ "attrs": Object {
233
+ "value": "Lato",
234
+ },
235
+ "type": "font_family",
236
+ },
237
+ ],
238
+ "text": " ipsum",
239
+ "type": "text",
240
+ },
241
+ ],
242
+ "type": "paragraph",
243
+ },
244
+ ],
245
+ "type": "doc",
246
+ }
247
+ `;
248
+
158
249
  exports[`rendering should render html 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-font-family: Bungee;\\" class=\\"zw-style\\">hello world</span></p>"`;
@@ -135,6 +135,105 @@ Object {
135
135
  }
136
136
  `;
137
137
 
138
+ exports[`parsing html should get value from paragraph 1`] = `
139
+ Object {
140
+ "content": Array [
141
+ Object {
142
+ "content": Array [
143
+ Object {
144
+ "marks": Array [
145
+ Object {
146
+ "attrs": Object {
147
+ "desktop": "24",
148
+ "mobile": "24",
149
+ "tablet": "24",
150
+ },
151
+ "type": "font_size",
152
+ },
153
+ ],
154
+ "text": "test",
155
+ "type": "text",
156
+ },
157
+ ],
158
+ "type": "paragraph",
159
+ },
160
+ ],
161
+ "type": "doc",
162
+ }
163
+ `;
164
+
165
+ exports[`parsing html should get value from text 1`] = `
166
+ Object {
167
+ "content": Array [
168
+ Object {
169
+ "content": Array [
170
+ Object {
171
+ "marks": Array [
172
+ Object {
173
+ "attrs": Object {
174
+ "desktop": "24",
175
+ "mobile": "24",
176
+ "tablet": "24",
177
+ },
178
+ "type": "font_size",
179
+ },
180
+ ],
181
+ "text": "lorem",
182
+ "type": "text",
183
+ },
184
+ Object {
185
+ "text": " ipsum",
186
+ "type": "text",
187
+ },
188
+ ],
189
+ "type": "paragraph",
190
+ },
191
+ ],
192
+ "type": "doc",
193
+ }
194
+ `;
195
+
196
+ exports[`parsing html should merge paragraph and text settings 1`] = `
197
+ Object {
198
+ "content": Array [
199
+ Object {
200
+ "content": Array [
201
+ Object {
202
+ "marks": Array [
203
+ Object {
204
+ "attrs": Object {
205
+ "desktop": "20",
206
+ "mobile": "20",
207
+ "tablet": "20",
208
+ },
209
+ "type": "font_size",
210
+ },
211
+ ],
212
+ "text": "lorem",
213
+ "type": "text",
214
+ },
215
+ Object {
216
+ "marks": Array [
217
+ Object {
218
+ "attrs": Object {
219
+ "desktop": "24",
220
+ "mobile": "24",
221
+ "tablet": "24",
222
+ },
223
+ "type": "font_size",
224
+ },
225
+ ],
226
+ "text": " ipsum",
227
+ "type": "text",
228
+ },
229
+ ],
230
+ "type": "paragraph",
231
+ },
232
+ ],
233
+ "type": "doc",
234
+ }
235
+ `;
236
+
138
237
  exports[`rendering should render all devices 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-mobile-font-size: 12px; --zw-tablet-font-size: 14px; --zw-desktop-font-size: 16px;\\" class=\\"zw-style\\">hello world</span></p>"`;
139
238
 
140
239
  exports[`rendering should render only desktop 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-desktop-font-size: 14px;\\" class=\\"zw-style\\">hello world</span></p>"`;