tiptapify 0.0.11 → 0.0.13

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 (107) hide show
  1. package/README.md +9 -4
  2. package/dist/tiptapify.css +1 -1
  3. package/dist/tiptapify.mjs +47819 -28736
  4. package/dist/tiptapify.umd.js +78 -38
  5. package/index.d.ts +2 -2
  6. package/package.json +49 -45
  7. package/src/components/MenuBubble.vue +8 -8
  8. package/src/components/Tiptapify.vue +4 -5
  9. package/src/components/Toolbar/Group.vue +2 -2
  10. package/src/components/Toolbar/GroupBtn.vue +11 -8
  11. package/src/components/Toolbar/GroupDropdown.vue +3 -17
  12. package/src/components/Toolbar/Index.vue +13 -10
  13. package/src/components/Toolbar/Items.vue +3 -6
  14. package/src/components/Toolbar/Toggle.vue +2 -4
  15. package/src/components/Toolbar/defaultExtensionComponents.ts +34 -13
  16. package/src/components/Toolbar/items.ts +43 -60
  17. package/src/components/UI/BtnIcon.vue +24 -0
  18. package/src/components/UI/{Dialog.vue → TiptapifyDialog.vue} +4 -3
  19. package/src/components/editorExtensions.ts +16 -1
  20. package/src/components/index.ts +8 -2
  21. package/src/composables/Toolbar/Actions/useRedo.ts +23 -0
  22. package/src/composables/Toolbar/Actions/useUndo.ts +23 -0
  23. package/src/composables/Toolbar/Alignment/useAlignmentCenter.ts +24 -0
  24. package/src/composables/Toolbar/Alignment/useAlignmentJustify.ts +24 -0
  25. package/src/composables/Toolbar/Alignment/useAlignmentLeft.ts +24 -0
  26. package/src/composables/Toolbar/Alignment/useAlignmentRight.ts +24 -0
  27. package/src/composables/Toolbar/Format/useBold.ts +24 -0
  28. package/src/composables/Toolbar/Format/useItalic.ts +24 -0
  29. package/src/composables/Toolbar/Format/useStrike.ts +24 -0
  30. package/src/composables/Toolbar/Format/useUnderline.ts +24 -0
  31. package/src/composables/Toolbar/FormatExtra/useBlockquote.ts +24 -0
  32. package/src/composables/Toolbar/FormatExtra/useCode.ts +24 -0
  33. package/src/composables/Toolbar/FormatExtra/useCodeBlock.ts +24 -0
  34. package/src/composables/Toolbar/FormatExtra/useSub.ts +24 -0
  35. package/src/composables/Toolbar/FormatExtra/useSup.ts +24 -0
  36. package/src/composables/Toolbar/List/useBullet.ts +23 -0
  37. package/src/composables/Toolbar/List/useIndent.ts +24 -0
  38. package/src/composables/Toolbar/List/useNumbered.ts +23 -0
  39. package/src/composables/Toolbar/List/useOutdent.ts +24 -0
  40. package/src/composables/Toolbar/List/useTask.ts +23 -0
  41. package/src/composables/Toolbar/Media/useEmoji.ts +20 -0
  42. package/src/composables/Toolbar/Media/useImage.ts +24 -0
  43. package/src/composables/Toolbar/Media/useLink.ts +24 -0
  44. package/src/composables/Toolbar/Media/useTable.ts +188 -0
  45. package/src/composables/Toolbar/Misc/useBreak.ts +21 -0
  46. package/src/composables/Toolbar/Misc/useFormatClear.ts +23 -0
  47. package/src/composables/Toolbar/Misc/useInvisibleCharacters.ts +23 -0
  48. package/src/composables/Toolbar/Misc/useLine.ts +21 -0
  49. package/src/composables/Toolbar/Misc/usePreview.ts +20 -0
  50. package/src/composables/Toolbar/Misc/useSource.ts +21 -0
  51. package/src/composables/Toolbar/Style/useColor.ts +36 -0
  52. package/src/composables/Toolbar/Style/useFontFamily.ts +49 -0
  53. package/src/composables/Toolbar/Style/useFontSize.ts +50 -0
  54. package/src/composables/Toolbar/Style/useHeading.ts +64 -0
  55. package/src/composables/Toolbar/Style/useHighlight.ts +36 -0
  56. package/src/composables/Toolbar/Style/useLineHeight.ts +49 -0
  57. package/src/composables/Toolbar/useActionsItems.ts +5 -31
  58. package/src/composables/Toolbar/useAlignmentItems.ts +9 -59
  59. package/src/composables/Toolbar/useFormatExtraItems.ts +11 -72
  60. package/src/composables/Toolbar/useFormatItems.ts +9 -59
  61. package/src/composables/Toolbar/useListItems.ts +11 -69
  62. package/src/composables/Toolbar/useMediaItems.ts +9 -209
  63. package/src/composables/Toolbar/useMiscItems.ts +13 -58
  64. package/src/composables/Toolbar/useStyleItems.ts +14 -228
  65. package/src/extensions/components/Emoji.vue +109 -0
  66. package/src/extensions/components/ImageDialog.vue +7 -3
  67. package/src/extensions/components/LinkDialog.vue +7 -3
  68. package/src/extensions/components/PreviewDialog.vue +11 -4
  69. package/src/extensions/components/ShowSourceDialog.vue +7 -4
  70. package/src/extensions/components/StyleColor.vue +2 -2
  71. package/src/extensions/components/slashCommands/CommandsList.vue +1 -4
  72. package/src/extensions/emoji/activities.ts +770 -0
  73. package/src/extensions/emoji/animals_and_nature.ts +1330 -0
  74. package/src/extensions/emoji/component.ts +74 -0
  75. package/src/extensions/emoji/flags.ts +2210 -0
  76. package/src/extensions/emoji/food_and_drink.ts +1066 -0
  77. package/src/extensions/emoji/index.ts +63 -0
  78. package/src/extensions/emoji/objects.ts +2514 -0
  79. package/src/extensions/emoji/people_and_body.ts +3986 -0
  80. package/src/extensions/emoji/smileys_and_emotion.ts +1482 -0
  81. package/src/extensions/emoji/symbols.ts +2242 -0
  82. package/src/extensions/emoji/travel_and_places.ts +2138 -0
  83. package/src/extensions/image.ts +2 -1
  84. package/src/extensions/link.ts +2 -1
  85. package/src/extensions/preview.ts +2 -1
  86. package/src/extensions/view-source.ts +2 -1
  87. package/src/i18n/index.ts +1 -0
  88. package/src/i18n/locales/ch.json +14 -1
  89. package/src/i18n/locales/cz.json +14 -1
  90. package/src/i18n/locales/de.json +14 -1
  91. package/src/i18n/locales/en.json +14 -1
  92. package/src/i18n/locales/es.json +14 -1
  93. package/src/i18n/locales/fr.json +14 -1
  94. package/src/i18n/locales/it.json +14 -1
  95. package/src/i18n/locales/la.json +14 -1
  96. package/src/i18n/locales/lt.json +14 -1
  97. package/src/i18n/locales/nl.json +14 -1
  98. package/src/i18n/locales/pl.json +14 -1
  99. package/src/i18n/locales/pt.json +14 -1
  100. package/src/i18n/locales/ru.json +14 -1
  101. package/src/i18n/locales/se.json +14 -1
  102. package/src/i18n/locales/ua.json +14 -1
  103. package/src/index.ts +3 -1
  104. package/src/types/extensionComponents.ts +22 -0
  105. package/src/types/toolbarItems.ts +43 -0
  106. package/src/types/toolbarSections.ts +11 -0
  107. package/src/types/overridable-extensions.ts +0 -6
