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
@@ -6,63 +6,26 @@ import { useListItems } from "@tiptapify/composables/Toolbar/useListItems";
6
6
  import { useMediaItems } from "@tiptapify/composables/Toolbar/useMediaItems";
7
7
  import { useMiscItems } from "@tiptapify/composables/Toolbar/useMiscItems";
8
8
  import { useStyleItems } from "@tiptapify/composables/Toolbar/useStyleItems";
9
- import { ComputedRef, ref } from "vue";
10
-
11
- interface ToolbarItemAttrs {
12
- [key: string]: Function | any
13
- }
14
-
15
- interface ToolbarItemProps {
16
- [key: string]: any
17
- }
18
-
19
- export interface ToolbarItem {
20
- name: string|number|ComputedRef<string>,
21
- tooltip: string|ComputedRef<string>,
22
- icon: string|ComputedRef<string>,
23
- icon2?: string|ComputedRef<string>,
24
- noI18n?: boolean,
25
- enabled: boolean,
26
- component?: any,
27
- modelValue?: any,
28
- group?: boolean,
29
- toggle?: boolean,
30
- icon2Props?: ToolbarItemProps,
31
- componentProps?: ToolbarItemProps,
32
- props?: ToolbarItemProps,
33
- attrs?: ToolbarItemAttrs,
34
- children?: ToolbarItems|ToolbarItem[],
35
- }
36
-
37
- export interface ToolbarItems {
38
- [key: string]: ToolbarItem
39
- }
40
-
41
- export interface ToolbarItemSection {
42
- group?: boolean,
43
- toggle?: boolean,
44
- items: ToolbarItems,
45
- }
46
-
47
- export interface ToolbarItemSections {
48
- [key: string]: ToolbarItemSection
49
- }
9
+ import { extensionComponents } from "@tiptapify/types/extensionComponents";
10
+ import { ref } from "vue";
11
+
12
+ import { ToolbarItem, ToolbarItemSections } from '@tiptapify/types/toolbarItems'
50
13
 
