tiptapify 0.1.3 → 0.1.5

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 (110) hide show
  1. package/dist/tiptapify.css +2 -1
  2. package/dist/tiptapify.mjs +64316 -50753
  3. package/dist/tiptapify.umd.js +88 -78
  4. package/index.d.ts +97 -40
  5. package/package.json +65 -66
  6. package/src/components/Footer.vue +4 -3
  7. package/src/components/MenuBubble.vue +16 -16
  8. package/src/components/MenuFloating.vue +13 -13
  9. package/src/components/Tiptapify.vue +31 -16
  10. package/src/components/Toolbar/Index.vue +21 -17
  11. package/src/components/Toolbar/Items.vue +9 -8
  12. package/src/components/Toolbar/actions.ts +3 -3
  13. package/src/components/Toolbar/alignment.ts +5 -5
  14. package/src/components/Toolbar/format.ts +5 -5
  15. package/src/components/Toolbar/formatExtra.ts +6 -6
  16. package/src/components/Toolbar/items.ts +8 -8
  17. package/src/components/Toolbar/list.ts +6 -6
  18. package/src/components/Toolbar/media.ts +8 -8
  19. package/src/components/Toolbar/misc.ts +8 -8
  20. package/src/components/Toolbar/style.ts +7 -7
  21. package/src/components/UI/TiptapifyDialog.vue +14 -13
  22. package/src/components/editorExtensions.ts +2 -2
  23. package/src/components/index.ts +6 -6
  24. package/src/constants/style.ts +4 -3
  25. package/src/extensions/charmap/arrows.ts +700 -700
  26. package/src/extensions/charmap/box_drawing.ts +184 -184
  27. package/src/extensions/charmap/currency.ts +93 -93
  28. package/src/extensions/charmap/cyrillic.ts +368 -368
  29. package/src/extensions/charmap/diacritics.ts +60 -60
  30. package/src/extensions/charmap/extended_letters.ts +748 -748
  31. package/src/extensions/charmap/greek.ts +252 -252
  32. package/src/extensions/charmap/hebrew.ts +105 -105
  33. package/src/extensions/charmap/math.ts +1684 -1684
  34. package/src/extensions/charmap/punctuation.ts +68 -68
  35. package/src/extensions/charmap/symbols.ts +288 -288
  36. package/src/extensions/charmap/typography.ts +284 -284
  37. package/src/extensions/components/CodeBlockComponent.vue +2 -2
  38. package/src/extensions/components/actions/redo/Button.vue +12 -10
  39. package/src/extensions/components/actions/undo/Button.vue +12 -10
  40. package/src/extensions/components/alignment/center/Button.vue +11 -9
  41. package/src/extensions/components/alignment/justify/Button.vue +11 -9
  42. package/src/extensions/components/alignment/left/Button.vue +11 -9
  43. package/src/extensions/components/alignment/right/Button.vue +11 -9
  44. package/src/extensions/components/format/bold/Button.vue +12 -10
  45. package/src/extensions/components/format/italic/Button.vue +12 -10
  46. package/src/extensions/components/format/strike/Button.vue +12 -10
  47. package/src/extensions/components/format/underline/Button.vue +5 -3
  48. package/src/extensions/components/formatExtra/code/Button.vue +12 -10
  49. package/src/extensions/components/formatExtra/codeBlock/Button.vue +12 -10
  50. package/src/extensions/components/formatExtra/quote/Button.vue +12 -10
  51. package/src/extensions/components/formatExtra/sub/Button.vue +12 -10
  52. package/src/extensions/components/formatExtra/sup/Button.vue +12 -10
  53. package/src/extensions/components/list/bullet/Button.vue +21 -19
  54. package/src/extensions/components/list/bullet/index.ts +1 -1
  55. package/src/extensions/components/list/indent/Button.vue +13 -11
  56. package/src/extensions/components/list/numbered/Button.vue +12 -10
  57. package/src/extensions/components/list/outdent/Button.vue +13 -11
  58. package/src/extensions/components/list/task/Button.vue +12 -10
  59. package/src/extensions/components/media/charmap/Button.vue +8 -5
  60. package/src/extensions/components/media/charmap/Picker.vue +20 -18
  61. package/src/extensions/components/media/emoji/Button.vue +8 -6
  62. package/src/extensions/components/media/emoji/Picker.vue +20 -18
  63. package/src/extensions/components/media/iframe/Button.vue +13 -11
  64. package/src/extensions/components/media/iframe/IframeDialog.vue +27 -25
  65. package/src/extensions/components/media/image/Button.vue +12 -10
  66. package/src/extensions/components/media/image/ImageDialog.vue +46 -42
  67. package/src/extensions/components/media/link/Button.vue +12 -11
  68. package/src/extensions/components/media/link/LinkDialog.vue +34 -32
  69. package/src/extensions/components/media/link/index.ts +6 -7
  70. package/src/extensions/components/media/table/Button.vue +21 -19
  71. package/src/extensions/components/media/table/ColumnActions.vue +5 -4
  72. package/src/extensions/components/media/table/RowActions.vue +5 -4
  73. package/src/extensions/components/media/table/TableBuilder.vue +15 -13
  74. package/src/extensions/components/media/video/Button.vue +12 -10
  75. package/src/extensions/components/media/video/VideoDialog.vue +33 -15
  76. package/src/extensions/components/misc/break/Button.vue +8 -6
  77. package/src/extensions/components/misc/formatClear/Button.vue +12 -10
  78. package/src/extensions/components/misc/fullscreen/Button.vue +20 -18
  79. package/src/extensions/components/misc/invisibleChar/Button.vue +11 -9
  80. package/src/extensions/components/misc/line/Button.vue +11 -9
  81. package/src/extensions/components/misc/preview/Button.vue +11 -9
  82. package/src/extensions/components/misc/source/Button.vue +9 -7
  83. package/src/extensions/components/misc/source/ShowSourceDialog.vue +27 -25
  84. package/src/extensions/components/slashCommands/CommandsList.vue +3 -1
  85. package/src/extensions/components/style/StyleColor.vue +26 -22
  86. package/src/extensions/components/style/color/Button.vue +19 -17
  87. package/src/extensions/components/style/fontFamily/Button.vue +16 -14
  88. package/src/extensions/components/style/fontFamily/FontFamily.vue +3 -2
  89. package/src/extensions/components/style/fontSize/Button.vue +17 -15
  90. package/src/extensions/components/style/fontSize/FontSize.vue +4 -3
  91. package/src/extensions/components/style/heading/Button.vue +19 -16
  92. package/src/extensions/components/style/highlight/Button.vue +19 -17
  93. package/src/extensions/components/style/lineHeight/Button.vue +16 -14
  94. package/src/extensions/components/style/lineHeight/FontFamily.vue +3 -2
  95. package/src/extensions/components/style/lineHeight/LineHeight.vue +3 -2
  96. package/src/extensions/emoji/activities.ts +534 -534
  97. package/src/extensions/emoji/animals_and_nature.ts +978 -978
  98. package/src/extensions/emoji/component.ts +54 -54
  99. package/src/extensions/emoji/flags.ts +1644 -1644
  100. package/src/extensions/emoji/food_and_drink.ts +810 -810
  101. package/src/extensions/emoji/objects.ts +1608 -1608
  102. package/src/extensions/emoji/people_and_body.ts +2022 -2022
  103. package/src/extensions/emoji/smileys_and_emotion.ts +1038 -1038
  104. package/src/extensions/emoji/symbols.ts +1290 -1290
  105. package/src/extensions/emoji/travel_and_places.ts +1332 -1332
  106. package/src/index.ts +15 -5
  107. package/src/types/editor.ts +10 -0
  108. package/src/types/slashCommandsTypes.ts +1 -1
  109. package/src/types/toolbarTypes.ts +3 -1
  110. package/src/utils/helpers.ts +1 -1
