tiptapify 0.0.13 → 0.0.15
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 +12 -4
- package/dist/tiptapify.css +1 -1
- package/dist/tiptapify.mjs +44219 -43771
- package/dist/tiptapify.umd.js +38 -38
- package/package.json +47 -41
- package/src/components/Footer.vue +1 -3
- package/src/components/Tiptapify.vue +39 -33
- package/src/components/Toolbar/GroupBtn.vue +0 -1
- package/src/components/Toolbar/Items.vue +0 -2
- package/src/components/Toolbar/defaultExtensionComponents.ts +13 -1
- package/src/components/Toolbar/items.ts +1 -6
- package/src/components/UI/TiptapifyDialog.vue +2 -3
- package/src/components/editorExtensions.ts +5 -0
- package/src/composables/Toolbar/Actions/useRedo.ts +1 -2
- package/src/composables/Toolbar/Actions/useUndo.ts +1 -2
- package/src/composables/Toolbar/Alignment/useAlignmentCenter.ts +1 -2
- package/src/composables/Toolbar/Alignment/useAlignmentJustify.ts +1 -2
- package/src/composables/Toolbar/Alignment/useAlignmentLeft.ts +1 -2
- package/src/composables/Toolbar/Alignment/useAlignmentRight.ts +1 -2
- package/src/composables/Toolbar/Format/useBold.ts +1 -2
- package/src/composables/Toolbar/Format/useItalic.ts +1 -2
- package/src/composables/Toolbar/Format/useStrike.ts +1 -2
- package/src/composables/Toolbar/Format/useUnderline.ts +1 -2
- package/src/composables/Toolbar/FormatExtra/useBlockquote.ts +1 -2
- package/src/composables/Toolbar/FormatExtra/useCode.ts +1 -2
- package/src/composables/Toolbar/FormatExtra/useCodeBlock.ts +1 -2
- package/src/composables/Toolbar/FormatExtra/useSub.ts +1 -2
- package/src/composables/Toolbar/FormatExtra/useSup.ts +1 -2
- package/src/composables/Toolbar/List/useBullet.ts +1 -2
- package/src/composables/Toolbar/List/useIndent.ts +1 -2
- package/src/composables/Toolbar/List/useNumbered.ts +1 -2
- package/src/composables/Toolbar/List/useOutdent.ts +1 -2
- package/src/composables/Toolbar/List/useTask.ts +1 -2
- package/src/composables/Toolbar/Media/useEmoji.ts +4 -5
- package/src/composables/Toolbar/Media/useImage.ts +1 -2
- package/src/composables/Toolbar/Media/useLink.ts +1 -2
- package/src/composables/Toolbar/Media/useTable.ts +1 -2
- package/src/composables/Toolbar/Media/useVideo.ts +22 -0
- package/src/composables/Toolbar/Misc/useBreak.ts +1 -2
- package/src/composables/Toolbar/Misc/useFormatClear.ts +1 -2
- package/src/composables/Toolbar/Misc/useInvisibleCharacters.ts +2 -3
- package/src/composables/Toolbar/Misc/useLine.ts +1 -2
- package/src/composables/Toolbar/Misc/usePreview.ts +1 -2
- package/src/composables/Toolbar/Misc/useSource.ts +1 -2
- package/src/composables/Toolbar/Style/useColor.ts +1 -2
- package/src/composables/Toolbar/Style/useFontFamily.ts +1 -2
- package/src/composables/Toolbar/Style/useFontSize.ts +1 -2
- package/src/composables/Toolbar/Style/useHeading.ts +1 -2
- package/src/composables/Toolbar/Style/useHighlight.ts +1 -2
- package/src/composables/Toolbar/Style/useLineHeight.ts +1 -2
- package/src/composables/Toolbar/useMediaItems.ts +2 -0
- package/src/extensions/components/Emoji.vue +1 -2
- package/src/extensions/components/FontFamily.vue +1 -2
- package/src/extensions/components/FontSize.vue +1 -2
- package/src/extensions/components/ImageDialog.vue +1 -2
- package/src/extensions/components/LineHeight.vue +1 -2
- package/src/extensions/components/LinkDialog.vue +1 -2
- package/src/extensions/components/ShowSourceDialog.vue +1 -2
- package/src/extensions/components/StyleColor.vue +1 -2
- package/src/extensions/components/TableBuilder.vue +1 -2
- package/src/extensions/components/VideoDialog.vue +138 -0
- package/src/i18n/index.ts +23 -10
- package/src/i18n/locales/ch.json +6 -0
- package/src/i18n/locales/cz.json +6 -0
- package/src/i18n/locales/de.json +6 -0
- package/src/i18n/locales/en.json +9 -1
- package/src/i18n/locales/es.json +6 -0
- package/src/i18n/locales/fr.json +6 -0
- package/src/i18n/locales/it.json +6 -0
- package/src/i18n/locales/la.json +6 -0
- package/src/i18n/locales/lt.json +6 -0
- package/src/i18n/locales/nl.json +6 -0
- package/src/i18n/locales/pl.json +6 -0
- package/src/i18n/locales/pt.json +6 -0
- package/src/i18n/locales/ru.json +9 -1
- package/src/i18n/locales/se.json +6 -0
- package/src/i18n/locales/ua.json +9 -1
- package/src/index.ts +0 -3
- package/src/types/toolbarItems.ts +0 -2
- package/src/components/Toolbar/Toggle.vue +0 -31
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as mdi from "@mdi/js";
|
|
2
2
|
import { Editor } from "@tiptap/vue-3";
|
|
3
3
|
import { computed, inject, Ref } from "vue";
|
|
4
|
-
import { useI18n } from "vue-i18n";
|
|
5
4
|
|
|
6
5
|
export function useLink() {
|
|
7
|
-
const { t } =
|
|
6
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
8
7
|
|
|
9
8
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
9
|
|
|
@@ -2,10 +2,9 @@ import * as mdi from "@mdi/js";
|
|
|
2
2
|
import { Editor } from "@tiptap/vue-3";
|
|
3
3
|
import TableBuilder from "@tiptapify/extensions/components/TableBuilder.vue";
|
|
4
4
|
import { computed, inject, markRaw, Ref } from "vue";
|
|
5
|
-
import { useI18n } from "vue-i18n";
|
|
6
5
|
|
|
7
6
|
export function useTable() {
|
|
8
|
-
const { t } =
|
|
7
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
9
8
|
|
|
10
9
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
11
10
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Editor } from "@tiptap/vue-3";
|
|
2
|
+
import { computed, inject, Ref } from "vue";
|
|
3
|
+
|
|
4
|
+
export function useVideo() {
|
|
5
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
6
|
+
|
|
7
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
8
|
+
|
|
9
|
+
return {
|
|
10
|
+
name: computed(() => t('media.video')),
|
|
11
|
+
tooltip: computed(() => t('media.video')),
|
|
12
|
+
icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M4 6H2v14a2 2 0 0 0 2 2h14v-2H4zm16-4H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2m-8 12.5v-9l6 4.5z"/></svg>',
|
|
13
|
+
enabled: true,
|
|
14
|
+
props: {
|
|
15
|
+
color: computed(() => editor.value.isActive('youtube') ? 'primary' : ''),
|
|
16
|
+
disabled: computed(() => editor.value.isActive('code') || editor.value.isActive('codeBlock')),
|
|
17
|
+
},
|
|
18
|
+
attrs: {
|
|
19
|
+
click: () => editor.value.commands.showTiptapifyVideo()
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as mdi from "@mdi/js";
|
|
2
2
|
import { Editor } from "@tiptap/vue-3";
|
|
3
3
|
import { computed, inject, Ref } from "vue";
|
|
4
|
-
import { useI18n } from "vue-i18n";
|
|
5
4
|
|
|
6
5
|
export function useBreak() {
|
|
7
|
-
const { t } =
|
|
6
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
8
7
|
|
|
9
8
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
9
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as mdi from "@mdi/js";
|
|
2
2
|
import { Editor } from "@tiptap/vue-3";
|
|
3
3
|
import { computed, inject, Ref } from "vue";
|
|
4
|
-
import { useI18n } from "vue-i18n";
|
|
5
4
|
|
|
6
5
|
export function useFormatClear() {
|
|
7
|
-
const { t } =
|
|
6
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
8
7
|
|
|
9
8
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
9
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Editor } from "@tiptap/vue-3";
|
|
2
2
|
import { computed, inject, Ref } from "vue";
|
|
3
|
-
import { useI18n } from "vue-i18n";
|
|
4
3
|
|
|
5
4
|
export function useInvisibleCharacters() {
|
|
6
|
-
const { t } =
|
|
5
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
7
6
|
|
|
8
7
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
9
8
|
|
|
@@ -11,7 +10,7 @@ export function useInvisibleCharacters() {
|
|
|
11
10
|
name: 'show/hide invisible characters',
|
|
12
11
|
tooltip: computed(() => t('misc.toggleInvisibleCharacters')),
|
|
13
12
|
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>`,
|
|
13
|
+
icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><path fill="currentColor" 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
14
|
enabled: true,
|
|
16
15
|
props: {
|
|
17
16
|
color: computed(() => editor.value.storage.invisibleCharacters.visibility() ? 'primary' : ''),
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as mdi from "@mdi/js";
|
|
2
2
|
import { Editor } from "@tiptap/vue-3";
|
|
3
3
|
import { computed, inject, Ref } from "vue";
|
|
4
|
-
import { useI18n } from "vue-i18n";
|
|
5
4
|
|
|
6
5
|
export function useLine() {
|
|
7
|
-
const { t } =
|
|
6
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
8
7
|
|
|
9
8
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
9
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as mdi from "@mdi/js";
|
|
2
2
|
import { Editor } from "@tiptap/vue-3";
|
|
3
3
|
import { computed, inject, Ref } from "vue";
|
|
4
|
-
import { useI18n } from "vue-i18n";
|
|
5
4
|
|
|
6
5
|
export function usePreview() {
|
|
7
|
-
const { t } =
|
|
6
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
8
7
|
|
|
9
8
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
9
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as mdi from "@mdi/js";
|
|
2
2
|
import { Editor } from "@tiptap/vue-3";
|
|
3
3
|
import { computed, inject, Ref } from "vue";
|
|
4
|
-
import { useI18n } from "vue-i18n";
|
|
5
4
|
|
|
6
5
|
export function useSource() {
|
|
7
|
-
const { t } =
|
|
6
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
8
7
|
|
|
9
8
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
9
|
|
|
@@ -2,10 +2,9 @@ import * as mdi from "@mdi/js";
|
|
|
2
2
|
import { Editor } from "@tiptap/vue-3";
|
|
3
3
|
import StyleColor from "@tiptapify/extensions/components/StyleColor.vue";
|
|
4
4
|
import { computed, inject, markRaw, Ref } from "vue";
|
|
5
|
-
import { useI18n } from "vue-i18n";
|
|
6
5
|
|
|
7
6
|
export function useColor(theme: any) {
|
|
8
|
-
const { t } =
|
|
7
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
9
8
|
|
|
10
9
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
11
10
|
|
|
@@ -3,10 +3,9 @@ import { Editor } from "@tiptap/vue-3";
|
|
|
3
3
|
import { fonts } from "@tiptapify/constants/style";
|
|
4
4
|
import FontFamily from "@tiptapify/extensions/components/FontFamily.vue";
|
|
5
5
|
import { computed, inject, markRaw, Ref } from "vue";
|
|
6
|
-
import { useI18n } from "vue-i18n";
|
|
7
6
|
|
|
8
7
|
export function useFontFamily() {
|
|
9
|
-
const { t } =
|
|
8
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
10
9
|
|
|
11
10
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
12
11
|
|
|
@@ -3,10 +3,9 @@ import { Editor } from "@tiptap/vue-3";
|
|
|
3
3
|
import { fontSizes } from "@tiptapify/constants/style";
|
|
4
4
|
import FontSize from "@tiptapify/extensions/components/FontSize.vue";
|
|
5
5
|
import { computed, inject, markRaw, Ref } from "vue";
|
|
6
|
-
import { useI18n } from "vue-i18n";
|
|
7
6
|
|
|
8
7
|
export function useFontSize(fontMeasure: string) {
|
|
9
|
-
const { t } =
|
|
8
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
10
9
|
|
|
11
10
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
12
11
|
|
|
@@ -3,7 +3,6 @@ import { Level } from "@tiptap/extension-heading";
|
|
|
3
3
|
import { Editor } from "@tiptap/vue-3";
|
|
4
4
|
import { headingLevels, setHeadingLevels } from "@tiptapify/constants/style";
|
|
5
5
|
import { computed, inject, Ref } from "vue";
|
|
6
|
-
import { useI18n } from "vue-i18n";
|
|
7
6
|
|
|
8
7
|
interface MDIIcons {
|
|
9
8
|
[key: string]: string
|
|
@@ -11,7 +10,7 @@ interface MDIIcons {
|
|
|
11
10
|
const mdiIcons = mdi as MDIIcons
|
|
12
11
|
|
|
13
12
|
export function useHeading(customHeadingLevels: Array<number> = []) {
|
|
14
|
-
const { t } =
|
|
13
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
15
14
|
|
|
16
15
|
setHeadingLevels(customHeadingLevels)
|
|
17
16
|
|
|
@@ -2,10 +2,9 @@ import * as mdi from "@mdi/js";
|
|
|
2
2
|
import { Editor } from "@tiptap/vue-3";
|
|
3
3
|
import StyleColor from "@tiptapify/extensions/components/StyleColor.vue";
|
|
4
4
|
import { computed, inject, markRaw, Ref } from "vue";
|
|
5
|
-
import { useI18n } from "vue-i18n";
|
|
6
5
|
|
|
7
6
|
export function useHighlight(theme: any) {
|
|
8
|
-
const { t } =
|
|
7
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
9
8
|
|
|
10
9
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
11
10
|
|
|
@@ -3,10 +3,9 @@ import { Editor } from "@tiptap/vue-3";
|
|
|
3
3
|
import { lineHeights } from "@tiptapify/constants/style";
|
|
4
4
|
import LineHeight from "@tiptapify/extensions/components/LineHeight.vue";
|
|
5
5
|
import { computed, inject, markRaw, Ref } from "vue";
|
|
6
|
-
import { useI18n } from "vue-i18n";
|
|
7
6
|
|
|
8
7
|
export function useLineHeight() {
|
|
9
|
-
const { t } =
|
|
8
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
10
9
|
|
|
11
10
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
12
11
|
|
|
@@ -2,11 +2,13 @@ import { useImage } from "@tiptapify/composables/Toolbar/Media/useImage";
|
|
|
2
2
|
import { useEmoji } from "@tiptapify/composables/Toolbar/Media/useEmoji";
|
|
3
3
|
import { useLink } from "@tiptapify/composables/Toolbar/Media/useLink";
|
|
4
4
|
import { useTable } from "@tiptapify/composables/Toolbar/Media/useTable";
|
|
5
|
+
import { useVideo } from "@tiptapify/composables/Toolbar/Media/useVideo";
|
|
5
6
|
|
|
6
7
|
export function useMediaItems() {
|
|
7
8
|
return {
|
|
8
9
|
link: useLink(),
|
|
9
10
|
image: useImage(),
|
|
11
|
+
video: useVideo(),
|
|
10
12
|
emoji: useEmoji(),
|
|
11
13
|
table: useTable()
|
|
12
14
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
|
|
3
3
|
import { Editor } from "@tiptap/vue-3";
|
|
4
|
-
import { useI18n } from 'vue-i18n'
|
|
5
4
|
|
|
6
5
|
import tiptapifyEmojis from "@tiptapify/extensions/emoji"
|
|
7
6
|
|
|
8
7
|
import { computed, inject, Ref, ref } from 'vue'
|
|
9
8
|
|
|
10
|
-
const { t } =
|
|
9
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
11
10
|
|
|
12
11
|
defineExpose({ open, close })
|
|
13
12
|
|
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
import { Editor } from "@tiptap/vue-3";
|
|
4
4
|
|
|
5
5
|
import { computed, inject, Ref, ref } from 'vue'
|
|
6
|
-
import { useI18n } from "vue-i18n";
|
|
7
6
|
|
|
8
7
|
const props = defineProps({
|
|
9
8
|
fonts: { type: Array<{ name: string, fontFamily: string }>, default: [] },
|
|
10
9
|
fontFamily: { type: String, default: '' },
|
|
11
10
|
})
|
|
12
11
|
|
|
13
|
-
const { t } =
|
|
12
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
14
13
|
|
|
15
14
|
const emit = defineEmits(['close'])
|
|
16
15
|
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import { Editor } from "@tiptap/vue-3";
|
|
4
4
|
|
|
5
5
|
import { computed, inject, Ref, ref } from 'vue'
|
|
6
|
-
import { useI18n } from "vue-i18n";
|
|
7
6
|
|
|
8
7
|
const props = defineProps({
|
|
9
8
|
sizes: { type: Array<number>, default: [] },
|
|
@@ -11,7 +10,7 @@ const props = defineProps({
|
|
|
11
10
|
fontSize: { type: Number, default () { return null } },
|
|
12
11
|
})
|
|
13
12
|
|
|
14
|
-
const { t } =
|
|
13
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
15
14
|
|
|
16
15
|
const emit = defineEmits(['close'])
|
|
17
16
|
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import { Editor } from "@tiptap/vue-3";
|
|
4
4
|
import TiptapifyDialog from "@tiptapify/components/UI/TiptapifyDialog.vue";
|
|
5
5
|
|
|
6
|
-
import { useI18n } from 'vue-i18n'
|
|
7
6
|
import { computed, inject, onMounted, onUnmounted, Ref, ref } from 'vue'
|
|
8
7
|
|
|
9
8
|
defineProps({
|
|
@@ -12,7 +11,7 @@ defineProps({
|
|
|
12
11
|
})
|
|
13
12
|
|
|
14
13
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
15
|
-
const { t } =
|
|
14
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
16
15
|
|
|
17
16
|
const generateImageAttrs = () => ({
|
|
18
17
|
src: '',
|
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
import { Editor } from "@tiptap/vue-3";
|
|
4
4
|
|
|
5
5
|
import { computed, inject, Ref, ref } from 'vue'
|
|
6
|
-
import { useI18n } from "vue-i18n";
|
|
7
6
|
|
|
8
7
|
const props = defineProps({
|
|
9
8
|
lineHeights: { type: Array<number>, default () { return [] } },
|
|
10
9
|
lineHeight: { type: Number, default () { return null } },
|
|
11
10
|
})
|
|
12
11
|
|
|
13
|
-
const { t } =
|
|
12
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
14
13
|
|
|
15
14
|
const emit = defineEmits(['close'])
|
|
16
15
|
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { Editor } from "@tiptap/vue-3";
|
|
4
4
|
|
|
5
|
-
import { useI18n } from 'vue-i18n'
|
|
6
5
|
import { computed, inject, onMounted, onUnmounted, Ref, ref, watch } from 'vue'
|
|
7
6
|
|
|
8
7
|
import TiptapifyDialog from "@tiptapify/components/UI/TiptapifyDialog.vue"
|
|
@@ -13,7 +12,7 @@ defineProps({
|
|
|
13
12
|
})
|
|
14
13
|
|
|
15
14
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
16
|
-
const { t } =
|
|
15
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
17
16
|
|
|
18
17
|
const generateLinkAttrs = () => ({
|
|
19
18
|
href: '',
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { Editor } from "@tiptap/vue-3";
|
|
3
3
|
import TiptapifyDialog from "@tiptapify/components/UI/TiptapifyDialog.vue";
|
|
4
4
|
import { ref, onMounted, onUnmounted, watch, inject, Ref } from 'vue'
|
|
5
|
-
import { useI18n } from "vue-i18n";
|
|
6
5
|
|
|
7
6
|
const props = defineProps({
|
|
8
7
|
indent: { type: Number, default: 2 },
|
|
@@ -10,7 +9,7 @@ const props = defineProps({
|
|
|
10
9
|
variantField: { type: String, default: 'solo' }
|
|
11
10
|
})
|
|
12
11
|
|
|
13
|
-
const { t } =
|
|
12
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
14
13
|
|
|
15
14
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
16
15
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
|
|
3
3
|
import { Editor } from "@tiptap/vue-3";
|
|
4
|
-
import { useI18n } from 'vue-i18n'
|
|
5
4
|
|
|
6
5
|
import { computed, inject, Ref, ref } from 'vue'
|
|
7
6
|
|
|
8
|
-
const { t } =
|
|
7
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
9
8
|
|
|
10
9
|
defineExpose({ open, close })
|
|
11
10
|
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
|
|
3
|
+
import { Editor } from "@tiptap/vue-3";
|
|
4
|
+
import TiptapifyDialog from "@tiptapify/components/UI/TiptapifyDialog.vue";
|
|
5
|
+
|
|
6
|
+
import { computed, inject, onMounted, onUnmounted, Ref, ref } from 'vue'
|
|
7
|
+
|
|
8
|
+
defineProps({
|
|
9
|
+
variantBtn: { type: String, default() { return 'elevated' }},
|
|
10
|
+
variantField: { type: String, default() { return 'solo' }}
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
14
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
15
|
+
|
|
16
|
+
type videoAttrs = {
|
|
17
|
+
src: string,
|
|
18
|
+
width?: number,
|
|
19
|
+
height?: number
|
|
20
|
+
}
|
|
21
|
+
const generateVideoAttrs = () => ({
|
|
22
|
+
src: '',
|
|
23
|
+
height: null,
|
|
24
|
+
width: null
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
const attrs = ref(generateVideoAttrs())
|
|
28
|
+
|
|
29
|
+
const dialog = ref(null)
|
|
30
|
+
|
|
31
|
+
const isDisabled = computed(() => {
|
|
32
|
+
const { src } = attrs.value
|
|
33
|
+
return !src
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
function apply() {
|
|
37
|
+
let { src, width, height } = attrs.value
|
|
38
|
+
|
|
39
|
+
const videoOptions: videoAttrs = { src }
|
|
40
|
+
|
|
41
|
+
if (width) {
|
|
42
|
+
videoOptions.width = width
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (height) {
|
|
46
|
+
videoOptions.height = height
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (src) {
|
|
50
|
+
editor.value.commands.setYoutubeVideo(videoOptions)
|
|
51
|
+
// editor.value.commands.setYoutubeVideo({
|
|
52
|
+
// src: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
|
|
53
|
+
// width: 640,
|
|
54
|
+
// height: 480,
|
|
55
|
+
// })
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
close()
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function clear() {
|
|
62
|
+
editor.value.commands.deleteSelection()
|
|
63
|
+
|
|
64
|
+
close()
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function close() {
|
|
68
|
+
dialog.value.close()
|
|
69
|
+
|
|
70
|
+
attrs.value = generateVideoAttrs()
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const showTiptapifyVideo = (event: CustomEvent) => {
|
|
74
|
+
if (event.detail.editorId !== editor.value.instanceId) {
|
|
75
|
+
return
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
attrs.value.src = event.detail.video?.src
|
|
79
|
+
attrs.value.width = event.detail.video?.width
|
|
80
|
+
attrs.value.height = event.detail.video?.height
|
|
81
|
+
|
|
82
|
+
dialog.value.open()
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
onMounted(() => {
|
|
86
|
+
window.addEventListener('tiptapify-show-tiptapifyVideo', showTiptapifyVideo as EventListener)
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
onUnmounted(() => {
|
|
90
|
+
window.removeEventListener('tiptapify-show-tiptapifyVideo', showTiptapifyVideo as EventListener)
|
|
91
|
+
})
|
|
92
|
+
</script>
|
|
93
|
+
|
|
94
|
+
<template>
|
|
95
|
+
<TiptapifyDialog ref="dialog" module="video" :max-width="800">
|
|
96
|
+
<template #content>
|
|
97
|
+
<VCardText>
|
|
98
|
+
<VRow>
|
|
99
|
+
<!-- <VCol cols="12">-->
|
|
100
|
+
<!-- <VSelect v-model="attrs.type" density="compact" variant="outlined" :label="t('dialog.video.src')" />-->
|
|
101
|
+
<!-- </VCol>-->
|
|
102
|
+
|
|
103
|
+
<VCol cols="12">
|
|
104
|
+
<VTextField v-model="attrs.src" density="compact" variant="outlined" :label="t('dialog.video.src')" />
|
|
105
|
+
</VCol>
|
|
106
|
+
|
|
107
|
+
<VCol cols="12" md="3">
|
|
108
|
+
<VTextField v-model="attrs.width" type="number" density="compact" variant="outlined" :precision="0" :min="1" :label="t('dialog.video.width')" />
|
|
109
|
+
</VCol>
|
|
110
|
+
|
|
111
|
+
<VCol cols="12" md="3">
|
|
112
|
+
<VTextField v-model="attrs.height" type="number" density="compact" variant="outlined" :precision="0" :min="1" :label="t('dialog.video.height')" />
|
|
113
|
+
</VCol>
|
|
114
|
+
</VRow>
|
|
115
|
+
</VCardText>
|
|
116
|
+
</template>
|
|
117
|
+
|
|
118
|
+
<template #actions>
|
|
119
|
+
<VCardActions>
|
|
120
|
+
<VRow>
|
|
121
|
+
<VCol class="d-flex justify-start">
|
|
122
|
+
<VBtn color="warning" v-if="editor.isActive('image')" :variant="variantBtn" :disabled="isDisabled" @click="clear">
|
|
123
|
+
{{ t('dialog.clear') }}
|
|
124
|
+
</VBtn>
|
|
125
|
+
</VCol>
|
|
126
|
+
<VCol class="d-flex justify-end">
|
|
127
|
+
<VBtn :variant="variantBtn" @click="close" class="mr-2">
|
|
128
|
+
{{ t('dialog.close') }}
|
|
129
|
+
</VBtn>
|
|
130
|
+
<VBtn color="primary" :variant="variantBtn" :disabled="isDisabled" @click="apply">
|
|
131
|
+
{{ t('dialog.apply') }}
|
|
132
|
+
</VBtn>
|
|
133
|
+
</VCol>
|
|
134
|
+
</VRow>
|
|
135
|
+
</VCardActions>
|
|
136
|
+
</template>
|
|
137
|
+
</TiptapifyDialog>
|
|
138
|
+
</template>
|
package/src/i18n/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createI18n } from 'vue-i18n'
|
|
2
|
+
import { ref, computed } from 'vue'
|
|
2
3
|
|
|
3
4
|
const messages = Object.fromEntries(
|
|
4
5
|
Object.entries(
|
|
@@ -6,17 +7,29 @@ const messages = Object.fromEntries(
|
|
|
6
7
|
.map(([key, value]) => [key.slice(10, -5), value.default]),
|
|
7
8
|
)
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
export function useLocale(initialLocale: string = 'en') {
|
|
11
|
+
const currentLocale = ref(initialLocale)
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
const i18n = createI18n({
|
|
14
|
+
legacy: false,
|
|
15
|
+
locale: currentLocale.value,
|
|
16
|
+
fallbackLocale: 'en',
|
|
17
|
+
messages
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const { t, locale } = i18n.global
|
|
21
|
+
|
|
22
|
+
const setLocale = (newLocale: string) => {
|
|
23
|
+
if (messages[newLocale]) {
|
|
24
|
+
currentLocale.value = newLocale
|
|
25
|
+
locale.value = newLocale
|
|
26
|
+
}
|
|
19
27
|
}
|
|
20
28
|
|
|
21
|
-
return
|
|
29
|
+
return {
|
|
30
|
+
i18n,
|
|
31
|
+
t,
|
|
32
|
+
locale: computed(() => currentLocale.value),
|
|
33
|
+
setLocale
|
|
34
|
+
}
|
|
22
35
|
}
|
package/src/i18n/locales/ch.json
CHANGED
package/src/i18n/locales/cz.json
CHANGED
package/src/i18n/locales/de.json
CHANGED
package/src/i18n/locales/en.json
CHANGED
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"link": "External link",
|
|
43
43
|
"image": "Image",
|
|
44
44
|
"emoji": {
|
|
45
|
+
"title": "Emoji",
|
|
45
46
|
"activities": "Activities",
|
|
46
47
|
"animals_and_nature": "Animals & nature",
|
|
47
48
|
"component": "Component",
|
|
@@ -70,7 +71,8 @@
|
|
|
70
71
|
"deleteCol": "Delete column",
|
|
71
72
|
"mergeCells": "Merge cells",
|
|
72
73
|
"splitCell": "Split cell"
|
|
73
|
-
}
|
|
74
|
+
},
|
|
75
|
+
"video": "Video"
|
|
74
76
|
},
|
|
75
77
|
"action": {
|
|
76
78
|
"undo": "Undo",
|
|
@@ -118,6 +120,12 @@
|
|
|
118
120
|
"source": {
|
|
119
121
|
"title": "View source code",
|
|
120
122
|
"prettify": "Prettify"
|
|
123
|
+
},
|
|
124
|
+
"video": {
|
|
125
|
+
"title": "Add/edit video",
|
|
126
|
+
"src": "Source",
|
|
127
|
+
"width": "Width",
|
|
128
|
+
"height": "Height"
|
|
121
129
|
}
|
|
122
130
|
},
|
|
123
131
|
"misc": {
|
package/src/i18n/locales/es.json
CHANGED