tiptapify 0.0.10 → 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 (107) hide show
  1. package/README.md +7 -3
  2. package/dist/tiptapify.css +1 -1
  3. package/dist/tiptapify.mjs +18524 -17801
  4. package/dist/tiptapify.umd.js +77 -38
  5. package/index.d.ts +2 -2
  6. package/package.json +41 -40
  7. package/src/components/MenuBubble.vue +8 -8
  8. package/src/components/Tiptapify.vue +5 -6
  9. package/src/components/Toolbar/Group.vue +2 -2
  10. package/src/components/Toolbar/GroupBtn.vue +12 -9
  11. package/src/components/Toolbar/GroupDropdown.vue +5 -19
  12. package/src/components/Toolbar/Index.vue +13 -9
  13. package/src/components/Toolbar/Items.vue +5 -8
  14. package/src/components/Toolbar/Toggle.vue +3 -5
  15. package/src/components/Toolbar/defaultExtensionComponents.ts +34 -13
  16. package/src/components/Toolbar/items.ts +53 -70
  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 +17 -2
  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 +9 -0
  57. package/src/composables/Toolbar/useAlignmentItems.ts +13 -0
  58. package/src/composables/Toolbar/useFormatExtraItems.ts +15 -0
  59. package/src/composables/Toolbar/useFormatItems.ts +13 -0
  60. package/src/composables/Toolbar/useListItems.ts +15 -0
  61. package/src/composables/Toolbar/useMediaItems.ts +11 -0
  62. package/src/composables/Toolbar/useMiscItems.ts +17 -0
  63. package/src/composables/Toolbar/useStyleItems.ts +17 -0
  64. package/src/{components/Toolbar/fonts.ts → constants/style.ts} +21 -0
  65. package/src/extensions/components/FontFamily.vue +82 -0
  66. package/src/extensions/components/FontSize.vue +83 -0
  67. package/src/extensions/components/ImageDialog.vue +7 -3
  68. package/src/extensions/components/LineHeight.vue +82 -0
  69. package/src/extensions/components/LinkDialog.vue +27 -7
  70. package/src/extensions/components/PreviewDialog.vue +11 -4
  71. package/src/extensions/components/ShowSourceDialog.vue +10 -6
  72. package/src/extensions/components/StyleColor.vue +2 -2
  73. package/src/extensions/components/slashCommands/CommandsList.vue +1 -4
  74. package/src/extensions/image.ts +2 -1
  75. package/src/extensions/link.ts +10 -1
  76. package/src/extensions/preview.ts +2 -1
  77. package/src/extensions/slash-commands.ts +1 -1
  78. package/src/extensions/view-source.ts +2 -1
  79. package/src/i18n/locales/ch.json +84 -82
  80. package/src/i18n/locales/cz.json +32 -30
  81. package/src/i18n/locales/de.json +28 -26
  82. package/src/i18n/locales/en.json +3 -1
  83. package/src/i18n/locales/es.json +30 -28
  84. package/src/i18n/locales/fr.json +30 -28
  85. package/src/i18n/locales/it.json +32 -30
  86. package/src/i18n/locales/la.json +61 -59
  87. package/src/i18n/locales/lt.json +38 -36
  88. package/src/i18n/locales/nl.json +31 -29
  89. package/src/i18n/locales/pl.json +32 -30
  90. package/src/i18n/locales/pt.json +29 -27
  91. package/src/i18n/locales/ru.json +3 -1
  92. package/src/i18n/locales/se.json +30 -28
  93. package/src/i18n/locales/ua.json +3 -1
  94. package/src/index.ts +3 -1
  95. package/src/types/extensionComponents.ts +22 -0
  96. package/src/types/toolbarItems.ts +43 -0
  97. package/src/types/toolbarSections.ts +11 -0
  98. package/src/components/Toolbar/items/actions.ts +0 -32
  99. package/src/components/Toolbar/items/alignment.ts +0 -60
  100. package/src/components/Toolbar/items/format.ts +0 -60
  101. package/src/components/Toolbar/items/formatExtra.ts +0 -73
  102. package/src/components/Toolbar/items/list.ts +0 -70
  103. package/src/components/Toolbar/items/media.ts +0 -211
  104. package/src/components/Toolbar/items/misc.ts +0 -59
  105. package/src/components/Toolbar/items/style.ts +0 -204
  106. package/src/types/overridable-extensions.ts +0 -6
  107. /package/src/{components → extensions/components}/CodeBlockComponent.vue +0 -0
