tiptapify 0.0.22 → 0.0.25

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 (57) hide show
  1. package/README.md +39 -3
  2. package/dist/tiptapify.css +1 -1
  3. package/dist/tiptapify.mjs +22765 -22309
  4. package/dist/tiptapify.umd.js +53 -38
  5. package/index.d.ts +2 -2
  6. package/package.json +45 -47
  7. package/src/components/Tiptapify.vue +27 -8
  8. package/src/components/Toolbar/Index.vue +113 -9
  9. package/src/components/Toolbar/Items.vue +11 -5
  10. package/src/components/Toolbar/items.ts +14 -2
  11. package/src/components/Toolbar/style.ts +1 -1
  12. package/src/components/editorExtensions.ts +1 -1
  13. package/src/components/index.ts +6 -5
  14. package/src/constants/defaults.ts +4 -0
  15. package/src/extensions/components/actions/redo/Button.vue +7 -0
  16. package/src/extensions/components/actions/undo/Button.vue +7 -0
  17. package/src/extensions/components/alignment/center/Button.vue +7 -0
  18. package/src/extensions/components/alignment/justify/Button.vue +7 -0
  19. package/src/extensions/components/alignment/left/Button.vue +7 -0
  20. package/src/extensions/components/alignment/right/Button.vue +7 -0
  21. package/src/extensions/components/format/bold/Button.vue +7 -0
  22. package/src/extensions/components/format/italic/Button.vue +7 -0
  23. package/src/extensions/components/format/strike/Button.vue +7 -0
  24. package/src/extensions/components/format/underline/Button.vue +7 -0
  25. package/src/extensions/components/formatExtra/code/Button.vue +7 -0
  26. package/src/extensions/components/formatExtra/codeBlock/Button.vue +7 -0
  27. package/src/extensions/components/formatExtra/quote/Button.vue +7 -0
  28. package/src/extensions/components/formatExtra/sub/Button.vue +7 -0
  29. package/src/extensions/components/formatExtra/sup/Button.vue +7 -0
  30. package/src/extensions/components/list/bullet/Button.vue +7 -0
  31. package/src/extensions/components/list/indent/Button.vue +7 -0
  32. package/src/extensions/components/list/numbered/Button.vue +7 -0
  33. package/src/extensions/components/list/outdent/Button.vue +7 -0
  34. package/src/extensions/components/list/task/Button.vue +7 -0
  35. package/src/extensions/components/media/emoji/Button.vue +8 -2
  36. package/src/extensions/components/media/image/Button.vue +7 -0
  37. package/src/extensions/components/media/image/ImageDialog.vue +3 -2
  38. package/src/extensions/components/media/link/Button.vue +7 -0
  39. package/src/extensions/components/media/link/LinkDialog.vue +2 -1
  40. package/src/extensions/components/media/table/Button.vue +7 -0
  41. package/src/extensions/components/media/video/Button.vue +7 -0
  42. package/src/extensions/components/media/video/VideoDialog.vue +3 -2
  43. package/src/extensions/components/misc/break/Button.vue +7 -1
  44. package/src/extensions/components/misc/formatClear/Button.vue +7 -0
  45. package/src/extensions/components/misc/invisibleChar/Button.vue +7 -0
  46. package/src/extensions/components/misc/line/Button.vue +7 -1
  47. package/src/extensions/components/misc/preview/Button.vue +7 -1
  48. package/src/extensions/components/misc/source/Button.vue +8 -2
  49. package/src/extensions/components/misc/source/ShowSourceDialog.vue +2 -1
  50. package/src/extensions/components/style/StyleColor.vue +4 -2
  51. package/src/extensions/components/style/color/Button.vue +4 -1
  52. package/src/extensions/components/style/fontFamily/Button.vue +7 -0
  53. package/src/extensions/components/style/fontSize/Button.vue +5 -1
  54. package/src/extensions/components/style/heading/Button.vue +14 -6
  55. package/src/extensions/components/style/highlight/Button.vue +4 -1
  56. package/src/extensions/components/style/lineHeight/Button.vue +7 -0
  57. package/src/types/{toolbarSections.ts → toolbarTypes.ts} +4 -1
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 { toolbarSections } from "./src/types/toolbarSections";
3
+ import { toolbarTypes } from "./src/types/toolbarTypes";
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: toolbarSections
21
+ customExtensions: toolbarTypes
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.22",
4
+ "version": "0.0.25",
5
5
  "description": "Tiptap3 editor with Vuetify3 menu implementation",