@@ -1,213 +1,13 @@
1
- import * as mdi from "@mdi/js";
2
- import { Editor } from "@tiptap/vue-3";
3
- import TableBuilder from "@tiptapify/extensions/components/TableBuilder.vue";
4
- import { computed, markRaw } from "vue";
5
- import { useI18n } from "vue-i18n";
1
+ import { useImage } from "@tiptapify/composables/Toolbar/Media/useImage";
2
+ import { useEmoji } from "@tiptapify/composables/Toolbar/Media/useEmoji";
3
+ import { useLink } from "@tiptapify/composables/Toolbar/Media/useLink";
4
+ import { useTable } from "@tiptapify/composables/Toolbar/Media/useTable";
6
5
 
7
- export function useMediaItems(editor: Editor) {
8
- const { t } = useI18n();
6
+ export function useMediaItems() {
9
7
  return {
10
- link: {
11
- name: computed(() => t('media.link')),
12
- tooltip: computed(() => t('media.link')),
13
- icon: computed(() => editor.isActive('tiptapifyLink') ? mdi.mdiLinkOff : mdi.mdiLink),
14
- enabled: true,
15
- props: {
16
- color: computed(() => editor.isActive('tiptapifyLink') ? 'primary' : ''),
17
- disabled: computed(() => editor.isActive('code') || editor.isActive('codeBlock')),
18
- },
19
- attrs: {
20
- click: () => editor.commands.showLink()
21
- }
22
- },
23
- image: {
24
- name: computed(() => t('media.image')),
25
- tooltip: computed(() => t('media.image')),
26
- icon: mdi.mdiImage,
27
- enabled: true,
28
- props: {
29
- color: computed(() => editor.isActive('image') ? 'primary' : ''),
30
- disabled: computed(() => editor.isActive('code') || editor.isActive('codeBlock')),
31
- },
32
- attrs: {
33
- click: () => editor.commands.showTiptapifyImage()
34
- }
35
- },
36
- table: {
37
- name: 'tables',
38
- tooltip: computed(() => t('media.tables.table')),
39
- icon: mdi.mdiTable,
40
- modelValue: false,
41
- enabled: true,
42
- props: {
43
- color: computed(() => editor.isActive('table') ? 'primary' : ''),
44
- disabled: computed(() => !editor.can().chain().focus().insertTable().run()),
45
- },
46
- children: [
47
- {
48
- name: 'insert table',
49
- tooltip: computed(() => t('media.tables.insertTable')),
50
- icon: mdi.mdiTablePlus,
51
- enabled: true,
52
- props: {
53
- disabled: computed(() => !editor.can().chain().focus().insertTable().run()),
54
- activator: 'parent',
55
- openOnClick: true,
56
- openOnHover: false,
57
- closeOnContentClick: false,
58
- submenu: true
59
- },
60
- component: markRaw(TableBuilder),
61
- },
62
- {
63
- name: 'delete table',
64
- tooltip: computed(() => t('media.tables.deleteTable')),
65
- icon: mdi.mdiTableMinus,
66
- enabled: true,
67
- props: {
68
- disabled: computed(() => !editor.can().chain().focus().deleteTable().run()),
69
- },
70
- attrs: {
71
- click: () => editor.chain().focus().deleteTable().run()
72
- }
73
- },
74
- {
75
- name: 'table row',
76
- tooltip: computed(() => t('media.tables.row')),
77
- icon: mdi.mdiTableRow,
78
- enabled: true,
79
- props: {
80
- disabled: computed(
81
- () =>
82
- !editor.can().chain().focus().addRowBefore().run() &&
83
- !editor.can().chain().focus().addRowAfter().run() &&
84
- !editor.can().chain().focus().deleteRow().run()
85
- ),
86
- openOnHover: true,
87
- openOnClick: true,
88
- activator: 'parent',
89
- submenu: true
90
- },
91
- children: [
92
- {
93
- name: 'insert row before',
94
- tooltip: computed(() => t('media.tables.insertRowBefore')),
95
- icon: mdi.mdiTableRowPlusBefore,
96
- enabled: true,
97
- props: {
98
- disabled: computed(() => !editor.can().chain().focus().addRowBefore().run()),
99
- },
100
- attrs: {
101
- click: () => editor.chain().focus().addRowBefore().run()
102
- }
103
- },
104
- {
105
- name: 'insert row after',
106
- tooltip: computed(() => t('media.tables.insertRowAfter')),
107
- icon: mdi.mdiTableRowPlusAfter,
108
- enabled: true,
109
- props: {
110
- disabled: computed(() => !editor.can().chain().focus().addRowAfter().run()),
111
- },
112
- attrs: {
113
- click: () => editor.chain().focus().addRowAfter().run()
114
- }
115
- },
116
- {
117
- name: 'delete row',
118
- tooltip: computed(() => t('media.tables.deleteRow')),
119
- icon: mdi.mdiTableRowRemove,
120
- enabled: true,
121
- props: {
122
- disabled: computed(() => !editor.can().chain().focus().deleteRow().run()),
123
- },
124
- attrs: {
125
- click: () => editor.chain().focus().deleteRow().run()
126
- }
127
- },
128
- ]
129
- },
130
- {
131
- name: 'column',
132
- tooltip: computed(() => t('media.tables.col')),
133
- icon: mdi.mdiTableColumn,
134
- enabled: true,
135
- props: {
136
- disabled: computed(
137
- () =>
138
- !editor.can().chain().focus().addColumnBefore().run() &&
139
- !editor.can().chain().focus().addColumnAfter().run() &&
140
- !editor.can().chain().focus().deleteColumn().run()
141
- ),
142
- openOnHover: true,
143
- openOnClick: true,
144
- activator: 'parent',
145
- submenu: true
146
- },
147
- children: [
148
- {
149
- name: 'insert col before',
150
- tooltip: computed(() => t('media.tables.insertColBefore')),
151
- icon: mdi.mdiTableColumnPlusBefore,
152
- enabled: true,
153
- props: {
154
- disabled: computed(() => !editor.can().chain().focus().addColumnBefore().run()),
155
- },
156
- attrs: {
157
- click: () => editor.chain().focus().addColumnBefore().run()
158
- }
159
- },
160
- {
161
- name: 'insert column after',
162
- tooltip: computed(() => t('media.tables.insertColAfter')),
163
- icon: mdi.mdiTableColumnPlusAfter,
164
- enabled: true,
165
- props: {
166
- disabled: computed(() => !editor.can().chain().focus().addColumnAfter().run()),
167
- },
168
- attrs: {
169
- click: () => editor.chain().focus().addColumnAfter().run()
170
- }
171
- },
172
- {
173
- name: 'delete column',
174
- tooltip: computed(() => t('media.tables.deleteCol')),
175
- icon: mdi.mdiTableColumnRemove,
176
- enabled: true,
177
- props: {
178
- disabled: computed(() => !editor.can().chain().focus().deleteColumn().run()),
179
- },
180
- attrs: {
181
- click: () => editor.chain().focus().deleteColumn().run()
182
- }
183
- }
184
- ]
185
- },
186
- {
187
- name: 'merge cells',
188
- tooltip: computed(() => t('media.tables.mergeCells')),
189
- icon: mdi.mdiTableMergeCells,
190
- enabled: true,
191
- props: {
192
- disabled: computed(() => !editor.can().chain().focus().mergeCells().run()),
193
- },
194
- attrs: {
195
- click: () => editor.chain().focus().mergeCells().run()
196
- }
197
- },
198
- {
199
- name: 'split cell',
200
- tooltip: computed(() => t('media.tables.splitCell')),
201
- icon: mdi.mdiTableSplitCell,
202
- enabled: true,
203
- props: {
204
- disabled: computed(() => !editor.can().chain().focus().splitCell().run()),
205
- },
206
- attrs: {
207
- click: () => editor.chain().focus().splitCell().run()
208
- }
209
- }
210
- ]
211
- }
8
+ link: useLink(),
9
+ image: useImage(),
10
+ emoji: useEmoji(),
11
+ table: useTable()
212
12
  }
213
13
  }
@@ -1,62 +1,17 @@
1
- import * as mdi from "@mdi/js";
2
- import { Editor } from "@tiptap/vue-3";
3
- import { computed } from "vue";
4
- import { useI18n } from "vue-i18n";
5
-
6
- export function useMiscItems(editor: Editor) {
7
- const { t } = useI18n();
1
+ import { useBreak } from "@tiptapify/composables/Toolbar/Misc/useBreak";
2
+ import { useFormatClear } from "@tiptapify/composables/Toolbar/Misc/useFormatClear";
3
+ import { useInvisibleCharacters } from "@tiptapify/composables/Toolbar/Misc/useInvisibleCharacters";
4
+ import { useLine } from "@tiptapify/composables/Toolbar/Misc/useLine";
5
+ import { usePreview } from "@tiptapify/composables/Toolbar/Misc/usePreview";
6
+ import { useSource } from "@tiptapify/composables/Toolbar/Misc/useSource";
8
7
 
8
+ export function useMiscItems() {
9
9
  return {
10
- line: {
11
- name: 'line',
12
- tooltip: computed(() => t('format.line')),
13
- icon: mdi.mdiMinus,
14
- enabled: true,
15
- props: {},
16
- attrs: {
17
- click: () => editor.chain().focus().setHorizontalRule().run()
18
- }
19
- },
20
- break: {
21
- name: 'break',
22
- tooltip: computed(() => t('format.break')),
23
- icon: mdi.mdiFormatPageBreak,
24
- enabled: true,
25
- props: {},
26
- attrs: {
27
- click: () => editor.chain().focus().setHardBreak().run()
28
- }
29
- },
30
- source: {
31
- name: 'source',
32
- tooltip: computed(() => t('misc.source')),
33
- icon: mdi.mdiCodeTags,
34
- enabled: true,
35
- props: {},
36
- attrs: {
37
- click: () => editor.commands.showSource()
38
- }
39
- },
40
- preview: {
41
- name: 'preview',
42
- tooltip: computed(() => t('misc.preview')),
43
- icon: mdi.mdiFileEyeOutline,
44
- enabled: true,
45
- attrs: {
46
- click: () => editor.commands.showPreview()
47
- }
48
- },
49
- formatClear: {
50
- name: 'format clear',
51
- tooltip: computed(() => t('format.formatClear')),
52
- icon: mdi.mdiFormatClear,
53
- enabled: true,
54
- props: {
55
- disabled: computed(() => !editor.can().chain().focus().unsetAllMarks().run()),
56
- },
57
- attrs: {
58
- click: () => editor.chain().focus().unsetAllMarks().clearNodes().run()
59
- }
60
- },
10
+ line: useLine(),
11
+ break: useBreak(),
12
+ source: useSource(),
13
+ preview: usePreview(),
14
+ formatClear: useFormatClear(),
15
+ invisibleCharacters: useInvisibleCharacters(),
61
16
  }
62
17
  }
@@ -1,231 +1,17 @@
1
- import * as mdi from "@mdi/js";
2
- import { Level } from "@tiptap/extension-heading";
3
- import FontFamily from "@tiptapify/extensions/components/FontFamily.vue";
4
- import FontSize from "@tiptapify/extensions/components/FontSize.vue";
5
- import LineHeight from "@tiptapify/extensions/components/LineHeight.vue";
6
- import { Editor } from "@tiptap/vue-3";
7
- import StyleColor from "@tiptapify/extensions/components/StyleColor.vue";
8
- import { computed, markRaw } from "vue";
9
- import { useI18n } from "vue-i18n";
10
- import {
11
- fonts,
12
- fontSizes,
13
- lineHeights,
14
- headingLevels,
15
- setHeadingLevels,
16
- defaultFontSize,
17
- defaultLineHeight
18
- } from "@tiptapify/constants/style";
19
-
20
- interface MDIIcons {
21
- [key: string]: string
22
- }
23
- const mdiIcons = mdi as MDIIcons
24
-
25
- export function useStyleItems(editor: Editor, theme: any, fontMeasure: string, customHeadingLevels: Array<number> = []) {
26
- const { t } = useI18n();
27
-
28
- setHeadingLevels(customHeadingLevels)
29
-
1
+ import { useColor } from "@tiptapify/composables/Toolbar/Style/useColor";
2
+ import { useFontFamily } from "@tiptapify/composables/Toolbar/Style/useFontFamily";
3
+ import { useFontSize } from "@tiptapify/composables/Toolbar/Style/useFontSize";
4
+ import { useHeading } from "@tiptapify/composables/Toolbar/Style/useHeading";
5
+ import { useHighlight } from "@tiptapify/composables/Toolbar/Style/useHighlight";
6
+ import { useLineHeight } from "@tiptapify/composables/Toolbar/Style/useLineHeight";
7
+
8
+ export function useStyleItems(theme: any, fontMeasure: string, customHeadingLevels: Array<number> = []) {
30
9
  return {
31
- heading: {
32
- name: 'heading',
33
- tooltip: computed(() => t('style.heading')),
34
- icon: mdi.mdiFormatHeaderPound,
35
- modelValue: null,
36
- enabled: true,
37
- props: {
38
- color: computed(() => editor.isActive('heading') || editor.isActive('paragraph') ? 'primary' : ''),
39
- },
40
- children: [
41
- {
42
- name: 'paragraph',
43
- tooltip: computed(() => t('style.paragraph')),
44
- icon: mdiIcons['mdiFormatParagraph'],
45
- noI18n: true,
46
- enabled: true,
47
- props: {
48
- color: computed(() => editor.isActive('paragraph') ? 'primary' : ''),
49
- },
50
- attrs: {
51
- click: () => editor.chain().focus().setParagraph().run()
52
- }
53
- }
54
- ].concat(
55
- headingLevels.value.map(level => {
56
- const headingLevel: Level = level as Level
57
- return {
58
- name: `H${level}`,
59
- tooltip: computed(() => t(`style.headings.h${level}`)),
60
- icon: mdiIcons[`mdiFormatHeader${level}`],
61
- noI18n: true,
62
- enabled: true,
63
- props: {
64
- color: computed(() => editor.isActive('heading', { level: level }) ? 'primary' : ''),
65
- },
66
- attrs: {
67
- click: () => editor.chain().focus().toggleHeading({ level: headingLevel }).run()
68
- }
69
- }
70
- })
71
- )
72
- },
73
- fontFamily: {
74
- name: 'font-family',
75
- tooltip: computed(() => t('style.fontFamily')),
76
- icon: mdi.mdiFormatFont,
77
- modelValue: false,
78
- enabled: true,
79
- props: {
80
- disabled: computed(() => !editor.can().chain().focus().unsetFontFamily().run()),
81
- color: computed(() => {
82
- let color = ''
83
- for (const font in fonts) {
84
- if (editor.isActive('textStyle', { fontFamily: fonts[font].fontFamily })) {
85
- color = 'primary'
86
- break;
87
- }
88
- }
89
-
90
- return color
91
- }),
92
- },
93
- component: markRaw(FontFamily),
94
- componentProps: {
95
- fonts: fonts,
96
- fontFamily: computed(() => {
97
- let fontFamily = ''
98
- for (const font in fonts) {
99
- if (editor.isActive('textStyle', { fontFamily: fonts[font].fontFamily })) {
100
- fontFamily = fonts[font].fontFamily
101
- break;
102
- }
103
- }
104
-
105
- return fontFamily
106
- }),
107
- }
108
- },
109
- fontSize: {
110
- name: 'font-size',
111
- tooltip: computed(() => t('style.fontSize')),
112
- icon: mdi.mdiFormatSize,
113
- modelValue: false,
114
- enabled: true,
115
- props: {
116
- disabled: computed(() => !editor.can().chain().focus().unsetFontSize().run()),
117
- color: computed(() => {
118
- let color = ''
119
- for (const size of fontSizes) {
120
- if (editor.isActive('textStyle', { fontSize: `${size}${fontMeasure}` })) {
121
- color = 'primary'
122
- break;
123
- }
124
- }
125
-
126
- return color
127
- }),
128
- },
129
- component: markRaw(FontSize),
130
- componentProps: {
131
- sizes: fontSizes,
132
- measure: fontMeasure,
133
- fontSize: computed(() => {
134
- let fontSize = null
135
- for (const size of fontSizes) {
136
- if (editor.isActive('textStyle', { fontSize: `${size}${fontMeasure}` })) {
137
- fontSize = size
138
- break;
139
- }
140
- }
141
-
142
- return fontSize
143
- }),
144
- }
145
- },
146
- lineHeight: {
147
- name: 'line-height',
148
- tooltip: computed(() => t('style.lineHeight')),
149
- icon: mdi.mdiFormatLineHeight,
150
- modelValue: null,
151
- enabled: true,
152
- props: {
153
- disabled: computed(() => !editor.can().chain().focus().unsetLineHeight().run()),
154
- color: computed(() => {
155
- let color = ''
156
- for (const height of lineHeights) {
157
- if (editor.isActive('textStyle', { lineHeight: height.toString() })) {
158
- color = 'primary'
159
- break;
160
- }
161
- }
162
-
163
- return color
164
- }),
165
- },
166
- component: markRaw(LineHeight),
167
- componentProps: {
168
- lineHeights,
169
- lineHeight: computed(() => {
170
- let lineHeight = null
171
- for (const height of lineHeights) {
172
- if (editor.isActive('textStyle', { lineHeight: height.toString() })) {
173
- lineHeight = height
174
- break;
175
- }
176
- }
177
-
178
- return lineHeight
179
- }),
180
- }
181
- },
182
- highlight: {
183
- name: 'highlight',
184
- tooltip: computed(() => t('style.color.highlight')),
185
- icon: mdi.mdiFormatColorFill,
186
- icon2: mdi.mdiColorHelper,
187
- enabled: true,
188
- props: {
189
- disabled: computed(() => !editor.can().chain().focus().toggleHighlight().run()),
190
- },
191
- icon2Props: {
192
- disabled: computed(() => !editor.can().chain().focus().toggleHighlight().run()),
193
- color: computed(() => {
194
- const defaultColor = theme.global.current.value.dark ? '#fff' : '#000'
195
- return editor.getAttributes('highlight').color || defaultColor
196
- }),
197
- style: 'filter: drop-shadow(rgba(0, 0, 0, .75) 1px 1px 2px);'
198
- },
199
- component: markRaw(StyleColor),
200
- componentProps: {
201
- fontColor: false,
202
- backgroundColor: true,
203
- color: computed(() => editor.getAttributes('highlight').color || ''),
204
- }
205
- },
206
- color: {
207
- name: 'color',
208
- tooltip: computed(() => t('style.color.text')),
209
- icon: mdi.mdiFormatColorText,
210
- icon2: mdi.mdiColorHelper,
211
- enabled: true,
212
- props: {
213
- disabled: computed(() => !editor.can().chain().focus().toggleHighlight().run()),
214
- },
215
- icon2Props: {
216
- disabled: computed(() => !editor.can().chain().focus().toggleHighlight().run()),
217
- color: computed(() => {
218
- const defaultColor = theme.global.current.value.dark ? '#fff' : '#000'
219
- return editor.getAttributes('textStyle').color || defaultColor
220
- }),
221
- style: 'filter: drop-shadow(rgba(0, 0, 0, .75) 1px 1px 2px);'
222
- },
223
- component: markRaw(StyleColor),
224
- componentProps: {
225
- fontColor: true,
226
- backgroundColor: false,
227
- color: computed(() => editor.getAttributes('textStyle').color || ''),
228
- }
229
- }
10
+ heading: useHeading(customHeadingLevels),
11
+ fontFamily: useFontFamily(),
12
+ fontSize: useFontSize(fontMeasure),
13
+ lineHeight: useLineHeight(),
14
+ highlight: useHighlight(theme),
15
+ color: useColor(theme)
230
16
  }
231
17
  }
@@ -0,0 +1,109 @@
1
+ <script setup lang="ts">
2
+
3
+ import { Editor } from "@tiptap/vue-3";
4
+ import { useI18n } from 'vue-i18n'
5
+
6
+ import tiptapifyEmojis from "@tiptapify/extensions/emoji"
7
+
8
+ import { computed, inject, Ref, ref } from 'vue'
9
+
10
+ const { t } = useI18n()
11
+
12
+ defineExpose({ open, close })
13
+
14
+ const emit = defineEmits(['close'])
15
+
16
+ const editor = inject('tiptapifyEditor') as Ref<Editor>
17
+
18
+ const tab = ref('smileys_and_emotion')
19
+ const sorted = tiptapifyEmojis.sort((previous, current) => {
20
+ if (previous.order < current.order) {
21
+ return -1
22
+ }
23
+ if (previous.order > current.order) {
24
+ return 1
25
+ }
26
+
27
+ return 0
28
+ })
29
+ const emojis = computed(() => sorted.map(item => { return { group: item.name, emojis: item.items } }))
30
+
31
+ const handleEmojiClick = (emoji: any) => {
32
+ editor.value.chain().focus().insertContent(emoji.char).run()
33
+ close()
34
+ }
35
+
36
+ function close() {
37
+ emit('close')
38
+ }
39
+ </script>
40
+
41
+ <template>
42
+ <VSheet class="pa-2" max-width="570">
43
+ <div class="d-flex flex-row">
44
+ <VTabs v-model="tab" mandatory direction="vertical" color="primary" density="compact">
45
+ <VTab
46
+ v-for="item of emojis"
47
+ :text="item.group"
48
+ :value="item.group"
49
+ :key="item.group"
50
+ density="compact"
51
+ rounded
52
+ size="small"
53
+ >
54
+ {{ t(`media.emoji.${item.group}`) }}
55
+ </VTab>
56
+ </VTabs>
57
+
58
+ <VWindow v-model="tab" direction="vertical">
59
+ <VWindowItem v-for="item of emojis" :value="item.group">
60
+ <div class="tiptapify-emoji-container">
61
+ <div v-for="emojiItem in item.emojis" class="tiptapify-emoji-container-item" @click="handleEmojiClick(emojiItem)" :title="emojiItem.name">
62
+ <div class="tiptapify-emoji-container-item__overlay">
63
+ <span>
64
+ {{ emojiItem.char }}
65
+ </span>
66
+ </div>
67
+ </div>
68
+ </div>
69
+ </VWindowItem>
70
+ </VWindow>
71
+ </div>
72
+ </VSheet>
73
+ </template>
74
+
75
+ <style lang="scss" scoped>
76
+ .tiptapify-emoji-container {
77
+ max-height: 500px;
78
+ overflow-y: auto;
79
+
80
+ border: 1px solid #ddd;
81
+ border-radius: 8px;
82
+ filter: drop-shadow(1px 2px 3px #777);
83
+ }
84
+
85
+ .tiptapify-emoji-container-item__overlay {
86
+ display: flex;
87
+ justify-content: center;
88
+ align-items: center;
89
+ width: 32px;
90
+ height: 32px;
91
+ border-radius: 5px;
92
+ z-index: 1;
93
+ }
94
+
95
+ .tiptapify-emoji-container-item {
96
+ position: relative;
97
+ display: inline-flex;
98
+ justify-content: center;
99
+ align-items: center;
100
+ cursor: pointer;
101
+ width: 32px;
102
+ height: 32px;
103
+ transition: background-color 0.2s ease-in-out;
104
+ }
105
+
106
+ .tiptapify-emoji-container-item:hover .tiptapify-emoji-container-item__overlay {
107
+ background-color: rgba(var(--v-theme-on-background), calc(var(--v-hover-opacity) * var(--v-theme-overlay-multiplier)));
108
+ }
109
+ </style>
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
 
3
3
  import { Editor } from "@tiptap/vue-3";
4
- import Dialog from "@tiptapify/components/UI/Dialog.vue";
4
+ import TiptapifyDialog from "@tiptapify/components/UI/TiptapifyDialog.vue";
5
5
 
6
6
  import { useI18n } from 'vue-i18n'
7
7
  import { computed, inject, onMounted, onUnmounted, Ref, ref } from 'vue'
@@ -66,6 +66,10 @@ function close() {
66
66
  }
67
67
 
68
68
  const showTiptapifyImage = (event: CustomEvent) => {
69
+ if (event.detail.editorId !== editor.value.instanceId) {
70
+ return
71
+ }
72
+
69
73
  attrs.value.src = event.detail.image?.src
70
74
  attrs.value.alt = event.detail.image?.alt
71
75
  attrs.value.width = event.detail.image?.width
@@ -84,7 +88,7 @@ onUnmounted(() => {
84
88
  </script>
85
89
 
86
90
  <template>
87
- <Dialog ref="dialog" module="image" :max-width="800">
91
+ <TiptapifyDialog ref="dialog" module="image" :max-width="800">
88
92
  <template #content>
89
93
  <VCardText>
90
94
  <VRow>
@@ -126,5 +130,5 @@ onUnmounted(() => {
126
130
  </VRow>
127
131
  </VCardActions>
128
132
  </template>
129
- </Dialog>
133
+ </TiptapifyDialog>
130
134
  </template>