@zipify/wysiwyg 1.0.0-dev.16 → 1.0.0-dev.19

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/.github/dependabot.yaml +1 -0
  2. package/dist/wysiwyg.css +293 -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 +16 -6
  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 +3 -1
  23. package/lib/components/toolbar/Toolbar.vue +48 -8
  24. package/lib/components/toolbar/ToolbarFull.vue +10 -2
  25. package/lib/components/toolbar/__tests__/Toolbar.test.js +6 -0
  26. package/lib/components/toolbar/controls/FontSizeControl.vue +7 -0
  27. package/lib/components/toolbar/controls/UnderlineControl.vue +2 -2
  28. package/lib/components/toolbar/controls/__tests__/UnderlineControl.test.js +4 -0
  29. package/lib/components/toolbar/controls/index.js +1 -0
  30. package/lib/components/toolbar/controls/link/LinkControl.vue +152 -0
  31. package/lib/components/toolbar/controls/link/LinkControlApply.vue +35 -0
  32. package/lib/components/toolbar/controls/link/LinkControlHeader.vue +67 -0
  33. package/lib/components/toolbar/controls/link/composables/index.js +1 -0
  34. package/lib/components/toolbar/controls/link/composables/useLink.js +61 -0
  35. package/lib/components/toolbar/controls/link/destination/LinkControlDestination.vue +103 -0
  36. package/lib/components/toolbar/controls/link/destination/LinkControlPageBlock.vue +54 -0
  37. package/lib/components/toolbar/controls/link/destination/LinkControlUrl.vue +52 -0
  38. package/lib/components/toolbar/controls/link/destination/index.js +1 -0
  39. package/lib/components/toolbar/controls/link/index.js +1 -0
  40. package/lib/composables/__tests__/useEditor.test.js +2 -2
  41. package/lib/composables/useEditor.js +4 -5
  42. package/lib/composables/useToolbar.js +15 -19
  43. package/lib/enums/LinkDestinations.js +4 -0
  44. package/lib/enums/LinkTargets.js +4 -0
  45. package/lib/enums/TextSettings.js +3 -1
  46. package/lib/enums/index.js +2 -0
  47. package/lib/extensions/Alignment.js +18 -6
  48. package/lib/extensions/BackgroundColor.js +14 -6
  49. package/lib/extensions/FontColor.js +14 -6
  50. package/lib/extensions/FontFamily.js +25 -8
  51. package/lib/extensions/FontSize.js +26 -13
  52. package/lib/extensions/FontStyle.js +23 -13
  53. package/lib/extensions/FontWeight.js +22 -14
  54. package/lib/extensions/LineHeight.js +11 -3
  55. package/lib/extensions/Link.js +101 -0
  56. package/lib/extensions/StylePreset.js +4 -2
  57. package/lib/extensions/TextDecoration.js +27 -12
  58. package/lib/extensions/__tests__/Alignment.test.js +11 -5
  59. package/lib/extensions/__tests__/BackgroundColor.test.js +11 -5
  60. package/lib/extensions/__tests__/CaseStyle.test.js +3 -5
  61. package/lib/extensions/__tests__/FontColor.test.js +11 -5
  62. package/lib/extensions/__tests__/FontFamily.test.js +32 -7
  63. package/lib/extensions/__tests__/FontSize.test.js +11 -5
  64. package/lib/extensions/__tests__/FontStyle.test.js +11 -5
  65. package/lib/extensions/__tests__/FontWeight.test.js +11 -5
  66. package/lib/extensions/__tests__/LineHeight.test.js +11 -5
  67. package/lib/extensions/__tests__/StylePreset.test.js +70 -6
  68. package/lib/extensions/__tests__/TextDecoration.test.js +27 -5
  69. package/lib/extensions/__tests__/__snapshots__/Alignment.test.js.snap +26 -2
  70. package/lib/extensions/__tests__/__snapshots__/BackgroundColor.test.js.snap +30 -1
  71. package/lib/extensions/__tests__/__snapshots__/FontColor.test.js.snap +18 -1
  72. package/lib/extensions/__tests__/__snapshots__/FontFamily.test.js.snap +88 -1
  73. package/lib/extensions/__tests__/__snapshots__/FontSize.test.js.snap +33 -2
  74. package/lib/extensions/__tests__/__snapshots__/FontStyle.test.js.snap +25 -4
  75. package/lib/extensions/__tests__/__snapshots__/FontWeight.test.js.snap +30 -1
  76. package/lib/extensions/__tests__/__snapshots__/LineHeight.test.js.snap +26 -2
  77. package/lib/extensions/__tests__/__snapshots__/StylePreset.test.js.snap +6 -2
  78. package/lib/extensions/__tests__/__snapshots__/TextDecoration.test.js.snap +93 -3
  79. package/lib/extensions/core/CopyPasteProcessor.js +10 -0
  80. package/lib/extensions/core/TextProcessor.js +10 -0
  81. package/lib/extensions/core/__tests__/NodeProcessor.test.js +3 -5
  82. package/lib/extensions/core/__tests__/SelectionProcessor.test.js +3 -5
  83. package/lib/extensions/core/__tests__/TextProcessor.test.js +138 -12
  84. package/lib/extensions/core/__tests__/__snapshots__/TextProcessor.test.js.snap +26 -0
  85. package/lib/extensions/core/index.js +11 -2
  86. package/lib/extensions/core/plugins/PastePlugin.js +48 -0
  87. package/lib/extensions/core/plugins/ProseMirrorPlugin.js +20 -0
  88. package/lib/extensions/core/plugins/index.js +1 -0
  89. package/lib/extensions/index.js +41 -34
  90. package/lib/extensions/list/__tests__/List.test.js +3 -5
  91. package/lib/extensions/list/__tests__/__snapshots__/List.test.js.snap +45 -15
  92. package/lib/injectionTokens.js +2 -1
  93. package/lib/services/ContentNormalizer.js +62 -20
  94. package/lib/services/__tests__/ContentNormalizer.test.js +40 -7
  95. package/lib/styles/content.css +96 -9
  96. package/lib/styles/helpers/offsets.css +16 -0
  97. package/lib/styles/variables.css +6 -0
  98. package/lib/utils/__tests__/__snapshots__/renderInlineSetting.test.js.snap +4 -4
  99. package/lib/utils/renderInlineSetting.js +1 -1
  100. package/package.json +11 -9