@@ -1,4 +1,5 @@
1
1
  {
2
+ "defaultValue": "Значення за замовчуванням",
2
3
  "content": {
3
4
  "placeholder": "Напишіть щонебудь..."
4
5
  },
@@ -109,7 +110,8 @@
109
110
  },
110
111
  "misc": {
111
112
  "source": "Перегляд вихідного коду",
112
- "preview": "Попередній перегляд"
113
+ "preview": "Попередній перегляд",
114
+ "toggleInvisibleCharacters": "Показати/приховати невидимі символи"
113
115
  },
114
116
  "footer": {
115
117
  "words": "слова",
package/src/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Plugin } from 'vue';
2
2
  import Tiptapify from '@tiptapify/components/Tiptapify.vue';
3
+ import TiptapifyDialog from '@tiptapify/components/UI/TiptapifyDialog.vue';
3
4
  import { getI18n } from "@tiptapify/i18n";
4
5
 
5
6
  interface PackageOptions {
@@ -11,8 +12,9 @@ const TiptapifyPlugin: Plugin = {
11
12
  const locale = options.locale || 'en'
12
13
  app.use(getI18n(locale));
13
14
  app.component('Tiptapify', Tiptapify);
15
+ app.component('TiptapifyDialog', TiptapifyDialog);
14
16
  }
15
17
  };
16
18
 
17
- export { Tiptapify };
19
+ export { Tiptapify, TiptapifyDialog };
18
20
  export default TiptapifyPlugin;
