@zipify/wysiwyg 4.11.0 → 4.11.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 (141) 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/types/models/Font.d.ts +1 -0
  57. package/dist/wysiwyg.css +27 -27
  58. package/dist/wysiwyg.mjs +135 -165
  59. package/example/fonts.js +111 -111
  60. package/lib/Wysiwyg.vue +3 -3
  61. package/lib/__tests__/utils/buildTestExtensions.js +6 -6
  62. package/lib/components/toolbar/Toolbar.vue +2 -2
  63. package/lib/components/toolbar/__tests__/Toolbar.test.js +5 -5
  64. package/lib/components/toolbar/controls/AlignmentControl.vue +7 -7
  65. package/lib/components/toolbar/controls/CaseStyleControl.vue +5 -5
  66. package/lib/components/toolbar/controls/FontColorControl.vue +2 -2
  67. package/lib/components/toolbar/controls/FontFamilyControl.vue +2 -2
  68. package/lib/components/toolbar/controls/FontSizeControl.vue +2 -2
  69. package/lib/components/toolbar/controls/FontWeightControl.vue +2 -2
  70. package/lib/components/toolbar/controls/ItalicControl.vue +2 -2
  71. package/lib/components/toolbar/controls/LineHeightControl.vue +2 -2
  72. package/lib/components/toolbar/controls/ListControl.vue +5 -5
  73. package/lib/components/toolbar/controls/__tests__/AlignmentControl.test.js +13 -13
  74. package/lib/components/toolbar/controls/__tests__/CaseStyleControl.test.js +4 -4
  75. package/lib/components/toolbar/controls/__tests__/ListControl.test.js +10 -10
  76. package/lib/components/toolbar/controls/__tests__/StylePresetControl.test.js +6 -6
  77. package/lib/components/toolbar/controls/link/LinkControl.vue +5 -5
  78. package/lib/components/toolbar/controls/link/composables/__tests__/useLink.test.js +20 -20
  79. package/lib/components/toolbar/controls/link/composables/useLink.js +10 -10
  80. package/lib/components/toolbar/controls/link/destination/LinkControlDestination.vue +10 -7
  81. package/lib/components/toolbar/controls/link/destination/LinkControlPageBlock.vue +1 -1
  82. package/lib/enums/{Alignments.ts → Alignment.ts} +0 -8
  83. package/lib/enums/{CaseStyles.ts → CaseStyle.ts} +0 -6
  84. package/lib/enums/{Devices.ts → Device.ts} +0 -8
  85. package/lib/enums/LinkDestination.ts +4 -0
  86. package/lib/enums/LinkTarget.ts +4 -0
  87. package/lib/enums/{ListTypes.ts → ListType.ts} +0 -9
  88. package/lib/enums/MarkGroup.ts +4 -0
  89. package/lib/enums/{NodeTypes.ts → NodeType.ts} +0 -8
  90. package/lib/enums/{TextSettings.ts → TextSetting.ts} +0 -11
  91. package/lib/enums/index.ts +9 -9
  92. package/lib/extensions/Alignment.js +13 -11
  93. package/lib/extensions/BackgroundColor.js +2 -2
  94. package/lib/extensions/CaseStyle.js +8 -6
  95. package/lib/extensions/FontColor.js +4 -4
  96. package/lib/extensions/FontFamily.js +8 -6
  97. package/lib/extensions/FontSize.js +3 -3
  98. package/lib/extensions/FontStyle.js +3 -3
  99. package/lib/extensions/FontWeight.js +3 -3
  100. package/lib/extensions/LineHeight.js +4 -4
  101. package/lib/extensions/Link.js +11 -11
  102. package/lib/extensions/Margin.js +4 -4
  103. package/lib/extensions/StylePreset.js +18 -12
  104. package/lib/extensions/Superscript.js +2 -2
  105. package/lib/extensions/TextDecoration.js +2 -2
  106. package/lib/extensions/__tests__/Alignment.test.js +21 -21
  107. package/lib/extensions/__tests__/BackgroundColor.test.js +4 -4
  108. package/lib/extensions/__tests__/CaseStyle.test.js +6 -6
  109. package/lib/extensions/__tests__/FontColor.test.js +4 -4
  110. package/lib/extensions/__tests__/FontFamily.test.js +10 -10
  111. package/lib/extensions/__tests__/FontSize.test.js +9 -9
  112. package/lib/extensions/__tests__/FontStyle.test.js +6 -6
  113. package/lib/extensions/__tests__/FontWeight.test.js +11 -11
  114. package/lib/extensions/__tests__/LineHeight.test.js +2 -2
  115. package/lib/extensions/__tests__/Link.test.js +13 -13
  116. package/lib/extensions/__tests__/StylePreset.test.js +29 -29
  117. package/lib/extensions/__tests__/Superscript.test.js +5 -5
  118. package/lib/extensions/__tests__/TextDecoration.test.js +14 -14
  119. package/lib/extensions/core/Document.js +3 -3
  120. package/lib/extensions/core/Heading.js +2 -2
  121. package/lib/extensions/core/NodeProcessor.js +8 -8
  122. package/lib/extensions/core/Paragraph.js +2 -2
  123. package/lib/extensions/core/__tests__/NodeProcessor.test.js +68 -68
  124. package/lib/extensions/core/__tests__/TextProcessor.test.js +13 -13
  125. package/lib/extensions/list/ListItem.js +5 -5
  126. package/lib/extensions/list/__tests__/List.test.js +11 -11
  127. package/lib/extensions/proseMirror/PasteLinkPlugin.js +4 -4
  128. package/lib/extensions/proseMirror/PastePlugin.js +2 -2
  129. package/lib/models/Font.ts +4 -0
  130. package/lib/services/ContentSerializer.js +3 -3
  131. package/lib/services/StylePresetRenderer.js +4 -4
  132. package/lib/services/__tests__/NodeFactory.test.js +11 -11
  133. package/lib/services/__tests__/NodeSelector.test.js +18 -18
  134. package/lib/services/normalizer/JsonNormalizer.js +5 -5
  135. package/lib/services/normalizer/__tests__/JsonNormalizer.test.js +15 -15
  136. package/lib/utils/__tests__/convertAlignment.test.js +3 -3
  137. package/lib/utils/convertAlignment.js +4 -4
  138. package/package.json +17 -17
  139. package/lib/enums/LinkDestinations.ts +0 -9
  140. package/lib/enums/LinkTargets.ts +0 -9
  141. package/lib/enums/MarkGroups.ts +0 -9