package/index.d.ts CHANGED
@@ -1,45 +1,66 @@
1
1
  import { Editor as TiptapEditor } from '@tiptap/vue-3'
2
- import type { DefineComponent } from 'vue'
3
- import { toolbarSections } from './src/types/toolbarTypes'
4
-
5
- export interface TiptapifyProps {
6
- content: string|object
7
- variantBtn: string
8
- variantField: string
9
- toolbar: boolean
10
- items: [string]
11
- itemsExclude: boolean
12
- bubbleMenu: boolean
13
- floatingMenu: boolean
14
- slashCommands: boolean
15
- placeholder: string
16
- showWordsCount: boolean
17
- showCharactersCount: boolean
18
- defaultFontFamily: string
19
- fontMeasure: string
20
- rounded: string
21
- customExtensions: toolbarSections
22
- }
2
+ import {
3
+ Extension,
4
+ ExtendableConfig,
5
+ InputRule,
6
+ PasteRule,
7
+ Node,
8
+ Mark,
9
+ markInputRule,
10
+ markPasteRule,
11
+ mergeAttributes
12
+ } from '@tiptap/core'
13
+ import type {
14
+ AnyExtension,
15
+ CanCommands,
16
+ ChainedCommands,
17
+ Command,
18
+ CommandProps,
19
+ Commands,
20
+ Content,
21
+ EditorOptions,
22
+ EditorEvents,
23
+ Extensions,
24
+ ExtensionConfig,
25
+ InputRuleMatch,
26
+ JSONContent,
27
+ MarkConfig,
28
+ NodeConfig,
29
+ PasteRuleMatch,
30
+ Range,
31
+ RawCommands,
32
+ SingleCommands,
33
+ } from '@tiptap/core'
23
34
 
