@zipify/wysiwyg 4.11.0-4 → 4.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/.release-it.json +2 -1
  2. package/dist/cli.js +28 -28
  3. package/dist/node.js +26 -26
  4. package/dist/types/Wysiwyg.vue.d.ts +7 -8
  5. package/dist/types/components/base/Button.vue.d.ts +5 -10
  6. package/dist/types/components/base/ButtonToggle.vue.d.ts +9 -14
  7. package/dist/types/components/base/Checkbox.vue.d.ts +1 -1
  8. package/dist/types/components/base/FieldLabel.vue.d.ts +5 -10
  9. package/dist/types/components/base/Icon.vue.d.ts +1 -1
  10. package/dist/types/components/base/Modal.vue.d.ts +5 -14
  11. package/dist/types/components/base/ModalFloating.vue.d.ts +5 -14
  12. package/dist/types/components/base/NumberField.vue.d.ts +1 -1
  13. package/dist/types/components/base/Range.vue.d.ts +1 -1
  14. package/dist/types/components/base/ScrollView.vue.d.ts +5 -14
  15. package/dist/types/components/base/TextField.vue.d.ts +1 -1
  16. package/dist/types/components/base/colorPicker/ColorPicker.vue.d.ts +10 -517
  17. package/dist/types/components/base/dropdown/Dropdown.vue.d.ts +6 -15
  18. package/dist/types/components/base/dropdown/DropdownActivator.vue.d.ts +7 -12
  19. package/dist/types/components/base/dropdown/DropdownDivider.vue.d.ts +1 -1
  20. package/dist/types/components/base/dropdown/DropdownGroup.vue.d.ts +7 -12
  21. package/dist/types/components/base/dropdown/DropdownMenu.vue.d.ts +6 -12
  22. package/dist/types/components/base/dropdown/DropdownOption.vue.d.ts +5 -14
  23. package/dist/types/components/toolbar/ToolbarFloating.vue.d.ts +5 -14
  24. package/dist/types/components/toolbar/controls/AlignmentControl.vue.d.ts +1 -1
  25. package/dist/types/components/toolbar/controls/CaseStyleControl.vue.d.ts +1 -1
  26. package/dist/types/components/toolbar/controls/FontFamilyControl.vue.d.ts +1 -1
  27. package/dist/types/components/toolbar/controls/FontSizeControl.vue.d.ts +1 -1
  28. package/dist/types/components/toolbar/controls/FontWeightControl.vue.d.ts +1 -1
  29. package/dist/types/components/toolbar/controls/ItalicControl.vue.d.ts +1 -1
  30. package/dist/types/components/toolbar/controls/LineHeightControl.vue.d.ts +1 -3
  31. package/dist/types/components/toolbar/controls/ListControl.vue.d.ts +1 -1
  32. package/dist/types/components/toolbar/controls/RemoveFormatControl.vue.d.ts +1 -1
  33. package/dist/types/components/toolbar/controls/StrikeThroughControl.vue.d.ts +1 -1
  34. package/dist/types/components/toolbar/controls/SuperscriptControl.vue.d.ts +1 -1
  35. package/dist/types/components/toolbar/controls/UnderlineControl.vue.d.ts +1 -1
  36. package/dist/types/components/toolbar/controls/link/LinkControl.vue.d.ts +1 -3
  37. package/dist/types/components/toolbar/controls/link/LinkControlHeader.vue.d.ts +1 -1
  38. package/dist/types/components/toolbar/controls/link/composables/useLink.d.ts +11 -9
  39. package/dist/types/components/toolbar/controls/link/destination/LinkControlDestination.vue.d.ts +1 -1
  40. package/dist/types/components/toolbar/controls/link/destination/LinkControlPageBlock.vue.d.ts +1 -1
  41. package/dist/types/components/toolbar/controls/link/destination/LinkControlUrl.vue.d.ts +1 -1
  42. package/dist/types/components/toolbar/controls/stylePreset/StylePresetControl.vue.d.ts +1 -1
  43. package/dist/types/components/toolbar/controls/stylePreset/StylePresetOption.vue.d.ts +2 -4
  44. package/dist/types/enums/Alignment.d.ts +7 -0
  45. package/dist/types/enums/CaseStyle.d.ts +5 -0
  46. package/dist/types/enums/Device.d.ts +7 -0
  47. package/dist/types/enums/LinkDestination.d.ts +4 -0
  48. package/dist/types/enums/LinkTarget.d.ts +4 -0
  49. package/dist/types/enums/ListType.d.ts +10 -0
  50. package/dist/types/enums/MarkGroup.d.ts +4 -0
  51. package/dist/types/enums/NodeType.d.ts +9 -0
  52. package/dist/types/enums/TextSetting.d.ts +19 -0
  53. package/dist/types/enums/index.d.ts +9 -9
  54. package/dist/types/extensions/Alignment.d.ts +2 -1
  55. package/dist/types/extensions/CaseStyle.d.ts +2 -1
  56. package/dist/wysiwyg.css +27 -27
  57. package/dist/wysiwyg.mjs +129 -164
  58. package/lib/Wysiwyg.vue +3 -3
  59. package/lib/__tests__/utils/buildTestExtensions.js +6 -6
  60. package/lib/components/toolbar/Toolbar.vue +2 -2
  61. package/lib/components/toolbar/__tests__/Toolbar.test.js +5 -5
  62. package/lib/components/toolbar/controls/AlignmentControl.vue +7 -7
  63. package/lib/components/toolbar/controls/CaseStyleControl.vue +5 -5
  64. package/lib/components/toolbar/controls/FontColorControl.vue +2 -2
  65. package/lib/components/toolbar/controls/FontFamilyControl.vue +2 -2
  66. package/lib/components/toolbar/controls/FontSizeControl.vue +2 -2
  67. package/lib/components/toolbar/controls/FontWeightControl.vue +2 -2
  68. package/lib/components/toolbar/controls/ItalicControl.vue +2 -2
  69. package/lib/components/toolbar/controls/LineHeightControl.vue +2 -2
  70. package/lib/components/toolbar/controls/ListControl.vue +5 -5
  71. package/lib/components/toolbar/controls/__tests__/AlignmentControl.test.js +13 -13
  72. package/lib/components/toolbar/controls/__tests__/CaseStyleControl.test.js +4 -4
  73. package/lib/components/toolbar/controls/__tests__/ListControl.test.js +10 -10
  74. package/lib/components/toolbar/controls/__tests__/StylePresetControl.test.js +6 -6
  75. package/lib/components/toolbar/controls/link/LinkControl.vue +5 -5
  76. package/lib/components/toolbar/controls/link/composables/__tests__/useLink.test.js +20 -20
  77. package/lib/components/toolbar/controls/link/composables/useLink.js +10 -10
  78. package/lib/components/toolbar/controls/link/destination/LinkControlDestination.vue +10 -7
  79. package/lib/components/toolbar/controls/link/destination/LinkControlPageBlock.vue +1 -1
  80. package/lib/enums/{Alignments.ts → Alignment.ts} +0 -8
  81. package/lib/enums/{CaseStyles.ts → CaseStyle.ts} +0 -6
  82. package/lib/enums/{Devices.ts → Device.ts} +0 -8
  83. package/lib/enums/LinkDestination.ts +4 -0
  84. package/lib/enums/LinkTarget.ts +4 -0
  85. package/lib/enums/{ListTypes.ts → ListType.ts} +0 -9
  86. package/lib/enums/MarkGroup.ts +4 -0
  87. package/lib/enums/{NodeTypes.ts → NodeType.ts} +0 -8
  88. package/lib/enums/{TextSettings.ts → TextSetting.ts} +0 -11
  89. package/lib/enums/index.ts +9 -9
  90. package/lib/extensions/Alignment.js +13 -11
  91. package/lib/extensions/BackgroundColor.js +2 -2
  92. package/lib/extensions/CaseStyle.js +8 -6
  93. package/lib/extensions/FontColor.js +4 -4
  94. package/lib/extensions/FontFamily.js +5 -5
  95. package/lib/extensions/FontSize.js +3 -3
  96. package/lib/extensions/FontStyle.js +3 -3
  97. package/lib/extensions/FontWeight.js +3 -3
  98. package/lib/extensions/LineHeight.js +4 -4
  99. package/lib/extensions/Link.js +11 -11
  100. package/lib/extensions/Margin.js +4 -4
  101. package/lib/extensions/StylePreset.js +18 -12
  102. package/lib/extensions/Superscript.js +2 -2
  103. package/lib/extensions/TextDecoration.js +2 -2
  104. package/lib/extensions/__tests__/Alignment.test.js +21 -21
  105. package/lib/extensions/__tests__/BackgroundColor.test.js +4 -4
  106. package/lib/extensions/__tests__/CaseStyle.test.js +6 -6
  107. package/lib/extensions/__tests__/FontColor.test.js +4 -4
  108. package/lib/extensions/__tests__/FontFamily.test.js +10 -10
  109. package/lib/extensions/__tests__/FontSize.test.js +9 -9
  110. package/lib/extensions/__tests__/FontStyle.test.js +6 -6
  111. package/lib/extensions/__tests__/FontWeight.test.js +11 -11
  112. package/lib/extensions/__tests__/LineHeight.test.js +2 -2
  113. package/lib/extensions/__tests__/Link.test.js +13 -13
  114. package/lib/extensions/__tests__/StylePreset.test.js +29 -29
  115. package/lib/extensions/__tests__/Superscript.test.js +5 -5
  116. package/lib/extensions/__tests__/TextDecoration.test.js +14 -14
  117. package/lib/extensions/core/Document.js +3 -3
  118. package/lib/extensions/core/Heading.js +2 -2
  119. package/lib/extensions/core/NodeProcessor.js +8 -8
  120. package/lib/extensions/core/Paragraph.js +2 -2
  121. package/lib/extensions/core/__tests__/NodeProcessor.test.js +68 -68
  122. package/lib/extensions/core/__tests__/TextProcessor.test.js +13 -13
  123. package/lib/extensions/list/ListItem.js +5 -5
  124. package/lib/extensions/list/__tests__/List.test.js +11 -11
  125. package/lib/extensions/proseMirror/PasteLinkPlugin.js +4 -4
  126. package/lib/extensions/proseMirror/PastePlugin.js +2 -2
  127. package/lib/services/ContentSerializer.js +3 -3
  128. package/lib/services/StylePresetRenderer.js +4 -4
  129. package/lib/services/__tests__/NodeFactory.test.js +11 -11
  130. package/lib/services/__tests__/NodeSelector.test.js +18 -18
  131. package/lib/services/normalizer/JsonNormalizer.js +5 -5
  132. package/lib/services/normalizer/__tests__/JsonNormalizer.test.js +15 -15
  133. package/lib/utils/__tests__/convertAlignment.test.js +3 -3
  134. package/lib/utils/convertAlignment.js +4 -4
  135. package/package.json +17 -17
  136. package/lib/enums/LinkDestinations.ts +0 -9
  137. package/lib/enums/LinkTargets.ts +0 -9
  138. package/lib/enums/MarkGroups.ts +0 -9
