@zipify/wysiwyg 1.0.0-dev.17 → 1.0.0-dev.18

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 (98) hide show
  1. package/.github/dependabot.yaml +1 -0
  2. package/dist/wysiwyg.css +199 -12
  3. package/dist/wysiwyg.js +1 -1
  4. package/example/ExampleApp.vue +6 -2
  5. package/example/pageBlocks.js +31 -0
  6. package/example/presets.js +2 -2
  7. package/lib/Wysiwyg.vue +14 -3
  8. package/lib/assets/icons/link.svg +3 -0
  9. package/lib/assets/icons/unlink.svg +3 -0
  10. package/lib/components/base/Button.vue +21 -1
  11. package/lib/components/base/Checkbox.vue +89 -0
  12. package/lib/components/base/FieldLabel.vue +2 -1
  13. package/lib/components/base/Icon.vue +2 -2
  14. package/lib/components/base/Modal.vue +0 -1
  15. package/lib/components/base/TextField.vue +106 -0
  16. package/lib/components/base/__tests__/TextField.test.js +57 -0
  17. package/lib/components/base/__tests__/__snapshots__/TextField.test.js.snap +9 -0
  18. package/lib/components/base/composables/index.js +1 -0
  19. package/lib/components/base/composables/useValidator.js +19 -0
  20. package/lib/components/base/dropdown/Dropdown.vue +15 -3
  21. package/lib/components/base/dropdown/DropdownActivator.vue +19 -3
  22. package/lib/components/base/index.js +2 -0
  23. package/lib/components/toolbar/Toolbar.vue +5 -5
  24. package/lib/components/toolbar/ToolbarFull.vue +10 -2
  25. package/lib/components/toolbar/controls/FontSizeControl.vue +7 -0
  26. package/lib/components/toolbar/controls/UnderlineControl.vue +2 -2
  27. package/lib/components/toolbar/controls/__tests__/UnderlineControl.test.js +4 -0
  28. package/lib/components/toolbar/controls/index.js +1 -0
  29. package/lib/components/toolbar/controls/link/LinkControl.vue +152 -0
  30. package/lib/components/toolbar/controls/link/LinkControlApply.vue +35 -0
  31. package/lib/components/toolbar/controls/link/LinkControlHeader.vue +67 -0
  32. package/lib/components/toolbar/controls/link/composables/index.js +1 -0
  33. package/lib/components/toolbar/controls/link/composables/useLink.js +61 -0
  34. package/lib/components/toolbar/controls/link/destination/LinkControlDestination.vue +103 -0
  35. package/lib/components/toolbar/controls/link/destination/LinkControlPageBlock.vue +54 -0
  36. package/lib/components/toolbar/controls/link/destination/LinkControlUrl.vue +52 -0
  37. package/lib/components/toolbar/controls/link/destination/index.js +1 -0
  38. package/lib/components/toolbar/controls/link/index.js +1 -0
  39. package/lib/composables/__tests__/useEditor.test.js +2 -2
  40. package/lib/composables/useEditor.js +2 -4
  41. package/lib/enums/LinkDestinations.js +4 -0
  42. package/lib/enums/LinkTargets.js +4 -0
  43. package/lib/enums/TextSettings.js +3 -1
  44. package/lib/enums/index.js +2 -0
  45. package/lib/extensions/Alignment.js +18 -6
  46. package/lib/extensions/BackgroundColor.js +14 -6
  47. package/lib/extensions/FontColor.js +14 -6
  48. package/lib/extensions/FontFamily.js +25 -8
  49. package/lib/extensions/FontSize.js +26 -13
  50. package/lib/extensions/FontStyle.js +23 -13
  51. package/lib/extensions/FontWeight.js +22 -14
  52. package/lib/extensions/LineHeight.js +11 -3
  53. package/lib/extensions/Link.js +101 -0
  54. package/lib/extensions/StylePreset.js +4 -2
  55. package/lib/extensions/TextDecoration.js +27 -12
  56. package/lib/extensions/__tests__/Alignment.test.js +11 -5
  57. package/lib/extensions/__tests__/BackgroundColor.test.js +11 -5
  58. package/lib/extensions/__tests__/CaseStyle.test.js +3 -5
  59. package/lib/extensions/__tests__/FontColor.test.js +11 -5
  60. package/lib/extensions/__tests__/FontFamily.test.js +32 -7
  61. package/lib/extensions/__tests__/FontSize.test.js +11 -5
  62. package/lib/extensions/__tests__/FontStyle.test.js +11 -5
  63. package/lib/extensions/__tests__/FontWeight.test.js +11 -5
  64. package/lib/extensions/__tests__/LineHeight.test.js +11 -5
  65. package/lib/extensions/__tests__/StylePreset.test.js +70 -6
  66. package/lib/extensions/__tests__/TextDecoration.test.js +27 -5
  67. package/lib/extensions/__tests__/__snapshots__/Alignment.test.js.snap +26 -2
  68. package/lib/extensions/__tests__/__snapshots__/BackgroundColor.test.js.snap +30 -1
  69. package/lib/extensions/__tests__/__snapshots__/FontColor.test.js.snap +18 -1
  70. package/lib/extensions/__tests__/__snapshots__/FontFamily.test.js.snap +88 -1
  71. package/lib/extensions/__tests__/__snapshots__/FontSize.test.js.snap +33 -2
  72. package/lib/extensions/__tests__/__snapshots__/FontStyle.test.js.snap +25 -4
  73. package/lib/extensions/__tests__/__snapshots__/FontWeight.test.js.snap +30 -1
  74. package/lib/extensions/__tests__/__snapshots__/LineHeight.test.js.snap +26 -2
  75. package/lib/extensions/__tests__/__snapshots__/StylePreset.test.js.snap +6 -2
  76. package/lib/extensions/__tests__/__snapshots__/TextDecoration.test.js.snap +93 -3
  77. package/lib/extensions/core/CopyPasteProcessor.js +10 -0
  78. package/lib/extensions/core/TextProcessor.js +10 -0
  79. package/lib/extensions/core/__tests__/NodeProcessor.test.js +3 -5
  80. package/lib/extensions/core/__tests__/SelectionProcessor.test.js +3 -5
  81. package/lib/extensions/core/__tests__/TextProcessor.test.js +138 -12
  82. package/lib/extensions/core/__tests__/__snapshots__/TextProcessor.test.js.snap +26 -0
  83. package/lib/extensions/core/index.js +11 -2
  84. package/lib/extensions/core/plugins/PastePlugin.js +48 -0
  85. package/lib/extensions/core/plugins/ProseMirrorPlugin.js +20 -0
  86. package/lib/extensions/core/plugins/index.js +1 -0
  87. package/lib/extensions/index.js +41 -34
  88. package/lib/extensions/list/__tests__/List.test.js +3 -5
  89. package/lib/extensions/list/__tests__/__snapshots__/List.test.js.snap +45 -15
  90. package/lib/injectionTokens.js +2 -1
  91. package/lib/services/ContentNormalizer.js +62 -20
  92. package/lib/services/__tests__/ContentNormalizer.test.js +40 -7
  93. package/lib/styles/content.css +17 -9
  94. package/lib/styles/helpers/offsets.css +16 -0
  95. package/lib/styles/variables.css +6 -0
  96. package/lib/utils/__tests__/__snapshots__/renderInlineSetting.test.js.snap +4 -4
  97. package/lib/utils/renderInlineSetting.js +1 -1
  98. package/package.json +11 -9
