tiptapify 0.0.23 → 0.0.26

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 (64) hide show
  1. package/README.md +40 -3
  2. package/dist/tiptapify.css +1 -1
  3. package/dist/tiptapify.mjs +22762 -22314
  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 +52 -27
  8. package/src/components/Toolbar/Index.vue +127 -9
  9. package/src/components/Toolbar/Items.vue +11 -5
  10. package/src/components/Toolbar/items.ts +14 -2
  11. package/src/components/Toolbar/misc.ts +5 -0
  12. package/src/components/Toolbar/style.ts +1 -1
  13. package/src/components/UI/BtnIcon.vue +3 -3
  14. package/src/components/UI/TiptapifyDialog.vue +5 -1
  15. package/src/components/editorExtensions.ts +4 -5
  16. package/src/components/index.ts +3 -4
  17. package/src/constants/defaults.ts +4 -0
  18. package/src/extensions/components/actions/redo/Button.vue +7 -0
  19. package/src/extensions/components/actions/undo/Button.vue +7 -0
  20. package/src/extensions/components/alignment/center/Button.vue +7 -0
  21. package/src/extensions/components/alignment/justify/Button.vue +7 -0
  22. package/src/extensions/components/alignment/left/Button.vue +7 -0
  23. package/src/extensions/components/alignment/right/Button.vue +7 -0
  24. package/src/extensions/components/format/bold/Button.vue +7 -0
  25. package/src/extensions/components/format/italic/Button.vue +7 -0
  26. package/src/extensions/components/format/strike/Button.vue +7 -0
  27. package/src/extensions/components/format/underline/Button.vue +7 -0
  28. package/src/extensions/components/formatExtra/code/Button.vue +7 -0
  29. package/src/extensions/components/formatExtra/codeBlock/Button.vue +7 -0
  30. package/src/extensions/components/formatExtra/quote/Button.vue +7 -0
  31. package/src/extensions/components/formatExtra/sub/Button.vue +7 -0
  32. package/src/extensions/components/formatExtra/sup/Button.vue +7 -0
  33. package/src/extensions/components/list/bullet/Button.vue +103 -1
  34. package/src/extensions/components/list/bullet/index.ts +101 -0
  35. package/src/extensions/components/list/indent/Button.vue +7 -0
  36. package/src/extensions/components/list/numbered/Button.vue +7 -0
  37. package/src/extensions/components/list/outdent/Button.vue +7 -0
  38. package/src/extensions/components/list/task/Button.vue +7 -0
  39. package/src/extensions/components/media/emoji/Button.vue +8 -2
  40. package/src/extensions/components/media/image/Button.vue +7 -0
  41. package/src/extensions/components/media/image/ImageDialog.vue +3 -2
  42. package/src/extensions/components/media/link/Button.vue +7 -0
  43. package/src/extensions/components/media/link/LinkDialog.vue +2 -1
  44. package/src/extensions/components/media/table/Button.vue +7 -0
  45. package/src/extensions/components/media/video/Button.vue +7 -0
  46. package/src/extensions/components/media/video/VideoDialog.vue +3 -2
  47. package/src/extensions/components/misc/break/Button.vue +7 -1
  48. package/src/extensions/components/misc/formatClear/Button.vue +7 -0
  49. package/src/extensions/components/misc/fullscreen/Button.vue +61 -0
  50. package/src/extensions/components/misc/invisibleChar/Button.vue +7 -0
  51. package/src/extensions/components/misc/line/Button.vue +7 -1
  52. package/src/extensions/components/misc/preview/Button.vue +7 -1
  53. package/src/extensions/components/misc/source/Button.vue +8 -2
  54. package/src/extensions/components/misc/source/ShowSourceDialog.vue +2 -1
  55. package/src/extensions/components/style/StyleColor.vue +4 -2
  56. package/src/extensions/components/style/color/Button.vue +4 -1
  57. package/src/extensions/components/style/fontFamily/Button.vue +7 -0
  58. package/src/extensions/components/style/fontSize/Button.vue +5 -1
  59. package/src/extensions/components/style/heading/Button.vue +14 -6
  60. package/src/extensions/components/style/highlight/Button.vue +4 -1
  61. package/src/extensions/components/style/lineHeight/Button.vue +7 -0
  62. package/src/types/{toolbarSections.ts → toolbarTypes.ts} +4 -1
  63. package/src/extensions/components/misc/preview/index.ts +0 -41
  64. package/src/extensions/components/misc/source/index.ts +0 -49
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.23",
4
+ "version": "0.0.26",
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,11 +36,17 @@ 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
+
43
50
  function contentChanged() {
44
51
  emit('content-changed', { html: editor.value?.getHTML(), json: editor.value?.getJSON() })
45
52
  }
@@ -61,6 +68,7 @@ editor.value?.chain().setFontFamily(props.defaultFontFamily).run()
61
68
 
