tiptapify 0.0.10 → 0.0.12

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 (107) hide show
  1. package/README.md +7 -3
  2. package/dist/tiptapify.css +1 -1
  3. package/dist/tiptapify.mjs +18524 -17801
  4. package/dist/tiptapify.umd.js +77 -38
  5. package/index.d.ts +2 -2
  6. package/package.json +41 -40
  7. package/src/components/MenuBubble.vue +8 -8
  8. package/src/components/Tiptapify.vue +5 -6
  9. package/src/components/Toolbar/Group.vue +2 -2
  10. package/src/components/Toolbar/GroupBtn.vue +12 -9
  11. package/src/components/Toolbar/GroupDropdown.vue +5 -19
  12. package/src/components/Toolbar/Index.vue +13 -9
  13. package/src/components/Toolbar/Items.vue +5 -8
  14. package/src/components/Toolbar/Toggle.vue +3 -5
  15. package/src/components/Toolbar/defaultExtensionComponents.ts +34 -13
  16. package/src/components/Toolbar/items.ts +53 -70
  17. package/src/components/UI/BtnIcon.vue +24 -0
  18. package/src/components/UI/{Dialog.vue → TiptapifyDialog.vue} +4 -3
  19. package/src/components/editorExtensions.ts +17 -2
  20. package/src/components/index.ts +8 -2
  21. package/src/composables/Toolbar/Actions/useRedo.ts +23 -0
  22. package/src/composables/Toolbar/Actions/useUndo.ts +23 -0
  23. package/src/composables/Toolbar/Alignment/useAlignmentCenter.ts +24 -0
  24. package/src/composables/Toolbar/Alignment/useAlignmentJustify.ts +24 -0
  25. package/src/composables/Toolbar/Alignment/useAlignmentLeft.ts +24 -0
  26. package/src/composables/Toolbar/Alignment/useAlignmentRight.ts +24 -0
  27. package/src/composables/Toolbar/Format/useBold.ts +24 -0
  28. package/src/composables/Toolbar/Format/useItalic.ts +24 -0
  29. package/src/composables/Toolbar/Format/useStrike.ts +24 -0
  30. package/src/composables/Toolbar/Format/useUnderline.ts +24 -0
  31. package/src/composables/Toolbar/FormatExtra/useBlockquote.ts +24 -0
  32. package/src/composables/Toolbar/FormatExtra/useCode.ts +24 -0
  33. package/src/composables/Toolbar/FormatExtra/useCodeBlock.ts +24 -0
  34. package/src/composables/Toolbar/FormatExtra/useSub.ts +24 -0
  35. package/src/composables/Toolbar/FormatExtra/useSup.ts +24 -0
  36. package/src/composables/Toolbar/List/useBullet.ts +23 -0
  37. package/src/composables/Toolbar/List/useIndent.ts +24 -0
  38. package/src/composables/Toolbar/List/useNumbered.ts +23 -0
  39. package/src/composables/Toolbar/List/useOutdent.ts +24 -0
  40. package/src/composables/Toolbar/List/useTask.ts +23 -0
  41. package/src/composables/Toolbar/Media/useImage.ts +24 -0
  42. package/src/composables/Toolbar/Media/useLink.ts +24 -0
  43. package/src/composables/Toolbar/Media/useTable.ts +188 -0
  44. package/src/composables/Toolbar/Misc/useBreak.ts +21 -0
  45. package/src/composables/Toolbar/Misc/useFormatClear.ts +23 -0
  46. package/src/composables/Toolbar/Misc/useInvisibleCharacters.ts +23 -0
  47. package/src/composables/Toolbar/Misc/useLine.ts +21 -0
  48. package/src/composables/Toolbar/Misc/usePreview.ts +20 -0
  49. package/src/composables/Toolbar/Misc/useSource.ts +21 -0
  50. package/src/composables/Toolbar/Style/useColor.ts +36 -0
  51. package/src/composables/Toolbar/Style/useFontFamily.ts +49 -0
  52. package/src/composables/Toolbar/Style/useFontSize.ts +50 -0
  53. package/src/composables/Toolbar/Style/useHeading.ts +64 -0
  54. package/src/composables/Toolbar/Style/useHighlight.ts +36 -0
  55. package/src/composables/Toolbar/Style/useLineHeight.ts +49 -0
  56. package/src/composables/Toolbar/useActionsItems.ts +9 -0
  57. package/src/composables/Toolbar/useAlignmentItems.ts +13 -0
  58. package/src/composables/Toolbar/useFormatExtraItems.ts +15 -0
  59. package/src/composables/Toolbar/useFormatItems.ts +13 -0
  60. package/src/composables/Toolbar/useListItems.ts +15 -0
  61. package/src/composables/Toolbar/useMediaItems.ts +11 -0
  62. package/src/composables/Toolbar/useMiscItems.ts +17 -0
  63. package/src/composables/Toolbar/useStyleItems.ts +17 -0
  64. package/src/{components/Toolbar/fonts.ts → constants/style.ts} +21 -0
  65. package/src/extensions/components/FontFamily.vue +82 -0
  66. package/src/extensions/components/FontSize.vue +83 -0
  67. package/src/extensions/components/ImageDialog.vue +7 -3
  68. package/src/extensions/components/LineHeight.vue +82 -0
  69. package/src/extensions/components/LinkDialog.vue +27 -7
  70. package/src/extensions/components/PreviewDialog.vue +11 -4
  71. package/src/extensions/components/ShowSourceDialog.vue +10 -6
  72. package/src/extensions/components/StyleColor.vue +2 -2
  73. package/src/extensions/components/slashCommands/CommandsList.vue +1 -4
  74. package/src/extensions/image.ts +2 -1
  75. package/src/extensions/link.ts +10 -1
  76. package/src/extensions/preview.ts +2 -1
  77. package/src/extensions/slash-commands.ts +1 -1
  78. package/src/extensions/view-source.ts +2 -1
  79. package/src/i18n/locales/ch.json +84 -82
  80. package/src/i18n/locales/cz.json +32 -30
  81. package/src/i18n/locales/de.json +28 -26
  82. package/src/i18n/locales/en.json +3 -1
  83. package/src/i18n/locales/es.json +30 -28
  84. package/src/i18n/locales/fr.json +30 -28
  85. package/src/i18n/locales/it.json +32 -30
  86. package/src/i18n/locales/la.json +61 -59
  87. package/src/i18n/locales/lt.json +38 -36
  88. package/src/i18n/locales/nl.json +31 -29
  89. package/src/i18n/locales/pl.json +32 -30
  90. package/src/i18n/locales/pt.json +29 -27
  91. package/src/i18n/locales/ru.json +3 -1
  92. package/src/i18n/locales/se.json +30 -28
  93. package/src/i18n/locales/ua.json +3 -1
  94. package/src/index.ts +3 -1
  95. package/src/types/extensionComponents.ts +22 -0
  96. package/src/types/toolbarItems.ts +43 -0
  97. package/src/types/toolbarSections.ts +11 -0
  98. package/src/components/Toolbar/items/actions.ts +0 -32
  99. package/src/components/Toolbar/items/alignment.ts +0 -60
  100. package/src/components/Toolbar/items/format.ts +0 -60
  101. package/src/components/Toolbar/items/formatExtra.ts +0 -73
  102. package/src/components/Toolbar/items/list.ts +0 -70
  103. package/src/components/Toolbar/items/media.ts +0 -211
  104. package/src/components/Toolbar/items/misc.ts +0 -59
  105. package/src/components/Toolbar/items/style.ts +0 -204
  106. package/src/types/overridable-extensions.ts +0 -6
  107. /package/src/{components → extensions/components}/CodeBlockComponent.vue +0 -0
