@zipify/wysiwyg 1.0.0-dev.3 → 1.0.0-dev.32

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 (152) hide show
  1. package/.eslintignore +1 -0
  2. package/.github/dependabot.yaml +1 -0
  3. package/.release-it.json +3 -1
  4. package/.stylelintignore +1 -0
  5. package/README.md +3 -1
  6. package/config/jest/setupTests.js +7 -1
  7. package/config/webpack/example.config.js +2 -0
  8. package/config/webpack/lib.config.js +46 -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 +1118 -0
  12. package/dist/wysiwyg.js +2 -0
  13. package/dist/wysiwyg.js.LICENSE.txt +1 -0
  14. package/example/ExampleApp.vue +51 -32
  15. package/example/example.js +26 -0
  16. package/example/pageBlocks.js +31 -0
  17. package/example/presets.js +4 -2
  18. package/lib/Wysiwyg.vue +41 -21
  19. package/lib/assets/icons/alignment-center.svg +3 -0
  20. package/lib/assets/icons/alignment-justify.svg +3 -0
  21. package/lib/assets/icons/alignment-left.svg +3 -0
  22. package/lib/assets/icons/alignment-right.svg +3 -0
  23. package/lib/assets/icons/arrow.svg +3 -0
  24. package/lib/assets/icons/background-color.svg +3 -0
  25. package/lib/assets/icons/case-style.svg +3 -0
  26. package/lib/assets/icons/font-color.svg +5 -0
  27. package/lib/assets/icons/italic.svg +3 -0
  28. package/lib/assets/icons/line-height.svg +3 -0
  29. package/lib/assets/icons/link.svg +3 -0
  30. package/lib/assets/icons/list-circle.svg +3 -0
  31. package/lib/assets/icons/list-decimal.svg +3 -0
  32. package/lib/assets/icons/list-disc.svg +3 -0
  33. package/lib/assets/icons/list-latin.svg +3 -0
  34. package/lib/assets/icons/list-roman.svg +3 -0
  35. package/lib/assets/icons/list-square.svg +3 -0
  36. package/lib/assets/icons/remove-format.svg +3 -0
  37. package/lib/assets/icons/reset-styles.svg +3 -0
  38. package/lib/assets/icons/strike-through.svg +3 -0
  39. package/lib/assets/icons/superscript.svg +3 -0
  40. package/lib/assets/icons/underline.svg +3 -0
  41. package/lib/assets/icons/unlink.svg +3 -0
  42. package/lib/components/base/Button.vue +21 -1
  43. package/lib/components/base/Checkbox.vue +89 -0
  44. package/lib/components/base/FieldLabel.vue +2 -1
  45. package/lib/components/base/Icon.vue +18 -10
  46. package/lib/components/base/Modal.vue +0 -1
  47. package/lib/components/base/TextField.vue +106 -0
  48. package/lib/components/base/__tests__/Icon.test.js +6 -13
  49. package/lib/components/base/__tests__/TextField.test.js +57 -0
  50. package/lib/components/base/__tests__/__snapshots__/TextField.test.js.snap +9 -0
  51. package/lib/components/base/colorPicker/composables/usePickerHotkeys.js +2 -1
  52. package/lib/components/base/composables/index.js +1 -0
  53. package/lib/components/base/composables/useValidator.js +19 -0
  54. package/lib/components/base/dropdown/Dropdown.vue +15 -3
  55. package/lib/components/base/dropdown/DropdownActivator.vue +19 -3
  56. package/lib/components/base/index.js +3 -1
  57. package/lib/components/toolbar/Toolbar.vue +49 -9
  58. package/lib/components/toolbar/ToolbarFull.vue +10 -2
  59. package/lib/components/toolbar/__tests__/Toolbar.test.js +6 -0
  60. package/lib/components/toolbar/controls/FontSizeControl.vue +7 -0
  61. package/lib/components/toolbar/controls/ListControl.vue +1 -5
  62. package/lib/components/toolbar/controls/UnderlineControl.vue +2 -2
  63. package/lib/components/toolbar/controls/__tests__/UnderlineControl.test.js +4 -0
  64. package/lib/components/toolbar/controls/index.js +1 -0
  65. package/lib/components/toolbar/controls/link/LinkControl.vue +152 -0
  66. package/lib/components/toolbar/controls/link/LinkControlApply.vue +35 -0
  67. package/lib/components/toolbar/controls/link/LinkControlHeader.vue +67 -0
  68. package/lib/components/toolbar/controls/link/composables/index.js +1 -0
  69. package/lib/components/toolbar/controls/link/composables/useLink.js +61 -0
  70. package/lib/components/toolbar/controls/link/destination/LinkControlDestination.vue +103 -0
  71. package/lib/components/toolbar/controls/link/destination/LinkControlPageBlock.vue +54 -0
  72. package/lib/components/toolbar/controls/link/destination/LinkControlUrl.vue +52 -0
  73. package/lib/components/toolbar/controls/link/destination/index.js +1 -0
  74. package/lib/components/toolbar/controls/link/index.js +1 -0
  75. package/lib/composables/__tests__/useEditor.test.js +14 -5
  76. package/lib/composables/useEditor.js +13 -8
  77. package/lib/composables/useToolbar.js +14 -29
  78. package/lib/directives/outClick.js +20 -4
  79. package/lib/enums/LinkDestinations.js +4 -0
  80. package/lib/enums/LinkTargets.js +4 -0
  81. package/lib/enums/TextSettings.js +3 -1
  82. package/lib/enums/index.js +2 -0
  83. package/lib/extensions/Alignment.js +21 -3
  84. package/lib/extensions/BackgroundColor.js +16 -1
  85. package/lib/extensions/FontColor.js +16 -1
  86. package/lib/extensions/FontFamily.js +26 -2
  87. package/lib/extensions/FontSize.js +28 -3
  88. package/lib/extensions/FontStyle.js +23 -2
  89. package/lib/extensions/FontWeight.js +33 -1
  90. package/lib/extensions/LineHeight.js +29 -3
  91. package/lib/extensions/Link.js +101 -0
  92. package/lib/extensions/StylePreset.js +36 -6
  93. package/lib/extensions/TextDecoration.js +29 -3
  94. package/lib/extensions/__tests__/Alignment.test.js +30 -3
  95. package/lib/extensions/__tests__/BackgroundColor.test.js +38 -3
  96. package/lib/extensions/__tests__/CaseStyle.test.js +4 -3
  97. package/lib/extensions/__tests__/FontColor.test.js +38 -3
  98. package/lib/extensions/__tests__/FontFamily.test.js +59 -5
  99. package/lib/extensions/__tests__/FontSize.test.js +38 -3
  100. package/lib/extensions/__tests__/FontStyle.test.js +46 -3
  101. package/lib/extensions/__tests__/FontWeight.test.js +66 -3
  102. package/lib/extensions/__tests__/LineHeight.test.js +49 -3
  103. package/lib/extensions/__tests__/StylePreset.test.js +143 -4
  104. package/lib/extensions/__tests__/TextDecoration.test.js +87 -3
  105. package/lib/extensions/__tests__/__snapshots__/Alignment.test.js.snap +70 -2
  106. package/lib/extensions/__tests__/__snapshots__/BackgroundColor.test.js.snap +121 -1
  107. package/lib/extensions/__tests__/__snapshots__/FontColor.test.js.snap +109 -1
  108. package/lib/extensions/__tests__/__snapshots__/FontFamily.test.js.snap +179 -1
  109. package/lib/extensions/__tests__/__snapshots__/FontSize.test.js.snap +132 -2
  110. package/lib/extensions/__tests__/__snapshots__/FontStyle.test.js.snap +142 -1
  111. package/lib/extensions/__tests__/__snapshots__/FontWeight.test.js.snap +179 -1
  112. package/lib/extensions/__tests__/__snapshots__/LineHeight.test.js.snap +118 -2
  113. package/lib/extensions/__tests__/__snapshots__/StylePreset.test.js.snap +171 -2
  114. package/lib/extensions/__tests__/__snapshots__/TextDecoration.test.js.snap +300 -3
  115. package/lib/extensions/core/CopyPasteProcessor.js +10 -0
  116. package/lib/extensions/core/TextProcessor.js +10 -0
  117. package/lib/extensions/core/__tests__/NodeProcessor.test.js +4 -3
  118. package/lib/extensions/core/__tests__/SelectionProcessor.test.js +9 -6
  119. package/lib/extensions/core/__tests__/TextProcessor.test.js +139 -10
  120. package/lib/extensions/core/__tests__/__snapshots__/TextProcessor.test.js.snap +26 -0
  121. package/lib/extensions/core/index.js +11 -2
  122. package/lib/extensions/core/plugins/PastePlugin.js +48 -0
  123. package/lib/extensions/core/plugins/ProseMirrorPlugin.js +20 -0
  124. package/lib/extensions/core/plugins/index.js +1 -0
  125. package/lib/extensions/index.js +41 -33
  126. package/lib/extensions/list/List.js +34 -0
  127. package/lib/extensions/list/__tests__/List.test.js +115 -5
  128. package/lib/extensions/list/__tests__/__snapshots__/List.test.js.snap +481 -0
  129. package/lib/index.js +4 -1
  130. package/lib/injectionTokens.js +2 -1
  131. package/lib/services/ContentNormalizer.js +157 -0
  132. package/lib/services/ContextWidnow.js +23 -0
  133. package/lib/services/Storage.js +1 -13
  134. package/lib/services/__tests__/ContentNormalizer.test.js +74 -0
  135. package/lib/services/__tests__/FavoriteColors.test.js +20 -0
  136. package/lib/services/__tests__/JsonSerializer.test.js +23 -0
  137. package/lib/services/__tests__/Storage.test.js +79 -0
  138. package/lib/services/index.js +2 -0
  139. package/lib/styles/content.css +96 -9
  140. package/lib/styles/helpers/offsets.css +16 -0
  141. package/lib/styles/variables.css +6 -0
  142. package/lib/utils/__tests__/__snapshots__/renderInlineSetting.test.js.snap +4 -4
  143. package/lib/utils/__tests__/convertColor.test.js +19 -0
  144. package/lib/utils/__tests__/createKeyboardShortcut.test.js +25 -0
  145. package/lib/utils/__tests__/renderInlineSetting.test.js +26 -0
  146. package/lib/utils/convertColor.js +7 -0
  147. package/lib/utils/importIcon.js +12 -0
  148. package/lib/utils/index.js +2 -0
  149. package/lib/utils/renderInlineSetting.js +2 -2
  150. package/package.json +18 -14
  151. package/lib/assets/icons.svg +0 -69
  152. package/lib/composables/__tests__/useToolbar.test.js +0 -56