@@ -1,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
+ }
@@ -21,12 +21,3 @@ export const ListOrderedTypeList = [
21
21
  ListType.ROMAN,
22
22
  ListType.LATIN
23
23
  ];
24
-
25
- /**
26
- * @deprecated Use `ListType` instead.
27
- */
28
- export const ListTypes = {
29
- ...ListType,
30
- values: ListTypeList,
31
- ordered: ListOrderedTypeList
32
- };
@@ -0,0 +1,4 @@
1
+ export enum MarkGroup {
2
+ SETTINGS = 'settings',
3
+ ALL = '_'
4
+ }
@@ -8,11 +8,3 @@ export enum NodeType {
8
8
  }
9
9
 
10
10
  export const NodeBlockTypeList = [NodeType.PARAGRAPH, NodeType.LIST, NodeType.HEADING];
11
-
12
- /**
13
- * @deprecated Use `NodeType` instead.
14
- */
15
- export const NodeTypes = Object.freeze({
16
- ...NodeType,
17
- blocks: NodeBlockTypeList
18
- });
@@ -41,14 +41,3 @@ export const TextBlockMarkList = [
41
41
  TextSetting.TEXT_DECORATION,
42
42
  TextSetting.SUPERSCRIPT
43
43
  ];
44
-
45
- /**
46
- * @deprecated Use `TextSetting` instead.
47
- */
48
- export const TextSettings = {
49
- ...TextSetting,
50
- attributes: TextAttributeSettingList,
51
- presetAttributes: TextPresetAttributeSettingList,
52
- inlineMarks: TextInlineMarkList,
53
- marks: TextBlockMarkList
54
- };
@@ -1,9 +1,9 @@
1
- export * from './Devices';
2
- export * from './CaseStyles';
3
- export * from './Alignments';
4
- export * from './NodeTypes';
5
- export * from './ListTypes';
6
- export * from './TextSettings';
7
- export * from './MarkGroups';
8
- export * from './LinkTargets';
9
- export * from './LinkDestinations';
1
+ export * from './Device';
2
+ export * from './CaseStyle';
3
+ export * from './Alignment';
4
+ export * from './NodeType';
5
+ export * from './ListType';
6
+ export * from './TextSetting';
7
+ export * from './MarkGroup';
8
+ export * from './LinkTarget';
9
+ export * from './LinkDestination';
@@ -1,7 +1,7 @@
1
1
  import { Extension } from '@tiptap/vue-3';
