@zipify/wysiwyg 4.0.0 → 4.0.2

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 (26) hide show
  1. package/README.md +5 -0
  2. package/dist/cli.js +2 -2
  3. package/dist/wysiwyg.mjs +42 -0
  4. package/example/ai-component/AiComponent.vue +14 -0
  5. package/lib/composables/__tests__/__snapshots__/useEditor.test.js.snap +3 -0
  6. package/lib/extensions/__tests__/__snapshots__/Alignment.test.js.snap +15 -0
  7. package/lib/extensions/__tests__/__snapshots__/BackgroundColor.test.js.snap +15 -0
  8. package/lib/extensions/__tests__/__snapshots__/CaseStyle.test.js.snap +12 -0
  9. package/lib/extensions/__tests__/__snapshots__/FontColor.test.js.snap +15 -0
  10. package/lib/extensions/__tests__/__snapshots__/FontFamily.test.js.snap +33 -0
  11. package/lib/extensions/__tests__/__snapshots__/FontSize.test.js.snap +27 -0
  12. package/lib/extensions/__tests__/__snapshots__/FontStyle.test.js.snap +27 -0
  13. package/lib/extensions/__tests__/__snapshots__/FontWeight.test.js.snap +39 -0
  14. package/lib/extensions/__tests__/__snapshots__/LineHeight.test.js.snap +18 -0
  15. package/lib/extensions/__tests__/__snapshots__/Link.test.js.snap +30 -0
  16. package/lib/extensions/__tests__/__snapshots__/Margin.test.js.snap +9 -0
  17. package/lib/extensions/__tests__/__snapshots__/StylePreset.test.js.snap +45 -0
  18. package/lib/extensions/__tests__/__snapshots__/Superscript.test.js.snap +15 -0
  19. package/lib/extensions/__tests__/__snapshots__/TextDecoration.test.js.snap +63 -0
  20. package/lib/extensions/core/Document.js +14 -0
  21. package/lib/extensions/core/__tests__/__snapshots__/NodeProcessor.test.js.snap +57 -0
  22. package/lib/extensions/core/__tests__/__snapshots__/TextProcessor.test.js.snap +6 -0
  23. package/lib/extensions/list/__tests__/__snapshots__/List.test.js.snap +54 -0
  24. package/lib/extensions/steps/SetDocAttr.js +42 -0
  25. package/lib/extensions/steps/index.js +1 -0
  26. package/package.json +2 -2
@@ -2,6 +2,9 @@
2
2
 
3
3
  exports[`apply mark should apply inline mark 1`] = `
4
4
  Object {
5
+ "attrs": Object {
6
+ "meta": Object {},
7
+ },
5
8
  "content": Array [
6
9
  Object {
7
10
  "attrs": Object {
@@ -32,6 +35,9 @@ Object {
32
35
 
33
36
  exports[`apply mark should apply mark to block 1`] = `