@@ -1,17 +1,17 @@
1
1
  import { ref } from 'vue';
2
2
  import { Editor, Extension, Mark } from '@tiptap/vue-3';
3
- import { buildTestExtensions } from '../../../__tests__/utils';
4
- import { Devices, ListTypes, MarkGroups, NodeTypes, TextSettings } from '../../../enums';
5
- import { ContentNormalizer, NodeFactory } from '../../../services';
6
- import { createCommand } from '../../../utils';
3
+ import { buildTestExtensions } from '@/__tests__/utils';
4
+ import { Device, ListType, MarkGroup, NodeType, TextSetting } from '@/enums';
5
+ import { ContentNormalizer, NodeFactory } from '@/services';
6
+ import { createCommand } from '@/utils';
7
7
  import { List } from '../../list';
8
8
 
9
9
  const MockLineHeight = Extension.create({
10
- name: TextSettings.LINE_HEIGHT,
10
+ name: TextSetting.LINE_HEIGHT,
11
11
 
12
12
  addGlobalAttributes: () => [
13
13
  {
14
- types: [NodeTypes.PARAGRAPH],
14
+ types: [NodeType.PARAGRAPH],
15
15
  attributes: {
16
16
  line_height: {
17
17
  isRequired: false,
@@ -26,7 +26,7 @@ const MockLineHeight = Extension.create({
26
26
  });
27
27
 
28
28
  const MockTextDecoration = Mark.create({
29
- name: TextSettings.TEXT_DECORATION,
29
+ name: TextSetting.TEXT_DECORATION,
30
30
  renderHTML: () => ['span', {}, 0],
31
31
 
32
32
  addAttributes: () => ({
@@ -36,15 +36,15 @@ const MockTextDecoration = Mark.create({
36
36
  });
37
37
 
38
38
  const MockFontWeight = Mark.create({
39
- name: TextSettings.FONT_WEIGHT,
40
- group: MarkGroups.SETTINGS,
39
+ name: TextSetting.FONT_WEIGHT,
40
+ group: MarkGroup.SETTINGS,
41
41
  renderHTML: () => ['span', {}, 0],
42
42
  addAttributes: () => ({ value: { required: true } })
43
43
  });
44
44
 
45
45
  const MockFontSize = Mark.create({
46
- name: TextSettings.FONT_SIZE,
47
- group: MarkGroups.SETTINGS,
46
+ name: TextSetting.FONT_SIZE,
47
+ group: MarkGroup.SETTINGS,
48
48
  renderHTML: () => ['span', {}, 0],
49
49
 
50
50
  addAttributes: () => ({
@@ -76,7 +76,7 @@ function createEditor({ content, device }) {
76
76
  MockFontSize,
77
77
  MockTextDecoration,
78
78
  List.configure({ baseClass: 'zw-list--' }),
79
- DeviceManager.configure({ device: device ?? Devices.DESKTOP })
79
+ DeviceManager.configure({ device: device ?? Device.DESKTOP })
80
80
  ]
81
81
  })
82
82
  });
@@ -101,7 +101,7 @@ describe('block attributes', () => {
101
101
  line_height: { mobile: '1.2' }
102
102
  })
103
103
  });
104
- const attrs = editor.commands.getBlockAttributes(TextSettings.LINE_HEIGHT);
104
+ const attrs = editor.commands.getBlockAttributes(TextSetting.LINE_HEIGHT);
105
105
 
106
106
  expect(attrs.value).toEqual({ mobile: '1.2' });
107
107
  });
@@ -112,7 +112,7 @@ describe('block attributes', () => {
112
112
  line_height: { mobile: '1.2' }
113
113
  })
114
114
  });
115
- const attrs = editor.commands.getBlockAttributes(TextSettings.LINE_HEIGHT, DEFAULTS);
115
+ const attrs = editor.commands.getBlockAttributes(TextSetting.LINE_HEIGHT, DEFAULTS);
116
116
 
117
117
  expect(attrs.value).toEqual({
118
118
  mobile: '1.2',
@@ -125,7 +125,7 @@ describe('block attributes', () => {
125
125
  const editor = createEditor({
126
126
  content: createContent({ line_height: null })
127
127
  });
128
- const attrs = editor.commands.getBlockAttributes(TextSettings.LINE_HEIGHT);
128
+ const attrs = editor.commands.getBlockAttributes(TextSetting.LINE_HEIGHT);
129
129
 
130
130
  expect(attrs.value).toBeNull();
131
131
  });
@@ -136,7 +136,7 @@ describe('block attributes', () => {
136
136
  });
137
137
 
138
138
  editor.commands.selectAll();
139
- editor.commands.setBlockAttributes(TextSettings.LINE_HEIGHT, { mobile: '1.3' });
139
+ editor.commands.setBlockAttributes(TextSetting.LINE_HEIGHT, { mobile: '1.3' });
140
140
 
141
141
  expect(editor.getJSON()).toMatchSnapshot();
142
142
  });
@@ -149,7 +149,7 @@ describe('block attributes', () => {
149
149
  });
150
150
 
151
151
  editor.commands.selectAll();
152
- editor.commands.removeBlockAttributes(TextSettings.LINE_HEIGHT);
152
+ editor.commands.removeBlockAttributes(TextSetting.LINE_HEIGHT);
153
153
 
154
154
  expect(editor.getJSON()).toMatchSnapshot();
155
155
  });
@@ -167,7 +167,7 @@ describe('block attributes', () => {
167
167
  });
168
168
 
169
169
  editor.commands.selectAll();
170
- editor.commands.removeBlockAttributes([TextSettings.LINE_HEIGHT, TextSettings.ALIGNMENT]);
170
+ editor.commands.removeBlockAttributes([TextSetting.LINE_HEIGHT, TextSetting.ALIGNMENT]);
171
171
 
172
172
  expect(editor.getJSON()).toMatchSnapshot();
173
173
  });
