tiptapify 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -4
- package/dist/tiptapify.css +1 -1
- package/dist/tiptapify.mjs +47819 -28736
- package/dist/tiptapify.umd.js +78 -38
- package/index.d.ts +2 -2
- package/package.json +49 -45
- package/src/components/MenuBubble.vue +8 -8
- package/src/components/Tiptapify.vue +4 -5
- package/src/components/Toolbar/Group.vue +2 -2
- package/src/components/Toolbar/GroupBtn.vue +11 -8
- package/src/components/Toolbar/GroupDropdown.vue +3 -17
- package/src/components/Toolbar/Index.vue +13 -10
- package/src/components/Toolbar/Items.vue +3 -6
- package/src/components/Toolbar/Toggle.vue +2 -4
- package/src/components/Toolbar/defaultExtensionComponents.ts +34 -13
- package/src/components/Toolbar/items.ts +43 -60
- package/src/components/UI/BtnIcon.vue +24 -0
- package/src/components/UI/{Dialog.vue → TiptapifyDialog.vue} +4 -3
- package/src/components/editorExtensions.ts +16 -1
- 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/useEmoji.ts +20 -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 +5 -31
- package/src/composables/Toolbar/useAlignmentItems.ts +9 -59
- package/src/composables/Toolbar/useFormatExtraItems.ts +11 -72
- package/src/composables/Toolbar/useFormatItems.ts +9 -59
- package/src/composables/Toolbar/useListItems.ts +11 -69
- package/src/composables/Toolbar/useMediaItems.ts +9 -209
- package/src/composables/Toolbar/useMiscItems.ts +13 -58
- package/src/composables/Toolbar/useStyleItems.ts +14 -228
- package/src/extensions/components/Emoji.vue +109 -0
- package/src/extensions/components/ImageDialog.vue +7 -3
- package/src/extensions/components/LinkDialog.vue +7 -3
- package/src/extensions/components/PreviewDialog.vue +11 -4
- package/src/extensions/components/ShowSourceDialog.vue +7 -4
- package/src/extensions/components/StyleColor.vue +2 -2
- package/src/extensions/components/slashCommands/CommandsList.vue +1 -4
- package/src/extensions/emoji/activities.ts +770 -0
- package/src/extensions/emoji/animals_and_nature.ts +1330 -0
- package/src/extensions/emoji/component.ts +74 -0
- package/src/extensions/emoji/flags.ts +2210 -0
- package/src/extensions/emoji/food_and_drink.ts +1066 -0
- package/src/extensions/emoji/index.ts +63 -0
- package/src/extensions/emoji/objects.ts +2514 -0
- package/src/extensions/emoji/people_and_body.ts +3986 -0
- package/src/extensions/emoji/smileys_and_emotion.ts +1482 -0
- package/src/extensions/emoji/symbols.ts +2242 -0
- package/src/extensions/emoji/travel_and_places.ts +2138 -0
- package/src/extensions/image.ts +2 -1
- package/src/extensions/link.ts +2 -1
- package/src/extensions/preview.ts +2 -1
- package/src/extensions/view-source.ts +2 -1
- package/src/i18n/index.ts +1 -0
- package/src/i18n/locales/ch.json +14 -1
- package/src/i18n/locales/cz.json +14 -1
- package/src/i18n/locales/de.json +14 -1
- package/src/i18n/locales/en.json +14 -1
- package/src/i18n/locales/es.json +14 -1
- package/src/i18n/locales/fr.json +14 -1
- package/src/i18n/locales/it.json +14 -1
- package/src/i18n/locales/la.json +14 -1
- package/src/i18n/locales/lt.json +14 -1
- package/src/i18n/locales/nl.json +14 -1
- package/src/i18n/locales/pl.json +14 -1
- package/src/i18n/locales/pt.json +14 -1
- package/src/i18n/locales/ru.json +14 -1
- package/src/i18n/locales/se.json +14 -1
- package/src/i18n/locales/ua.json +14 -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/types/overridable-extensions.ts +0 -6
|
@@ -6,63 +6,26 @@ import { useListItems } from "@tiptapify/composables/Toolbar/useListItems";
|
|
|
6
6
|
import { useMediaItems } from "@tiptapify/composables/Toolbar/useMediaItems";
|
|
7
7
|
import { useMiscItems } from "@tiptapify/composables/Toolbar/useMiscItems";
|
|
8
8
|
import { useStyleItems } from "@tiptapify/composables/Toolbar/useStyleItems";
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface ToolbarItemProps {
|
|
16
|
-
[key: string]: any
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface ToolbarItem {
|
|
20
|
-
name: string|number|ComputedRef<string>,
|
|
21
|
-
tooltip: string|ComputedRef<string>,
|
|
22
|
-
icon: string|ComputedRef<string>,
|
|
23
|
-
icon2?: string|ComputedRef<string>,
|
|
24
|
-
noI18n?: boolean,
|
|
25
|
-
enabled: boolean,
|
|
26
|
-
component?: any,
|
|
27
|
-
modelValue?: any,
|
|
28
|
-
group?: boolean,
|
|
29
|
-
toggle?: boolean,
|
|
30
|
-
icon2Props?: ToolbarItemProps,
|
|
31
|
-
componentProps?: ToolbarItemProps,
|
|
32
|
-
props?: ToolbarItemProps,
|
|
33
|
-
attrs?: ToolbarItemAttrs,
|
|
34
|
-
children?: ToolbarItems|ToolbarItem[],
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface ToolbarItems {
|
|
38
|
-
[key: string]: ToolbarItem
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface ToolbarItemSection {
|
|
42
|
-
group?: boolean,
|
|
43
|
-
toggle?: boolean,
|
|
44
|
-
items: ToolbarItems,
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface ToolbarItemSections {
|
|
48
|
-
[key: string]: ToolbarItemSection
|
|
49
|
-
}
|
|
9
|
+
import { extensionComponents } from "@tiptapify/types/extensionComponents";
|
|
10
|
+
import { ref } from "vue";
|
|
11
|
+
|
|
12
|
+
import { ToolbarItem, ToolbarItemSections } from '@tiptapify/types/toolbarItems'
|
|
50
13
|
|
|
51
14
|
export function toolbarItems(
|
|
52
|
-
editor: any,
|
|
53
15
|
theme: any,
|
|
54
16
|
fontMeasure: string,
|
|
55
|
-
items: { list: Array<
|
|
56
|
-
customHeadingLevels: Array<number
|
|
17
|
+
items: { list: Array<ToolbarItem>, exclude: boolean },
|
|
18
|
+
customHeadingLevels: Array<number>,
|
|
19
|
+
customExtensions: extensionComponents
|
|
57
20
|
): ToolbarItemSections {
|
|
58
|
-
const styleItems = ref(useStyleItems(
|
|
59
|
-
const formatItems = ref(useFormatItems(
|
|
60
|
-
const formatExtraItems = ref(useFormatExtraItems(
|
|
61
|
-
const alignmentItems = ref(useAlignmentItems(
|
|
62
|
-
const listItems = ref(useListItems(
|
|
63
|
-
const actionsItems = ref(useActionsItems(
|
|
64
|
-
const miscItems = ref(useMiscItems(
|
|
65
|
-
const mediaItems = ref(useMediaItems(
|
|
21
|
+
const styleItems = ref(useStyleItems(theme, fontMeasure, customHeadingLevels))
|
|
22
|
+
const formatItems = ref(useFormatItems())
|
|
23
|
+
const formatExtraItems = ref(useFormatExtraItems())
|
|
24
|
+
const alignmentItems = ref(useAlignmentItems())
|
|
25
|
+
const listItems = ref(useListItems())
|
|
26
|
+
const actionsItems = ref(useActionsItems())
|
|
27
|
+
const miscItems = ref(useMiscItems())
|
|
28
|
+
const mediaItems = ref(useMediaItems())
|
|
66
29
|
|
|
67
30
|
const allMenuItems: ToolbarItemSections = {
|
|
68
31
|
/**
|
|
@@ -78,6 +41,7 @@ export function toolbarItems(
|
|
|
78
41
|
list: { group: true, items: listItems.value },
|
|
79
42
|
actions: { group: true, items: actionsItems.value },
|
|
80
43
|
misc: { group: true, items: miscItems.value },
|
|
44
|
+
extra: { group: true, items: {} },
|
|
81
45
|
}
|
|
82
46
|
|
|
83
47
|
const pluginsList: Array<string> = []
|
|
@@ -85,13 +49,13 @@ export function toolbarItems(
|
|
|
85
49
|
Object.keys(allMenuItems[section]).forEach(item => pluginsList.push(item))
|
|
86
50
|
})
|
|
87
51
|
|
|
88
|
-
if (items.list.length) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
52
|
+
// if (items.list.length) {
|
|
53
|
+
// items.list.forEach(item => {
|
|
54
|
+
// if (!pluginsList.includes(item)) {
|
|
55
|
+
// throw new Error(`Unknown plugin name: ${item}! Supported plugins: ${pluginsList.join(', ')}`)
|
|
56
|
+
// }
|
|
57
|
+
// })
|
|
58
|
+
// }
|
|
95
59
|
|
|
96
60
|
const toolbarItems: ToolbarItemSections = {}
|
|
97
61
|
|
|
@@ -100,7 +64,7 @@ export function toolbarItems(
|
|
|
100
64
|
Object.keys(allMenuItems).forEach(sectionName => {
|
|
101
65
|
const section = allMenuItems[sectionName]
|
|
102
66
|
Object.keys(section.items).forEach(plugin => {
|
|
103
|
-
const item = section.items[plugin]
|
|
67
|
+
const item: ToolbarItem = section.items[plugin]
|
|
104
68
|
|
|
105
69
|
if (items.list.length) {
|
|
106
70
|
item.enabled = items.list.includes(plugin)
|
|
@@ -132,5 +96,24 @@ export function toolbarItems(
|
|
|
132
96
|
}
|
|
133
97
|
})
|
|
134
98
|
|
|
99
|
+
// add/override custom extensions
|
|
100
|
+
Object.keys(customExtensions).forEach(extension => {
|
|
101
|
+
const section = customExtensions[extension].section
|
|
102
|
+
|
|
103
|
+
if (typeof customExtensions[extension]?.props === 'undefined') {
|
|
104
|
+
customExtensions[extension].props = toolbarItems[section]?.items[extension]?.props ?? {}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (typeof customExtensions[extension]?.attrs === 'undefined') {
|
|
108
|
+
customExtensions[extension].attrs = toolbarItems[section]?.items[extension]?.attrs ?? {}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (typeof toolbarItems[section] === 'undefined') {
|
|
112
|
+
toolbarItems[section] = { group: true, items: {} }
|
|
113
|
+
toolbarItems[section].items[extension] = {}
|
|
114
|
+
}
|
|
115
|
+
toolbarItems[section].items[extension] = customExtensions[extension]
|
|
116
|
+
})
|
|
117
|
+
|
|
135
118
|
return toolbarItems
|
|
136
119
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { defineProps } from 'vue'
|
|
3
|
+
import * as mdi from '@mdi/js'
|
|
4
|
+
|
|
5
|
+
defineProps({
|
|
6
|
+
icon: String
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
const isSvgString = (icon: any) => {
|
|
10
|
+
return typeof icon === 'string' && icon.includes('<svg')
|
|
11
|
+
}
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<div v-if="isSvgString(icon)" v-html="icon" class="v-icon tiptapify-btn-svg-icon"></div>
|
|
16
|
+
<VIcon v-else :icon="icon || `mdiSvg:${mdi.mdiImageBrokenVariant}`" size="small" />
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<style lang="scss" scoped>
|
|
20
|
+
.tiptapify-btn-svg-icon {
|
|
21
|
+
width: 16px;
|
|
22
|
+
height: 16px;
|
|
23
|
+
}
|
|
24
|
+
</style>
|
|
@@ -6,6 +6,7 @@ import { useI18n } from "vue-i18n";
|
|
|
6
6
|
|
|
7
7
|
const props = defineProps({
|
|
8
8
|
module: String,
|
|
9
|
+
title: String,
|
|
9
10
|
fullscreen: { type: Boolean, default () { return false } },
|
|
10
11
|
maxWidth: { type: Number, default () { return 800 } },
|
|
11
12
|
})
|
|
@@ -103,17 +104,17 @@ watch(() => dialog.value, async () => {
|
|
|
103
104
|
</script>
|
|
104
105
|
|
|
105
106
|
<template>
|
|
106
|
-
<VDialog v-model="dialog" :max-width="maxWidth" :fullscreen="fullscreen"
|
|
107
|
+
<VDialog v-model="dialog" :max-width="maxWidth" :fullscreen="fullscreen" @click:outside="emitClose">
|
|
107
108
|
<VCard>
|
|
108
109
|
<VCardTitle ref="movableHandler" :class="`d-flex ${!fullscreen ? 'tiptapify-movable-handler' : ''}`" style="user-select: none;">
|
|
109
110
|
<VLabel>
|
|
110
|
-
{{ t(`dialog.${module}.title`) }}
|
|
111
|
+
{{ title ?? t(`dialog.${module}.title`) }}
|
|
111
112
|
</VLabel>
|
|
112
113
|
|
|
113
114
|
<VSpacer />
|
|
114
115
|
|
|
115
116
|
<VBtn density="compact" class="tiptapify-dialog-close" variant="elevated" elevation="4" icon @click="emitClose">
|
|
116
|
-
<VIcon size="x-small" :icon="mdi.mdiClose" />
|
|
117
|
+
<VIcon size="x-small" :icon="`mdiSvg:${mdi.mdiClose}`" />
|
|
117
118
|
</VBtn>
|
|
118
119
|
</VCardTitle>
|
|
119
120
|
|
|
@@ -22,6 +22,7 @@ import { TextAlign } from '@tiptap/extension-text-align'
|
|
|
22
22
|
import { Underline } from '@tiptap/extension-underline'
|
|
23
23
|
import { TableKit } from '@tiptap/extension-table'
|
|
24
24
|
import { CodeBlockLowlight } from '@tiptap/extension-code-block-lowlight'
|
|
25
|
+
import { InvisibleCharacters } from '@tiptap/extension-invisible-characters'
|
|
25
26
|
|
|
26
27
|
import { TiptapifyLink } from '@tiptapify/extensions/link'
|
|
27
28
|
import { TiptapifyImage } from '@tiptapify/extensions/image'
|
|
@@ -30,6 +31,7 @@ import { ViewSource } from '@tiptapify/extensions/view-source'
|
|
|
30
31
|
import { Preview } from '@tiptapify/extensions/preview'
|
|
31
32
|
import SlashCommands from '@tiptapify/extensions/slash-commands'
|
|
32
33
|
import suggestion from '@tiptapify/extensions/components/slashCommands/suggestion'
|
|
34
|
+
import { extensionComponents } from "@tiptapify/types/extensionComponents";
|
|
33
35
|
|
|
34
36
|
// load all languages with "all" or common languages with "common"
|
|
35
37
|
import { common, createLowlight } from 'lowlight'
|
|
@@ -47,7 +49,7 @@ const lowlight = createLowlight(common)
|
|
|
47
49
|
// register language example
|
|
48
50
|
// lowlight.register('ts', ts)
|
|
49
51
|
|
|
50
|
-
export function editorExtensions (placeholder: string, slashCommands: boolean) {
|
|
52
|
+
export function editorExtensions (placeholder: string, slashCommands: boolean, customExtensions: extensionComponents) {
|
|
51
53
|
const extensions = [
|
|
52
54
|
TextStyleKit,
|
|
53
55
|
Document,
|
|
@@ -94,6 +96,9 @@ export function editorExtensions (placeholder: string, slashCommands: boolean) {
|
|
|
94
96
|
Placeholder.configure({ placeholder }),
|
|
95
97
|
CharacterCount,
|
|
96
98
|
ViewSource,
|
|
99
|
+
InvisibleCharacters.configure({
|
|
100
|
+
visible: false,
|
|
101
|
+
}),
|
|
97
102
|
Preview
|
|
98
103
|
]
|
|
99
104
|
|
|
@@ -101,5 +106,15 @@ export function editorExtensions (placeholder: string, slashCommands: boolean) {
|
|
|
101
106
|
extensions.push(SlashCommands.configure({ suggestion }))
|
|
102
107
|
}
|
|
103
108
|
|
|
109
|
+
if (Object.keys(customExtensions).length) {
|
|
110
|
+
for (const customExtension of Object.values(customExtensions)) {
|
|
111
|
+
if (typeof customExtension.extensions !== 'undefined') {
|
|
112
|
+
for (const extension of customExtension.extensions) {
|
|
113
|
+
extensions.push(extension)
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
104
119
|
return extensions
|
|
105
120
|
}
|
package/src/components/index.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { Editor, useEditor } from "@tiptap/vue-3";
|
|
2
2
|
import { editorExtensions } from "@tiptapify/components/editorExtensions";
|
|
3
|
+
import { extensionComponents } from "@tiptapify/types/extensionComponents";
|
|
3
4
|
import { ShallowRef } from "vue";
|
|
4
5
|
|
|
5
|
-
export function getTiptapEditor (
|
|
6
|
-
|
|
6
|
+
export function getTiptapEditor (
|
|
7
|
+
content: any,
|
|
8
|
+
placeholder: string,
|
|
9
|
+
slashCommands: boolean = true,
|
|
10
|
+
customExtensions: extensionComponents
|
|
11
|
+
): ShallowRef<Editor | undefined> {
|
|
12
|
+
const extensions = editorExtensions(placeholder, slashCommands, customExtensions)
|
|
7
13
|
const editor: ShallowRef<Editor | undefined> = useEditor({
|
|
8
14
|
content,
|
|
9
15
|
extensions,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as mdi from "@mdi/js";
|
|
2
|
+
import { Editor } from "@tiptap/vue-3";
|
|
3
|
+
import { computed, inject, Ref } from "vue";
|
|
4
|
+
import { useI18n } from "vue-i18n";
|
|
5
|
+
|
|
6
|
+
export function useRedo() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: 'redo',
|
|
13
|
+
tooltip: computed(() => t('action.redo')),
|
|
14
|
+
icon: `mdiSvg:${mdi.mdiRedo}`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {
|
|
17
|
+
disabled: computed(() => !editor.value.can().chain().focus().redo().run()),
|
|
18
|
+
},
|
|
19
|
+
attrs: {
|
|
20
|
+
click: () => editor.value.chain().focus().redo().run()
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as mdi from "@mdi/js";
|
|
2
|
+
import { Editor } from "@tiptap/vue-3";
|
|
3
|
+
import { computed, inject, Ref } from "vue";
|
|
4
|
+
import { useI18n } from "vue-i18n";
|
|
5
|
+
|
|
6
|
+
export function useUndo() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: 'undo',
|
|
13
|
+
tooltip: computed(() => t('action.undo')),
|
|
14
|
+
icon: `mdiSvg:${mdi.mdiUndo}`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {
|
|
17
|
+
disabled: computed(() => !editor.value.can().chain().focus().undo().run()),
|
|
18
|
+
},
|
|
19
|
+
attrs: {
|
|
20
|
+
click: () => editor.value.chain().focus().undo().run()
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as mdi from "@mdi/js";
|
|
2
|
+
import { Editor } from "@tiptap/vue-3";
|
|
3
|
+
import { computed, inject, Ref } from "vue";
|
|
4
|
+
import { useI18n } from "vue-i18n";
|
|
5
|
+
|
|
6
|
+
export function useAlignmentCenter() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: computed(() => t('alignments.center')),
|
|
13
|
+
tooltip: computed(() => t('alignments.center')),
|
|
14
|
+
icon: `mdiSvg:${mdi.mdiFormatAlignCenter}`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {
|
|
17
|
+
active: false,
|
|
18
|
+
color: computed(() => editor.value.isActive({ textAlign: 'center' }) ? 'primary' : ''),
|
|
19
|
+
},
|
|
20
|
+
attrs: {
|
|
21
|
+
click: () => editor.value.chain().focus().toggleTextAlign('center').run()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as mdi from "@mdi/js";
|
|
2
|
+
import { Editor } from "@tiptap/vue-3";
|
|
3
|
+
import { computed, inject, Ref } from "vue";
|
|
4
|
+
import { useI18n } from "vue-i18n";
|
|
5
|
+
|
|
6
|
+
export function useAlignmentJustify() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: computed(() => t('alignments.justify')),
|
|
13
|
+
tooltip: computed(() => t('alignments.justify')),
|
|
14
|
+
icon: `mdiSvg:${mdi.mdiFormatAlignJustify}`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {
|
|
17
|
+
active: false,
|
|
18
|
+
color: computed(() => editor.value.isActive({ textAlign: 'justify' }) ? 'primary' : ''),
|
|
19
|
+
},
|
|
20
|
+
attrs: {
|
|
21
|
+
click: () => editor.value.chain().focus().toggleTextAlign('justify').run()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as mdi from "@mdi/js";
|
|
2
|
+
import { Editor } from "@tiptap/vue-3";
|
|
3
|
+
import { computed, inject, Ref } from "vue";
|
|
4
|
+
import { useI18n } from "vue-i18n";
|
|
5
|
+
|
|
6
|
+
export function useAlignmentLeft() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: computed(() => t('alignments.left')),
|
|
13
|
+
tooltip: computed(() => t('alignments.left')),
|
|
14
|
+
icon: `mdiSvg:${mdi.mdiFormatAlignLeft}`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {
|
|
17
|
+
active: false,
|
|
18
|
+
color: computed(() => editor.value.isActive({ textAlign: 'left' }) ? 'primary' : ''),
|
|
19
|
+
},
|
|
20
|
+
attrs: {
|
|
21
|
+
click: () => editor.value.chain().focus().toggleTextAlign('left').run()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as mdi from "@mdi/js";
|
|
2
|
+
import { Editor } from "@tiptap/vue-3";
|
|
3
|
+
import { computed, inject, Ref } from "vue";
|
|
4
|
+
import { useI18n } from "vue-i18n";
|
|
5
|
+
|
|
6
|
+
export function useAlignmentRight() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: computed(() => t('alignments.right')),
|
|
13
|
+
tooltip: computed(() => t('alignments.right')),
|
|
14
|
+
icon: `mdiSvg:${mdi.mdiFormatAlignRight}`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {
|
|
17
|
+
active: false,
|
|
18
|
+
color: computed(() => editor.value.isActive({ textAlign: 'right' }) ? 'primary' : ''),
|
|
19
|
+
},
|
|
20
|
+
attrs: {
|
|
21
|
+
click: () => editor.value.chain().focus().toggleTextAlign('right').run()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as mdi from "@mdi/js";
|
|
2
|
+
import { Editor } from "@tiptap/vue-3";
|
|
3
|
+
import { computed, inject, Ref } from "vue";
|
|
4
|
+
import { useI18n } from "vue-i18n";
|
|
5
|
+
|
|
6
|
+
export function useBold() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: 'bold',
|
|
13
|
+
tooltip: computed(() => t('format.bold')),
|
|
14
|
+
icon: `mdiSvg:${mdi.mdiFormatBold}`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {
|
|
17
|
+
disabled: computed(() => !editor.value.can().chain().focus().toggleBold().run()),
|
|
18
|
+
color: computed(() => editor.value.isActive('bold') ? 'primary' : ''),
|
|
19
|
+
},
|
|
20
|
+
attrs: {
|
|
21
|
+
click: () => editor.value.chain().focus().toggleBold().run()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as mdi from "@mdi/js";
|
|
2
|
+
import { Editor } from "@tiptap/vue-3";
|
|
3
|
+
import { computed, inject, Ref } from "vue";
|
|
4
|
+
import { useI18n } from "vue-i18n";
|
|
5
|
+
|
|
6
|
+
export function useItalic() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: 'italic',
|
|
13
|
+
tooltip: computed(() => t('format.italic')),
|
|
14
|
+
icon: `mdiSvg:${mdi.mdiFormatItalic}`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {
|
|
17
|
+
disabled: computed(() => !editor.value.can().chain().focus().toggleItalic().run()),
|
|
18
|
+
color: computed(() => editor.value.isActive('italic') ? 'primary' : ''),
|
|
19
|
+
},
|
|
20
|
+
attrs: {
|
|
21
|
+
click: () => editor.value.chain().focus().toggleItalic().run()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as mdi from "@mdi/js";
|
|
2
|
+
import { Editor } from "@tiptap/vue-3";
|
|
3
|
+
import { computed, inject, Ref } from "vue";
|
|
4
|
+
import { useI18n } from "vue-i18n";
|
|
5
|
+
|
|
6
|
+
export function useStrike() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: 'strike',
|
|
13
|
+
tooltip: computed(() => t('format.strike')),
|
|
14
|
+
icon: `mdiSvg:${mdi.mdiFormatStrikethroughVariant}`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {
|
|
17
|
+
disabled: computed(() => !editor.value.can().chain().focus().toggleStrike().run()),
|
|
18
|
+
color: computed(() => editor.value.isActive('strike') ? 'primary' : ''),
|
|
19
|
+
},
|
|
20
|
+
attrs: {
|
|
21
|
+
click: () => editor.value.chain().focus().toggleStrike().run()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as mdi from "@mdi/js";
|
|
2
|
+
import { Editor } from "@tiptap/vue-3";
|
|
3
|
+
import { computed, inject, Ref } from "vue";
|
|
4
|
+
import { useI18n } from "vue-i18n";
|
|
5
|
+
|
|
6
|
+
export function useUnderline() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: 'underline',
|
|
13
|
+
tooltip: computed(() => t('format.underline')),
|
|
14
|
+
icon: `mdiSvg:${mdi.mdiFormatUnderline}`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {
|
|
17
|
+
disabled: computed(() => !editor.value.can().chain().focus().toggleUnderline().run()),
|
|
18
|
+
color: computed(() => editor.value.isActive('underline') ? 'primary' : ''),
|
|
19
|
+
},
|
|
20
|
+
attrs: {
|
|
21
|
+
click: () => editor.value.chain().focus().toggleUnderline().run()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as mdi from "@mdi/js";
|
|
2
|
+
import { Editor } from "@tiptap/vue-3";
|
|
3
|
+
import { computed, inject, Ref } from "vue";
|
|
4
|
+
import { useI18n } from "vue-i18n";
|
|
5
|
+
|
|
6
|
+
export function useBlockquote() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: 'blockquote',
|
|
13
|
+
tooltip: computed(() => t('format.blockquote')),
|
|
14
|
+
icon: `mdiSvg:${mdi.mdiCommentQuote}`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {
|
|
17
|
+
disabled: computed(() => !editor.value.can().chain().focus().toggleBlockquote().run() || editor.value.isActive('codeBlock') || editor.value.isActive('code')),
|
|
18
|
+
color: computed(() => editor.value.isActive('blockquote') ? 'primary' : ''),
|
|
19
|
+
},
|
|
20
|
+
attrs: {
|
|
21
|
+
click: () => editor.value.chain().focus().toggleBlockquote().run()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as mdi from "@mdi/js";
|
|
2
|
+
import { Editor } from "@tiptap/vue-3";
|
|
3
|
+
import { computed, inject, Ref } from "vue";
|
|
4
|
+
import { useI18n } from "vue-i18n";
|
|
5
|
+
|
|
6
|
+
export function useCode() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: 'code',
|
|
13
|
+
tooltip: computed(() => t('format.code')),
|
|
14
|
+
icon: `mdiSvg:${mdi.mdiXml}`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {
|
|
17
|
+
disabled: computed(() => !editor.value.can().chain().focus().toggleCode().run()),
|
|
18
|
+
color: computed(() => editor.value.isActive('code') ? 'primary' : ''),
|
|
19
|
+
},
|
|
20
|
+
attrs: {
|
|
21
|
+
click: () => editor.value.chain().focus().toggleCode().run()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as mdi from "@mdi/js";
|
|
2
|
+
import { Editor } from "@tiptap/vue-3";
|
|
3
|
+
import { computed, inject, Ref } from "vue";
|
|
4
|
+
import { useI18n } from "vue-i18n";
|
|
5
|
+
|
|
6
|
+
export function useCodeBlock() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: 'codeblock',
|
|
13
|
+
tooltip: computed(() => t('format.codeblock')),
|
|
14
|
+
icon: `mdiSvg:${mdi.mdiCodeBlockTags}`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {
|
|
17
|
+
disabled: computed(() => !editor.value.can().chain().focus().toggleCodeBlock().run()),
|
|
18
|
+
color: computed(() => editor.value.isActive('codeBlock') ? 'primary' : ''),
|
|
19
|
+
},
|
|
20
|
+
attrs: {
|
|
21
|
+
click: () => editor.value.chain().focus().toggleCodeBlock().run()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as mdi from "@mdi/js";
|
|
2
|
+
import { Editor } from "@tiptap/vue-3";
|
|
3
|
+
import { computed, inject, Ref } from "vue";
|
|
4
|
+
import { useI18n } from "vue-i18n";
|
|
5
|
+
|
|
6
|
+
export function useSub() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: 'sub',
|
|
13
|
+
tooltip: computed(() => t('format.sub')),
|
|
14
|
+
icon: `mdiSvg:${mdi.mdiFormatSubscript}`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {
|
|
17
|
+
disabled: computed(() => !editor.value.can().chain().focus().toggleSubscript().run()),
|
|
18
|
+
color: computed(() => editor.value.isActive('subscript') ? 'primary' : ''),
|
|
19
|
+
},
|
|
20
|
+
attrs: {
|
|
21
|
+
click: () => editor.value.chain().focus().toggleSubscript().run()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as mdi from "@mdi/js";
|
|
2
|
+
import { Editor } from "@tiptap/vue-3";
|
|
3
|
+
import { computed, inject, Ref } from "vue";
|
|
4
|
+
import { useI18n } from "vue-i18n";
|
|
5
|
+
|
|
6
|
+
export function useSup() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: 'sup',
|
|
13
|
+
tooltip: computed(() => t('format.sup')),
|
|
14
|
+
icon: `mdiSvg:${mdi.mdiFormatSuperscript}`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {
|
|
17
|
+
disabled: computed(() => !editor.value.can().chain().focus().toggleSuperscript().run()),
|
|
18
|
+
color: computed(() => editor.value.isActive('superscript') ? 'primary' : ''),
|
|
19
|
+
},
|
|
20
|
+
attrs: {
|
|
21
|
+
click: () => editor.value.chain().focus().toggleSuperscript().run()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as mdi from "@mdi/js";
|
|
2
|
+
import { Editor } from "@tiptap/vue-3";
|
|
3
|
+
import { computed, inject, Ref } from "vue";
|
|
4
|
+
import { useI18n } from "vue-i18n";
|
|
5
|
+
|
|
6
|
+
export function useBullet() {
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: computed(() => t('lists.bullet')),
|
|
13
|
+
tooltip: computed(() => t('lists.bullet')),
|
|
14
|
+
icon: `mdiSvg:${mdi.mdiFormatListBulleted}`,
|
|
15
|
+
enabled: true,
|
|
16
|
+
props: {
|
|
17
|
+
color: computed(() => editor.value.isActive('bulletList') ? 'primary' : ''),
|
|
18
|
+
},
|
|
19
|
+
attrs: {
|
|
20
|
+
click: () => editor.value.chain().focus().toggleBulletList().run()
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|