34
37
  Object {
38
+ "attrs": Object {
39
+ "meta": Object {},
40
+ },
35
41
  "content": Array [
36
42
  Object {
37
43
  "attrs": Object {
@@ -61,6 +67,9 @@ Object {
61
67
 
62
68
  exports[`apply mark should apply mark to list item 1`] = `
63
69
  Object {
70
+ "attrs": Object {
71
+ "meta": Object {},
72
+ },
64
73
  "content": Array [
65
74
  Object {
66
75
  "attrs": Object {
@@ -123,6 +132,9 @@ Object {
123
132
 
124
133
  exports[`apply mark should apply mark to paragraph 1`] = `
125
134
  Object {
135
+ "attrs": Object {
136
+ "meta": Object {},
137
+ },
126
138
  "content": Array [
127
139
  Object {
128
140
  "attrs": Object {
@@ -152,6 +164,9 @@ Object {
152
164
 
153
165
  exports[`apply mark should apply mark to part of text 1`] = `
154
166
  Object {
167
+ "attrs": Object {
168
+ "meta": Object {},
169
+ },
155
170
  "content": Array [
156
171
  Object {
157
172
  "attrs": Object {
@@ -185,6 +200,9 @@ Object {
185
200
 
186
201
  exports[`apply mark should apply mark to word 1`] = `
187
202
  Object {
203
+ "attrs": Object {
204
+ "meta": Object {},
205
+ },
188
206
  "content": Array [
189
207
  Object {
190
208
  "attrs": Object {
@@ -218,6 +236,9 @@ Object {
218
236
 
219
237
  exports[`apply mark should apply text mark to paragraph with mark 1`] = `
220
238
  Object {
239
+ "attrs": Object {
240
+ "meta": Object {},
241
+ },
221
242
  "content": Array [
222
243
  Object {
223
244
  "attrs": Object {
@@ -259,6 +280,9 @@ Object {
259
280
 
260
281
  exports[`apply mark should merge marks 1`] = `
261
282
  Object {
283
+ "attrs": Object {
284
+ "meta": Object {},
285
+ },
262
286
  "content": Array [
263
287
  Object {
264
288
  "attrs": Object {
@@ -292,6 +316,9 @@ Object {
292
316
 
293
317
  exports[`apply mark should remove paragraph mark on applying to list item 1`] = `
294
318
  Object {
319
+ "attrs": Object {
320
+ "meta": Object {},
321
+ },
295
322
  "content": Array [
296
323
  Object {
297
324
  "attrs": Object {
@@ -367,6 +394,9 @@ Object {
367
394
 
368
395
  exports[`apply mark should remove text mark on applying to paragraph 1`] = `
369
396
  Object {
397
+ "attrs": Object {
398
+ "meta": Object {},
399
+ },
370
400
  "content": Array [
371
401
  Object {
372
402
  "attrs": Object {
@@ -396,6 +426,9 @@ Object {
396
426
 
397
427
  exports[`block attributes should remove a few some attributes 1`] = `
398
428
  Object {
429
+ "attrs": Object {
430
+ "meta": Object {},
431
+ },
399
432
  "content": Array [
400
433
  Object {
401
434
  "attrs": Object {
@@ -417,6 +450,9 @@ Object {
417
450
 
418
451
  exports[`block attributes should remove some attribute 1`] = `
419
452
  Object {
453
+ "attrs": Object {
454
+ "meta": Object {},
455
+ },
420
456
  "content": Array [
421
457
  Object {
422
458
  "attrs": Object {
@@ -438,6 +474,9 @@ Object {
438
474
 
439
475
  exports[`block attributes should set attributes 1`] = `
440
476
  Object {
477
+ "attrs": Object {
478
+ "meta": Object {},
479
+ },
441
480
  "content": Array [
442
481
  Object {
443
482
  "attrs": Object {
@@ -461,6 +500,9 @@ Object {
461
500
 
462
501
  exports[`block attributes should set attributes with defaults 1`] = `
463
502
  Object {
503
+ "attrs": Object {
504
+ "meta": Object {},
505
+ },
464
506
  "content": Array [
465
507
  Object {
466
508
  "attrs": Object {
@@ -486,6 +528,9 @@ Object {
486
528
 
487
529
  exports[`block attributes should update attributes 1`] = `
488
530
  Object {
531
+ "attrs": Object {
532
+ "meta": Object {},
533
+ },
489
534
  "content": Array [
490
535
  Object {
491
536
  "attrs": Object {
@@ -509,6 +554,9 @@ Object {
509
554
 
510
555
  exports[`block attributes should update attributes with defaults 1`] = `
511
556
  Object {
557
+ "attrs": Object {
558
+ "meta": Object {},
559
+ },
512
560
  "content": Array [
513
561
  Object {
514
562
  "attrs": Object {
@@ -534,6 +582,9 @@ Object {
534
582
 
535
583
  exports[`remove marks should remove block and text marks 1`] = `
536
584
  Object {
585
+ "attrs": Object {
586
+ "meta": Object {},
587
+ },
537
588
  "content": Array [
538
589
  Object {
539
590
  "attrs": Object {
@@ -555,6 +606,9 @@ Object {
555
606
 
556
607
  exports[`remove marks should remove block marks 1`] = `
557
608
  Object {
609
+ "attrs": Object {
610
+ "meta": Object {},
611
+ },
558
612
  "content": Array [
559
613
  Object {
560
614
  "attrs": Object {
@@ -576,6 +630,9 @@ Object {
576
630
 
577
631
  exports[`remove marks should remove text marks 1`] = `
578
632
  Object {
633
+ "attrs": Object {
634
+ "meta": Object {},
635
+ },
579
636
  "content": Array [
580
637
  Object {
581
638
  "attrs": Object {
@@ -2,6 +2,9 @@
2
2
 
3
3
  exports[`transform text should keep text marks 1`] = `
4
4
  Object {
5
+ "attrs": Object {
6
+ "meta": Object {},
7
+ },
5
8
  "content": Array [
6
9
  Object {
7
10
  "attrs": Object {
@@ -30,6 +33,9 @@ Object {
30
33
 
31
34
  exports[`transform text should transform selected text 1`] = `
32
35
  Object {
36
+ "attrs": Object {
37
+ "meta": Object {},
38
+ },
33
39
  "content": Array [
34
40
  Object {
35
41
  "attrs": Object {
@@ -2,6 +2,9 @@
2
2
 
3
3
  exports[`apply list should apply list to text 1`] = `
4
4
  Object {
5
+ "attrs": Object {
6
+ "meta": Object {},
7
+ },
5
8
  "content": Array [
6
9
  Object {
7
10
  "attrs": Object {
@@ -39,6 +42,9 @@ Object {
39
42
 
40
43
  exports[`apply list should change list type 1`] = `
41
44
  Object {
45
+ "attrs": Object {
46
+ "meta": Object {},
47
+ },
42
48
  "content": Array [
43
49
  Object {
44
50
  "attrs": Object {
@@ -95,6 +101,9 @@ Object {
95
101
 
96
102
  exports[`apply list should remove preset 1`] = `
97
103
  Object {
104
+ "attrs": Object {
105
+ "meta": Object {},
106
+ },
98
107
  "content": Array [
99
108
  Object {
100
109
  "attrs": Object {
@@ -151,6 +160,9 @@ Object {
151
160
 
152
161
  exports[`apply list should toggle list 1`] = `
153
162
  Object {
163
+ "attrs": Object {
164
+ "meta": Object {},
165
+ },
154
166
  "content": Array [
155
167
  Object {
156
168
  "attrs": Object {
@@ -187,6 +199,9 @@ Object {
187
199
 
188
200
  exports[`parsing html should parse circle type by class 1`] = `
189
201
  Object {
202
+ "attrs": Object {
203
+ "meta": Object {},
204
+ },
190
205
  "content": Array [
191
206
  Object {
192
207
  "attrs": Object {
@@ -224,6 +239,9 @@ Object {
224
239
 
225
240
  exports[`parsing html should parse decimal as default 1`] = `
226
241
  Object {
242
+ "attrs": Object {
243
+ "meta": Object {},
244
+ },
227
245
  "content": Array [
228
246
  Object {
229
247
  "attrs": Object {
@@ -261,6 +279,9 @@ Object {
261
279
 
262
280
  exports[`parsing html should parse decimal type by attribute 1`] = `
263
281
  Object {
282
+ "attrs": Object {
283
+ "meta": Object {},
284
+ },
264
285
  "content": Array [
265
286
  Object {
266
287
  "attrs": Object {
@@ -298,6 +319,9 @@ Object {
298
319
 
299
320
  exports[`parsing html should parse decimal type by class 1`] = `
300
321
  Object {
322
+ "attrs": Object {
323
+ "meta": Object {},
324
+ },
301
325
  "content": Array [
302
326
  Object {
303
327
  "attrs": Object {
@@ -335,6 +359,9 @@ Object {
335
359
 
336
360
  exports[`parsing html should parse disc as default 1`] = `
337
361
  Object {
362
+ "attrs": Object {
363
+ "meta": Object {},
364
+ },
338
365
  "content": Array [
339
366
  Object {
340
367
  "attrs": Object {
@@ -372,6 +399,9 @@ Object {
372
399
 
373
400
  exports[`parsing html should parse disc type by class 1`] = `
374
401
  Object {
402
+ "attrs": Object {
403
+ "meta": Object {},
404
+ },
375
405
  "content": Array [
376
406
  Object {
377
407
  "attrs": Object {
@@ -409,6 +439,9 @@ Object {
409
439
 
410
440
  exports[`parsing html should parse latin type by class 1`] = `
411
441
  Object {
442
+ "attrs": Object {
443
+ "meta": Object {},
444
+ },
412
445
  "content": Array [
413
446
  Object {
414
447
  "attrs": Object {
@@ -446,6 +479,9 @@ Object {
446
479
 
447
480
  exports[`parsing html should parse latin type by lower attribute 1`] = `
448
481
  Object {
482
+ "attrs": Object {
483
+ "meta": Object {},
484
+ },
449
485
  "content": Array [
450
486
  Object {
451
487
  "attrs": Object {
@@ -483,6 +519,9 @@ Object {
483
519
 
484
520
  exports[`parsing html should parse latin type by upper attribute 1`] = `
485
521
  Object {
522
+ "attrs": Object {
523
+ "meta": Object {},
524
+ },
486
525
  "content": Array [
487
526
  Object {
488
527
  "attrs": Object {
@@ -520,6 +559,9 @@ Object {
520
559
 
521
560
  exports[`parsing html should parse roman type by class 1`] = `
522
561
  Object {
562
+ "attrs": Object {
563
+ "meta": Object {},
564
+ },
523
565
  "content": Array [
524
566
  Object {
525
567
  "attrs": Object {
@@ -557,6 +599,9 @@ Object {
557
599
 
558
600
  exports[`parsing html should parse roman type by lower attribute 1`] = `
559
601
  Object {
602
+ "attrs": Object {
603
+ "meta": Object {},
604
+ },
560
605
  "content": Array [
561
606
  Object {
562
607
  "attrs": Object {
@@ -594,6 +639,9 @@ Object {
594
639
 
595
640
  exports[`parsing html should parse roman type by upper attribute 1`] = `
596
641
  Object {
642
+ "attrs": Object {
643
+ "meta": Object {},
644
+ },
597
645
  "content": Array [
598
646
  Object {
599
647
  "attrs": Object {
@@ -631,6 +679,9 @@ Object {
631
679
 
632
680
  exports[`parsing html should parse square type by class 1`] = `
633
681
  Object {
682
+ "attrs": Object {
683
+ "meta": Object {},
684
+ },
634
685
  "content": Array [
635
686
  Object {
636
687
  "attrs": Object {
@@ -668,6 +719,9 @@ Object {
668
719
 
669
720
  exports[`remove list should remove list 1`] = `
670
721
  Object {
722
+ "attrs": Object {
723
+ "meta": Object {},
724
+ },
671
725
  "content": Array [
672
726
  Object {
673
727
  "attrs": Object {
@@ -0,0 +1,42 @@
1
+ import { Node } from '@tiptap/pm/model';
2
+ import { Step, StepResult } from '@tiptap/pm/transform';
3
+
4
+ export class SetDocAttr extends Step {
5
+ constructor(key, value, schema, stepType = 'SetDocAttr') {
6
+ super();
7
+ this.key = key;
8
+ this.value = value;
9
+ this.schema = schema;
10
+ this.stepType = stepType;
11
+ }
12
+
13
+ apply(doc) {
14
+ this.prevValue = doc.attrs.meta[this.key];
15
+ const newDoc = Node.fromJSON(this.schema, doc.toJSON());
16
+
17
+ newDoc.attrs.meta[this.key] = this.value;
18
+ return StepResult.ok(newDoc);
19
+ }
20
+
21
+ invert() {
22
+ return new SetDocAttr(this.key, this.prevValue, this.schema, 'revertSetDocAttr');
23
+ }
24
+
25
+ map() {
26
+ return null;
27
+ }
28
+
29
+ toJSON() {
30
+ return {
31
+ stepType: this.stepType,
32
+ key: this.key,
33
+ value: this.value
34
+ };
35
+ }
36
+
37
+ static fromJSON(json) {
38
+ return new SetDocAttr(json.key, json.value, json.stepType);
39
+ }
40
+ }
41
+
42
+ Step.jsonID('setDocAttr', SetDocAttr);
@@ -0,0 +1 @@
1
+ export { SetDocAttr } from './SetDocAttr';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zipify/wysiwyg",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "Zipify modification of TipTap text editor",
5
5
  "main": "dist/wysiwyg.mjs",
6
6
  "bin": {
@@ -74,7 +74,7 @@
74
74
  "@vitejs/plugin-vue": "^4.2.3",
75
75
  "@vue/test-utils": "^2.3.2",
76
76
  "@vue/vue3-jest": "^29.2.2",
77
- "@zipify/colorpicker": "^3.0.0-vue3.6",
77
+ "@zipify/colorpicker": "^3.0.0",
78
78
  "@zipify/eslint-config": "^1.2.0",
79
79
  "babel-jest": "^29.5.0",
80
80
  "eslint": "8.37.0",