tiptapify 0.1.4 → 0.1.6
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 +68619 -55059
- package/dist/tiptapify.umd.js +90 -80
- package/index.d.ts +98 -40
- package/package.json +73 -67
- 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 +4 -2
- package/src/components/index.ts +6 -6
- package/src/constants/style.test.ts +49 -0
- package/src/constants/style.ts +4 -3
- package/src/extensions/PickerEventBus.test.ts +38 -0
- 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 +39 -37
- 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.test.ts +32 -0
- package/src/utils/helpers.ts +1 -1
|
@@ -1,21 +1,23 @@
|
|
|
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 StyleColor from
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
4
|
+
import { Editor } from '@tiptap/vue-3'
|
|
5
|
+
import BtnIcon from '@tiptapify/components/UI/BtnIcon.vue'
|
|
6
|
+
import StyleColor from '@tiptapify/extensions/components/style/StyleColor.vue'
|
|
7
|
+
import { variantBtnTypes } from '@tiptapify/types/editor'
|
|
8
|
+
import { computed, inject, PropType, Ref } from 'vue'
|
|
9
|
+
import { ComposerTranslation } from 'vue-i18n'
|
|
10
|
+
import { useTheme } from 'vuetify/framework'
|
|
9
11
|
|
|
10
12
|
import defaults from '@tiptapify/constants/defaults'
|
|
11
13
|
|
|
12
14
|
defineProps({
|
|
13
|
-
variantBtn: { type: String
|
|
15
|
+
variantBtn: { type: String as PropType<variantBtnTypes>, default() { return defaults.variantBtn } },
|
|
14
16
|
})
|
|
15
17
|
|
|
16
18
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
17
19
|
|
|
18
|
-
const { t } = inject('tiptapifyI18n') as
|
|
20
|
+
const { t } = inject('tiptapifyI18n') as { t: ComposerTranslation }
|
|
19
21
|
|
|
20
22
|
const appTheme = useTheme()
|
|
21
23
|
|
|
@@ -30,11 +32,11 @@ const selectedColor = computed(() => editor.value.getAttributes('textStyle').col
|
|
|
30
32
|
|
|
31
33
|
<template>
|
|
32
34
|
<VBtn
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
:id="`tiptapify-color-button-${editor.instanceId}`"
|
|
36
|
+
:disabled="!editor.can().chain().focus().toggleHighlight().run()"
|
|
37
|
+
:variant="variantBtn"
|
|
38
|
+
size="32"
|
|
39
|
+
@click="editor.chain().focus().redo().run()"
|
|
38
40
|
>
|
|
39
41
|
<VTooltip activator="parent">
|
|
40
42
|
{{ t('style.color.text') }}
|
|
@@ -42,11 +44,11 @@ const selectedColor = computed(() => editor.value.getAttributes('textStyle').col
|
|
|
42
44
|
|
|
43
45
|
<BtnIcon :icon="`mdiSvg:${mdi.mdiFormatColorText}`" />
|
|
44
46
|
<VIcon
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
:icon="`mdiSvg:${mdi.mdiColorHelper}`"
|
|
48
|
+
:disabled="!editor.can().chain().focus().toggleHighlight().run()"
|
|
49
|
+
:color="activeColor"
|
|
50
|
+
size="small"
|
|
51
|
+
style="position: absolute; filter: drop-shadow(rgba(0, 0, 0, .75) 1px 1px 2px)"
|
|
50
52
|
/>
|
|
51
53
|
</VBtn>
|
|
52
54
|
|
|
@@ -1,28 +1,30 @@
|
|
|
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 FontFamily from
|
|
7
|
-
import { fonts } from
|
|
8
|
-
import {
|
|
4
|
+
import { Editor } from '@tiptap/vue-3'
|
|
5
|
+
import BtnIcon from '@tiptapify/components/UI/BtnIcon.vue'
|
|
6
|
+
import FontFamily from '@tiptapify/extensions/components/style/fontFamily/FontFamily.vue'
|
|
7
|
+
import { fonts } from '@tiptapify/constants/style'
|
|
8
|
+
import { variantBtnTypes } from '@tiptapify/types/editor'
|
|
9
|
+
import { computed, inject, PropType, Ref } from 'vue'
|
|
9
10
|
|
|
10
11
|
import defaults from '@tiptapify/constants/defaults'
|
|
12
|
+
import { ComposerTranslation } from 'vue-i18n'
|
|
11
13
|
|
|
12
14
|
defineProps({
|
|
13
|
-
variantBtn: { type: String
|
|
15
|
+
variantBtn: { type: String as PropType<variantBtnTypes>, default() { return defaults.variantBtn } },
|
|
14
16
|
})
|
|
15
17
|
|
|
16
18
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
17
19
|
|
|
18
|
-
const { t } = inject('tiptapifyI18n') as
|
|
20
|
+
const { t } = inject('tiptapifyI18n') as { t: ComposerTranslation }
|
|
19
21
|
|
|
20
22
|
const activeFontFamily = computed(() => {
|
|
21
23
|
let fontFamily = ''
|
|
22
24
|
for (const font in fonts) {
|
|
23
25
|
if (editor.value.isActive('textStyle', { fontFamily: fonts[font].fontFamily })) {
|
|
24
26
|
fontFamily = fonts[font].fontFamily
|
|
25
|
-
break
|
|
27
|
+
break
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
|
|
@@ -34,7 +36,7 @@ function getColor() {
|
|
|
34
36
|
for (const font in fonts) {
|
|
35
37
|
if (editor.value.isActive('textStyle', { fontFamily: fonts[font].fontFamily })) {
|
|
36
38
|
color = 'primary'
|
|
37
|
-
break
|
|
39
|
+
break
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
42
|
|
|
@@ -45,11 +47,11 @@ function getColor() {
|
|
|
45
47
|
|
|
46
48
|
<template>
|
|
47
49
|
<VBtn
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
:id="`tiptapify-font-family-button-${editor.instanceId}`"
|
|
51
|
+
:disabled="!editor.can().chain().focus().unsetFontFamily().run()"
|
|
52
|
+
:color="getColor()"
|
|
53
|
+
:variant="variantBtn"
|
|
54
|
+
size="32"
|
|
53
55
|
>
|
|
54
56
|
<VTooltip activator="parent">
|
|
55
57
|
{{ t('style.fontFamily') }}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
|
|
3
|
-
import { Editor } from
|
|
3
|
+
import { Editor } from '@tiptap/vue-3'
|
|
4
4
|
|
|
5
5
|
import { computed, inject, Ref, ref } from 'vue'
|
|
6
|
+
import { ComposerTranslation } from 'vue-i18n'
|
|
6
7
|
|
|
7
8
|
const props = defineProps({
|
|
8
9
|
fonts: { type: Array<{ name: string, fontFamily: string }>, default: [] },
|
|
9
10
|
fontFamily: { type: String, default: '' },
|
|
10
11
|
})
|
|
11
12
|
|
|
12
|
-
const { t } = inject('tiptapifyI18n') as
|
|
13
|
+
const { t } = inject('tiptapifyI18n') as { t: ComposerTranslation }
|
|
13
14
|
|
|
14
15
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
15
16
|
|
|
@@ -1,29 +1,31 @@
|
|
|
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 FontSize from
|
|
7
|
-
import { fontSizes } from
|
|
8
|
-
import {
|
|
4
|
+
import { Editor } from '@tiptap/vue-3'
|
|
5
|
+
import BtnIcon from '@tiptapify/components/UI/BtnIcon.vue'
|
|
6
|
+
import FontSize from '@tiptapify/extensions/components/style/fontSize/FontSize.vue'
|
|
7
|
+
import { fontSizes } from '@tiptapify/constants/style'
|
|
8
|
+
import { variantBtnTypes } from '@tiptapify/types/editor'
|
|
9
|
+
import { computed, inject, PropType, Ref } from 'vue'
|
|
9
10
|
|
|
10
11
|
import defaults from '@tiptapify/constants/defaults'
|
|
12
|
+
import { ComposerTranslation } from 'vue-i18n'
|
|
11
13
|
|
|
12
14
|
const props = defineProps({
|
|
13
|
-
fontMeasure: { type: String, default () { return 'px' }},
|
|
14
|
-
variantBtn: { type: String
|
|
15
|
+
fontMeasure: { type: String, default () { return 'px' } },
|
|
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
|
const activeFontSize = computed(() => {
|
|
22
24
|
let fontSize = null
|
|
23
25
|
for (const size of fontSizes) {
|
|
24
26
|
if (editor.value.isActive('textStyle', { fontSize: `${size}${props.fontMeasure}` })) {
|
|
25
27
|
fontSize = size
|
|
26
|
-
break
|
|
28
|
+
break
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
31
|
|
|
@@ -35,7 +37,7 @@ function getColor() {
|
|
|
35
37
|
for (const size of fontSizes) {
|
|
36
38
|
if (editor.value.isActive('textStyle', { fontSize: `${size}${props.fontMeasure}` })) {
|
|
37
39
|
color = 'primary'
|
|
38
|
-
break
|
|
40
|
+
break
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
|
|
@@ -46,11 +48,11 @@ function getColor() {
|
|
|
46
48
|
|
|
47
49
|
<template>
|
|
48
50
|
<VBtn
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
:id="`tiptapify-font-size-button-${editor.instanceId}`"
|
|
52
|
+
:disabled="!editor.can().chain().focus().unsetFontSize().run()"
|
|
53
|
+
:color="getColor()"
|
|
54
|
+
:variant="variantBtn"
|
|
55
|
+
size="32"
|
|
54
56
|
>
|
|
55
57
|
<VTooltip activator="parent">
|
|
56
58
|
{{ t('style.fontSize') }}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
|
|
3
|
-
import { Editor } from
|
|
3
|
+
import { Editor } from '@tiptap/vue-3'
|
|
4
4
|
|
|
5
5
|
import { computed, inject, Ref, ref } from 'vue'
|
|
6
|
+
import { ComposerTranslation } from 'vue-i18n'
|
|
6
7
|
|
|
7
8
|
const props = defineProps({
|
|
8
9
|
sizes: { type: Array<number>, default: [] },
|
|
@@ -10,7 +11,7 @@ const props = defineProps({
|
|
|
10
11
|
fontSize: { type: Number, default () { return null } },
|
|
11
12
|
})
|
|
12
13
|
|
|
13
|
-
const { t } = inject('tiptapifyI18n') as
|
|
14
|
+
const { t } = inject('tiptapifyI18n') as { t: ComposerTranslation }
|
|
14
15
|
|
|
15
16
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
16
17
|
|
|
@@ -64,7 +65,7 @@ function isFontSizeActive(fontSize: number): boolean {
|
|
|
64
65
|
@mouseleave="resetFontSize"
|
|
65
66
|
>
|
|
66
67
|
<VListItemTitle>
|
|
67
|
-
{{ size }}{{ measure}}
|
|
68
|
+
{{ size }}{{ measure }}
|
|
68
69
|
</VListItemTitle>
|
|
69
70
|
</VListItem>
|
|
70
71
|
</VList>
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
|
|
3
3
|
import * as mdi from '@mdi/js'
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import { Level } from '@tiptap/extension-heading'
|
|
5
|
+
import { Editor } from '@tiptap/vue-3'
|
|
6
|
+
import BtnIcon from '@tiptapify/components/UI/BtnIcon.vue'
|
|
7
|
+
import { variantBtnTypes } from '@tiptapify/types/editor'
|
|
8
|
+
import { inject, PropType, Ref } from 'vue'
|
|
7
9
|
|
|
8
10
|
import defaults from '@tiptapify/constants/defaults'
|
|
9
11
|
|
|
10
12
|
const props = defineProps({
|
|
11
|
-
customHeadingLevels: { type: Array<
|
|
13
|
+
customHeadingLevels: { type: Array<Level>, default: () => [] },
|
|
12
14
|
withParagraph: { type: Boolean, default: () => true },
|
|
13
|
-
variantBtn: { type: String
|
|
15
|
+
variantBtn: { type: String as PropType<variantBtnTypes>, default() { return defaults.variantBtn } },
|
|
14
16
|
})
|
|
15
17
|
|
|
16
18
|
interface MDIIcons { [key: string]: string }
|
|
@@ -18,20 +20,20 @@ const mdiIcons = mdi as MDIIcons
|
|
|
18
20
|
|
|
19
21
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
20
22
|
|
|
21
|
-
const { t } = inject('tiptapifyI18n') as
|
|
23
|
+
const { t } = inject('tiptapifyI18n') as { t: ComposerTranslation }
|
|
22
24
|
|
|
23
|
-
import { headingLevels, setHeadingLevels } from
|
|
25
|
+
import { headingLevels, setHeadingLevels } from '@tiptapify/constants/style'
|
|
26
|
+
import { ComposerTranslation } from 'vue-i18n'
|
|
24
27
|
setHeadingLevels(props.customHeadingLevels)
|
|
25
|
-
|
|
26
28
|
</script>
|
|
27
29
|
|
|
28
30
|
<template>
|
|
29
31
|
<VBtn
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
:id="`tiptapify-heading-button-${editor.instanceId}`"
|
|
33
|
+
:color="editor.isActive('heading') ? 'primary' : ''"
|
|
34
|
+
:variant="variantBtn"
|
|
35
|
+
size="32"
|
|
36
|
+
@click="editor.chain().focus().redo().run()"
|
|
35
37
|
>
|
|
36
38
|
<VTooltip activator="parent">
|
|
37
39
|
{{ t('style.heading') }}
|
|
@@ -52,9 +54,10 @@ setHeadingLevels(props.customHeadingLevels)
|
|
|
52
54
|
</VListItemTitle>
|
|
53
55
|
</VListItem>
|
|
54
56
|
<VListItem
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
v-for="headingLevel in headingLevels"
|
|
58
|
+
:key="headingLevel"
|
|
59
|
+
:color="editor.isActive('heading', { level: headingLevel }) ? 'primary' : ''"
|
|
60
|
+
@click="editor.chain().focus().toggleHeading({ level: headingLevel }).run()"
|
|
58
61
|
>
|
|
59
62
|
<VListItemTitle class="d-flex justify-center align-center">
|
|
60
63
|
<BtnIcon :icon="`mdiSvg:${mdiIcons[`mdiFormatHeader${headingLevel}`]}`" />
|
|
@@ -1,21 +1,23 @@
|
|
|
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 StyleColor from
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
4
|
+
import { Editor } from '@tiptap/vue-3'
|
|
5
|
+
import BtnIcon from '@tiptapify/components/UI/BtnIcon.vue'
|
|
6
|
+
import StyleColor from '@tiptapify/extensions/components/style/StyleColor.vue'
|
|
7
|
+
import { variantBtnTypes } from '@tiptapify/types/editor'
|
|
8
|
+
import { computed, inject, PropType, Ref } from 'vue'
|
|
9
|
+
import { ComposerTranslation } from 'vue-i18n'
|
|
10
|
+
import { useTheme } from 'vuetify/framework'
|
|
9
11
|
|
|
10
12
|
import defaults from '@tiptapify/constants/defaults'
|
|
11
13
|
|
|
12
14
|
defineProps({
|
|
13
|
-
variantBtn: { type: String
|
|
15
|
+
variantBtn: { type: String as PropType<variantBtnTypes>, default() { return defaults.variantBtn } },
|
|
14
16
|
})
|
|
15
17
|
|
|
16
18
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
17
19
|
|
|
18
|
-
const { t } = inject('tiptapifyI18n') as
|
|
20
|
+
const { t } = inject('tiptapifyI18n') as { t: ComposerTranslation }
|
|
19
21
|
|
|
20
22
|
const appTheme = useTheme()
|
|
21
23
|
|
|
@@ -30,11 +32,11 @@ const selectedColor = computed(() => editor.value.getAttributes('highlight').col
|
|
|
30
32
|
|
|
31
33
|
<template>
|
|
32
34
|
<VBtn
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
:id="`tiptapify-highlight-button-${editor.instanceId}`"
|
|
36
|
+
:disabled="!editor.can().chain().focus().toggleHighlight().run()"
|
|
37
|
+
:variant="variantBtn"
|
|
38
|
+
size="32"
|
|
39
|
+
@click="editor.chain().focus().redo().run()"
|
|
38
40
|
>
|
|
39
41
|
<VTooltip activator="parent">
|
|
40
42
|
{{ t('style.color.highlight') }}
|
|
@@ -42,11 +44,11 @@ const selectedColor = computed(() => editor.value.getAttributes('highlight').col
|
|
|
42
44
|
|
|
43
45
|
<BtnIcon :icon="`mdiSvg:${mdi.mdiFormatColorFill}`" />
|
|
44
46
|
<VIcon
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
:icon="`mdiSvg:${mdi.mdiColorHelper}`"
|
|
48
|
+
:disabled="!editor.can().chain().focus().toggleHighlight().run()"
|
|
49
|
+
:color="activeColor"
|
|
50
|
+
size="small"
|
|
51
|
+
style="position: absolute; filter: drop-shadow(rgba(0, 0, 0, .75) 1px 1px 2px)"
|
|
50
52
|
/>
|
|
51
53
|
</VBtn>
|
|
52
54
|
|
|
@@ -1,28 +1,30 @@
|
|
|
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 LineHeight from
|
|
7
|
-
import { lineHeights } from
|
|
8
|
-
import {
|
|
4
|
+
import { Editor } from '@tiptap/vue-3'
|
|
5
|
+
import BtnIcon from '@tiptapify/components/UI/BtnIcon.vue'
|
|
6
|
+
import LineHeight from '@tiptapify/extensions/components/style/lineHeight/LineHeight.vue'
|
|
7
|
+
import { lineHeights } from '@tiptapify/constants/style'
|
|
8
|
+
import { variantBtnTypes } from '@tiptapify/types/editor'
|
|
9
|
+
import { computed, inject, PropType, Ref } from 'vue'
|
|
9
10
|
|
|
10
11
|
import defaults from '@tiptapify/constants/defaults'
|
|
12
|
+
import { ComposerTranslation } from 'vue-i18n'
|
|
11
13
|
|
|
12
14
|
defineProps({
|
|
13
|
-
variantBtn: { type: String
|
|
15
|
+
variantBtn: { type: String as PropType<variantBtnTypes>, default() { return defaults.variantBtn } },
|
|
14
16
|
})
|
|
15
17
|
|
|
16
18
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
17
19
|
|
|
18
|
-
const { t } = inject('tiptapifyI18n') as
|
|
20
|
+
const { t } = inject('tiptapifyI18n') as { t: ComposerTranslation }
|
|
19
21
|
|
|
20
22
|
const activeLineHeight = computed(() => {
|
|
21
23
|
let lineHeight = null
|
|
22
24
|
for (const height of lineHeights) {
|
|
23
25
|
if (editor.value.isActive('textStyle', { lineHeight: height.toString() })) {
|
|
24
26
|
lineHeight = height
|
|
25
|
-
break
|
|
27
|
+
break
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
|
|
@@ -34,7 +36,7 @@ function getColor() {
|
|
|
34
36
|
for (const height of lineHeights) {
|
|
35
37
|
if (editor.value.isActive('textStyle', { lineHeight: height.toString() })) {
|
|
36
38
|
color = 'primary'
|
|
37
|
-
break
|
|
39
|
+
break
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
42
|
|
|
@@ -45,11 +47,11 @@ function getColor() {
|
|
|
45
47
|
|
|
46
48
|
<template>
|
|
47
49
|
<VBtn
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
:id="`tiptapify-line-height-button-${editor.instanceId}`"
|
|
51
|
+
:disabled="!editor.can().chain().focus().unsetLineHeight().run()"
|
|
52
|
+
:color="getColor()"
|
|
53
|
+
:variant="variantBtn"
|
|
54
|
+
size="32"
|
|
53
55
|
>
|
|
54
56
|
<VTooltip activator="parent">
|
|
55
57
|
{{ t('style.lineHeight') }}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
|
|
3
|
-
import { Editor } from
|
|
3
|
+
import { Editor } from '@tiptap/vue-3'
|
|
4
4
|
|
|
5
5
|
import { computed, inject, Ref, ref } from 'vue'
|
|
6
|
+
import { ComposerTranslation } from 'vue-i18n'
|
|
6
7
|
|
|
7
8
|
const props = defineProps({
|
|
8
9
|
fonts: { type: Array<{ name: string, fontFamily: string }>, default: [] },
|
|
9
10
|
fontFamily: { type: String, default: '' },
|
|
10
11
|
})
|
|
11
12
|
|
|
12
|
-
const { t } = inject('tiptapifyI18n') as
|
|
13
|
+
const { t } = inject('tiptapifyI18n') as { t: ComposerTranslation }
|
|
13
14
|
|
|
14
15
|
const emit = defineEmits(['close'])
|
|
15
16
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
|
|
3
|
-
import { Editor } from
|
|
3
|
+
import { Editor } from '@tiptap/vue-3'
|
|
4
4
|
|
|
5
5
|
import { computed, inject, Ref, ref } from 'vue'
|
|
6
|
+
import { ComposerTranslation } from 'vue-i18n'
|
|
6
7
|
|
|
7
8
|
const props = defineProps({
|
|
8
9
|
lineHeights: { type: Array<number>, default () { return [] } },
|
|
9
10
|
lineHeight: { type: Number, default () { return null } },
|
|
10
11
|
})
|
|
11
12
|
|
|
12
|
-
const { t } = inject('tiptapifyI18n') as
|
|
13
|
+
const { t } = inject('tiptapifyI18n') as { t: ComposerTranslation }
|
|
13
14
|
|
|
14
15
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
15
16
|
|