@@ -178,7 +178,7 @@ describe('block attributes', () => {
178
178
  });
179
179
 
180
180
  editor.commands.selectAll();
181
- editor.commands.setBlockAttributes(TextSettings.LINE_HEIGHT, { mobile: '1.3' }, DEFAULTS);
181
+ editor.commands.setBlockAttributes(TextSetting.LINE_HEIGHT, { mobile: '1.3' }, DEFAULTS);
182
182
 
183
183
  expect(editor.getJSON()).toMatchSnapshot();
184
184
  });
@@ -191,7 +191,7 @@ describe('block attributes', () => {
191
191
  });
192
192
 
193
193
  editor.commands.selectAll();
194
- editor.commands.setBlockAttributes(TextSettings.LINE_HEIGHT, { mobile: '1.3' });
194
+ editor.commands.setBlockAttributes(TextSetting.LINE_HEIGHT, { mobile: '1.3' });
195
195
 
196
196
  expect(editor.getJSON()).toMatchSnapshot();
197
197
  });
@@ -204,7 +204,7 @@ describe('block attributes', () => {
204
204
  });
205
205
 
206
206
  editor.commands.selectAll();
207
- editor.commands.setBlockAttributes(TextSettings.LINE_HEIGHT, { mobile: '1.3' }, DEFAULTS);
207
+ editor.commands.setBlockAttributes(TextSetting.LINE_HEIGHT, { mobile: '1.3' }, DEFAULTS);
208
208
 
209
209
  expect(editor.getJSON()).toMatchSnapshot();
210
210
  });
@@ -217,7 +217,7 @@ describe('apply mark', () => {
217
217
  });
218
218
 
219
219
  editor.commands.setTextSelection({ from: 1, to: 6 });
220
- editor.commands.applyMark(TextSettings.FONT_WEIGHT, { value: '700' });
220
+ editor.commands.applyMark(TextSetting.FONT_WEIGHT, { value: '700' });
221
221
 
222
222
  expect(editor.getJSON()).toMatchSnapshot();
223
223
  });
