tiptapify 0.0.11 → 0.0.13

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 +9 -4
  2. package/dist/tiptapify.css +1 -1
  3. package/dist/tiptapify.mjs +47819 -28736
  4. package/dist/tiptapify.umd.js +78 -38
  5. package/index.d.ts +2 -2
  6. package/package.json +49 -45
  7. package/src/components/MenuBubble.vue +8 -8
  8. package/src/components/Tiptapify.vue +4 -5
  9. package/src/components/Toolbar/Group.vue +2 -2
  10. package/src/components/Toolbar/GroupBtn.vue +11 -8
  11. package/src/components/Toolbar/GroupDropdown.vue +3 -17
  12. package/src/components/Toolbar/Index.vue +13 -10
  13. package/src/components/Toolbar/Items.vue +3 -6
  14. package/src/components/Toolbar/Toggle.vue +2 -4
  15. package/src/components/Toolbar/defaultExtensionComponents.ts +34 -13
  16. package/src/components/Toolbar/items.ts +43 -60
  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 +16 -1
  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/useEmoji.ts +20 -0
  42. package/src/composables/Toolbar/Media/useImage.ts +24 -0
  43. package/src/composables/Toolbar/Media/useLink.ts +24 -0
  44. package/src/composables/Toolbar/Media/useTable.ts +188 -0
  45. package/src/composables/Toolbar/Misc/useBreak.ts +21 -0
  46. package/src/composables/Toolbar/Misc/useFormatClear.ts +23 -0
  47. package/src/composables/Toolbar/Misc/useInvisibleCharacters.ts +23 -0
  48. package/src/composables/Toolbar/Misc/useLine.ts +21 -0
  49. package/src/composables/Toolbar/Misc/usePreview.ts +20 -0
  50. package/src/composables/Toolbar/Misc/useSource.ts +21 -0
  51. package/src/composables/Toolbar/Style/useColor.ts +36 -0
  52. package/src/composables/Toolbar/Style/useFontFamily.ts +49 -0
  53. package/src/composables/Toolbar/Style/useFontSize.ts +50 -0
  54. package/src/composables/Toolbar/Style/useHeading.ts +64 -0
  55. package/src/composables/Toolbar/Style/useHighlight.ts +36 -0
  56. package/src/composables/Toolbar/Style/useLineHeight.ts +49 -0
  57. package/src/composables/Toolbar/useActionsItems.ts +5 -31
  58. package/src/composables/Toolbar/useAlignmentItems.ts +9 -59
  59. package/src/composables/Toolbar/useFormatExtraItems.ts +11 -72
  60. package/src/composables/Toolbar/useFormatItems.ts +9 -59
  61. package/src/composables/Toolbar/useListItems.ts +11 -69
  62. package/src/composables/Toolbar/useMediaItems.ts +9 -209
  63. package/src/composables/Toolbar/useMiscItems.ts +13 -58
  64. package/src/composables/Toolbar/useStyleItems.ts +14 -228
  65. package/src/extensions/components/Emoji.vue +109 -0
  66. package/src/extensions/components/ImageDialog.vue +7 -3
  67. package/src/extensions/components/LinkDialog.vue +7 -3
  68. package/src/extensions/components/PreviewDialog.vue +11 -4
  69. package/src/extensions/components/ShowSourceDialog.vue +7 -4
  70. package/src/extensions/components/StyleColor.vue +2 -2
  71. package/src/extensions/components/slashCommands/CommandsList.vue +1 -4
  72. package/src/extensions/emoji/activities.ts +770 -0
  73. package/src/extensions/emoji/animals_and_nature.ts +1330 -0
  74. package/src/extensions/emoji/component.ts +74 -0
  75. package/src/extensions/emoji/flags.ts +2210 -0
  76. package/src/extensions/emoji/food_and_drink.ts +1066 -0
  77. package/src/extensions/emoji/index.ts +63 -0
  78. package/src/extensions/emoji/objects.ts +2514 -0
  79. package/src/extensions/emoji/people_and_body.ts +3986 -0
  80. package/src/extensions/emoji/smileys_and_emotion.ts +1482 -0
  81. package/src/extensions/emoji/symbols.ts +2242 -0
  82. package/src/extensions/emoji/travel_and_places.ts +2138 -0
  83. package/src/extensions/image.ts +2 -1
  84. package/src/extensions/link.ts +2 -1
  85. package/src/extensions/preview.ts +2 -1
  86. package/src/extensions/view-source.ts +2 -1
  87. package/src/i18n/index.ts +1 -0
  88. package/src/i18n/locales/ch.json +14 -1
  89. package/src/i18n/locales/cz.json +14 -1
  90. package/src/i18n/locales/de.json +14 -1
  91. package/src/i18n/locales/en.json +14 -1
  92. package/src/i18n/locales/es.json +14 -1
  93. package/src/i18n/locales/fr.json +14 -1
  94. package/src/i18n/locales/it.json +14 -1
  95. package/src/i18n/locales/la.json +14 -1
  96. package/src/i18n/locales/lt.json +14 -1
  97. package/src/i18n/locales/nl.json +14 -1
  98. package/src/i18n/locales/pl.json +14 -1
  99. package/src/i18n/locales/pt.json +14 -1
  100. package/src/i18n/locales/ru.json +14 -1
  101. package/src/i18n/locales/se.json +14 -1
  102. package/src/i18n/locales/ua.json +14 -1
  103. package/src/index.ts +3 -1
  104. package/src/types/extensionComponents.ts +22 -0
  105. package/src/types/toolbarItems.ts +43 -0
  106. package/src/types/toolbarSections.ts +11 -0
  107. package/src/types/overridable-extensions.ts +0 -6
