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.
- package/README.md +7 -3
- package/dist/tiptapify.css +1 -1
- package/dist/tiptapify.mjs +18524 -17801
- package/dist/tiptapify.umd.js +77 -38
- package/index.d.ts +2 -2
- package/package.json +41 -40
- package/src/components/MenuBubble.vue +8 -8
- package/src/components/Tiptapify.vue +5 -6
- package/src/components/Toolbar/Group.vue +2 -2
- package/src/components/Toolbar/GroupBtn.vue +12 -9
- package/src/components/Toolbar/GroupDropdown.vue +5 -19
- package/src/components/Toolbar/Index.vue +13 -9
- package/src/components/Toolbar/Items.vue +5 -8
- package/src/components/Toolbar/Toggle.vue +3 -5
- package/src/components/Toolbar/defaultExtensionComponents.ts +34 -13
- package/src/components/Toolbar/items.ts +53 -70
- package/src/components/UI/BtnIcon.vue +24 -0
- package/src/components/UI/{Dialog.vue → TiptapifyDialog.vue} +4 -3
- package/src/components/editorExtensions.ts +17 -2
- package/src/components/index.ts +8 -2
- package/src/composables/Toolbar/Actions/useRedo.ts +23 -0
- package/src/composables/Toolbar/Actions/useUndo.ts +23 -0
- package/src/composables/Toolbar/Alignment/useAlignmentCenter.ts +24 -0
- package/src/composables/Toolbar/Alignment/useAlignmentJustify.ts +24 -0
- package/src/composables/Toolbar/Alignment/useAlignmentLeft.ts +24 -0
- package/src/composables/Toolbar/Alignment/useAlignmentRight.ts +24 -0
- package/src/composables/Toolbar/Format/useBold.ts +24 -0
- package/src/composables/Toolbar/Format/useItalic.ts +24 -0
- package/src/composables/Toolbar/Format/useStrike.ts +24 -0
- package/src/composables/Toolbar/Format/useUnderline.ts +24 -0
- package/src/composables/Toolbar/FormatExtra/useBlockquote.ts +24 -0
- package/src/composables/Toolbar/FormatExtra/useCode.ts +24 -0
- package/src/composables/Toolbar/FormatExtra/useCodeBlock.ts +24 -0
- package/src/composables/Toolbar/FormatExtra/useSub.ts +24 -0
- package/src/composables/Toolbar/FormatExtra/useSup.ts +24 -0
- package/src/composables/Toolbar/List/useBullet.ts +23 -0
- package/src/composables/Toolbar/List/useIndent.ts +24 -0
- package/src/composables/Toolbar/List/useNumbered.ts +23 -0
- package/src/composables/Toolbar/List/useOutdent.ts +24 -0
- package/src/composables/Toolbar/List/useTask.ts +23 -0
- package/src/composables/Toolbar/Media/useImage.ts +24 -0
- package/src/composables/Toolbar/Media/useLink.ts +24 -0
- package/src/composables/Toolbar/Media/useTable.ts +188 -0
- package/src/composables/Toolbar/Misc/useBreak.ts +21 -0
- package/src/composables/Toolbar/Misc/useFormatClear.ts +23 -0
- package/src/composables/Toolbar/Misc/useInvisibleCharacters.ts +23 -0
- package/src/composables/Toolbar/Misc/useLine.ts +21 -0
- package/src/composables/Toolbar/Misc/usePreview.ts +20 -0
- package/src/composables/Toolbar/Misc/useSource.ts +21 -0
- package/src/composables/Toolbar/Style/useColor.ts +36 -0
- package/src/composables/Toolbar/Style/useFontFamily.ts +49 -0
- package/src/composables/Toolbar/Style/useFontSize.ts +50 -0
- package/src/composables/Toolbar/Style/useHeading.ts +64 -0
- package/src/composables/Toolbar/Style/useHighlight.ts +36 -0
- package/src/composables/Toolbar/Style/useLineHeight.ts +49 -0
- package/src/composables/Toolbar/useActionsItems.ts +9 -0
- package/src/composables/Toolbar/useAlignmentItems.ts +13 -0
- package/src/composables/Toolbar/useFormatExtraItems.ts +15 -0
- package/src/composables/Toolbar/useFormatItems.ts +13 -0
- package/src/composables/Toolbar/useListItems.ts +15 -0
- package/src/composables/Toolbar/useMediaItems.ts +11 -0
- package/src/composables/Toolbar/useMiscItems.ts +17 -0
- package/src/composables/Toolbar/useStyleItems.ts +17 -0
- package/src/{components/Toolbar/fonts.ts → constants/style.ts} +21 -0
- package/src/extensions/components/FontFamily.vue +82 -0
- package/src/extensions/components/FontSize.vue +83 -0
- package/src/extensions/components/ImageDialog.vue +7 -3
- package/src/extensions/components/LineHeight.vue +82 -0
- package/src/extensions/components/LinkDialog.vue +27 -7
- package/src/extensions/components/PreviewDialog.vue +11 -4
- package/src/extensions/components/ShowSourceDialog.vue +10 -6
- package/src/extensions/components/StyleColor.vue +2 -2
- package/src/extensions/components/slashCommands/CommandsList.vue +1 -4
- package/src/extensions/image.ts +2 -1
- package/src/extensions/link.ts +10 -1
- package/src/extensions/preview.ts +2 -1
- package/src/extensions/slash-commands.ts +1 -1
- package/src/extensions/view-source.ts +2 -1
- package/src/i18n/locales/ch.json +84 -82
- package/src/i18n/locales/cz.json +32 -30
- package/src/i18n/locales/de.json +28 -26
- package/src/i18n/locales/en.json +3 -1
- package/src/i18n/locales/es.json +30 -28
- package/src/i18n/locales/fr.json +30 -28
- package/src/i18n/locales/it.json +32 -30
- package/src/i18n/locales/la.json +61 -59
- package/src/i18n/locales/lt.json +38 -36
- package/src/i18n/locales/nl.json +31 -29
- package/src/i18n/locales/pl.json +32 -30
- package/src/i18n/locales/pt.json +29 -27
- package/src/i18n/locales/ru.json +3 -1
- package/src/i18n/locales/se.json +30 -28
- package/src/i18n/locales/ua.json +3 -1
- package/src/index.ts +3 -1
- package/src/types/extensionComponents.ts +22 -0
- package/src/types/toolbarItems.ts +43 -0
- package/src/types/toolbarSections.ts +11 -0
- package/src/components/Toolbar/items/actions.ts +0 -32
- package/src/components/Toolbar/items/alignment.ts +0 -60
- package/src/components/Toolbar/items/format.ts +0 -60
- package/src/components/Toolbar/items/formatExtra.ts +0 -73
- package/src/components/Toolbar/items/list.ts +0 -70
- package/src/components/Toolbar/items/media.ts +0 -211
- package/src/components/Toolbar/items/misc.ts +0 -59
- package/src/components/Toolbar/items/style.ts +0 -204
- package/src/types/overridable-extensions.ts +0 -6
- /package/src/{components → extensions/components}/CodeBlockComponent.vue +0 -0
|
@@ -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
|
+
}
|
|
@@ -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 useIndent() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: computed(() => t('lists.indent')),
|
|
13
|
+
tooltip: computed(() => t('lists.indent')),
|
|
14
|
+
icon: `mdiSvg:${mdi.mdiFormatIndentIncrease}`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {
|
|
17
|
+
disabled: computed(() => !editor.value.can().sinkListItem('listItem')),
|
|
18
|
+
active: false,
|
|
19
|
+
},
|
|
20
|
+
attrs: {
|
|
21
|
+
click: () => editor.value.chain().focus().sinkListItem('listItem').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 useNumbered() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: computed(() => t('lists.numbered')),
|
|
13
|
+
tooltip: computed(() => t('lists.numbered')),
|
|
14
|
+
icon: `mdiSvg:${mdi.mdiFormatListNumbered}`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {
|
|
17
|
+
color: computed(() => editor.value.isActive('orderedList') ? 'primary' : ''),
|
|
18
|
+
},
|
|
19
|
+
attrs: {
|
|
20
|
+
click: () => editor.value.chain().focus().toggleOrderedList().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 useOutdent() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: computed(() => t('lists.outdent')),
|
|
13
|
+
tooltip: computed(() => t('lists.outdent')),
|
|
14
|
+
icon: `mdiSvg:${mdi.mdiFormatIndentDecrease}`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {
|
|
17
|
+
disabled: computed(() => !editor.value.can().liftListItem('listItem')),
|
|
18
|
+
active: false,
|
|
19
|
+
},
|
|
20
|
+
attrs: {
|
|
21
|
+
click: () => editor.value.chain().focus().liftListItem('listItem').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 useTask() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: computed(() => t('lists.task')),
|
|
13
|
+
tooltip: computed(() => t('lists.task')),
|
|
14
|
+
icon: `mdiSvg:${mdi.mdiFormatListChecks}`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {
|
|
17
|
+
color: computed(() => editor.value.isActive('taskList') ? 'primary' : ''),
|
|
18
|
+
},
|
|
19
|
+
attrs: {
|
|
20
|
+
click: () => editor.value.chain().focus().toggleTaskList().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 useImage() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: computed(() => t('media.image')),
|
|
13
|
+
tooltip: computed(() => t('media.image')),
|
|
14
|
+
icon: `mdiSvg:${mdi.mdiImage}`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {
|
|
17
|
+
color: computed(() => editor.value.isActive('image') ? 'primary' : ''),
|
|
18
|
+
disabled: computed(() => editor.value.isActive('code') || editor.value.isActive('codeBlock')),
|
|
19
|
+
},
|
|
20
|
+
attrs: {
|
|
21
|
+
click: () => editor.value.commands.showTiptapifyImage()
|
|
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 useLink() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: computed(() => t('media.link')),
|
|
13
|
+
tooltip: computed(() => t('media.link')),
|
|
14
|
+
icon: computed(() => editor.value.isActive('tiptapifyLink') ? `mdiSvg:${mdi.mdiLinkOff}` : `mdiSvg:${mdi.mdiLink}`),
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {
|
|
17
|
+
color: computed(() => editor.value.isActive('tiptapifyLink') ? 'primary' : ''),
|
|
18
|
+
disabled: computed(() => editor.value.isActive('code') || editor.value.isActive('codeBlock')),
|
|
19
|
+
},
|
|
20
|
+
attrs: {
|
|
21
|
+
click: () => editor.value.commands.showLink()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
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, inject, markRaw, Ref } from "vue";
|
|
5
|
+
import { useI18n } from "vue-i18n";
|
|
6
|
+
|
|
7
|
+
export function useTable() {
|
|
8
|
+
const { t } = useI18n();
|
|
9
|
+
|
|
10
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
11
|
+
|
|
12
|
+
return {
|
|
13
|
+
name: 'tables',
|
|
14
|
+
tooltip: computed(() => t('media.tables.table')),
|
|
15
|
+
icon: `mdiSvg:${mdi.mdiTable}`,
|
|
16
|
+
modelValue: false,
|
|
17
|
+
enabled: true,
|
|
18
|
+
props: {
|
|
19
|
+
color: computed(() => editor.value.isActive('table') ? 'primary' : ''),
|
|
20
|
+
disabled: computed(() => !editor.value.can().chain().focus().insertTable().run()),
|
|
21
|
+
},
|
|
22
|
+
children: [
|
|
23
|
+
{
|
|
24
|
+
name: 'insert table',
|
|
25
|
+
tooltip: computed(() => t('media.tables.insertTable')),
|
|
26
|
+
icon: `mdiSvg:${mdi.mdiTablePlus}`,
|
|
27
|
+
enabled: true,
|
|
28
|
+
props: {
|
|
29
|
+
disabled: computed(() => !editor.value.can().chain().focus().insertTable().run()),
|
|
30
|
+
activator: 'parent',
|
|
31
|
+
openOnClick: true,
|
|
32
|
+
openOnHover: false,
|
|
33
|
+
closeOnContentClick: false,
|
|
34
|
+
submenu: true
|
|
35
|
+
},
|
|
36
|
+
component: markRaw(TableBuilder),
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'delete table',
|
|
40
|
+
tooltip: computed(() => t('media.tables.deleteTable')),
|
|
41
|
+
icon: `mdiSvg:${mdi.mdiTableMinus}`,
|
|
42
|
+
enabled: true,
|
|
43
|
+
props: {
|
|
44
|
+
disabled: computed(() => !editor.value.can().chain().focus().deleteTable().run()),
|
|
45
|
+
},
|
|
46
|
+
attrs: {
|
|
47
|
+
click: () => editor.value.chain().focus().deleteTable().run()
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'table row',
|
|
52
|
+
tooltip: computed(() => t('media.tables.row')),
|
|
53
|
+
icon: `mdiSvg:${mdi.mdiTableRow}`,
|
|
54
|
+
enabled: true,
|
|
55
|
+
props: {
|
|
56
|
+
disabled: computed(
|
|
57
|
+
() =>
|
|
58
|
+
!editor.value.can().chain().focus().addRowBefore().run() &&
|
|
59
|
+
!editor.value.can().chain().focus().addRowAfter().run() &&
|
|
60
|
+
!editor.value.can().chain().focus().deleteRow().run()
|
|
61
|
+
),
|
|
62
|
+
openOnHover: true,
|
|
63
|
+
openOnClick: true,
|
|
64
|
+
activator: 'parent',
|
|
65
|
+
submenu: true
|
|
66
|
+
},
|
|
67
|
+
children: [
|
|
68
|
+
{
|
|
69
|
+
name: 'insert row before',
|
|
70
|
+
tooltip: computed(() => t('media.tables.insertRowBefore')),
|
|
71
|
+
icon: `mdiSvg:${mdi.mdiTableRowPlusBefore}`,
|
|
72
|
+
enabled: true,
|
|
73
|
+
props: {
|
|
74
|
+
disabled: computed(() => !editor.value.can().chain().focus().addRowBefore().run()),
|
|
75
|
+
},
|
|
76
|
+
attrs: {
|
|
77
|
+
click: () => editor.value.chain().focus().addRowBefore().run()
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: 'insert row after',
|
|
82
|
+
tooltip: computed(() => t('media.tables.insertRowAfter')),
|
|
83
|
+
icon: `mdiSvg:${mdi.mdiTableRowPlusAfter}`,
|
|
84
|
+
enabled: true,
|
|
85
|
+
props: {
|
|
86
|
+
disabled: computed(() => !editor.value.can().chain().focus().addRowAfter().run()),
|
|
87
|
+
},
|
|
88
|
+
attrs: {
|
|
89
|
+
click: () => editor.value.chain().focus().addRowAfter().run()
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: 'delete row',
|
|
94
|
+
tooltip: computed(() => t('media.tables.deleteRow')),
|
|
95
|
+
icon: `mdiSvg:${mdi.mdiTableRowRemove}`,
|
|
96
|
+
enabled: true,
|
|
97
|
+
props: {
|
|
98
|
+
disabled: computed(() => !editor.value.can().chain().focus().deleteRow().run()),
|
|
99
|
+
},
|
|
100
|
+
attrs: {
|
|
101
|
+
click: () => editor.value.chain().focus().deleteRow().run()
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: 'column',
|
|
108
|
+
tooltip: computed(() => t('media.tables.col')),
|
|
109
|
+
icon: `mdiSvg:${mdi.mdiTableColumn}`,
|
|
110
|
+
enabled: true,
|
|
111
|
+
props: {
|
|
112
|
+
disabled: computed(
|
|
113
|
+
() =>
|
|
114
|
+
!editor.value.can().chain().focus().addColumnBefore().run() &&
|
|
115
|
+
!editor.value.can().chain().focus().addColumnAfter().run() &&
|
|
116
|
+
!editor.value.can().chain().focus().deleteColumn().run()
|
|
117
|
+
),
|
|
118
|
+
openOnHover: true,
|
|
119
|
+
openOnClick: true,
|
|
120
|
+
activator: 'parent',
|
|
121
|
+
submenu: true
|
|
122
|
+
},
|
|
123
|
+
children: [
|
|
124
|
+
{
|
|
125
|
+
name: 'insert col before',
|
|
126
|
+
tooltip: computed(() => t('media.tables.insertColBefore')),
|
|
127
|
+
icon: `mdiSvg:${mdi.mdiTableColumnPlusBefore}`,
|
|
128
|
+
enabled: true,
|
|
129
|
+
props: {
|
|
130
|
+
disabled: computed(() => !editor.value.can().chain().focus().addColumnBefore().run()),
|
|
131
|
+
},
|
|
132
|
+
attrs: {
|
|
133
|
+
click: () => editor.value.chain().focus().addColumnBefore().run()
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: 'insert column after',
|
|
138
|
+
tooltip: computed(() => t('media.tables.insertColAfter')),
|
|
139
|
+
icon: `mdiSvg:${mdi.mdiTableColumnPlusAfter}`,
|
|
140
|
+
enabled: true,
|
|
141
|
+
props: {
|
|
142
|
+
disabled: computed(() => !editor.value.can().chain().focus().addColumnAfter().run()),
|
|
143
|
+
},
|
|
144
|
+
attrs: {
|
|
145
|
+
click: () => editor.value.chain().focus().addColumnAfter().run()
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: 'delete column',
|
|
150
|
+
tooltip: computed(() => t('media.tables.deleteCol')),
|
|
151
|
+
icon: `mdiSvg:${mdi.mdiTableColumnRemove}`,
|
|
152
|
+
enabled: true,
|
|
153
|
+
props: {
|
|
154
|
+
disabled: computed(() => !editor.value.can().chain().focus().deleteColumn().run()),
|
|
155
|
+
},
|
|
156
|
+
attrs: {
|
|
157
|
+
click: () => editor.value.chain().focus().deleteColumn().run()
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: 'merge cells',
|
|
164
|
+
tooltip: computed(() => t('media.tables.mergeCells')),
|
|
165
|
+
icon: `mdiSvg:${mdi.mdiTableMergeCells}`,
|
|
166
|
+
enabled: true,
|
|
167
|
+
props: {
|
|
168
|
+
disabled: computed(() => !editor.value.can().chain().focus().mergeCells().run()),
|
|
169
|
+
},
|
|
170
|
+
attrs: {
|
|
171
|
+
click: () => editor.value.chain().focus().mergeCells().run()
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: 'split cell',
|
|
176
|
+
tooltip: computed(() => t('media.tables.splitCell')),
|
|
177
|
+
icon: `mdiSvg:${mdi.mdiTableSplitCell}`,
|
|
178
|
+
enabled: true,
|
|
179
|
+
props: {
|
|
180
|
+
disabled: computed(() => !editor.value.can().chain().focus().splitCell().run()),
|
|
181
|
+
},
|
|
182
|
+
attrs: {
|
|
183
|
+
click: () => editor.value.chain().focus().splitCell().run()
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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 useBreak() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: 'break',
|
|
13
|
+
tooltip: computed(() => t('format.break')),
|
|
14
|
+
icon: `mdiSvg:${mdi.mdiFormatPageBreak}`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {},
|
|
17
|
+
attrs: {
|
|
18
|
+
click: () => editor.value.chain().focus().setHardBreak().run()
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -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 useFormatClear() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: 'format clear',
|
|
13
|
+
tooltip: computed(() => t('format.formatClear')),
|
|
14
|
+
icon: `mdiSvg:${mdi.mdiFormatClear}`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {
|
|
17
|
+
disabled: computed(() => !editor.value.can().chain().focus().unsetAllMarks().run()),
|
|
18
|
+
},
|
|
19
|
+
attrs: {
|
|
20
|
+
click: () => editor.value.chain().focus().unsetAllMarks().clearNodes().run()
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Editor } from "@tiptap/vue-3";
|
|
2
|
+
import { computed, inject, Ref } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
4
|
+
|
|
5
|
+
export function useInvisibleCharacters() {
|
|
6
|
+
const { t } = useI18n();
|
|
7
|
+
|
|
8
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
name: 'show/hide invisible characters',
|
|
12
|
+
tooltip: computed(() => t('misc.toggleInvisibleCharacters')),
|
|
13
|
+
svg: true,
|
|
14
|
+
icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><path d="M256 64L512 64C529.7 64 544 78.3 544 96C544 113.7 529.7 128 512 128L480 128L480 544C480 561.7 465.7 576 448 576C430.3 576 416 561.7 416 544L416 128L368 128L368 544C368 561.7 353.7 576 336 576C318.3 576 304 561.7 304 544L304 384L256 384C167.6 384 96 312.4 96 224C96 135.6 167.6 64 256 64z"/></svg>`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {
|
|
17
|
+
color: computed(() => editor.value.storage.invisibleCharacters.visibility() ? 'primary' : ''),
|
|
18
|
+
},
|
|
19
|
+
attrs: {
|
|
20
|
+
click: () => editor.value.commands.toggleInvisibleCharacters()
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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 useLine() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: 'line',
|
|
13
|
+
tooltip: computed(() => t('format.line')),
|
|
14
|
+
icon: `mdiSvg:${mdi.mdiMinus}`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {},
|
|
17
|
+
attrs: {
|
|
18
|
+
click: () => editor.value.chain().focus().setHorizontalRule().run()
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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 usePreview() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: 'preview',
|
|
13
|
+
tooltip: computed(() => t('misc.preview')),
|
|
14
|
+
icon: `mdiSvg:${mdi.mdiFileEyeOutline}`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
attrs: {
|
|
17
|
+
click: () => editor.value.commands.showPreview()
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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 useSource() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: 'source',
|
|
13
|
+
tooltip: computed(() => t('misc.source')),
|
|
14
|
+
icon: `mdiSvg:${mdi.mdiCodeTags}`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {},
|
|
17
|
+
attrs: {
|
|
18
|
+
click: () => editor.value.commands.showSource()
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as mdi from "@mdi/js";
|
|
2
|
+
import { Editor } from "@tiptap/vue-3";
|
|
3
|
+
import StyleColor from "@tiptapify/extensions/components/StyleColor.vue";
|
|
4
|
+
import { computed, inject, markRaw, Ref } from "vue";
|
|
5
|
+
import { useI18n } from "vue-i18n";
|
|
6
|
+
|
|
7
|
+
export function useColor(theme: any) {
|
|
8
|
+
const { t } = useI18n();
|
|
9
|
+
|
|
10
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
11
|
+
|
|
12
|
+
return {
|
|
13
|
+
name: 'color',
|
|
14
|
+
tooltip: computed(() => t('style.color.text')),
|
|
15
|
+
icon: `mdiSvg:${mdi.mdiFormatColorText}`,
|
|
16
|
+
icon2: `mdiSvg:${mdi.mdiColorHelper}`,
|
|
17
|
+
enabled: true,
|
|
18
|
+
props: {
|
|
19
|
+
disabled: computed(() => !editor.value.can().chain().focus().toggleHighlight().run()),
|
|
20
|
+
},
|
|
21
|
+
icon2Props: {
|
|
22
|
+
disabled: computed(() => !editor.value.can().chain().focus().toggleHighlight().run()),
|
|
23
|
+
color: computed(() => {
|
|
24
|
+
const defaultColor = theme.global.current.value.dark ? '#fff' : '#000'
|
|
25
|
+
return editor.value.getAttributes('textStyle').color || defaultColor
|
|
26
|
+
}),
|
|
27
|
+
style: 'filter: drop-shadow(rgba(0, 0, 0, .75) 1px 1px 2px);'
|
|
28
|
+
},
|
|
29
|
+
component: markRaw(StyleColor),
|
|
30
|
+
componentProps: {
|
|
31
|
+
fontColor: true,
|
|
32
|
+
backgroundColor: false,
|
|
33
|
+
color: computed(() => editor.value.getAttributes('textStyle').color || ''),
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as mdi from "@mdi/js";
|
|
2
|
+
import { Editor } from "@tiptap/vue-3";
|
|
3
|
+
import { fonts } from "@tiptapify/constants/style";
|
|
4
|
+
import FontFamily from "@tiptapify/extensions/components/FontFamily.vue";
|
|
5
|
+
import { computed, inject, markRaw, Ref } from "vue";
|
|
6
|
+
import { useI18n } from "vue-i18n";
|
|
7
|
+
|
|
8
|
+
export function useFontFamily() {
|
|
9
|
+
const { t } = useI18n();
|
|
10
|
+
|
|
11
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
name: 'font-family',
|
|
15
|
+
tooltip: computed(() => t('style.fontFamily')),
|
|
16
|
+
icon: `mdiSvg:${mdi.mdiFormatFont}`,
|
|
17
|
+
modelValue: false,
|
|
18
|
+
enabled: true,
|
|
19
|
+
props: {
|
|
20
|
+
disabled: computed(() => !editor.value.can().chain().focus().unsetFontFamily().run()),
|
|
21
|
+
color: computed(() => {
|
|
22
|
+
let color = ''
|
|
23
|
+
for (const font in fonts) {
|
|
24
|
+
if (editor.value.isActive('textStyle', { fontFamily: fonts[font].fontFamily })) {
|
|
25
|
+
color = 'primary'
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return color
|
|
31
|
+
}),
|
|
32
|
+
},
|
|
33
|
+
component: markRaw(FontFamily),
|
|
34
|
+
componentProps: {
|
|
35
|
+
fonts: fonts,
|
|
36
|
+
fontFamily: computed(() => {
|
|
37
|
+
let fontFamily = ''
|
|
38
|
+
for (const font in fonts) {
|
|
39
|
+
if (editor.value.isActive('textStyle', { fontFamily: fonts[font].fontFamily })) {
|
|
40
|
+
fontFamily = fonts[font].fontFamily
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return fontFamily
|
|
46
|
+
}),
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as mdi from "@mdi/js";
|
|
2
|
+
import { Editor } from "@tiptap/vue-3";
|
|
3
|
+
import { fontSizes } from "@tiptapify/constants/style";
|
|
4
|
+
import FontSize from "@tiptapify/extensions/components/FontSize.vue";
|
|
5
|
+
import { computed, inject, markRaw, Ref } from "vue";
|
|
6
|
+
import { useI18n } from "vue-i18n";
|
|
7
|
+
|
|
8
|
+
export function useFontSize(fontMeasure: string) {
|
|
9
|
+
const { t } = useI18n();
|
|
10
|
+
|
|
11
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
name: 'font-size',
|
|
15
|
+
tooltip: computed(() => t('style.fontSize')),
|
|
16
|
+
icon: `mdiSvg:${mdi.mdiFormatSize}`,
|
|
17
|
+
modelValue: false,
|
|
18
|
+
enabled: true,
|
|
19
|
+
props: {
|
|
20
|
+
disabled: computed(() => !editor.value.can().chain().focus().unsetFontSize().run()),
|
|
21
|
+
color: computed(() => {
|
|
22
|
+
let color = ''
|
|
23
|
+
for (const size of fontSizes) {
|
|
24
|
+
if (editor.value.isActive('textStyle', { fontSize: `${size}${fontMeasure}` })) {
|
|
25
|
+
color = 'primary'
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return color
|
|
31
|
+
}),
|
|
32
|
+
},
|
|
33
|
+
component: markRaw(FontSize),
|
|
34
|
+
componentProps: {
|
|
35
|
+
sizes: fontSizes,
|
|
36
|
+
measure: fontMeasure,
|
|
37
|
+
fontSize: computed(() => {
|
|
38
|
+
let fontSize = null
|
|
39
|
+
for (const size of fontSizes) {
|
|
40
|
+
if (editor.value.isActive('textStyle', { fontSize: `${size}${fontMeasure}` })) {
|
|
41
|
+
fontSize = size
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return fontSize
|
|
47
|
+
}),
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|