51
14
  export function toolbarItems(
52
- editor: any,
53
15
  theme: any,
54
16
  fontMeasure: string,
55
- items: { list: Array<string>, exclude: boolean },
56
- customHeadingLevels: Array<number>
17
+ items: { list: Array<ToolbarItem>, exclude: boolean },
18
+ customHeadingLevels: Array<number>,
19
+ customExtensions: extensionComponents
57
20
  ): ToolbarItemSections {
58
- const styleItems = ref(useStyleItems(editor.value, theme, fontMeasure, customHeadingLevels))
59
- const formatItems = ref(useFormatItems(editor.value))
60
- const formatExtraItems = ref(useFormatExtraItems(editor.value))
61
- const alignmentItems = ref(useAlignmentItems(editor.value))
62
- const listItems = ref(useListItems(editor.value))
63
- const actionsItems = ref(useActionsItems(editor.value))
64
- const miscItems = ref(useMiscItems(editor.value))
65
- const mediaItems = ref(useMediaItems(editor.value))
21
+ const styleItems = ref(useStyleItems(theme, fontMeasure, customHeadingLevels))
22
+ const formatItems = ref(useFormatItems())
23
+ const formatExtraItems = ref(useFormatExtraItems())
24
+ const alignmentItems = ref(useAlignmentItems())
25
+ const listItems = ref(useListItems())
26
+ const actionsItems = ref(useActionsItems())
27
+ const miscItems = ref(useMiscItems())
28
+ const mediaItems = ref(useMediaItems())
66
29
 
67
30
  const allMenuItems: ToolbarItemSections = {
68
31
  /**
@@ -78,6 +41,7 @@ export function toolbarItems(
78
41
  list: { group: true, items: listItems.value },
79
42
  actions: { group: true, items: actionsItems.value },
80
43
  misc: { group: true, items: miscItems.value },
44
+ extra: { group: true, items: {} },
81
45
  }
82
46
 
83
47
  const pluginsList: Array<string> = []
@@ -85,13 +49,13 @@ export function toolbarItems(
85
49
  Object.keys(allMenuItems[section]).forEach(item => pluginsList.push(item))
86
50
  })
87
51
 
88
- if (items.list.length) {
89
- items.list.forEach(item => {
90
- if (!pluginsList.includes(item)) {
91
- throw new Error(`Unknown plugin name: ${item}! Supported plugins: ${pluginsList.join(', ')}`)
92
- }
93
- })
94
- }
52
+ // if (items.list.length) {
53
+ // items.list.forEach(item => {
54
+ // if (!pluginsList.includes(item)) {
55
+ // throw new Error(`Unknown plugin name: ${item}! Supported plugins: ${pluginsList.join(', ')}`)
56
+ // }
57
+ // })
58
+ // }
95
59
 
96
60
  const toolbarItems: ToolbarItemSections = {}
97
61
 
@@ -100,7 +64,7 @@ export function toolbarItems(
100
64
  Object.keys(allMenuItems).forEach(sectionName => {
101
65
  const section = allMenuItems[sectionName]
102
66
  Object.keys(section.items).forEach(plugin => {
103
- const item = section.items[plugin]
67
+ const item: ToolbarItem = section.items[plugin]
104
68
 
105
69
  if (items.list.length) {
106
70
  item.enabled = items.list.includes(plugin)
@@ -132,5 +96,24 @@ export function toolbarItems(
132
96
  }
133
97
  })
134
98
 
99
+ // add/override custom extensions
100
+ Object.keys(customExtensions).forEach(extension => {
101
+ const section = customExtensions[extension].section
102
+
103
+ if (typeof customExtensions[extension]?.props === 'undefined') {
104
+ customExtensions[extension].props = toolbarItems[section]?.items[extension]?.props ?? {}
105
+ }
106
+
107
+ if (typeof customExtensions[extension]?.attrs === 'undefined') {
108
+ customExtensions[extension].attrs = toolbarItems[section]?.items[extension]?.attrs ?? {}
109
+ }
110
+
111
+ if (typeof toolbarItems[section] === 'undefined') {
112
+ toolbarItems[section] = { group: true, items: {} }
113
+ toolbarItems[section].items[extension] = {}
114
+ }
115
+ toolbarItems[section].items[extension] = customExtensions[extension]
116
+ })
117
+
135
118
  return toolbarItems
136
119
  }
@@ -0,0 +1,24 @@
1
+ <script setup lang="ts">
2
+ import { defineProps } from 'vue'
3
+ import * as mdi from '@mdi/js'
4
+
5
+ defineProps({
6
+ icon: String
7
+ })
8
+
9
+ const isSvgString = (icon: any) => {
10
+ return typeof icon === 'string' && icon.includes('<svg')
11
+ }
12
+ </script>
13
+
14
+ <template>
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" />
17
+ </template>
18
+
19
+ <style lang="scss" scoped>
20
+ .tiptapify-btn-svg-icon {
21
+ width: 16px;
22
+ height: 16px;
23
+ }
24
+ </style>
@@ -6,6 +6,7 @@ import { useI18n } from "vue-i18n";
6
6
 
7
7
  const props = defineProps({
8
8
  module: String,
9
+ title: String,
9
10
  fullscreen: { type: Boolean, default () { return false } },
10
11
  maxWidth: { type: Number, default () { return 800 } },
11
12
  })
@@ -103,17 +104,17 @@ watch(() => dialog.value, async () => {
103
104
  </script>
104
105
 
105
106
  <template>
106
- <VDialog v-model="dialog" :max-width="maxWidth" :fullscreen="fullscreen" absolute @click:outside="emitClose">
107
+ <VDialog v-model="dialog" :max-width="maxWidth" :fullscreen="fullscreen" @click:outside="emitClose">
107
108
  <VCard>
108
109
  <VCardTitle ref="movableHandler" :class="`d-flex ${!fullscreen ? 'tiptapify-movable-handler' : ''}`" style="user-select: none;">
109
110
  <VLabel>
110
- {{ t(`dialog.${module}.title`) }}
111
+ {{ title ?? t(`dialog.${module}.title`) }}
111
112
  </VLabel>
112
113
 
113
114
  <VSpacer />
114
115
 
115
116
  <VBtn density="compact" class="tiptapify-dialog-close" variant="elevated" elevation="4" icon @click="emitClose">
116
- <VIcon size="x-small" :icon="mdi.mdiClose" />
117
+ <VIcon size="x-small" :icon="`mdiSvg:${mdi.mdiClose}`" />
117
118
  </VBtn>
118
119
  </VCardTitle>
119
120
 
@@ -22,6 +22,7 @@ import { TextAlign } from '@tiptap/extension-text-align'
22
22
  import { Underline } from '@tiptap/extension-underline'
23
23
  import { TableKit } from '@tiptap/extension-table'
24
24
  import { CodeBlockLowlight } from '@tiptap/extension-code-block-lowlight'
25
+ import { InvisibleCharacters } from '@tiptap/extension-invisible-characters'
25
26
 
26
27
  import { TiptapifyLink } from '@tiptapify/extensions/link'
27
28
  import { TiptapifyImage } from '@tiptapify/extensions/image'
@@ -30,6 +31,7 @@ import { ViewSource } from '@tiptapify/extensions/view-source'
30
31
  import { Preview } from '@tiptapify/extensions/preview'
31
32
  import SlashCommands from '@tiptapify/extensions/slash-commands'
32
33
  import suggestion from '@tiptapify/extensions/components/slashCommands/suggestion'
34
+ import { extensionComponents } from "@tiptapify/types/extensionComponents";
33
35
 
34
36
  // load all languages with "all" or common languages with "common"
35
37
  import { common, createLowlight } from 'lowlight'
@@ -47,7 +49,7 @@ const lowlight = createLowlight(common)
47
49
  // register language example
48
50
  // lowlight.register('ts', ts)
49
51
 
50
- export function editorExtensions (placeholder: string, slashCommands: boolean) {
52
+ export function editorExtensions (placeholder: string, slashCommands: boolean, customExtensions: extensionComponents) {
51
53
  const extensions = [
52
54
  TextStyleKit,
53
55
  Document,
@@ -94,6 +96,9 @@ export function editorExtensions (placeholder: string, slashCommands: boolean) {
94
96
  Placeholder.configure({ placeholder }),
95
97
  CharacterCount,
96
98
  ViewSource,
99
+ InvisibleCharacters.configure({
100
+ visible: false,
101
+ }),
97
102
  Preview
98
103
  ]
99
104
 
@@ -101,5 +106,15 @@ export function editorExtensions (placeholder: string, slashCommands: boolean) {
101
106
  extensions.push(SlashCommands.configure({ suggestion }))
102
107
  }
103
108
 
109
+ if (Object.keys(customExtensions).length) {
110
+ for (const customExtension of Object.values(customExtensions)) {
111
+ if (typeof customExtension.extensions !== 'undefined') {
112
+ for (const extension of customExtension.extensions) {
113
+ extensions.push(extension)
114
+ }
115
+ }
116
+ }
117
+ }
118
+
104
119
  return extensions
105
120
  }
@@ -1,9 +1,15 @@
1
1
  import { Editor, useEditor } from "@tiptap/vue-3";
2
2
  import { editorExtensions } from "@tiptapify/components/editorExtensions";
3
+ import { extensionComponents } from "@tiptapify/types/extensionComponents";
3
4
  import { ShallowRef } from "vue";
4
5
 
5
- export function getTiptapEditor (content: any, placeholder: string, slashCommands: boolean = true): ShallowRef<Editor | undefined> {
6
- const extensions = editorExtensions(placeholder, slashCommands)
6
+ export function getTiptapEditor (
7
+ content: any,
8
+ placeholder: string,
9
+ slashCommands: boolean = true,
10
+ customExtensions: extensionComponents
11
+ ): ShallowRef<Editor | undefined> {
12
+ const extensions = editorExtensions(placeholder, slashCommands, customExtensions)
7
13
  const editor: ShallowRef<Editor | undefined> = useEditor({
8
14
  content,
9
15
  extensions,
@@ -0,0 +1,23 @@
1
+ import * as mdi from "@mdi/js";
2
+ import { Editor } from "@tiptap/vue-3";
3
+ import { computed, inject, Ref } from "vue";
4
+ import { useI18n } from "vue-i18n";
5
+
6
+ export function useRedo() {
7
+ const { t } = useI18n();
8
+
9
+ const editor = inject('tiptapifyEditor') as Ref<Editor>
10
+
11
+ return {
12
+ name: 'redo',
13
+ tooltip: computed(() => t('action.redo')),
14
+ icon: `mdiSvg:${mdi.mdiRedo}`,
15
+ enabled: true,
16
+ props: {
17
+ disabled: computed(() => !editor.value.can().chain().focus().redo().run()),
18
+ },
19
+ attrs: {
20
+ click: () => editor.value.chain().focus().redo().run()
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,23 @@
1
+ import * as mdi from "@mdi/js";
2
+ import { Editor } from "@tiptap/vue-3";
3
+ import { computed, inject, Ref } from "vue";
4
+ import { useI18n } from "vue-i18n";
5
+
6
+ export function useUndo() {
7
+ const { t } = useI18n();
8
+
9
+ const editor = inject('tiptapifyEditor') as Ref<Editor>
10
+
11
+ return {
12
+ name: 'undo',
13
+ tooltip: computed(() => t('action.undo')),
14
+ icon: `mdiSvg:${mdi.mdiUndo}`,
15
+ enabled: true,
16
+ props: {
17
+ disabled: computed(() => !editor.value.can().chain().focus().undo().run()),
18
+ },
19
+ attrs: {
20
+ click: () => editor.value.chain().focus().undo().run()
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,24 @@
1
+ import * as mdi from "@mdi/js";
2
+ import { Editor } from "@tiptap/vue-3";
3
+ import { computed, inject, Ref } from "vue";
4
+ import { useI18n } from "vue-i18n";
5
+
6
+ export function useAlignmentCenter() {
7
+ const { t } = useI18n();
8
+
9
+ const editor = inject('tiptapifyEditor') as Ref<Editor>
10
+
11
+ return {
12
+ name: computed(() => t('alignments.center')),
13
+ tooltip: computed(() => t('alignments.center')),
14
+ icon: `mdiSvg:${mdi.mdiFormatAlignCenter}`,
15
+ enabled: true,
16
+ props: {
17
+ active: false,
18
+ color: computed(() => editor.value.isActive({ textAlign: 'center' }) ? 'primary' : ''),
19
+ },
20
+ attrs: {
21
+ click: () => editor.value.chain().focus().toggleTextAlign('center').run()
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,24 @@
1
+ import * as mdi from "@mdi/js";
2
+ import { Editor } from "@tiptap/vue-3";
3
+ import { computed, inject, Ref } from "vue";
4
+ import { useI18n } from "vue-i18n";
5
+
6
+ export function useAlignmentJustify() {
7
+ const { t } = useI18n();
8
+
9
+ const editor = inject('tiptapifyEditor') as Ref<Editor>
10
+
11
+ return {
12
+ name: computed(() => t('alignments.justify')),
13
+ tooltip: computed(() => t('alignments.justify')),
14
+ icon: `mdiSvg:${mdi.mdiFormatAlignJustify}`,
15
+ enabled: true,
16
+ props: {
17
+ active: false,
18
+ color: computed(() => editor.value.isActive({ textAlign: 'justify' }) ? 'primary' : ''),
19
+ },
20
+ attrs: {
21
+ click: () => editor.value.chain().focus().toggleTextAlign('justify').run()
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,24 @@
1
+ import * as mdi from "@mdi/js";
2
+ import { Editor } from "@tiptap/vue-3";
3
+ import { computed, inject, Ref } from "vue";
4
+ import { useI18n } from "vue-i18n";
5
+
6
+ export function useAlignmentLeft() {
7
+ const { t } = useI18n();
8
+
9
+ const editor = inject('tiptapifyEditor') as Ref<Editor>
10
+
11
+ return {
12
+ name: computed(() => t('alignments.left')),
13
+ tooltip: computed(() => t('alignments.left')),
14
+ icon: `mdiSvg:${mdi.mdiFormatAlignLeft}`,
15
+ enabled: true,
16
+ props: {
17
+ active: false,
18
+ color: computed(() => editor.value.isActive({ textAlign: 'left' }) ? 'primary' : ''),
19
+ },
20
+ attrs: {
21
+ click: () => editor.value.chain().focus().toggleTextAlign('left').run()
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,24 @@
1
+ import * as mdi from "@mdi/js";
2
+ import { Editor } from "@tiptap/vue-3";
3
+ import { computed, inject, Ref } from "vue";
4
+ import { useI18n } from "vue-i18n";
5
+
6
+ export function useAlignmentRight() {
7
+ const { t } = useI18n();
8
+
9
+ const editor = inject('tiptapifyEditor') as Ref<Editor>
10
+
11
+ return {
12
+ name: computed(() => t('alignments.right')),
13
+ tooltip: computed(() => t('alignments.right')),
14
+ icon: `mdiSvg:${mdi.mdiFormatAlignRight}`,
15
+ enabled: true,
16
+ props: {
17
+ active: false,
18
+ color: computed(() => editor.value.isActive({ textAlign: 'right' }) ? 'primary' : ''),
19
+ },
20
+ attrs: {
21
+ click: () => editor.value.chain().focus().toggleTextAlign('right').run()
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,24 @@
1
+ import * as mdi from "@mdi/js";
2
+ import { Editor } from "@tiptap/vue-3";
3
+ import { computed, inject, Ref } from "vue";
4
+ import { useI18n } from "vue-i18n";
5
+
6
+ export function useBold() {
7
+ const { t } = useI18n();
8
+
9
+ const editor = inject('tiptapifyEditor') as Ref<Editor>
10
+
11
+ return {
12
+ name: 'bold',
13
+ tooltip: computed(() => t('format.bold')),
14
+ icon: `mdiSvg:${mdi.mdiFormatBold}`,
15
+ enabled: true,
16
+ props: {
17
+ disabled: computed(() => !editor.value.can().chain().focus().toggleBold().run()),
18
+ color: computed(() => editor.value.isActive('bold') ? 'primary' : ''),
19
+ },
20
+ attrs: {
21
+ click: () => editor.value.chain().focus().toggleBold().run()
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,24 @@
1
+ import * as mdi from "@mdi/js";
2
+ import { Editor } from "@tiptap/vue-3";
3
+ import { computed, inject, Ref } from "vue";
4
+ import { useI18n } from "vue-i18n";
5
+
6
+ export function useItalic() {
7
+ const { t } = useI18n();
8
+
9
+ const editor = inject('tiptapifyEditor') as Ref<Editor>
10
+
11
+ return {
12
+ name: 'italic',
13
+ tooltip: computed(() => t('format.italic')),
14
+ icon: `mdiSvg:${mdi.mdiFormatItalic}`,
15
+ enabled: true,
16
+ props: {
17
+ disabled: computed(() => !editor.value.can().chain().focus().toggleItalic().run()),
18
+ color: computed(() => editor.value.isActive('italic') ? 'primary' : ''),
19
+ },
20
+ attrs: {
21
+ click: () => editor.value.chain().focus().toggleItalic().run()
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,24 @@
1
+ import * as mdi from "@mdi/js";
2
+ import { Editor } from "@tiptap/vue-3";
3
+ import { computed, inject, Ref } from "vue";
4
+ import { useI18n } from "vue-i18n";
5
+
6
+ export function useStrike() {
7
+ const { t } = useI18n();
8
+
9
+ const editor = inject('tiptapifyEditor') as Ref<Editor>
10
+
11
+ return {
12
+ name: 'strike',
13
+ tooltip: computed(() => t('format.strike')),
14
+ icon: `mdiSvg:${mdi.mdiFormatStrikethroughVariant}`,
15
+ enabled: true,
16
+ props: {
17
+ disabled: computed(() => !editor.value.can().chain().focus().toggleStrike().run()),
18
+ color: computed(() => editor.value.isActive('strike') ? 'primary' : ''),
19
+ },
20
+ attrs: {
21
+ click: () => editor.value.chain().focus().toggleStrike().run()
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,24 @@
1
+ import * as mdi from "@mdi/js";
2
+ import { Editor } from "@tiptap/vue-3";
3
+ import { computed, inject, Ref } from "vue";
4
+ import { useI18n } from "vue-i18n";
5
+
6
+ export function useUnderline() {
7
+ const { t } = useI18n();
8
+
9
+ const editor = inject('tiptapifyEditor') as Ref<Editor>
10
+
11
+ return {
12
+ name: 'underline',
13
+ tooltip: computed(() => t('format.underline')),
14
+ icon: `mdiSvg:${mdi.mdiFormatUnderline}`,
15
+ enabled: true,
16
+ props: {
17
+ disabled: computed(() => !editor.value.can().chain().focus().toggleUnderline().run()),
18
+ color: computed(() => editor.value.isActive('underline') ? 'primary' : ''),
19
+ },
20
+ attrs: {
21
+ click: () => editor.value.chain().focus().toggleUnderline().run()
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,24 @@
1
+ import * as mdi from "@mdi/js";
2
+ import { Editor } from "@tiptap/vue-3";
3
+ import { computed, inject, Ref } from "vue";
4
+ import { useI18n } from "vue-i18n";
5
+
6
+ export function useBlockquote() {
7
+ const { t } = useI18n();
8
+
9
+ const editor = inject('tiptapifyEditor') as Ref<Editor>
10
+
11
+ return {
12
+ name: 'blockquote',
13
+ tooltip: computed(() => t('format.blockquote')),
14
+ icon: `mdiSvg:${mdi.mdiCommentQuote}`,
15
+ enabled: true,
16
+ props: {
17
+ disabled: computed(() => !editor.value.can().chain().focus().toggleBlockquote().run() || editor.value.isActive('codeBlock') || editor.value.isActive('code')),
18
+ color: computed(() => editor.value.isActive('blockquote') ? 'primary' : ''),
19
+ },
20
+ attrs: {
21
+ click: () => editor.value.chain().focus().toggleBlockquote().run()
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,24 @@
1
+ import * as mdi from "@mdi/js";
2
+ import { Editor } from "@tiptap/vue-3";
3
+ import { computed, inject, Ref } from "vue";
4
+ import { useI18n } from "vue-i18n";
5
+
6
+ export function useCode() {
7
+ const { t } = useI18n();
8
+
9
+ const editor = inject('tiptapifyEditor') as Ref<Editor>
10
+
11
+ return {
12
+ name: 'code',
13
+ tooltip: computed(() => t('format.code')),
14
+ icon: `mdiSvg:${mdi.mdiXml}`,
15
+ enabled: true,
16
+ props: {
17
+ disabled: computed(() => !editor.value.can().chain().focus().toggleCode().run()),
18
+ color: computed(() => editor.value.isActive('code') ? 'primary' : ''),
19
+ },
20
+ attrs: {
21
+ click: () => editor.value.chain().focus().toggleCode().run()
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,24 @@
1
+ import * as mdi from "@mdi/js";
2
+ import { Editor } from "@tiptap/vue-3";
3
+ import { computed, inject, Ref } from "vue";
4
+ import { useI18n } from "vue-i18n";
5
+
6
+ export function useCodeBlock() {
7
+ const { t } = useI18n();
8
+
9
+ const editor = inject('tiptapifyEditor') as Ref<Editor>
10
+
11
+ return {
12
+ name: 'codeblock',
13
+ tooltip: computed(() => t('format.codeblock')),
14
+ icon: `mdiSvg:${mdi.mdiCodeBlockTags}`,
15
+ enabled: true,
16
+ props: {
17
+ disabled: computed(() => !editor.value.can().chain().focus().toggleCodeBlock().run()),
18
+ color: computed(() => editor.value.isActive('codeBlock') ? 'primary' : ''),
19
+ },
20
+ attrs: {
21
+ click: () => editor.value.chain().focus().toggleCodeBlock().run()
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,24 @@
1
+ import * as mdi from "@mdi/js";
2
+ import { Editor } from "@tiptap/vue-3";
3
+ import { computed, inject, Ref } from "vue";
4
+ import { useI18n } from "vue-i18n";
5
+
6
+ export function useSub() {
7
+ const { t } = useI18n();
8
+
9
+ const editor = inject('tiptapifyEditor') as Ref<Editor>
10
+
11
+ return {
12
+ name: 'sub',
13
+ tooltip: computed(() => t('format.sub')),
14
+ icon: `mdiSvg:${mdi.mdiFormatSubscript}`,
15
+ enabled: true,
16
+ props: {
17
+ disabled: computed(() => !editor.value.can().chain().focus().toggleSubscript().run()),
18
+ color: computed(() => editor.value.isActive('subscript') ? 'primary' : ''),
19
+ },
20
+ attrs: {
21
+ click: () => editor.value.chain().focus().toggleSubscript().run()
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,24 @@
1
+ import * as mdi from "@mdi/js";
2
+ import { Editor } from "@tiptap/vue-3";
3
+ import { computed, inject, Ref } from "vue";
4
+ import { useI18n } from "vue-i18n";
5
+
6
+ export function useSup() {
7
+ const { t } = useI18n();
8
+
9
+ const editor = inject('tiptapifyEditor') as Ref<Editor>
10
+
11
+ return {
12
+ name: 'sup',
13
+ tooltip: computed(() => t('format.sup')),
14
+ icon: `mdiSvg:${mdi.mdiFormatSuperscript}`,
15
+ enabled: true,
16
+ props: {
17
+ disabled: computed(() => !editor.value.can().chain().focus().toggleSuperscript().run()),
18
+ color: computed(() => editor.value.isActive('superscript') ? 'primary' : ''),
19
+ },
20
+ attrs: {
21
+ click: () => editor.value.chain().focus().toggleSuperscript().run()
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,23 @@
1
+ import * as mdi from "@mdi/js";
2
+ import { Editor } from "@tiptap/vue-3";
3
+ import { computed, inject, Ref } from "vue";
4
+ import { useI18n } from "vue-i18n";
5
+
6
+ export function useBullet() {
7
+ const { t } = useI18n();
8
+
9
+ const editor = inject('tiptapifyEditor') as Ref<Editor>
10
+
11
+ return {
12
+ name: computed(() => t('lists.bullet')),
13
+ tooltip: computed(() => t('lists.bullet')),
14
+ icon: `mdiSvg:${mdi.mdiFormatListBulleted}`,
15
+ enabled: true,
16
+ props: {
17
+ color: computed(() => editor.value.isActive('bulletList') ? 'primary' : ''),
18
+ },
19
+ attrs: {
20
+ click: () => editor.value.chain().focus().toggleBulletList().run()
21
+ }
22
+ }
23
+ }