tiptapify 0.0.11 → 0.0.12

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 (94) hide show
  1. package/README.md +6 -2
  2. package/dist/tiptapify.css +1 -1
  3. package/dist/tiptapify.mjs +16191 -15808
  4. package/dist/tiptapify.umd.js +73 -33
  5. package/index.d.ts +2 -2
  6. package/package.json +2 -1
  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/useImage.ts +24 -0
  42. package/src/composables/Toolbar/Media/useLink.ts +24 -0
  43. package/src/composables/Toolbar/Media/useTable.ts +188 -0
  44. package/src/composables/Toolbar/Misc/useBreak.ts +21 -0
  45. package/src/composables/Toolbar/Misc/useFormatClear.ts +23 -0
  46. package/src/composables/Toolbar/Misc/useInvisibleCharacters.ts +23 -0
  47. package/src/composables/Toolbar/Misc/useLine.ts +21 -0
  48. package/src/composables/Toolbar/Misc/usePreview.ts +20 -0
  49. package/src/composables/Toolbar/Misc/useSource.ts +21 -0
  50. package/src/composables/Toolbar/Style/useColor.ts +36 -0
  51. package/src/composables/Toolbar/Style/useFontFamily.ts +49 -0
  52. package/src/composables/Toolbar/Style/useFontSize.ts +50 -0
  53. package/src/composables/Toolbar/Style/useHeading.ts +64 -0
  54. package/src/composables/Toolbar/Style/useHighlight.ts +36 -0
  55. package/src/composables/Toolbar/Style/useLineHeight.ts +49 -0
  56. package/src/composables/Toolbar/useActionsItems.ts +5 -31
  57. package/src/composables/Toolbar/useAlignmentItems.ts +9 -59
  58. package/src/composables/Toolbar/useFormatExtraItems.ts +11 -72
  59. package/src/composables/Toolbar/useFormatItems.ts +9 -59
  60. package/src/composables/Toolbar/useListItems.ts +11 -69
  61. package/src/composables/Toolbar/useMediaItems.ts +7 -209
  62. package/src/composables/Toolbar/useMiscItems.ts +13 -58
  63. package/src/composables/Toolbar/useStyleItems.ts +14 -228
  64. package/src/extensions/components/ImageDialog.vue +7 -3
  65. package/src/extensions/components/LinkDialog.vue +7 -3
  66. package/src/extensions/components/PreviewDialog.vue +11 -4
  67. package/src/extensions/components/ShowSourceDialog.vue +7 -4
  68. package/src/extensions/components/StyleColor.vue +2 -2
  69. package/src/extensions/components/slashCommands/CommandsList.vue +1 -4
  70. package/src/extensions/image.ts +2 -1
  71. package/src/extensions/link.ts +2 -1
  72. package/src/extensions/preview.ts +2 -1
  73. package/src/extensions/view-source.ts +2 -1
  74. package/src/i18n/index.ts +1 -0
  75. package/src/i18n/locales/ch.json +2 -1
  76. package/src/i18n/locales/cz.json +2 -1
  77. package/src/i18n/locales/de.json +2 -1
  78. package/src/i18n/locales/en.json +2 -1
  79. package/src/i18n/locales/es.json +2 -1
  80. package/src/i18n/locales/fr.json +2 -1
  81. package/src/i18n/locales/it.json +2 -1
  82. package/src/i18n/locales/la.json +2 -1
  83. package/src/i18n/locales/lt.json +2 -1
  84. package/src/i18n/locales/nl.json +2 -1
  85. package/src/i18n/locales/pl.json +2 -1
  86. package/src/i18n/locales/pt.json +2 -1
  87. package/src/i18n/locales/ru.json +2 -1
  88. package/src/i18n/locales/se.json +2 -1
  89. package/src/i18n/locales/ua.json +2 -1
  90. package/src/index.ts +3 -1
  91. package/src/types/extensionComponents.ts +22 -0
  92. package/src/types/toolbarItems.ts +43 -0
  93. package/src/types/toolbarSections.ts +11 -0
  94. package/src/types/overridable-extensions.ts +0 -6