@@ -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>"`;
@@ -138,7 +138,7 @@ Object {
138
138
  }
139
139
  `;
140
140
 
141
- exports[`parsing html should get value from text 1`] = `
141
+ exports[`parsing html should get value from rendered view 1`] = `
142
142
  Object {
143
143
  "content": Array [
144
144
  Object {
@@ -167,7 +167,7 @@ Object {
167
167
  }
168
168
  `;
169
169
 
170
- exports[`parsing html should merge paragraph and text settings 1`] = `
170
+ exports[`parsing html should get value from text 1`] = `
171
171
  Object {
172
172
  "content": Array [
173
173
  Object {
@@ -176,7 +176,7 @@ Object {
176
176
  "marks": Array [
177
177
  Object {
178
178
  "attrs": Object {
179
- "italic": false,
179
+ "italic": true,
180
180
  },
181
181
  "type": "font_style",
182
182
  },
@@ -184,6 +184,27 @@ Object {
184
184
  "text": "lorem",
185
185
  "type": "text",
186
186
  },
187
+ Object {
188
+ "text": " ipsum",
189
+ "type": "text",
190
+ },
191
+ ],
192
+ "type": "paragraph",
193
+ },
194
+ ],
195
+ "type": "doc",
196
+ }
197
+ `;
198
+
199
+ exports[`parsing html should merge paragraph and text settings 1`] = `
200
+ Object {
201
+ "content": Array [
202
+ Object {
203
+ "content": Array [
204
+ Object {
205
+ "text": "lorem",
206
+ "type": "text",
207
+ },
187
208
  Object {
188
209
  "marks": Array [
189
210
  Object {
@@ -204,4 +225,4 @@ Object {
204
225
  }
205
226
  `;
206
227
 
207
- exports[`rendering should render html 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-font-style: italic;\\" class=\\"zw-style\\">hello world</span></p>"`;
228
+ exports[`rendering should render html 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-font-style:italic;\\" class=\\"zw-style\\">hello world</span></p>"`;
@@ -191,6 +191,35 @@ Object {
191
191
  }
192
192
  `;
193
193
 
194
+ exports[`parsing html should get value from rendered view 1`] = `
195
+ Object {
196
+ "content": Array [
197
+ Object {
198
+ "content": Array [
199
+ Object {
200
+ "marks": Array [
201
+ Object {
202
+ "attrs": Object {
203
+ "value": "700",
204
+ },
205
+ "type": "font_weight",
206
+ },
207
+ ],
208
+ "text": "lorem",
209
+ "type": "text",
210
+ },
211
+ Object {
212
+ "text": " ipsum",
213
+ "type": "text",
214
+ },
215
+ ],
216
+ "type": "paragraph",
217
+ },
218
+ ],
219
+ "type": "doc",
220
+ }
221
+ `;
222
+
194
223
  exports[`parsing html should get value from strong tag 1`] = `
195
224
  Object {
196
225
  "content": Array [
@@ -286,4 +315,4 @@ Object {
286
315
  }
287
316
  `;
288
317
 
289
- exports[`rendering should render html 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-font-weight: 700;\\" class=\\"zw-style\\">hello world</span></p>"`;
318
+ exports[`rendering should render html 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-font-weight:700;\\" class=\\"zw-style\\">hello world</span></p>"`;
@@ -24,6 +24,30 @@ Object {
24
24
  }
25
25
  `;
26
26
 
27
+ exports[`parsing html should get value from rendered view 1`] = `
28
+ Object {
29
+ "content": Array [
30
+ Object {
31
+ "attrs": Object {
32
+ "line_height": Object {
33
+ "desktop": "1.4",
34
+ "mobile": "1.2",
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 value from text in px units with font size 1`] = `
28
52
  Object {
29
53
  "content": Array [
@@ -116,6 +140,6 @@ Object {
116
140
  }
117
141
  `;
118
142
 
119
- exports[`rendering should render all devices 1`] = `"<p class=\\"zw-style\\" style=\\"--zw-mobile-line-height: 1.21; --zw-tablet-line-height: 1.4; --zw-desktop-line-height: 1.6;\\">hello world</p>"`;
143
+ exports[`rendering should render all devices 1`] = `"<p class=\\"zw-style\\" style=\\"--zw-line-height-mobile:1.21;--zw-line-height-tablet:1.4;--zw-line-height-desktop:1.6;\\">hello world</p>"`;
120
144
 
121
- exports[`rendering should render only desktop 1`] = `"<p class=\\"zw-style\\" style=\\"--zw-desktop-line-height: 1.3;\\">hello world</p>"`;
145
+ exports[`rendering should render only desktop 1`] = `"<p class=\\"zw-style\\" style=\\"--zw-line-height-desktop:1.3;\\">hello world</p>"`;
@@ -349,7 +349,9 @@ Object {
349
349
  Object {
350
350
  "attrs": Object {
351
351
  "alignment": null,
352
- "preset": null,
352
+ "preset": Object {
353
+ "id": "regular-1",
354
+ },
353
355
  },
354
356
  "content": Array [
355
357
  Object {
@@ -385,7 +387,9 @@ Object {
385
387
  Object {
386
388
  "attrs": Object {
387
389
  "alignment": null,
388
- "preset": null,
390
+ "preset": Object {
391
+ "id": "regular-1",
392
+ },
389
393
  },
390
394
  "content": Array [
391
395
  Object {
@@ -225,6 +225,36 @@ Object {
225
225
  }
226
226
  `;
227
227
 
228
+ exports[`parsing html should get both from rendered view 1`] = `
229
+ Object {
230
+ "content": Array [
231
+ Object {
232
+ "content": Array [
233
+ Object {
234
+ "marks": Array [
235
+ Object {
236
+ "attrs": Object {
237
+ "strike_through": true,
238
+ "underline": true,
239
+ },
240
+ "type": "text_decoration",
241
+ },
242
+ ],
243
+ "text": "lorem",
244
+ "type": "text",
245
+ },
246
+ Object {
247
+ "text": " ipsum",
248
+ "type": "text",
249
+ },
250
+ ],
251
+ "type": "paragraph",
252
+ },
253
+ ],
254
+ "type": "doc",
255
+ }
256
+ `;
257
+
228
258
  exports[`parsing html should get both from text 1`] = `
229
259
  Object {
230
260
  "content": Array [
@@ -281,6 +311,36 @@ Object {
281
311
  }
282
312
  `;
283
313
 
314
+ exports[`parsing html should get strike through from rendered view 1`] = `
315
+ Object {
316
+ "content": Array [
317
+ Object {
318
+ "content": Array [
319
+ Object {
320
+ "marks": Array [
321
+ Object {
322
+ "attrs": Object {
323
+ "strike_through": true,
324
+ "underline": false,
325
+ },
326
+ "type": "text_decoration",
327
+ },
328
+ ],
329
+ "text": "lorem",
330
+ "type": "text",
331
+ },
332
+ Object {
333
+ "text": " ipsum",
334
+ "type": "text",
335
+ },
336
+ ],
337
+ "type": "paragraph",
338
+ },
339
+ ],
340
+ "type": "doc",
341
+ }
342
+ `;
343
+
284
344
  exports[`parsing html should get strike through from text 1`] = `
285
345
  Object {
286
346
  "content": Array [
@@ -337,6 +397,36 @@ Object {
337
397
  }
338
398
  `;
339
399
 
400
+ exports[`parsing html should get underline from rendered view 1`] = `
401
+ Object {
402
+ "content": Array [
403
+ Object {
404
+ "content": Array [
405
+ Object {
406
+ "marks": Array [
407
+ Object {
408
+ "attrs": Object {
409
+ "strike_through": false,
410
+ "underline": true,
411
+ },
412
+ "type": "text_decoration",
413
+ },
414
+ ],
415
+ "text": "lorem",
416
+ "type": "text",
417
+ },
418
+ Object {
419
+ "text": " ipsum",
420
+ "type": "text",
421
+ },
422
+ ],
423
+ "type": "paragraph",
424
+ },
425
+ ],
426
+ "type": "doc",
427
+ }
428
+ `;
429
+
340
430
  exports[`parsing html should get underline from text 1`] = `
341
431
  Object {
342
432
  "content": Array [
@@ -406,8 +496,8 @@ Object {
406
496
  }
407
497
  `;
408
498
 
409
- exports[`rendering should render both 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-text-decoration: underline line-through;\\" class=\\"zw-style\\">hello world</span></p>"`;
499
+ exports[`rendering should render both 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-text-decoration:underline line-through;\\" class=\\"zw-style\\">hello world</span></p>"`;
410
500
 
411
- exports[`rendering should render strike through only 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-text-decoration: line-through;\\" class=\\"zw-style\\">hello world</span></p>"`;
501
+ exports[`rendering should render strike through only 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-text-decoration:line-through;\\" class=\\"zw-style\\">hello world</span></p>"`;
412
502
 
413
- exports[`rendering should render underline only 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-text-decoration: underline;\\" class=\\"zw-style\\">hello world</span></p>"`;
503
+ exports[`rendering should render underline only 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-text-decoration:underline;\\" class=\\"zw-style\\">hello world</span></p>"`;
@@ -0,0 +1,10 @@
1
+ import { Extension } from '@tiptap/vue-2';
2
+ import { PastePlugin } from './plugins';
3
+
4
+ export const CopyPasteProcessor = Extension.create({
5
+ name: 'copy_paste_processor',
6
+
7
+ addProseMirrorPlugins() {
8
+ return [PastePlugin.create()];
9
+ }
10
+ });
@@ -17,6 +17,16 @@ export const TextProcessor = Extension.create({
17
17
 
18
18
  addCommands() {
19
19
  return {
20
+ getSelectedText: createCommand(({ state }) => {
21
+ const { from, to } = state.selection;
22
+
23
+ return state.doc.textBetween(from, to, ' ');
24
+ }),
25
+
26
+ unsetMarks: createCommand(({ commands }, marks) => {
27
+ marks.forEach((mark) => commands.unsetMark(mark));
28
+ }),
29
+
20
30
  transformText: createCommand(({ state }, transform) => {
21
31
  const { selection } = state.tr;
22
32
 
@@ -1,8 +1,8 @@
1
1
  import { Editor, Extension } from '@tiptap/vue-2';
2
2
  import { NodeFactory } from '../../../__tests__/utils';
3
- import { CORE_EXTENSIONS } from '../index';
4
3
  import { NodeTypes } from '../../../enums';
5
4
  import { ContentNormalizer } from '../../../services';
5
+ import { buildCoreExtensions } from '../index';
6
6
 
7
7
  const LineHeight = Extension.create({
8
8
  name: 'line_height',
@@ -21,11 +21,9 @@ const LineHeight = Extension.create({
21
21
  });
22
22
 
23
23
  function createEditor({ content }) {
24
- const normalizer = new ContentNormalizer();
25
-
26
24
  return new Editor({
27
- content: normalizer.normalize(content),
28
- extensions: CORE_EXTENSIONS.concat(LineHeight) // Included to core extensions
25
+ content: ContentNormalizer.normalize(content),
26
+ extensions: buildCoreExtensions().concat(LineHeight) // Included to core extensions
29
27
  });
30
28
  }
31
29
 
@@ -1,19 +1,17 @@
1
1
  import { Editor } from '@tiptap/vue-2';
2
- import { CORE_EXTENSIONS } from '../index';
3
2
  import { NodeFactory } from '../../../__tests__/utils';
4
3
  import { ContentNormalizer } from '../../../services';
4
+ import { buildCoreExtensions } from '../index';
5
5
 
6
6
  function createEditor() {
7
- const normalizer = new ContentNormalizer();
8
-
9
7
  const content = NodeFactory.doc([
10
8
  NodeFactory.paragraph('Lorem ipsum dolor sit amet'),
11
9
  NodeFactory.paragraph('consectetur adipisicing elit')
12
10
  ]);
13
11
 
14
12
  return new Editor({
15
- content: normalizer.normalize(content),
16
- extensions: CORE_EXTENSIONS // included to core
13
+ content: ContentNormalizer.normalize(content),
14
+ extensions: buildCoreExtensions() // included to core
17
15
  });
18
16
  }
19
17