2
2
  import { computed, unref } from 'vue';
3
- import { convertAlignment, createCommand, createKeyboardShortcut, renderInlineSetting } from '../utils';
4
- import { Alignments, NodeTypes, TextSettings } from '../enums';
3
+ import { convertAlignment, createCommand, createKeyboardShortcut, renderInlineSetting } from '@/utils';
4
+ import { Alignment, NodeType, TextSetting } from '@/enums';
5
5
 
6
6
  const DEFAULTS = {
7
7
  mobile: null,
@@ -9,14 +9,14 @@ const DEFAULTS = {
9
9
  desktop: null
10
10
  };
11
11
 
12
- export const Alignment = Extension.create({
13
- name: TextSettings.ALIGNMENT,
12
+ export const AlignmentExtension = Extension.create({
13
+ name: TextSetting.ALIGNMENT,
14
14
 
15
15
  addGlobalAttributes: () => [
16
16
  {
17
- types: [NodeTypes.PARAGRAPH, NodeTypes.HEADING],
17
+ types: [NodeType.PARAGRAPH, NodeType.HEADING],
18
18
  attributes: {
19
- [TextSettings.ALIGNMENT]: {
19
+ [TextSetting.ALIGNMENT]: {
20
20
  isRequired: false,
21
21
 
22
22
  parseHTML({ style }) {
@@ -71,15 +71,17 @@ export const Alignment = Extension.create({
71
71
  const device = commands.getDevice();
72
72
  const preset = commands.getPreset();
73
73
 
74
- return computed(() => unref(preset)[unref(device)].alignment ?? Alignments.LEFT);
74
+ return computed(() => unref(preset)[unref(device)].alignment ?? Alignment.LEFT);
75
75
  })
76
76
  };
77
77
  },
78
78
 
79
79
  addKeyboardShortcuts: () => ({
80
- 'Mod-Shift-l': createKeyboardShortcut('applyAlignment', Alignments.LEFT),
81
- 'Mod-Shift-e': createKeyboardShortcut('applyAlignment', Alignments.CENTER),
82
- 'Mod-Shift-r': createKeyboardShortcut('applyAlignment', Alignments.RIGHT),
83
- 'Mod-Shift-j': createKeyboardShortcut('applyAlignment', Alignments.JUSTIFY)
80
+ 'Mod-Shift-l': createKeyboardShortcut('applyAlignment', Alignment.LEFT),
81
+ 'Mod-Shift-e': createKeyboardShortcut('applyAlignment', Alignment.CENTER),
82
+ 'Mod-Shift-r': createKeyboardShortcut('applyAlignment', Alignment.RIGHT),
83
+ 'Mod-Shift-j': createKeyboardShortcut('applyAlignment', Alignment.JUSTIFY)
84
84
  })
85
85
  });
86
+
87
+ export { AlignmentExtension as Alignment };
@@ -1,9 +1,9 @@
1
1
  import { Mark } from '@tiptap/vue-3';
2
2
  import { convertColor, createCommand, renderMark } from '../utils';
3
- import { TextSettings } from '../enums';
3
+ import { TextSetting } from '../enums';
4
4
 
5
5
  export const BackgroundColor = Mark.create({
6
- name: TextSettings.BACKGROUND_COLOR,
6
+ name: TextSetting.BACKGROUND_COLOR,
7
7
 
8
8
  addAttributes: () => ({
9
9
  value: { required: true }
@@ -1,21 +1,21 @@
1
1
  import { Extension } from '@tiptap/vue-3';
2
- import { capitalize, createCommand } from '../utils';
3
- import { CaseStyles } from '../enums';
2
+ import { capitalize, createCommand } from '@/utils';
3
+ import { CaseStyle } from '@/enums';
4
4
 
5
- export const CaseStyle = Extension.create({
5
+ export const CaseStyleExtension = Extension.create({
6
6
  name: 'case_style',
7
7
 
8
8
  addCommands() {
9
9
  return {
10
10
  applyCaseStyle: createCommand(({ commands }, value) => {
11
11
  switch (value) {
12
- case CaseStyles.CAPITALIZE:
12
+ case CaseStyle.CAPITALIZE:
13
13
  return commands.applyCapitalize();
14
14
 
15
- case CaseStyles.LOWERCASE:
15
+ case CaseStyle.LOWERCASE:
16
16
  return commands.applyLowerCase();
17
17
 
18
- case CaseStyles.UPPERCASE:
18
+ case CaseStyle.UPPERCASE:
19
19
  return commands.applyUpperCase();
20
20
  }
21
21
  }),
@@ -34,3 +34,5 @@ export const CaseStyle = Extension.create({
34
34
  };
35
35
  }
36
36
  });
37
+
38
+ export { CaseStyleExtension as CaseStyle };
@@ -1,11 +1,11 @@
1
1
  import { Mark } from '@tiptap/vue-3';
2
2
  import { computed, unref } from 'vue';
3
- import { convertColor, createCommand, renderMark } from '../utils';
4
- import { MarkGroups, TextSettings } from '../enums';
3
+ import { convertColor, createCommand, renderMark } from '@/utils';
4
+ import { MarkGroup, TextSetting } from '@/enums';
5
5
 
6
6
  export const FontColor = Mark.create({
7
- name: TextSettings.FONT_COLOR,
8
- group: MarkGroups.SETTINGS,
7
+ name: TextSetting.FONT_COLOR,
8
+ group: MarkGroup.SETTINGS,
9
9
 
10
10
  addAttributes: () => ({
11
11
  value: { required: true }
@@ -1,11 +1,11 @@
1
1
  import { Mark } from '@tiptap/vue-3';
2
2
  import { computed, unref } from 'vue';
3
- import { createCommand, renderMark } from '../utils';
4
- import { MarkGroups, TextSettings } from '../enums';
3
+ import { createCommand, renderMark } from '@/utils';
4
+ import { MarkGroup, TextSetting } from '@/enums';
5
5
 
6
6
  export const FontFamily = Mark.create({
7
- name: TextSettings.FONT_FAMILY,
8
- group: MarkGroups.SETTINGS,
7
+ name: TextSetting.FONT_FAMILY,
8
+ group: MarkGroup.SETTINGS,
9
9
 
10
10
  addOptions: () => ({
11
11
  fonts: []
@@ -28,7 +28,7 @@ export const FontFamily = Mark.create({
28
28
  commands.applyFontWeight(fontWeight);
29
29
  }
30
30
 
31
- const isItalicCustomized = commands.isSettingCustomized(TextSettings.FONT_STYLE).value;
31
+ const isItalicCustomized = commands.isSettingCustomized(TextSetting.FONT_STYLE).value;
32
32
 
33
33
  if (!font.isItalicSupported(fontWeight) && isItalicCustomized) {
34
34
  commands.removeItalic();
@@ -1,11 +1,11 @@
1
1
  import { Mark } from '@tiptap/vue-3';
2
2
  import { computed, unref } from 'vue';
3
3
  import { convertFontSize, createCommand, createKeyboardShortcut, renderMark } from '../utils';
4
- import { MarkGroups, TextSettings } from '../enums';
4
+ import { MarkGroup, TextSetting } from '../enums';
5
5
 
6
6
  export const FontSize = Mark.create({
7
- name: TextSettings.FONT_SIZE,
8
- group: MarkGroups.SETTINGS,
7
+ name: TextSetting.FONT_SIZE,
8
+ group: MarkGroup.SETTINGS,
9
9
 
10
10
  addOptions: () => ({
11
11
  minSize: 1,
@@ -1,11 +1,11 @@
1
1
  import { Mark } from '@tiptap/vue-3';
2
2
  import { computed, unref } from 'vue';
3
3
  import { createCommand, createKeyboardShortcut, renderMark } from '@/utils';
4
- import { MarkGroups, TextSettings } from '@/enums';
4
+ import { MarkGroup, TextSetting } from '@/enums';
5
5
 
6
6
  export const FontStyle = Mark.create({
7
- name: TextSettings.FONT_STYLE,
8
- group: MarkGroups.SETTINGS,
7
+ name: TextSetting.FONT_STYLE,
8
+ group: MarkGroup.SETTINGS,
9
9
 
10
10
  addAttributes: () => ({
11
11
  italic: { required: true }
@@ -1,11 +1,11 @@
1
1
  import { Mark } from '@tiptap/vue-3';
2
2
  import { computed, unref } from 'vue';
3
3
  import { createCommand, createKeyboardShortcut, renderMark } from '../utils';
4
- import { MarkGroups, TextSettings } from '../enums';
4
+ import { MarkGroup, TextSetting } from '../enums';
5
5
 
6
6
  export const FontWeight = Mark.create({
7
- name: TextSettings.FONT_WEIGHT,
8
- group: MarkGroups.SETTINGS,
7
+ name: TextSetting.FONT_WEIGHT,
8
+ group: MarkGroup.SETTINGS,
9
9
 
10
10
  addAttributes: () => ({
11
11
  value: { required: true }
@@ -1,7 +1,7 @@
1
1
  import { Extension } from '@tiptap/vue-3';
2
2
  import { computed, unref } from 'vue';
3
3
  import { createCommand, renderInlineSetting, convertLineHeight } from '../utils';
4
- import { NodeTypes, TextSettings } from '../enums';
4
+ import { NodeType, TextSetting } from '../enums';
5
5
 
6
6
  const DEFAULTS = {
7
7
  mobile: null,
@@ -10,14 +10,14 @@ const DEFAULTS = {
10
10
  };
11
11
 
12
12
  export const LineHeight = Extension.create({
13
- name: TextSettings.LINE_HEIGHT,
13
+ name: TextSetting.LINE_HEIGHT,
14
14
 
15
15
  addGlobalAttributes() {
16
16
  return [
17
17
  {
18
- types: [NodeTypes.PARAGRAPH, NodeTypes.HEADING],
18
+ types: [NodeType.PARAGRAPH, NodeType.HEADING],
19
19
  attributes: {
20
- [TextSettings.LINE_HEIGHT]: {
20
+ [TextSetting.LINE_HEIGHT]: {
21
21
  isRequired: false,
22
22
 
23
23
  parseHTML: (element) => {
@@ -1,12 +1,12 @@
1
1
  import Base from '@tiptap/extension-link';
2
2
  import { computed, unref } from 'vue';
3
- import { createCommand } from '../utils';
4
- import { LinkDestinations, LinkTargets, TextSettings } from '../enums';
5
- import { NodeFactory } from '../services';
3
+ import { createCommand } from '@/utils';
4
+ import { LinkDestination, LinkTarget, TextSetting } from '@/enums';
5
+ import { NodeFactory } from '@/services';
6
6
  import { PasteLinkPlugin } from './proseMirror';
7
7
 
8
8
  export const Link = Base.extend({
9
- name: TextSettings.LINK,
9
+ name: TextSetting.LINK,
10
10
 
11
11
  addOptions() {
12
12
  return {
@@ -30,23 +30,23 @@ export const Link = Base.extend({
30
30
  },
31
31
 
32
32
  target: {
33
- default: LinkTargets.SELF,
34
- parseHTML: (element) => element.getAttribute('target') || LinkTargets.SELF
33
+ default: LinkTarget.SELF,
34
+ parseHTML: (element) => element.getAttribute('target') || LinkTarget.SELF
35
35
  },
36
36
 
37
37
  destination: {
38
- default: LinkDestinations.URL,
38
+ default: LinkDestination.URL,
39
39
 
40
40
  parseHTML: (element) => {
41
41
  const href = element.getAttribute('href');
42
42
 
43
- if (!href.startsWith('#')) return LinkDestinations.URL;
43
+ if (!href.startsWith('#')) return LinkDestination.URL;
44
44
 
45
45
  const id = href.replace('#', '');
46
46
  const blocks = unref(this.options.pageBlocks);
47
47
  const block = blocks.find((block) => block.id === parseInt(id));
48
48
 
49
- return block ? LinkDestinations.BLOCK : LinkDestinations.URL;
49
+ return block ? LinkDestination.BLOCK : LinkDestination.URL;
50
50
  }
51
51
  }
52
52
  };
@@ -63,7 +63,7 @@ export const Link = Base.extend({
63
63
 
64
64
  if (!commands.getSelectedText()) {
65
65
  return commands.insertContent(NodeFactory.text(attributes.text, [
66
- NodeFactory.mark(TextSettings.LINK, attributes)
66
+ NodeFactory.mark(TextSetting.LINK, attributes)
67
67
  ]));
68
68
  }
69
69
 
@@ -96,7 +96,7 @@ export const Link = Base.extend({
96
96
  },
97
97
 
98
98
  renderHTML({ HTMLAttributes: attrs }) {
99
- const href = attrs.destination === LinkDestinations.BLOCK ? `#${attrs.href}` : attrs.href;
99
+ const href = attrs.destination === LinkDestination.BLOCK ? `#${attrs.href}` : attrs.href;
100
100
  const presetClass = unref(this.options.basePresetClass) + unref(this.options.preset).id;
101
101
  const linkAttrs = { href, target: attrs.target, class: `${presetClass} zw-style` };
102
102
 
@@ -1,17 +1,17 @@
1
1
  import { Extension } from '@tiptap/vue-3';
2
- import { NodeTypes, TextSettings } from '../enums';
2
+ import { NodeType, TextSetting } from '../enums';
3
3
  import { renderInlineSetting } from '../utils';
4
4
 
5
5
  // Fallback margins in old wysiwyg content
6
6
  export const Margin = Extension.create({
7
- name: TextSettings.MARGIN,
7
+ name: TextSetting.MARGIN,
8
8
 
9
9
  addGlobalAttributes: () => [
10
10
  {
11
- types: [NodeTypes.PARAGRAPH, NodeTypes.HEADING],
11
+ types: [NodeType.PARAGRAPH, NodeType.HEADING],
12
12
 
13
13
  attributes: {
14
- [TextSettings.MARGIN]: {
14
+ [TextSetting.MARGIN]: {
15
15
  isRequired: false,
16
16
 
17
17
  parseHTML(el) {