@@ -2,12 +2,12 @@ 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 { Font } from '../../models';
7
6
  import { FontFamily } from '../FontFamily';
8
7
  import { FontWeight } from '../FontWeight';
9
8
  import { FontStyle } from '../FontStyle';
10
9
  import { ContentNormalizer } from '../../services';
10
+ import { buildCoreExtensions } from '../core';
11
11
 
12
12
  const MockStylePreset = Extension.create({
13
13
  name: 'style_preset',
@@ -25,17 +25,18 @@ const MockStylePreset = Extension.create({
25
25
  });
26
26
 
27
27
  function createEditor({ content }) {
28
- const normalizer = new ContentNormalizer();
29
-
30
28
  return new Editor({
31
- content: normalizer.normalize(content),
32
- extensions: CORE_EXTENSIONS.concat(
29
+ content: ContentNormalizer.normalize(content),
30
+ extensions: buildCoreExtensions().concat(
33
31
  MockStylePreset,
34
32
  FontFamily.configure({
35
33
  fonts: [
36
34
  new Font({ name: 'Lato', styles: ['400', '700', '700i'] }),
37
- new Font({ name: 'Bungee', styles: ['400'] })
38
- ]
35
+ new Font({ name: 'Bungee', styles: ['400'] }),
36
+ new Font({ name: 'Roboto', styles: ['400'] }),
37
+ new Font({ name: 'Josefin Slab', styles: ['400'] })
38
+ ],
39
+ defaultFont: 'Lato'
39
40
  }),
40
41
  FontWeight,
41
42
  FontStyle
@@ -190,6 +191,22 @@ describe('parsing html', () => {
190
191
  expect(editor.getJSON()).toMatchSnapshot();
191
192
  });
192
193
 
194
+ test('should get value from rendered view', () => {
195
+ const editor = createEditor({
196
+ content: '<p><span style="--zw-font-family: Lato">lorem</span> ipsum</p>'
197
+ });
198
+
199
+ expect(editor.getJSON()).toMatchSnapshot();
200
+ });
201
+
202
+ test('should get set default if undefined font', () => {
203
+ const editor = createEditor({
204
+ content: '<p><span style="--zw-font-family: Arial">lorem</span> ipsum</p>'
205
+ });
206
+
207
+ expect(editor.getJSON()).toMatchSnapshot();
208
+ });
209
+
193
210
  test('should merge paragraph and text settings', () => {
194
211
  const editor = createEditor({
195
212
  content: '<p style="font-family: Lato"><span style="font-family: Roboto">lorem</span> ipsum</p>'
@@ -197,4 +214,12 @@ describe('parsing html', () => {
197
214
 
198
215
  expect(editor.getJSON()).toMatchSnapshot();
199
216
  });
217
+
218
+ test('should get parse font name with quotes', () => {
219
+ const editor = createEditor({
220
+ content: '<p>hello <span style="font-family: &quot;Josefin Slab&quot;;">world</span></p>'
221
+ });
222
+
223
+ expect(editor.getJSON()).toMatchSnapshot();
224
+ });
200
225
  });
@@ -2,10 +2,10 @@ 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 { FontSize } from '../FontSize';
7
6
  import { DeviceManager } from '../DeviceManager';
8
7
  import { ContentNormalizer } from '../../services';
8
+ import { buildCoreExtensions } from '../core';
9
9
 
10
10
  const MockStylePreset = Extension.create({
11
11
  name: 'style_preset',
@@ -22,11 +22,9 @@ const MockStylePreset = Extension.create({
22
22
  });
23
23
 
24
24
  function createEditor({ content }) {
25
- const normalizer = new ContentNormalizer();
26
-
27
25
  return new Editor({
28
- content: normalizer.normalize(content),
29
- extensions: CORE_EXTENSIONS.concat(
26
+ content: ContentNormalizer.normalize(content),
27
+ extensions: buildCoreExtensions().concat(
30
28
  MockStylePreset,
31
29
  DeviceManager.configure({
32
30
  deviceRef: ref('desktop')
@@ -202,6 +200,14 @@ describe('parsing html', () => {
202
200
  expect(editor.getJSON()).toMatchSnapshot();
203
201
  });
204
202
 
203
+ test('should get value from rendered view', () => {
204
+ const editor = createEditor({
205
+ content: '<p><span style="--zw-font-size-mobile: 24px; --zw-font-size-desktop:30px">lorem</span> ipsum</p>'
206
+ });
207
+
208
+ expect(editor.getJSON()).toMatchSnapshot();
209
+ });
210
+
205
211
  test('should merge paragraph and text settings', () => {
206
212
  const editor = createEditor({
207
213
  content: '<p style="font-size: 24px"><span style="font-size: 20px">lorem</span> ipsum</p>'
@@ -2,12 +2,12 @@ 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 { FontStyle } from '../FontStyle';
7
6
  import { FontFamily } from '../FontFamily';
8
7
  import { Font } from '../../models';
9
8
  import { FontWeight } from '../FontWeight';
10
9
  import { ContentNormalizer } from '../../services';
10
+ import { buildCoreExtensions } from '../core';
11
11
 
12
12
  const MockStylePreset = Extension.create({
13
13
  name: 'style_preset',
@@ -26,11 +26,9 @@ const MockStylePreset = Extension.create({
26
26
  });
27
27
 
28
28
  function createEditor({ content }) {
29
- const normalizer = new ContentNormalizer();
30
-
31
29
  return new Editor({
32
- content: normalizer.normalize(content),
33
- extensions: CORE_EXTENSIONS.concat(
30
+ content: ContentNormalizer.normalize(content),
31
+ extensions: buildCoreExtensions().concat(
34
32
  MockStylePreset,
35
33
  FontStyle,
36
34
  FontWeight,
@@ -155,6 +153,14 @@ describe('parsing html', () => {
155
153
  expect(editor.getJSON()).toMatchSnapshot();
156
154
  });
157
155
 
156
+ test('should get value from rendered view', () => {
157
+ const editor = createEditor({
158
+ content: '<p><span style="--zw-font-style: italic">lorem</span> ipsum</p>'
159
+ });
160
+
161
+ expect(editor.getJSON()).toMatchSnapshot();
162
+ });
163
+
158
164
  test('should get value from i tag', () => {
159
165
  const editor = createEditor({
160
166
  content: '<p><i>lorem</i> ipsum</p>'
@@ -2,12 +2,12 @@ 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 { Font } from '../../models';
7
6
  import { FontWeight } from '../FontWeight';
8
7
  import { FontFamily } from '../FontFamily';
9
8
  import { FontStyle } from '../FontStyle';
10
9
  import { ContentNormalizer } from '../../services';
10
+ import { buildCoreExtensions } from '../core';
11
11
 
12
12
  const MockStylePreset = Extension.create({
13
13
  name: 'style_preset',
@@ -25,11 +25,9 @@ const MockStylePreset = Extension.create({
25
25
  });
26
26
 
27
27
  function createEditor({ content }) {
28
- const normalizer = new ContentNormalizer();
29
-
30
28
  return new Editor({
31
- content: normalizer.normalize(content),
32
- extensions: CORE_EXTENSIONS.concat(
29
+ content: ContentNormalizer.normalize(content),
30
+ extensions: buildCoreExtensions().concat(
33
31
  MockStylePreset,
34
32
  FontFamily.configure({
35
33
  fonts: [
@@ -182,6 +180,14 @@ describe('parsing html', () => {
182
180
  expect(editor.getJSON()).toMatchSnapshot();
183
181
  });
184
182
 
183
+ test('should get value from rendered view', () => {
184
+ const editor = createEditor({
185
+ content: '<p><span style="--zw-font-weight: 700">lorem</span> ipsum</p>'
186
+ });
187
+
188
+ expect(editor.getJSON()).toMatchSnapshot();
189
+ });
190
+
185
191
  test('should get value from b tag', () => {
186
192
  const editor = createEditor({
187
193
  content: '<p><b>lorem</b> ipsum</p>'
@@ -2,10 +2,10 @@ 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 { DeviceManager } from '../DeviceManager';
7
6
  import { LineHeight } from '../LineHeight';
8
7
  import { ContentNormalizer } from '../../services';
8
+ import { buildCoreExtensions } from '../core';
9
9
 
10
10
  const MockStylePreset = Extension.create({
11
11
  name: 'style_preset',
@@ -22,11 +22,9 @@ const MockStylePreset = Extension.create({
22
22
  });
23
23
 
24
24
  function createEditor({ content }) {
25
- const normalizer = new ContentNormalizer();
26
-
27
25
  return new Editor({
28
- content: normalizer.normalize(content),
29
- extensions: CORE_EXTENSIONS.concat(
26
+ content: ContentNormalizer.normalize(content),
27
+ extensions: buildCoreExtensions().concat(
30
28
  MockStylePreset,
31
29
  DeviceManager.configure({ deviceRef: ref('desktop') }),
32
30
  LineHeight
@@ -136,6 +134,14 @@ describe('parsing html', () => {
136
134
  global.document.body.style.removeProperty('font-size');
137
135
  });
138
136
 
137
+ test('should get value from rendered view', () => {
138
+ const editor = createEditor({
139
+ content: '<p style="--zw-line-height-mobile:1.2;--zw-line-height-desktop:1.4">test</p>'
140
+ });
141
+
142
+ expect(editor.getJSON()).toMatchSnapshot();
143
+ });
144
+
139
145
  test('should set null if no alignment', () => {
140
146
  const editor = createEditor({
141
147
  content: '<p>test</p>'
@@ -1,11 +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';
8
7
  import { ContentNormalizer } from '../../services';
8
+ import { buildCoreExtensions } from '../core';
9
9
 
10
10
  const MockFontSize = Mark.create({
11
11
  name: TextSettings.FONT_SIZE,
@@ -43,15 +43,73 @@ const MockAlignment = Extension.create({
43
43
  ]
44
44
  });
45
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
+
46
106
  function createEditor({ content, presets, defaultId }) {
47
107
  return new Promise((resolve) => {
48
- const normalizer = new ContentNormalizer();
49
-
50
108
  const editor = new Editor({
51
- content: normalizer.normalize(content),
109
+ content: ContentNormalizer.normalize(content),
52
110
  onCreate: () => resolve(editor),
53
111
 
54
- extensions: CORE_EXTENSIONS.concat(
112
+ extensions: buildCoreExtensions().concat(
55
113
  StylePreset.configure({
56
114
  presetsRef: ref(presets),
57
115
  baseClass: 'zw ts-',
@@ -68,7 +126,13 @@ function createEditor({ content, presets, defaultId }) {
68
126
  }),
69
127
  MockFontSize,
70
128
  MockFontWeight,
71
- MockAlignment
129
+ MockAlignment,
130
+ MockBackgroundColor,
131
+ MockFontColor,
132
+ MockFontFamily,
133
+ MockFontStyle,
134
+ MockTextDecoration,
135
+ MockSuperscript
72
136
  )
73
137
  });
74
138
  });
@@ -2,9 +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';
7
6
  import { ContentNormalizer } from '../../services';
7
+ import { buildCoreExtensions } from '../core';
8
8
 
9
9
  const MockStylePreset = Extension.create({
10
10
  name: 'style_preset',
@@ -19,11 +19,9 @@ const MockStylePreset = Extension.create({
19
19
  });
20
20
 
21
21
  function createEditor({ content }) {
22
- const normalizer = new ContentNormalizer();
23
-
24
22
  return new Editor({
25
- content: normalizer.normalize(content),
26
- extensions: CORE_EXTENSIONS.concat(MockStylePreset, TextDecoration)
23
+ content: ContentNormalizer.normalize(content),
24
+ extensions: buildCoreExtensions().concat(MockStylePreset, TextDecoration)
27
25
  });
28
26
  }
29
27
 
@@ -294,6 +292,14 @@ describe('parsing html', () => {
294
292
  expect(editor.getJSON()).toMatchSnapshot();
295
293
  });
296
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
+
297
303
  test('should get strike through from text', () => {
298
304
  const editor = createEditor({
299
305
  content: '<p><span style="text-decoration-line: line-through">lorem</span> ipsum</p>'
@@ -302,6 +308,14 @@ describe('parsing html', () => {
302
308
  expect(editor.getJSON()).toMatchSnapshot();
303
309
  });
304
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
+
305
319
  test('should get both from text', () => {
306
320
  const editor = createEditor({
307
321
  content: '<p><span style="text-decoration-line: underline line-through">lorem</span> ipsum</p>'
@@ -310,6 +324,14 @@ describe('parsing html', () => {
310
324
  expect(editor.getJSON()).toMatchSnapshot();
311
325
  });
312
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
+
313
335
  test('should merge paragraph and text settings', () => {
314
336
  const editor = createEditor({
315
337
  content: '<p style="text-decoration-line: underline"><span style="text-decoration-line: line-through">lorem</span> ipsum</p>'
@@ -24,6 +24,30 @@ Object {
24
24
  }
25
25
  `;
26
26
 
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
+
27
51
  exports[`parsing html should get alignment from text 1`] = `
28
52
  Object {
29
53
  "content": Array [
@@ -68,6 +92,6 @@ Object {
68
92
  }
69
93
  `;
70
94
 
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>"`;
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>"`;
72
96
 
73
- 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>"`;
@@ -50,6 +50,35 @@ Object {
50
50
  }
51
51
  `;
52
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
+
53
82
  exports[`parsing html should get value from text 1`] = `
54
83
  Object {
55
84
  "content": Array [
@@ -116,4 +145,4 @@ Object {
116
145
  }
117
146
  `;
118
147
 
119
- exports[`rendering should render html 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-background-color: green;\\" class=\\"zw-style\\">hello world</span></p>"`;
148
+ exports[`rendering should render html 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-background-color:green;\\" class=\\"zw-style\\">hello world</span></p>"`;
@@ -50,6 +50,23 @@ Object {
50
50
  }
51
51
  `;
52
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
+
53
70
  exports[`parsing html should get value from text 1`] = `
54
71
  Object {
55
72
  "content": Array [
@@ -116,4 +133,4 @@ Object {
116
133
  }
117
134
  `;
118
135
 
119
- exports[`rendering should render html 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-font-color: green;\\" class=\\"zw-style\\">hello world</span></p>"`;
136
+ exports[`rendering should render html 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-font-color:green;\\" class=\\"zw-style\\">hello world</span></p>"`;
@@ -155,6 +155,64 @@ Object {
155
155
  }
156
156
  `;
157
157
 
158
+ exports[`parsing html should get parse font name with quotes 1`] = `
159
+ Object {
160
+ "content": Array [
161
+ Object {
162
+ "content": Array [
163
+ Object {
164
+ "text": "hello ",
165
+ "type": "text",
166
+ },
167
+ Object {
168
+ "marks": Array [
169
+ Object {
170
+ "attrs": Object {
171
+ "value": "Josefin Slab",
172
+ },
173
+ "type": "font_family",
174
+ },
175
+ ],
176
+ "text": "world",
177
+ "type": "text",
178
+ },
179
+ ],
180
+ "type": "paragraph",
181
+ },
182
+ ],
183
+ "type": "doc",
184
+ }
185
+ `;
186
+
187
+ exports[`parsing html should get set default if undefined font 1`] = `
188
+ Object {
189
+ "content": Array [
190
+ Object {
191
+ "content": Array [
192
+ Object {
193
+ "marks": Array [
194
+ Object {
195
+ "attrs": Object {
196
+ "value": "Lato",
197
+ },
198
+ "type": "font_family",
199
+ },
200
+ ],
201
+ "text": "lorem",
202
+ "type": "text",
203
+ },
204
+ Object {
205
+ "text": " ipsum",
206
+ "type": "text",
207
+ },
208
+ ],
209
+ "type": "paragraph",
210
+ },
211
+ ],
212
+ "type": "doc",
213
+ }
214
+ `;
215
+
158
216
  exports[`parsing html should get value from paragraph 1`] = `
159
217
  Object {
160
218
  "content": Array [
@@ -180,6 +238,35 @@ Object {
180
238
  }
181
239
  `;
182
240
 
241
+ exports[`parsing html should get value from rendered view 1`] = `
242
+ Object {
243
+ "content": Array [
244
+ Object {
245
+ "content": Array [
246
+ Object {
247
+ "marks": Array [
248
+ Object {
249
+ "attrs": Object {
250
+ "value": "Lato",
251
+ },
252
+ "type": "font_family",
253
+ },
254
+ ],
255
+ "text": "lorem",
256
+ "type": "text",
257
+ },
258
+ Object {
259
+ "text": " ipsum",
260
+ "type": "text",
261
+ },
262
+ ],
263
+ "type": "paragraph",
264
+ },
265
+ ],
266
+ "type": "doc",
267
+ }
268
+ `;
269
+
183
270
  exports[`parsing html should get value from text 1`] = `
184
271
  Object {
185
272
  "content": Array [
@@ -246,4 +333,4 @@ Object {
246
333
  }
247
334
  `;
248
335
 
249
- exports[`rendering should render html 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-font-family: Bungee;\\" class=\\"zw-style\\">hello world</span></p>"`;
336
+ exports[`rendering should render html 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-font-family:&quot;Bungee&quot;;\\" class=\\"zw-style\\">hello world</span></p>"`;
@@ -162,6 +162,37 @@ Object {
162
162
  }
163
163
  `;
164
164
 
165
+ exports[`parsing html should get value from rendered view 1`] = `
166
+ Object {
167
+ "content": Array [
168
+ Object {
169
+ "content": Array [
170
+ Object {
171
+ "marks": Array [
172
+ Object {
173
+ "attrs": Object {
174
+ "desktop": "30",
175
+ "mobile": "24",
176
+ "tablet": null,
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
+
165
196
  exports[`parsing html should get value from text 1`] = `
166
197
  Object {
167
198
  "content": Array [
@@ -234,6 +265,6 @@ Object {
234
265
  }
235
266
  `;
236
267
 
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>"`;
268
+ exports[`rendering should render all devices 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-font-size-mobile:12px;--zw-font-size-tablet:14px;--zw-font-size-desktop:16px;\\" class=\\"zw-style\\">hello world</span></p>"`;
238
269
 
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>"`;
270
+ exports[`rendering should render only desktop 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-font-size-desktop:14px;\\" class=\\"zw-style\\">hello world</span></p>"`;