@@ -0,0 +1,22 @@
1
+ import { ToolbarSections } from "@tiptapify/types/toolbarSections";
2
+ import { ComputedRef } from "vue";
3
+
4
+ export enum ToolbarItemType {
5
+ dropdown = 'dropdown',
6
+ modal = 'modal',
7
+ }
8
+
9
+ export type extensionComponents = {
10
+ [key: string]: {
11
+ type: ToolbarItemType,
12
+ component: any,
13
+ extensions?: Array<any>,
14
+ componentProps?: any
15
+ props?: any
16
+ attrs?: any
17
+ section: ToolbarSections,
18
+ name: ComputedRef|string,
19
+ tooltip: ComputedRef|string,
20
+ icon: ComputedRef|string,
21
+ }
22
+ }
@@ -0,0 +1,43 @@
1
+ import { ComputedRef } from "vue";
2
+
3
+ type ToolbarItemAttrs = {
4
+ [key: string]: Function | any
5
+ }
6
+
7
+ type ToolbarItemProps = {
8
+ [key: string]: any
9
+ }
10
+
11
+ export type ToolbarItem = {
12
+ // type: ToolbarItemType,
13
+ name: string|number|ComputedRef<string>,
14
+ tooltip: string|ComputedRef<string>,
15
+ icon: string|ComputedRef<string>,
16
+ icon2?: string|ComputedRef<string>,
17
+ svg?: boolean,
18
+ noI18n?: boolean,
19
+ enabled: boolean,
20
+ component?: any,
21
+ modelValue?: any,
22
+ group?: boolean,
23
+ toggle?: boolean,
24
+ icon2Props?: ToolbarItemProps,
25
+ componentProps?: ToolbarItemProps,
26
+ props?: ToolbarItemProps,
27
+ attrs?: ToolbarItemAttrs,
28
+ children?: ToolbarItems|ToolbarItem[],
29
+ }
30
+
31
+ export type ToolbarItems = {
32
+ [key: string]: ToolbarItem
33
+ }
34
+
35
+ export type ToolbarItemSection = {
36
+ group?: boolean,
37
+ toggle?: boolean,
38
+ items: ToolbarItems | {},
39
+ }
40
+
41
+ export type ToolbarItemSections = {
42
+ [key: string]: ToolbarItemSection
43
+ }
@@ -0,0 +1,11 @@
1
+ export enum ToolbarSections {
2
+ actions = 'actions',
3
+ alignment = 'alignment',
4
+ extra = 'extra',
5
+ formatExtra = 'formatExtra',
6
+ format = 'format',
7
+ list = 'list',
8
+ media = 'media',
9
+ misc = 'misc',
10
+ style = 'style',
11
+ }
@@ -1,32 +0,0 @@
1
- import * as mdi from "@mdi/js";
2
- import { Editor } from "@tiptap/vue-3";
3
- import { computed } from "vue";
4
-
5
- export function getActionsItems(editor: Editor) {
6
- return {
7
- undo: {
8
- name: 'undo',
9
- tooltip: 'action.undo',
10
- icon: mdi.mdiUndo,
11
- enabled: true,
12
- props: {
13
- disabled: computed(() => !editor.can().chain().focus().undo().run()),
14
- },
15
- attrs: {
16
- click: () => editor.chain().focus().undo().run()
17
- }
18
- },
19
- redo: {
20
- name: 'redo',
21
- tooltip: 'action.redo',
22
- icon: mdi.mdiRedo,
23
- enabled: true,
24
- props: {
25
- disabled: computed(() => !editor.can().chain().focus().redo().run()),
26
- },
27
- attrs: {
28
- click: () => editor.chain().focus().redo().run()
29
- }
30
- }
31
- }
32
- }
@@ -1,60 +0,0 @@
1
- import * as mdi from "@mdi/js";
2
- import { Editor } from "@tiptap/vue-3";
3
- import { computed } from "vue";
4
-
5
- export function getAlignmentItems(editor: Editor) {
6
- return {
7
- alignmentLeft: {
8
- name: 'alignments.left',
9
- tooltip: 'alignments.left',
10
- icon: mdi.mdiFormatAlignLeft,
11
- enabled: true,
12
- props: {
13
- active: false,
14
- color: computed(() => editor.isActive({ textAlign: 'left' }) ? 'primary' : ''),
15
- },
16
- attrs: {
17
- click: () => editor.chain().focus().toggleTextAlign('left').run()
18
- }
19
- },
20
- alignmentCenter: {
21
- name: 'alignments.center',
22
- tooltip: 'alignments.center',
23
- icon: mdi.mdiFormatAlignCenter,
24
- enabled: true,
25
- props: {
26
- active: false,
27
- color: computed(() => editor.isActive({ textAlign: 'center' }) ? 'primary' : ''),
28
- },
29
- attrs: {
30
- click: () => editor.chain().focus().toggleTextAlign('center').run()
31
- }
32
- },
33
- alignmentRight: {
34
- name: 'alignments.right',
35
- tooltip: 'alignments.right',
36
- icon: mdi.mdiFormatAlignRight,
37
- enabled: true,
38
- props: {
39
- active: false,
40
- color: computed(() => editor.isActive({ textAlign: 'right' }) ? 'primary' : ''),
41
- },
42
- attrs: {
43
- click: () => editor.chain().focus().toggleTextAlign('right').run()
44
- }
45
- },
46
- alignmentJustify: {
47
- name: 'alignments.justify',
48
- tooltip: 'alignments.justify',
49
- icon: mdi.mdiFormatAlignJustify,
50
- enabled: true,
51
- props: {
52
- active: false,
53
- color: computed(() => editor.isActive({ textAlign: 'justify' }) ? 'primary' : ''),
54
- },
55
- attrs: {
56
- click: () => editor.chain().focus().toggleTextAlign('justify').run()
57
- }
58
- },
59
- }
60
- }
@@ -1,60 +0,0 @@
1
- import * as mdi from "@mdi/js";
2
- import { Editor } from "@tiptap/vue-3";
3
- import { computed } from "vue";
4
-
5
- export function getFormatItems(editor: Editor) {
6
- return {
7
- bold: {
8
- name: 'bold',
9
- tooltip: 'format.bold',
10
- icon: mdi.mdiFormatBold,
11
- enabled: true,
12
- props: {
13
- disabled: computed(() => !editor.can().chain().focus().toggleBold().run()),
14
- color: computed(() => editor.isActive('bold') ? 'primary' : ''),
15
- },
16
- attrs: {
17
- click: () => editor.chain().focus().toggleBold().run()
18
- }
19
- },
20
- italic: {
21
- name: 'italic',
22
- tooltip: 'format.italic',
23
- icon: mdi.mdiFormatItalic,
24
- enabled: true,
25
- props: {
26
- disabled: computed(() => !editor.can().chain().focus().toggleItalic().run()),
27
- color: computed(() => editor.isActive('italic') ? 'primary' : ''),
28
- },
29
- attrs: {
30
- click: () => editor.chain().focus().toggleItalic().run()
31
- }
32
- },
33
- underline: {
34
- name: 'underline',
35
- tooltip: 'format.underline',
36
- icon: mdi.mdiFormatUnderline,
37
- enabled: true,
38
- props: {
39
- disabled: computed(() => !editor.can().chain().focus().toggleUnderline().run()),
40
- color: computed(() => editor.isActive('underline') ? 'primary' : ''),
41
- },
42
- attrs: {
43
- click: () => editor.chain().focus().toggleUnderline().run()
44
- }
45
- },
46
- strike: {
47
- name: 'strike',
48
- tooltip: 'format.strike',
49
- icon: mdi.mdiFormatStrikethroughVariant,
50
- enabled: true,
51
- props: {
52
- disabled: computed(() => !editor.can().chain().focus().toggleStrike().run()),
53
- color: computed(() => editor.isActive('strike') ? 'primary' : ''),
54
- },
55
- attrs: {
56
- click: () => editor.chain().focus().toggleStrike().run()
57
- }
58
- }
59
- }
60
- }
@@ -1,73 +0,0 @@
1
- import * as mdi from "@mdi/js";
2
- import { Editor } from "@tiptap/vue-3";
3
- import { computed } from "vue";
4
-
5
- export function getFormatExtraItems(editor: Editor) {
6
- return {
7
- sup: {
8
- name: 'sup',
9
- tooltip: 'format.sup',
10
- icon: mdi.mdiFormatSuperscript,
11
- enabled: true,
12
- props: {
13
- disabled: computed(() => !editor.can().chain().focus().toggleSuperscript().run()),
14
- color: computed(() => editor.isActive('superscript') ? 'primary' : ''),
15
- },
16
- attrs: {
17
- click: () => editor.chain().focus().toggleSuperscript().run()
18
- }
19
- },
20
- sub: {
21
- name: 'sub',
22
- tooltip: 'format.sub',
23
- icon: mdi.mdiFormatSubscript,
24
- enabled: true,
25
- props: {
26
- disabled: computed(() => !editor.can().chain().focus().toggleSubscript().run()),
27
- color: computed(() => editor.isActive('subscript') ? 'primary' : ''),
28
- },
29
- attrs: {
30
- click: () => editor.chain().focus().toggleSubscript().run()
31
- }
32
- },
33
- code: {
34
- name: 'code',
35
- tooltip: 'format.code',
36
- icon: mdi.mdiXml,
37
- enabled: true,
38
- props: {
39
- disabled: computed(() => !editor.can().chain().focus().toggleCode().run()),
40
- color: computed(() => editor.isActive('code') ? 'primary' : ''),
41
- },
42
- attrs: {
43
- click: () => editor.chain().focus().toggleCode().run()
44
- }
45
- },
46
- codeBlock: {
47
- name: 'codeblock',
48
- tooltip: 'format.codeblock',
49
- icon: mdi.mdiCodeBlockTags,
50
- enabled: true,
51
- props: {
52
- disabled: computed(() => !editor.can().chain().focus().toggleCodeBlock().run()),
53
- color: computed(() => editor.isActive('codeBlock') ? 'primary' : ''),
54
- },
55
- attrs: {
56
- click: () => editor.chain().focus().toggleCodeBlock().run()
57
- }
58
- },
59
- blockquote: {
60
- name: 'blockquote',
61
- tooltip: 'format.blockquote',
62
- icon: mdi.mdiCommentQuote,
63
- enabled: true,
64
- props: {
65
- disabled: computed(() => !editor.can().chain().focus().toggleBlockquote().run() || editor.isActive('codeBlock') || editor.isActive('code')),
66
- color: computed(() => editor.isActive('blockquote') ? 'primary' : ''),
67
- },
68
- attrs: {
69
- click: () => editor.chain().focus().toggleBlockquote().run()
70
- }
71
- }
72
- }
73
- }
@@ -1,70 +0,0 @@
1
- import * as mdi from "@mdi/js";
2
- import { Editor } from "@tiptap/vue-3";
3
- import { computed } from "vue";
4
-
5
- export function getListItems(editor: Editor) {
6
- return {
7
- listBullet: {
8
- name: 'lists.bullet',
9
- tooltip: 'lists.bullet',
10
- icon: mdi.mdiFormatListBulleted,
11
- enabled: true,
12
- props: {
13
- color: computed(() => editor.isActive('bulletList') ? 'primary' : ''),
14
- },
15
- attrs: {
16
- click: () => editor.chain().focus().toggleBulletList().run()
17
- }
18
- },
19
- listNumbered: {
20
- name: 'lists.numbered',
21
- tooltip: 'lists.numbered',
22
- icon: mdi.mdiFormatListNumbered,
23
- enabled: true,
24
- props: {
25
- color: computed(() => editor.isActive('orderedList') ? 'primary' : ''),
26
- },
27
- attrs: {
28
- click: () => editor.chain().focus().toggleOrderedList().run()
29
- }
30
- },
31
- listTask: {
32
- name: 'lists.task',
33
- tooltip: 'lists.task',
34
- icon: mdi.mdiFormatListChecks,
35
- enabled: true,
36
- props: {
37
- color: computed(() => editor.isActive('taskList') ? 'primary' : ''),
38
- },
39
- attrs: {
40
- click: () => editor.chain().focus().toggleTaskList().run()
41
- }
42
- },
43
- listIndent: {
44
- name: 'lists.indent',
45
- tooltip: 'lists.indent',
46
- icon: mdi.mdiFormatIndentIncrease,
47
- enabled: true,
48
- props: {
49
- disabled: computed(() => !editor.can().sinkListItem('listItem')),
50
- active: false,
51
- },
52
- attrs: {
53
- click: () => editor.chain().focus().sinkListItem('listItem').run()
54
- }
55
- },
56
- listOutdent: {
57
- name: 'lists.outdent',
58
- tooltip: 'lists.outdent',
59
- icon: mdi.mdiFormatIndentDecrease,
60
- enabled: true,
61
- props: {
62
- disabled: computed(() => !editor.can().liftListItem('listItem')),
63
- active: false,
64
- },
65
- attrs: {
66
- click: () => editor.chain().focus().liftListItem('listItem').run()
67
- }
68
- }
69
- }
70
- }
@@ -1,211 +0,0 @@
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
-
6
- export function getMediaItems(editor: Editor) {
7
- return {
8
- link: {
9
- name: 'media.link',
10
- tooltip: 'media.link',
11
- icon: computed(() => editor.isActive('link') ? mdi.mdiLinkOff : mdi.mdiLink),
12
- enabled: true,
13
- props: {
14
- color: computed(() => editor.isActive('link') ? 'primary' : ''),
15
- disabled: computed(() => editor.isActive('code') || editor.isActive('codeBlock')),
16
- },
17
- attrs: {
18
- click: () => editor.commands.showLink()
19
- }
20
- },
21
- image: {
22
- name: 'media.image',
23
- tooltip: 'media.image',
24
- icon: mdi.mdiImage,
25
- enabled: true,
26
- props: {
27
- color: computed(() => editor.isActive('image') ? 'primary' : ''),
28
- disabled: computed(() => editor.isActive('code') || editor.isActive('codeBlock')),
29
- },
30
- attrs: {
31
- click: () => editor.commands.showTiptapifyImage()
32
- }
33
- },
34
- table: {
35
- name: 'tables',
36
- tooltip: 'media.tables.table',
37
- icon: mdi.mdiTable,
38
- modelValue: false,
39
- enabled: true,
40
- props: {
41
- color: computed(() => editor.isActive('table') ? 'primary' : ''),
42
- disabled: computed(() => !editor.can().chain().focus().insertTable().run()),
43
- },
44
- children: [
45
- {
46
- name: 'insert table',
47
- tooltip: 'media.tables.insertTable',
48
- icon: mdi.mdiTablePlus,
49
- enabled: true,
50
- props: {
51
- disabled: computed(() => !editor.can().chain().focus().insertTable().run()),
52
- activator: 'parent',
53
- openOnClick: true,
54
- openOnHover: false,
55
- closeOnContentClick: false,
56
- submenu: true
57
- },
58
- component: markRaw(TableBuilder),
59
- },
60
- {
61
- name: 'delete table',
62
- tooltip: 'media.tables.deleteTable',
63
- icon: mdi.mdiTableMinus,
64
- enabled: true,
65
- props: {
66
- disabled: computed(() => !editor.can().chain().focus().deleteTable().run()),
67
- },
68
- attrs: {
69
- click: () => editor.chain().focus().deleteTable().run()
70
- }
71
- },
72
- {
73
- name: 'table row',
74
- tooltip: 'media.tables.row',
75
- icon: mdi.mdiTableRow,
76
- enabled: true,
77
- props: {
78
- disabled: computed(
79
- () =>
80
- !editor.can().chain().focus().addRowBefore().run() &&
81
- !editor.can().chain().focus().addRowAfter().run() &&
82
- !editor.can().chain().focus().deleteRow().run()
83
- ),
84
- openOnHover: true,
85
- openOnClick: true,
86
- activator: 'parent',
87
- submenu: true
88
- },
89
- children: [
90
- {
91
- name: 'insert row before',
92
- tooltip: 'media.tables.insertRowBefore',
93
- icon: mdi.mdiTableRowPlusBefore,
94
- enabled: true,
95
- props: {
96
- disabled: computed(() => !editor.can().chain().focus().addRowBefore().run()),
97
- },
98
- attrs: {
99
- click: () => editor.chain().focus().addRowBefore().run()
100
- }
101
- },
102
- {
103
- name: 'insert row after',
104
- tooltip: 'media.tables.insertRowAfter',
105
- icon: mdi.mdiTableRowPlusAfter,
106
- enabled: true,
107
- props: {
108
- disabled: computed(() => !editor.can().chain().focus().addRowAfter().run()),
109
- },
110
- attrs: {
111
- click: () => editor.chain().focus().addRowAfter().run()
112
- }
113
- },
114
- {
115
- name: 'delete row',
116
- tooltip: 'media.tables.deleteRow',
117
- icon: mdi.mdiTableRowRemove,
118
- enabled: true,
119
- props: {
120
- disabled: computed(() => !editor.can().chain().focus().deleteRow().run()),
121
- },
122
- attrs: {
123
- click: () => editor.chain().focus().deleteRow().run()
124
- }
125
- },
126
- ]
127
- },
128
- {
129
- name: 'column',
130
- tooltip: 'media.tables.col',
131
- icon: mdi.mdiTableColumn,
132
- enabled: true,
133
- props: {
134
- disabled: computed(
135
- () =>
136
- !editor.can().chain().focus().addColumnBefore().run() &&
137
- !editor.can().chain().focus().addColumnAfter().run() &&
138
- !editor.can().chain().focus().deleteColumn().run()
139
- ),
140
- openOnHover: true,
141
- openOnClick: true,
142
- activator: 'parent',
143
- submenu: true
144
- },
145
- children: [
146
- {
147
- name: 'insert col before',
148
- tooltip: 'media.tables.insertColBefore',
149
- icon: mdi.mdiTableColumnPlusBefore,
150
- enabled: true,
151
- props: {
152
- disabled: computed(() => !editor.can().chain().focus().addColumnBefore().run()),
153
- },
154
- attrs: {
155
- click: () => editor.chain().focus().addColumnBefore().run()
156
- }
157
- },
158
- {
159
- name: 'insert column after',
160
- tooltip: 'media.tables.insertColAfter',
161
- icon: mdi.mdiTableColumnPlusAfter,
162
- enabled: true,
163
- props: {
164
- disabled: computed(() => !editor.can().chain().focus().addColumnAfter().run()),
165
- },
166
- attrs: {
167
- click: () => editor.chain().focus().addColumnAfter().run()
168
- }
169
- },
170
- {
171
- name: 'delete column',
172
- tooltip: 'media.tables.deleteCol',
173
- icon: mdi.mdiTableColumnRemove,
174
- enabled: true,
175
- props: {
176
- disabled: computed(() => !editor.can().chain().focus().deleteColumn().run()),
177
- },
178
- attrs: {
179
- click: () => editor.chain().focus().deleteColumn().run()
180
- }
181
- }
182
- ]
183
- },
184
- {
185
- name: 'merge cells',
186
- tooltip: 'media.tables.mergeCells',
187
- icon: mdi.mdiTableMergeCells,
188
- enabled: true,
189
- props: {
190
- disabled: computed(() => !editor.can().chain().focus().mergeCells().run()),
191
- },
192
- attrs: {
193
- click: () => editor.chain().focus().mergeCells().run()
194
- }
195
- },
196
- {
197
- name: 'split cell',
198
- tooltip: 'media.tables.splitCell',
199
- icon: mdi.mdiTableSplitCell,
200
- enabled: true,
201
- props: {
202
- disabled: computed(() => !editor.can().chain().focus().splitCell().run()),
203
- },
204
- attrs: {
205
- click: () => editor.chain().focus().splitCell().run()
206
- }
207
- }
208
- ]
209
- }
210
- }
211
- }
@@ -1,59 +0,0 @@
1
- import * as mdi from "@mdi/js";
2
- import { Editor } from "@tiptap/vue-3";
3
- import { computed } from "vue";
4
-
5
- export function getMiscItems(editor: Editor) {
6
- return {
7
- line: {
8
- name: 'line',
9
- tooltip: 'format.line',
10
- icon: mdi.mdiMinus,
11
- enabled: true,
12
- props: {},
13
- attrs: {
14
- click: () => editor.chain().focus().setHorizontalRule().run()
15
- }
16
- },
17
- break: {
18
- name: 'break',
19
- tooltip: 'format.break',
20
- icon: mdi.mdiFormatPageBreak,
21
- enabled: true,
22
- props: {},
23
- attrs: {
24
- click: () => editor.chain().focus().setHardBreak().run()
25
- }
26
- },
27
- source: {
28
- name: 'source',
29
- tooltip: 'misc.source',
30
- icon: mdi.mdiCodeTags,
31
- enabled: true,
32
- props: {},
33
- attrs: {
34
- click: () => editor.commands.showSource()
35
- }
36
- },
37
- preview: {
38
- name: 'preview',
39
- tooltip: 'misc.preview',
40
- icon: mdi.mdiFileEyeOutline,
41
- enabled: true,
42
- attrs: {
43
- click: () => editor.commands.showPreview()
44
- }
45
- },
46
- formatClear: {
47
- name: 'format clear',
48
- tooltip: 'format.formatClear',
49
- icon: mdi.mdiFormatClear,
50
- enabled: true,
51
- props: {
52
- disabled: computed(() => !editor.can().chain().focus().unsetAllMarks().run()),
53
- },
54
- attrs: {
55
- click: () => editor.chain().focus().unsetAllMarks().clearNodes().run()
56
- }
57
- },
58
- }
59
- }