@@ -227,7 +227,7 @@ describe('apply mark', () => {
227
227
  content: NodeFactory.doc([
228
228
  NodeFactory.paragraph([
229
229
  NodeFactory.text('lorem', [
230
- NodeFactory.mark(TextSettings.FONT_WEIGHT, { value: '900' })
230
+ NodeFactory.mark(TextSetting.FONT_WEIGHT, { value: '900' })
231
231
  ]),
232
232
  NodeFactory.text(' ipsum')
233
233
  ])
@@ -235,7 +235,7 @@ describe('apply mark', () => {
235
235
  });
236
236
 
237
237
  editor.commands.setTextSelection({ from: 1, to: 10 });
238
- editor.commands.applyMark(TextSettings.FONT_WEIGHT, { value: '700' });
238
+ editor.commands.applyMark(TextSetting.FONT_WEIGHT, { value: '700' });
239
239
 
240
240
  expect(editor.getJSON()).toMatchSnapshot();
241
241
  });
@@ -248,7 +248,7 @@ describe('apply mark', () => {
248
248
  editor
249
249
  .chain()
250
250
  .selectAll()
251
- .applyMark(TextSettings.FONT_WEIGHT, { value: '700' })
251
+ .applyMark(TextSetting.FONT_WEIGHT, { value: '700' })
252
252
  .run();
253
253
 
254
254
  expect(editor.getJSON()).toMatchSnapshot();
@@ -257,13 +257,13 @@ describe('apply mark', () => {
257
257
  test('should apply text mark to paragraph with mark', () => {
258
258
  const editor = createEditor({
259
259
  content: NodeFactory.doc([
260
- NodeFactory.paragraph(null, [NodeFactory.mark(TextSettings.FONT_WEIGHT, { value: '700' })], 'lorem impum')
260
+ NodeFactory.paragraph(null, [NodeFactory.mark(TextSetting.FONT_WEIGHT, { value: '700' })], 'lorem impum')
261
261
  ])
262
262
  });
263
263
 
264
264
 
265
265
  editor.commands.setTextSelection({ from: 1, to: 6 });
266
- editor.commands.applyMark(TextSettings.FONT_WEIGHT, { value: '400' });
266
+ editor.commands.applyMark(TextSetting.FONT_WEIGHT, { value: '400' });
267
267
 
268
268
  expect(editor.getJSON()).toMatchSnapshot();
269
269
  });
@@ -276,7 +276,7 @@ describe('apply mark', () => {
276
276
  });
277
277
 
278
278
  editor.commands.selectAll();
279
- editor.commands.applyMark(TextSettings.TEXT_DECORATION, { underline: true });
279
+ editor.commands.applyMark(TextSetting.TEXT_DECORATION, { underline: true });
280
280
 
281
281
  expect(editor.getJSON()).toMatchSnapshot();
282
282
  });
@@ -289,7 +289,7 @@ describe('apply mark', () => {
289
289
  });
290
290
 
291
291
  editor.commands.setTextSelection({ from: 1, to: 6 });
292
- editor.commands.applyMark(TextSettings.FONT_WEIGHT, { value: '700' });
292
+ editor.commands.applyMark(TextSetting.FONT_WEIGHT, { value: '700' });
293
293
 
294
294
  expect(editor.getJSON()).toMatchSnapshot();
295
295
  });
@@ -302,7 +302,7 @@ describe('apply mark', () => {
302
302
  });
303
303
 
304
304
  editor.commands.selectAll();
305
- editor.commands.applyMark(TextSettings.FONT_WEIGHT, { value: '700' });
305
+ editor.commands.applyMark(TextSetting.FONT_WEIGHT, { value: '700' });
306
306
 
307
307
  expect(editor.getJSON()).toMatchSnapshot();
308
308
  });
