@zipify/wysiwyg 1.2.5 → 2.0.0-0

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 (62) hide show
  1. package/dist/cli.js +2 -2
  2. package/dist/wysiwyg.mjs +421 -274
  3. package/lib/__tests__/utils/buildTestExtensions.js +14 -0
  4. package/lib/__tests__/utils/index.js +1 -0
  5. package/lib/components/toolbar/controls/SuperscriptControl.vue +2 -2
  6. package/lib/components/toolbar/controls/__tests__/SuperscriptControl.test.js +2 -2
  7. package/lib/composables/__tests__/useEditor.test.js +2 -2
  8. package/lib/extensions/BackgroundColor.js +4 -4
  9. package/lib/extensions/FontColor.js +4 -5
  10. package/lib/extensions/FontFamily.js +4 -5
  11. package/lib/extensions/FontSize.js +5 -7
  12. package/lib/extensions/FontStyle.js +13 -11
  13. package/lib/extensions/FontWeight.js +6 -9
  14. package/lib/extensions/StylePreset.js +0 -8
  15. package/lib/extensions/Superscript.js +23 -1
  16. package/lib/extensions/TextDecoration.js +33 -13
  17. package/lib/extensions/__tests__/Alignment.test.js +10 -7
  18. package/lib/extensions/__tests__/BackgroundColor.test.js +6 -3
  19. package/lib/extensions/__tests__/CaseStyle.test.js +11 -7
  20. package/lib/extensions/__tests__/FontColor.test.js +6 -3
  21. package/lib/extensions/__tests__/FontFamily.test.js +29 -22
  22. package/lib/extensions/__tests__/FontSize.test.js +24 -17
  23. package/lib/extensions/__tests__/FontStyle.test.js +22 -16
  24. package/lib/extensions/__tests__/FontWeight.test.js +26 -19
  25. package/lib/extensions/__tests__/LineHeight.test.js +14 -11
  26. package/lib/extensions/__tests__/Link.test.js +14 -10
  27. package/lib/extensions/__tests__/Margin.test.js +2 -2
  28. package/lib/extensions/__tests__/StylePreset.test.js +49 -49
  29. package/lib/extensions/__tests__/TextDecoration.test.js +72 -26
  30. package/lib/extensions/__tests__/__snapshots__/BackgroundColor.test.js.snap +24 -24
  31. package/lib/extensions/__tests__/__snapshots__/FontColor.test.js.snap +24 -24
  32. package/lib/extensions/__tests__/__snapshots__/FontFamily.test.js.snap +86 -82
  33. package/lib/extensions/__tests__/__snapshots__/FontSize.test.js.snap +70 -70
  34. package/lib/extensions/__tests__/__snapshots__/FontStyle.test.js.snap +53 -45
  35. package/lib/extensions/__tests__/__snapshots__/FontWeight.test.js.snap +64 -60
  36. package/lib/extensions/__tests__/__snapshots__/TextDecoration.test.js.snap +148 -83
  37. package/lib/extensions/core/Document.js +5 -0
  38. package/lib/extensions/core/Heading.js +10 -0
  39. package/lib/extensions/core/NodeProcessor.js +84 -4
  40. package/lib/extensions/core/Paragraph.js +9 -0
  41. package/lib/extensions/core/TextProcessor.js +10 -12
  42. package/lib/extensions/core/__tests__/NodeProcessor.test.js +82 -10
  43. package/lib/extensions/core/__tests__/SelectionProcessor.test.js +2 -2
  44. package/lib/extensions/core/__tests__/TextProcessor.test.js +18 -20
  45. package/lib/extensions/core/__tests__/__snapshots__/NodeProcessor.test.js.snap +132 -0
  46. package/lib/extensions/core/index.js +5 -5
  47. package/lib/extensions/core/steps/AddNodeMarkStep.js +60 -0
  48. package/lib/extensions/core/steps/RemoveNodeMarkStep.js +50 -0
  49. package/lib/extensions/core/steps/index.js +2 -0
  50. package/lib/extensions/list/List.js +1 -0
  51. package/lib/extensions/list/ListItem.js +5 -0
  52. package/lib/extensions/list/__tests__/List.test.js +30 -25
  53. package/lib/services/ContentNormalizer.js +1 -100
  54. package/lib/services/NodeFactory.js +16 -6
  55. package/lib/services/__tests__/ContentNormalizer.test.js +0 -64
  56. package/lib/utils/findMarkByType.js +5 -0
  57. package/lib/utils/index.js +5 -0
  58. package/lib/utils/isMarkAppliedToParent.js +15 -0
  59. package/lib/utils/isNodeFullySelected.js +10 -0
  60. package/lib/utils/resolveNodePosition.js +6 -0
  61. package/lib/utils/resolveTextPosition.js +6 -0
  62. package/package.json +1 -1
