tiptapify 0.0.16 → 0.0.18

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 (127) hide show
  1. package/README.md +2 -2
  2. package/dist/tiptapify.css +1 -1
  3. package/dist/tiptapify.mjs +25493 -25148
  4. package/dist/tiptapify.umd.js +38 -38
  5. package/index.d.ts +2 -2
  6. package/package.json +1 -1
  7. package/src/components/Tiptapify.vue +3 -3
  8. package/src/components/Toolbar/Index.vue +9 -30
  9. package/src/components/Toolbar/Items.vue +14 -29
  10. package/src/components/Toolbar/actions.ts +18 -0
  11. package/src/components/Toolbar/alignment.ts +28 -0
  12. package/src/components/Toolbar/format.ts +28 -0
  13. package/src/components/Toolbar/formatExtra.ts +33 -0
  14. package/src/components/Toolbar/items.ts +19 -114
  15. package/src/components/Toolbar/list.ts +33 -0
  16. package/src/components/Toolbar/media.ts +33 -0
  17. package/src/components/Toolbar/misc.ts +38 -0
  18. package/src/components/Toolbar/style.ts +38 -0
  19. package/src/components/editorExtensions.ts +8 -6
  20. package/src/components/index.ts +2 -2
  21. package/src/extensions/components/actions/redo/Button.vue +29 -0
  22. package/src/extensions/components/actions/undo/Button.vue +29 -0
  23. package/src/extensions/components/alignment/center/Button.vue +29 -0
  24. package/src/extensions/components/alignment/justify/Button.vue +29 -0
  25. package/src/extensions/components/alignment/left/Button.vue +29 -0
  26. package/src/extensions/components/alignment/right/Button.vue +29 -0
  27. package/src/extensions/components/format/bold/Button.vue +30 -0
  28. package/src/extensions/components/format/italic/Button.vue +30 -0
  29. package/src/extensions/components/format/strike/Button.vue +30 -0
  30. package/src/extensions/components/format/underline/Button.vue +30 -0
  31. package/src/extensions/components/formatExtra/code/Button.vue +30 -0
  32. package/src/extensions/components/formatExtra/codeBlock/Button.vue +30 -0
  33. package/src/extensions/components/formatExtra/quote/Button.vue +30 -0
  34. package/src/extensions/components/formatExtra/sub/Button.vue +30 -0
  35. package/src/extensions/components/formatExtra/sup/Button.vue +30 -0
  36. package/src/extensions/components/list/bullet/Button.vue +30 -0
  37. package/src/extensions/components/list/indent/Button.vue +30 -0
  38. package/src/extensions/components/list/numbered/Button.vue +30 -0
  39. package/src/extensions/components/list/outdent/Button.vue +30 -0
  40. package/src/extensions/components/list/task/Button.vue +30 -0
  41. package/src/extensions/components/{Emoji.vue → media/emoji/Button.vue} +65 -62
  42. package/src/extensions/components/media/image/Button.vue +32 -0
  43. package/src/extensions/components/media/link/Button.vue +34 -0
  44. package/src/extensions/components/media/table/Button.vue +119 -0
  45. package/src/extensions/components/media/table/ColumnActions.vue +52 -0
  46. package/src/extensions/components/media/table/RowActions.vue +52 -0
  47. package/src/extensions/components/media/video/Button.vue +32 -0
  48. package/src/extensions/components/media/video/index.ts +32 -0
  49. package/src/extensions/components/misc/break/Button.vue +25 -0
  50. package/src/extensions/components/misc/formatClear/Button.vue +29 -0
  51. package/src/extensions/components/misc/invisibleChar/Button.vue +30 -0
  52. package/src/extensions/components/misc/line/Button.vue +25 -0
  53. package/src/extensions/components/misc/preview/Button.vue +36 -0
  54. package/src/extensions/components/misc/source/Button.vue +31 -0
  55. package/src/extensions/components/{ShowSourceDialog.vue → misc/source/ShowSourceDialog.vue} +5 -14
  56. package/src/extensions/components/{StyleColor.vue → style/StyleColor.vue} +5 -8
  57. package/src/extensions/components/style/color/Button.vue +57 -0
  58. package/src/extensions/components/style/fontFamily/Button.vue +60 -0
  59. package/src/extensions/components/style/fontFamily/FontFamily.vue +76 -0
  60. package/src/extensions/components/style/fontSize/Button.vue +64 -0
  61. package/src/extensions/components/{FontSize.vue → style/fontSize/FontSize.vue} +0 -5
  62. package/src/extensions/components/style/heading/Button.vue +61 -0
  63. package/src/extensions/components/style/highlight/Button.vue +57 -0
  64. package/src/extensions/components/style/lineHeight/Button.vue +60 -0
  65. package/src/extensions/components/{LineHeight.vue → style/lineHeight/LineHeight.vue} +0 -4
  66. package/src/types/toolbarSections.ts +16 -2
  67. package/src/components/Toolbar/Group.vue +0 -42
  68. package/src/components/Toolbar/GroupBtn.vue +0 -32
  69. package/src/components/Toolbar/GroupDropdown.vue +0 -67
  70. package/src/components/Toolbar/defaultExtensionComponents.ts +0 -65
  71. package/src/composables/Toolbar/Actions/useRedo.ts +0 -22
  72. package/src/composables/Toolbar/Actions/useUndo.ts +0 -22
  73. package/src/composables/Toolbar/Alignment/useAlignmentCenter.ts +0 -23
  74. package/src/composables/Toolbar/Alignment/useAlignmentJustify.ts +0 -23
  75. package/src/composables/Toolbar/Alignment/useAlignmentLeft.ts +0 -23
  76. package/src/composables/Toolbar/Alignment/useAlignmentRight.ts +0 -23
  77. package/src/composables/Toolbar/Format/useBold.ts +0 -23
  78. package/src/composables/Toolbar/Format/useItalic.ts +0 -23
  79. package/src/composables/Toolbar/Format/useStrike.ts +0 -23
  80. package/src/composables/Toolbar/Format/useUnderline.ts +0 -23
  81. package/src/composables/Toolbar/FormatExtra/useBlockquote.ts +0 -23
  82. package/src/composables/Toolbar/FormatExtra/useCode.ts +0 -23
  83. package/src/composables/Toolbar/FormatExtra/useCodeBlock.ts +0 -23
  84. package/src/composables/Toolbar/FormatExtra/useSub.ts +0 -23
  85. package/src/composables/Toolbar/FormatExtra/useSup.ts +0 -23
  86. package/src/composables/Toolbar/List/useBullet.ts +0 -22
  87. package/src/composables/Toolbar/List/useIndent.ts +0 -23
  88. package/src/composables/Toolbar/List/useNumbered.ts +0 -22
  89. package/src/composables/Toolbar/List/useOutdent.ts +0 -23
  90. package/src/composables/Toolbar/List/useTask.ts +0 -22
  91. package/src/composables/Toolbar/Media/useEmoji.ts +0 -19
  92. package/src/composables/Toolbar/Media/useImage.ts +0 -23
  93. package/src/composables/Toolbar/Media/useLink.ts +0 -23
  94. package/src/composables/Toolbar/Media/useTable.ts +0 -187
  95. package/src/composables/Toolbar/Media/useVideo.ts +0 -22
  96. package/src/composables/Toolbar/Misc/useBreak.ts +0 -20
  97. package/src/composables/Toolbar/Misc/useFormatClear.ts +0 -22
  98. package/src/composables/Toolbar/Misc/useInvisibleCharacters.ts +0 -22
  99. package/src/composables/Toolbar/Misc/useLine.ts +0 -20
  100. package/src/composables/Toolbar/Misc/usePreview.ts +0 -19
  101. package/src/composables/Toolbar/Misc/useSource.ts +0 -20
  102. package/src/composables/Toolbar/Style/useColor.ts +0 -35
  103. package/src/composables/Toolbar/Style/useFontFamily.ts +0 -48
  104. package/src/composables/Toolbar/Style/useFontSize.ts +0 -49
  105. package/src/composables/Toolbar/Style/useHeading.ts +0 -63
  106. package/src/composables/Toolbar/Style/useHighlight.ts +0 -35
  107. package/src/composables/Toolbar/Style/useLineHeight.ts +0 -48
  108. package/src/composables/Toolbar/useActionsItems.ts +0 -9
  109. package/src/composables/Toolbar/useAlignmentItems.ts +0 -13
  110. package/src/composables/Toolbar/useFormatExtraItems.ts +0 -15
  111. package/src/composables/Toolbar/useFormatItems.ts +0 -13
  112. package/src/composables/Toolbar/useListItems.ts +0 -15
  113. package/src/composables/Toolbar/useMediaItems.ts +0 -15
  114. package/src/composables/Toolbar/useMiscItems.ts +0 -17
  115. package/src/composables/Toolbar/useStyleItems.ts +0 -17
  116. package/src/extensions/components/PreviewDialog.vue +0 -43
  117. package/src/types/extensionComponents.ts +0 -22
  118. package/src/types/toolbarItems.ts +0 -41
  119. /package/src/extensions/components/{ImageDialog.vue → media/image/ImageDialog.vue} +0 -0
  120. /package/src/extensions/{image.ts → components/media/image/index.ts} +0 -0
  121. /package/src/extensions/components/{LinkDialog.vue → media/link/LinkDialog.vue} +0 -0
  122. /package/src/extensions/{link.ts → components/media/link/index.ts} +0 -0
  123. /package/src/extensions/components/{TableBuilder.vue → media/table/TableBuilder.vue} +0 -0
  124. /package/src/extensions/components/{VideoDialog.vue → media/video/VideoDialog.vue} +0 -0
  125. /package/src/extensions/{preview.ts → components/misc/preview/index.ts} +0 -0
  126. /package/src/extensions/{view-source.ts → components/misc/source/index.ts} +0 -0
  127. /package/src/extensions/components/{FontFamily.vue → style/lineHeight/FontFamily.vue} +0 -0
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 { extensionComponents } from "./src/types/extensionComponents";
3
+ import { toolbarSections } from "./src/types/toolbarSections";
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
- customExtensions: extensionComponents
21
+ customExtensions: toolbarSections
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.16",
4
+ "version": "0.0.18",
5
5
  "description": "Tiptap3 editor with Vuetify3 menu implementation",
