tiptapify 0.0.18 → 0.0.20

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tiptapify",
3
3
  "types": "./index.d.ts",
4
- "version": "0.0.18",
4
+ "version": "0.0.20",
5
5
  "description": "Tiptap3 editor with Vuetify3 menu implementation",
6
6
  "exports": {
7
7
  ".": {
@@ -1,10 +1,10 @@
1
1
  <script setup lang="ts">
2
2
  import { Editor } from "@tiptap/vue-3";
3
3
  import Items from "@tiptapify/components/Toolbar/Items.vue";
4
- import { defineProps, inject, PropType, ref, Ref } from 'vue'
4
+ import { defineProps, inject, PropType, Ref } from 'vue'
5
5
  import { toolbarSections } from '@tiptapify/types/toolbarSections'
6
6
 
7
- import { default as items } from "@tiptapify/components/Toolbar/items";
7
+ import items from "@tiptapify/components/Toolbar/items";
8
8
 
9
9
  const props = defineProps({
10
10
  variantBtn: { type: String, default () { return 'elevated' }},
@@ -18,15 +18,16 @@ const props = defineProps({
18
18
  theme: { type: String, default() { return 'light' } },
19
19
  rounded: { type: String, default() { return '0' } },
20
20
  toolbarScrollable: { type: Boolean, default() { return false } },
21
- customExtensions: { type: Array as PropType<toolbarSections>, default() { return {} } },
21
+ customExtensions: { type: Array as PropType<toolbarSections>, default() { return [] } },
22
22
  })
23
23
 
24
24
  const editor = inject('tiptapifyEditor') as Ref<Editor>
25
25
 
26
- const toolbarItems = ref<Ref<toolbarSections>>(items)
26
+ // this prevents from overriding the default items
27
+ const toolbarItems = [...items]
27
28
 
28
- Object.keys(props.customExtensions).forEach(extension => {
29
- toolbarItems.value.push(props.customExtensions[extension])
29
+ Object.keys(props.customExtensions).forEach((key: any) => {
30
+ toolbarItems.push(props.customExtensions[key])
30
31
  })
31
32
 
32
33
  </script>
@@ -113,10 +113,13 @@ export function editorExtensions (placeholder: string, slashCommands: boolean, c
113
113
  extensions.push(SlashCommands.configure({ suggestion }))
114
114
  }
115
115
 
116
- if (Object.keys(customExtensions).length) {
117
- for (const customExtension of Object.values(customExtensions)) {
118
- if (typeof customExtension.extensions !== 'undefined') {
119
- for (const extension of customExtension.extensions) {
116
+ if (customExtensions.length) {
117
+ for (const customExtension of customExtensions) {
118
+ for (const component of customExtension.components) {
119
+ if (typeof component.extensions === 'undefined') {
120
+ continue
121
+ }
122
+ for (const extension of component.extensions) {
120
123
  extensions.push(extension)
121
124
  }
122
125
  }