tiptapify 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -2
- package/dist/tiptapify.css +1 -1
- package/dist/tiptapify.mjs +16191 -15808
- package/dist/tiptapify.umd.js +73 -33
- package/index.d.ts +2 -2
- package/package.json +2 -1
- 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/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 +7 -209
- package/src/composables/Toolbar/useMiscItems.ts +13 -58
- package/src/composables/Toolbar/useStyleItems.ts +14 -228
- 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/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 +2 -1
- package/src/i18n/locales/cz.json +2 -1
- package/src/i18n/locales/de.json +2 -1
- package/src/i18n/locales/en.json +2 -1
- package/src/i18n/locales/es.json +2 -1
- package/src/i18n/locales/fr.json +2 -1
- package/src/i18n/locales/it.json +2 -1
- package/src/i18n/locales/la.json +2 -1
- package/src/i18n/locales/lt.json +2 -1
- package/src/i18n/locales/nl.json +2 -1
- package/src/i18n/locales/pl.json +2 -1
- package/src/i18n/locales/pt.json +2 -1
- package/src/i18n/locales/ru.json +2 -1
- package/src/i18n/locales/se.json +2 -1
- package/src/i18n/locales/ua.json +2 -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
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
|
+
}
|
|
@@ -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
|
+
}
|