@@ -6,20 +6,20 @@ Object {
6
6
  Object {
7
7
  "content": Array [
8
8
  Object {
9
- "marks": Array [
10
- Object {
11
- "attrs": Object {
12
- "desktop": "16",
13
- "mobile": null,
14
- "tablet": "16",
15
- },
16
- "type": "font_size",
17
- },
18
- ],
19
9
  "text": "hello world",
20
10
  "type": "text",
21
11
  },
22
12
  ],
13
+ "marks": Array [
14
+ Object {
15
+ "attrs": Object {
16
+ "desktop": "16",
17
+ "mobile": null,
18
+ "tablet": "16",
19
+ },
20
+ "type": "font_size",
21
+ },
22
+ ],
23
23
  "type": "paragraph",
24
24
  },
25
25
  ],
@@ -33,20 +33,20 @@ Object {
33
33
  Object {
34
34
  "content": Array [
35
35
  Object {
36
- "marks": Array [
37
- Object {
38
- "attrs": Object {
39
- "desktop": "13",
40
- "mobile": null,
41
- "tablet": "13",
42
- },
43
- "type": "font_size",
44
- },
45
- ],
46
36
  "text": "hello world",
47
37
  "type": "text",
48
38
  },
49
39
  ],
40
+ "marks": Array [
41
+ Object {
42
+ "attrs": Object {
43
+ "desktop": "13",
44
+ "mobile": null,
45
+ "tablet": "13",
46
+ },
47
+ "type": "font_size",
48
+ },
49
+ ],
50
50
  "type": "paragraph",
51
51
  },
52
52
  ],
@@ -60,20 +60,20 @@ Object {
60
60
  Object {
61
61
  "content": Array [
62
62
  Object {
63
- "marks": Array [
64
- Object {
65
- "attrs": Object {
66
- "desktop": "15",
67
- "mobile": null,
68
- "tablet": "15",
69
- },
70
- "type": "font_size",
71
- },
72
- ],
73
63
  "text": "hello world",
74
64
  "type": "text",
75
65
  },
76
66
  ],
67
+ "marks": Array [
68
+ Object {
69
+ "attrs": Object {
70
+ "desktop": "15",
71
+ "mobile": null,
72
+ "tablet": "15",
73
+ },
74
+ "type": "font_size",
75
+ },
76
+ ],
77
77
  "type": "paragraph",
78
78
  },
79
79
  ],
@@ -87,20 +87,20 @@ Object {
87
87
  Object {
88
88
  "content": Array [
89
89
  Object {
90
- "marks": Array [
91
- Object {
92
- "attrs": Object {
93
- "desktop": "5",
94
- "mobile": null,
95
- "tablet": "5",
96
- },
97
- "type": "font_size",
98
- },
99
- ],
100
90
  "text": "hello world",
101
91
  "type": "text",
102
92
  },
103
93
  ],
94
+ "marks": Array [
95
+ Object {
96
+ "attrs": Object {
97
+ "desktop": "5",
98
+ "mobile": null,
99
+ "tablet": "5",
100
+ },
101
+ "type": "font_size",
102
+ },
103
+ ],
104
104
  "type": "paragraph",
105
105
  },
106
106
  ],
