tiptapify 0.0.5 → 0.0.7
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 -1
- package/dist/tiptapify.css +1 -1
- package/dist/{tiptapify.es.js → tiptapify.mjs} +52867 -51790
- package/dist/tiptapify.umd.js +41 -43
- package/package.json +8 -8
- package/src/components/Footer.vue +5 -6
- package/src/components/MenuBubble.vue +61 -47
- package/src/components/MenuFloating.vue +38 -34
- package/src/components/Tiptapify.vue +139 -23
- package/src/components/Toolbar/Group.vue +43 -0
- package/src/components/Toolbar/GroupDropdown.vue +85 -0
- package/src/components/Toolbar/Index.vue +51 -79
- package/src/components/Toolbar/Toggle.vue +33 -0
- package/src/components/Toolbar/items/actions.ts +32 -0
- package/src/components/Toolbar/items/alignment.ts +60 -0
- package/src/components/Toolbar/items/format.ts +73 -0
- package/src/components/Toolbar/items/formatExtra.ts +73 -0
- package/src/components/Toolbar/items/list.ts +70 -0
- package/src/components/Toolbar/items/media.ts +202 -0
- package/src/components/Toolbar/items/misc.ts +59 -0
- package/src/components/Toolbar/items/style.ts +146 -0
- package/src/components/Toolbar/items.ts +73 -545
- package/src/components/editorExtensions.ts +6 -4
- package/src/components/index.ts +13 -0
- package/src/{components/extensions → extensions}/components/LinkDialog.vue +11 -8
- package/src/extensions/components/PreviewDialog.vue +45 -0
- package/src/{components/extensions/components/ShowSource.vue → extensions/components/ShowSourceDialog.vue} +11 -7
- package/src/extensions/components/TableBuilder.vue +138 -0
- package/src/extensions/preview.ts +53 -0
- package/src/{components/extensions → extensions}/view-source.ts +1 -3
- package/src/i18n/locales/de.json +64 -45
- package/src/i18n/locales/en.json +21 -2
- package/src/i18n/locales/es.json +27 -8
- package/src/i18n/locales/fr.json +26 -7
- package/src/i18n/locales/it.json +36 -17
- package/src/i18n/locales/pl.json +28 -9
- package/src/i18n/locales/ru.json +21 -2
- package/src/i18n/locales/ua.json +21 -2
- package/src/utils/helpers.ts +17 -0
- package/src/composable/useEditor.ts +0 -35
- /package/src/{components/extensions → extensions}/components/slashCommands/CommandsList.vue +0 -0
- /package/src/{components/extensions → extensions}/components/slashCommands/suggestion.ts +0 -0
- /package/src/{components/extensions → extensions}/slash-commands.ts +0 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { defineProps, PropType } from 'vue'
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
4
|
+
|
|
5
|
+
import helpers from "@tiptapify/utils/helpers";
|
|
6
|
+
|
|
7
|
+
import { ToolbarItem } from "@tiptapify/components/Toolbar/items";
|
|
8
|
+
|
|
9
|
+
const { ucFirst } = helpers;
|
|
10
|
+
|
|
11
|
+
defineProps({
|
|
12
|
+
variant: { type: String, default () { return 'flat' }},
|
|
13
|
+
nested: { type: Boolean, default () { return false }},
|
|
14
|
+
toolbarItem: { type: Object as PropType<ToolbarItem>, default() { return {} }}
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const { t } = useI18n();
|
|
18
|
+
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<VMenu v-model="toolbarItem.modelValue" v-bind="toolbarItem.props">
|
|
23
|
+
<template v-if="!nested" #activator="{ props: menuProps }">
|
|
24
|
+
<VBtn v-bind="{ ...menuProps, ...toolbarItem.props }" size="32">
|
|
25
|
+
<VTooltip :text="ucFirst(t(toolbarItem.tooltip))" location="top" activator="parent" />
|
|
26
|
+
|
|
27
|
+
<VIcon v-if="toolbarItem.icon" :icon="toolbarItem.icon" size="small" />
|
|
28
|
+
<span v-else class="menu-item-title">
|
|
29
|
+
{{ ucFirst(t(toolbarItem.name)) }}
|
|
30
|
+
</span>
|
|
31
|
+
</VBtn>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<VList v-model="toolbarItem.modelValue" max-height="430px">
|
|
35
|
+
<VListItem
|
|
36
|
+
v-for="(item, menuItemKey) in toolbarItem.children"
|
|
37
|
+
:key="menuItemKey"
|
|
38
|
+
:value="item.name"
|
|
39
|
+
density="compact"
|
|
40
|
+
class="pa-0"
|
|
41
|
+
>
|
|
42
|
+
<VBtn
|
|
43
|
+
variant="text"
|
|
44
|
+
block
|
|
45
|
+
class="justify-start"
|
|
46
|
+
rounded="0"
|
|
47
|
+
v-bind="item.props ?? {}"
|
|
48
|
+
v-on="item?.attrs ?? {}"
|
|
49
|
+
>
|
|
50
|
+
<VTooltip v-if="item.tooltip" :text="ucFirst(t(item.tooltip))" location="top" activator="parent" />
|
|
51
|
+
|
|
52
|
+
<VIcon v-if="item.icon" :icon="item.icon" size="small" />
|
|
53
|
+
|
|
54
|
+
<span v-else class="menu-item-title">
|
|
55
|
+
<template v-if="item.noI18n">
|
|
56
|
+
{{ item.name }}
|
|
57
|
+
</template>
|
|
58
|
+
<template v-else>
|
|
59
|
+
{{ ucFirst(t(item.toggle)) }}
|
|
60
|
+
</template>
|
|
61
|
+
</span>
|
|
62
|
+
|
|
63
|
+
<VMenu
|
|
64
|
+
v-if="item.component"
|
|
65
|
+
v-bind="item.props"
|
|
66
|
+
>
|
|
67
|
+
<VList>
|
|
68
|
+
<VListItem density="compact">
|
|
69
|
+
<component :is="item.component" @close="toolbarItem.modelValue = false" />
|
|
70
|
+
</VListItem>
|
|
71
|
+
</VList>
|
|
72
|
+
</VMenu>
|
|
73
|
+
|
|
74
|
+
<template v-if="item.children?.length">
|
|
75
|
+
<GroupDropdown :toolbar-item="item" variant="outline" :nested="true" />
|
|
76
|
+
</template>
|
|
77
|
+
</VBtn>
|
|
78
|
+
</VListItem>
|
|
79
|
+
</VList>
|
|
80
|
+
</VMenu>
|
|
81
|
+
</template>
|
|
82
|
+
|
|
83
|
+
<style lang="scss" scoped>
|
|
84
|
+
|
|
85
|
+
</style>
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import { Editor } from "@tiptap/vue-3";
|
|
3
|
+
import LinkDialog from "@tiptapify/extensions/components/LinkDialog.vue";
|
|
4
|
+
import ShowSourceDialog from "@tiptapify/extensions/components/ShowSourceDialog.vue";
|
|
5
|
+
import PreviewDialog from "@tiptapify/extensions/components/PreviewDialog.vue";
|
|
6
|
+
import Group from "@tiptapify/components/Toolbar/Group.vue";
|
|
7
|
+
import Toggle from "@tiptapify/components/Toolbar/Toggle.vue";
|
|
8
|
+
import { computed, defineProps, inject, Ref, ref } from 'vue'
|
|
6
9
|
import { useI18n } from "vue-i18n";
|
|
7
10
|
|
|
8
11
|
import { toolbarItems, ToolbarItemSections } from "@tiptapify/components/Toolbar/items";
|
|
@@ -15,17 +18,18 @@ const props = defineProps({
|
|
|
15
18
|
fontMeasure: { type: String, default () { return 'px' }},
|
|
16
19
|
customFonts: { type: Array<string>, default () { return [] } },
|
|
17
20
|
customFontsOverride: { type: Boolean, default() { return false } },
|
|
21
|
+
theme: { type: String, default() { return 'light' } },
|
|
22
|
+
rounded: { type: String, default() { return '0' } },
|
|
18
23
|
})
|
|
19
24
|
|
|
20
25
|
const { t } = useI18n();
|
|
21
26
|
|
|
22
|
-
const
|
|
23
|
-
const editorInstance = ref(editor.getInstance())
|
|
27
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
24
28
|
|
|
25
29
|
const toolbarLinkButton = ref(null)
|
|
26
30
|
|
|
27
31
|
const items = toolbarItems(
|
|
28
|
-
|
|
32
|
+
editor,
|
|
29
33
|
computed(() => props.fontMeasure).value,
|
|
30
34
|
{ list: computed(() => props.items).value, exclude: computed(() => props.itemsExclude).value },
|
|
31
35
|
computed(() => props.headingLevels).value,
|
|
@@ -36,83 +40,42 @@ const toolbarItemsRef: Ref<ToolbarItemSections> = ref(items)
|
|
|
36
40
|
</script>
|
|
37
41
|
|
|
38
42
|
<template>
|
|
39
|
-
<div v-if="editor"
|
|
40
|
-
<
|
|
41
|
-
<
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
</VBtnToggle>
|
|
60
|
-
|
|
61
|
-
<VMenu v-else>
|
|
62
|
-
<template #activator="{ props: menuProps }">
|
|
63
|
-
<VBtn :variant="variant" v-bind="menuProps" size="32" class="menu-button">
|
|
64
|
-
<VTooltip :text="t(toolbarItem.tooltip)" location="top" activator="parent" />
|
|
65
|
-
|
|
66
|
-
<VIcon v-if="toolbarItem.icon" :icon="toolbarItem.icon" size="small" />
|
|
67
|
-
<span v-else class="menu-item-title">
|
|
68
|
-
{{ t(toolbarItem.name) }}
|
|
69
|
-
</span>
|
|
70
|
-
</VBtn>
|
|
71
|
-
</template>
|
|
72
|
-
|
|
73
|
-
<VList v-model="toolbarItem.modelValue" max-height="430px">
|
|
74
|
-
<VListItem
|
|
75
|
-
v-for="(item, menuItemKey) in toolbarItem.children"
|
|
76
|
-
:key="menuItemKey"
|
|
77
|
-
:value="item.name"
|
|
78
|
-
density="compact"
|
|
79
|
-
v-bind="item.props"
|
|
80
|
-
v-on="item.attrs"
|
|
81
|
-
>
|
|
82
|
-
<VTooltip v-if="item.tooltip" :text="t(item.tooltip)" location="top" activator="parent" />
|
|
83
|
-
|
|
84
|
-
<VListItemTitle>
|
|
85
|
-
<VIcon v-if="item.icon" :icon="item.icon" size="small" />
|
|
86
|
-
<span v-else class="menu-item-title">
|
|
87
|
-
<template v-if="item.noI18n">
|
|
88
|
-
{{ item.name }}
|
|
89
|
-
</template>
|
|
90
|
-
<template v-else>
|
|
91
|
-
{{ t(item.name) }}
|
|
92
|
-
</template>
|
|
93
|
-
</span>
|
|
94
|
-
</VListItemTitle>
|
|
95
|
-
</VListItem>
|
|
96
|
-
</VList>
|
|
97
|
-
</VMenu>
|
|
98
|
-
</template>
|
|
99
|
-
|
|
100
|
-
<VBtn v-else :variant="variant" v-bind="toolbarItem.props" v-on="toolbarItem.attrs" class="menu-button" size="32">
|
|
43
|
+
<div v-if="editor">
|
|
44
|
+
<VToolbar elevation="1" :theme="theme" height="auto" :class="`ps-1 rounded-t-${rounded}`">
|
|
45
|
+
<VToolbarItems class="py-2">
|
|
46
|
+
<template v-for="(toolbarSection, sectionKey) in toolbarItemsRef" :key="sectionKey">
|
|
47
|
+
<Group v-if="toolbarSection.group" :variant="variant" :toolbar-section="toolbarSection" />
|
|
48
|
+
|
|
49
|
+
<Toggle v-else-if="toolbarSection.toggle" :variant="variant" :toolbar-section="toolbarSection" />
|
|
50
|
+
|
|
51
|
+
<VBtn
|
|
52
|
+
v-else
|
|
53
|
+
v-for="(toolbarItem, itemKey) in toolbarSection.items"
|
|
54
|
+
:key="itemKey"
|
|
55
|
+
:variant="variant"
|
|
56
|
+
v-bind="toolbarItem.props"
|
|
57
|
+
v-on="toolbarItem.attrs"
|
|
58
|
+
class="menu-button"
|
|
59
|
+
size="32"
|
|
60
|
+
elevation="4"
|
|
61
|
+
rounded="sm"
|
|
62
|
+
>
|
|
101
63
|
<VTooltip :text="t(toolbarItem.tooltip)" location="top" activator="parent" />
|
|
102
64
|
|
|
103
65
|
<VIcon v-if="toolbarItem.icon" :icon="toolbarItem.icon" size="16" />
|
|
104
66
|
<span v-else class="menu-item-title">
|
|
105
|
-
|
|
106
|
-
|
|
67
|
+
{{ t(toolbarItem.name) }}
|
|
68
|
+
</span>
|
|
107
69
|
</VBtn>
|
|
108
|
-
</template>
|
|
109
|
-
</template>
|
|
110
70
|
|
|
111
|
-
|
|
112
|
-
|
|
71
|
+
<div class="menu-divider"></div>
|
|
72
|
+
</template>
|
|
73
|
+
</VToolbarItems>
|
|
74
|
+
</VToolbar>
|
|
113
75
|
|
|
114
76
|
<LinkDialog ref="toolbarLinkButton" />
|
|
115
|
-
<
|
|
77
|
+
<PreviewDialog />
|
|
78
|
+
<ShowSourceDialog />
|
|
116
79
|
</div>
|
|
117
80
|
</template>
|
|
118
81
|
|
|
@@ -122,6 +85,10 @@ const toolbarItemsRef: Ref<ToolbarItemSections> = ref(items)
|
|
|
122
85
|
border-bottom: var(--border);
|
|
123
86
|
}
|
|
124
87
|
|
|
88
|
+
:deep(.toolbar__items) {
|
|
89
|
+
flex-wrap: wrap;
|
|
90
|
+
}
|
|
91
|
+
|
|
125
92
|
:deep(.v-btn-group) {
|
|
126
93
|
height: 32px !important;
|
|
127
94
|
}
|
|
@@ -134,11 +101,16 @@ const toolbarItemsRef: Ref<ToolbarItemSections> = ref(items)
|
|
|
134
101
|
margin: 0 1px;
|
|
135
102
|
}
|
|
136
103
|
|
|
137
|
-
.
|
|
138
|
-
margin: 0
|
|
104
|
+
.menu-divider {
|
|
105
|
+
margin: 0 4px;
|
|
139
106
|
}
|
|
140
107
|
|
|
141
|
-
.
|
|
108
|
+
.menu-divider:nth-last-child(1) {
|
|
142
109
|
display: none;
|
|
143
110
|
}
|
|
111
|
+
|
|
112
|
+
.v-toolbar-items {
|
|
113
|
+
flex-wrap: wrap;
|
|
114
|
+
row-gap: 5px;
|
|
115
|
+
}
|
|
144
116
|
</style>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { defineProps, PropType } from 'vue'
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
4
|
+
|
|
5
|
+
import { ToolbarItemSection } from "@tiptapify/components/Toolbar/items";
|
|
6
|
+
|
|
7
|
+
defineProps({
|
|
8
|
+
variant: { type: String, default () { return 'flat' }},
|
|
9
|
+
toolbarSection: { type: Object as PropType<ToolbarItemSection>, default() { return {} }}
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
const { t } = useI18n();
|
|
13
|
+
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<VBtnToggle :variant="variant" elevation="4">
|
|
18
|
+
<template v-for="(item, key) in toolbarSection.items" :key="key">
|
|
19
|
+
<VBtn v-bind="item.props" v-on="item.attrs" size="32">
|
|
20
|
+
<VTooltip :text="t(item.name)" location="top" activator="parent" />
|
|
21
|
+
|
|
22
|
+
<VIcon v-if="item.icon" :icon="item.icon" size="small" />
|
|
23
|
+
<span v-else class="menu-item-title">
|
|
24
|
+
{{ t(item.name) }}
|
|
25
|
+
</span>
|
|
26
|
+
</VBtn>
|
|
27
|
+
</template>
|
|
28
|
+
</VBtnToggle>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<style lang="scss" scoped>
|
|
32
|
+
|
|
33
|
+
</style>
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
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
|
+
strike: {
|
|
34
|
+
name: 'strike',
|
|
35
|
+
tooltip: 'format.strike',
|
|
36
|
+
icon: mdi.mdiFormatStrikethroughVariant,
|
|
37
|
+
enabled: true,
|
|
38
|
+
props: {
|
|
39
|
+
disabled: computed(() => !editor.can().chain().focus().toggleStrike().run()),
|
|
40
|
+
color: computed(() => editor.isActive('strike') ? 'primary' : ''),
|
|
41
|
+
},
|
|
42
|
+
attrs: {
|
|
43
|
+
click: () => editor.chain().focus().toggleStrike().run()
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
underline: {
|
|
47
|
+
name: 'underline',
|
|
48
|
+
tooltip: 'format.underline',
|
|
49
|
+
icon: mdi.mdiFormatUnderline,
|
|
50
|
+
enabled: true,
|
|
51
|
+
props: {
|
|
52
|
+
disabled: computed(() => !editor.can().chain().focus().toggleUnderline().run()),
|
|
53
|
+
color: computed(() => editor.isActive('underline') ? 'primary' : ''),
|
|
54
|
+
},
|
|
55
|
+
attrs: {
|
|
56
|
+
click: () => editor.chain().focus().toggleUnderline().run()
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
highlight: {
|
|
60
|
+
name: 'highlight',
|
|
61
|
+
tooltip: 'format.highlight',
|
|
62
|
+
icon: mdi.mdiMarker,
|
|
63
|
+
enabled: true,
|
|
64
|
+
props: {
|
|
65
|
+
disabled: computed(() => !editor.can().chain().focus().toggleHighlight().run()),
|
|
66
|
+
color: computed(() => editor.isActive('highlight') ? 'primary' : ''),
|
|
67
|
+
},
|
|
68
|
+
attrs: {
|
|
69
|
+
click: () => editor.chain().focus().toggleHighlight().run()
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
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()),
|
|
66
|
+
color: computed(() => editor.isActive('blockquote') ? 'primary' : ''),
|
|
67
|
+
},
|
|
68
|
+
attrs: {
|
|
69
|
+
click: () => editor.chain().focus().toggleBlockquote().run()
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
}
|