package/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Editor } from "@tiptap/vue-3";
2
2
  import type { DefineComponent } from 'vue'
3
- import { extensionsComponents } from "./src/types/overridable-extensions";
3
+ import { extensionComponents } from "./src/types/extensionComponents";
4
4
 
5
5
  export interface TiptapifyProps {
6
6
  content: string|object
@@ -18,7 +18,7 @@ export interface TiptapifyProps {
18
18
  defaultFontFamily: string
19
19
  fontMeasure: string
20
20
  rounded: string
21
- overrideExtensionsComponents: extensionsComponents
21
+ customExtensions: extensionComponents
22
22
  }
23
23
 
24
24
  export interface TiptapifyEmits {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tiptapify",
3
3
  "types": "./index.d.ts",
4
- "version": "0.0.11",
4
+ "version": "0.0.13",
5
5
  "description": "Tiptap3 editor with Vuetify3 menu implementation",
6
6
  "exports": {
7
7
  ".": {
@@ -29,7 +29,8 @@
29
29
  "scripts": {
30
30
  "dev": "vite",
31
31
  "build": "vite build",
32
- "test": "echo \"Error: no test specified\" && exit 1"
32
+ "test": "echo \"Error: no test specified\" && exit 1",
33
+ "build:emojis": "tsx build-emojis.ts"
33
34
  },
34
35
  "keywords": [
35
36
  "vue",
@@ -53,48 +54,50 @@
53
54
  "repository": "https://github.com/IVoyt/tiptapify",
54
55
  "packageManager": "pnpm@10.12.1",
55
56
  "dependencies": {
56
- "@tiptap/core": "^3.0.7",
57
- "@tiptap/extension-blockquote": "^3.0.7",
58
- "@tiptap/extension-bold": "^3.0.7",
59
- "@tiptap/extension-bubble-menu": "^3.0.7",
60
- "@tiptap/extension-code": "^3.0.7",
61
- "@tiptap/extension-code-block": "^3.0.7",
62
- "@tiptap/extension-code-block-lowlight": "^3.0.7",
63
- "@tiptap/extension-color": "^3.0.7",
64
- "@tiptap/extension-document": "^3.0.7",
65
- "@tiptap/extension-floating-menu": "^3.0.7",
66
- "@tiptap/extension-font-family": "^3.0.7",
67
- "@tiptap/extension-hard-break": "^3.0.7",
68
- "@tiptap/extension-heading": "^3.0.7",
69
- "@tiptap/extension-highlight": "^3.0.7",
70
- "@tiptap/extension-horizontal-rule": "^3.0.7",
71
- "@tiptap/extension-image": "^3.0.7",
72
- "@tiptap/extension-italic": "^3.0.7",
73
- "@tiptap/extension-link": "^3.0.7",
74
- "@tiptap/extension-list": "^3.0.7",
75
- "@tiptap/extension-list-item": "^3.0.7",
76
- "@tiptap/extension-paragraph": "^3.0.7",
77
- "@tiptap/extension-placeholder": "^3.0.7",
78
- "@tiptap/extension-strike": "^3.0.7",
79
- "@tiptap/extension-subscript": "^3.0.7",
80
- "@tiptap/extension-superscript": "^3.0.7",
81
- "@tiptap/extension-table": "^3.0.7",
82
- "@tiptap/extension-task-item": "^3.0.7",
83
- "@tiptap/extension-task-list": "^3.0.7",
84
- "@tiptap/extension-text": "^3.0.7",
85
- "@tiptap/extension-text-align": "^3.0.7",
86
- "@tiptap/extension-text-style": "^3.0.7",
87
- "@tiptap/extension-typography": "^3.0.7",
88
- "@tiptap/extension-underline": "^3.0.7",
89
- "@tiptap/extensions": "^3.0.7",
90
- "@tiptap/pm": "^3.0.7",
91
- "@tiptap/starter-kit": "^3.0.7",
92
- "@tiptap/suggestion": "^3.0.7",
93
- "@tiptap/vue-3": "^3.0.7",
57
+ "@tiptap/core": "^3.0.8",
58
+ "@tiptap/extension-blockquote": "^3.0.8",
59
+ "@tiptap/extension-bold": "^3.0.8",
60
+ "@tiptap/extension-bubble-menu": "^3.0.8",
61
+ "@tiptap/extension-code": "^3.0.8",
62
+ "@tiptap/extension-code-block": "^3.0.8",
63
+ "@tiptap/extension-code-block-lowlight": "^3.0.8",
64
+ "@tiptap/extension-color": "^3.0.8",
65
+ "@tiptap/extension-document": "^3.0.8",
66
+ "@tiptap/extension-floating-menu": "^3.0.8",
67
+ "@tiptap/extension-font-family": "^3.0.8",
68
+ "@tiptap/extension-hard-break": "^3.0.8",
69
+ "@tiptap/extension-heading": "^3.0.8",
70
+ "@tiptap/extension-highlight": "^3.0.8",
71
+ "@tiptap/extension-horizontal-rule": "^3.0.8",
72
+ "@tiptap/extension-image": "^3.0.8",
73
+ "@tiptap/extension-invisible-characters": "^3.0.8",
74
+ "@tiptap/extension-italic": "^3.0.8",
75
+ "@tiptap/extension-link": "^3.0.8",
76
+ "@tiptap/extension-list": "^3.0.8",
77
+ "@tiptap/extension-list-item": "^3.0.8",
78
+ "@tiptap/extension-paragraph": "^3.0.8",
79
+ "@tiptap/extension-placeholder": "^3.0.8",
80
+ "@tiptap/extension-strike": "^3.0.8",
81
+ "@tiptap/extension-subscript": "^3.0.8",
82
+ "@tiptap/extension-superscript": "^3.0.8",
83
+ "@tiptap/extension-table": "^3.0.8",
84
+ "@tiptap/extension-task-item": "^3.0.8",
85
+ "@tiptap/extension-task-list": "^3.0.8",
86
+ "@tiptap/extension-text": "^3.0.8",
87
+ "@tiptap/extension-text-align": "^3.0.8",
88
+ "@tiptap/extension-text-style": "^3.0.8",
89
+ "@tiptap/extension-typography": "^3.0.8",
90
+ "@tiptap/extension-underline": "^3.0.8",
91
+ "@tiptap/extensions": "^3.0.8",
92
+ "@tiptap/pm": "^3.0.8",
93
+ "@tiptap/starter-kit": "^3.0.8",
94
+ "@tiptap/suggestion": "^3.0.8",
95
+ "@tiptap/vue-3": "^3.0.8",
96
+ "emoji.json": "^16.0.0",
94
97
  "highlight.js": "^11.11.1",
95
- "linkifyjs": "^4.3.1",
98
+ "linkifyjs": "^4.3.2",
96
99
  "lowlight": "^3.3.0",
97
- "vue-i18n": "^11.1.10"
100
+ "vue-i18n": "^11.1.11"
98
101
  },
99
102
  "peerDependencies": {
100
103
  "@mdi/js": "^7.4.47",
@@ -104,15 +107,16 @@
104
107
  "devDependencies": {
105
108
  "@intlify/unplugin-vue-i18n": "^6.0.8",
106
109
  "@rollup/plugin-alias": "^5.1.1",
107
- "@types/node": "^22.16.4",
110
+ "@types/node": "^22.17.0",
108
111
  "@vitejs/plugin-vue": "^5.2.4",
109
112
  "@vitejs/plugin-vue-jsx": "^4.2.0",
110
113
  "rollup-plugin-tsconfig-paths": "^1.5.2",
111
114
  "sass-embedded": "^1.89.2",
112
- "typescript": "^5.8.3",
115
+ "tsx": "^4.20.3",
116
+ "typescript": "^5.9.2",
113
117
  "unplugin-vue-components": "^28.8.0",
114
118
  "vite": "^6.3.5",
115
- "vite-plugin-vuetify": "^2.1.1",
119
+ "vite-plugin-vuetify": "^2.1.2",
116
120
  "vite-svg-loader": "^5.1.0",
117
121
  "vite-tsconfig-paths": "^5.1.4",
118
122
  "vue-tsc": "^2.2.12"
@@ -14,7 +14,7 @@ const editor = inject('tiptapifyEditor') as Ref<Editor>
14
14
  const items = ref([
15
15
  {
16
16
  name: 'bold',
17
- icon: mdi.mdiFormatBold,
17
+ icon: `mdiSvg:${mdi.mdiFormatBold}`,
18
18
  props: {
19
19
  disabled: computed(() => !editor?.value.can().chain().focus().toggleBold().run()),
20
20
  color: computed(() => editor.value.isActive('bold') ? 'primary' : ''),
@@ -23,7 +23,7 @@ const items = ref([
23
23
  },
24
24
  {
25
25
  name: 'italic',
26
- icon: mdi.mdiFormatItalic,
26
+ icon: `mdiSvg:${mdi.mdiFormatItalic}`,
27
27
  props: {
28
28
  disabled: computed(() => !editor.value.can().chain().focus().toggleItalic().run()),
29
29
  color: computed(() => editor.value.isActive('italic') ? 'primary' : ''),
@@ -32,7 +32,7 @@ const items = ref([
32
32
  },
33
33
  {
34
34
  name: 'strike',
35
- icon: mdi.mdiFormatStrikethroughVariant,
35
+ icon: `mdiSvg:${mdi.mdiFormatStrikethroughVariant}`,
36
36
  props: {
37
37
  disabled: computed(() => !editor.value.can().chain().focus().toggleStrike().run()),
38
38
  color: computed(() => editor.value.isActive('strike') ? 'primary' : ''),
@@ -41,7 +41,7 @@ const items = ref([
41
41
  },
42
42
  {
43
43
  name: 'underline',
44
- icon: mdi.mdiFormatUnderline,
44
+ icon: `mdiSvg:${mdi.mdiFormatUnderline}`,
45
45
  props: {
46
46
  disabled: computed(() => !editor.value.can().chain().focus().toggleUnderline().run()),
47
47
  color: computed(() => editor.value.isActive('underline') ? 'primary' : ''),
@@ -50,7 +50,7 @@ const items = ref([
50
50
  },
51
51
  {
52
52
  name: 'highlight',
53
- icon: mdi.mdiFormatColorHighlight,
53
+ icon: `mdiSvg:${mdi.mdiFormatColorHighlight}`,
54
54
  props: {
55
55
  disabled: computed(() => !editor.value.can().chain().focus().toggleHighlight().run()),
56
56
  color: computed(() => editor.value.isActive('highlight') ? 'primary' : ''),
@@ -59,7 +59,7 @@ const items = ref([
59
59
  },
60
60
  {
61
61
  name: 'code',
62
- icon: mdi.mdiXml,
62
+ icon: `mdiSvg:${mdi.mdiXml}`,
63
63
  props: {
64
64
  disabled: computed(() => !editor.value.can().chain().focus().toggleCode().run()),
65
65
  color: computed(() => editor.value.isActive('code') ? 'primary' : ''),
@@ -68,7 +68,7 @@ const items = ref([
68
68
  },
69
69
  {
70
70
  name: 'link',
71
- icon: computed(() => editor.value.isActive('link') ? mdi.mdiLinkOff : mdi.mdiLink),
71
+ icon: computed(() => editor.value.isActive('link') ? `mdiSvg:${mdi.mdiLinkOff}` : `mdiSvg:${mdi.mdiLink}`),
72
72
  props: {
73
73
  color: computed(() => editor.value.isActive('link') ? 'primary' : ''),
74
74
  disabled: computed(() => editor.value.isActive('code') || editor.value.isActive('codeBlock')),
@@ -77,7 +77,7 @@ const items = ref([
77
77
  },
78
78
  {
79
79
  name: 'format clear',
80
- icon: mdi.mdiFormatClear,
80
+ icon: `mdiSvg:${mdi.mdiFormatClear}`,
81
81
  click: () => editor.value.chain().focus().unsetAllMarks().clearNodes().run(),
82
82
  }
83
83
  ])
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
 
3
- import { extensionsComponents } from "@tiptapify/types/overridable-extensions";
3
+ import { extensionComponents } from "@tiptapify/types/extensionComponents";
4
4
  import { computed, onBeforeUnmount, PropType, provide, ref, ShallowRef, watch } from "vue";
5
5
  import { default as Toolbar } from "@tiptapify/components/Toolbar/Index.vue";
6
6
  import { Editor, EditorContent } from '@tiptap/vue-3'
@@ -32,18 +32,17 @@ const props = defineProps({
32
32
  defaultFontFamily: { type: String, default () { return 'Inter' } },
33
33
  fontMeasure: { type: String, default () { return 'px' } },
34
34
  rounded: { type: String, default () { return '0' } },
35
- customExtensions: { type: Object as PropType<extensionsComponents>, default() { return {} } },
35
+ customExtensions: { type: Object as PropType<extensionComponents>, default() { return {} } },
36
36
  })
37
37
 
38
- // console.log('override extension components', computed(() => props.overrideExtensionsComponents).value)
39
-
40
38
  const appTheme = useTheme()
41
39
  const currentTheme = ref(appTheme.global.name)
42
40
 
43
41
  const editor: ShallowRef<Editor | undefined> = getTiptapEditor(
44
42
  props.content,
45
43
  computed(() => props.placeholder || t('content.placeholder')).value,
46
- props.slashCommands
44
+ props.slashCommands,
45
+ props.customExtensions
47
46
  )
48
47
 
49
48
  const emit = defineEmits(['update:modelValue', 'editor-ready']);
@@ -3,7 +3,7 @@ import GroupBtn from "@tiptapify/components/Toolbar/GroupBtn.vue";
3
3
  import GroupDropdown from "@tiptapify/components/Toolbar/GroupDropdown.vue";
4
4
  import { defineProps, PropType } from 'vue'
5
5
 
6
- import { ToolbarItemSection } from "@tiptapify/components/Toolbar/items";
6
+ import { ToolbarItemSection } from "@tiptapify/types/toolbarItems";
7
7
 
8
8
  defineProps({
9
9
  variant: { type: String, default () { return 'flat' }},
@@ -20,7 +20,7 @@ defineProps({
20
20
  <GroupDropdown :toolbar-item="toolbarItem" :variant="variant" />
21
21
  </template>
22
22
 
23
- <VMenu v-else-if="toolbarItem?.component" v-model="toolbarItem.modelValue" :close-on-content-click="false">
23
+ <VMenu v-else-if="toolbarItem?.component" v-model="toolbarItem.modelValue" :close-on-content-click="false" v-bind="toolbarItem.props">
24
24
  <template #activator="{ props: menuProps }">
25
25
  <GroupBtn v-bind="menuProps" :toolbar-item="toolbarItem" :variant="variant" />
26
26
  </template>
@@ -1,27 +1,30 @@
1
1
  <script setup lang="ts">
2
+ import BtnIcon from "@tiptapify/components/UI/BtnIcon.vue";
2
3
  import { defineProps, PropType } from 'vue'
3
- import { useI18n } from "vue-i18n";
4
4
 
5
- import { ToolbarItem } from "@tiptapify/components/Toolbar/items";
5
+
6
+ import { ToolbarItem } from '@tiptapify/types/toolbarItems'
6
7
 
7
8
  defineProps({
8
9
  variant: { type: String, default () { return 'flat' }},
9
10
  toolbarItem: { type: Object as PropType<ToolbarItem>, default() { return {} }}
10
11
  })
11
12
 
12
- const { t } = useI18n();
13
13
  </script>
14
14
 
15
15
  <template>
16
16
  <VBtn v-bind="toolbarItem?.props ?? {}" v-on="toolbarItem?.attrs ?? {}" size="32">
17
17
  <VTooltip :text="toolbarItem.tooltip" location="top" activator="parent" />
18
18
 
19
- <VIcon v-if="toolbarItem.icon" :icon="toolbarItem.icon" size="small" />
20
- <span v-else class="menu-item-title">
21
- {{ toolbarItem.name }}
22
- </span>
19
+ <BtnIcon :icon="toolbarItem.icon" />
23
20
 
24
- <VIcon v-if="toolbarItem.icon2" v-bind="toolbarItem?.icon2Props ?? {}" :icon="toolbarItem.icon2" size="small" style="position: absolute;" />
21
+ <VIcon
22
+ v-if="toolbarItem.icon2"
23
+ v-bind="toolbarItem?.icon2Props ?? {}"
24
+ :icon="toolbarItem.icon2"
25
+ size="small"
26
+ style="position: absolute;"
27
+ />
25
28
  </VBtn>
26
29
  </template>
27
30
 
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { defineProps, PropType } from 'vue'
3
- import { useI18n } from "vue-i18n";
3
+ import * as mdi from '@mdi/js'
4
4
 
5
5
  import { ToolbarItem } from "@tiptapify/components/Toolbar/items";
6
6
 
@@ -10,8 +10,6 @@ defineProps({
10
10
  toolbarItem: { type: Object as PropType<ToolbarItem>, default() { return {} }}
11
11
  })
12
12
 
13
- const { t } = useI18n();
14
-
15
13
  </script>
16
14
 
17
15
  <template>
@@ -20,10 +18,7 @@ const { t } = useI18n();
20
18
  <VBtn v-bind="{ ...menuProps, ...toolbarItem.props }" size="32">
21
19
  <VTooltip :text="toolbarItem.tooltip" location="top" activator="parent" />
22
20
 
23
- <VIcon v-if="toolbarItem.icon" :icon="toolbarItem.icon" size="small" />
24
- <span v-else class="menu-item-title">
25
- {{ toolbarItem.name }}
26
- </span>
21
+ <VIcon :icon="toolbarItem.icon || `mdiSvg:${mdi.mdiImageBrokenVariant}`" size="small" />
27
22
  </VBtn>
28
23
  </template>
29
24
 
@@ -45,16 +40,7 @@ const { t } = useI18n();
45
40
  >
46
41
  <VTooltip v-if="item.tooltip" :text="item.tooltip" location="top" activator="parent" />
47
42
 
48
- <VIcon v-if="item.icon" :icon="item.icon" size="small" />
49
-
50
- <span v-else class="menu-item-title">
51
- <template v-if="item.noI18n">
52
- {{ item.name }}
53
- </template>
54
- <template v-else>
55
- {{ item.toggle }}
56
- </template>
57
- </span>
43
+ <VIcon :icon="item.icon || `mdiSvg:${mdi.mdiImageBrokenVariant}`" size="small" />
58
44
 
59
45
  <VMenu
60
46
  v-if="item.component"
@@ -2,8 +2,8 @@
2
2
  import { Editor } from "@tiptap/vue-3";
3
3
  import { getDefaultComponents } from "@tiptapify/components/Toolbar/defaultExtensionComponents";
4
4
  import Items from "@tiptapify/components/Toolbar/Items.vue";
5
- import { computed, defineProps, inject, PropType, ref, Ref, ShallowRef, shallowRef, triggerRef } from 'vue'
6
- import { extensionsComponents } from '@tiptapify/types/overridable-extensions'
5
+ import { computed, defineProps, inject, PropType, Ref, ShallowRef, shallowRef } from 'vue'
6
+ import { extensionComponents, ToolbarItemType } from '@tiptapify/types/extensionComponents'
7
7
 
8
8
  import { toolbarItems } from "@tiptapify/components/Toolbar/items";
9
9
  import { useTheme } from "vuetify/framework";
@@ -20,7 +20,7 @@ const props = defineProps({
20
20
  theme: { type: String, default() { return 'light' } },
21
21
  rounded: { type: String, default() { return '0' } },
22
22
  toolbarScrollable: { type: Boolean, default() { return false } },
23
- customExtensions: { type: Object as PropType<extensionsComponents>, default() { return {} } },
23
+ customExtensions: { type: Object as PropType<extensionComponents>, default() { return {} } },
24
24
  })
25
25
 
26
26
  const editor = inject('tiptapifyEditor') as Ref<Editor>
@@ -28,18 +28,21 @@ const editor = inject('tiptapifyEditor') as Ref<Editor>
28
28
  const appTheme = useTheme()
29
29
 
30
30
  const items = toolbarItems(
31
- editor,
32
31
  appTheme,
33
32
  computed(() => props.fontMeasure).value,
34
33
  { list: computed(() => props.items).value, exclude: computed(() => props.itemsExclude).value },
35
- computed(() => props.headingLevels).value
34
+ computed(() => props.headingLevels).value,
35
+ props.customExtensions
36
36
  )
37
37
 
38
- const defaultComponents: extensionsComponents = getDefaultComponents(props.variantField)
38
+ const defaultComponents: extensionComponents = getDefaultComponents(props.variantField)
39
39
 
40
- const extensions: ShallowRef<extensionsComponents> = shallowRef({})
40
+ const extensions: ShallowRef<extensionComponents> = shallowRef({})
41
41
  Object.keys(defaultComponents).forEach(extension => {
42
- extensions.value[extension] = props.customExtensions[extension] ?? defaultComponents[extension]
42
+ extensions.value[extension] = defaultComponents[extension]
43
+ })
44
+ Object.keys(props.customExtensions).forEach(extension => {
45
+ extensions.value[extension] = props.customExtensions[extension]
43
46
  })
44
47
 
45
48
  </script>
@@ -54,9 +57,9 @@ Object.keys(defaultComponents).forEach(extension => {
54
57
  <Items v-else :items="items" />
55
58
  </VToolbar>
56
59
 
57
- <!-- mount components mentioned in "items" -->
60
+ <!-- mount built-in and/or custom components -->
58
61
  <template v-for="extension in extensions">
59
- <component :is="extension.component" v-bind="extension?.props ?? {}" />
62
+ <component v-if="extension.type !== ToolbarItemType.dropdown" :is="extension.component" v-bind="{ ...extension?.props ?? {}, ...extension?.componentProps ?? {} }" />
60
63
  </template>
61
64
  </div>
62
65
  </template>
@@ -2,17 +2,14 @@
2
2
  import Group from "@tiptapify/components/Toolbar/Group.vue";
3
3
  import Toggle from "@tiptapify/components/Toolbar/Toggle.vue";
4
4
  import { computed, defineProps, PropType, Ref, ref } from 'vue'
5
- import { useI18n } from "vue-i18n";
6
5
 
7
- import { ToolbarItemSections } from "@tiptapify/components/Toolbar/items";
6
+ import { ToolbarItemSections } from "@tiptapify/types/toolbarItems";
8
7
 
9
8
  const props = defineProps({
10
9
  variantBtn: { type: String, default () { return 'elevated' }},
11
10
  items: { type: Object as PropType<ToolbarItemSections>, default() { return {} }},
12
11
  })
13
12
 
14
- const { t } = useI18n();
15
-
16
13
  const toolbarItemsRef: Ref<ToolbarItemSections> = ref(computed(() => props.items).value)
17
14
 
18
15
  </script>
@@ -29,8 +26,8 @@ const toolbarItemsRef: Ref<ToolbarItemSections> = ref(computed(() => props.items
29
26
  v-for="(toolbarItem, itemKey) in toolbarSection.items"
30
27
  :key="itemKey"
31
28
  :variant="variantBtn"
32
- v-bind="toolbarItem.props"
33
- v-on="toolbarItem.attrs"
29
+ v-bind="toolbarItem?.props ?? {}"
30
+ v-on="toolbarItem?.attrs ?? {}"
34
31
  class="menu-button"
35
32
  size="32"
36
33
  elevation="4"
@@ -1,6 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { defineProps, PropType } from 'vue'
3
3
  import { useI18n } from "vue-i18n";
4
+ import * as mdi from '@mdi/js'
4
5
 
5
6
  import { ToolbarItemSection } from "@tiptapify/components/Toolbar/items";
6
7
 
@@ -19,10 +20,7 @@ const { t } = useI18n();
19
20
  <VBtn v-bind="item.props" v-on="item.attrs" size="32">
20
21
  <VTooltip :text="item.name" location="top" activator="parent" />
21
22
 
22
- <VIcon v-if="item.icon" :icon="item.icon" size="small" />
23
- <span v-else class="menu-item-title">
24
- {{ item.name }}
25
- </span>
23
+ <VIcon :icon="item.icon || `mdiSvg:${mdi.mdiImageBrokenVariant}`" size="small" />
26
24
  </VBtn>
27
25
  </template>
28
26
  </VBtnToggle>
@@ -1,32 +1,53 @@
1
+ import { useImage } from "@tiptapify/composables/Toolbar/Media/useImage";
2
+ import { useLink } from "@tiptapify/composables/Toolbar/Media/useLink";
3
+ import { usePreview } from "@tiptapify/composables/Toolbar/Misc/usePreview";
4
+ import { useSource } from "@tiptapify/composables/Toolbar/Misc/useSource";
1
5
  import ImageDialog from "@tiptapify/extensions/components/ImageDialog.vue";
2
6
  import LinkDialog from "@tiptapify/extensions/components/LinkDialog.vue";
3
7
  import PreviewDialog from "@tiptapify/extensions/components/PreviewDialog.vue";
4
8
  import ShowSourceDialog from "@tiptapify/extensions/components/ShowSourceDialog.vue";
5
- import { extensionsComponents } from "@tiptapify/types/overridable-extensions";
6
- import { computed } from "vue";
9
+ import { extensionComponents } from "@tiptapify/types/extensionComponents";
10
+ import { ToolbarSections } from "@tiptapify/types/toolbarSections";
11
+ import { computed, markRaw } from "vue";
7
12
 
8
- export function getDefaultComponents(variantField: string): extensionsComponents {
13
+ export function getDefaultComponents(variantField: string): extensionComponents {
9
14
  return {
10
15
  image: {
11
- component: ImageDialog,
12
- props: {
16
+ component: markRaw(ImageDialog),
17
+ componentProps: {
13
18
  variantField: computed(() => variantField).value,
14
- }
19
+ },
20
+ section: ToolbarSections.media,
21
+ name: useImage().name,
22
+ tooltip: useImage().tooltip,
23
+ icon: useImage().icon,
15
24
  },
16
25
  link: {
17
- component: LinkDialog,
18
- props: {
26
+ component: markRaw(LinkDialog),
27
+ componentProps: {
19
28
  variantField: computed(() => variantField).value,
20
- }
29
+ },
30
+ section: ToolbarSections.media,
31
+ name: useLink().name,
32
+ tooltip: useLink().tooltip,
33
+ icon: useLink().icon,
21
34
  },
22
35
  preview: {
23
- component: PreviewDialog,
36
+ component: markRaw(PreviewDialog),
37
+ section: ToolbarSections.misc,
38
+ name: usePreview().name,
39
+ tooltip: usePreview().tooltip,
40
+ icon: usePreview().icon,
24
41
  },
25
42
  showSource: {
26
- component: ShowSourceDialog,
27
- props: {
43
+ component: markRaw(ShowSourceDialog),
44
+ componentProps: {
28
45
  variantField: computed(() => variantField).value,
29
- }
46
+ },
47
+ section: ToolbarSections.misc,
48
+ name: useSource().name,
49
+ tooltip: useSource().tooltip,
50
+ icon: useSource().icon,
30
51
  }
31
52
  }
32
53
  }