@@ -114,20 +114,20 @@ Object {
114
114
  Object {
115
115
  "content": Array [
116
116
  Object {
117
- "marks": Array [
118
- Object {
119
- "attrs": Object {
120
- "desktop": "20",
121
- "mobile": null,
122
- "tablet": "20",
123
- },
124
- "type": "font_size",
125
- },
126
- ],
127
117
  "text": "hello world",
128
118
  "type": "text",
129
119
  },
130
120
  ],
121
+ "marks": Array [
122
+ Object {
123
+ "attrs": Object {
124
+ "desktop": "20",
125
+ "mobile": null,
126
+ "tablet": "20",
127
+ },
128
+ "type": "font_size",
129
+ },
130
+ ],
131
131
  "type": "paragraph",
132
132
  },
133
133
  ],
@@ -141,20 +141,20 @@ Object {
141
141
  Object {
142
142
  "content": Array [
143
143
  Object {
144
- "marks": Array [
145
- Object {
146
- "attrs": Object {
147
- "desktop": "24",
148
- "mobile": null,
149
- "tablet": "24",
150
- },
151
- "type": "font_size",
152
- },
153
- ],
154
144
  "text": "test",
155
145
  "type": "text",
156
146
  },
157
147
  ],
148
+ "marks": Array [
149
+ Object {
150
+ "attrs": Object {
151
+ "desktop": "24",
152
+ "mobile": null,
153
+ "tablet": "24",
154
+ },
155
+ "type": "font_size",
156
+ },
157
+ ],
158
158
  "type": "paragraph",
159
159
  },
160
160
  ],
@@ -244,20 +244,20 @@ Object {
244
244
  "type": "text",
245
245
  },
246
246
  Object {
247
- "marks": Array [
248
- Object {
249
- "attrs": Object {
250
- "desktop": "24",
251
- "mobile": null,
252
- "tablet": "24",
253
- },
254
- "type": "font_size",
255
- },
256
- ],
257
247
  "text": " ipsum",
258
248
  "type": "text",
259
249
  },
260
250
  ],
251
+ "marks": Array [
252
+ Object {
253
+ "attrs": Object {
254
+ "desktop": "24",
255
+ "mobile": null,
256
+ "tablet": "24",
257
+ },
258
+ "type": "font_size",
259
+ },
260
+ ],
261
261
  "type": "paragraph",
262
262
  },
263
263
  ],
@@ -6,18 +6,18 @@ Object {
6
6
  Object {
7
7
  "content": Array [
8
8
  Object {
9
- "marks": Array [
10
- Object {
11
- "attrs": Object {
12
- "italic": true,
13
- },
14
- "type": "font_style",
15
- },
16
- ],
17
9
  "text": "hello world",
18
10
  "type": "text",
19
11
  },
20
12
  ],
13
+ "marks": Array [
14
+ Object {
15
+ "attrs": Object {
16
+ "italic": true,
17
+ },
18
+ "type": "font_style",
19
+ },
20
+ ],
21
21
  "type": "paragraph",
22
22
  },
23
23
  ],
@@ -31,18 +31,18 @@ Object {
31
31
  Object {
32
32
  "content": Array [
33
33
  Object {
34
- "marks": Array [
35
- Object {
36
- "attrs": Object {
37
- "italic": false,
38
- },
39
- "type": "font_style",
40
- },
41
- ],
42
34
  "text": "hello world",
43
35
  "type": "text",
44
36
  },
45
37
  ],
38
+ "marks": Array [
39
+ Object {
40
+ "attrs": Object {
41
+ "italic": false,
42
+ },
43
+ "type": "font_style",
44
+ },
45
+ ],
46
46
  "type": "paragraph",
47
47
  },
48
48
  ],