@@ -1,10 +1,11 @@
1
1
  import { Editor, Extension, Mark } from '@tiptap/vue-2';
2
2
  import { ref } from '@vue/composition-api';
3
3
  import { NodeFactory } from '../../__tests__/utils';
4
- import { CORE_EXTENSIONS } from '../core';
5
4
  import { StylePreset } from '../StylePreset';
6
5
  import { List } from '../list';
7
6
  import { ListTypes, NodeTypes, TextSettings } from '../../enums';
7
+ import { ContentNormalizer } from '../../services';
8
+ import { buildCoreExtensions } from '../core';
8
9
 
9
10
  const MockFontSize = Mark.create({
10
11
  name: TextSettings.FONT_SIZE,
@@ -42,15 +43,76 @@ const MockAlignment = Extension.create({
42
43
  ]
43
44
  });
44
45
 
46
+ const MockBackgroundColor = Mark.create({
47
+ name: TextSettings.BACKGROUND_COLOR,
48
+
49
+ addAttributes: () => ({
50
+ value: { default: null }
51
+ }),
52
+
53
+ renderHTML: () => ['span', {}, 0]
54
+ });
55
+
56
+ const MockFontColor = Mark.create({
57
+ name: TextSettings.FONT_COLOR,
58
+
59
+ addAttributes: () => ({
60
+ value: { default: null }
61
+ }),
62
+
63
+ renderHTML: () => ['span', {}, 0]
64
+ });
65
+
66
+ const MockFontFamily = Mark.create({
67
+ name: TextSettings.FONT_FAMILY,
68
+
69
+ addAttributes: () => ({
70
+ value: { default: null }
71
+ }),
72
+
73
+ renderHTML: () => ['span', {}, 0]
74
+ });
75
+
76
+ const MockFontStyle = Mark.create({
77
+ name: TextSettings.FONT_STYLE,
78
+
79
+ addAttributes: () => ({
80
+ value: { default: null }
81
+ }),
82
+
83
+ renderHTML: () => ['span', {}, 0]
84
+ });
85
+
86
+ const MockTextDecoration = Mark.create({
87
+ name: TextSettings.TEXT_DECORATION,
88
+
89
+ addAttributes: () => ({
90
+ value: { default: null }
91
+ }),
92
+
93
+ renderHTML: () => ['span', {}, 0]
94
+ });
95
+
96
+ const MockSuperscript = Mark.create({
97
+ name: TextSettings.SUPERSCRIPT,
98
+
99
+ addAttributes: () => ({
100
+ value: { default: null }
101
+ }),
102
+
103
+ renderHTML: () => ['span', {}, 0]
104
+ });
105
+
45
106
  function createEditor({ content, presets, defaultId }) {
46
107
  return new Promise((resolve) => {
47
108
  const editor = new Editor({
48
- content,
109
+ content: ContentNormalizer.normalize(content),
49
110
  onCreate: () => resolve(editor),
50
111
 
51
- extensions: CORE_EXTENSIONS.concat(
112
+ extensions: buildCoreExtensions().concat(
52
113
  StylePreset.configure({
53
114
  presetsRef: ref(presets),
115
+ baseClass: 'zw ts-',
54
116
  defaultId,
55
117
 
56
118
  makeVariable({ device, preset, property }) {
@@ -64,7 +126,13 @@ function createEditor({ content, presets, defaultId }) {
64
126
  }),
65
127
  MockFontSize,
66
128
  MockFontWeight,
67
- MockAlignment
129
+ MockAlignment,
130
+ MockBackgroundColor,
131
+ MockFontColor,
132
+ MockFontFamily,
133
+ MockFontStyle,
134
+ MockTextDecoration,
135
+ MockSuperscript
68
136
  )
69
137
  });
70
138
  });
@@ -398,3 +466,74 @@ describe('remove preset customization', () => {
398
466
  );
399
467
  });
400
468
  });
469
+
470
+ describe('parsing html', () => {
471
+ test('should get by fallback class', async () => {
472
+ const editor = await createEditor({
473
+ content: '<p class="zpa-regular2">lorem ipsum</p>',
474
+ defaultId: 'regular-1',
475
+ presets: [
476
+ createPreset({ id: 'regular-1' }),
477
+ createPreset({ id: 'regular-2', fallbackClass: 'zpa-regular2' })
478
+ ]
479
+ });
480
+
481
+ expect(editor.getJSON()).toMatchSnapshot();
482
+ });
483
+
484
+ test('should get by preset class', async () => {
485
+ const editor = await createEditor({
486
+ content: '<p class="zw ts-regular-2">lorem ipsum</p>',
487
+ defaultId: 'regular-1',
488
+ presets: [
489
+ createPreset({ id: 'regular-1' }),
490
+ createPreset({ id: 'regular-2' })
491
+ ]
492
+ });
493
+
494
+ expect(editor.getJSON()).toMatchSnapshot();
495
+ });
496
+
497
+ test('should get by heading tag', async () => {
498
+ const editor = await createEditor({
499
+ content: '<h3>lorem ipsum</h3>',
500
+ defaultId: 'regular-1',
501
+ presets: [
502
+ createPreset({ id: 'regular-1' }),
503
+ createPreset({ id: 'h3', node: { type: 'heading', level: 3 } })
504
+ ]
505
+ });
506
+
507
+ expect(editor.getJSON()).toMatchSnapshot();
508
+ });
509
+
510
+ test('should set default preset to unstyled paragraph', async () => {
511
+ const editor = await createEditor({
512
+ content: '<p>lorem ipsum</p>',
513
+ defaultId: 'regular-1',
514
+ presets: [createPreset({ id: 'regular-1' })]
515
+ });
516
+
517
+ expect(editor.getJSON()).toMatchSnapshot();
518
+ });
519
+
520
+ test('should set null to list item', async () => {
521
+ const editor = await createEditor({
522
+ content: '<ul><li>lorem ipsum</li></ul>',
523
+ defaultId: 'regular-1',
524
+ presets: [createPreset({ id: 'regular-1' })]
525
+ });
526
+
527
+ expect(editor.getJSON()).toMatchSnapshot();
528
+ });
529
+
530
+ test('should set null to list item with preset', async () => {
531
+ const editor = await createEditor({
532
+ content: '<ul class="zw regular-1"><li>lorem ipsum</li></ul>',
533
+ defaultId: 'regular-1',
534
+ presets: [createPreset({ id: 'regular-1' })]
535
+ });
536
+
537
+ expect(editor.getJSON()).toMatchSnapshot();
538
+ });
539
+ });
@@ -2,8 +2,9 @@ import { Editor, Extension } from '@tiptap/vue-2';
2
2
  import { ref } from '@vue/composition-api';
3
3
  import { NodeFactory } from '../../__tests__/utils';
4
4
  import { createCommand } from '../../utils';
5
- import { CORE_EXTENSIONS } from '../core';
6
5
  import { TextDecoration } from '../TextDecoration';
6
+ import { ContentNormalizer } from '../../services';
7
+ import { buildCoreExtensions } from '../core';
7
8
 
8
9
  const MockStylePreset = Extension.create({
9
10
  name: 'style_preset',
@@ -19,8 +20,8 @@ const MockStylePreset = Extension.create({
19
20
 
20
21
  function createEditor({ content }) {
21
22
  return new Editor({
22
- content,
23
- extensions: CORE_EXTENSIONS.concat(MockStylePreset, TextDecoration)
23
+ content: ContentNormalizer.normalize(content),
24
+ extensions: buildCoreExtensions().concat(MockStylePreset, TextDecoration)
24
25
  });
25
26
  }
26
27
 
@@ -256,3 +257,86 @@ describe('rendering', () => {
256
257
  expect(editor.getHTML()).toMatchSnapshot();
257
258
  });
258
259
  });
260
+
261
+
262
+ describe('parsing html', () => {
263
+ test('should get underline from paragraph', () => {
264
+ const editor = createEditor({
265
+ content: '<p style="text-decoration-line: underline">test</p>'
266
+ });
267
+
268
+ expect(editor.getJSON()).toMatchSnapshot();
269
+ });
270
+
271
+ test('should get strike through from paragraph', () => {
272
+ const editor = createEditor({
273
+ content: '<p style="text-decoration-line: line-through">test</p>'
274
+ });
275
+
276
+ expect(editor.getJSON()).toMatchSnapshot();
277
+ });
278
+
279
+ test('should get both from paragraph', () => {
280
+ const editor = createEditor({
281
+ content: '<p style="text-decoration-line: line-through underline">test</p>'
282
+ });
283
+
284
+ expect(editor.getJSON()).toMatchSnapshot();
285
+ });
286
+
287
+ test('should get underline from text', () => {
288
+ const editor = createEditor({
289
+ content: '<p><span style="text-decoration-line: underline">lorem</span> ipsum</p>'
290
+ });
291
+
292
+ expect(editor.getJSON()).toMatchSnapshot();
293
+ });
294
+
295
+ test('should get underline from rendered view', () => {
296
+ const editor = createEditor({
297
+ content: '<p><span style="--zw-text-decoration: underline">lorem</span> ipsum</p>'
298
+ });
299
+
300
+ expect(editor.getJSON()).toMatchSnapshot();
301
+ });
302
+
303
+ test('should get strike through from text', () => {
304
+ const editor = createEditor({
305
+ content: '<p><span style="text-decoration-line: line-through">lorem</span> ipsum</p>'
306
+ });
307
+
308
+ expect(editor.getJSON()).toMatchSnapshot();
309
+ });
310
+
311
+ test('should get strike through from rendered view', () => {
312
+ const editor = createEditor({
313
+ content: '<p><span style="--zw-text-decoration: line-through">lorem</span> ipsum</p>'
314
+ });
315
+
316
+ expect(editor.getJSON()).toMatchSnapshot();
317
+ });
318
+
319
+ test('should get both from text', () => {
320
+ const editor = createEditor({
321
+ content: '<p><span style="text-decoration-line: underline line-through">lorem</span> ipsum</p>'
322
+ });
323
+
324
+ expect(editor.getJSON()).toMatchSnapshot();
325
+ });
326
+
327
+ test('should get both from rendered view', () => {
328
+ const editor = createEditor({
329
+ content: '<p><span style="--zw-text-decoration: underline line-through">lorem</span> ipsum</p>'
330
+ });
331
+
332
+ expect(editor.getJSON()).toMatchSnapshot();
333
+ });
334
+
335
+ test('should merge paragraph and text settings', () => {
336
+ const editor = createEditor({
337
+ content: '<p style="text-decoration-line: underline"><span style="text-decoration-line: line-through">lorem</span> ipsum</p>'
338
+ });
339
+
340
+ expect(editor.getJSON()).toMatchSnapshot();
341
+ });
342
+ });
@@ -24,6 +24,74 @@ Object {
24
24
  }
25
25
  `;
26
26
 
27
- 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>"`;
27
+ exports[`parsing html should get alignment from rendered view 1`] = `
28
+ Object {
29
+ "content": Array [
30
+ Object {
31
+ "attrs": Object {
32
+ "alignment": Object {
33
+ "desktop": "right",
34
+ "mobile": "center",
35
+ "tablet": null,
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 get alignment from text 1`] = `
52
+ Object {
53
+ "content": Array [
54
+ Object {
55
+ "attrs": Object {
56
+ "alignment": Object {
57
+ "desktop": "center",
58
+ "mobile": "center",
59
+ "tablet": "center",
60
+ },
61
+ },
62
+ "content": Array [
63
+ Object {
64
+ "text": "test",
65
+ "type": "text",
66
+ },
67
+ ],
68
+ "type": "paragraph",
69
+ },
70
+ ],
71
+ "type": "doc",
72
+ }
73
+ `;
74
+
75
+ exports[`parsing html should set null if no alignment 1`] = `
76
+ Object {
77
+ "content": Array [
78
+ Object {
79
+ "attrs": Object {
80
+ "alignment": null,
81
+ },
82
+ "content": Array [
83
+ Object {
84
+ "text": "test",
85
+ "type": "text",
86
+ },
87
+ ],
88
+ "type": "paragraph",
89
+ },
90
+ ],
91
+ "type": "doc",
92
+ }
93
+ `;
94
+
95
+ exports[`rendering should render all devices 1`] = `"<p class=\\"zw-style\\" style=\\"--zw-text-align-mobile:left;--zw-text-align-tablet:right;--zw-text-align-desktop:center;\\">hello world</p>"`;
28
96
 
29
- exports[`rendering should render only desktop 1`] = `"<p class=\\"zw-style\\" style=\\"--zw-desktop-text-align: center;\\">hello world</p>"`;
97
+ exports[`rendering should render only desktop 1`] = `"<p class=\\"zw-style\\" style=\\"--zw-text-align-desktop:center;\\">hello world</p>"`;
@@ -25,4 +25,124 @@ Object {
25
25
  }
26
26
  `;
27
27
 
28
- exports[`rendering should render html 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-background-color: green;\\" class=\\"zw-style\\">hello world</span></p>"`;
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 rendered view 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 get value from text 1`] = `
83
+ Object {
84
+ "content": Array [
85
+ Object {
86
+ "content": Array [
87
+ Object {
88
+ "marks": Array [
89
+ Object {
90
+ "attrs": Object {
91
+ "value": "#FF0000",
92
+ },
93
+ "type": "background_color",
94
+ },
95
+ ],
96
+ "text": "lorem",
97
+ "type": "text",
98
+ },
99
+ Object {
100
+ "text": " ipsum",
101
+ "type": "text",
102
+ },
103
+ ],
104
+ "type": "paragraph",
105
+ },
106
+ ],
107
+ "type": "doc",
108
+ }
109
+ `;
110
+
111
+ exports[`parsing html should merge paragraph and text settings 1`] = `
112
+ Object {
113
+ "content": Array [
114
+ Object {
115
+ "content": Array [
116
+ Object {
117
+ "marks": Array [
118
+ Object {
119
+ "attrs": Object {
120
+ "value": "#000000",
121
+ },
122
+ "type": "background_color",
123
+ },
124
+ ],
125
+ "text": "lorem",
126
+ "type": "text",
127
+ },
128
+ Object {
129
+ "marks": Array [
130
+ Object {
131
+ "attrs": Object {
132
+ "value": "#FF0000",
133
+ },
134
+ "type": "background_color",
135
+ },
136
+ ],
137
+ "text": " ipsum",
138
+ "type": "text",
139
+ },
140
+ ],
141
+ "type": "paragraph",
142
+ },
143
+ ],
144
+ "type": "doc",
145
+ }
146
+ `;
147
+
148
+ 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,112 @@ Object {
25
25
  }
26
26
  `;
27
27
 
28
- exports[`rendering should render html 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-font-color: green;\\" class=\\"zw-style\\">hello world</span></p>"`;
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 parsed view 1`] = `
54
+ Object {
55
+ "content": Array [
56
+ Object {
57
+ "content": Array [
58
+ Object {
59
+ "text": "lorem ipsum",
60
+ "type": "text",
61
+ },
62
+ ],
63
+ "type": "paragraph",
64
+ },
65
+ ],
66
+ "type": "doc",
67
+ }
68
+ `;
69
+
70
+ exports[`parsing html should get value from text 1`] = `
71
+ Object {
72
+ "content": Array [
73
+ Object {
74
+ "content": Array [
75
+ Object {
76
+ "marks": Array [
77
+ Object {
78
+ "attrs": Object {
79
+ "value": "#FF0000",
80
+ },
81
+ "type": "font_color",
82
+ },
83
+ ],
84
+ "text": "lorem",
85
+ "type": "text",
86
+ },
87
+ Object {
88
+ "text": " ipsum",
89
+ "type": "text",
90
+ },
91
+ ],
92
+ "type": "paragraph",
93
+ },
94
+ ],
95
+ "type": "doc",
96
+ }
97
+ `;
98
+
99
+ exports[`parsing html should merge paragraph and text settings 1`] = `
100
+ Object {
101
+ "content": Array [
102
+ Object {
103
+ "content": Array [
104
+ Object {
105
+ "marks": Array [
106
+ Object {
107
+ "attrs": Object {
108
+ "value": "#000000",
109
+ },
110
+ "type": "font_color",
111
+ },
112
+ ],
113
+ "text": "lorem",
114
+ "type": "text",
115
+ },
116
+ Object {
117
+ "marks": Array [
118
+ Object {
119
+ "attrs": Object {
120
+ "value": "#FF0000",
121
+ },
122
+ "type": "font_color",
123
+ },
124
+ ],
125
+ "text": " ipsum",
126
+ "type": "text",
127
+ },
128
+ ],
129
+ "type": "paragraph",
130
+ },
131
+ ],
132
+ "type": "doc",
133
+ }
134
+ `;
135
+
136
+ exports[`rendering should render html 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-font-color:green;\\" class=\\"zw-style\\">hello world</span></p>"`;