24
- export interface TiptapifyEmits {
25
- [key: string]: ((...args: never[]) => never) | null
26
- 'editor-ready': (options: {
27
- getHTML: () => string
28
- getJSON: () => never
29
- editor: TiptapEditor
30
- }) => void
31
- }
35
+ import '@tiptap/extension-text-style'
36
+ import '@tiptap/extension-list'
37
+ import '@tiptap/extensions'
38
+ import '@tiptap/extension-document'
39
+ import '@tiptap/extension-text'
40
+ import '@tiptap/extension-paragraph'
41
+ import '@tiptap/extension-heading'
42
+ import '@tiptap/extension-bold'
43
+ import '@tiptap/extension-italic'
44
+ import '@tiptap/extension-strike'
45
+ import '@tiptap/extension-code'
46
+ import '@tiptap/extension-blockquote'
47
+ import '@tiptap/extension-hard-break'
48
+ import '@tiptap/extension-horizontal-rule'
49
+ import '@tiptap/extension-typography'
50
+ import '@tiptap/extension-highlight'
51
+ import '@tiptap/extension-image'
52
+ import '@tiptap/extension-youtube'
53
+ import '@tiptap/extension-superscript'
54
+ import '@tiptap/extension-subscript'
55
+ import '@tiptap/extension-text-align'
56
+ import '@tiptap/extension-underline'
57
+ import '@tiptap/extension-table'
58
+ import '@tiptap/extension-code-block-lowlight'
59
+ import '@tiptap/extension-invisible-characters'
32
60
 
33
- export declare const Tiptapify: DefineComponent<
34
- TiptapifyProps,
35
- object,
36
- object,
37
- Record<string, never>,
38
- Record<string, never>,
39
- object,
40
- object,
41
- TiptapifyEmits
42
- >
61
+ import Tiptapify from './src/components/Tiptapify.vue'
62
+ import TiptapifyDialog from './src/components/UI/TiptapifyDialog.vue'
63
+ import * as mdi from '@mdi/js'
43
64
 
