tiptapify 0.1.4 → 0.1.5
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/dist/tiptapify.css +2 -1
- package/dist/tiptapify.mjs +64289 -50740
- package/dist/tiptapify.umd.js +88 -78
- package/index.d.ts +97 -40
- package/package.json +65 -66
- package/src/components/Footer.vue +4 -3
- package/src/components/MenuBubble.vue +16 -16
- package/src/components/MenuFloating.vue +13 -13
- package/src/components/Tiptapify.vue +19 -9
- package/src/components/Toolbar/Index.vue +21 -17
- package/src/components/Toolbar/Items.vue +2 -1
- package/src/components/Toolbar/actions.ts +3 -3
- package/src/components/Toolbar/alignment.ts +5 -5
- package/src/components/Toolbar/format.ts +5 -5
- package/src/components/Toolbar/formatExtra.ts +6 -6
- package/src/components/Toolbar/items.ts +8 -8
- package/src/components/Toolbar/list.ts +6 -6
- package/src/components/Toolbar/media.ts +8 -8
- package/src/components/Toolbar/misc.ts +8 -8
- package/src/components/Toolbar/style.ts +7 -7
- package/src/components/UI/TiptapifyDialog.vue +14 -13
- package/src/components/editorExtensions.ts +2 -2
- package/src/components/index.ts +6 -6
- package/src/constants/style.ts +4 -3
- package/src/extensions/charmap/arrows.ts +700 -700
- package/src/extensions/charmap/box_drawing.ts +184 -184
- package/src/extensions/charmap/currency.ts +93 -93
- package/src/extensions/charmap/cyrillic.ts +368 -368
- package/src/extensions/charmap/diacritics.ts +60 -60
- package/src/extensions/charmap/extended_letters.ts +748 -748
- package/src/extensions/charmap/greek.ts +252 -252
- package/src/extensions/charmap/hebrew.ts +105 -105
- package/src/extensions/charmap/math.ts +1684 -1684
- package/src/extensions/charmap/punctuation.ts +68 -68
- package/src/extensions/charmap/symbols.ts +288 -288
- package/src/extensions/charmap/typography.ts +284 -284
- package/src/extensions/components/CodeBlockComponent.vue +2 -2
- package/src/extensions/components/actions/redo/Button.vue +12 -10
- package/src/extensions/components/actions/undo/Button.vue +12 -10
- package/src/extensions/components/alignment/center/Button.vue +11 -9
- package/src/extensions/components/alignment/justify/Button.vue +11 -9
- package/src/extensions/components/alignment/left/Button.vue +11 -9
- package/src/extensions/components/alignment/right/Button.vue +11 -9
- package/src/extensions/components/format/bold/Button.vue +12 -10
- package/src/extensions/components/format/italic/Button.vue +12 -10
- package/src/extensions/components/format/strike/Button.vue +12 -10
- package/src/extensions/components/format/underline/Button.vue +5 -3
- package/src/extensions/components/formatExtra/code/Button.vue +12 -10
- package/src/extensions/components/formatExtra/codeBlock/Button.vue +12 -10
- package/src/extensions/components/formatExtra/quote/Button.vue +12 -10
- package/src/extensions/components/formatExtra/sub/Button.vue +12 -10
- package/src/extensions/components/formatExtra/sup/Button.vue +12 -10
- package/src/extensions/components/list/bullet/Button.vue +21 -19
- package/src/extensions/components/list/bullet/index.ts +1 -1
- package/src/extensions/components/list/indent/Button.vue +13 -11
- package/src/extensions/components/list/numbered/Button.vue +12 -10
- package/src/extensions/components/list/outdent/Button.vue +13 -11
- package/src/extensions/components/list/task/Button.vue +12 -10
- package/src/extensions/components/media/charmap/Button.vue +8 -5
- package/src/extensions/components/media/charmap/Picker.vue +20 -18
- package/src/extensions/components/media/emoji/Button.vue +8 -6
- package/src/extensions/components/media/emoji/Picker.vue +20 -18
- package/src/extensions/components/media/iframe/Button.vue +13 -11
- package/src/extensions/components/media/iframe/IframeDialog.vue +27 -25
- package/src/extensions/components/media/image/Button.vue +12 -10
- package/src/extensions/components/media/image/ImageDialog.vue +46 -42
- package/src/extensions/components/media/link/Button.vue +12 -11
- package/src/extensions/components/media/link/LinkDialog.vue +34 -32
- package/src/extensions/components/media/link/index.ts +6 -7
- package/src/extensions/components/media/table/Button.vue +21 -19
- package/src/extensions/components/media/table/ColumnActions.vue +5 -4
- package/src/extensions/components/media/table/RowActions.vue +5 -4
- package/src/extensions/components/media/table/TableBuilder.vue +15 -13
- package/src/extensions/components/media/video/Button.vue +12 -10
- package/src/extensions/components/media/video/VideoDialog.vue +33 -15
- package/src/extensions/components/misc/break/Button.vue +8 -6
- package/src/extensions/components/misc/formatClear/Button.vue +12 -10
- package/src/extensions/components/misc/fullscreen/Button.vue +20 -18
- package/src/extensions/components/misc/invisibleChar/Button.vue +11 -9
- package/src/extensions/components/misc/line/Button.vue +11 -9
- package/src/extensions/components/misc/preview/Button.vue +11 -9
- package/src/extensions/components/misc/source/Button.vue +9 -7
- package/src/extensions/components/misc/source/ShowSourceDialog.vue +27 -25
- package/src/extensions/components/slashCommands/CommandsList.vue +3 -1
- package/src/extensions/components/style/StyleColor.vue +26 -22
- package/src/extensions/components/style/color/Button.vue +19 -17
- package/src/extensions/components/style/fontFamily/Button.vue +16 -14
- package/src/extensions/components/style/fontFamily/FontFamily.vue +3 -2
- package/src/extensions/components/style/fontSize/Button.vue +17 -15
- package/src/extensions/components/style/fontSize/FontSize.vue +4 -3
- package/src/extensions/components/style/heading/Button.vue +19 -16
- package/src/extensions/components/style/highlight/Button.vue +19 -17
- package/src/extensions/components/style/lineHeight/Button.vue +16 -14
- package/src/extensions/components/style/lineHeight/FontFamily.vue +3 -2
- package/src/extensions/components/style/lineHeight/LineHeight.vue +3 -2
- package/src/extensions/emoji/activities.ts +534 -534
- package/src/extensions/emoji/animals_and_nature.ts +978 -978
- package/src/extensions/emoji/component.ts +54 -54
- package/src/extensions/emoji/flags.ts +1644 -1644
- package/src/extensions/emoji/food_and_drink.ts +810 -810
- package/src/extensions/emoji/objects.ts +1608 -1608
- package/src/extensions/emoji/people_and_body.ts +2022 -2022
- package/src/extensions/emoji/smileys_and_emotion.ts +1038 -1038
- package/src/extensions/emoji/symbols.ts +1290 -1290
- package/src/extensions/emoji/travel_and_places.ts +1332 -1332
- package/src/index.ts +15 -5
- package/src/types/editor.ts +10 -0
- package/src/types/slashCommandsTypes.ts +1 -1
- package/src/types/toolbarTypes.ts +3 -1
- package/src/utils/helpers.ts +1 -1
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
|
|
3
|
-
import * as mdi from
|
|
4
|
-
import { Editor } from
|
|
5
|
-
import TiptapifyDialog from
|
|
6
|
-
import defaults from
|
|
3
|
+
import * as mdi from '@mdi/js'
|
|
4
|
+
import { Editor } from '@tiptap/vue-3'
|
|
5
|
+
import TiptapifyDialog from '@tiptapify/components/UI/TiptapifyDialog.vue'
|
|
6
|
+
import defaults from '@tiptapify/constants/defaults'
|
|
7
|
+
import { variantBtnTypes, variantFieldTypes } from '@tiptapify/types/editor'
|
|
7
8
|
|
|
8
|
-
import { computed, inject, onMounted, onUnmounted, Ref, ref } from 'vue'
|
|
9
|
+
import { computed, inject, onMounted, onUnmounted, PropType, Ref, ref, useTemplateRef } from 'vue'
|
|
10
|
+
import { ComposerTranslation } from 'vue-i18n'
|
|
9
11
|
|
|
10
12
|
defineProps({
|
|
11
|
-
variantBtn: { type: String
|
|
12
|
-
variantField: { type: String
|
|
13
|
+
variantBtn: { type: String as PropType<variantBtnTypes>, default() { return defaults.variantBtn } },
|
|
14
|
+
variantField: { type: String as PropType<variantFieldTypes>, default() { return defaults.variantField } },
|
|
13
15
|
})
|
|
14
16
|
|
|
15
17
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
16
|
-
const { t } = inject('tiptapifyI18n') as
|
|
18
|
+
const { t } = inject('tiptapifyI18n') as { t: ComposerTranslation }
|
|
17
19
|
|
|
18
20
|
const generateImageAttrs = () => ({
|
|
19
21
|
src: '',
|
|
@@ -25,7 +27,7 @@ const generateImageAttrs = () => ({
|
|
|
25
27
|
|
|
26
28
|
const attrs = ref(generateImageAttrs())
|
|
27
29
|
|
|
28
|
-
const dialog =
|
|
30
|
+
const dialog = useTemplateRef('dialog')
|
|
29
31
|
|
|
30
32
|
const isDisabled = computed(() => {
|
|
31
33
|
const { src } = attrs.value
|
|
@@ -33,7 +35,7 @@ const isDisabled = computed(() => {
|
|
|
33
35
|
})
|
|
34
36
|
|
|
35
37
|
const keepRatio = ref(true)
|
|
36
|
-
const ratio = ref(
|
|
38
|
+
const ratio: Ref<string> = ref('')
|
|
37
39
|
function setRatio(force: boolean = false) {
|
|
38
40
|
if (!keepRatio.value && !force) {
|
|
39
41
|
return
|
|
@@ -60,7 +62,7 @@ function updateSizeRatio(dim: string) {
|
|
|
60
62
|
|
|
61
63
|
const target = source === 'width' ? 'height' : 'width'
|
|
62
64
|
|
|
63
|
-
attrs.value[target] = parseFloat(sizeRatio).toFixed(0)
|
|
65
|
+
attrs.value[target] = parseFloat(String(sizeRatio)).toFixed(0)
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
function apply() {
|
|
@@ -97,7 +99,7 @@ function clear() {
|
|
|
97
99
|
}
|
|
98
100
|
|
|
99
101
|
function close() {
|
|
100
|
-
dialog.value
|
|
102
|
+
dialog.value?.close()
|
|
101
103
|
|
|
102
104
|
attrs.value = generateImageAttrs()
|
|
103
105
|
ratio.value = null
|
|
@@ -114,7 +116,7 @@ const showTiptapifyImage = (event: CustomEvent) => {
|
|
|
114
116
|
attrs.value.width = event.detail.image?.width
|
|
115
117
|
attrs.value.height = event.detail.image?.height
|
|
116
118
|
|
|
117
|
-
dialog.value
|
|
119
|
+
dialog.value?.open()
|
|
118
120
|
}
|
|
119
121
|
|
|
120
122
|
onMounted(() => {
|
|
@@ -139,51 +141,53 @@ onUnmounted(() => {
|
|
|
139
141
|
<div class="tiptapify-grid-row">
|
|
140
142
|
<div>
|
|
141
143
|
<VTextField
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
144
|
+
v-model="attrs.alt"
|
|
145
|
+
density="comfortable"
|
|
146
|
+
:label="t('dialog.image.alt')"
|
|
147
|
+
/>
|
|
145
148
|
</div>
|
|
146
149
|
</div>
|
|
147
150
|
|
|
148
151
|
<div class="tiptapify-grid-row">
|
|
149
152
|
<div>
|
|
150
153
|
<VTextField
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
+
v-model="attrs.title"
|
|
155
|
+
density="comfortable"
|
|
156
|
+
:label="t('dialog.image.title')"
|
|
157
|
+
/>
|
|
154
158
|
</div>
|
|
155
159
|
</div>
|
|
156
160
|
|
|
157
161
|
<div class="tiptapify-grid-row">
|
|
158
162
|
<div class="tiptapify-image-inputs-container">
|
|
159
163
|
<VTextField
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
164
|
+
v-model="attrs.width"
|
|
165
|
+
type="number"
|
|
166
|
+
density="comfortable"
|
|
167
|
+
:precision="0"
|
|
168
|
+
:min="1"
|
|
169
|
+
:label="t('dialog.image.width')"
|
|
170
|
+
@change="setRatio"
|
|
171
|
+
@update:model-value="updateSizeRatio('width')"
|
|
168
172
|
/>
|
|
169
173
|
<VTextField
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
174
|
+
v-model="attrs.height"
|
|
175
|
+
type="number"
|
|
176
|
+
density="comfortable"
|
|
177
|
+
:precision="0"
|
|
178
|
+
:min="1"
|
|
179
|
+
:label="t('dialog.image.height')"
|
|
180
|
+
@change="setRatio"
|
|
181
|
+
@update:model-value="updateSizeRatio('height')"
|
|
178
182
|
/>
|
|
179
183
|
</div>
|
|
180
184
|
<div>
|
|
181
185
|
<VBtn
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
186
|
+
v-model="keepRatio"
|
|
187
|
+
:color="keepRatio ? 'primary' : 'secondary'"
|
|
188
|
+
size="48"
|
|
189
|
+
:variant="variantBtn"
|
|
190
|
+
@click="keepRatio = !keepRatio"
|
|
187
191
|
>
|
|
188
192
|
<VIcon :icon="keepRatio ? `mdiSvg:${mdi.mdiLock}` : `mdiSvg:${mdi.mdiLockOpenVariant}`" />
|
|
189
193
|
<VTooltip activator="parent">
|
|
@@ -199,12 +203,12 @@ onUnmounted(() => {
|
|
|
199
203
|
<VCardActions>
|
|
200
204
|
<VRow>
|
|
201
205
|
<VCol class="d-flex justify-start">
|
|
202
|
-
<VBtn
|
|
206
|
+
<VBtn v-if="editor.isActive('image')" color="warning" :variant="variantBtn" :disabled="isDisabled" @click="clear">
|
|
203
207
|
{{ t('dialog.clear') }}
|
|
204
208
|
</VBtn>
|
|
205
209
|
</VCol>
|
|
206
210
|
<VCol class="d-flex justify-end">
|
|
207
|
-
<VBtn :variant="variantBtn"
|
|
211
|
+
<VBtn :variant="variantBtn" class="mr-2" @click="close">
|
|
208
212
|
{{ t('dialog.close') }}
|
|
209
213
|
</VBtn>
|
|
210
214
|
<VBtn color="primary" :variant="variantBtn" :disabled="isDisabled" @click="apply">
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
|
|
3
3
|
import * as mdi from '@mdi/js'
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { computed, inject, Ref } from
|
|
4
|
+
import BtnIcon from '@tiptapify/components/UI/BtnIcon.vue'
|
|
5
|
+
import LinkDialog from '@tiptapify/extensions/components/media/link/LinkDialog.vue'
|
|
6
|
+
import { TiptapifyEditor, variantBtnTypes } from '@tiptapify/types/editor'
|
|
7
|
+
import { computed, inject, PropType, Ref } from 'vue'
|
|
8
8
|
|
|
9
9
|
import defaults from '@tiptapify/constants/defaults'
|
|
10
|
+
import { ComposerTranslation } from 'vue-i18n'
|
|
10
11
|
|
|
11
12
|
defineProps({
|
|
12
|
-
variantBtn: { type: String
|
|
13
|
+
variantBtn: { type: String as PropType<variantBtnTypes>, default() { return defaults.variantBtn } },
|
|
13
14
|
})
|
|
14
15
|
|
|
15
|
-
const editor = inject('tiptapifyEditor') as Ref<
|
|
16
|
+
const editor = inject('tiptapifyEditor') as Ref<TiptapifyEditor>
|
|
16
17
|
|
|
17
|
-
const { t } = inject('tiptapifyI18n') as
|
|
18
|
+
const { t } = inject('tiptapifyI18n') as { t: ComposerTranslation }
|
|
18
19
|
|
|
19
20
|
const icon = computed(() => editor.value.isActive('tiptapifyLink') ? `mdiSvg:${mdi.mdiLinkOff}` : `mdiSvg:${mdi.mdiLink}`)
|
|
20
21
|
|
|
@@ -22,10 +23,10 @@ const icon = computed(() => editor.value.isActive('tiptapifyLink') ? `mdiSvg:${m
|
|
|
22
23
|
|
|
23
24
|
<template>
|
|
24
25
|
<VBtn
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
:color="editor.isActive('link') ? 'primary' : ''"
|
|
27
|
+
:variant="variantBtn"
|
|
28
|
+
size="32"
|
|
29
|
+
@click="editor.commands.showLink()"
|
|
29
30
|
>
|
|
30
31
|
<VTooltip activator="parent">
|
|
31
32
|
{{ t('media.link') }}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
|
|
3
|
-
import { Editor } from
|
|
4
|
-
import defaults from
|
|
3
|
+
import { Editor } from '@tiptap/vue-3'
|
|
4
|
+
import defaults from '@tiptapify/constants/defaults'
|
|
5
|
+
import { variantBtnTypes, variantFieldTypes } from '@tiptapify/types/editor'
|
|
5
6
|
|
|
6
|
-
import { computed, inject, onMounted, onUnmounted, Ref, ref, watch } from 'vue'
|
|
7
|
+
import { computed, inject, onMounted, onUnmounted, PropType, Ref, ref, useTemplateRef, watch } from 'vue'
|
|
7
8
|
|
|
8
|
-
import TiptapifyDialog from
|
|
9
|
+
import TiptapifyDialog from '@tiptapify/components/UI/TiptapifyDialog.vue'
|
|
10
|
+
import { ComposerTranslation } from 'vue-i18n'
|
|
9
11
|
|
|
10
12
|
defineProps({
|
|
11
|
-
variantBtn: { type: String
|
|
12
|
-
variantField: { type: String
|
|
13
|
+
variantBtn: { type: String as PropType<variantBtnTypes>, default() { return defaults.variantBtn } },
|
|
14
|
+
variantField: { type: String as PropType<variantFieldTypes>, default() { return 'outlined' } },
|
|
13
15
|
})
|
|
14
16
|
|
|
15
17
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
16
|
-
const { t } = inject('tiptapifyI18n') as
|
|
18
|
+
const { t } = inject('tiptapifyI18n') as { t: ComposerTranslation }
|
|
17
19
|
|
|
18
20
|
const generateLinkAttrs = () => ({
|
|
19
21
|
href: '',
|
|
@@ -32,7 +34,7 @@ const targetAttrs = computed(() => [
|
|
|
32
34
|
const attrs = ref(generateLinkAttrs())
|
|
33
35
|
const hrefInvalid = ref(false)
|
|
34
36
|
|
|
35
|
-
const dialog =
|
|
37
|
+
const dialog = useTemplateRef('dialog')
|
|
36
38
|
|
|
37
39
|
const isDisabled = computed(() => {
|
|
38
40
|
const { href } = attrs.value
|
|
@@ -68,7 +70,7 @@ const showLink = (event: CustomEvent) => {
|
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
attrs.value.href = event.detail.link?.href ?? ''
|
|
71
|
-
attrs.value.target = targetAttrs.value.find(item => item.value === event.detail.link?.target) ?? targetAttrs[0]
|
|
73
|
+
attrs.value.target = targetAttrs.value.find(item => item.value === event.detail.link?.target) ?? targetAttrs.value[0]
|
|
72
74
|
attrs.value.rel = event.detail.link?.rel?.split(' ')
|
|
73
75
|
attrs.value.cssClass = event.detail.link?.class
|
|
74
76
|
|
|
@@ -113,23 +115,23 @@ watch(() => attrs.value.href, () => {
|
|
|
113
115
|
<VRow>
|
|
114
116
|
<VCol cols="12">
|
|
115
117
|
<VTextField
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
118
|
+
v-model="attrs.href"
|
|
119
|
+
density="compact"
|
|
120
|
+
variant="outlined"
|
|
121
|
+
:label="t('dialog.link.href')"
|
|
122
|
+
:error-messages="hrefInvalid ? t('dialog.link.href_error') : ''"
|
|
123
|
+
autofocus
|
|
122
124
|
/>
|
|
123
125
|
</VCol>
|
|
124
126
|
|
|
125
127
|
<VCol cols="12" md="4">
|
|
126
128
|
<VSelect
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
v-model="attrs.target"
|
|
130
|
+
:items="targetAttrs"
|
|
131
|
+
:label="t('dialog.link.target')"
|
|
132
|
+
variant="outlined"
|
|
133
|
+
return-object
|
|
134
|
+
density="compact"
|
|
133
135
|
/>
|
|
134
136
|
</VCol>
|
|
135
137
|
|
|
@@ -139,15 +141,15 @@ watch(() => attrs.value.href, () => {
|
|
|
139
141
|
|
|
140
142
|
<VCol cols="12">
|
|
141
143
|
<VSelect
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
144
|
+
v-model="attrs.rel"
|
|
145
|
+
:items="relAttrs"
|
|
146
|
+
:label="t('dialog.link.rel')"
|
|
147
|
+
variant="outlined"
|
|
148
|
+
multiple
|
|
149
|
+
chips
|
|
150
|
+
closable-chips
|
|
151
|
+
clearable
|
|
152
|
+
density="compact"
|
|
151
153
|
/>
|
|
152
154
|
</VCol>
|
|
153
155
|
</VRow>
|
|
@@ -158,12 +160,12 @@ watch(() => attrs.value.href, () => {
|
|
|
158
160
|
<VCardActions>
|
|
159
161
|
<VRow>
|
|
160
162
|
<VCol class="d-flex justify-start">
|
|
161
|
-
<VBtn
|
|
163
|
+
<VBtn v-if="editor.isActive('link')" color="warning" :variant="variantBtn" :disabled="isDisabled" @click="clear">
|
|
162
164
|
{{ t('dialog.clear') }}
|
|
163
165
|
</VBtn>
|
|
164
166
|
</VCol>
|
|
165
167
|
<VCol class="d-flex justify-end">
|
|
166
|
-
<VBtn :variant="variantBtn"
|
|
168
|
+
<VBtn :variant="variantBtn" class="mr-2" @click="close">
|
|
167
169
|
{{ t('dialog.close') }}
|
|
168
170
|
</VBtn>
|
|
169
171
|
<VBtn color="primary" :variant="variantBtn" :disabled="isDisabled || hrefInvalid" @click="apply">
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const name: string = 'link'
|
|
1
|
+
import { CommandProps } from '@tiptap/core'
|
|
2
|
+
import Link from '@tiptap/extension-link'
|
|
4
3
|
|
|
5
4
|
declare module '@tiptap/core' {
|
|
6
5
|
interface Commands<ReturnType> {
|
|
7
|
-
|
|
6
|
+
tiptapify_link: {
|
|
8
7
|
showLink: () => ReturnType
|
|
9
8
|
}
|
|
10
9
|
}
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
export const TiptapifyLink = Link.extend({
|
|
14
|
-
name,
|
|
13
|
+
name: 'tiptapify_link',
|
|
15
14
|
|
|
16
15
|
addCommands() {
|
|
17
16
|
return {
|
|
18
17
|
...this.parent?.(),
|
|
19
|
-
showLink: () => ({ editor }) => {
|
|
20
|
-
const event = new CustomEvent(
|
|
18
|
+
showLink: () => ({ editor }: CommandProps) => {
|
|
19
|
+
const event = new CustomEvent('tiptapify-show-link', {
|
|
21
20
|
detail: {
|
|
22
21
|
link: editor.getAttributes('link'),
|
|
23
22
|
editorId: editor.instanceId
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
|
|
3
3
|
import * as mdi from '@mdi/js'
|
|
4
|
-
import { Editor } from
|
|
5
|
-
import BtnIcon from
|
|
6
|
-
import ColumnActions from
|
|
7
|
-
import RowActions from
|
|
8
|
-
import TableBuilder from
|
|
9
|
-
import {
|
|
4
|
+
import { Editor } from '@tiptap/vue-3'
|
|
5
|
+
import BtnIcon from '@tiptapify/components/UI/BtnIcon.vue'
|
|
6
|
+
import ColumnActions from '@tiptapify/extensions/components/media/table/ColumnActions.vue'
|
|
7
|
+
import RowActions from '@tiptapify/extensions/components/media/table/RowActions.vue'
|
|
8
|
+
import TableBuilder from '@tiptapify/extensions/components/media/table/TableBuilder.vue'
|
|
9
|
+
import { variantBtnTypes } from '@tiptapify/types/editor'
|
|
10
|
+
import { inject, PropType, Ref } from 'vue'
|
|
10
11
|
|
|
11
12
|
import defaults from '@tiptapify/constants/defaults'
|
|
13
|
+
import { ComposerTranslation } from 'vue-i18n'
|
|
12
14
|
|
|
13
15
|
defineProps({
|
|
14
|
-
variantBtn: { type: String
|
|
16
|
+
variantBtn: { type: String as PropType<variantBtnTypes>, default() { return defaults.variantBtn } },
|
|
15
17
|
})
|
|
16
18
|
|
|
17
19
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
18
20
|
|
|
19
|
-
const { t } = inject('tiptapifyI18n') as
|
|
21
|
+
const { t } = inject('tiptapifyI18n') as { t: ComposerTranslation }
|
|
20
22
|
|
|
21
23
|
|
|
22
24
|
const rowActionsDisabled = () => {
|
|
@@ -34,11 +36,11 @@ const columnActionsDisabled = () => {
|
|
|
34
36
|
|
|
35
37
|
<template>
|
|
36
38
|
<VBtn
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
:id="`tiptapify-table-button-${editor.instanceId}`"
|
|
40
|
+
:color="editor.isActive('table') ? 'primary' : ''"
|
|
41
|
+
:disabled="!editor.can().chain().focus().insertTable().run()"
|
|
42
|
+
:variant="variantBtn"
|
|
43
|
+
size="32"
|
|
42
44
|
>
|
|
43
45
|
<BtnIcon :icon="`mdiSvg:${mdi.mdiTable}`" />
|
|
44
46
|
</VBtn>
|
|
@@ -54,12 +56,12 @@ const columnActionsDisabled = () => {
|
|
|
54
56
|
</VListItemTitle>
|
|
55
57
|
|
|
56
58
|
<VMenu
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
submenu
|
|
60
|
+
activator="parent"
|
|
61
|
+
:open-on-hover="true"
|
|
62
|
+
open-on-click
|
|
63
|
+
:close-on-content-click="false"
|
|
64
|
+
:disabled="!editor.can().chain().focus().insertTable().run()"
|
|
63
65
|
>
|
|
64
66
|
<TableBuilder />
|
|
65
67
|
</VMenu>
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
|
|
3
3
|
import * as mdi from '@mdi/js'
|
|
4
|
-
import { Editor } from
|
|
5
|
-
import BtnIcon from
|
|
6
|
-
import { inject, Ref } from
|
|
4
|
+
import { Editor } from '@tiptap/vue-3'
|
|
5
|
+
import BtnIcon from '@tiptapify/components/UI/BtnIcon.vue'
|
|
6
|
+
import { inject, Ref } from 'vue'
|
|
7
|
+
import { ComposerTranslation } from 'vue-i18n'
|
|
7
8
|
|
|
8
9
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
9
10
|
|
|
10
|
-
const { t } = inject('tiptapifyI18n') as
|
|
11
|
+
const { t } = inject('tiptapifyI18n') as { t: ComposerTranslation }
|
|
11
12
|
|
|
12
13
|
const columnCanAddBefore = () => {
|
|
13
14
|
return editor.value.can().chain().focus().addColumnBefore().run()
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
|
|
3
3
|
import * as mdi from '@mdi/js'
|
|
4
|
-
import { Editor } from
|
|
5
|
-
import BtnIcon from
|
|
6
|
-
import { inject, Ref } from
|
|
4
|
+
import { Editor } from '@tiptap/vue-3'
|
|
5
|
+
import BtnIcon from '@tiptapify/components/UI/BtnIcon.vue'
|
|
6
|
+
import { inject, Ref } from 'vue'
|
|
7
|
+
import { ComposerTranslation } from 'vue-i18n'
|
|
7
8
|
|
|
8
9
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
9
10
|
|
|
10
|
-
const { t } = inject('tiptapifyI18n') as
|
|
11
|
+
const { t } = inject('tiptapifyI18n') as { t: ComposerTranslation }
|
|
11
12
|
|
|
12
13
|
const rowCanAddBefore = () => {
|
|
13
14
|
return editor.value.can().chain().focus().addRowBefore().run()
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
|
|
3
|
-
import { Editor } from
|
|
3
|
+
import { Editor } from '@tiptap/vue-3'
|
|
4
4
|
|
|
5
5
|
import { inject, Ref, ref } from 'vue'
|
|
6
|
+
import { ComposerTranslation } from 'vue-i18n'
|
|
6
7
|
|
|
7
|
-
const { t } = inject('tiptapifyI18n') as
|
|
8
|
+
const { t } = inject('tiptapifyI18n') as { t: ComposerTranslation }
|
|
8
9
|
|
|
9
10
|
defineExpose({ open })
|
|
10
11
|
|
|
@@ -48,22 +49,23 @@ function printSelection() {
|
|
|
48
49
|
<template>
|
|
49
50
|
<VSheet class="pa-2">
|
|
50
51
|
<VCheckbox
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
v-model="withHeaderRow"
|
|
53
|
+
density="compact"
|
|
54
|
+
color="primary"
|
|
55
|
+
:label="t('media.tables.insertWithHeaderRow')"
|
|
56
|
+
hide-details
|
|
55
57
|
/>
|
|
56
58
|
|
|
57
59
|
<div v-for="rowNum in maxRows" :key="`row-${rowNum}`" class="tiptapify-insert-table-row">
|
|
58
60
|
<div
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
v-for="colNum in maxCols"
|
|
62
|
+
class="tiptapify-insert-table-col"
|
|
63
|
+
:class="{'tiptapify-insert-table-col-hovered': rowNum <= rowHover && colNum <= colHover}"
|
|
64
|
+
@click="insertTable(rowNum, colNum)"
|
|
65
|
+
@mouseover="hoverCell($el.querySelector('.tiptapify-insert-table-col'), rowNum, colNum)"
|
|
66
|
+
@mouseout="leaveCell($el.querySelector('.tiptapify-insert-table-col'))"
|
|
65
67
|
>
|
|
66
|
-
<div class="tiptapify-insert-table-col-button"
|
|
68
|
+
<div class="tiptapify-insert-table-col-button" />
|
|
67
69
|
</div>
|
|
68
70
|
</div>
|
|
69
71
|
|
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
|
|
3
|
-
import { Editor } from
|
|
4
|
-
import BtnIcon from
|
|
5
|
-
import VideoDialog from
|
|
6
|
-
import {
|
|
3
|
+
import { Editor } from '@tiptap/vue-3'
|
|
4
|
+
import BtnIcon from '@tiptapify/components/UI/BtnIcon.vue'
|
|
5
|
+
import VideoDialog from '@tiptapify/extensions/components/media/video/VideoDialog.vue'
|
|
6
|
+
import { variantBtnTypes } from '@tiptapify/types/editor'
|
|
7
|
+
import { inject, PropType, Ref } from 'vue'
|
|
7
8
|
|
|
8
9
|
import defaults from '@tiptapify/constants/defaults'
|
|
10
|
+
import { ComposerTranslation } from 'vue-i18n'
|
|
9
11
|
|
|
10
12
|
defineProps({
|
|
11
|
-
variantBtn: { type: String
|
|
13
|
+
variantBtn: { type: String as PropType<variantBtnTypes>, default() { return defaults.variantBtn } },
|
|
12
14
|
})
|
|
13
15
|
|
|
14
16
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
15
17
|
|
|
16
|
-
const { t } = inject('tiptapifyI18n') as
|
|
18
|
+
const { t } = inject('tiptapifyI18n') as { t: ComposerTranslation }
|
|
17
19
|
|
|
18
20
|
const 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>'
|
|
19
21
|
</script>
|
|
20
22
|
|
|
21
23
|
<template>
|
|
22
24
|
<VBtn
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
:color="editor.isActive('video') ? 'primary' : ''"
|
|
26
|
+
:variant="variantBtn"
|
|
27
|
+
size="32"
|
|
28
|
+
@click="editor.commands.showTiptapifyVideo()"
|
|
27
29
|
>
|
|
28
30
|
<VTooltip activator="parent">
|
|
29
31
|
{{ t('media.video') }}
|