6
6
  "exports": {
7
7
  ".": {
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
 
3
- import { extensionComponents } from "@tiptapify/types/extensionComponents";
3
+ import { toolbarSections } from "@tiptapify/types/toolbarSections";
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'
@@ -34,7 +34,7 @@ const props = defineProps({
34
34
  defaultFontFamily: { type: String, default () { return 'Inter' } },
35
35
  fontMeasure: { type: String, default () { return 'px' } },
36
36
  rounded: { type: String, default () { return '0' } },
37
- customExtensions: { type: Object as PropType<extensionComponents>, default() { return {} } },
37
+ customExtensions: { type: Array as PropType<toolbarSections>, default() { return [] } },
38
38
  })
39
39
 
40
40
  const appTheme = useTheme()
@@ -88,7 +88,7 @@ onBeforeUnmount(() => {
88
88
  />
89
89
  </template>
90
90
 
91
- <div :class="`border border-t-0 rounded-b-${rounded}`">
91
+ <div :class="`tiptapify-editor border border-t-0 rounded-b-${rounded}`">
92
92
  <div class="pa-2 tiptapify-container resizable" :style="`${height > 0 ? `height: ${height}px` : ''}`">
93
93
  <MenuFloating v-if="floatingMenu" :variant="variantBtn" :theme="currentTheme" />
94
94
 
@@ -1,12 +1,10 @@
1
1
  <script setup lang="ts">
2
2
  import { Editor } from "@tiptap/vue-3";
3
- import { getDefaultComponents } from "@tiptapify/components/Toolbar/defaultExtensionComponents";
4
3
  import Items from "@tiptapify/components/Toolbar/Items.vue";
5
- import { computed, defineProps, inject, PropType, Ref, ShallowRef, shallowRef } from 'vue'
6
- import { extensionComponents, ToolbarItemType } from '@tiptapify/types/extensionComponents'
4
+ import { defineProps, inject, PropType, ref, Ref } from 'vue'
5
+ import { toolbarSections } from '@tiptapify/types/toolbarSections'
7
6
 
8
- import { toolbarItems } from "@tiptapify/components/Toolbar/items";
9
- import { useTheme } from "vuetify/framework";
7
+ import { default as items } from "@tiptapify/components/Toolbar/items";
10
8
 
11
9
  const props = defineProps({
12
10
  variantBtn: { type: String, default () { return 'elevated' }},
@@ -20,47 +18,28 @@ const props = defineProps({
20
18
  theme: { type: String, default() { return 'light' } },
21
19
  rounded: { type: String, default() { return '0' } },
22
20
  toolbarScrollable: { type: Boolean, default() { return false } },
23
- customExtensions: { type: Object as PropType<extensionComponents>, default() { return {} } },
21
+ customExtensions: { type: Array as PropType<toolbarSections>, default() { return {} } },
24
22
  })
25
23
 
26
24
  const editor = inject('tiptapifyEditor') as Ref<Editor>
27
25
 
28
- const appTheme = useTheme()
26
+ const toolbarItems = ref<Ref<toolbarSections>>(items)
29
27
 
30
- const items = toolbarItems(
31
- appTheme,
32
- computed(() => props.fontMeasure).value,
33
- { list: computed(() => props.items).value, exclude: computed(() => props.itemsExclude).value },
34
- computed(() => props.headingLevels).value,
35
- props.customExtensions
36
- )
37
-
38
- const defaultComponents: extensionComponents = getDefaultComponents(props.variantField)
39
-
40
- const extensions: ShallowRef<extensionComponents> = shallowRef({})
41
- Object.keys(defaultComponents).forEach(extension => {
42
- extensions.value[extension] = defaultComponents[extension]
43
- })
44
28
  Object.keys(props.customExtensions).forEach(extension => {
45
- extensions.value[extension] = props.customExtensions[extension]
29
+ toolbarItems.value.push(props.customExtensions[extension])
46
30
  })
47
31
 
48
32
  </script>
49
33
 
50
34
  <template>
51
- <div v-if="editor">
35
+ <div v-if="editor" class="tiptapify-toolbar">
52
36
  <VToolbar elevation="1" :theme="theme" height="auto" :class="`ps-1 pr-1 rounded-t-${rounded}`">
53
37
  <VSlideGroup v-if="toolbarScrollable">
54
- <Items :items="items" />
38
+ <Items :items="toolbarItems" />
55
39
  </VSlideGroup>
56
40
 
57
- <Items v-else :items="items" />
41
+ <Items v-else :items="toolbarItems" />
58
42
  </VToolbar>
59
-
60
- <!-- mount built-in and/or custom components -->
61
- <template v-for="extension in extensions">
62
- <component v-if="extension.type !== ToolbarItemType.dropdown" :is="extension.component" v-bind="{ ...extension?.props ?? {}, ...extension?.componentProps ?? {} }" />
63
- </template>
64
43
  </div>
65
44
  </template>
66
45
 
@@ -1,42 +1,27 @@
1
1
  <script setup lang="ts">
2
- import Group from "@tiptapify/components/Toolbar/Group.vue";
3
- import { computed, defineProps, PropType, Ref, ref } from 'vue'
4
2
 
5
- import { ToolbarItemSections } from "@tiptapify/types/toolbarItems";
3
+ import { defineProps, PropType } from 'vue'
6
4
 
7
- const props = defineProps({
5
+ import { toolbarSections } from "@tiptapify/types/toolbarSections";
6
+
7
+ defineProps({
8
8
  variantBtn: { type: String, default () { return 'elevated' }},
9
- items: { type: Object as PropType<ToolbarItemSections>, default() { return {} }},
9
+ items: { type: Array as PropType<toolbarSections>, default() { return {} }},
10
10
  })
11
11
 
12
- const toolbarItemsRef: Ref<ToolbarItemSections> = ref(computed(() => props.items).value)
13
-
14
12
  </script>
15
13
 
16
14
  <template>
17
15
  <VToolbarItems class="py-2">
18
- <template v-for="(toolbarSection, sectionKey) in toolbarItemsRef" :key="sectionKey">
19
- <Group v-if="toolbarSection.group" :variant="variantBtn" :toolbar-section="toolbarSection" />
20
-
21
- <VBtn
22
- v-else
23
- v-for="(toolbarItem, itemKey) in toolbarSection.items"
24
- :key="itemKey"
25
- :variant="variantBtn"
26
- v-bind="toolbarItem?.props ?? {}"
27
- v-on="toolbarItem?.attrs ?? {}"
28
- class="menu-button"
29
- size="32"
30
- elevation="4"
31
- rounded="sm"
32
- >
33
- <VTooltip :text="toolbarItem.tooltip" location="top" activator="parent" />
34
-
35
- <VIcon v-if="toolbarItem.icon" :icon="toolbarItem.icon" size="16" />
36
- <span v-else class="menu-item-title">
37
- {{ toolbarItem.name }}
38
- </span>
39
- </VBtn>
16
+ <template v-for="(item, key) in items" :key="item.section">
17
+ <VBtnGroup v-if="item.group" elevation="4">
18
+ <template v-for="sectionItem in item.components" :key="sectionItem.name">
19
+ <component :is="sectionItem.component" />
20
+ </template>
21
+ </VBtnGroup>
22
+ <template v-else>
23
+ <component v-for="sectionItem in item.components" :key="sectionItem.name" :is="sectionItem.component" />
24
+ </template>
40
25
 
41
26
  <div class="menu-divider"></div>
42
27
  </template>
@@ -0,0 +1,18 @@
1
+ import { default as UndoButton } from "@tiptapify/extensions/components/actions/undo/Button.vue";
2
+ import { default as RedoButton } from "@tiptapify/extensions/components/actions/redo/Button.vue";
3
+ import { markRaw } from "vue";
4
+
5
+ export default {
6
+ section: 'actions',
7
+ group: true,
8
+ components: [
9
+ {
10
+ name: 'undo',
11
+ component: markRaw(UndoButton),
12
+ },
13
+ {
14
+ name: 'redo',
15
+ component: markRaw(RedoButton),
16
+ }
17
+ ]
18
+ }
@@ -0,0 +1,28 @@
1
+ import { default as AlignmentLeftButton } from "@tiptapify/extensions/components/alignment/left/Button.vue";
2
+ import { default as AlignmentCenterButton } from "@tiptapify/extensions/components/alignment/center/Button.vue";
3
+ import { default as AlignmentRightButton } from "@tiptapify/extensions/components/alignment/right/Button.vue";
4
+ import { default as AlignmentJustifyButton } from "@tiptapify/extensions/components/alignment/justify/Button.vue";
5
+ import { markRaw } from "vue";
6
+
7
+ export default {
8
+ section: 'alignment',
9
+ group: true,
10
+ components: [
11
+ {
12
+ name: 'left',
13
+ component: markRaw(AlignmentLeftButton),
14
+ },
15
+ {
16
+ name: 'center',
17
+ component: markRaw(AlignmentCenterButton),
18
+ },
19
+ {
20
+ name: 'right',
21
+ component: markRaw(AlignmentRightButton),
22
+ },
23
+ {
24
+ name: 'justify',
25
+ component: markRaw(AlignmentJustifyButton),
26
+ },
27
+ ]
28
+ }
@@ -0,0 +1,28 @@
1
+ import { default as BoldButton } from "@tiptapify/extensions/components/format/bold/Button.vue";
2
+ import { default as ItalicButton } from "@tiptapify/extensions/components/format/italic/Button.vue";
3
+ import { default as UnderlineButton } from "@tiptapify/extensions/components/format/underline/Button.vue";
4
+ import { default as StrikeButton } from "@tiptapify/extensions/components/format/strike/Button.vue";
5
+ import { markRaw } from "vue";
6
+
7
+ export default {
8
+ section: 'format',
9
+ group: true,
10
+ components: [
11
+ {
12
+ name: 'bold',
13
+ component: markRaw(BoldButton),
14
+ },
15
+ {
16
+ name: 'italic',
17
+ component: markRaw(ItalicButton),
18
+ },
19
+ {
20
+ name: 'underline',
21
+ component: markRaw(UnderlineButton),
22
+ },
23
+ {
24
+ name: 'strike',
25
+ component: markRaw(StrikeButton),
26
+ },
27
+ ]
28
+ }
@@ -0,0 +1,33 @@
1
+ import { default as SupButton } from "@tiptapify/extensions/components/formatExtra/sup/Button.vue";
2
+ import { default as SubButton } from "@tiptapify/extensions/components/formatExtra/sub/Button.vue";
3
+ import { default as CodeButton } from "@tiptapify/extensions/components/formatExtra/code/Button.vue";
4
+ import { default as CodeBlockButton } from "@tiptapify/extensions/components/formatExtra/codeBlock/Button.vue";
5
+ import { default as BlockquoteButton } from "@tiptapify/extensions/components/formatExtra/quote/Button.vue";
6
+ import { markRaw } from "vue";
7
+
8
+ export default {
9
+ section: 'formatExtra',
10
+ group: true,
11
+ components: [
12
+ {
13
+ name: 'sup',
14
+ component: markRaw(SupButton),
15
+ },
16
+ {
17
+ name: 'sub',
18
+ component: markRaw(SubButton),
19
+ },
20
+ {
21
+ name: 'code',
22
+ component: markRaw(CodeButton),
23
+ },
24
+ {
25
+ name: 'codeBlock',
26
+ component: markRaw(CodeBlockButton),
27
+ },
28
+ {
29
+ name: 'blockquote',
30
+ component: markRaw(BlockquoteButton),
31
+ },
32
+ ]
33
+ }
@@ -1,114 +1,19 @@
1
- import { useActionsItems } from "@tiptapify/composables/Toolbar/useActionsItems";
2
- import { useAlignmentItems } from "@tiptapify/composables/Toolbar/useAlignmentItems";
3
- import { useFormatExtraItems } from "@tiptapify/composables/Toolbar/useFormatExtraItems";
4
- import { useFormatItems } from "@tiptapify/composables/Toolbar/useFormatItems";
5
- import { useListItems } from "@tiptapify/composables/Toolbar/useListItems";
6
- import { useMediaItems } from "@tiptapify/composables/Toolbar/useMediaItems";
7
- import { useMiscItems } from "@tiptapify/composables/Toolbar/useMiscItems";
8
- import { useStyleItems } from "@tiptapify/composables/Toolbar/useStyleItems";
9
- import { extensionComponents } from "@tiptapify/types/extensionComponents";
10
- import { ref } from "vue";
11
-
12
- import { ToolbarItem, ToolbarItemSections } from '@tiptapify/types/toolbarItems'
13
-
14
- export function toolbarItems(
15
- theme: any,
16
- fontMeasure: string,
17
- items: { list: Array<ToolbarItem>, exclude: boolean },
18
- customHeadingLevels: Array<number>,
19
- customExtensions: extensionComponents
20
- ): ToolbarItemSections {
21
- const styleItems = ref(useStyleItems(theme, fontMeasure, customHeadingLevels))
22
- const formatItems = ref(useFormatItems())
23
- const formatExtraItems = ref(useFormatExtraItems())
24
- const alignmentItems = ref(useAlignmentItems())
25
- const listItems = ref(useListItems())
26
- const actionsItems = ref(useActionsItems())
27
- const miscItems = ref(useMiscItems())
28
- const mediaItems = ref(useMediaItems())
29
-
30
- const allMenuItems: ToolbarItemSections = {
31
- style: { group: true, items: styleItems.value },
32
- format: { group: true, items: formatItems.value },
33
- format_extra: { group: true, items: formatExtraItems.value },
34
- media: { group: true, items: mediaItems.value },
35
- alignment: { group: true, items: alignmentItems.value },
36
- list: { group: true, items: listItems.value },
37
- actions: { group: true, items: actionsItems.value },
38
- misc: { group: true, items: miscItems.value },
39
- extra: { group: true, items: {} },
40
- }
41
-
42
- const pluginsList: Array<string> = []
43
- Object.keys(allMenuItems).forEach(section => {
44
- Object.keys(allMenuItems[section]).forEach(item => pluginsList.push(item))
45
- })
46
-
47
- // if (items.list.length) {
48
- // items.list.forEach(item => {
49
- // if (!pluginsList.includes(item)) {
50
- // throw new Error(`Unknown plugin name: ${item}! Supported plugins: ${pluginsList.join(', ')}`)
51
- // }
52
- // })
53
- // }
54
-
55
- const toolbarItems: ToolbarItemSections = {}
56
-
57
- const sections: { [key: string]: number } = {}
58
-
59
- Object.keys(allMenuItems).forEach(sectionName => {
60
- const section = allMenuItems[sectionName]
61
- Object.keys(section.items).forEach(plugin => {
62
- const item: ToolbarItem = section.items[plugin]
63
-
64
- if (items.list.length) {
65
- item.enabled = items.list.includes(plugin)
66
- if (items.exclude) {
67
- item.enabled = !item.enabled
68
- }
69
- }
70
-
71
- if (typeof toolbarItems[sectionName] === 'undefined') {
72
- sections[sectionName] = 0
73
- toolbarItems[sectionName] = {
74
- group: section.group ?? false,
75
- toggle: section.toggle ?? false,
76
- items: {},
77
- }
78
- }
79
-
80
- toolbarItems[sectionName].items[plugin] = item
81
-
82
- if (item.enabled) {
83
- sections[sectionName]++
84
- }
85
- })
86
- })
87
-
88
- Object.keys(sections).forEach(sectionName => {
89
- if (sections[sectionName] === 0) {
90
- delete toolbarItems[sectionName]
91
- }
92
- })
93
-
94
- // add/override custom extensions
95
- Object.keys(customExtensions).forEach(extension => {
96
- const section = customExtensions[extension].section
97
-
98
- if (typeof customExtensions[extension]?.props === 'undefined') {
99
- customExtensions[extension].props = toolbarItems[section]?.items[extension]?.props ?? {}
100
- }
101
-
102
- if (typeof customExtensions[extension]?.attrs === 'undefined') {
103
- customExtensions[extension].attrs = toolbarItems[section]?.items[extension]?.attrs ?? {}
104
- }
105
-
106
- if (typeof toolbarItems[section] === 'undefined') {
107
- toolbarItems[section] = { group: true, items: {} }
108
- toolbarItems[section].items[extension] = {}
109
- }
110
- toolbarItems[section].items[extension] = customExtensions[extension]
111
- })
112
-
113
- return toolbarItems
114
- }
1
+ import actions from "@tiptapify/components/Toolbar/actions";
2
+ import alignment from "@tiptapify/components/Toolbar/alignment";
3
+ import format from "@tiptapify/components/Toolbar/format";
4
+ import formatExtra from "@tiptapify/components/Toolbar/formatExtra";
5
+ import style from "@tiptapify/components/Toolbar/style";
6
+ import list from "@tiptapify/components/Toolbar/list";
7
+ import media from "@tiptapify/components/Toolbar/media";
8
+ import misc from "@tiptapify/components/Toolbar/misc";
9
+
10
+ export default [
11
+ style,
12
+ format,
13
+ formatExtra,
14
+ media,
15
+ alignment,
16
+ list,
17
+ actions,
18
+ misc,
19
+ ]
@@ -0,0 +1,33 @@
1
+ import { default as BulletListButton } from "@tiptapify/extensions/components/list/bullet/Button.vue";
2
+ import { default as NumberedListButton } from "@tiptapify/extensions/components/list/numbered/Button.vue";
3
+ import { default as TaskListButton } from "@tiptapify/extensions/components/list/task/Button.vue";
4
+ import { default as IndentListButton } from "@tiptapify/extensions/components/list/indent/Button.vue";
5
+ import { default as OutdentListButton } from "@tiptapify/extensions/components/list/outdent/Button.vue";
6
+ import { markRaw } from "vue";
7
+
8
+ export default {
9
+ section: 'list',
10
+ group: true,
11
+ components: [
12
+ {
13
+ name: 'bulletList',
14
+ component: markRaw(BulletListButton),
15
+ },
16
+ {
17
+ name: 'orderedList',
18
+ component: markRaw(NumberedListButton),
19
+ },
20
+ {
21
+ name: 'taskList',
22
+ component: markRaw(TaskListButton),
23
+ },
24
+ {
25
+ name: 'indent',
26
+ component: markRaw(IndentListButton),
27
+ },
28
+ {
29
+ name: 'outdent',
30
+ component: markRaw(OutdentListButton),
31
+ },
32
+ ]
33
+ }
@@ -0,0 +1,33 @@
1
+ import { default as EmojiButton } from "@tiptapify/extensions/components/media/emoji/Button.vue";
2
+ import { default as LinkButton } from "@tiptapify/extensions/components/media/link/Button.vue";
3
+ import { default as ImageButton } from "@tiptapify/extensions/components/media/image/Button.vue";
4
+ import { default as TableButton } from "@tiptapify/extensions/components/media/table/Button.vue";
5
+ import { default as VideoButton } from "@tiptapify/extensions/components/media/video/Button.vue";
6
+ import { markRaw } from "vue";
7
+
8
+ export default {
9
+ section: 'media',
10
+ group: true,
11
+ components: [
12
+ {
13
+ name: 'link',
14
+ component: markRaw(LinkButton),
15
+ },
16
+ {
17
+ name: 'image',
18
+ component: markRaw(ImageButton),
19
+ },
20
+ {
21
+ name: 'video',
22
+ component: markRaw(VideoButton),
23
+ },
24
+ {
25
+ name: 'emoji',
26
+ component: markRaw(EmojiButton),
27
+ },
28
+ {
29
+ name: 'table',
30
+ component: markRaw(TableButton),
31
+ }
32
+ ]
33
+ }
@@ -0,0 +1,38 @@
1
+ import { default as LineButton } from "@tiptapify/extensions/components/misc/line/Button.vue";
2
+ import { default as BreakButton } from "@tiptapify/extensions/components/misc/break/Button.vue";
3
+ import { default as PreviewButton } from "@tiptapify/extensions/components/misc/preview/Button.vue";
4
+ import { default as SourceButton } from "@tiptapify/extensions/components/misc/source/Button.vue";
5
+ import { default as InvisibleCharButton } from "@tiptapify/extensions/components/misc/invisibleChar/Button.vue";
6
+ import { default as FormatClearButton } from "@tiptapify/extensions/components/misc/formatClear/Button.vue";
7
+ import { markRaw } from "vue";
8
+
9
+ export default {
10
+ section: 'misc',
11
+ group: true,
12
+ components: [
13
+ {
14
+ name: 'line',
15
+ component: markRaw(LineButton),
16
+ },
17
+ {
18
+ name: 'pagebreak',
19
+ component: markRaw(BreakButton),
20
+ },
21
+ {
22
+ name: 'source',
23
+ component: markRaw(SourceButton),
24
+ },
25
+ {
26
+ name: 'preview',
27
+ component: markRaw(PreviewButton),
28
+ },
29
+ {
30
+ name: 'formatClear',
31
+ component: markRaw(FormatClearButton),
32
+ },
33
+ {
34
+ name: 'invisibleChar',
35
+ component: markRaw(InvisibleCharButton),
36
+ },
37
+ ]
38
+ }
@@ -0,0 +1,38 @@
1
+ import { default as HeadingButton } from "@tiptapify/extensions/components/style/heading/Button.vue";
2
+ import { default as FontFamilyButton } from "@tiptapify/extensions/components/style/fontFamily/Button.vue";
3
+ import { default as FontSizeButton } from "@tiptapify/extensions/components/style/fontSize/Button.vue";
4
+ import { default as LineHeightButton } from "@tiptapify/extensions/components/style/lineHeight/Button.vue";
5
+ import { default as ColorButton } from "@tiptapify/extensions/components/style/color/Button.vue";
6
+ import { default as HighlightButton } from "@tiptapify/extensions/components/style/highlight/Button.vue";
7
+ import { markRaw } from "vue";
8
+
9
+ export default {
10
+ section: 'actions',
11
+ group: true,
12
+ components: [
13
+ {
14
+ name: 'heading',
15
+ component: markRaw(HeadingButton),
16
+ },
17
+ {
18
+ name: 'fontFamily',
19
+ component: markRaw(FontFamilyButton),
20
+ },
21
+ {
22
+ name: 'fontSize',
23
+ component: markRaw(FontSizeButton),
24
+ },
25
+ {
26
+ name: 'lineHeight',
27
+ component: markRaw(LineHeightButton),
28
+ },
29
+ {
30
+ name: 'textColor',
31
+ component: markRaw(ColorButton),
32
+ },
33
+ {
34
+ name: 'highlightColor',
35
+ component: markRaw(HighlightButton),
36
+ },
37
+ ]
38
+ }
@@ -25,14 +25,15 @@ import { TableKit } from '@tiptap/extension-table'
25
25
  import { CodeBlockLowlight } from '@tiptap/extension-code-block-lowlight'
26
26
  import { InvisibleCharacters } from '@tiptap/extension-invisible-characters'
27
27
 
28
- import { TiptapifyLink } from '@tiptapify/extensions/link'
29
- import { TiptapifyImage } from '@tiptapify/extensions/image'
28
+ import { TiptapifyLink } from '@tiptapify/extensions/components/media/link'
29
+ import { TiptapifyImage } from '@tiptapify/extensions/components/media/image'
30
+ import { TiptapifyVideo } from '@tiptapify/extensions/components/media/video'
30
31
  import CodeBlockComponent from '@tiptapify/extensions/components/CodeBlockComponent.vue'
31
- import { ViewSource } from '@tiptapify/extensions/view-source'
32
- import { Preview } from '@tiptapify/extensions/preview'
32
+ import { ViewSource } from '@tiptapify/extensions/components/misc/source'
33
+ import { Preview } from '@tiptapify/extensions/components/misc/preview'
33
34
  import SlashCommands from '@tiptapify/extensions/slash-commands'
34
35
  import suggestion from '@tiptapify/extensions/components/slashCommands/suggestion'
35
- import { extensionComponents } from "@tiptapify/types/extensionComponents";
36
+ import { toolbarSections } from "@tiptapify/types/toolbarSections";
36
37
 
37
38
  // load all languages with "all" or common languages with "common"
38
39
  import { common, createLowlight } from 'lowlight'
@@ -50,7 +51,7 @@ const lowlight = createLowlight(common)
50
51
  // register language example
51
52
  // lowlight.register('ts', ts)
52
53
 
53
- export function editorExtensions (placeholder: string, slashCommands: boolean, customExtensions: extensionComponents) {
54
+ export function editorExtensions (placeholder: string, slashCommands: boolean, customExtensions: toolbarSections) {
54
55
  const extensions = [
55
56
  TextStyleKit,
56
57
  Document,
@@ -83,6 +84,7 @@ export function editorExtensions (placeholder: string, slashCommands: boolean, c
83
84
  nocookie: true,
84
85
  }),
85
86
  TiptapifyImage,
87
+ TiptapifyVideo,
86
88
  Superscript,
87
89
  Subscript,
88
90
  TableKit,
@@ -1,13 +1,13 @@
1
1
  import { Editor, useEditor } from "@tiptap/vue-3";
2
2
  import { editorExtensions } from "@tiptapify/components/editorExtensions";
3
- import { extensionComponents } from "@tiptapify/types/extensionComponents";
3
+ import { toolbarSections } from "@tiptapify/types/toolbarSections";
4
4
  import { ShallowRef } from "vue";
5
5
 
6
6
  export function getTiptapEditor (
7
7
  content: any,
8
8
  placeholder: string,
9
9
  slashCommands: boolean = true,
10
- customExtensions: extensionComponents
10
+ customExtensions: toolbarSections
11
11
  ): ShallowRef<Editor | undefined> {
12
12
  const extensions = editorExtensions(placeholder, slashCommands, customExtensions)
13
13
  const editor: ShallowRef<Editor | undefined> = useEditor({
@@ -0,0 +1,29 @@
1
+ <script lang="ts" setup>
2
+
3
+ import * as mdi from '@mdi/js'
4
+ import { Editor } from "@tiptap/vue-3";
5
+ import BtnIcon from "@tiptapify/components/UI/BtnIcon.vue";
6
+ import { inject, Ref } from "vue";
7
+
8
+ const editor = inject('tiptapifyEditor') as Ref<Editor>
9
+
10
+ const { t } = inject('tiptapifyI18n') as any
11
+
12
+ </script>
13
+
14
+ <template>
15
+ <VBtn
16
+ :disabled="!editor.can().chain().focus().redo().run()"
17
+ @click="editor.chain().focus().redo().run()"
18
+ size="32"
19
+ >
20
+ <VTooltip activator="parent">
21
+ {{ t('action.redo') }}
22
+ </VTooltip>
23
+ <BtnIcon :icon="`mdiSvg:${mdi.mdiRedo}`" />
24
+ </VBtn>
25
+ </template>
26
+
27
+ <style lang="scss" scoped>
28
+
29
+ </style>