6
6
  "exports": {
7
7
  ".": {
@@ -57,53 +57,51 @@
57
57
  "author": "Igor Voytovich",
58
58
  "license": "MIT",
59
59
  "repository": "https://github.com/IVoyt/tiptapify",
60
- "packageManager": "pnpm@10.12.1",
60
+ "packageManager": "pnpm@10.15.1",
61
61
  "dependencies": {
62
- "@tiptap/core": "^3.0.9",
63
- "@tiptap/extension-blockquote": "^3.0.9",
64
- "@tiptap/extension-bold": "^3.0.9",
65
- "@tiptap/extension-bubble-menu": "^3.0.9",
66
- "@tiptap/extension-code": "^3.0.9",
67
- "@tiptap/extension-code-block": "^3.0.9",
68
- "@tiptap/extension-code-block-lowlight": "^3.0.9",
69
- "@tiptap/extension-color": "^3.0.9",
70
- "@tiptap/extension-document": "^3.0.9",
71
- "@tiptap/extension-floating-menu": "^3.0.9",
72
- "@tiptap/extension-font-family": "^3.0.9",
73
- "@tiptap/extension-hard-break": "^3.0.9",
74
- "@tiptap/extension-heading": "^3.0.9",
75
- "@tiptap/extension-highlight": "^3.0.9",
76
- "@tiptap/extension-horizontal-rule": "^3.0.9",
77
- "@tiptap/extension-image": "^3.0.9",
78
- "@tiptap/extension-invisible-characters": "^3.0.9",
79
- "@tiptap/extension-italic": "^3.0.9",
80
- "@tiptap/extension-link": "^3.0.9",
81
- "@tiptap/extension-list": "^3.0.9",
82
- "@tiptap/extension-list-item": "^3.0.9",
83
- "@tiptap/extension-paragraph": "^3.0.9",
84
- "@tiptap/extension-placeholder": "^3.0.9",
85
- "@tiptap/extension-strike": "^3.0.9",
86
- "@tiptap/extension-subscript": "^3.0.9",
87
- "@tiptap/extension-superscript": "^3.0.9",
88
- "@tiptap/extension-table": "^3.0.9",
89
- "@tiptap/extension-task-item": "^3.0.9",
90
- "@tiptap/extension-task-list": "^3.0.9",
91
- "@tiptap/extension-text": "^3.0.9",
92
- "@tiptap/extension-text-align": "^3.0.9",
93
- "@tiptap/extension-text-style": "^3.0.9",
94
- "@tiptap/extension-typography": "^3.0.9",
95
- "@tiptap/extension-underline": "^3.0.9",
96
- "@tiptap/extension-youtube": "^3.0.9",
97
- "@tiptap/extensions": "^3.0.9",
98
- "@tiptap/pm": "^3.0.9",
99
- "@tiptap/starter-kit": "^3.0.9",
100
- "@tiptap/suggestion": "^3.0.9",
101
- "@tiptap/vue-3": "^3.0.9",
62
+ "@tiptap/core": "^3.4.1",
63
+ "@tiptap/extension-blockquote": "^3.4.1",
64
+ "@tiptap/extension-bold": "^3.4.1",
65
+ "@tiptap/extension-bubble-menu": "^3.4.1",
66
+ "@tiptap/extension-code": "^3.4.1",
67
+ "@tiptap/extension-code-block": "^3.4.1",
68
+ "@tiptap/extension-code-block-lowlight": "^3.4.1",
69
+ "@tiptap/extension-color": "^3.4.1",
70
+ "@tiptap/extension-document": "^3.4.1",
71
+ "@tiptap/extension-floating-menu": "^3.4.1",
72
+ "@tiptap/extension-font-family": "^3.4.1",
73
+ "@tiptap/extension-hard-break": "^3.4.1",
74
+ "@tiptap/extension-heading": "^3.4.1",
75
+ "@tiptap/extension-highlight": "^3.4.1",
76
+ "@tiptap/extension-horizontal-rule": "^3.4.1",
77
+ "@tiptap/extension-image": "^3.4.1",
78
+ "@tiptap/extension-invisible-characters": "^3.4.1",
79
+ "@tiptap/extension-italic": "^3.4.1",
80
+ "@tiptap/extension-link": "^3.4.1",
81
+ "@tiptap/extension-list": "^3.4.1",
82
+ "@tiptap/extension-list-item": "^3.4.1",
83
+ "@tiptap/extension-paragraph": "^3.4.1",
84
+ "@tiptap/extension-placeholder": "^3.4.1",
85
+ "@tiptap/extension-strike": "^3.4.1",
86
+ "@tiptap/extension-subscript": "^3.4.1",
87
+ "@tiptap/extension-superscript": "^3.4.1",
88
+ "@tiptap/extension-table": "^3.4.1",
89
+ "@tiptap/extension-task-item": "^3.4.1",
90
+ "@tiptap/extension-task-list": "^3.4.1",
91
+ "@tiptap/extension-text": "^3.4.1",
92
+ "@tiptap/extension-text-align": "^3.4.1",
93
+ "@tiptap/extension-typography": "^3.4.1",
94
+ "@tiptap/extension-underline": "^3.4.1",
95
+ "@tiptap/extension-youtube": "^3.4.1",
96
+ "@tiptap/extensions": "^3.4.1",
97
+ "@tiptap/pm": "^3.4.1",
98
+ "@tiptap/suggestion": "^3.4.1",
99
+ "@tiptap/vue-3": "^3.4.1",
102
100
  "emoji.json": "^16.0.0",
103
101
  "highlight.js": "^11.11.1",
104
102
  "linkifyjs": "^4.3.2",
105
103
  "lowlight": "^3.3.0",
106
- "vue-i18n": "^11.1.11"
104
+ "vue-i18n": "^11.1.12"
107
105
  },
108
106
  "peerDependencies": {
109
107
  "@mdi/js": "^7.4.47",
@@ -113,18 +111,18 @@
113
111
  "devDependencies": {
114
112
  "@intlify/unplugin-vue-i18n": "^6.0.8",
115
113
  "@rollup/plugin-alias": "^5.1.1",
116
- "@types/node": "^22.17.0",
114
+ "@types/node": "^22.18.1",
117
115
  "@vitejs/plugin-vue": "^5.2.4",
118
116
  "@vitejs/plugin-vue-jsx": "^4.2.0",
119
117
  "rollup-plugin-tsconfig-paths": "^1.5.2",
120
- "sass-embedded": "^1.89.2",
121
- "tsx": "^4.20.3",
118
+ "sass-embedded": "^1.92.0",
119
+ "tsx": "^4.20.5",
122
120
  "typescript": "^5.9.2",
123
121
  "unplugin-vue-components": "^28.8.0",
124
122
  "vite": "^6.3.5",
125
123
  "vite-plugin-vuetify": "^2.1.2",
126
124
  "vite-svg-loader": "^5.1.0",
127
125
  "vite-tsconfig-paths": "^5.1.4",
128
- "vue-tsc": "^2.2.12"
126
+ "vue-tsc": "^3.0.0"
129
127
  }
130
128
  }
@@ -1,6 +1,7 @@
1
1
  <script setup lang="ts">
2
2
 
3
- import { toolbarSections } from "@tiptapify/types/toolbarSections";
3
+ import defaults from "@tiptapify/constants/defaults";
4
+ import { itemsPropType, toolbarSections } from "@tiptapify/types/toolbarTypes";
4
5
  import { computed, onBeforeUnmount, PropType, provide, ref, ShallowRef, watch } from "vue";
5
6
  import { default as Toolbar } from "@tiptapify/components/Toolbar/Index.vue";
6
7
  import { Editor, EditorContent } from '@tiptap/vue-3'
@@ -20,10 +21,10 @@ const props = defineProps({
20
21
  locale: { type: String, default () { return 'en' } },
21
22
  content: String|Object,
22
23
  height: { type: Number, default () { return null } },
23
- variantBtn: { type: String, default () { return 'elevated' } },
24
- variantField: { type: String, default () { return 'solo' } },
24
+ variantBtn: { type: String, default () { return defaults.variantBtn } },
25
+ variantField: { type: String, default () { return defaults.variantField } },
25
26
  toolbar: { type: Boolean, default () { return true } },
26
- items: { type: Array<string>, default() { return [] }},
27
+ items: { type: [Array, Object as PropType<itemsPropType>], default() { return [] }},
27
28
  itemsExclude: { type: Boolean, default() { return false } },
28
29
  bubbleMenu: { type: Boolean, default () { return true } },
29
30
  floatingMenu: { type: Boolean, default () { return true } },
@@ -35,19 +36,30 @@ const props = defineProps({
35
36
  fontMeasure: { type: String, default () { return 'px' } },
36
37
  rounded: { type: String, default () { return '0' } },
37
38
  customExtensions: { type: Array as PropType<toolbarSections>, default() { return [] } },
39
+ interactiveStyles: { type: Boolean, default() { return true } },
38
40
  })
39
41
 
40
42
  const appTheme = useTheme()
41
43
  const currentTheme = ref(appTheme.global.name)
42
44
 
45
+ const propsItems = computed(() => props.items)
46
+ const propsItemsExclude = computed(() => props.itemsExclude)
47
+
48
+ const interactiveStyles = computed(() => props.interactiveStyles)
49
+
50
+ function contentChanged() {
51
+ emit('content-changed', { html: editor.value?.getHTML(), json: editor.value?.getJSON() })
52
+ }
53
+
43
54
  const editor: ShallowRef<Editor | undefined> = getTiptapEditor(
44
55
  props.content,
45
56
  computed(() => props.placeholder || t('content.placeholder')).value,
46
57
  props.slashCommands,
47
- props.customExtensions
58
+ props.customExtensions,
59
+ contentChanged
48
60
  )
49
61
 
50
- const emit = defineEmits(['update:modelValue', 'editor-ready']);
62
+ const emit = defineEmits(['update:modelValue', 'editor-ready', 'content-changed']);
51
63
 
52
64
  provide('tiptapifyEditor', editor)
53
65
  provide('tiptapifyI18n', { t, setLocale })
@@ -56,6 +68,7 @@ editor.value?.chain().setFontFamily(props.defaultFontFamily).run()
56
68
 
57
69
  watch(() => editor.value, (editorInstance) => {
58
70
  if (editorInstance instanceof Editor) {
71
+ editor.value.interactiveStyles = interactiveStyles.value
59
72
  emit('editor-ready', {
60
73
  editor: editorInstance,
61
74
  getHTML: () => editorInstance.getHTML(),
@@ -68,6 +81,12 @@ watch(() => props.locale, () => {
68
81
  setLocale(props.locale)
69
82
  }, { immediate: true });
70
83
 
84
+ watch(() => props.interactiveStyles, (_interactiveStyles) => {
85
+ if (editor.value instanceof Editor) {
86
+ editor.value.interactiveStyles = interactiveStyles
87
+ }
88
+ })
89
+
71
90
  onBeforeUnmount(() => {
72
91
  editor.value?.destroy()
73
92
  })
@@ -80,8 +99,8 @@ onBeforeUnmount(() => {
80
99
  :variant-btn="variantBtn"
81
100
  :variant-field="variantField"
82
101
  :font-measure="fontMeasure"
83
- :items="items"
84
- :items-exclude="itemsExclude"
102
+ :items="propsItems"
103
+ :items-exclude="propsItemsExclude"
85
104
  :rounded="rounded"
86
105
  :custom-extensions="customExtensions"
87
106
  :theme="currentTheme"
@@ -1,18 +1,18 @@
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 } from 'vue'
5
- import { toolbarSections } from '@tiptapify/types/toolbarSections'
4
+ import defaults from "@tiptapify/constants/defaults";
5
+ import { computed, defineProps, inject, PropType, Ref } from 'vue'
6
+ import { itemsPropType, toolbarSections } from '@tiptapify/types/toolbarTypes'
6
7
 
7
- import items from "@tiptapify/components/Toolbar/items";
8
+ import { default as items, availableItems } from "@tiptapify/components/Toolbar/items";
8
9
 
9
10
  const props = defineProps({
10
- variantBtn: { type: String, default () { return 'elevated' }},
11
- variantField: { type: String, default () { return 'solo' }},
12
- items: { type: Array<string>, default() { return [] }},
11
+ variantBtn: { type: String, default () { return defaults.variantBtn } },
12
+ variantField: { type: String, default () { return defaults.variantField } },
13
+ items: { type: [Array, Object as PropType<itemsPropType>], default() { return [] } },
13
14
  itemsExclude: { type: Boolean, default() { return false } },
14
- headingLevels: { type: Array<number>, default() { return [] }},
15
- fontMeasure: { type: String, default () { return 'px' }},
15
+ fontMeasure: { type: String, default () { return 'px' } },
16
16
  customFonts: { type: Array<string>, default () { return [] } },
17
17
  customFontsOverride: { type: Boolean, default() { return false } },
18
18
  theme: { type: String, default() { return 'light' } },
@@ -23,8 +23,112 @@ const props = defineProps({
23
23
 
24
24
  const editor = inject('tiptapifyEditor') as Ref<Editor>
25
25
 
26
+ const propsItems = computed(() => props.items)
27
+ const propsItemsIsList = computed(() => Array.isArray(propsItems.value))
28
+ const propsItemsExclude = computed(() => props.itemsExclude)
29
+
26
30
  // this prevents from overriding the default items
27
- const toolbarItems = [...items]
31
+ let toolbarItems = [...Object.values(items)]
32
+ const availableItemsKeys = Object.keys(availableItems)
33
+
34
+ type toolbarItemsType = { [key: string]: { section: string, group: boolean, components: any[] } }
35
+ propsItemsExclude.value ? prepareExcludeToolbarItems() : prepareToolbarItems()
36
+
37
+ function prepareToolbarItems() {
38
+ const _toolbarItems: toolbarItemsType = {}
39
+
40
+ if (!propsItemsIsList.value) {
41
+ for (const propsItemSection in propsItems.value as itemsPropType) {
42
+ if (propsItems.value[propsItemSection].length === 0) {
43
+ continue
44
+ }
45
+
46
+ for (const propsItem of propsItems.value[propsItemSection]) {
47
+ const item = propsItem.split(':')
48
+ if (!availableItemsKeys.includes(item[0])) {
49
+ throw new Error(`The ${propsItem} is unknown extension. Please use one of the following: ${availableItemsKeys.join(', ')}`)
50
+ }
51
+
52
+ addToolbarItem(_toolbarItems, propsItems.value[propsItemSection], propsItem)
53
+ }
54
+ }
55
+ } else if (propsItems.value.length > 0) {
56
+ for (const propsItem of propsItems.value as string[]) {
57
+ const item = propsItem.split(':')
58
+ if (!availableItemsKeys.includes(item[0])) {
59
+ throw new Error(`The ${propsItem} is unknown extension. Please use one of the following: ${availableItemsKeys.join(', ')}`)
60
+ }
61
+
62
+ addToolbarItem(_toolbarItems, propsItems.value, propsItem)
63
+ }
64
+ } else {
65
+ return
66
+ }
67
+
68
+ toolbarItems = Object.values(_toolbarItems)
69
+ }
70
+
71
+ function prepareExcludeToolbarItems() {
72
+ const _toolbarItems: toolbarItemsType = {}
73
+ const excludeItems = []
74
+ for (const propsItemSection in propsItems.value as itemsPropType) {
75
+ for (const propsItem of propsItems.value[propsItemSection]) {
76
+ excludeItems.push(propsItem)
77
+ }
78
+ }
79
+
80
+ for (const item in availableItems) {
81
+ addToolbarItem(_toolbarItems, excludeItems, item)
82
+ }
83
+
84
+ toolbarItems = Object.values(_toolbarItems)
85
+ }
86
+
87
+ function addToolbarItem(_toolbarItems: toolbarItemsType, itemsList: any, itemTitle: string, group: boolean|null = null): boolean {
88
+ const item = itemTitle.split(':')
89
+ const _itemTitle = item[0]
90
+ const _itemOptions = item[1] ? item[1].split(',') : []
91
+
92
+ const itemSection = availableItems[_itemTitle]
93
+ const section = items[itemSection]
94
+
95
+ const component = section?.components.find((component: any) => component.name === _itemTitle)
96
+
97
+ let itemExists = itemsList.includes(itemTitle)
98
+ itemExists = propsItemsExclude.value ? itemExists : !itemExists
99
+ if (!component || itemExists) {
100
+ return false
101
+ }
102
+
103
+ if (group === null) {
104
+ group = section.group
105
+ }
106
+
107
+ if (typeof _toolbarItems[itemSection] === 'undefined') {
108
+ _toolbarItems[itemSection] = {
109
+ section: itemSection,
110
+ group,
111
+ components: []
112
+ }
113
+ }
114
+
115
+ if (_itemTitle === 'heading' && _itemOptions.length > 0) {
116
+ const paragraphIndex = _itemOptions.findIndex((item: any) => item === 'p')
117
+ const withParagraph = paragraphIndex > -1
118
+ if (withParagraph) {
119
+ _itemOptions.splice(paragraphIndex, 1)
120
+ }
121
+
122
+ component.props = {
123
+ withParagraph,
124
+ customHeadingLevels: _itemOptions,
125
+ }
126
+ }
127
+
128
+ _toolbarItems[itemSection].components.push(component)
129
+
130
+ return true
131
+ }
28
132
 
29
133
  Object.keys(props.customExtensions).forEach((key: any) => {
30
134
  toolbarItems.push(props.customExtensions[key])
@@ -1,11 +1,12 @@
1
1
  <script setup lang="ts">
2
2
 
3
+ import defaults from "@tiptapify/constants/defaults";
3
4
  import { defineProps, PropType } from 'vue'
4
5
 
5
- import { toolbarSections } from "@tiptapify/types/toolbarSections";
6
+ import { toolbarSections } from "@tiptapify/types/toolbarTypes";
6
7
 
7
8
  defineProps({
8
- variantBtn: { type: String, default () { return 'elevated' }},
9
+ variantBtn: { type: String, default () { return defaults.variantBtn }},
9
10
  items: { type: Array as PropType<toolbarSections>, default() { return {} }},
10
11
  })
11
12
 
@@ -13,14 +14,19 @@ defineProps({
13
14
 
14
15
  <template>
15
16
  <VToolbarItems class="py-2">
16
- <template v-for="(item, key) in items" :key="item.section">
17
+ <template v-for="item in items" :key="item.section">
17
18
  <VBtnGroup v-if="item.group" elevation="4">
18
19
  <template v-for="sectionItem in item.components" :key="sectionItem.name">
19
- <component :is="sectionItem.component" />
20
+ <component :is="sectionItem.component" v-bind="{ ...sectionItem.props ?? {} }" />
20
21
  </template>
21
22
  </VBtnGroup>
22
23
  <template v-else>
23
- <component v-for="sectionItem in item.components" :key="sectionItem.name" :is="sectionItem.component" />
24
+ <component
25
+ v-for="sectionItem in item.components"
26
+ :key="sectionItem.name"
27
+ :is="sectionItem.component"
28
+ v-bind="{ variantBtn, ...sectionItem.props ?? {} }"
29
+ />
24
30
  </template>
25
31
 
26
32
  <div class="menu-divider"></div>
@@ -7,7 +7,7 @@ import list from "@tiptapify/components/Toolbar/list";
7
7
  import media from "@tiptapify/components/Toolbar/media";
8
8
  import misc from "@tiptapify/components/Toolbar/misc";
9
9
 
10
- export default [
10
+ const items = {
11
11
  style,
12
12
  format,
13
13
  formatExtra,
@@ -16,4 +16,16 @@ export default [
16
16
  list,
17
17
  actions,
18
18
  misc,
19
- ]
19
+ }
20
+
21
+ const availableItems: { [key: string]: string } = {}
22
+ for (const item of Object.values(items)) {
23
+ const itemComponents = item.components
24
+ for (const component of itemComponents) {
25
+ availableItems[component.name] = item.section
26
+ }
27
+ }
28
+
29
+ export default items
30
+
31
+ export { availableItems }
@@ -7,7 +7,7 @@ import { default as HighlightButton } from "@tiptapify/extensions/components/sty
7
7
  import { markRaw } from "vue";
8
8
 
9
9
  export default {
10
- section: 'actions',
10
+ section: 'style',
11
11
  group: true,
12
12
  components: [
13
13
  {
@@ -33,7 +33,7 @@ import { ViewSource } from '@tiptapify/extensions/components/misc/source'
33
33
  import { Preview } from '@tiptapify/extensions/components/misc/preview'
34
34
  import SlashCommands from '@tiptapify/extensions/slash-commands'
35
35
  import suggestion from '@tiptapify/extensions/components/slashCommands/suggestion'
36
- import { toolbarSections } from "@tiptapify/types/toolbarSections";
36
+ import { toolbarSections } from "@tiptapify/types/toolbarTypes";
37
37
 
38
38
  // load all languages with "all" or common languages with "common"
39
39
  import { common, createLowlight } from 'lowlight'
@@ -1,19 +1,20 @@
1
1
  import { Editor, useEditor } from "@tiptap/vue-3";
2
2
  import { editorExtensions } from "@tiptapify/components/editorExtensions";
3
- import { toolbarSections } from "@tiptapify/types/toolbarSections";
3
+ import { toolbarSections } from "@tiptapify/types/toolbarTypes";
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: toolbarSections
10
+ customExtensions: toolbarSections,
11
+ onUpdate: Function = () => {}
11
12
  ): ShallowRef<Editor | undefined> {
12
13
  const extensions = editorExtensions(placeholder, slashCommands, customExtensions)
13
- const editor: ShallowRef<Editor | undefined> = useEditor({
14
+
15
+ return useEditor({
14
16
  content,
15
17
  extensions,
18
+ onUpdate: ({ editor }) => onUpdate()
16
19
  })
17
-
18
- return editor
19
20
  }
@@ -0,0 +1,4 @@
1
+ export default {
2
+ variantBtn: 'flat',
3
+ variantField: 'solo',
4
+ }
@@ -5,6 +5,12 @@ import { Editor } from "@tiptap/vue-3";
5
5
  import BtnIcon from "@tiptapify/components/UI/BtnIcon.vue";
6
6
  import { inject, Ref } from "vue";
7
7
 
8
+ import defaults from '@tiptapify/constants/defaults'
9
+
10
+ defineProps({
11
+ variantBtn: { type: String, default: defaults.variantBtn }
12
+ })
13
+
8
14
  const editor = inject('tiptapifyEditor') as Ref<Editor>
9
15
 
10
16
  const { t } = inject('tiptapifyI18n') as any
@@ -14,6 +20,7 @@ const { t } = inject('tiptapifyI18n') as any
14
20
  <template>
15
21
  <VBtn
16
22
  :disabled="!editor.can().chain().focus().redo().run()"
23
+ :variant="variantBtn"
17
24
  @click="editor.chain().focus().redo().run()"
18
25
  size="32"
19
26
  >
@@ -5,6 +5,12 @@ import { Editor } from "@tiptap/vue-3";
5
5
  import BtnIcon from "@tiptapify/components/UI/BtnIcon.vue";
6
6
  import { inject, Ref } from "vue";
7
7
 
8
+ import defaults from '@tiptapify/constants/defaults'
9
+
10
+ defineProps({
11
+ variantBtn: { type: String, default: defaults.variantBtn }
12
+ })
13
+
8
14
  const editor = inject('tiptapifyEditor') as Ref<Editor>
9
15
 
10
16
  const { t } = inject('tiptapifyI18n') as any
@@ -14,6 +20,7 @@ const { t } = inject('tiptapifyI18n') as any
14
20
  <template>
15
21
  <VBtn
16
22
  :disabled="!editor.can().chain().focus().undo().run()"
23
+ :variant="variantBtn"
17
24
  @click="editor.chain().focus().undo().run()"
18
25
  size="32"
19
26
  >
@@ -5,6 +5,12 @@ import { Editor } from "@tiptap/vue-3";
5
5
  import BtnIcon from "@tiptapify/components/UI/BtnIcon.vue";
6
6
  import { inject, Ref } from "vue";
7
7
 
8
+ import defaults from '@tiptapify/constants/defaults'
9
+
10
+ defineProps({
11
+ variantBtn: { type: String, default: defaults.variantBtn }
12
+ })
13
+
8
14
  const editor = inject('tiptapifyEditor') as Ref<Editor>
9
15
 
10
16
  const { t } = inject('tiptapifyI18n') as any
@@ -14,6 +20,7 @@ const { t } = inject('tiptapifyI18n') as any
14
20
  <template>
15
21
  <VBtn
16
22
  :color="editor.isActive({ textAlign: 'center' }) ? 'primary' : ''"
23
+ :variant="variantBtn"
17
24
  @click="editor.chain().focus().toggleTextAlign('center').run()"
18
25
  size="32"
19
26
  >
@@ -5,6 +5,12 @@ import { Editor } from "@tiptap/vue-3";
5
5
  import BtnIcon from "@tiptapify/components/UI/BtnIcon.vue";
6
6
  import { inject, Ref } from "vue";
7
7
 
8
+ import defaults from '@tiptapify/constants/defaults'
9
+
10
+ defineProps({
11
+ variantBtn: { type: String, default: defaults.variantBtn }
12
+ })
13
+
8
14
  const editor = inject('tiptapifyEditor') as Ref<Editor>
9
15
 
10
16
  const { t } = inject('tiptapifyI18n') as any
@@ -14,6 +20,7 @@ const { t } = inject('tiptapifyI18n') as any
14
20
  <template>
15
21
  <VBtn
16
22
  :color="editor.isActive({ textAlign: 'justify' }) ? 'primary' : ''"
23
+ :variant="variantBtn"
17
24
  @click="editor.chain().focus().toggleTextAlign('justify').run()"
18
25
  size="32"
19
26
  >
@@ -5,6 +5,12 @@ import { Editor } from "@tiptap/vue-3";
5
5
  import BtnIcon from "@tiptapify/components/UI/BtnIcon.vue";
6
6
  import { inject, Ref } from "vue";
7
7
 
8
+ import defaults from '@tiptapify/constants/defaults'
9
+
10
+ defineProps({
11
+ variantBtn: { type: String, default: defaults.variantBtn }
12
+ })
13
+
8
14
  const editor = inject('tiptapifyEditor') as Ref<Editor>
9
15
 
10
16
  const { t } = inject('tiptapifyI18n') as any
@@ -14,6 +20,7 @@ const { t } = inject('tiptapifyI18n') as any
14
20
  <template>
15
21
  <VBtn
16
22
  :color="editor.isActive({ textAlign: 'left' }) ? 'primary' : ''"
23
+ :variant="variantBtn"
17
24
  @click="editor.chain().focus().toggleTextAlign('left').run()"
18
25
  size="32"
19
26
  >
@@ -5,6 +5,12 @@ import { Editor } from "@tiptap/vue-3";
5
5
  import BtnIcon from "@tiptapify/components/UI/BtnIcon.vue";
6
6
  import { inject, Ref } from "vue";
7
7
 
8
+ import defaults from '@tiptapify/constants/defaults'
9
+
10
+ defineProps({
11
+ variantBtn: { type: String, default: defaults.variantBtn }
12
+ })
13
+
8
14
  const editor = inject('tiptapifyEditor') as Ref<Editor>
9
15
 
10
16
  const { t } = inject('tiptapifyI18n') as any
@@ -14,6 +20,7 @@ const { t } = inject('tiptapifyI18n') as any
14
20
  <template>
15
21
  <VBtn
16
22
  :color="editor.isActive({ textAlign: 'right' }) ? 'primary' : ''"
23
+ :variant="variantBtn"
17
24
  @click="editor.chain().focus().toggleTextAlign('right').run()"
18
25
  size="32"
19
26
  >
@@ -5,6 +5,12 @@ import { Editor } from "@tiptap/vue-3";
5
5
  import BtnIcon from "@tiptapify/components/UI/BtnIcon.vue";
6
6
  import { inject, Ref } from "vue";
7
7
 
8
+ import defaults from '@tiptapify/constants/defaults'
9
+
10
+ defineProps({
11
+ variantBtn: { type: String, default: defaults.variantBtn }
12
+ })
13
+
8
14
  const editor = inject('tiptapifyEditor') as Ref<Editor>
9
15
 
10
16
  const { t } = inject('tiptapifyI18n') as any
@@ -15,6 +21,7 @@ const { t } = inject('tiptapifyI18n') as any
15
21
  <VBtn
16
22
  :color="editor.isActive('bold') ? 'primary' : ''"
17
23
  :disabled="!editor.can().chain().focus().toggleBold().run()"
24
+ :variant="variantBtn"
18
25
  @click="editor.commands.toggleBold()"
19
26
  size="32"
20
27
  >