@@ -1,204 +0,0 @@
1
- import * as mdi from "@mdi/js";
2
- import { Editor } from "@tiptap/vue-3";
3
- import { fonts } from "@tiptapify/components/Toolbar/fonts";
4
- import StyleColor from "@tiptapify/extensions/components/StyleColor.vue";
5
- import { computed, markRaw, ref } from "vue";
6
-
7
- interface MDIIcons {
8
- [key: string]: string
9
- }
10
- const mdiIcons = mdi as MDIIcons
11
-
12
- export function getStyleItems(editor: Editor, theme: any, fontMeasure: string, customHeadingLevels: Array<number> = []) {
13
- const headingLevels = ref([1, 2, 3, 4, 5, 6])
14
- if (customHeadingLevels.length) {
15
- customHeadingLevels.forEach(level => {
16
- if (level <= 0 || level > 6) {
17
- throw new Error('customHeadingLevels must be between 1 and 6')
18
- }
19
- })
20
-
21
- headingLevels.value = customHeadingLevels
22
- }
23
-
24
- const fontSizes = [6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 32, 48, 64, 96]
25
-
26
- const lineHeights = [1, 1.5, 2, 3, 4]
27
-
28
- return {
29
- heading: {
30
- name: 'heading',
31
- tooltip: 'style.heading',
32
- icon: mdi.mdiFormatHeaderPound,
33
- modelValue: null,
34
- enabled: true,
35
- props: {
36
- color: computed(() => editor.isActive('heading') || editor.isActive('paragraph') ? 'primary' : ''),
37
- },
38
- children: [
39
- {
40
- name: `paragraph`,
41
- tooltip: `style.paragraph`,
42
- icon: mdiIcons[`mdiFormatParagraph`],
43
- noI18n: true,
44
- enabled: true,
45
- props: {
46
- color: computed(() => editor.isActive('paragraph') ? 'primary' : ''),
47
- },
48
- attrs: {
49
- click: () => editor.chain().focus().setParagraph().run()
50
- }
51
- }
52
- ].concat(
53
- headingLevels.value.map(level => {
54
- return {
55
- name: `H${level}`,
56
- tooltip: `style.headings.h${level}`,
57
- icon: mdiIcons[`mdiFormatHeader${level}`],
58
- noI18n: true,
59
- enabled: true,
60
- props: {
61
- color: computed(() => editor.isActive('heading', { level: level }) ? 'primary' : ''),
62
- },
63
- attrs: {
64
- click: () => editor.chain().focus().toggleHeading({ level }).run()
65
- }
66
- }
67
- })
68
- )
69
- },
70
- fontFamily: {
71
- name: 'font-family',
72
- tooltip: 'style.fontFamily',
73
- icon: mdi.mdiFormatFont,
74
- modelValue: false,
75
- enabled: true,
76
- props: {
77
- disabled: computed(() => !editor.can().chain().focus().unsetFontFamily().run()),
78
- },
79
- attrs: {
80
- click: () => editor.chain().focus().unsetFontFamily().run()
81
- },
82
- children: fonts.map((font) => {
83
- return {
84
- name: font.name,
85
- tooltip: '',
86
- icon: '',
87
- enabled: true,
88
- noI18n: true,
89
- props: {
90
- color: computed(() => editor.isActive('textStyle', {fontFamily: font.fontFamily}) ? 'primary' : ''),
91
- style: `font-family: ${font.fontFamily};`
92
- },
93
- attrs: {
94
- click: () => editor.chain().focus().setFontFamily(font.fontFamily).run()
95
- }
96
- }
97
- })
98
- },
99
- fontSize: {
100
- name: 'font-size',
101
- tooltip: 'style.fontSize',
102
- icon: mdi.mdiFormatSize,
103
- modelValue: false,
104
- enabled: true,
105
- props: {
106
- disabled: computed(() => !editor.can().chain().focus().unsetFontSize().run()),
107
- },
108
- attrs: {
109
- click: () => editor.chain().focus().unsetFontSize().run()
110
- },
111
- children: fontSizes.map((fontSize) => {
112
- return {
113
- name: `${fontSize}${fontMeasure}`,
114
- tooltip: '',
115
- icon: '',
116
- enabled: true,
117
- noI18n: true,
118
- props: {
119
- color: computed(() => editor.isActive('textStyle', {fontSizes: fontSize}) ? 'primary' : ''),
120
- },
121
- attrs: {
122
- click: () => editor.chain().focus().setFontSize(`${fontSize}${fontMeasure}`).run()
123
- }
124
- }
125
- })
126
- },
127
- lineHeight: {
128
- name: 'line-height',
129
- tooltip: 'style.lineHeight',
130
- icon: mdi.mdiFormatLineHeight,
131
- modelValue: null,
132
- enabled: true,
133
- props: {
134
- disabled: computed(() => !editor.can().chain().focus().unsetLineHeight().run()),
135
- },
136
- attrs: {
137
- click: () => editor.chain().focus().unsetLineHeight().run()
138
- },
139
- children: lineHeights.map((lineHeight) => {
140
- return {
141
- name: lineHeight,
142
- tooltip: '',
143
- icon: '',
144
- enabled: true,
145
- noI18n: true,
146
- props: {
147
- color: computed(() => editor.isActive('textStyle', {lineHeights: lineHeight}) ? 'primary' : ''),
148
- },
149
- attrs: {
150
- click: () => editor.chain().focus().setLineHeight(lineHeight.toString()).run()
151
- }
152
- }
153
- })
154
- },
155
- highlight: {
156
- name: 'highlight',
157
- tooltip: 'style.color.highlight',
158
- icon: mdi.mdiFormatColorFill,
159
- icon2: mdi.mdiColorHelper,
160
- enabled: true,
161
- props: {
162
- disabled: computed(() => !editor.can().chain().focus().toggleHighlight().run()),
163
- },
164
- icon2Props: {
165
- disabled: computed(() => !editor.can().chain().focus().toggleHighlight().run()),
166
- color: computed(() => {
167
- const defaultColor = theme.global.current.value.dark ? '#fff' : '#000'
168
- return editor.getAttributes('highlight').color || defaultColor
169
- }),
170
- style: 'filter: drop-shadow(rgba(0, 0, 0, .75) 1px 1px 2px);'
171
- },
172
- component: markRaw(StyleColor),
173
- componentProps: {
174
- fontColor: false,
175
- backgroundColor: true,
176
- color: computed(() => editor.getAttributes('highlight').color || ''),
177
- }
178
- },
179
- color: {
180
- name: 'color',
181
- tooltip: 'style.color.text',
182
- icon: mdi.mdiFormatColorText,
183
- icon2: mdi.mdiColorHelper,
184
- enabled: true,
185
- props: {
186
- disabled: computed(() => !editor.can().chain().focus().toggleHighlight().run()),
187
- },
188
- icon2Props: {
189
- disabled: computed(() => !editor.can().chain().focus().toggleHighlight().run()),
190
- color: computed(() => {
191
- const defaultColor = theme.global.current.value.dark ? '#fff' : '#000'
192
- return editor.getAttributes('textStyle').color || defaultColor
193
- }),
194
- style: 'filter: drop-shadow(rgba(0, 0, 0, .75) 1px 1px 2px);'
195
- },
196
- component: markRaw(StyleColor),
197
- componentProps: {
198
- fontColor: true,
199
- backgroundColor: false,
200
- color: computed(() => editor.getAttributes('textStyle').color || ''),
201
- }
202
- }
203
- }
204
- }
@@ -1,6 +0,0 @@
1
- export enum OverridableExtensions {
2
- link = 'link',
3
- image = 'image',
4
- }
5
-
6
- export interface extensionsComponents { [key: string]: { component: any, props?: any} }