@zipify/wysiwyg 4.11.0-4 → 4.11.1

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 (138) hide show
  1. package/.release-it.json +2 -1
  2. package/dist/cli.js +28 -28
  3. package/dist/node.js +26 -26
  4. package/dist/types/Wysiwyg.vue.d.ts +7 -8
  5. package/dist/types/components/base/Button.vue.d.ts +5 -10
  6. package/dist/types/components/base/ButtonToggle.vue.d.ts +9 -14
  7. package/dist/types/components/base/Checkbox.vue.d.ts +1 -1
  8. package/dist/types/components/base/FieldLabel.vue.d.ts +5 -10
  9. package/dist/types/components/base/Icon.vue.d.ts +1 -1
  10. package/dist/types/components/base/Modal.vue.d.ts +5 -14
  11. package/dist/types/components/base/ModalFloating.vue.d.ts +5 -14
  12. package/dist/types/components/base/NumberField.vue.d.ts +1 -1
  13. package/dist/types/components/base/Range.vue.d.ts +1 -1
  14. package/dist/types/components/base/ScrollView.vue.d.ts +5 -14
  15. package/dist/types/components/base/TextField.vue.d.ts +1 -1
  16. package/dist/types/components/base/colorPicker/ColorPicker.vue.d.ts +10 -517
  17. package/dist/types/components/base/dropdown/Dropdown.vue.d.ts +6 -15
  18. package/dist/types/components/base/dropdown/DropdownActivator.vue.d.ts +7 -12
  19. package/dist/types/components/base/dropdown/DropdownDivider.vue.d.ts +1 -1
  20. package/dist/types/components/base/dropdown/DropdownGroup.vue.d.ts +7 -12
  21. package/dist/types/components/base/dropdown/DropdownMenu.vue.d.ts +6 -12
  22. package/dist/types/components/base/dropdown/DropdownOption.vue.d.ts +5 -14
  23. package/dist/types/components/toolbar/ToolbarFloating.vue.d.ts +5 -14
  24. package/dist/types/components/toolbar/controls/AlignmentControl.vue.d.ts +1 -1
  25. package/dist/types/components/toolbar/controls/CaseStyleControl.vue.d.ts +1 -1
  26. package/dist/types/components/toolbar/controls/FontFamilyControl.vue.d.ts +1 -1
  27. package/dist/types/components/toolbar/controls/FontSizeControl.vue.d.ts +1 -1
  28. package/dist/types/components/toolbar/controls/FontWeightControl.vue.d.ts +1 -1
  29. package/dist/types/components/toolbar/controls/ItalicControl.vue.d.ts +1 -1
  30. package/dist/types/components/toolbar/controls/LineHeightControl.vue.d.ts +1 -3
  31. package/dist/types/components/toolbar/controls/ListControl.vue.d.ts +1 -1
  32. package/dist/types/components/toolbar/controls/RemoveFormatControl.vue.d.ts +1 -1
  33. package/dist/types/components/toolbar/controls/StrikeThroughControl.vue.d.ts +1 -1
  34. package/dist/types/components/toolbar/controls/SuperscriptControl.vue.d.ts +1 -1
  35. package/dist/types/components/toolbar/controls/UnderlineControl.vue.d.ts +1 -1
  36. package/dist/types/components/toolbar/controls/link/LinkControl.vue.d.ts +1 -3
  37. package/dist/types/components/toolbar/controls/link/LinkControlHeader.vue.d.ts +1 -1
  38. package/dist/types/components/toolbar/controls/link/composables/useLink.d.ts +11 -9
  39. package/dist/types/components/toolbar/controls/link/destination/LinkControlDestination.vue.d.ts +1 -1
  40. package/dist/types/components/toolbar/controls/link/destination/LinkControlPageBlock.vue.d.ts +1 -1
  41. package/dist/types/components/toolbar/controls/link/destination/LinkControlUrl.vue.d.ts +1 -1
  42. package/dist/types/components/toolbar/controls/stylePreset/StylePresetControl.vue.d.ts +1 -1
  43. package/dist/types/components/toolbar/controls/stylePreset/StylePresetOption.vue.d.ts +2 -4
  44. package/dist/types/enums/Alignment.d.ts +7 -0
  45. package/dist/types/enums/CaseStyle.d.ts +5 -0
  46. package/dist/types/enums/Device.d.ts +7 -0
  47. package/dist/types/enums/LinkDestination.d.ts +4 -0
  48. package/dist/types/enums/LinkTarget.d.ts +4 -0
  49. package/dist/types/enums/ListType.d.ts +10 -0
  50. package/dist/types/enums/MarkGroup.d.ts +4 -0
  51. package/dist/types/enums/NodeType.d.ts +9 -0
  52. package/dist/types/enums/TextSetting.d.ts +19 -0
  53. package/dist/types/enums/index.d.ts +9 -9
  54. package/dist/types/extensions/Alignment.d.ts +2 -1
  55. package/dist/types/extensions/CaseStyle.d.ts +2 -1
  56. package/dist/wysiwyg.css +27 -27
  57. package/dist/wysiwyg.mjs +129 -164
  58. package/lib/Wysiwyg.vue +3 -3
  59. package/lib/__tests__/utils/buildTestExtensions.js +6 -6
  60. package/lib/components/toolbar/Toolbar.vue +2 -2
  61. package/lib/components/toolbar/__tests__/Toolbar.test.js +5 -5
  62. package/lib/components/toolbar/controls/AlignmentControl.vue +7 -7
  63. package/lib/components/toolbar/controls/CaseStyleControl.vue +5 -5
  64. package/lib/components/toolbar/controls/FontColorControl.vue +2 -2
  65. package/lib/components/toolbar/controls/FontFamilyControl.vue +2 -2
  66. package/lib/components/toolbar/controls/FontSizeControl.vue +2 -2
  67. package/lib/components/toolbar/controls/FontWeightControl.vue +2 -2
  68. package/lib/components/toolbar/controls/ItalicControl.vue +2 -2
  69. package/lib/components/toolbar/controls/LineHeightControl.vue +2 -2
  70. package/lib/components/toolbar/controls/ListControl.vue +5 -5
  71. package/lib/components/toolbar/controls/__tests__/AlignmentControl.test.js +13 -13
  72. package/lib/components/toolbar/controls/__tests__/CaseStyleControl.test.js +4 -4
  73. package/lib/components/toolbar/controls/__tests__/ListControl.test.js +10 -10
  74. package/lib/components/toolbar/controls/__tests__/StylePresetControl.test.js +6 -6
  75. package/lib/components/toolbar/controls/link/LinkControl.vue +5 -5
  76. package/lib/components/toolbar/controls/link/composables/__tests__/useLink.test.js +20 -20
  77. package/lib/components/toolbar/controls/link/composables/useLink.js +10 -10
  78. package/lib/components/toolbar/controls/link/destination/LinkControlDestination.vue +10 -7
  79. package/lib/components/toolbar/controls/link/destination/LinkControlPageBlock.vue +1 -1
  80. package/lib/enums/{Alignments.ts → Alignment.ts} +0 -8
  81. package/lib/enums/{CaseStyles.ts → CaseStyle.ts} +0 -6
  82. package/lib/enums/{Devices.ts → Device.ts} +0 -8
  83. package/lib/enums/LinkDestination.ts +4 -0
  84. package/lib/enums/LinkTarget.ts +4 -0
  85. package/lib/enums/{ListTypes.ts → ListType.ts} +0 -9
  86. package/lib/enums/MarkGroup.ts +4 -0
  87. package/lib/enums/{NodeTypes.ts → NodeType.ts} +0 -8
  88. package/lib/enums/{TextSettings.ts → TextSetting.ts} +0 -11
  89. package/lib/enums/index.ts +9 -9
  90. package/lib/extensions/Alignment.js +13 -11
  91. package/lib/extensions/BackgroundColor.js +2 -2
  92. package/lib/extensions/CaseStyle.js +8 -6
  93. package/lib/extensions/FontColor.js +4 -4
  94. package/lib/extensions/FontFamily.js +5 -5
  95. package/lib/extensions/FontSize.js +3 -3
  96. package/lib/extensions/FontStyle.js +3 -3
  97. package/lib/extensions/FontWeight.js +3 -3
  98. package/lib/extensions/LineHeight.js +4 -4
  99. package/lib/extensions/Link.js +11 -11
  100. package/lib/extensions/Margin.js +4 -4
  101. package/lib/extensions/StylePreset.js +18 -12
  102. package/lib/extensions/Superscript.js +2 -2
  103. package/lib/extensions/TextDecoration.js +2 -2
  104. package/lib/extensions/__tests__/Alignment.test.js +21 -21
  105. package/lib/extensions/__tests__/BackgroundColor.test.js +4 -4
  106. package/lib/extensions/__tests__/CaseStyle.test.js +6 -6
  107. package/lib/extensions/__tests__/FontColor.test.js +4 -4
  108. package/lib/extensions/__tests__/FontFamily.test.js +10 -10
  109. package/lib/extensions/__tests__/FontSize.test.js +9 -9
  110. package/lib/extensions/__tests__/FontStyle.test.js +6 -6
  111. package/lib/extensions/__tests__/FontWeight.test.js +11 -11
  112. package/lib/extensions/__tests__/LineHeight.test.js +2 -2
  113. package/lib/extensions/__tests__/Link.test.js +13 -13
  114. package/lib/extensions/__tests__/StylePreset.test.js +29 -29
  115. package/lib/extensions/__tests__/Superscript.test.js +5 -5
  116. package/lib/extensions/__tests__/TextDecoration.test.js +14 -14
  117. package/lib/extensions/core/Document.js +3 -3
  118. package/lib/extensions/core/Heading.js +2 -2
  119. package/lib/extensions/core/NodeProcessor.js +8 -8
  120. package/lib/extensions/core/Paragraph.js +2 -2
  121. package/lib/extensions/core/__tests__/NodeProcessor.test.js +68 -68
  122. package/lib/extensions/core/__tests__/TextProcessor.test.js +13 -13
  123. package/lib/extensions/list/ListItem.js +5 -5
  124. package/lib/extensions/list/__tests__/List.test.js +11 -11
  125. package/lib/extensions/proseMirror/PasteLinkPlugin.js +4 -4
  126. package/lib/extensions/proseMirror/PastePlugin.js +2 -2
  127. package/lib/services/ContentSerializer.js +3 -3
  128. package/lib/services/StylePresetRenderer.js +4 -4
  129. package/lib/services/__tests__/NodeFactory.test.js +11 -11
  130. package/lib/services/__tests__/NodeSelector.test.js +18 -18
  131. package/lib/services/normalizer/JsonNormalizer.js +5 -5
  132. package/lib/services/normalizer/__tests__/JsonNormalizer.test.js +15 -15
  133. package/lib/utils/__tests__/convertAlignment.test.js +3 -3
  134. package/lib/utils/convertAlignment.js +4 -4
  135. package/package.json +17 -17
  136. package/lib/enums/LinkDestinations.ts +0 -9
  137. package/lib/enums/LinkTargets.ts +0 -9
  138. package/lib/enums/MarkGroups.ts +0 -9