44
65
  export interface TiptapifyOptions {
45
66
  i18n?: string
@@ -51,7 +72,43 @@ declare const TiptapifyPlugin: {
51
72
 
52
73
  export default TiptapifyPlugin
53
74
 
54
- export { TiptapEditor }
75
+ export {
76
+ mdi,
77
+ Tiptapify,
78
+ TiptapifyDialog,
79
+ TiptapEditor,
80
+ Extension,
81
+ ExtendableConfig,
82
+ InputRule,
83
+ Mark,
84
+ mergeAttributes,
85
+ markInputRule,
86
+ markPasteRule,
87
+ Node,
88
+ PasteRule,
89
+ }
90
+
91
+ export type {
92
+ AnyExtension,
93
+ CanCommands,
94
+ ChainedCommands,
95
+ Command,
96
+ CommandProps,
97
+ Commands,
98
+ Content,
99
+ EditorOptions,
100
+ EditorEvents,
101
+ Extensions,
102
+ ExtensionConfig,
103
+ InputRuleMatch,
104
+ JSONContent,
105
+ MarkConfig,
106
+ NodeConfig,
107
+ PasteRuleMatch,
108
+ Range,
109
+ RawCommands,
110
+ SingleCommands,
111
+ }
55
112
 
56
113
  declare module '@vue/runtime-core' {
57
114
  interface GlobalComponents {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tiptapify",
3
3
  "types": "./index.d.ts",
4
- "version": "0.1.3",
4
+ "version": "0.1.5",
5
5
  "description": "Tiptap3 editor with Vuetify3 menu implementation",
6
6
  "exports": {
7
7
  ".": {
@@ -62,85 +62,84 @@
62
62
  "author": "Igor Voytovich",
63
63
  "license": "MIT",
64
64
  "repository": "https://github.com/IVoyt/tiptapify",
65
- "packageManager": "pnpm@10.33.4",
65
+ "packageManager": "pnpm@11.8.0",
66
66
  "dependencies": {
67
- "@mdi/js": "^7.4.47",
68
- "@tiptap/core": "^3.23.5",
69
- "@tiptap/extension-blockquote": "^3.23.5",
70
- "@tiptap/extension-bold": "^3.23.5",
71
- "@tiptap/extension-bubble-menu": "^3.23.5",
72
- "@tiptap/extension-code": "^3.23.5",
73
- "@tiptap/extension-code-block": "^3.23.5",
74
- "@tiptap/extension-code-block-lowlight": "^3.23.5",
75
- "@tiptap/extension-color": "^3.23.5",
76
- "@tiptap/extension-document": "^3.23.5",
77
- "@tiptap/extension-floating-menu": "^3.23.5",
78
- "@tiptap/extension-font-family": "^3.23.5",
79
- "@tiptap/extension-hard-break": "^3.23.5",
80
- "@tiptap/extension-heading": "^3.23.5",
81
- "@tiptap/extension-highlight": "^3.23.5",
82
- "@tiptap/extension-horizontal-rule": "^3.23.5",
83
- "@tiptap/extension-image": "^3.23.5",
84
- "@tiptap/extension-invisible-characters": "^3.23.5",
85
- "@tiptap/extension-italic": "^3.23.5",
86
- "@tiptap/extension-link": "^3.23.5",
87
- "@tiptap/extension-list": "^3.23.5",
88
- "@tiptap/extension-list-item": "^3.23.5",
89
- "@tiptap/extension-paragraph": "^3.23.5",
90
- "@tiptap/extension-placeholder": "^3.23.5",
91
- "@tiptap/extension-strike": "^3.23.5",
92
- "@tiptap/extension-subscript": "^3.23.5",
93
- "@tiptap/extension-superscript": "^3.23.5",
94
- "@tiptap/extension-table": "^3.23.5",
95
- "@tiptap/extension-task-item": "^3.23.5",
96
- "@tiptap/extension-task-list": "^3.23.5",
97
- "@tiptap/extension-text": "^3.23.5",
98
- "@tiptap/extension-text-align": "^3.23.5",
99
- "@tiptap/extension-text-style": "^3.23.5",
100
- "@tiptap/extension-typography": "^3.23.5",
101
- "@tiptap/extension-underline": "^3.23.5",
102
- "@tiptap/extension-youtube": "^3.23.5",
103
- "@tiptap/extensions": "^3.23.5",
104
- "@tiptap/pm": "^3.23.5",
105
- "@tiptap/suggestion": "^3.23.5",
106
- "@tiptap/vue-3": "^3.23.5",
67
+ "@floating-ui/dom": "^1.7.6",
68
+ "@tiptap/core": "^3.26.1",
69
+ "@tiptap/extension-blockquote": "^3.26.1",
70
+ "@tiptap/extension-bold": "^3.26.1",
71
+ "@tiptap/extension-bubble-menu": "^3.26.1",
72
+ "@tiptap/extension-code": "^3.26.1",
73
+ "@tiptap/extension-code-block": "^3.26.1",
74
+ "@tiptap/extension-code-block-lowlight": "^3.26.1",
75
+ "@tiptap/extension-color": "^3.26.1",
76
+ "@tiptap/extension-document": "^3.26.1",
77
+ "@tiptap/extension-floating-menu": "^3.26.1",
78
+ "@tiptap/extension-font-family": "^3.26.1",
79
+ "@tiptap/extension-hard-break": "^3.26.1",
80
+ "@tiptap/extension-heading": "^3.26.1",
81
+ "@tiptap/extension-highlight": "^3.26.1",
82
+ "@tiptap/extension-horizontal-rule": "^3.26.1",
83
+ "@tiptap/extension-image": "^3.26.1",
84
+ "@tiptap/extension-invisible-characters": "^3.26.1",
85
+ "@tiptap/extension-italic": "^3.26.1",
86
+ "@tiptap/extension-link": "^3.26.1",
87
+ "@tiptap/extension-list": "^3.26.1",
88
+ "@tiptap/extension-list-item": "^3.26.1",
89
+ "@tiptap/extension-paragraph": "^3.26.1",
90
+ "@tiptap/extension-placeholder": "^3.26.1",
91
+ "@tiptap/extension-strike": "^3.26.1",
92
+ "@tiptap/extension-subscript": "^3.26.1",
93
+ "@tiptap/extension-superscript": "^3.26.1",
94
+ "@tiptap/extension-table": "^3.26.1",
95
+ "@tiptap/extension-task-item": "^3.26.1",
96
+ "@tiptap/extension-task-list": "^3.26.1",
97
+ "@tiptap/extension-text": "^3.26.1",
98
+ "@tiptap/extension-text-align": "^3.26.1",
99
+ "@tiptap/extension-text-style": "^3.26.1",
100
+ "@tiptap/extension-typography": "^3.26.1",
101
+ "@tiptap/extension-underline": "^3.26.1",
102
+ "@tiptap/extension-youtube": "^3.26.1",
103
+ "@tiptap/extensions": "^3.26.1",
104
+ "@tiptap/pm": "^3.26.1",
105
+ "@tiptap/suggestion": "^3.26.1",
106
+ "@tiptap/vue-3": "^3.26.1",
107
107
  "emoji.json": "^16.0.0",
108
108
  "highlight.js": "^11.11.1",
109
- "linkifyjs": "^4.3.2",
109
+ "linkifyjs": "^4.3.3",
110
110
  "lowlight": "^3.3.0"
111
111
  },
112
112
  "peerDependencies": {
113
- "vue": "^3.5.14",
114
- "vuetify": "^3.8.5 || ^4.0.0",
115
- "vue-i18n": "^11.3.0"
113
+ "@mdi/js": "^7.4.47",
114
+ "vue": "^3.5.38",
115
+ "vue-i18n": "^11.3.0",
116
+ "vuetify": "^3.8.5 || ^4.0.0"
116
117
  },
117
118
  "devDependencies": {
118
- "@intlify/unplugin-vue-i18n": "^11.1.1",
119
- "@rollup/plugin-alias": "^5.1.1",
120
- "@types/node": "^22.19.15",
121
- "@vitejs/plugin-vue": "^6.0.5",
119
+ "@intlify/unplugin-vue-i18n": "^11.2.3",
120
+ "@types/node": "^25.9.3",
121
+ "@vitejs/plugin-vue": "^6.0.7",
122
122
  "@vitejs/plugin-vue-jsx": "^5.1.5",
123
- "eslint": "^10.4.0",
124
- "eslint-import-resolver-typescript": "^4.4.4",
123
+ "eslint": "^10.5.0",
124
+ "eslint-import-resolver-typescript": "^4.4.5",
125
125
  "eslint-plugin-case-police": "^2.2.1",
126
126
  "eslint-plugin-import": "^2.32.0",
127
127
  "eslint-plugin-promise": "^7.3.0",
128
- "eslint-plugin-regexp": "2.7.0",
129
- "eslint-plugin-sonarjs": "1.0.4",
130
- "eslint-plugin-unicorn": "^64.0.0",
131
- "eslint-plugin-vue": "^10.9.1",
132
- "rollup-plugin-tsconfig-paths": "^1.5.2",
133
- "sass-embedded": "^1.98.0",
134
- "stylelint": "^17.12.0",
135
- "stylelint-config-standard-scss": "14.0.0",
136
- "tsx": "^4.21.0",
128
+ "eslint-plugin-regexp": "3.1.0",
129
+ "eslint-plugin-sonarjs": "2.0.4",
130
+ "eslint-plugin-unicorn": "^67.0.0",
131
+ "eslint-plugin-vue": "^10.9.2",
132
+ "sass-embedded": "^1.100.0",
133
+ "stylelint": "^17.13.0",
134
+ "stylelint-config-standard-scss": "17.0.0",
135
+ "tsx": "^4.22.4",
137
136
  "typescript": "^6.0.3",
138
- "typescript-eslint": "^8.59.4",
139
- "unplugin-vue-components": "^28.8.0",
140
- "vite": "^7.3.1",
137
+ "typescript-eslint": "^8.61.1",
138
+ "unplugin-vue-components": "^32.1.0",
139
+ "vite": "^8.0.16",
141
140
  "vite-plugin-vuetify": "^2.1.3",
142
141
  "vite-svg-loader": "^5.1.1",
143
- "vite-tsconfig-paths": "^5.1.4",
144
- "vue-tsc": "^3.2.6"
142
+ "vue-eslint-parser": "^10.4.1",
143
+ "vue-tsc": "^3.3.5"
145
144
  }
146
145
  }
@@ -1,13 +1,14 @@
1
1
  <script setup lang="ts">
2
- import { Editor } from "@tiptap/vue-3";
3
- import { computed, inject, ref, Ref } from "vue";
2
+ import { Editor } from '@tiptap/vue-3'
3
+ import { computed, inject, ref, Ref } from 'vue'
4
+ import { ComposerTranslation } from 'vue-i18n'
4
5
 
5
6
  const props = defineProps({
6
7
  showWordsCount: { type: Boolean, default: true },
7
8
  showCharactersCount: { type: Boolean, default: true },
8
9
  })
9
10
 
10
- const { t } = inject('tiptapifyI18n') as any
11
+ const { t } = inject('tiptapifyI18n') as { t: ComposerTranslation }
11
12
 
12
13
  const editor = inject('tiptapifyEditor') as Ref<Editor>
13
14
 
@@ -1,12 +1,12 @@
1
1
  <script setup lang="ts">
2
- import { Editor } from "@tiptap/vue-3";
3
- import { computed, inject, Ref, ref } from "vue";
2
+ import { Editor } from '@tiptap/vue-3'
3
+ import { computed, inject, Ref, ref } from 'vue'
4
4
  import { BubbleMenu } from '@tiptap/vue-3/menus'
5
5
  import * as mdi from '@mdi/js'
6
6
 
7
7
  defineProps({
8
- variant: { type: String, default () { return 'flat' }},
9
- theme: { type: String, default () { return 'light' }},
8
+ variant: { type: String, default () { return 'flat' } },
9
+ theme: { type: String, default () { return 'light' } },
10
10
  })
11
11
 
12
12
  const editor = inject('tiptapifyEditor') as Ref<Editor>
@@ -85,19 +85,19 @@ const items = ref([
85
85
 
86
86
  <template>
87
87
  <BubbleMenu
88
- v-if="editor"
89
- :editor="editor"
90
- :options="{ placement: 'bottom' }"
91
- :shouldShow="({ editor, view, state, from, to }) => {
92
- if (editor.isActive('image') || editor.isActive('code') || editor.isActive('codeBlock')) {
93
- return false
94
- }
88
+ v-if="editor"
89
+ :editor="editor"
90
+ :options="{ placement: 'bottom' }"
91
+ :should-show="({ editor, view, state, from, to }) => {
92
+ if (editor.isActive('image') || editor.isActive('code') || editor.isActive('codeBlock')) {
93
+ return false
94
+ }
95
95
 
96
- const docSize = editor.state.doc.content.size
97
- const isAllSelected = from === 0 && to === docSize
96
+ const docSize = editor.state.doc.content.size
97
+ const isAllSelected = from === 0 && to === docSize
98
98
 
99
- return (from !== to) && !isAllSelected
100
- }"
99
+ return (from !== to) && !isAllSelected
100
+ }"
101
101
  >
102
102
  <div class="bubble-menu">
103
103
  <VCard>
@@ -105,7 +105,7 @@ const items = ref([
105
105
  <VToolbar :theme="theme" density="compact" height="auto" class="p-0">
106
106
  <VToolbarItems>
107
107
  <VBtnGroup divided density="compact">
108
- <VBtn v-for="(item, key) in items" :key="key" v-bind="item.props" @click="item.click" size="x-small">
108
+ <VBtn v-for="(item, key) in items" :key="key" v-bind="item.props" size="x-small" @click="item.click">
109
109
  <VIcon :icon="item.icon" size="20" />
110
110
  </VBtn>
111
111
  </VBtnGroup>
@@ -1,12 +1,12 @@
1
1
  <script setup lang="ts">
2
- import { Editor } from "@tiptap/vue-3";
3
- import { inject, Ref } from "vue";
2
+ import { Editor } from '@tiptap/vue-3'
3
+ import { inject, Ref } from 'vue'
4
4
  import { FloatingMenu } from '@tiptap/vue-3/menus'
5
5
  import * as mdi from '@mdi/js'
6
6
 
7
7
  defineProps({
8
- variant: { type: String, default () { return '' }},
9
- theme: { type: String, default () { return 'light' }},
8
+ variant: { type: String, default () { return '' } },
9
+ theme: { type: String, default () { return 'light' } },
10
10
  })
11
11
 
12
12
  const editor = inject('tiptapifyEditor') as Ref<Editor>
@@ -21,23 +21,23 @@ const editor = inject('tiptapifyEditor') as Ref<Editor>
21
21
  <VToolbarItems>
22
22
  <VBtnGroup divided density="compact">
23
23
  <VBtn
24
- @click="editor.chain().focus().toggleHeading({ level: 1 }).run()"
25
- :color="`${editor.isActive('heading', { level: 1 }) ? 'primary' : ''}`"
26
- size="small"
24
+ :color="`${editor.isActive('heading', { level: 1 }) ? 'primary' : ''}`"
25
+ size="small"
26
+ @click="editor.chain().focus().toggleHeading({ level: 1 }).run()"
27
27
  >
28
28
  <VIcon :icon="mdi['mdiFormatHeader1']" size="16" />
29
29
  </VBtn>
30
30
  <VBtn
31
- @click="editor.chain().focus().toggleHeading({ level: 2 }).run()"
32
- :color="`${editor.isActive('heading', { level: 2 }) ? 'primary' : ''}`"
33
- size="small"
31
+ :color="`${editor.isActive('heading', { level: 2 }) ? 'primary' : ''}`"
32
+ size="small"
33
+ @click="editor.chain().focus().toggleHeading({ level: 2 }).run()"
34
34
  >
35
35
  <VIcon :icon="mdi['mdiFormatHeader2']" size="16" />
36
36
  </VBtn>
37
37
  <VBtn
38
- @click="editor.chain().focus().toggleBulletList().run()"
39
- :color="`${editor.isActive('bulletList') ? 'primary' : ''}`"
40
- size="small"
38
+ :color="`${editor.isActive('bulletList') ? 'primary' : ''}`"
39
+ size="small"
40
+ @click="editor.chain().focus().toggleBulletList().run()"
41
41
  >
42
42
  <VIcon :icon="mdi['mdiFormatListBulleted']" size="16" />
43
43
  </VBtn>
@@ -6,6 +6,7 @@ import { SlashCommandsConfig } from '@tiptapify/types/slashCommandsTypes'
6
6
  import { computed, onBeforeUnmount, PropType, provide, ref, ShallowRef } from 'vue'
7
7
  import { default as Toolbar } from '@tiptapify/components/Toolbar/Index.vue'
8
8
  import { Editor, EditorContent } from '@tiptap/vue-3'
9
+ import { TiptapifyEditor, variantBtnTypes, variantFieldTypes } from '@tiptapify/types/editor'
9
10
  import MenuBubble from '@tiptapify/components/MenuBubble.vue'
10
11
  import MenuFloating from '@tiptapify/components/MenuFloating.vue'
11
12
 
@@ -18,12 +19,12 @@ import { useTheme } from 'vuetify/framework'
18
19
 
19
20
  const props = defineProps({
20
21
  locale: { type: String, default () { return 'en' } },
21
- content: String|Object,
22
- height: { type: [Number,String], default () { return null } },
23
- variantBtn: { type: String, default () { return defaults.variantBtn } },
24
- variantField: { type: String, default () { return defaults.variantField } },
22
+ content: { type: [String, Object] as PropType<string | Record<string, never>>, required: true },
23
+ height: { type: [Number, String], default () { return null } },
24
+ variantBtn: { type: String as PropType<variantBtnTypes>, default() { return defaults.variantBtn } },
25
+ variantField: { type: String as PropType<variantFieldTypes>, default() { return defaults.variantField } },
25
26
  toolbar: { type: Boolean, default () { return true } },
26
- items: { type: [Array, Object as PropType<itemsPropType>], 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 } },
@@ -36,8 +37,13 @@ const props = defineProps({
36
37
  rounded: { type: String, default () { return '0' } },
37
38
  customExtensions: { type: Array as PropType<toolbarSections>, default() { return [] } },
38
39
  interactiveStyles: { type: Boolean, default() { return true } },
40
+ loading: { type: Boolean, default() { return false } },
41
+ loadingColor: { type: String, default() { return 'default' } },
42
+ loadingHeight: { type: String, default() { return '1px' } },
39
43
  })
40
44
 
45
+ const loadingProgress = ref(0)
46
+
41
47
  const { t } = useI18n()
42
48
 
43
49
  const appTheme = useTheme()
@@ -53,8 +59,8 @@ const editor: ShallowRef<Editor | undefined> = getTiptapEditor(
53
59
  props.slashCommands,
54
60
  props.customExtensions,
55
61
  contentChanged,
56
- (editorInstance) => {
57
- editorInstance.interactiveStyles = props.interactiveStyles
62
+ (editorInstance: Editor) => {
63
+ (<TiptapifyEditor>editorInstance).interactiveStyles = props.interactiveStyles
58
64
  emit('editor-ready', {
59
65
  editor: editorInstance,
60
66
  getHTML: () => editorInstance.getHTML(),
@@ -70,6 +76,15 @@ provide('tiptapifyI18n', { t })
70
76
 
71
77
  editor.value?.chain().setFontFamily(props.defaultFontFamily).run()
72
78
 
79
+ const computeResizableHeight = computed(() => {
80
+ let height = props.height
81
+ if (typeof height === 'string') {
82
+ height = parseInt(height)
83
+ }
84
+
85
+ return height > 0 ? `height: ${height}px` : ''
86
+ })
87
+
73
88
  onBeforeUnmount(() => {
74
89
  editor.value?.destroy()
75
90
  })
@@ -77,7 +92,7 @@ onBeforeUnmount(() => {
77
92
 
78
93
  <template>
79
94
  <div :id="`tiptapify-editor-${editor?.instanceId}`">
80
- <div>
95
+ <div :class="`border border-t-0 rounded-t-${rounded} rounded-b-${rounded}`">
81
96
  <template v-if="toolbar">
82
97
  <Toolbar
83
98
  v-if="editor"
@@ -92,17 +107,17 @@ onBeforeUnmount(() => {
92
107
  />
93
108
  </template>
94
109
 
95
- <div :class="`border border-t-0 rounded-b-${rounded}`">
96
- <div class="pa-2 tiptapify-container resizable" :style="`${height > 0 ? `height: ${height}px` : ''}`">
97
- <MenuFloating v-if="floatingMenu" :variant="variantBtn" :theme="currentTheme" />
110
+ <VProgressLinear v-model="loadingProgress" :color="loadingColor" :height="loadingHeight" :indeterminate="loading" />
98
111
 
99
- <MenuBubble v-if="bubbleMenu" :variant="variantBtn" :theme="currentTheme" />
112
+ <div class="pa-2 tiptapify-container resizable" :style="computeResizableHeight">
113
+ <MenuFloating v-if="floatingMenu" :variant="variantBtn" :theme="currentTheme" />
100
114
 
101
- <EditorContent :editor="editor" class="tiptapify-editor" />
102
- </div>
115
+ <MenuBubble v-if="bubbleMenu" :variant="variantBtn" :theme="currentTheme" />
103
116
 
104
- <Footer :show-words-count="showWordsCount" :show-characters-count="showCharactersCount" />
117
+ <EditorContent :editor="editor" class="tiptapify-editor" />
105
118
  </div>
119
+
120
+ <Footer :show-words-count="showWordsCount" :show-characters-count="showCharactersCount" />
106
121
  </div>
107
122
  </div>
108
123
  </template>
@@ -165,7 +180,7 @@ onBeforeUnmount(() => {
165
180
  font-size: .875rem;
166
181
  font-weight: 500;
167
182
  line-height: 1.15;
168
- margin: none;
183
+ margin: unset;
169
184
  padding: .375rem .625rem;
170
185
  transition: all .2s cubic-bezier(.65,.05,.36,1);
171
186
  }
@@ -1,16 +1,17 @@
1
1
  <script setup lang="ts">
2
- import { Editor } from "@tiptap/vue-3";
3
- import Items from "@tiptapify/components/Toolbar/Items.vue";
4
- import defaults from "@tiptapify/constants/defaults";
2
+ import { Editor } from '@tiptap/vue-3'
3
+ import Items from '@tiptapify/components/Toolbar/Items.vue'
4
+ import defaults from '@tiptapify/constants/defaults'
5
+ import { variantBtnTypes, variantFieldTypes } from '@tiptapify/types/editor'
5
6
  import { computed, inject, PropType, Ref } from 'vue'
6
7
  import { itemsPropType, toolbarSections } from '@tiptapify/types/toolbarTypes'
7
8
 
8
- import { default as items, availableItems } from "@tiptapify/components/Toolbar/items";
9
+ import { default as toolbarItemsGroups, availableItems } from '@tiptapify/components/Toolbar/items'
9
10
 
10
11
  const props = defineProps({
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 [] } },
12
+ variantBtn: { type: String as PropType<variantBtnTypes>, default() { return defaults.variantBtn } },
13
+ variantField: { type: String as PropType<variantFieldTypes>, default() { return defaults.variantField } },
14
+ items: { type: [Array, Object] as PropType<itemsPropType>, default() { return [] } },
14
15
  itemsExclude: { type: Boolean, default() { return false } },
15
16
  fontMeasure: { type: String, default () { return 'px' } },
16
17
  customFonts: { type: Array<string>, default () { return [] } },
@@ -24,20 +25,23 @@ const props = defineProps({
24
25
  const editor = inject('tiptapifyEditor') as Ref<Editor>
25
26
 
26
27
  const propsItems = computed(() => props.items)
27
- const propsItemsIsList = computed(() => Array.isArray(propsItems.value))
28
28
  const propsItemsExclude = computed(() => props.itemsExclude)
29
29
 
30
30
  // this prevents from overriding the default items
31
- let toolbarItems = [...Object.values(items)]
31
+ let toolbarItems = [...Object.values(toolbarItemsGroups)]
32
32
  const availableItemsKeys = Object.keys(availableItems)
33
33
 
34
34
  type toolbarItemsType = { [key: string]: { section: string, group: boolean, components: any[] } }
35
- propsItemsExclude.value ? prepareExcludeToolbarItems() : prepareToolbarItems()
35
+ if (propsItemsExclude.value) {
36
+ prepareExcludeToolbarItems()
37
+ } else {
38
+ prepareToolbarItems()
39
+ }
36
40
 
37
41
  function prepareToolbarItems() {
38
42
  const _toolbarItems: toolbarItemsType = {}
39
43
 
40
- if (!propsItemsIsList.value) {
44
+ if (!Array.isArray(propsItems.value)) {
41
45
  for (const propsItemSection in propsItems.value as itemsPropType) {
42
46
  if (propsItems.value[propsItemSection].length === 0) {
43
47
  continue
@@ -94,15 +98,15 @@ function prepareExcludeToolbarItems() {
94
98
  toolbarItems = Object.values(_toolbarItems)
95
99
  }
96
100
 
97
- function addToolbarItem(_toolbarItems: toolbarItemsType, itemsList: any, itemTitle: string, group: boolean|null = null): boolean {
101
+ function addToolbarItem(_toolbarItems: toolbarItemsType, itemsList: Array<any>, itemTitle: string, group: boolean|null = null): boolean {
98
102
  const item = itemTitle.split(':')
99
103
  const _itemTitle = item[0]
100
104
  const _itemOptions = item[1] ? item[1].split(',') : []
101
105
 
102
106
  const itemSection = availableItems[_itemTitle]
103
- const section = items[itemSection]
107
+ const section = toolbarItemsGroups[itemSection]
104
108
 
105
- const component = section?.components.find((component: any) => component.name === _itemTitle)
109
+ const component = section?.components.find((component: { name: string }) => component.name === _itemTitle)
106
110
 
107
111
  let itemExists = itemsList.includes(itemTitle)
108
112
  itemExists = propsItemsExclude.value ? itemExists : !itemExists
@@ -111,7 +115,7 @@ function addToolbarItem(_toolbarItems: toolbarItemsType, itemsList: any, itemTit
111
115
  }
112
116
 
113
117
  if (group === null) {
114
- group = section.group
118
+ group = section.group ?? true
115
119
  }
116
120
 
117
121
  if (typeof _toolbarItems[itemSection] === 'undefined') {
@@ -123,7 +127,7 @@ function addToolbarItem(_toolbarItems: toolbarItemsType, itemsList: any, itemTit
123
127
  }
124
128
 
125
129
  if (_itemTitle === 'heading' && _itemOptions.length > 0) {
126
- const paragraphIndex = _itemOptions.findIndex((item: any) => item === 'p')
130
+ const paragraphIndex = _itemOptions.findIndex((item: string) => item === 'p')
127
131
  const withParagraph = paragraphIndex > -1
128
132
  if (withParagraph) {
129
133
  _itemOptions.splice(paragraphIndex, 1)
@@ -131,7 +135,7 @@ function addToolbarItem(_toolbarItems: toolbarItemsType, itemsList: any, itemTit
131
135
 
132
136
  component.props = {
133
137
  withParagraph,
134
- customHeadingLevels: _itemOptions,
138
+ customHeadingLevels: _itemOptions.map((item: string) => parseInt(item)),
135
139
  }
136
140
  }
137
141