@@ -56,18 +56,18 @@ Object {
56
56
  Object {
57
57
  "content": Array [
58
58
  Object {
59
- "marks": Array [
60
- Object {
61
- "attrs": Object {
62
- "italic": false,
63
- },
64
- "type": "font_style",
65
- },
66
- ],
67
59
  "text": "hello world",
68
60
  "type": "text",
69
61
  },
70
62
  ],
63
+ "marks": Array [
64
+ Object {
65
+ "attrs": Object {
66
+ "italic": false,
67
+ },
68
+ "type": "font_style",
69
+ },
70
+ ],
71
71
  "type": "paragraph",
72
72
  },
73
73
  ],
@@ -81,18 +81,18 @@ Object {
81
81
  Object {
82
82
  "content": Array [
83
83
  Object {
84
- "marks": Array [
85
- Object {
86
- "attrs": Object {
87
- "italic": true,
88
- },
89
- "type": "font_style",
90
- },
91
- ],
92
84
  "text": "hello world",
93
85
  "type": "text",
94
86
  },
95
87
  ],
88
+ "marks": Array [
89
+ Object {
90
+ "attrs": Object {
91
+ "italic": true,
92
+ },
93
+ "type": "font_style",
94
+ },
95
+ ],
96
96
  "type": "paragraph",
97
97
  },
98
98
  ],
@@ -135,18 +135,18 @@ Object {
135
135
  Object {
136
136
  "content": Array [
137
137
  Object {
138
- "marks": Array [
139
- Object {
140
- "attrs": Object {
141
- "italic": true,
142
- },
143
- "type": "font_style",
144
- },
145
- ],
146
138
  "text": "test",
147
139
  "type": "text",
148
140
  },
149
141
  ],
142
+ "marks": Array [
143
+ Object {
144
+ "attrs": Object {
145
+ "italic": true,
146
+ },
147
+ "type": "font_style",
148
+ },
149
+ ],
150
150
  "type": "paragraph",
151
151
  },
152
152
  ],
@@ -217,23 +217,31 @@ Object {
217
217
  "content": Array [
218
218
  Object {
219
219
  "content": Array [
220
- Object {
221
- "text": "lorem",
222
- "type": "text",
223
- },
224
220
  Object {
225
221
  "marks": Array [
226
222
  Object {
227
223
  "attrs": Object {
228
- "italic": true,
224
+ "italic": false,
229
225
  },
230
226
  "type": "font_style",
231
227
  },
232
228
  ],
229
+ "text": "lorem",
230
+ "type": "text",
231
+ },
232
+ Object {
233
233
  "text": " ipsum",
234
234
  "type": "text",
235
235
  },
236
236
  ],
237
+ "marks": Array [
238
+ Object {
239
+ "attrs": Object {
240
+ "italic": true,
241
+ },
242
+ "type": "font_style",
243
+ },
244
+ ],
237
245
  "type": "paragraph",
238
246
  },
239
247
  ],
@@ -6,18 +6,18 @@ Object {
6
6
  Object {
7
7
  "content": Array [
8
8
  Object {
9
- "marks": Array [
10
- Object {
11
- "attrs": Object {
12
- "value": "700",
13
- },
14
- "type": "font_weight",
15
- },
16
- ],
17
9
  "text": "hello world",
18
10
  "type": "text",
19
11
  },
20
12
  ],
13
+ "marks": Array [
14
+ Object {
15
+ "attrs": Object {
16
+ "value": "700",
17
+ },
18
+ "type": "font_weight",
19
+ },
20
+ ],
21
21
  "type": "paragraph",
22
22
  },
23
23
  ],
@@ -31,18 +31,18 @@ Object {
31
31
  Object {
32
32
  "content": Array [
33
33
  Object {
34
- "marks": Array [
35
- Object {
36
- "attrs": Object {
37
- "value": "700",
38
- },
39
- "type": "font_weight",
40
- },
41
- ],
42
34
  "text": "hello world",
43
35
  "type": "text",
44
36
  },
45
37
  ],
38
+ "marks": Array [
39
+ Object {
40
+ "attrs": Object {
41
+ "value": "700",
42
+ },
43
+ "type": "font_weight",
44
+ },
45
+ ],
46
46
  "type": "paragraph",
47
47
  },
48
48
  ],
@@ -63,17 +63,19 @@ Object {
63
63
  },
64
64
  "type": "font_family",
65
65
  },