@@ -1,12 +1,12 @@
1
1
  import { ref } from 'vue';
2
2
  import { Editor, Mark } from '@tiptap/vue-3';
3
- import { buildTestExtensions } from '../../__tests__/utils';
4
- import { ContentNormalizer, NodeFactory } from '../../services';
3
+ import { buildTestExtensions } from '@/__tests__/utils';
4
+ import { ContentNormalizer, NodeFactory } from '@/services';
5
+ import { LinkDestination, LinkTarget, TextSetting } from '@/enums';
5
6
  import { Link } from '../Link';
6
- import { LinkDestinations, LinkTargets, TextSettings } from '../../enums';
7
7
 
8
8
  const MockFontWeight = Mark.create({
9
- name: TextSettings.FONT_WEIGHT,
9
+ name: TextSetting.FONT_WEIGHT,
10
10
  addAttributes: () => ({ value: { required: true } }),
11
11
  renderHTML: () => ['span', {}, 0]
12
12
  });
@@ -30,8 +30,8 @@ function createEditor({ content }) {
30
30
  const createLink = (attrs = {}) => ({
31
31
  href: '/test',
32
32
  text: 'Hello world link',
33
- target: LinkTargets.SELF,
34
- destination: LinkDestinations.URL,
33
+ target: LinkTarget.SELF,
34
+ destination: LinkDestination.URL,
35
35
  ...attrs
36
36
  });
37
37
 
@@ -41,7 +41,7 @@ describe('get link', () => {
41
41
  content: NodeFactory.doc([
42
42
  NodeFactory.paragraph([
43
43
  NodeFactory.text('hello world', [
44
- NodeFactory.mark(TextSettings.LINK, createLink())
44
+ NodeFactory.mark(TextSetting.LINK, createLink())
45
45
  ])
46
46
  ])
47
47
  ])
@@ -97,7 +97,7 @@ describe('apply link', () => {
97
97
  content: NodeFactory.doc([
98
98
  NodeFactory.paragraph([
99
99
  NodeFactory.text('hello', [
100
- NodeFactory.mark(TextSettings.FONT_WEIGHT, { value: '700' })
100
+ NodeFactory.mark(TextSetting.FONT_WEIGHT, { value: '700' })
101
101
  ]),
102
102
  NodeFactory.text(' world')
103
103
  ])
@@ -115,10 +115,10 @@ describe('apply link', () => {
115
115
  content: NodeFactory.doc([
116
116
  NodeFactory.paragraph([
117
117
  NodeFactory.text('https://google.com', [
118
- NodeFactory.mark(TextSettings.LINK, {
118
+ NodeFactory.mark(TextSetting.LINK, {
119
119
  href: 'https://google.com',
120
- destination: LinkDestinations.URL,
121
- target: LinkTargets.SELF
120
+ destination: LinkDestination.URL,
121
+ target: LinkTarget.SELF
122
122
  })
123
123
  ])
124
124
  ])
@@ -130,8 +130,8 @@ describe('apply link', () => {
130
130
  editor.commands.applyLink({
131
131
  text: 'https://google.com',
132
132
  href: 'https://google.com',
133
- destination: LinkDestinations.URL,
134
- target: LinkTargets.BLANK
133
+ destination: LinkDestination.URL,
134
+ target: LinkTarget.BLANK
135
135
  });
136
136
 
137
137
  expect(editor.getJSON()).toMatchSnapshot();
@@ -1,13 +1,13 @@
1
1
  import { Editor, Extension, Mark } from '@tiptap/vue-3';
2
2
  import { buildTestExtensions } from '@/__tests__/utils';
3
- import { ListTypes, NodeTypes, TextSettings } from '@/enums';
3
+ import { ListType, NodeType, TextSetting } from '@/enums';
4
4
  import { ContentNormalizer, NodeFactory } from '@/services';
5
5
  import { createCommand } from '@/utils';
6
6
  import { List } from '../list';
7
7
  import { StylePreset } from '../StylePreset';
8
8
 
9
9
  const MockFontSize = Mark.create({
10
- name: TextSettings.FONT_SIZE,
10
+ name: TextSetting.FONT_SIZE,
11
11
 
12
12
  addAttributes: () => ({
13
13
  value: { default: null }
@@ -17,7 +17,7 @@ const MockFontSize = Mark.create({
17
17
  });
18
18
 
19
19
  const MockFontWeight = Mark.create({
20
- name: TextSettings.FONT_WEIGHT,
20
+ name: TextSetting.FONT_WEIGHT,
21
21
 
22
22
  addAttributes: () => ({
23
23
  value: { default: null }
@@ -27,7 +27,7 @@ const MockFontWeight = Mark.create({
27
27
  });
28
28
 
29
29
  const MockBackgroundColor = Mark.create({
30
- name: TextSettings.BACKGROUND_COLOR,
30
+ name: TextSetting.BACKGROUND_COLOR,
31
31
 
32
32
  addAttributes: () => ({
33
33
  value: { default: null }
@@ -37,7 +37,7 @@ const MockBackgroundColor = Mark.create({
37
37
  });
38
38
 
39
39
  const MockFontColor = Mark.create({
40
- name: TextSettings.FONT_COLOR,
40
+ name: TextSetting.FONT_COLOR,
41
41
 
42
42
  addAttributes: () => ({
43
43
  value: { default: null }
@@ -47,7 +47,7 @@ const MockFontColor = Mark.create({
47
47
  });
48
48
 
49
49
  const MockFontFamily = Mark.create({
50
- name: TextSettings.FONT_FAMILY,
50
+ name: TextSetting.FONT_FAMILY,
51
51
 
52
52
  addAttributes: () => ({
53
53
  value: { default: null }
@@ -57,7 +57,7 @@ const MockFontFamily = Mark.create({
57
57
  });
58
58
 
59
59
  const MockFontStyle = Mark.create({
60
- name: TextSettings.FONT_STYLE,
60
+ name: TextSetting.FONT_STYLE,
61
61
 
62
62
  addAttributes: () => ({
63
63
  value: { default: null }
@@ -67,7 +67,7 @@ const MockFontStyle = Mark.create({
67
67
  });
68
68
 
69
69
  const MockTextDecoration = Mark.create({
70
- name: TextSettings.TEXT_DECORATION,
70
+ name: TextSetting.TEXT_DECORATION,
71
71
 
72
72
  addAttributes: () => ({
73
73
  value: { default: null }
@@ -77,7 +77,7 @@ const MockTextDecoration = Mark.create({
77
77
  });
78
78
 
79
79
  const MockSuperscript = Mark.create({
80
- name: TextSettings.SUPERSCRIPT,
80
+ name: TextSetting.SUPERSCRIPT,
81
81
 
82
82
  addAttributes: () => ({
83
83
  value: { default: null }
@@ -87,7 +87,7 @@ const MockSuperscript = Mark.create({
87
87
  });
88
88
 
89
89
  const MockLink = Extension.create({
90
- name: TextSettings.LINK,
90
+ name: TextSetting.LINK,
91
91
 
92
92
  addOptions: () => ({
93
93
  isActive: false,
@@ -103,11 +103,11 @@ const MockLink = Extension.create({
103
103
  });
104
104
 
105
105
  const MockLineHeight = Extension.create({
106
- name: TextSettings.LINE_HEIGHT,
106
+ name: TextSetting.LINE_HEIGHT,
107
107
 
108
108
  addGlobalAttributes: () => [
109
109
  {
110
- types: [NodeTypes.PARAGRAPH],
110
+ types: [NodeType.PARAGRAPH],
111
111
  attributes: {
112
112
  line_height: {
113
113
  isRequired: false,
@@ -294,7 +294,7 @@ describe('apply preset', () => {
294
294
  test('should apply regular to list', () => {
295
295
  const editor = createEditor({
296
296
  content: NodeFactory.doc([
297
- NodeFactory.list(ListTypes.LATIN, [
297
+ NodeFactory.list(ListType.LATIN, [
298
298
  NodeFactory.paragraph('Item 1'),
299
299
  NodeFactory.paragraph('Item 2')
300
300
  ])
@@ -311,7 +311,7 @@ describe('apply preset', () => {
311
311
  test('should apply heading to list', () => {
312
312
  const editor = createEditor({
313
313
  content: NodeFactory.doc([
314
- NodeFactory.list(ListTypes.LATIN, [
314
+ NodeFactory.list(ListType.LATIN, [
315
315
  NodeFactory.paragraph('Item 1'),
316
316
  NodeFactory.paragraph('Item 2')
317
317
  ])
@@ -384,7 +384,7 @@ describe('get preset customization', () => {
384
384
  presets: [createPreset({ id: 'regular-1' })]
385
385
  });
386
386
 
387
- const isFontSizeCustomized = editor.commands.isSettingCustomized(TextSettings.FONT_SIZE);
387
+ const isFontSizeCustomized = editor.commands.isSettingCustomized(TextSetting.FONT_SIZE);
388
388
 
389
389
  expect(isFontSizeCustomized.value).toBe(false);
390
390
  });
@@ -394,8 +394,8 @@ describe('get preset customization', () => {
394
394
  content: NodeFactory.doc([
395
395
  NodeFactory.paragraph({ preset: { id: 'regular-1' } }, [
396
396
  NodeFactory.text('test', [
397
- NodeFactory.mark(TextSettings.FONT_SIZE, { value: '12' }),
398
- NodeFactory.mark(TextSettings.FONT_WEIGHT, { value: '400' })
397
+ NodeFactory.mark(TextSetting.FONT_SIZE, { value: '12' }),
398
+ NodeFactory.mark(TextSetting.FONT_WEIGHT, { value: '400' })
399
399
  ])
400
400
  ])
401
401
  ]),
@@ -414,8 +414,8 @@ describe('get preset customization', () => {
414
414
  content: NodeFactory.doc([
415
415
  NodeFactory.paragraph({ preset: { id: 'regular-1' } }, [
416
416
  NodeFactory.text('test', [
417
- NodeFactory.mark(TextSettings.FONT_SIZE, { value: '12' }),
418
- NodeFactory.mark(TextSettings.FONT_WEIGHT, { value: '400' })
417
+ NodeFactory.mark(TextSetting.FONT_SIZE, { value: '12' }),
418
+ NodeFactory.mark(TextSetting.FONT_WEIGHT, { value: '400' })
419
419
  ])
420
420
  ])
421
421
  ]),
@@ -423,7 +423,7 @@ describe('get preset customization', () => {
423
423
  });
424
424
 
425
425
  editor.commands.selectAll();
426
- const isFontSizeCustomized = editor.commands.isSettingCustomized(TextSettings.FONT_SIZE);
426
+ const isFontSizeCustomized = editor.commands.isSettingCustomized(TextSetting.FONT_SIZE);
427
427
 
428
428
  expect(isFontSizeCustomized.value).toBe(true);
429
429
  });
@@ -458,7 +458,7 @@ describe('get preset customization', () => {
458
458
  });
459
459
 
460
460
  editor.commands.selectAll();
461
- const isLineHeightCustomized = editor.commands.isSettingCustomized(TextSettings.LINE_HEIGHT);
461
+ const isLineHeightCustomized = editor.commands.isSettingCustomized(TextSetting.LINE_HEIGHT);
462
462
 
463
463
  expect(isLineHeightCustomized.value).toBe(true);
464
464
  });
@@ -482,8 +482,8 @@ describe('get content customization', () => {
482
482
  content: NodeFactory.doc([
483
483
  NodeFactory.paragraph({ preset: { id: 'regular-2' } }, [
484
484
  NodeFactory.text('test', [
485
- NodeFactory.mark(TextSettings.FONT_SIZE, { value: '44' }),
486
- NodeFactory.mark(TextSettings.FONT_WEIGHT, { value: '500' })
485
+ NodeFactory.mark(TextSetting.FONT_SIZE, { value: '44' }),
486
+ NodeFactory.mark(TextSetting.FONT_WEIGHT, { value: '500' })
487
487
  ])
488
488
  ])
489
489
  ]),
@@ -518,11 +518,11 @@ describe('remove preset customization', () => {
518
518
  content: NodeFactory.doc([
519
519
  NodeFactory.paragraph({ preset: { id: 'regular-1' } }, [
520
520
  NodeFactory.text('test', [
521
- NodeFactory.mark(TextSettings.FONT_SIZE, { value: '12' }),
522
- NodeFactory.mark(TextSettings.FONT_WEIGHT, { value: '400' })
521
+ NodeFactory.mark(TextSetting.FONT_SIZE, { value: '12' }),
522
+ NodeFactory.mark(TextSetting.FONT_WEIGHT, { value: '400' })
523
523
  ]),
524
524
  NodeFactory.text(' test', [
525
- NodeFactory.mark(TextSettings.FONT_SIZE, { value: '12' })
525
+ NodeFactory.mark(TextSetting.FONT_SIZE, { value: '12' })
526
526
  ])
527
527
  ])
528
528
  ]),
@@ -563,11 +563,11 @@ describe('remove preset customization', () => {
563
563
  content: NodeFactory.doc([
564
564
  NodeFactory.paragraph({ preset: { id: 'regular-1' } }, [
565
565
  NodeFactory.text('test', [
566
- NodeFactory.mark(TextSettings.FONT_SIZE, { value: '12' }),
567
- NodeFactory.mark(TextSettings.FONT_WEIGHT, { value: '400' })
566
+ NodeFactory.mark(TextSetting.FONT_SIZE, { value: '12' }),
567
+ NodeFactory.mark(TextSetting.FONT_WEIGHT, { value: '400' })
568
568
  ]),
569
569
  NodeFactory.text(' test', [
570
- NodeFactory.mark(TextSettings.FONT_SIZE, { value: '12' })
570
+ NodeFactory.mark(TextSetting.FONT_SIZE, { value: '12' })
571
571
  ])
572
572
  ])
573
573
  ]),
@@ -2,7 +2,7 @@ import { Editor } from '@tiptap/vue-3';
2
2
  import { buildTestExtensions } from '../../__tests__/utils';
3
3
  import { ContentNormalizer, NodeFactory } from '../../services';
4
4
  import { Superscript } from '../Superscript';
5
- import { TextSettings } from '../../enums';
5
+ import { TextSetting } from '../../enums';
6
6
 
7
7
  function createEditor({ content }) {
8
8
  return new Editor({
@@ -19,7 +19,7 @@ describe('get value', () => {
19
19
  test('should get from selection', () => {
20
20
  const editor = createEditor({
21
21
  content: createContent(NodeFactory.text('hello world', [
22
- NodeFactory.mark(TextSettings.SUPERSCRIPT)
22
+ NodeFactory.mark(TextSetting.SUPERSCRIPT)
23
23
  ]))
24
24
  });
25
25
 
@@ -44,7 +44,7 @@ describe('apply value', () => {
44
44
  test('should remove superscript', () => {
45
45
  const editor = createEditor({
46
46
  content: createContent(NodeFactory.text('hello world', [
47
- NodeFactory.mark(TextSettings.SUPERSCRIPT)
47
+ NodeFactory.mark(TextSetting.SUPERSCRIPT)
48
48
  ]))
49
49
  });
50
50
 
@@ -68,7 +68,7 @@ describe('apply value', () => {
68
68
  test('should toggle superscript to removed', () => {
69
69
  const editor = createEditor({
70
70
  content: createContent(NodeFactory.text('hello world', [
71
- NodeFactory.mark(TextSettings.SUPERSCRIPT)
71
+ NodeFactory.mark(TextSetting.SUPERSCRIPT)
72
72
  ]))
73
73
  });
74
74
 
@@ -83,7 +83,7 @@ describe('rendering', () => {
83
83
  test('should render html', () => {
84
84
  const editor = createEditor({
85
85
  content: createContent(NodeFactory.text('hello world', [
86
- NodeFactory.mark(TextSettings.SUPERSCRIPT)
86
+ NodeFactory.mark(TextSetting.SUPERSCRIPT)
87
87
  ]))
88
88
  });
89
89
 
@@ -4,10 +4,10 @@ import { buildTestExtensions } from '../../__tests__/utils';
4
4
  import { createCommand } from '../../utils';
5
5
  import { TextDecoration } from '../TextDecoration';
6
6
  import { ContentNormalizer, NodeFactory } from '../../services';
7
- import { TextSettings } from '../../enums';
7
+ import { TextSetting } from '../../enums';
8
8
 
9
9
  const MockStylePreset = Extension.create({
10
- name: TextSettings.TEXT_DECORATION,
10
+ name: TextSetting.TEXT_DECORATION,
11
11
 
12
12
  addCommands() {
13
13
  return {
@@ -35,7 +35,7 @@ describe('get decoration', () => {
35
35
  test('should get from selection', () => {
36
36
  const editor = createEditor({
37
37
  content: createContent(NodeFactory.text('hello world', [
38
- NodeFactory.mark(TextSettings.TEXT_DECORATION, {
38
+ NodeFactory.mark(TextSetting.TEXT_DECORATION, {
39
39
  underline: true,
40
40
  strike_through: true
41
41
  })
@@ -65,7 +65,7 @@ describe('get decoration', () => {
65
65
  test('should get from selection', () => {
66
66
  const editor = createEditor({
67
67
  content: createContent(NodeFactory.text('hello world', [
68
- NodeFactory.mark(TextSettings.TEXT_DECORATION, { underline: true })
68
+ NodeFactory.mark(TextSetting.TEXT_DECORATION, { underline: true })
69
69
  ]))
70
70
  });
71
71
 
@@ -77,7 +77,7 @@ describe('get decoration', () => {
77
77
  test('should is customized settings', () => {
78
78
  const editor = createEditor({
79
79
  content: createContent(NodeFactory.text('hello world', [
80
- NodeFactory.mark(TextSettings.TEXT_DECORATION, { underline: true })
80
+ NodeFactory.mark(TextSetting.TEXT_DECORATION, { underline: true })
81
81
  ]))
82
82
  });
83
83
 
@@ -109,7 +109,7 @@ describe('get decoration', () => {
109
109
  test('should get from selection', () => {
110
110
  const editor = createEditor({
111
111
  content: createContent(NodeFactory.text('hello world', [
112
- NodeFactory.mark(TextSettings.TEXT_DECORATION, { strike_through: true })
112
+ NodeFactory.mark(TextSetting.TEXT_DECORATION, { strike_through: true })
113
113
  ]))
114
114
  });
115
115
 
@@ -145,7 +145,7 @@ describe('apply decoration', () => {
145
145
  test('should second decoration', () => {
146
146
  const editor = createEditor({
147
147
  content: createContent(NodeFactory.text('hello world', [
148
- NodeFactory.mark(TextSettings.TEXT_DECORATION, {
148
+ NodeFactory.mark(TextSetting.TEXT_DECORATION, {
149
149
  strike_through: true,
150
150
  underline: true
151
151
  })
@@ -163,7 +163,7 @@ describe('apply decoration', () => {
163
163
  content: NodeFactory.doc([
164
164
  NodeFactory.paragraph([
165
165
  NodeFactory.text('hello world', [
166
- NodeFactory.mark(TextSettings.TEXT_DECORATION, {
166
+ NodeFactory.mark(TextSetting.TEXT_DECORATION, {
167
167
  underline: true,
168
168
  strike_through: false
169
169
  })
@@ -182,7 +182,7 @@ describe('apply decoration', () => {
182
182
  const editor = createEditor({
183
183
  content: NodeFactory.doc([
184
184
  NodeFactory.paragraph(null, [
185
- NodeFactory.mark(TextSettings.TEXT_DECORATION, {
185
+ NodeFactory.mark(TextSetting.TEXT_DECORATION, {
186
186
  underline: false,
187
187
  strike_through: false
188
188
  })
@@ -200,7 +200,7 @@ describe('apply decoration', () => {
200
200
  test('should toggle to removed', () => {
201
201
  const editor = createEditor({
202
202
  content: createContent(NodeFactory.text('hello world', [
203
- NodeFactory.mark(TextSettings.TEXT_DECORATION, { underline: true })
203
+ NodeFactory.mark(TextSetting.TEXT_DECORATION, { underline: true })
204
204
  ]))
205
205
  });
206
206
 
@@ -226,7 +226,7 @@ describe('apply decoration', () => {
226
226
  test('should toggle to removed', () => {
227
227
  const editor = createEditor({
228
228
  content: createContent(NodeFactory.text('hello world', [
229
- NodeFactory.mark(TextSettings.TEXT_DECORATION, { strike_through: true })
229
+ NodeFactory.mark(TextSetting.TEXT_DECORATION, { strike_through: true })
230
230
  ]))
231
231
  });
232
232
 
@@ -253,7 +253,7 @@ describe('rendering', () => {
253
253
  test('should render underline only', () => {
254
254
  const editor = createEditor({
255
255
  content: createContent(NodeFactory.text('hello world', [
256
- NodeFactory.mark(TextSettings.TEXT_DECORATION, {
256
+ NodeFactory.mark(TextSetting.TEXT_DECORATION, {
257
257
  strike_through: false,
258
258
  underline: true
259
259
  })
@@ -266,7 +266,7 @@ describe('rendering', () => {
266
266
  test('should render strike through only', () => {
267
267
  const editor = createEditor({
268
268
  content: createContent(NodeFactory.text('hello world', [
269
- NodeFactory.mark(TextSettings.TEXT_DECORATION, {
269
+ NodeFactory.mark(TextSetting.TEXT_DECORATION, {
270
270
  strike_through: true,
271
271
  underline: false
272
272
  })
@@ -279,7 +279,7 @@ describe('rendering', () => {
279
279
  test('should render both', () => {
280
280
  const editor = createEditor({
281
281
  content: createContent(NodeFactory.text('hello world', [
282
- NodeFactory.mark(TextSettings.TEXT_DECORATION, {
282
+ NodeFactory.mark(TextSetting.TEXT_DECORATION, {
283
283
  strike_through: true,
284
284
  underline: true
285
285
  })
@@ -1,10 +1,10 @@
1
1
  import { Document as Base } from '@tiptap/extension-document';
2
- import { MarkGroups } from '../../enums';
3
- import { createCommand } from '../../utils';
2
+ import { MarkGroup } from '@/enums';
3
+ import { createCommand } from '@/utils';
4
4
  import { SetDocAttr } from '../steps';
5
5
 
6
6
  export const Document = Base.extend({
7
- marks: MarkGroups.SETTINGS,
7
+ marks: MarkGroup.SETTINGS,
8
8
 
9
9
  addAttributes: () => ({
10
10
  meta: { default: {} }
@@ -1,8 +1,8 @@
1
1
  import { Heading as Base } from '@tiptap/extension-heading';
2
- import { MarkGroups } from '../../enums';
2
+ import { MarkGroup } from '@/enums';
3
3
 
4
4
  export const Heading = Base.extend({
5
- marks: MarkGroups.ALL,
5
+ marks: MarkGroup.ALL,
6
6
 
7
7
  addOptions: () => ({
8
8
  levels: [1, 2, 3, 4],
@@ -6,8 +6,8 @@ import {
6
6
  isMarkAppliedToParent,
7
7
  isNodeFullySelected,
8
8
  resolveTextPosition
9
- } from '../../utils';
10
- import { MarkGroups, NodeTypes, TextSettings } from '../../enums';
9
+ } from '@/utils';
10
+ import { MarkGroup, NodeBlockTypeList, NodeType, TextSetting } from '@/enums';
11
11
 
12
12
  function removeNodeMark({ tr, node, position, mark }) {
13
13
  return node.isText
@@ -26,7 +26,7 @@ export const NodeProcessor = Extension.create({
26
26
  const { from, to } = tr.selection;
27
27
 
28
28
  doc.nodesBetween(from, to, (node, position) => {
29
- if (!NodeTypes.blocks.includes(node.type.name)) return;
29
+ if (!NodeBlockTypeList.includes(node.type.name)) return;
30
30
 
31
31
  tr.setNodeAttribute(position, name, { ...defaults, ...current, ...attrs });
32
32
  });
@@ -35,7 +35,7 @@ export const NodeProcessor = Extension.create({
35
35
  getBlockAttributes: createCommand(({ editor }, name, defaults) => computed(() => {
36
36
  let attrs = Object.assign({}, defaults || {});
37
37
 
38
- for (const type of NodeTypes.blocks) {
38
+ for (const type of NodeBlockTypeList) {
39
39
  Object.assign(attrs, editor.getAttributes(type)?.[name] || {});
40
40
  }
41
41
 
@@ -43,7 +43,7 @@ export const NodeProcessor = Extension.create({
43
43
  })),
44
44
 
45
45
  removeBlockAttributes: createCommand(({ commands }, names) => {
46
- for (const type of NodeTypes.blocks) {
46
+ for (const type of NodeBlockTypeList) {
47
47
  commands.resetAttributes(type, names);
48
48
  }
49
49
  }),
@@ -51,11 +51,11 @@ export const NodeProcessor = Extension.create({
51
51
  applyMark: createCommand(({ state, commands }, name, value, customizer = {}) => {
52
52
  const { tr, doc, schema } = state;
53
53
  const { $from, $to } = tr.selection;
54
- const linkMarkType = getMarkType(TextSettings.LINK, schema);
54
+ const linkMarkType = getMarkType(TextSetting.LINK, schema);
55
55
  const markType = getMarkType(name, schema);
56
56
  const markGroup = markType.spec.group || '';
57
57
 
58
- if (!markGroup.includes(MarkGroups.SETTINGS)) {
58
+ if (!markGroup.includes(MarkGroup.SETTINGS)) {
59
59
  // Apply inline mark if block level not supported
60
60
  return commands.setMark(name, value);
61
61
  }
@@ -71,7 +71,7 @@ export const NodeProcessor = Extension.create({
71
71
  };
72
72
 
73
73
  doc.nodesBetween($from.pos, $to.pos, (node, position) => {
74
- if (node.type.name === NodeTypes.LIST) return;
74
+ if (node.type.name === NodeType.LIST) return;
75
75
 
76
76
  const initialMark = findMarkByType(node.marks, name);
77
77
  const applyingMark = markType.create({ ...(initialMark?.attrs || {}), ...value });
@@ -1,8 +1,8 @@
1
1
  import { Paragraph as Base } from '@tiptap/extension-paragraph';
2
- import { MarkGroups } from '../../enums';
2
+ import { MarkGroup } from '../../enums';
3
3
 
4
4
  export const Paragraph = Base.extend({
5
- marks: MarkGroups.ALL,
5
+ marks: MarkGroup.ALL,
6
6
 
7
7
  addOptions: () => ({
8
8
  HTMLAttributes: { class: 'zw-style' }