@@ -312,7 +312,7 @@ describe('apply mark', () => {
312
312
  content: NodeFactory.doc([
313
313
  NodeFactory.paragraph([
314
314
  NodeFactory.text('lorem', [
315
- NodeFactory.mark(TextSettings.FONT_WEIGHT, { value: '400' })
315
+ NodeFactory.mark(TextSetting.FONT_WEIGHT, { value: '400' })
316
316
  ]),
317
317
  NodeFactory.text(' ipsum')
318
318
  ])
@@ -320,7 +320,7 @@ describe('apply mark', () => {
320
320
  });
321
321
 
322
322
  editor.commands.selectAll();
323
- editor.commands.applyMark(TextSettings.FONT_WEIGHT, { value: '700' });
323
+ editor.commands.applyMark(TextSetting.FONT_WEIGHT, { value: '700' });
324
324
 
325
325
  expect(editor.getJSON()).toMatchSnapshot();
326
326
  });
@@ -328,7 +328,7 @@ describe('apply mark', () => {
328
328
  test('should apply mark to list item', () => {
329
329
  const editor = createEditor({
330
330
  content: NodeFactory.doc([
331
- NodeFactory.list(ListTypes.DISC, [
331
+ NodeFactory.list(ListType.DISC, [
332
332
  'lorem ipsum 1',
333
333
  'lorem ipsum 2'
334
334
  ])
@@ -336,7 +336,7 @@ describe('apply mark', () => {
336
336
  });
337
337
 
338
338
  editor.commands.setTextSelection({ from: 1, to: 16 });
339
- editor.commands.applyMark(TextSettings.FONT_WEIGHT, { value: '700' });
339
+ editor.commands.applyMark(TextSetting.FONT_WEIGHT, { value: '700' });
340
340
 
341
341
  expect(editor.getJSON()).toMatchSnapshot();
342
342
  });
@@ -344,10 +344,10 @@ describe('apply mark', () => {
344
344
  test('should remove paragraph mark on applying to list item', () => {
345
345
  const editor = createEditor({
346
346
  content: NodeFactory.doc([
347
- NodeFactory.list(ListTypes.DISC, [
347
+ NodeFactory.list(ListType.DISC, [
348
348
  NodeFactory.listItem([
349
349
  NodeFactory.paragraph(null, [
350
- NodeFactory.mark(TextSettings.FONT_WEIGHT, { value: '400' })
350
+ NodeFactory.mark(TextSetting.FONT_WEIGHT, { value: '400' })
351
351
  ], 'lorem ipsum 1'),
352
352
 
353
353
  'lorem ipsum 2' // prevent move mark to list item on init
@@ -359,7 +359,7 @@ describe('apply mark', () => {
359
359
  });
360
360
 
361
361
  editor.commands.setTextSelection({ from: 1, to: 31 });
362
- editor.commands.applyMark(TextSettings.FONT_WEIGHT, { value: '700' });
362
+ editor.commands.applyMark(TextSetting.FONT_WEIGHT, { value: '700' });
363
363
 
364
364
  expect(editor.getJSON()).toMatchSnapshot();
365
365
  });
@@ -370,10 +370,10 @@ describe('get marks', () => {
370
370
  const editor = createEditor({
371
371
  content: NodeFactory.doc([
372
372
  NodeFactory.paragraph(null, [
373
- NodeFactory.mark(TextSettings.FONT_WEIGHT, { value: '400' })
373
+ NodeFactory.mark(TextSetting.FONT_WEIGHT, { value: '400' })
374
374
  ], [
375
375
  NodeFactory.text('lorem', [
376
- NodeFactory.mark(TextSettings.FONT_WEIGHT, { value: '700' })
376
+ NodeFactory.mark(TextSetting.FONT_WEIGHT, { value: '700' })
377
377
  ]),
378
378
  NodeFactory.text(' ipsum')
379
379
  ])
@@ -381,7 +381,7 @@ describe('get marks', () => {
381
381
  });
382
382
 
383
383
  editor.commands.selectAll();
384
- const selectionRef = editor.commands.getMarks(TextSettings.FONT_WEIGHT);
384
+ const selectionRef = editor.commands.getMarks(TextSetting.FONT_WEIGHT);
385
385
 
386
386
  expect(selectionRef.value).toEqual([
387
387
  { value: '700' },
@@ -397,7 +397,7 @@ describe('get marks', () => {
397
397
  });
398
398
 
399
399
  editor.commands.selectAll();
400
- const selectionRef = editor.commands.getMarks(TextSettings.FONT_WEIGHT);
400
+ const selectionRef = editor.commands.getMarks(TextSetting.FONT_WEIGHT);
401
401
 
402
402
  expect(selectionRef.value).toEqual([]);
403
403
  });
@@ -408,10 +408,10 @@ describe('get mark', () => {
408
408
  const editor = createEditor({
409
409
  content: NodeFactory.doc([
410
410
  NodeFactory.paragraph(null, [
411
- NodeFactory.mark(TextSettings.FONT_WEIGHT, { value: '400' })
411
+ NodeFactory.mark(TextSetting.FONT_WEIGHT, { value: '400' })
412
412
  ], [
413
413
  NodeFactory.text('lorem', [
414
- NodeFactory.mark(TextSettings.FONT_WEIGHT, { value: '700' })
414
+ NodeFactory.mark(TextSetting.FONT_WEIGHT, { value: '700' })
415
415
  ]),
416
416
  NodeFactory.text(' ipsum')
417
417
  ])
@@ -419,7 +419,7 @@ describe('get mark', () => {
419
419
  });
420
420
 
421
421
  editor.commands.selectAll();
422
- const selectionRef = editor.commands.getMark(TextSettings.FONT_WEIGHT);
422
+ const selectionRef = editor.commands.getMark(TextSetting.FONT_WEIGHT);
423
423
 
424
424
  expect(selectionRef.value).toEqual({ value: '700' });
425
425
  });
@@ -428,13 +428,13 @@ describe('get mark', () => {
428
428
  const editor = createEditor({
429
429
  content: NodeFactory.doc([
430
430
  NodeFactory.paragraph(null, [
431
- NodeFactory.mark(TextSettings.FONT_WEIGHT, { value: '400' })
431
+ NodeFactory.mark(TextSetting.FONT_WEIGHT, { value: '400' })
432
432
  ], 'lorem ipsum')
433
433
  ])
434
434
  });
435
435
 
436
436
  editor.commands.selectAll();
437
- const selectionRef = editor.commands.getMark(TextSettings.FONT_WEIGHT);
437
+ const selectionRef = editor.commands.getMark(TextSetting.FONT_WEIGHT);
438
438
 
439
439
  expect(selectionRef.value).toEqual({ value: '400' });
440
440
  });
@@ -446,13 +446,13 @@ describe('has mark', () => {
446
446
  content: NodeFactory.doc([
447
447
  NodeFactory.paragraph([
448
448
  NodeFactory.text('lorem ipsum', [
449
- NodeFactory.mark(TextSettings.FONT_WEIGHT, { value: '700' })
449
+ NodeFactory.mark(TextSetting.FONT_WEIGHT, { value: '700' })
450
450
  ])
451
451
  ])
452
452
  ])
453
453
  });
454
454
 
455
- expect(editor.commands.hasMark(TextSettings.FONT_WEIGHT).value).toBe(true);
455
+ expect(editor.commands.hasMark(TextSetting.FONT_WEIGHT).value).toBe(true);
456
456
  });
457
457
 
458
458
  test('should not detect mark', () => {
@@ -462,7 +462,7 @@ describe('has mark', () => {
462
462
  ])
463
463
  });
464
464
 
465
- expect(editor.commands.hasMark(TextSettings.FONT_WEIGHT).value).toBe(false);
465
+ expect(editor.commands.hasMark(TextSetting.FONT_WEIGHT).value).toBe(false);
466
466
  });
467
467
  });
468
468
 
@@ -471,13 +471,13 @@ describe('get setting mark', () => {
471
471
  const editor = createEditor({
472
472
  content: NodeFactory.doc([
473
473
  NodeFactory.paragraph(null, [
474
- NodeFactory.mark(TextSettings.FONT_WEIGHT, { value: '400' })
474
+ NodeFactory.mark(TextSetting.FONT_WEIGHT, { value: '400' })
475
475
  ], 'lorem ipsum')
476
476
  ])
477
477
  });
478
478
 
479
479
  editor.commands.selectAll();
480
- const selectionRef = editor.commands.getCommonSettingMark(TextSettings.FONT_WEIGHT);
480
+ const selectionRef = editor.commands.getCommonSettingMark(TextSetting.FONT_WEIGHT);
481
481
 
482
482
  expect(selectionRef.value).toBe('400');
483
483
  });
@@ -490,7 +490,7 @@ describe('get setting mark', () => {
490
490
  });
491
491
 
492
492
  editor.commands.selectAll();
493
- const selectionRef = editor.commands.getCommonSettingMark(TextSettings.FONT_WEIGHT, ref('400'));
493
+ const selectionRef = editor.commands.getCommonSettingMark(TextSetting.FONT_WEIGHT, ref('400'));
494
494
 
495
495
  expect(selectionRef.value).toBe('400');
496
496
  });
@@ -499,14 +499,14 @@ describe('get setting mark', () => {
499
499
  const editor = createEditor({
500
500
  content: NodeFactory.doc([
501
501
  NodeFactory.paragraph(null, [
502
- NodeFactory.mark(TextSettings.FONT_SIZE, { mobile: '23' })
502
+ NodeFactory.mark(TextSetting.FONT_SIZE, { mobile: '23' })
503
503
  ], 'lorem ipsum')
504
504
  ]),
505
- device: Devices.MOBILE
505
+ device: Device.MOBILE
506
506
  });
507
507
 
508
508
  editor.commands.selectAll();
509
- const selectionRef = editor.commands.getDeviceSettingMark(TextSettings.FONT_SIZE);
509
+ const selectionRef = editor.commands.getDeviceSettingMark(TextSetting.FONT_SIZE);
510
510
 
511
511
  expect(selectionRef.value).toBe('23');
512
512
  });
@@ -516,11 +516,11 @@ describe('get setting mark', () => {
516
516
  content: NodeFactory.doc([
517
517
  NodeFactory.paragraph('lorem ipsum')
518
518
  ]),
519
- device: Devices.MOBILE
519
+ device: Device.MOBILE
520
520
  });
521
521
 
522
522
  editor.commands.selectAll();
523
- const selectionRef = editor.commands.getDeviceSettingMark(TextSettings.FONT_SIZE, ref('23'));
523
+ const selectionRef = editor.commands.getDeviceSettingMark(TextSetting.FONT_SIZE, ref('23'));
524
524
 
525
525
  expect(selectionRef.value).toBe('23');
526
526
  });
@@ -529,19 +529,19 @@ describe('get setting mark', () => {
529
529
  const editor = createEditor({
530
530
  content: NodeFactory.doc([
531
531
  NodeFactory.paragraph(null, [
532
- NodeFactory.mark(TextSettings.FONT_SIZE, { mobile: '23' })
532
+ NodeFactory.mark(TextSetting.FONT_SIZE, { mobile: '23' })
533
533
  ], [
534
534
  NodeFactory.text('lorem', [
535
- NodeFactory.mark(TextSettings.FONT_SIZE, { tablet: '25' })
535
+ NodeFactory.mark(TextSetting.FONT_SIZE, { tablet: '25' })
536
536
  ]),
537
537
  NodeFactory.text(' ipsum')
538
538
  ])
539
539
  ]),
540
- device: Devices.MOBILE
540
+ device: Device.MOBILE
541
541
  });
542
542
 
543
543
  editor.commands.selectAll();
544
- const selectionRef = editor.commands.getDeviceSettingMark(TextSettings.FONT_SIZE);
544
+ const selectionRef = editor.commands.getDeviceSettingMark(TextSetting.FONT_SIZE);
545
545
 
546
546
  expect(selectionRef.value).toBe('23');
547
547
  });
@@ -553,7 +553,7 @@ describe('remove marks', () => {
553
553
  content: NodeFactory.doc([
554
554
  NodeFactory.paragraph([
555
555
  NodeFactory.text('lorem', [
556
- NodeFactory.mark(TextSettings.FONT_WEIGHT, { value: '700' })
556
+ NodeFactory.mark(TextSetting.FONT_WEIGHT, { value: '700' })
557
557
  ]),
558
558
  NodeFactory.text(' ipsum')
559
559
  ])
@@ -561,7 +561,7 @@ describe('remove marks', () => {
561
561
  });
562
562
 
563
563
  editor.commands.selectAll();
564
- editor.commands.removeMarks([TextSettings.FONT_WEIGHT]);
564
+ editor.commands.removeMarks([TextSetting.FONT_WEIGHT]);
565
565
 
566
566
  expect(editor.getJSON()).toMatchSnapshot();
567
567
  });
@@ -570,13 +570,13 @@ describe('remove marks', () => {
570
570
  const editor = createEditor({
571
571
  content: NodeFactory.doc([
572
572
  NodeFactory.paragraph(null, [
573
- NodeFactory.mark(TextSettings.FONT_WEIGHT, { value: '700' })
573
+ NodeFactory.mark(TextSetting.FONT_WEIGHT, { value: '700' })
574
574
  ], 'lorem ipsum')
575
575
  ])
576
576
  });
577
577
 
578
578
  editor.commands.selectAll();
579
- editor.commands.removeMarks([TextSettings.FONT_WEIGHT]);
579
+ editor.commands.removeMarks([TextSetting.FONT_WEIGHT]);
580
580
 
581
581
  expect(editor.getJSON()).toMatchSnapshot();
582
582
  });
@@ -585,18 +585,18 @@ describe('remove marks', () => {
585
585
  const editor = createEditor({
586
586
  content: NodeFactory.doc([
587
587
  NodeFactory.paragraph(null, [
588
- NodeFactory.mark(TextSettings.FONT_WEIGHT, { value: '700' })
588
+ NodeFactory.mark(TextSetting.FONT_WEIGHT, { value: '700' })
589
589
  ], [
590
590
  NodeFactory.text('lorem'),
591
591
  NodeFactory.text(' ipsum', [
592
- NodeFactory.mark(TextSettings.FONT_WEIGHT, { value: '400' })
592
+ NodeFactory.mark(TextSetting.FONT_WEIGHT, { value: '400' })
593
593
  ])
594
594
  ])
595
595
  ])
596
596
  });
597
597
 
598
598
  editor.commands.selectAll();
599
- editor.commands.removeMarks([TextSettings.FONT_WEIGHT]);
599
+ editor.commands.removeMarks([TextSetting.FONT_WEIGHT]);
600
600
 
601
601
  expect(editor.getJSON()).toMatchSnapshot();
602
602
  });
@@ -1,10 +1,10 @@
1
1
  import { Editor, Mark, Extension } from '@tiptap/vue-3';
2
2
  import { buildTestExtensions } from '../../../__tests__/utils';
3
3
  import { ContentNormalizer, NodeFactory } from '../../../services';
4
- import { NodeTypes, TextSettings } from '../../../enums';
4
+ import { NodeType, TextSetting } from '../../../enums';
5
5
 
6
6
  const MockFontSize = Mark.create({
7
- name: TextSettings.FONT_SIZE,
7
+ name: TextSetting.FONT_SIZE,
8
8
 
9
9
  addAttributes: () => ({
10
10
  value: { default: null }
@@ -14,7 +14,7 @@ const MockFontSize = Mark.create({
14
14
  });
15
15
 
16
16
  const MockFontWeight = Mark.create({
17
- name: TextSettings.FONT_WEIGHT,
17
+ name: TextSetting.FONT_WEIGHT,
18
18
 
19
19
  addAttributes: () => ({
20
20
  value: { default: null }
@@ -24,13 +24,13 @@ const MockFontWeight = Mark.create({
24
24
  });
25
25
 
26
26
  const MockAlignment = Extension.create({
27
- name: TextSettings.ALIGNMENT,
27
+ name: TextSetting.ALIGNMENT,
28
28
 
29
29
  addGlobalAttributes: () => [
30
30
  {
31
- types: [NodeTypes.PARAGRAPH, NodeTypes.HEADING],
31
+ types: [NodeType.PARAGRAPH, NodeType.HEADING],
32
32
  attributes: {
33
- [TextSettings.ALIGNMENT]: {
33
+ [TextSetting.ALIGNMENT]: {
34
34
  default: null,
35
35
  renderHTML: () => ({})
36
36
  }
@@ -40,7 +40,7 @@ const MockAlignment = Extension.create({
40
40
  });
41
41
 
42
42
  const MockBackgroundColor = Mark.create({
43
- name: TextSettings.BACKGROUND_COLOR,
43
+ name: TextSetting.BACKGROUND_COLOR,
44
44
 
45
45
  addAttributes: () => ({
46
46
  value: { default: null }
@@ -50,7 +50,7 @@ const MockBackgroundColor = Mark.create({
50
50
  });
51
51
 
52
52
  const MockFontColor = Mark.create({
53
- name: TextSettings.FONT_COLOR,
53
+ name: TextSetting.FONT_COLOR,
54
54
 
55
55
  addAttributes: () => ({
56
56
  value: { default: null }
@@ -60,7 +60,7 @@ const MockFontColor = Mark.create({
60
60
  });
61
61
 
62
62
  const MockFontFamily = Mark.create({
63
- name: TextSettings.FONT_FAMILY,
63
+ name: TextSetting.FONT_FAMILY,
64
64
 
65
65
  addAttributes: () => ({
66
66
  value: { default: null }
@@ -70,7 +70,7 @@ const MockFontFamily = Mark.create({
70
70
  });
71
71
 
72
72
  const MockFontStyle = Mark.create({
73
- name: TextSettings.FONT_STYLE,
73
+ name: TextSetting.FONT_STYLE,
74
74
 
75
75
  addAttributes: () => ({
76
76
  value: { default: null }
@@ -80,7 +80,7 @@ const MockFontStyle = Mark.create({
80
80
  });
81
81
 
82
82
  const MockTextDecoration = Mark.create({
83
- name: TextSettings.TEXT_DECORATION,
83
+ name: TextSetting.TEXT_DECORATION,
84
84
 
85
85
  addAttributes: () => ({
86
86
  value: { default: null }
@@ -90,7 +90,7 @@ const MockTextDecoration = Mark.create({
90
90
  });
91
91
 
92
92
  const MockSuperscript = Mark.create({
93
- name: TextSettings.SUPERSCRIPT,
93
+ name: TextSetting.SUPERSCRIPT,
94
94
 
95
95
  addAttributes: () => ({
96
96
  value: { default: null }
@@ -138,7 +138,7 @@ describe('transform text', () => {
138
138
  content: NodeFactory.doc([
139
139
  NodeFactory.paragraph([
140
140
  NodeFactory.text('hello world', [
141
- NodeFactory.mark(TextSettings.FONT_WEIGHT, { value: '700' })
141
+ NodeFactory.mark(TextSetting.FONT_WEIGHT, { value: '700' })
142
142
  ])
143
143
  ])
144
144
  ])
@@ -1,10 +1,10 @@
1
1
  import Base from '@tiptap/extension-list-item';
2
- import { MarkGroups, NodeTypes } from '../../enums';
3
- import { copyMark, createCommand } from '../../utils';
2
+ import { MarkGroup, NodeType } from '@/enums';
3
+ import { copyMark, createCommand } from '@/utils';
4
4
 
5
5
  export const ListItem = Base.extend({
6
- name: NodeTypes.LIST_ITEM,
7
- marks: MarkGroups.SETTINGS,
6
+ name: NodeType.LIST_ITEM,
7
+ marks: MarkGroup.SETTINGS,
8
8
 
9
9
  addCommands() {
10
10
  const getItemPosition = ({ selection }) => selection.$cursor.before(selection.$cursor.depth - 1);
@@ -38,7 +38,7 @@ export const ListItem = Base.extend({
38
38
  const { state, commands } = context.editor;
39
39
 
40
40
  const isListSelected = state.selection.$cursor?.path.some((node) => {
41
- return node.type?.name === NodeTypes.LIST;
41
+ return node.type?.name === NodeType.LIST;
42
42
  });
43
43
 
44
44
  if (isListSelected) return commands.listItemNewline();