@zipify/wysiwyg 4.11.0 → 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
package/lib/Wysiwyg.vue CHANGED
@@ -23,7 +23,7 @@ import { useEditor } from './composables';
23
23
  import { buildExtensions } from './extensions';
24
24
  import { InjectionTokens } from './injectionTokens';
25
25
  import { ContextWindow, FavoriteColors, Storage } from './services';
26
- import { Devices } from './enums';
26
+ import { Device } from './enums';
27
27
  import { Font, type IFontJson } from './models';
28
28
 
29
29
  const props = defineProps({
@@ -63,9 +63,9 @@ const props = defineProps({
63
63
  },
64
64
 
65
65
  device: {
66
- type: String,
66
+ type: String as PropType<Device>,
67
67
  required: false,
68
- default: Devices.DESKTOP
68
+ default: Device.DESKTOP
69
69
  },
70
70
 
71
71
  favoriteColors: {
@@ -1,18 +1,18 @@
1
1
  import { Mark } from '@tiptap/vue-3';
2
- import { buildCoreExtensions } from '../../extensions/core';
3
- import { MarkGroups, TextSettings } from '../../enums';
2
+ import { buildCoreExtensions } from '@/extensions/core';
3
+ import { MarkGroup, TextSetting } from '@/enums';
4
4
 
5
5
  // each node allows using 'settings' group of marks,
6
6
  // and it fails when there are no nodes with this group
7
7
  const SettingMark = Mark.create({
8
8
  name: 'placeholder_setting',
9
- group: MarkGroups.SETTINGS,
9
+ group: MarkGroup.SETTINGS,
10
10
  renderHTML: () => []
11
11
  });
12
12
 
13
13
  // NodeProcessor requires link mark
14
14
  const LinkMark = Mark.create({
15
- name: TextSettings.LINK,
15
+ name: TextSetting.LINK,
16
16
  renderHTML: () => []
17
17
  });
18
18
 
@@ -22,13 +22,13 @@ export function buildTestExtensions({ include } = {}) {
22
22
  const extensions = buildCoreExtensions().concat(include || []);
23
23
 
24
24
  const isSettingPreset = extensions.some((extension) => {
25
- return isMark(extension) && extension.config.group === MarkGroups.SETTINGS;
25
+ return isMark(extension) && extension.config.group === MarkGroup.SETTINGS;
26
26
  });
27
27
 
28
28
  if (!isSettingPreset) extensions.push(SettingMark);
29
29
 
30
30
  const isLinkPreset = extensions.some((extension) => {
31
- return isMark(extension) && extension.name === TextSettings.LINK;
31
+ return isMark(extension) && extension.name === TextSetting.LINK;
32
32
  });
33
33
 
34
34
  if (!isLinkPreset) extensions.push(LinkMark);
@@ -15,7 +15,7 @@
15
15
 
16
16
  <script setup>
17
17
  import { computed } from 'vue';
18
- import { Devices } from '../../enums';
18
+ import { Device } from '@/enums';
19
19
  import { ToolbarDesktop, ToolbarMobile, ToolbarPopup } from './layouts';
20
20
  import ToolbarFloating from './ToolbarFloating';
21
21
 
@@ -56,7 +56,7 @@ const props = defineProps({
56
56
  const layoutComponent = computed(() => {
57
57
  if (props.popupMode) return ToolbarPopup;
58
58
 
59
- return props.device === Devices.MOBILE ? ToolbarMobile : ToolbarDesktop;
59
+ return props.device === Device.MOBILE ? ToolbarMobile : ToolbarDesktop;
60
60
  });
61
61
  </script>
62
62
 
@@ -1,5 +1,5 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
- import { Devices } from '../../../enums';
2
+ import { Device } from '@/enums';
3
3
  import Toolbar from '../Toolbar';
4
4
  import { ToolbarMobile, ToolbarDesktop, ToolbarPopup } from '../layouts';
5
5
 
@@ -9,7 +9,7 @@ function createComponent({ device, popupMode }) {
9
9
  visible: true,
10
10
  offsets: [0, 8],
11
11
  referenceRef: document.createElement('div'),
12
- device: device ?? Devices.DESKTOP,
12
+ device: device ?? Device.DESKTOP,
13
13
  placement: 'bottom',
14
14
  popupMode: popupMode ?? false
15
15
  }
@@ -18,19 +18,19 @@ function createComponent({ device, popupMode }) {
18
18
 
19
19
  describe('rendering', () => {
20
20
  test('should render desktop toolbar', () => {
21
- const wrapper = createComponent({ device: Devices.DESKTOP });
21
+ const wrapper = createComponent({ device: Device.DESKTOP });
22
22
 
23
23
  expect(wrapper).toVueContainComponent(ToolbarDesktop);
24
24
  });
25
25
 
26
26
  test('should render tablet toolbar', () => {
27
- const wrapper = createComponent({ device: Devices.TABLET });
27
+ const wrapper = createComponent({ device: Device.TABLET });
28
28
 
29
29
  expect(wrapper).toVueContainComponent(ToolbarDesktop);
30
30
  });
31
31
 
32
32
  test('should render mobile toolbar', () => {
33
- const wrapper = createComponent({ device: Devices.MOBILE });
33
+ const wrapper = createComponent({ device: Device.MOBILE });
34
34
 
35
35
  expect(wrapper).toVueContainComponent(ToolbarMobile);
36
36
  });
@@ -25,8 +25,8 @@
25
25
 
26
26
  <script setup>
27
27
  import { inject } from 'vue';
28
- import { InjectionTokens } from '../../../injectionTokens';
29
- import { Alignments, TextSettings } from '../../../enums';
28
+ import { InjectionTokens } from '@/injectionTokens';
29
+ import { Alignment, TextSetting } from '@/enums';
30
30
  import { ButtonToggle, Button, Icon } from '../../base';
31
31
  import { tooltip as vTooltip } from '../../../directives';
32
32
 
@@ -34,19 +34,19 @@ const emit = defineEmits(['applied']);
34
34
 
35
35
  const alignments = [
36
36
  {
37
- id: Alignments.LEFT,
37
+ id: Alignment.LEFT,
38
38
  tooltip: { text: 'Align Left', hotkey: 'Mod Shift L' }
39
39
  },
40
40
  {
41
- id: Alignments.CENTER,
41
+ id: Alignment.CENTER,
42
42
  tooltip: { text: 'Align Center', hotkey: 'Mod Shift E' }
43
43
  },
44
44
  {
45
- id: Alignments.RIGHT,
45
+ id: Alignment.RIGHT,
46
46
  tooltip: { text: 'Align Right', hotkey: 'Mod Shift R' }
47
47
  },
48
48
  {
49
- id: Alignments.JUSTIFY,
49
+ id: Alignment.JUSTIFY,
50
50
  tooltip: { text: 'Justify', hotkey: 'Mod Shift J' }
51
51
  }
52
52
  ];
@@ -54,7 +54,7 @@ const alignments = [
54
54
  const editor = inject(InjectionTokens.EDITOR);
55
55
  const currentValue = editor.commands.getAlignment();
56
56
 
57
- const isCustomized = editor.commands.isSettingCustomized(TextSettings.ALIGNMENT);
57
+ const isCustomized = editor.commands.isSettingCustomized(TextSetting.ALIGNMENT);
58
58
 
59
59
  function toggle(value) {
60
60
  editor.chain().focus().applyAlignment(value).run();
@@ -16,15 +16,15 @@
16
16
 
17
17
  <script setup>
18
18
  import { inject } from 'vue';
19
- import { CaseStyles } from '../../../enums';
19
+ import { CaseStyle } from '@/enums';
20
+ import { InjectionTokens } from '@/injectionTokens';
20
21
  import { Dropdown, Button, Icon } from '../../base';
21
- import { InjectionTokens } from '../../../injectionTokens';
22
22
  import { tooltip as vTooltip } from '../../../directives';
23
23
 
24
24
  const styles = [
25
- { id: CaseStyles.UPPERCASE, title: 'UPPERCASE' },
26
- { id: CaseStyles.LOWERCASE, title: 'lowercase' },
27
- { id: CaseStyles.CAPITALIZE, title: 'Capitalize' }
25
+ { id: CaseStyle.UPPERCASE, title: 'UPPERCASE' },
26
+ { id: CaseStyle.LOWERCASE, title: 'lowercase' },
27
+ { id: CaseStyle.CAPITALIZE, title: 'Capitalize' }
28
28
  ];
29
29
 
30
30
  const editor = inject(InjectionTokens.EDITOR);
@@ -27,12 +27,12 @@ import { inject } from 'vue';
27
27
  import { ColorPicker, Button, Icon } from '../../base';
28
28
  import { InjectionTokens } from '../../../injectionTokens';
29
29
  import { tooltip as vTooltip } from '../../../directives';
30
- import { TextSettings } from '../../../enums';
30
+ import { TextSetting } from '../../../enums';
31
31
 
32
32
  const editor = inject(InjectionTokens.EDITOR);
33
33
 
34
34
  const currentValue = editor.commands.getFontColor();
35
- const isCustomized = editor.commands.isSettingCustomized(TextSettings.FONT_COLOR);
35
+ const isCustomized = editor.commands.isSettingCustomized(TextSetting.FONT_COLOR);
36
36
 
37
37
  const apply = (color) => editor.chain().applyFontColor(color).run();
38
38
  </script>
@@ -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
  }