@@ -1,63 +1,13 @@
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 useAlignmentItems(editor: Editor) {
7
- const { t } = useI18n();
1
+ import { useAlignmentCenter } from "@tiptapify/composables/Toolbar/Alignment/useAlignmentCenter";
2
+ import { useAlignmentJustify } from "@tiptapify/composables/Toolbar/Alignment/useAlignmentJustify";
3
+ import { useAlignmentLeft } from "@tiptapify/composables/Toolbar/Alignment/useAlignmentLeft";
4
+ import { useAlignmentRight } from "@tiptapify/composables/Toolbar/Alignment/useAlignmentRight";
8
5
 
6
+ export function useAlignmentItems() {
9
7
  return {
10
- alignmentLeft: {
11
- name: computed(() => t('alignments.left')),
12
- tooltip: computed(() => t('alignments.left')),
13
- icon: mdi.mdiFormatAlignLeft,
14
- enabled: true,
15
- props: {
16
- active: false,
17
- color: computed(() => editor.isActive({ textAlign: 'left' }) ? 'primary' : ''),
18
- },
19
- attrs: {
20
- click: () => editor.chain().focus().toggleTextAlign('left').run()
21
- }
22
- },
23
- alignmentCenter: {
24
- name: computed(() => t('alignments.center')),
25
- tooltip: computed(() => t('alignments.center')),
26
- icon: mdi.mdiFormatAlignCenter,
27
- enabled: true,
28
- props: {
29
- active: false,
30
- color: computed(() => editor.isActive({ textAlign: 'center' }) ? 'primary' : ''),
31
- },
32
- attrs: {
33
- click: () => editor.chain().focus().toggleTextAlign('center').run()
34
- }
35
- },
36
- alignmentRight: {
37
- name: computed(() => t('alignments.right')),
38
- tooltip: computed(() => t('alignments.right')),
39
- icon: mdi.mdiFormatAlignRight,
40
- enabled: true,
41
- props: {
42
- active: false,
43
- color: computed(() => editor.isActive({ textAlign: 'right' }) ? 'primary' : ''),
44
- },
45
- attrs: {
46
- click: () => editor.chain().focus().toggleTextAlign('right').run()
47
- }
48
- },
49
- alignmentJustify: {
50
- name: computed(() => t('alignments.justify')),
51
- tooltip: computed(() => t('alignments.justify')),
52
- icon: mdi.mdiFormatAlignJustify,
53
- enabled: true,
54
- props: {
55
- active: false,
56
- color: computed(() => editor.isActive({ textAlign: 'justify' }) ? 'primary' : ''),
57
- },
58
- attrs: {
59
- click: () => editor.chain().focus().toggleTextAlign('justify').run()
60
- }
61
- },
8
+ alignmentLeft: useAlignmentLeft(),
9
+ alignmentCenter: useAlignmentCenter(),
10
+ alignmentRight: useAlignmentRight(),
11
+ alignmentJustify: useAlignmentJustify()
62
12
  }
63
13
  }
@@ -1,76 +1,15 @@
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 useFormatExtraItems(editor: Editor) {
7
- const { t } = useI18n();
1
+ import { useBlockquote } from "@tiptapify/composables/Toolbar/FormatExtra/useBlockquote";
2
+ import { useCode } from "@tiptapify/composables/Toolbar/FormatExtra/useCode";
3
+ import { useCodeBlock } from "@tiptapify/composables/Toolbar/FormatExtra/useCodeBlock";
4
+ import { useSub } from "@tiptapify/composables/Toolbar/FormatExtra/useSub";
5
+ import { useSup } from "@tiptapify/composables/Toolbar/FormatExtra/useSup";
8
6
 
7
+ export function useFormatExtraItems() {
9
8
  return {
10
- sup: {
11
- name: 'sup',
12
- tooltip: computed(() => t('format.sup')),
13
- icon: mdi.mdiFormatSuperscript,
14
- enabled: true,
15
- props: {
16
- disabled: computed(() => !editor.can().chain().focus().toggleSuperscript().run()),
17
- color: computed(() => editor.isActive('superscript') ? 'primary' : ''),
18
- },
19
- attrs: {
20
- click: () => editor.chain().focus().toggleSuperscript().run()
21
- }
22
- },
23
- sub: {
24
- name: 'sub',
25
- tooltip: computed(() => t('format.sub')),
26
- icon: mdi.mdiFormatSubscript,
27
- enabled: true,
28
- props: {
29
- disabled: computed(() => !editor.can().chain().focus().toggleSubscript().run()),
30
- color: computed(() => editor.isActive('subscript') ? 'primary' : ''),
31
- },
32
- attrs: {
33
- click: () => editor.chain().focus().toggleSubscript().run()
34
- }
35
- },
36
- code: {
37
- name: 'code',
38
- tooltip: computed(() => t('format.code')),
39
- icon: mdi.mdiXml,
40
- enabled: true,
41
- props: {
42
- disabled: computed(() => !editor.can().chain().focus().toggleCode().run()),
43
- color: computed(() => editor.isActive('code') ? 'primary' : ''),
44
- },
45
- attrs: {
46
- click: () => editor.chain().focus().toggleCode().run()
47
- }
48
- },
49
- codeBlock: {
50
- name: 'codeblock',
51
- tooltip: computed(() => t('format.codeblock')),
52
- icon: mdi.mdiCodeBlockTags,
53
- enabled: true,
54
- props: {
55
- disabled: computed(() => !editor.can().chain().focus().toggleCodeBlock().run()),
56
- color: computed(() => editor.isActive('codeBlock') ? 'primary' : ''),
57
- },
58
- attrs: {
59
- click: () => editor.chain().focus().toggleCodeBlock().run()
60
- }
61
- },
62
- blockquote: {
63
- name: 'blockquote',
64
- tooltip: computed(() => t('format.blockquote')),
65
- icon: mdi.mdiCommentQuote,
66
- enabled: true,
67
- props: {
68
- disabled: computed(() => !editor.can().chain().focus().toggleBlockquote().run() || editor.isActive('codeBlock') || editor.isActive('code')),
69
- color: computed(() => editor.isActive('blockquote') ? 'primary' : ''),
70
- },
71
- attrs: {
72
- click: () => editor.chain().focus().toggleBlockquote().run()
73
- }
74
- }
9
+ sup: useSup(),
10
+ sub: useSub(),
11
+ code: useCode(),
12
+ codeBlock: useCodeBlock(),
13
+ blockquote: useBlockquote()
75
14
  }
76
15
  }
@@ -1,63 +1,13 @@
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 useFormatItems(editor: Editor) {
7
- const { t } = useI18n();
1
+ import { useBold } from "@tiptapify/composables/Toolbar/Format/useBold";
2
+ import { useItalic } from "@tiptapify/composables/Toolbar/Format/useItalic";
3
+ import { useStrike } from "@tiptapify/composables/Toolbar/Format/useStrike";
4
+ import { useUnderline } from "@tiptapify/composables/Toolbar/Format/useUnderline";
8
5
 
6
+ export function useFormatItems() {
9
7
  return {
10
- bold: {
11
- name: 'bold',
12
- tooltip: computed(() => t('format.bold')),
13
- icon: mdi.mdiFormatBold,
14
- enabled: true,
15
- props: {
16
- disabled: computed(() => !editor.can().chain().focus().toggleBold().run()),
17
- color: computed(() => editor.isActive('bold') ? 'primary' : ''),
18
- },
19
- attrs: {
20
- click: () => editor.chain().focus().toggleBold().run()
21
- }
22
- },
23
- italic: {
24
- name: 'italic',
25
- tooltip: computed(() => t('format.italic')),
26
- icon: mdi.mdiFormatItalic,
27
- enabled: true,
28
- props: {
29
- disabled: computed(() => !editor.can().chain().focus().toggleItalic().run()),
30
- color: computed(() => editor.isActive('italic') ? 'primary' : ''),
31
- },
32
- attrs: {
33
- click: () => editor.chain().focus().toggleItalic().run()
34
- }
35
- },
36
- underline: {
37
- name: 'underline',
38
- tooltip: computed(() => t('format.underline')),
39
- icon: mdi.mdiFormatUnderline,
40
- enabled: true,
41
- props: {
42
- disabled: computed(() => !editor.can().chain().focus().toggleUnderline().run()),
43
- color: computed(() => editor.isActive('underline') ? 'primary' : ''),
44
- },
45
- attrs: {
46
- click: () => editor.chain().focus().toggleUnderline().run()
47
- }
48
- },
49
- strike: {
50
- name: 'strike',
51
- tooltip: computed(() => t('format.strike')),
52
- icon: mdi.mdiFormatStrikethroughVariant,
53
- enabled: true,
54
- props: {
55
- disabled: computed(() => !editor.can().chain().focus().toggleStrike().run()),
56
- color: computed(() => editor.isActive('strike') ? 'primary' : ''),
57
- },
58
- attrs: {
59
- click: () => editor.chain().focus().toggleStrike().run()
60
- }
61
- }
8
+ bold: useBold(),
9
+ italic: useItalic(),
10
+ underline: useUnderline(),
11
+ strike: useStrike()
62
12
  }
63
13
  }
@@ -1,73 +1,15 @@
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 useListItems(editor: Editor) {
7
- const { t } = useI18n();
1
+ import { useBullet } from "@tiptapify/composables/Toolbar/List/useBullet";
2
+ import { useIndent } from "@tiptapify/composables/Toolbar/List/useIndent";
3
+ import { useNumbered } from "@tiptapify/composables/Toolbar/List/useNumbered";
4
+ import { useOutdent } from "@tiptapify/composables/Toolbar/List/useOutdent";
5
+ import { useTask } from "@tiptapify/composables/Toolbar/List/useTask";
8
6
 
7
+ export function useListItems() {
9
8
  return {
10
- listBullet: {
11
- name: computed(() => t('lists.bullet')),
12
- tooltip: computed(() => t('lists.bullet')),
13
- icon: mdi.mdiFormatListBulleted,
14
- enabled: true,
15
- props: {
16
- color: computed(() => editor.isActive('bulletList') ? 'primary' : ''),
17
- },
18
- attrs: {
19
- click: () => editor.chain().focus().toggleBulletList().run()
20
- }
21
- },
22
- listNumbered: {
23
- name: computed(() => t('lists.numbered')),
24
- tooltip: computed(() => t('lists.numbered')),
25
- icon: mdi.mdiFormatListNumbered,
26
- enabled: true,
27
- props: {
28
- color: computed(() => editor.isActive('orderedList') ? 'primary' : ''),
29
- },
30
- attrs: {
31
- click: () => editor.chain().focus().toggleOrderedList().run()
32
- }
33
- },
34
- listTask: {
35
- name: computed(() => t('lists.task')),
36
- tooltip: computed(() => t('lists.task')),
37
- icon: mdi.mdiFormatListChecks,
38
- enabled: true,
39
- props: {
40
- color: computed(() => editor.isActive('taskList') ? 'primary' : ''),
41
- },
42
- attrs: {
43
- click: () => editor.chain().focus().toggleTaskList().run()
44
- }
45
- },
46
- listIndent: {
47
- name: computed(() => t('lists.indent')),
48
- tooltip: computed(() => t('lists.indent')),
49
- icon: mdi.mdiFormatIndentIncrease,
50
- enabled: true,
51
- props: {
52
- disabled: computed(() => !editor.can().sinkListItem('listItem')),
53
- active: false,
54
- },
55
- attrs: {
56
- click: () => editor.chain().focus().sinkListItem('listItem').run()
57
- }
58
- },
59
- listOutdent: {
60
- name: computed(() => t('lists.outdent')),
61
- tooltip: computed(() => t('lists.outdent')),
62
- icon: mdi.mdiFormatIndentDecrease,
63
- enabled: true,
64
- props: {
65
- disabled: computed(() => !editor.can().liftListItem('listItem')),
66
- active: false,
67
- },
68
- attrs: {
69
- click: () => editor.chain().focus().liftListItem('listItem').run()
70
- }
71
- }
9
+ listBullet: useBullet(),
10
+ listNumbered: useNumbered(),
11
+ listTask: useTask(),
12
+ listIndent: useIndent(),
13
+ listOutdent: useOutdent()
72
14
  }
73
15
  }
@@ -1,213 +1,11 @@
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 { useLink } from "@tiptapify/composables/Toolbar/Media/useLink";
3
+ import { useTable } from "@tiptapify/composables/Toolbar/Media/useTable";
6
4
 
7
- export function useMediaItems(editor: Editor) {
8
- const { t } = useI18n();
5
+ export function useMediaItems() {
9
6
  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
- }
7
+ link: useLink(),
8
+ image: useImage(),
9
+ table: useTable()
212
10
  }
213
11
  }
@@ -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
  }