tiptapify 0.0.6 → 0.0.8
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 +4 -2
- package/dist/tiptapify.css +1 -1
- package/dist/{tiptapify.es.js → tiptapify.mjs} +54979 -52123
- package/dist/tiptapify.umd.js +41 -43
- package/package.json +8 -8
- package/src/components/Footer.vue +5 -6
- package/src/components/MenuBubble.vue +41 -39
- package/src/components/MenuFloating.vue +10 -10
- package/src/components/Tiptapify.vue +95 -14
- package/src/components/Toolbar/Group.vue +8 -43
- package/src/components/Toolbar/GroupDropdown.vue +85 -0
- package/src/components/Toolbar/Index.vue +20 -19
- package/src/components/Toolbar/items/media.ts +195 -9
- package/src/components/Toolbar/items/misc.ts +10 -1
- package/src/components/Toolbar/items/style.ts +2 -2
- package/src/components/Toolbar/items.ts +3 -3
- package/src/components/editorExtensions.ts +11 -7
- package/src/components/index.ts +13 -0
- package/src/extensions/components/ImageDialog.vue +142 -0
- package/src/extensions/components/LinkDialog.vue +142 -0
- package/src/extensions/components/PreviewDialog.vue +44 -0
- package/src/{components/extensions/components/ShowSource.vue → extensions/components/ShowSourceDialog.vue} +16 -10
- package/src/extensions/components/TableBuilder.vue +138 -0
- package/src/extensions/image.ts +31 -0
- package/src/extensions/link.ts +24 -0
- package/src/extensions/preview.ts +40 -0
- package/src/{components/extensions → extensions}/view-source.ts +1 -6
- package/src/i18n/locales/de.json +78 -45
- package/src/i18n/locales/en.json +37 -4
- package/src/i18n/locales/es.json +46 -13
- package/src/i18n/locales/fr.json +54 -21
- package/src/i18n/locales/it.json +51 -18
- package/src/i18n/locales/pl.json +45 -12
- package/src/i18n/locales/ru.json +36 -3
- package/src/i18n/locales/ua.json +36 -3
- package/src/index.ts +0 -1
- package/src/utils/helpers.ts +17 -0
- package/src/components/extensions/components/LinkDialog.vue +0 -98
- package/src/composable/useEditor.ts +0 -35
- /package/src/{components/extensions → extensions}/components/slashCommands/CommandsList.vue +0 -0
- /package/src/{components/extensions → extensions}/components/slashCommands/suggestion.ts +0 -0
- /package/src/{components/extensions → extensions}/slash-commands.ts +0 -0
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
|
|
3
|
-
import * as mdi from '@mdi/js'
|
|
4
|
-
import { useEditor } from "@tiptapify/composable/useEditor";
|
|
5
|
-
|
|
6
|
-
import { useI18n } from 'vue-i18n'
|
|
7
|
-
import { computed, ref, watch } from 'vue'
|
|
8
|
-
|
|
9
|
-
defineExpose({ open })
|
|
10
|
-
|
|
11
|
-
interface Props {
|
|
12
|
-
value?: string
|
|
13
|
-
target?: '_self' | '_blank'
|
|
14
|
-
destroy?: () => void
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
18
|
-
value: undefined,
|
|
19
|
-
target: '_blank',
|
|
20
|
-
destroy: undefined
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
const editor = useEditor().editor
|
|
24
|
-
const editorInstance = editor.getInstance()
|
|
25
|
-
|
|
26
|
-
const { t } = useI18n()
|
|
27
|
-
|
|
28
|
-
const generateLinkAttrs = () => ({
|
|
29
|
-
href: '',
|
|
30
|
-
target: '_blank'
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
const attrs = ref(generateLinkAttrs())
|
|
34
|
-
|
|
35
|
-
const dialog = ref<boolean>(false)
|
|
36
|
-
|
|
37
|
-
const isDisabled = computed(() => {
|
|
38
|
-
const { href, target } = attrs.value
|
|
39
|
-
if (!href) return true
|
|
40
|
-
|
|
41
|
-
return props.value === href && props.target === target
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
function apply() {
|
|
45
|
-
const { href, target } = attrs.value
|
|
46
|
-
|
|
47
|
-
if (href) {
|
|
48
|
-
editorInstance.value.chain().focus().extendMarkRange('link').setLink({ href, target }).run()
|
|
49
|
-
}
|
|
50
|
-
close()
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function open() {
|
|
54
|
-
dialog.value = true
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function close() {
|
|
58
|
-
dialog.value = false
|
|
59
|
-
attrs.value = generateLinkAttrs()
|
|
60
|
-
|
|
61
|
-
setTimeout(() => props.destroy?.(), 300)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
watch(dialog, val => {
|
|
65
|
-
if (!val) return
|
|
66
|
-
|
|
67
|
-
attrs.value = {
|
|
68
|
-
href: props.value,
|
|
69
|
-
target: props.target
|
|
70
|
-
}
|
|
71
|
-
})
|
|
72
|
-
</script>
|
|
73
|
-
|
|
74
|
-
<template>
|
|
75
|
-
<VDialog v-model="dialog" max-width="400" absolute @click:outside="close">
|
|
76
|
-
<VCard>
|
|
77
|
-
<VToolbar class="px-6" density="compact">
|
|
78
|
-
<span class="headline">{{ t('dialog.link.title') }}</span>
|
|
79
|
-
|
|
80
|
-
<VSpacer />
|
|
81
|
-
|
|
82
|
-
<VBtn class="mx-0" icon @click="close">
|
|
83
|
-
<VIcon :icon="mdi.mdiClose" />
|
|
84
|
-
</VBtn>
|
|
85
|
-
</VToolbar>
|
|
86
|
-
|
|
87
|
-
<VCardText>
|
|
88
|
-
<VTextField v-model="attrs.href" :label="t('dialog.link.placeholder')" autofocus />
|
|
89
|
-
</VCardText>
|
|
90
|
-
|
|
91
|
-
<VCardActions>
|
|
92
|
-
<VBtn :disabled="isDisabled" @click="apply">
|
|
93
|
-
{{ t('dialog.apply') }}
|
|
94
|
-
</VBtn>
|
|
95
|
-
</VCardActions>
|
|
96
|
-
</VCard>
|
|
97
|
-
</VDialog>
|
|
98
|
-
</template>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { useEditor as useEditorOriginal } from '@tiptap/vue-3'
|
|
2
|
-
|
|
3
|
-
import { editorExtensions } from '@tiptapify/components/editorExtensions'
|
|
4
|
-
|
|
5
|
-
let editorInstance: any = null
|
|
6
|
-
|
|
7
|
-
export function useEditor(content: any = '', placeholder: string = '', slashCommands: boolean = true) {
|
|
8
|
-
class TiptapifyEditor {
|
|
9
|
-
private editor
|
|
10
|
-
|
|
11
|
-
constructor() {
|
|
12
|
-
const extensions = editorExtensions(placeholder, slashCommands)
|
|
13
|
-
this.editor = useEditorOriginal({
|
|
14
|
-
content,
|
|
15
|
-
extensions,
|
|
16
|
-
})
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
getInstance() {
|
|
20
|
-
return this.editor
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
destroy() {
|
|
24
|
-
this.editor.value.destroy()
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (!editorInstance) {
|
|
29
|
-
editorInstance = new TiptapifyEditor()
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
editor: editorInstance
|
|
34
|
-
}
|
|
35
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|