62
69
  watch(() => editor.value, (editorInstance) => {
63
70
  if (editorInstance instanceof Editor) {
71
+ editor.value.interactiveStyles = interactiveStyles.value
64
72
  emit('editor-ready', {
65
73
  editor: editorInstance,
66
74
  getHTML: () => editorInstance.getHTML(),
@@ -73,36 +81,46 @@ watch(() => props.locale, () => {
73
81
  setLocale(props.locale)
74
82
  }, { immediate: true });
75
83
 
84
+ watch(() => props.interactiveStyles, (_interactiveStyles) => {
85
+ if (editor.value instanceof Editor) {
86
+ editor.value.interactiveStyles = interactiveStyles
87
+ }
88
+ })
89
+
76
90
  onBeforeUnmount(() => {
77
91
  editor.value?.destroy()
78
92
  })
79
93
  </script>
80
94
 
81
95
  <template>
82
- <template v-if="toolbar">
83
- <Toolbar
84
- v-if="editor"
85
- :variant-btn="variantBtn"
86
- :variant-field="variantField"
87
- :font-measure="fontMeasure"
88
- :items="items"
89
- :items-exclude="itemsExclude"
90
- :rounded="rounded"
91
- :custom-extensions="customExtensions"
92
- :theme="currentTheme"
93
- />
94
- </template>
95
-
96
- <div :class="`tiptapify-editor border border-t-0 rounded-b-${rounded}`">
97
- <div class="pa-2 tiptapify-container resizable" :style="`${height > 0 ? `height: ${height}px` : ''}`">
98
- <MenuFloating v-if="floatingMenu" :variant="variantBtn" :theme="currentTheme" />
99
-
100
- <MenuBubble v-if="bubbleMenu" :variant="variantBtn" :theme="currentTheme" />
101
-
102
- <EditorContent :editor="editor" class="tiptapify-editor" />
96
+ <div :id="`tiptapify-editor-${editor?.instanceId}`">
97
+ <div>
98
+ <template v-if="toolbar">
99
+ <Toolbar
100
+ v-if="editor"
101
+ :variant-btn="variantBtn"
102
+ :variant-field="variantField"
103
+ :font-measure="fontMeasure"
104
+ :items="propsItems"
105
+ :items-exclude="propsItemsExclude"
106
+ :rounded="rounded"
107
+ :custom-extensions="customExtensions"
108
+ :theme="currentTheme"
109
+ />
110
+ </template>
111
+
112
+ <div :class="`border border-t-0 rounded-b-${rounded}`">
113
+ <div class="pa-2 tiptapify-container resizable" :style="`${height > 0 ? `height: ${height}px` : ''}`">
114
+ <MenuFloating v-if="floatingMenu" :variant="variantBtn" :theme="currentTheme" />
115
+
116
+ <MenuBubble v-if="bubbleMenu" :variant="variantBtn" :theme="currentTheme" />
117
+
118
+ <EditorContent :editor="editor" class="tiptapify-editor" />
119
+ </div>
120
+
121
+ <Footer :show-words-count="showWordsCount" :show-characters-count="showCharactersCount" />
122
+ </div>
103
123
  </div>
104
-
105
- <Footer :show-words-count="showWordsCount" :show-characters-count="showCharactersCount" />
106
124
  </div>
107
125
  </template>
108
126
 
@@ -396,5 +414,12 @@ onBeforeUnmount(() => {
396
414
  cursor: col-resize;
397
415
  }
398
416
 
417
+ ul.list-style-circle {
418
+ list-style-type: circle !important;
419
+ }
420
+
421
+ ul.list-style-square {
422
+ list-style-type: square !important;
423
+ }
399
424
  }
400
425
  </style>
@@ -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,126 @@ 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
+ if (_itemTitle === 'bulletList' && _itemOptions.length > 0) {
129
+ const paragraphIndex = _itemOptions.findIndex((item: any) => item === 'p')
130
+ const withParagraph = paragraphIndex > -1
131
+ if (withParagraph) {
132
+ _itemOptions.splice(paragraphIndex, 1)
133
+ }
134
+
135
+ component.props = {
136
+ withDisc: _itemOptions.includes('disc'),
137
+ withCircle: _itemOptions.includes('circle'),
138
+ withSquare: _itemOptions.includes('square'),
139
+ }
140
+ }
141
+
142
+ _toolbarItems[itemSection].components.push(component)
143
+
144
+ return true
145
+ }
28
146
 
29
147
  Object.keys(props.customExtensions).forEach((key: any) => {
30
148
  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 }
@@ -1,6 +1,7 @@
1
1
  import { default as LineButton } from "@tiptapify/extensions/components/misc/line/Button.vue";
2
2
  import { default as BreakButton } from "@tiptapify/extensions/components/misc/break/Button.vue";
3
3
  import { default as PreviewButton } from "@tiptapify/extensions/components/misc/preview/Button.vue";
4
+ import { default as FullscreenButton } from "@tiptapify/extensions/components/misc/fullscreen/Button.vue";
4
5
  import { default as SourceButton } from "@tiptapify/extensions/components/misc/source/Button.vue";
5
6
  import { default as InvisibleCharButton } from "@tiptapify/extensions/components/misc/invisibleChar/Button.vue";
6
7
  import { default as FormatClearButton } from "@tiptapify/extensions/components/misc/formatClear/Button.vue";
@@ -26,6 +27,10 @@ export default {
26
27
  name: 'preview',
27
28
  component: markRaw(PreviewButton),
28
29
  },
30
+ {
31
+ name: 'fullscreen',
32
+ component: markRaw(FullscreenButton),
33
+ },
29
34
  {
30
35
  name: 'formatClear',
31
36
  component: markRaw(FormatClearButton),
@@ -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
  {
@@ -13,12 +13,12 @@ const isSvgString = (icon: any) => {
13
13
 
14
14
  <template>
15
15
  <div v-if="isSvgString(icon)" v-html="icon" class="v-icon tiptapify-btn-svg-icon"></div>
16
- <VIcon v-else :icon="icon || `mdiSvg:${mdi.mdiImageBrokenVariant}`" size="small" />
16
+ <VIcon v-else :icon="icon || `mdiSvg:${mdi.mdiImageBrokenVariant}`" size="20" />
17
17
  </template>
18
18
 
19
19
  <style lang="scss" scoped>
20
20
  .tiptapify-btn-svg-icon {
21
- width: 16px;
22
- height: 16px;
21
+ width: 20px;
22
+ height: 20px;
23
23
  }
24
24
  </style>
@@ -105,7 +105,11 @@ watch(() => dialog.value, async () => {
105
105
  <template>
106
106
  <VDialog v-model="dialog" :max-width="maxWidth" :fullscreen="fullscreen" @click:outside="emitClose">
107
107
  <VCard>
108
- <VCardTitle ref="movableHandler" :class="`d-flex ${!fullscreen ? 'tiptapify-movable-handler' : ''}`" style="user-select: none;">
108
+ <VCardTitle
109
+ ref="movableHandler"
110
+ :class="`d-flex ${!fullscreen ? 'tiptapify-movable-handler' : ''}`"
111
+ style="user-select: none;"
112
+ >
109
113
  <VLabel>
110
114
  {{ title ?? t(`dialog.${module}.title`) }}
111
115
  </VLabel>
@@ -25,15 +25,14 @@ 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 { BulletListCircle, BulletListSquare } from '@tiptapify/extensions/components/list/bullet'
28
29
  import { TiptapifyLink } from '@tiptapify/extensions/components/media/link'
29
30
  import { TiptapifyImage } from '@tiptapify/extensions/components/media/image'
30
31
  import { TiptapifyVideo } from '@tiptapify/extensions/components/media/video'
31
32
  import CodeBlockComponent from '@tiptapify/extensions/components/CodeBlockComponent.vue'
32
- import { ViewSource } from '@tiptapify/extensions/components/misc/source'
33
- import { Preview } from '@tiptapify/extensions/components/misc/preview'
34
33
  import SlashCommands from '@tiptapify/extensions/slash-commands'
35
34
  import suggestion from '@tiptapify/extensions/components/slashCommands/suggestion'
36
- import { toolbarSections } from "@tiptapify/types/toolbarSections";
35
+ import { toolbarSections } from "@tiptapify/types/toolbarTypes";
37
36
 
38
37
  // load all languages with "all" or common languages with "common"
39
38
  import { common, createLowlight } from 'lowlight'
@@ -102,11 +101,11 @@ export function editorExtensions (placeholder: string, slashCommands: boolean, c
102
101
  TextAlign.configure({ types: ['heading', 'paragraph'] }),
103
102
  Placeholder.configure({ placeholder }),
104
103
  CharacterCount,
105
- ViewSource,
106
104
  InvisibleCharacters.configure({
107
105
  visible: false,
108
106
  }),
109
- Preview
107
+ BulletListCircle,
108
+ BulletListSquare
110
109
  ]
111
110
 
112
111
  if (slashCommands) {
@@ -1,6 +1,6 @@
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 (
@@ -11,11 +11,10 @@ export function getTiptapEditor (
11
11
  onUpdate: Function = () => {}
12
12
  ): ShallowRef<Editor | undefined> {
13
13
  const extensions = editorExtensions(placeholder, slashCommands, customExtensions)
14
- const editor: ShallowRef<Editor | undefined> = useEditor({
14
+
15
+ return useEditor({
15
16
  content,
16
17
  extensions,
17
18
  onUpdate: ({ editor }) => onUpdate()
18
19
  })
19
-
20
- return editor
21
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
  >