tiptapify 0.0.12 → 0.0.14
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 +14 -5
- package/dist/tiptapify.css +1 -1
- package/dist/tiptapify.mjs +76483 -57282
- package/dist/tiptapify.umd.js +42 -42
- package/package.json +56 -47
- package/src/components/Footer.vue +1 -3
- package/src/components/Tiptapify.vue +15 -3
- package/src/components/Toolbar/GroupBtn.vue +0 -1
- package/src/components/Toolbar/Toggle.vue +2 -3
- package/src/components/Toolbar/defaultExtensionComponents.ts +13 -1
- 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 +19 -0
- 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 +1 -2
- 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 +4 -0
- package/src/extensions/components/Emoji.vue +108 -0
- 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/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/i18n/index.ts +23 -10
- package/src/i18n/locales/ch.json +18 -0
- package/src/i18n/locales/cz.json +18 -0
- package/src/i18n/locales/de.json +18 -0
- package/src/i18n/locales/en.json +21 -1
- package/src/i18n/locales/es.json +18 -0
- package/src/i18n/locales/fr.json +18 -0
- package/src/i18n/locales/it.json +18 -0
- package/src/i18n/locales/la.json +18 -0
- package/src/i18n/locales/lt.json +18 -0
- package/src/i18n/locales/nl.json +18 -0
- package/src/i18n/locales/pl.json +18 -0
- package/src/i18n/locales/pt.json +18 -0
- package/src/i18n/locales/ru.json +21 -1
- package/src/i18n/locales/se.json +18 -0
- package/src/i18n/locales/ua.json +21 -1
- package/src/index.ts +0 -3
|
@@ -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
|
|
|
@@ -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
|
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { useImage } from "@tiptapify/composables/Toolbar/Media/useImage";
|
|
2
|
+
import { useEmoji } from "@tiptapify/composables/Toolbar/Media/useEmoji";
|
|
2
3
|
import { useLink } from "@tiptapify/composables/Toolbar/Media/useLink";
|
|
3
4
|
import { useTable } from "@tiptapify/composables/Toolbar/Media/useTable";
|
|
5
|
+
import { useVideo } from "@tiptapify/composables/Toolbar/Media/useVideo";
|
|
4
6
|
|
|
5
7
|
export function useMediaItems() {
|
|
6
8
|
return {
|
|
7
9
|
link: useLink(),
|
|
8
10
|
image: useImage(),
|
|
11
|
+
video: useVideo(),
|
|
12
|
+
emoji: useEmoji(),
|
|
9
13
|
table: useTable()
|
|
10
14
|
}
|
|
11
15
|
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
|
|
3
|
+
import { Editor } from "@tiptap/vue-3";
|
|
4
|
+
|
|
5
|
+
import tiptapifyEmojis from "@tiptapify/extensions/emoji"
|
|
6
|
+
|
|
7
|
+
import { computed, inject, Ref, ref } from 'vue'
|
|
8
|
+
|
|
9
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
10
|
+
|
|
11
|
+
defineExpose({ open, close })
|
|
12
|
+
|
|
13
|
+
const emit = defineEmits(['close'])
|
|
14
|
+
|
|
15
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
16
|
+
|
|
17
|
+
const tab = ref('smileys_and_emotion')
|
|
18
|
+
const sorted = tiptapifyEmojis.sort((previous, current) => {
|
|
19
|
+
if (previous.order < current.order) {
|
|
20
|
+
return -1
|
|
21
|
+
}
|
|
22
|
+
if (previous.order > current.order) {
|
|
23
|
+
return 1
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return 0
|
|
27
|
+
})
|
|
28
|
+
const emojis = computed(() => sorted.map(item => { return { group: item.name, emojis: item.items } }))
|
|
29
|
+
|
|
30
|
+
const handleEmojiClick = (emoji: any) => {
|
|
31
|
+
editor.value.chain().focus().insertContent(emoji.char).run()
|
|
32
|
+
close()
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function close() {
|
|
36
|
+
emit('close')
|
|
37
|
+
}
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<VSheet class="pa-2" max-width="570">
|
|
42
|
+
<div class="d-flex flex-row">
|
|
43
|
+
<VTabs v-model="tab" mandatory direction="vertical" color="primary" density="compact">
|
|
44
|
+
<VTab
|
|
45
|
+
v-for="item of emojis"
|
|
46
|
+
:text="item.group"
|
|
47
|
+
:value="item.group"
|
|
48
|
+
:key="item.group"
|
|
49
|
+
density="compact"
|
|
50
|
+
rounded
|
|
51
|
+
size="small"
|
|
52
|
+
>
|
|
53
|
+
{{ t(`media.emoji.${item.group}`) }}
|
|
54
|
+
</VTab>
|
|
55
|
+
</VTabs>
|
|
56
|
+
|
|
57
|
+
<VWindow v-model="tab" direction="vertical">
|
|
58
|
+
<VWindowItem v-for="item of emojis" :value="item.group">
|
|
59
|
+
<div class="tiptapify-emoji-container">
|
|
60
|
+
<div v-for="emojiItem in item.emojis" class="tiptapify-emoji-container-item" @click="handleEmojiClick(emojiItem)" :title="emojiItem.name">
|
|
61
|
+
<div class="tiptapify-emoji-container-item__overlay">
|
|
62
|
+
<span>
|
|
63
|
+
{{ emojiItem.char }}
|
|
64
|
+
</span>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
</VWindowItem>
|
|
69
|
+
</VWindow>
|
|
70
|
+
</div>
|
|
71
|
+
</VSheet>
|
|
72
|
+
</template>
|
|
73
|
+
|
|
74
|
+
<style lang="scss" scoped>
|
|
75
|
+
.tiptapify-emoji-container {
|
|
76
|
+
max-height: 500px;
|
|
77
|
+
overflow-y: auto;
|
|
78
|
+
|
|
79
|
+
border: 1px solid #ddd;
|
|
80
|
+
border-radius: 8px;
|
|
81
|
+
filter: drop-shadow(1px 2px 3px #777);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.tiptapify-emoji-container-item__overlay {
|
|
85
|
+
display: flex;
|
|
86
|
+
justify-content: center;
|
|
87
|
+
align-items: center;
|
|
88
|
+
width: 32px;
|
|
89
|
+
height: 32px;
|
|
90
|
+
border-radius: 5px;
|
|
91
|
+
z-index: 1;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.tiptapify-emoji-container-item {
|
|
95
|
+
position: relative;
|
|
96
|
+
display: inline-flex;
|
|
97
|
+
justify-content: center;
|
|
98
|
+
align-items: center;
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
width: 32px;
|
|
101
|
+
height: 32px;
|
|
102
|
+
transition: background-color 0.2s ease-in-out;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.tiptapify-emoji-container-item:hover .tiptapify-emoji-container-item__overlay {
|
|
106
|
+
background-color: rgba(var(--v-theme-on-background), calc(var(--v-hover-opacity) * var(--v-theme-overlay-multiplier)));
|
|
107
|
+
}
|
|
108
|
+
</style>
|
|
@@ -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>
|