@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
@@ -28,7 +28,7 @@ import { computed, inject } from 'vue';
28
28
  import { InjectionTokens } from '../../../injectionTokens';
29
29
  import { tooltip as vTooltip } from '../../../directives';
30
30
  import { Dropdown, DropdownOption } from '../../base';
31
- import { TextSettings } from '../../../enums';
31
+ import { TextSetting } from '../../../enums';
32
32
  import { useRecentFonts } from './composables';
33
33
 
34
34
  const fonts = inject(InjectionTokens.FONTS);
@@ -36,7 +36,7 @@ const editor = inject(InjectionTokens.EDITOR);
36
36
 
37
37
  const defaultFontFamily = editor.commands.getDefaultFontFamily();
38
38
  const recentFontNames = useRecentFonts({ limit: 5 });
39
- const isCustomized = editor.commands.isSettingCustomized(TextSettings.FONT_FAMILY);
39
+ const isCustomized = editor.commands.isSettingCustomized(TextSetting.FONT_FAMILY);
40
40
 
41
41
  const recentFontsCategory = computed(() => ({
42
42
  id: 'Recently Used',
@@ -26,7 +26,7 @@ import { computed, inject } from 'vue';
26
26
  import { Dropdown, DropdownOption } from '../../base';
27
27
  import { InjectionTokens } from '../../../injectionTokens';
28
28
  import { tooltip as vTooltip } from '../../../directives';
29
- import { TextSettings } from '../../../enums';
29
+ import { TextSetting } from '../../../enums';
30
30
 
31
31
  const fontSizes = inject(InjectionTokens.FONT_SIZES);
32
32
  const editor = inject(InjectionTokens.EDITOR);
@@ -42,7 +42,7 @@ const options = computed(() => {
42
42
  });
43
43
 
44
44
  const currentValue = editor.commands.getFontSize();
45
- const isCustomized = editor.commands.isSettingCustomized(TextSettings.FONT_SIZE);
45
+ const isCustomized = editor.commands.isSettingCustomized(TextSetting.FONT_SIZE);
46
46
 
47
47
  const apply = (value) => editor.chain().focus().applyFontSize(value).run();
48
48
  </script>
@@ -26,7 +26,7 @@ import { computed, inject, unref } from 'vue';
26
26
  import { InjectionTokens } from '../../../injectionTokens';
27
27
  import { Dropdown, DropdownOption } from '../../base';
28
28
  import { tooltip as vTooltip } from '../../../directives';
29
- import { TextSettings } from '../../../enums';
29
+ import { TextSetting } from '../../../enums';
30
30
 
31
31
  const editor = inject(InjectionTokens.EDITOR);
32
32
  const font = editor.commands.getFont();
@@ -41,7 +41,7 @@ const options = computed(() => {
41
41
  });
42
42
 
43
43
  const currentValue = editor.commands.getFontWeight();
44
- const isCustomized = editor.commands.isSettingCustomized(TextSettings.FONT_WEIGHT);
44
+ const isCustomized = editor.commands.isSettingCustomized(TextSetting.FONT_WEIGHT);
45
45
 
46
46
  const apply = (value) => editor.chain().focus().applyFontWeight(value).run();
47
47
  </script>
@@ -24,13 +24,13 @@ import { inject } from 'vue';
24
24
  import { Button, Icon } from '../../base';
25
25
  import { InjectionTokens } from '../../../injectionTokens';
26
26
  import { tooltip as vTooltip } from '../../../directives';
27
- import { TextSettings } from '../../../enums';
27
+ import { TextSetting } from '../../../enums';
28
28
 
29
29
  const editor = inject(InjectionTokens.EDITOR);
30
30
 
31
31
  const currentValue = editor.commands.isItalic();
32
32
  const isAvailable = editor.commands.isItalicAvailable();
33
- const isCustomized = editor.commands.isSettingCustomized(TextSettings.FONT_STYLE);
33
+ const isCustomized = editor.commands.isSettingCustomized(TextSetting.FONT_STYLE);
34
34
  const apply = () => editor.chain().focus().toggleItalic().run();
35
35
  </script>
36
36
 
@@ -56,14 +56,14 @@ import { inject, ref } from 'vue';
56
56
  import { Button, Icon, Modal, Range, NumberField, FieldLabel, useModalToggler } from '../../base';
57
57
  import { InjectionTokens } from '../../../injectionTokens';
58
58
  import { tooltip as vTooltip } from '../../../directives';
59
- import { TextSettings } from '../../../enums';
59
+ import { TextSetting } from '../../../enums';
60
60
 
61
61
  const editor = inject(InjectionTokens.EDITOR);
62
62
  const wrapperRef = ref(null);
63
63
  const toggler = useModalToggler();
64
64
 
65
65
  const currentValue = editor.commands.getLineHeight();
66
- const isCustomized = editor.commands.isSettingCustomized(TextSettings.LINE_HEIGHT);
66
+ const isCustomized = editor.commands.isSettingCustomized(TextSetting.LINE_HEIGHT);
67
67
 
68
68
  const apply = (value) => editor.commands.applyLineHeight(String(value));
69
69
  </script>
@@ -42,12 +42,12 @@
42
42
 
43
43
  <script setup>
44
44
  import { computed, inject, ref, unref } from 'vue';
45
- import { InjectionTokens } from '../../../injectionTokens';
45
+ import { InjectionTokens } from '@/injectionTokens';
46
+ import { ListTypeList, ListType } from '@/enums';
46
47
  import { Dropdown, DropdownOption, Button, Icon } from '../../base';
47
- import { ListTypes } from '../../../enums';
48
48
  import { tooltip as vTooltip } from '../../../directives';
49
49
 
50
- const listTypes = ListTypes.values.map((type) => ({
50
+ const listTypes = ListTypeList.map((type) => ({
51
51
  id: type,
52
52
  icon: `list-${type}`
53
53
  }));
@@ -55,7 +55,7 @@ const listTypes = ListTypes.values.map((type) => ({
55
55
  const editor = inject(InjectionTokens.EDITOR);
56
56
  const selectionValue = editor.commands.getListType();
57
57
  const currentValue = computed(() => unref(selectionValue) || 'none');
58
- const recentListType = ref(ListTypes.DISC);
58
+ const recentListType = ref(ListType.DISC);
59
59
  const isCurrentListSelected = computed(() => unref(selectionValue) === recentListType.value);
60
60
 
61
61
  const currentIcon = computed(() => `list-${recentListType.value}`);
@@ -65,7 +65,7 @@ const apply = (type) => {
65
65
  editor.chain().focus().applyList(type).run();
66
66
  };
67
67
 
68
- const toggle = () => apply(recentListType.value || ListTypes.DISC);
68
+ const toggle = () => apply(recentListType.value || ListType.DISC);
69
69
  </script>
70
70
 
71
71
  <style scoped>
@@ -1,7 +1,7 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
2
  import { h, ref } from 'vue';
3
- import { InjectionTokens } from '../../../../injectionTokens';
4
- import { Alignments } from '../../../../enums';
3
+ import { InjectionTokens } from '@/injectionTokens';
4
+ import { Alignment } from '@/enums';
5
5
  import { ButtonToggle } from '../../../base';
6
6
  import AlignmentControl from '../AlignmentControl';
7
7
 
@@ -46,12 +46,12 @@ function createComponent({ editor, slotParams }) {
46
46
 
47
47
  describe('selection value', () => {
48
48
  test('should render value from selection', () => {
49
- const editor = createEditor({ alignment: Alignments.RIGHT });
49
+ const editor = createEditor({ alignment: Alignment.RIGHT });
50
50
  const wrapper = createComponent({
51
51
  editor,
52
52
  slotParams: {
53
53
  option: {
54
- id: Alignments.RIGHT,
54
+ id: Alignment.RIGHT,
55
55
  tooltip: { text: 'Align Right', hotkey: 'Mod Shift R' }
56
56
  },
57
57
  isActive: true
@@ -59,16 +59,16 @@ describe('selection value', () => {
59
59
  });
60
60
  const buttonWrapper = wrapper.findComponent(ButtonToggle);
61
61
 
62
- expect(buttonWrapper.props('value')).toBe(Alignments.RIGHT);
62
+ expect(buttonWrapper.props('value')).toBe(Alignment.RIGHT);
63
63
  });
64
64
 
65
65
  test('should apply new value', () => {
66
- const editor = createEditor({ alignment: Alignments.RIGHT });
66
+ const editor = createEditor({ alignment: Alignment.RIGHT });
67
67
  const wrapper = createComponent({
68
68
  editor,
69
69
  slotParams: {
70
70
  option: {
71
- id: Alignments.RIGHT,
71
+ id: Alignment.RIGHT,
72
72
  tooltip: { text: 'Align Right', hotkey: 'Mod Shift R' }
73
73
  },
74
74
  isActive: true
@@ -76,23 +76,23 @@ describe('selection value', () => {
76
76
  });
77
77
  const buttonWrapper = wrapper.findComponent(ButtonToggle);
78
78
 
79
- buttonWrapper.vm.$emit('change', Alignments.CENTER);
79
+ buttonWrapper.vm.$emit('change', Alignment.CENTER);
80
80
 
81
- expect(editor.commands.applyAlignment).toHaveBeenCalledWith(Alignments.CENTER);
81
+ expect(editor.commands.applyAlignment).toHaveBeenCalledWith(Alignment.CENTER);
82
82
  });
83
83
  });
84
84
 
85
85
  describe('render indicator of customized styles', () => {
86
86
  test('should render indicator', () => {
87
87
  const editor = createEditor({
88
- alignment: Alignments.LEFT,
88
+ alignment: Alignment.LEFT,
89
89
  isSettingCustomized: true
90
90
  });
91
91
  const wrapper = createComponent({
92
92
  editor,
93
93
  slotParams: {
94
94
  option: {
95
- id: Alignments.LEFT,
95
+ id: Alignment.LEFT,
96
96
  tooltip: { text: 'Align Left', hotkey: 'Mod Shift L' }
97
97
  },
98
98
  isActive: true
@@ -103,12 +103,12 @@ describe('render indicator of customized styles', () => {
103
103
  });
104
104
 
105
105
  test('should not render indicator', () => {
106
- const editor = createEditor({ alignment: Alignments.LEFT });
106
+ const editor = createEditor({ alignment: Alignment.LEFT });
107
107
  const wrapper = createComponent({
108
108
  editor,
109
109
  slotParams: {
110
110
  option: {
111
- id: Alignments.LEFT,
111
+ id: Alignment.LEFT,
112
112
  tooltip: { text: 'Align Left', hotkey: 'Mod Shift L' }
113
113
  },
114
114
  isActive: true
@@ -1,9 +1,9 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
2
  import { h } from 'vue';
3
- import { InjectionTokens } from '../../../../injectionTokens';
3
+ import { InjectionTokens } from '@/injectionTokens';
4
+ import { CaseStyle } from '@/enums';
4
5
  import { Dropdown } from '../../../base';
5
6
  import CaseStyleControl from '../CaseStyleControl';
6
- import { CaseStyles } from '../../../../enums';
7
7
 
8
8
  const createEditor = () => ({
9
9
  commands: {
@@ -37,8 +37,8 @@ describe('selection value', () => {
37
37
  const wrapper = createComponent({ editor });
38
38
  const dropdownWrapper = wrapper.findComponent(Dropdown);
39
39
 
40
- dropdownWrapper.vm.$emit('change', CaseStyles.UPPERCASE);
40
+ dropdownWrapper.vm.$emit('change', CaseStyle.UPPERCASE);
41
41
 
42
- expect(editor.commands.applyCaseStyle).toHaveBeenCalledWith(CaseStyles.UPPERCASE);
42
+ expect(editor.commands.applyCaseStyle).toHaveBeenCalledWith(CaseStyle.UPPERCASE);
43
43
  });
44
44
  });
@@ -1,9 +1,9 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
2
  import { h, ref, nextTick } from 'vue';
3
- import { InjectionTokens } from '../../../../injectionTokens';
3
+ import { InjectionTokens } from '@/injectionTokens';
4
+ import { ListType } from '@/enums';
4
5
  import { Button, Dropdown, Icon } from '../../../base';
5
6
  import ListControl from '../ListControl';
6
- import { ListTypes } from '../../../../enums';
7
7
 
8
8
  const createEditor = ({ listType } = {}) => ({
9
9
  commands: {
@@ -49,11 +49,11 @@ describe('selection value', () => {
49
49
  });
50
50
 
51
51
  test('should pass type from selection', () => {
52
- const editor = createEditor({ listType: ListTypes.LATIN });
52
+ const editor = createEditor({ listType: ListType.LATIN });
53
53
  const wrapper = createComponent({ editor });
54
54
  const dropdownWrapper = wrapper.findComponent(Dropdown);
55
55
 
56
- expect(dropdownWrapper.props('value')).toBe(ListTypes.LATIN);
56
+ expect(dropdownWrapper.props('value')).toBe(ListType.LATIN);
57
57
  });
58
58
 
59
59
  test('should render none icon', () => {
@@ -65,12 +65,12 @@ describe('selection value', () => {
65
65
  });
66
66
 
67
67
  test('should render type icon', async () => {
68
- const editor = createEditor({ listType: ListTypes.DECIMAL });
68
+ const editor = createEditor({ listType: ListType.DECIMAL });
69
69
  const wrapper = createComponent({ editor });
70
70
  const iconWrapper = wrapper.findComponent(Icon);
71
71
  const dropdownWrapper = wrapper.findComponent(Dropdown);
72
72
 
73
- dropdownWrapper.vm.$emit('change', ListTypes.DECIMAL);
73
+ dropdownWrapper.vm.$emit('change', ListType.DECIMAL);
74
74
 
75
75
  await nextTick();
76
76
 
@@ -78,13 +78,13 @@ describe('selection value', () => {
78
78
  });
79
79
 
80
80
  test('should apply list', () => {
81
- const editor = createEditor({ listType: ListTypes.LATIN });
81
+ const editor = createEditor({ listType: ListType.LATIN });
82
82
  const wrapper = createComponent({ editor });
83
83
  const dropdownWrapper = wrapper.findComponent(Dropdown);
84
84
 
85
- dropdownWrapper.vm.$emit('change', ListTypes.LATIN);
85
+ dropdownWrapper.vm.$emit('change', ListType.LATIN);
86
86
 
87
- expect(editor.commands.applyList).toHaveBeenCalledWith(ListTypes.LATIN);
87
+ expect(editor.commands.applyList).toHaveBeenCalledWith(ListType.LATIN);
88
88
  });
89
89
 
90
90
  test('should apply list with default type', () => {
@@ -94,6 +94,6 @@ describe('selection value', () => {
94
94
 
95
95
  buttonWrapper.vm.$emit('click');
96
96
 
97
- expect(editor.commands.applyList).toHaveBeenCalledWith(ListTypes.DISC);
97
+ expect(editor.commands.applyList).toHaveBeenCalledWith(ListType.DISC);
98
98
  });
99
99
  });
@@ -3,7 +3,7 @@ import { ref } from 'vue';
3
3
  import { InjectionTokens } from '../../../../injectionTokens';
4
4
  import { Button, Dropdown } from '../../../base';
5
5
  import { StylePresetControl } from '../stylePreset';
6
- import { TextSettings } from '../../../../enums';
6
+ import { TextSetting } from '../../../../enums';
7
7
 
8
8
  const createEditor = ({ presets, preset, customization } = {}) => ({
9
9
  commands: {
@@ -92,7 +92,7 @@ describe('rendering', () => {
92
92
  test('should enable reset if marks customized', () => {
93
93
  const editor = createEditor({
94
94
  customization: {
95
- marks: [TextSettings.FONT_SIZE],
95
+ marks: [TextSetting.FONT_SIZE],
96
96
  attributes: []
97
97
  }
98
98
  });
@@ -106,7 +106,7 @@ describe('rendering', () => {
106
106
  const editor = createEditor({
107
107
  customization: {
108
108
  marks: [],
109
- attributes: [TextSettings.ALIGNMENT]
109
+ attributes: [TextSetting.ALIGNMENT]
110
110
  }
111
111
  });
112
112
  const wrapper = createComponent({ editor });
@@ -118,8 +118,8 @@ describe('rendering', () => {
118
118
  test('should enable reset if attributes and marks customized', () => {
119
119
  const editor = createEditor({
120
120
  customization: {
121
- marks: [TextSettings.FONT_SIZE],
122
- attributes: [TextSettings.ALIGNMENT]
121
+ marks: [TextSetting.FONT_SIZE],
122
+ attributes: [TextSetting.ALIGNMENT]
123
123
  }
124
124
  });
125
125
  const wrapper = createComponent({ editor });
@@ -148,7 +148,7 @@ describe('apply preset', () => {
148
148
  dropdownWrapper.vm.$emit('change', 'regular-1');
149
149
 
150
150
  expect(editor.commands.expandSelectionToBlock).toHaveBeenCalled();
151
- expect(editor.commands.removeMarks).toHaveBeenCalledWith([TextSettings.FONT_SIZE, TextSettings.FONT_WEIGHT]);
151
+ expect(editor.commands.removeMarks).toHaveBeenCalledWith([TextSetting.FONT_SIZE, TextSetting.FONT_WEIGHT]);
152
152
  });
153
153
  });
154
154
 
@@ -45,9 +45,9 @@
45
45
 
46
46
  <script setup>
47
47
  import { computed, ref, inject, unref } from 'vue';
48
- import { LinkDestinations, TextSettings } from '../../../../enums';
49
- import { InjectionTokens } from '../../../../injectionTokens';
50
- import { RegExps } from '../../../../regExps';
48
+ import { LinkDestination, TextSetting } from '@/enums';
49
+ import { InjectionTokens } from '@/injectionTokens';
50
+ import { RegExps } from '@/regExps';
51
51
  import { tooltip as vTooltip } from '../../../../directives';
52
52
  import { useValidator } from '../../../base/composables';
53
53
  import { Button, Icon, Modal, TextField, useModalToggler } from '../../../base';
@@ -65,7 +65,7 @@ const isEmpty = () => {
65
65
  };
66
66
 
67
67
  const isValidUrl = () => {
68
- if (link.currentDestination.value.id !== LinkDestinations.URL) return false;
68
+ if (link.currentDestination.value.id !== LinkDestination.URL) return false;
69
69
 
70
70
  const href = link.destinationHrefs.value.url;
71
71
  const isTelOrMail = RegExps.TEL_PROTOCOL.test(href) || RegExps.MAILTO_PROTOCOL.test(href);
@@ -93,7 +93,7 @@ const resetErrors = () => {
93
93
 
94
94
  const toggler = useModalToggler({
95
95
  onBeforeOpened: () => {
96
- editor.commands.extendMarkRange(TextSettings.LINK);
96
+ editor.commands.extendMarkRange(TextSetting.LINK);
97
97
  resetErrors();
98
98
  link.prepareInitialFields();
99
99
  }
@@ -1,7 +1,7 @@
1
1
  import { ref } from 'vue';
2
- import { withComponentContext } from '../../../../../../__tests__/utils';
3
- import { InjectionTokens } from '../../../../../../injectionTokens';
4
- import { LinkDestinations, LinkTargets } from '../../../../../../enums';
2
+ import { withComponentContext } from '@/__tests__/utils';
3
+ import { InjectionTokens } from '@/injectionTokens';
4
+ import { LinkDestination, LinkTarget } from '@/enums';
5
5
  import { useLink } from '../useLink';
6
6
 
7
7
  const createEditor = (text, destination) => ({
@@ -42,8 +42,8 @@ describe('init link', () => {
42
42
 
43
43
  link.prepareInitialFields();
44
44
 
45
- expect(link.currentDestination.value.id).toBe(LinkDestinations.URL);
46
- expect(link.linkData.value.target).toBe(LinkTargets.SELF);
45
+ expect(link.currentDestination.value.id).toBe(LinkDestination.URL);
46
+ expect(link.linkData.value.target).toBe(LinkTarget.SELF);
47
47
  expect(link.destinationHrefs.value).toMatchSnapshot();
48
48
  });
49
49
 
@@ -66,7 +66,7 @@ describe('actions with link', () => {
66
66
  });
67
67
 
68
68
  test('should update block destination', () => {
69
- const link = useComposable('hello world', LinkDestinations.BLOCK);
69
+ const link = useComposable('hello world', LinkDestination.BLOCK);
70
70
 
71
71
  link.prepareInitialFields();
72
72
  link.updateLink('3456');
@@ -91,9 +91,9 @@ describe('actions with link', () => {
91
91
  link.apply();
92
92
 
93
93
  expect(link.editor.commands.applyLink).toHaveBeenCalledWith({
94
- destination: LinkDestinations.URL,
94
+ destination: LinkDestination.URL,
95
95
  href: '/world',
96
- target: LinkTargets.SELF,
96
+ target: LinkTarget.SELF,
97
97
  text: 'hello'
98
98
  });
99
99
  });
@@ -103,7 +103,7 @@ describe('actions with link', () => {
103
103
 
104
104
  link.updateTarget(false);
105
105
 
106
- expect(link.linkData.value.target).toBe(LinkTargets.SELF);
106
+ expect(link.linkData.value.target).toBe(LinkTarget.SELF);
107
107
  });
108
108
 
109
109
  test('should apply link target to current window', () => {
@@ -111,7 +111,7 @@ describe('actions with link', () => {
111
111
 
112
112
  link.updateTarget(true);
113
113
 
114
- expect(link.linkData.value.target).toBe(LinkTargets.BLANK);
114
+ expect(link.linkData.value.target).toBe(LinkTarget.BLANK);
115
115
  });
116
116
 
117
117
  test('should reset destination', () => {
@@ -133,9 +133,9 @@ describe('format link', () => {
133
133
  link.apply();
134
134
 
135
135
  expect(link.editor.commands.applyLink).toHaveBeenCalledWith({
136
- destination: LinkDestinations.URL,
136
+ destination: LinkDestination.URL,
137
137
  href: 'https://world.com',
138
- target: LinkTargets.SELF,
138
+ target: LinkTarget.SELF,
139
139
  text: 'hello'
140
140
  });
141
141
  });
@@ -149,9 +149,9 @@ describe('format link', () => {
149
149
  link.apply();
150
150
 
151
151
  expect(link.editor.commands.applyLink).toHaveBeenCalledWith({
152
- destination: LinkDestinations.URL,
152
+ destination: LinkDestination.URL,
153
153
  href: 'https://world.com',
154
- target: LinkTargets.SELF,
154
+ target: LinkTarget.SELF,
155
155
  text: 'hello'
156
156
  });
157
157
  });
@@ -165,9 +165,9 @@ describe('format link', () => {
165
165
  link.apply();
166
166
 
167
167
  expect(link.editor.commands.applyLink).toHaveBeenCalledWith({
168
- destination: LinkDestinations.URL,
168
+ destination: LinkDestination.URL,
169
169
  href: '/world/new',
170
- target: LinkTargets.SELF,
170
+ target: LinkTarget.SELF,
171
171
  text: 'hello'
172
172
  });
173
173
  });
@@ -181,9 +181,9 @@ describe('format link', () => {
181
181
  link.apply();
182
182
 
183
183
  expect(link.editor.commands.applyLink).toHaveBeenCalledWith({
184
- destination: LinkDestinations.URL,
184
+ destination: LinkDestination.URL,
185
185
  href: 'tel:0123456789',
186
- target: LinkTargets.SELF,
186
+ target: LinkTarget.SELF,
187
187
  text: 'hello'
188
188
  });
189
189
  });
@@ -197,9 +197,9 @@ describe('format link', () => {
197
197
  link.apply();
198
198
 
199
199
  expect(link.editor.commands.applyLink).toHaveBeenCalledWith({
200
- destination: LinkDestinations.URL,
200
+ destination: LinkDestination.URL,
201
201
  href: 'mailto:example@gmail.com',
202
- target: LinkTargets.SELF,
202
+ target: LinkTarget.SELF,
203
203
  text: 'hello'
204
204
  });
205
205
  });
@@ -1,29 +1,29 @@
1
1
  import { ref, inject } from 'vue';
2
- import { LinkTargets, LinkDestinations, TextSettings } from '../../../../../enums';
3
- import { InjectionTokens } from '../../../../../injectionTokens';
4
- import { RegExps } from '../../../../../regExps';
2
+ import { LinkTarget, LinkDestination, TextSetting } from '@/enums';
3
+ import { InjectionTokens } from '@/injectionTokens';
4
+ import { RegExps } from '@/regExps';
5
5
 
6
6
  // TODO NEED refactor it
7
7
  export function useLink() {
8
8
  const editor = inject(InjectionTokens.EDITOR);
9
9
  const pageBlocks = inject(InjectionTokens.PAGE_BLOCKS);
10
10
 
11
- const linkData = ref({ text: '', target: LinkTargets.SELF, destination: LinkDestinations.URL });
11
+ const linkData = ref({ text: '', target: LinkTarget.SELF, destination: LinkDestination.URL });
12
12
  const destinationHrefs = ref({ block: pageBlocks.value[0].id, url: '' });
13
- const currentDestination = ref({ id: LinkDestinations.URL });
13
+ const currentDestination = ref({ id: LinkDestination.URL });
14
14
 
15
15
  function updateTarget(isChecked) {
16
- linkData.value.target = isChecked ? LinkTargets.BLANK : LinkTargets.SELF;
16
+ linkData.value.target = isChecked ? LinkTarget.BLANK : LinkTarget.SELF;
17
17
  }
18
18
 
19
19
  function prepareInitialFields() {
20
20
  editor.commands.expandSelectionToLink();
21
21
  linkData.value.text = editor.commands.getSelectedText();
22
22
 
23
- const { destination, href, target } = editor.getAttributes(TextSettings.LINK);
23
+ const { destination, href, target } = editor.getAttributes(TextSetting.LINK);
24
24
 
25
- currentDestination.value.id = destination || LinkDestinations.URL;
26
- linkData.value.target = target || LinkTargets.SELF;
25
+ currentDestination.value.id = destination || LinkDestination.URL;
26
+ linkData.value.target = target || LinkTarget.SELF;
27
27
  destinationHrefs.value[currentDestination.value.id] = href || '';
28
28
  }
29
29
 
@@ -33,7 +33,7 @@ export function useLink() {
33
33
  }
34
34
 
35
35
  function getFormattedHref() {
36
- if (currentDestination.value.id === LinkDestinations.URL) {
36
+ if (currentDestination.value.id === LinkDestination.URL) {
37
37
  const url = destinationHrefs.value.url;
38
38
  const isTelOrMail = RegExps.TEL_PROTOCOL.test(url) || RegExps.MAILTO_PROTOCOL.test(url);
39
39
 
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div>
3
3
  <FieldLabel class="zw-margin-bottom--xxs">
4
- Destination
4
+ Click Action
5
5
  </FieldLabel>
6
6
 
7
7
  <Dropdown
@@ -40,7 +40,7 @@
40
40
 
41
41
  <script setup>
42
42
  import { computed, toRef } from 'vue';
43
- import { LinkDestinations, LinkTargets } from '../../../../../enums';
43
+ import { LinkDestination, LinkTarget } from '@/enums';
44
44
  import { Dropdown, DropdownOption, FieldLabel } from '../../../../base';
45
45
  import LinkControlPageBlock from './LinkControlPageBlock';
46
46
  import LinkControlUrl from './LinkControlUrl';
@@ -60,18 +60,21 @@ const props = defineProps({
60
60
  const emit = defineEmits(['reset-errors']);
61
61
 
62
62
  const destinationTypes = [
63
- { id: LinkDestinations.URL, title: 'URL' },
64
- { id: LinkDestinations.BLOCK, title: 'Page Section' }
63
+ { id: LinkDestination.URL, title: 'URL' },
64
+ { id: LinkDestination.BLOCK, title: 'Page Section' }
65
65
  ];
66
66
 
67
67
  const link = toRef(props, 'link');
68
- const isURLDestination = computed(() => link.value.currentDestination.value.id === LinkDestinations.URL);
69
- const isTargetBlank = computed(() => link.value.linkData.value.target === LinkTargets.BLANK);
68
+ const isURLDestination = computed(() => link.value.currentDestination.value.id === LinkDestination.URL);
69
+ const isTargetBlank = computed(() => link.value.linkData.value.target === LinkTarget.BLANK);
70
70
 
71
71
  const changeDestination = (value) => {
72
72
  emit('reset-errors');
73
73
  link.value.currentDestination.value.id = value;
74
- if (!isURLDestination.value) link.value.target = LinkTargets.SELF;
74
+
75
+ if (!isURLDestination.value) {
76
+ link.value.target = LinkTarget.SELF;
77
+ }
75
78
 
76
79
  link.value.destinationHrefs.value.url = '';
77
80
  };
@@ -23,8 +23,8 @@
23
23
 
24
24
  <script setup>
25
25
  import { inject } from 'vue';
26
+ import { InjectionTokens } from '@/injectionTokens';
26
27
  import { FieldLabel, DropdownOption, Dropdown } from '../../../../base';
27
- import { InjectionTokens } from '../../../../../injectionTokens';
28
28
 
29
29
  defineProps({
30
30
  value: {
@@ -11,11 +11,3 @@ export const AlignmentList = [
11
11
  Alignment.RIGHT,
12
12
  Alignment.JUSTIFY
13
13
  ];
14
-
15
- /**
16
- * @deprecated Use `Alignment` instead.
17
- */
18
- export const Alignments = {
19
- ...Alignment,
20
- values: AlignmentList
21
- };
@@ -3,9 +3,3 @@ export enum CaseStyle {
3
3
  LOWERCASE = 'lowercase',
4
4
  CAPITALIZE = 'capitalize'
5
5
  }
6
-
7
- /**
8
- * @deprecated Use `CaseStyle` instead.
9
- */
10
- export const CaseStyles = CaseStyle;
11
-
@@ -11,11 +11,3 @@ export const DeviceList = [
11
11
  Device.TABLET,
12
12
  Device.DESKTOP
13
13
  ];
14
-
15
- /**
16
- * @deprecated Use `Device` instead.
17
- */
18
- export const Devices = {
19
- ...Device,
20
- values: DeviceList
21
- };
@@ -0,0 +1,4 @@
1
+ export enum LinkDestination {
2
+ URL = 'url',
3
+ BLOCK = 'block'
4
+ }
@@ -0,0 +1,4 @@
1
+ export enum LinkTarget {
2
+ BLANK = '_blank',
3
+ SELF = '_self'
4
+ }