66
- Object {
67
- "attrs": Object {
68
- "value": "800",
69
- },
70
- "type": "font_weight",
71
- },
72
66
  ],
73
67
  "text": "hello world",
74
68
  "type": "text",
75
69
  },
76
70
  ],
71
+ "marks": Array [
72
+ Object {
73
+ "attrs": Object {
74
+ "value": "800",
75
+ },
76
+ "type": "font_weight",
77
+ },
78
+ ],
77
79
  "type": "paragraph",
78
80
  },
79
81
  ],
@@ -94,17 +96,19 @@ Object {
94
96
  },
95
97
  "type": "font_family",
96
98
  },
97
- Object {
98
- "attrs": Object {
99
- "value": "300",
100
- },
101
- "type": "font_weight",
102
- },
103
99
  ],
104
100
  "text": "hello world",
105
101
  "type": "text",
106
102
  },
107
103
  ],
104
+ "marks": Array [
105
+ Object {
106
+ "attrs": Object {
107
+ "value": "300",
108
+ },
109
+ "type": "font_weight",
110
+ },
111
+ ],
108
112
  "type": "paragraph",
109
113
  },
110
114
  ],
@@ -118,18 +122,18 @@ Object {
118
122
  Object {
119
123
  "content": Array [
120
124
  Object {
121
- "marks": Array [
122
- Object {
123
- "attrs": Object {
124
- "value": "400",
125
- },
126
- "type": "font_weight",
127
- },
128
- ],
129
125
  "text": "hello world",
130
126
  "type": "text",
131
127
  },
132
128
  ],
129
+ "marks": Array [
130
+ Object {
131
+ "attrs": Object {
132
+ "value": "400",
133
+ },
134
+ "type": "font_weight",
135
+ },
136
+ ],
133
137
  "type": "paragraph",
134
138
  },
135
139
  ],
@@ -172,18 +176,18 @@ Object {
172
176
  Object {
173
177
  "content": Array [
174
178
  Object {
175
- "marks": Array [
176
- Object {
177
- "attrs": Object {
178
- "value": "700",
179
- },
180
- "type": "font_weight",
181
- },
182
- ],
183
179
  "text": "test",
184
180
  "type": "text",
185
181
  },
186
182
  ],
183
+ "marks": Array [
184
+ Object {
185
+ "attrs": Object {
186
+ "value": "700",
187
+ },
188
+ "type": "font_weight",
189
+ },
190
+ ],
187
191
  "type": "paragraph",
188
192
  },
189
193
  ],
@@ -313,18 +317,18 @@ Object {
313
317
  "type": "text",
314
318
  },
315
319
  Object {
316
- "marks": Array [
317
- Object {
318
- "attrs": Object {
319
- "value": "500",
320
- },
321
- "type": "font_weight",
322
- },
323
- ],
324
320
  "text": " ipsum",
325
321
  "type": "text",
326
322
  },
327
323
  ],
324
+ "marks": Array [
325
+ Object {
326
+ "attrs": Object {
327
+ "value": "500",
328
+ },
329
+ "type": "font_weight",
330
+ },
331
+ ],
328
332
  "type": "paragraph",
329
333
  },
330
334
  ],
@@ -338,18 +342,18 @@ Object {
338
342
  Object {
339
343
  "content": Array [
340
344
  Object {
341
- "marks": Array [
342
- Object {
343
- "attrs": Object {
344
- "value": "700",
345
- },
346
- "type": "font_weight",
347
- },
348
- ],
349
345
  "text": "test",
350
346
  "type": "text",
351
347
  },
352
348
  ],
349
+ "marks": Array [
350
+ Object {
351
+ "attrs": Object {
352
+ "value": "700",
353
+ },
354
+ "type": "font_weight",
355
+ },
356
+ ],
353
357
  "type": "paragraph",
354
358
  },
355
359
  ],