tiptapify 0.0.16 → 0.0.18
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 +2 -2
- package/dist/tiptapify.css +1 -1
- package/dist/tiptapify.mjs +25493 -25148
- package/dist/tiptapify.umd.js +38 -38
- package/index.d.ts +2 -2
- package/package.json +1 -1
- package/src/components/Tiptapify.vue +3 -3
- package/src/components/Toolbar/Index.vue +9 -30
- package/src/components/Toolbar/Items.vue +14 -29
- package/src/components/Toolbar/actions.ts +18 -0
- package/src/components/Toolbar/alignment.ts +28 -0
- package/src/components/Toolbar/format.ts +28 -0
- package/src/components/Toolbar/formatExtra.ts +33 -0
- package/src/components/Toolbar/items.ts +19 -114
- package/src/components/Toolbar/list.ts +33 -0
- package/src/components/Toolbar/media.ts +33 -0
- package/src/components/Toolbar/misc.ts +38 -0
- package/src/components/Toolbar/style.ts +38 -0
- package/src/components/editorExtensions.ts +8 -6
- package/src/components/index.ts +2 -2
- package/src/extensions/components/actions/redo/Button.vue +29 -0
- package/src/extensions/components/actions/undo/Button.vue +29 -0
- package/src/extensions/components/alignment/center/Button.vue +29 -0
- package/src/extensions/components/alignment/justify/Button.vue +29 -0
- package/src/extensions/components/alignment/left/Button.vue +29 -0
- package/src/extensions/components/alignment/right/Button.vue +29 -0
- package/src/extensions/components/format/bold/Button.vue +30 -0
- package/src/extensions/components/format/italic/Button.vue +30 -0
- package/src/extensions/components/format/strike/Button.vue +30 -0
- package/src/extensions/components/format/underline/Button.vue +30 -0
- package/src/extensions/components/formatExtra/code/Button.vue +30 -0
- package/src/extensions/components/formatExtra/codeBlock/Button.vue +30 -0
- package/src/extensions/components/formatExtra/quote/Button.vue +30 -0
- package/src/extensions/components/formatExtra/sub/Button.vue +30 -0
- package/src/extensions/components/formatExtra/sup/Button.vue +30 -0
- package/src/extensions/components/list/bullet/Button.vue +30 -0
- package/src/extensions/components/list/indent/Button.vue +30 -0
- package/src/extensions/components/list/numbered/Button.vue +30 -0
- package/src/extensions/components/list/outdent/Button.vue +30 -0
- package/src/extensions/components/list/task/Button.vue +30 -0
- package/src/extensions/components/{Emoji.vue → media/emoji/Button.vue} +65 -62
- package/src/extensions/components/media/image/Button.vue +32 -0
- package/src/extensions/components/media/link/Button.vue +34 -0
- package/src/extensions/components/media/table/Button.vue +119 -0
- package/src/extensions/components/media/table/ColumnActions.vue +52 -0
- package/src/extensions/components/media/table/RowActions.vue +52 -0
- package/src/extensions/components/media/video/Button.vue +32 -0
- package/src/extensions/components/media/video/index.ts +32 -0
- package/src/extensions/components/misc/break/Button.vue +25 -0
- package/src/extensions/components/misc/formatClear/Button.vue +29 -0
- package/src/extensions/components/misc/invisibleChar/Button.vue +30 -0
- package/src/extensions/components/misc/line/Button.vue +25 -0
- package/src/extensions/components/misc/preview/Button.vue +36 -0
- package/src/extensions/components/misc/source/Button.vue +31 -0
- package/src/extensions/components/{ShowSourceDialog.vue → misc/source/ShowSourceDialog.vue} +5 -14
- package/src/extensions/components/{StyleColor.vue → style/StyleColor.vue} +5 -8
- package/src/extensions/components/style/color/Button.vue +57 -0
- package/src/extensions/components/style/fontFamily/Button.vue +60 -0
- package/src/extensions/components/style/fontFamily/FontFamily.vue +76 -0
- package/src/extensions/components/style/fontSize/Button.vue +64 -0
- package/src/extensions/components/{FontSize.vue → style/fontSize/FontSize.vue} +0 -5
- package/src/extensions/components/style/heading/Button.vue +61 -0
- package/src/extensions/components/style/highlight/Button.vue +57 -0
- package/src/extensions/components/style/lineHeight/Button.vue +60 -0
- package/src/extensions/components/{LineHeight.vue → style/lineHeight/LineHeight.vue} +0 -4
- package/src/types/toolbarSections.ts +16 -2
- package/src/components/Toolbar/Group.vue +0 -42
- package/src/components/Toolbar/GroupBtn.vue +0 -32
- package/src/components/Toolbar/GroupDropdown.vue +0 -67
- package/src/components/Toolbar/defaultExtensionComponents.ts +0 -65
- package/src/composables/Toolbar/Actions/useRedo.ts +0 -22
- package/src/composables/Toolbar/Actions/useUndo.ts +0 -22
- package/src/composables/Toolbar/Alignment/useAlignmentCenter.ts +0 -23
- package/src/composables/Toolbar/Alignment/useAlignmentJustify.ts +0 -23
- package/src/composables/Toolbar/Alignment/useAlignmentLeft.ts +0 -23
- package/src/composables/Toolbar/Alignment/useAlignmentRight.ts +0 -23
- package/src/composables/Toolbar/Format/useBold.ts +0 -23
- package/src/composables/Toolbar/Format/useItalic.ts +0 -23
- package/src/composables/Toolbar/Format/useStrike.ts +0 -23
- package/src/composables/Toolbar/Format/useUnderline.ts +0 -23
- package/src/composables/Toolbar/FormatExtra/useBlockquote.ts +0 -23
- package/src/composables/Toolbar/FormatExtra/useCode.ts +0 -23
- package/src/composables/Toolbar/FormatExtra/useCodeBlock.ts +0 -23
- package/src/composables/Toolbar/FormatExtra/useSub.ts +0 -23
- package/src/composables/Toolbar/FormatExtra/useSup.ts +0 -23
- package/src/composables/Toolbar/List/useBullet.ts +0 -22
- package/src/composables/Toolbar/List/useIndent.ts +0 -23
- package/src/composables/Toolbar/List/useNumbered.ts +0 -22
- package/src/composables/Toolbar/List/useOutdent.ts +0 -23
- package/src/composables/Toolbar/List/useTask.ts +0 -22
- package/src/composables/Toolbar/Media/useEmoji.ts +0 -19
- package/src/composables/Toolbar/Media/useImage.ts +0 -23
- package/src/composables/Toolbar/Media/useLink.ts +0 -23
- package/src/composables/Toolbar/Media/useTable.ts +0 -187
- package/src/composables/Toolbar/Media/useVideo.ts +0 -22
- package/src/composables/Toolbar/Misc/useBreak.ts +0 -20
- package/src/composables/Toolbar/Misc/useFormatClear.ts +0 -22
- package/src/composables/Toolbar/Misc/useInvisibleCharacters.ts +0 -22
- package/src/composables/Toolbar/Misc/useLine.ts +0 -20
- package/src/composables/Toolbar/Misc/usePreview.ts +0 -19
- package/src/composables/Toolbar/Misc/useSource.ts +0 -20
- package/src/composables/Toolbar/Style/useColor.ts +0 -35
- package/src/composables/Toolbar/Style/useFontFamily.ts +0 -48
- package/src/composables/Toolbar/Style/useFontSize.ts +0 -49
- package/src/composables/Toolbar/Style/useHeading.ts +0 -63
- package/src/composables/Toolbar/Style/useHighlight.ts +0 -35
- package/src/composables/Toolbar/Style/useLineHeight.ts +0 -48
- package/src/composables/Toolbar/useActionsItems.ts +0 -9
- package/src/composables/Toolbar/useAlignmentItems.ts +0 -13
- package/src/composables/Toolbar/useFormatExtraItems.ts +0 -15
- package/src/composables/Toolbar/useFormatItems.ts +0 -13
- package/src/composables/Toolbar/useListItems.ts +0 -15
- package/src/composables/Toolbar/useMediaItems.ts +0 -15
- package/src/composables/Toolbar/useMiscItems.ts +0 -17
- package/src/composables/Toolbar/useStyleItems.ts +0 -17
- package/src/extensions/components/PreviewDialog.vue +0 -43
- package/src/types/extensionComponents.ts +0 -22
- package/src/types/toolbarItems.ts +0 -41
- /package/src/extensions/components/{ImageDialog.vue → media/image/ImageDialog.vue} +0 -0
- /package/src/extensions/{image.ts → components/media/image/index.ts} +0 -0
- /package/src/extensions/components/{LinkDialog.vue → media/link/LinkDialog.vue} +0 -0
- /package/src/extensions/{link.ts → components/media/link/index.ts} +0 -0
- /package/src/extensions/components/{TableBuilder.vue → media/table/TableBuilder.vue} +0 -0
- /package/src/extensions/components/{VideoDialog.vue → media/video/VideoDialog.vue} +0 -0
- /package/src/extensions/{preview.ts → components/misc/preview/index.ts} +0 -0
- /package/src/extensions/{view-source.ts → components/misc/source/index.ts} +0 -0
- /package/src/extensions/components/{FontFamily.vue → style/lineHeight/FontFamily.vue} +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
|
|
3
|
+
import * as mdi from '@mdi/js'
|
|
4
|
+
import { Editor } from "@tiptap/vue-3";
|
|
5
|
+
import BtnIcon from "@tiptapify/components/UI/BtnIcon.vue";
|
|
6
|
+
import TiptapifyDialog from "@tiptapify/components/UI/TiptapifyDialog.vue";
|
|
7
|
+
import { inject, ref, Ref } from "vue";
|
|
8
|
+
|
|
9
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
|
+
|
|
11
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
12
|
+
|
|
13
|
+
const dialog = ref(null)
|
|
14
|
+
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<VBtn @click="dialog.open()" size="32">
|
|
19
|
+
<VTooltip activator="parent">
|
|
20
|
+
{{ t('misc.preview') }}
|
|
21
|
+
</VTooltip>
|
|
22
|
+
<BtnIcon :icon="`mdiSvg:${mdi.mdiFileEyeOutline}`" />
|
|
23
|
+
</VBtn>
|
|
24
|
+
|
|
25
|
+
<TiptapifyDialog ref="dialog" module="preview" fullscreen>
|
|
26
|
+
<template #content>
|
|
27
|
+
<VCardItem>
|
|
28
|
+
<div class="tiptap" v-html="editor.getHTML()"></div>
|
|
29
|
+
</VCardItem>
|
|
30
|
+
</template>
|
|
31
|
+
</TiptapifyDialog>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<style lang="scss" scoped>
|
|
35
|
+
|
|
36
|
+
</style>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
|
|
3
|
+
import * as mdi from '@mdi/js'
|
|
4
|
+
import BtnIcon from "@tiptapify/components/UI/BtnIcon.vue";
|
|
5
|
+
import ShowSourceDialog from "@tiptapify/extensions/components/misc/source/ShowSourceDialog.vue";
|
|
6
|
+
import { inject, ref, Ref } from "vue";
|
|
7
|
+
|
|
8
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
9
|
+
|
|
10
|
+
const dialog = ref(null)
|
|
11
|
+
|
|
12
|
+
function showDialog() {
|
|
13
|
+
dialog.value.showDialog()
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<VBtn @click="showDialog()" size="32">
|
|
20
|
+
<VTooltip activator="parent">
|
|
21
|
+
{{ t('misc.source') }}
|
|
22
|
+
</VTooltip>
|
|
23
|
+
<BtnIcon :icon="`mdiSvg:${mdi.mdiCodeTags}`" />
|
|
24
|
+
</VBtn>
|
|
25
|
+
|
|
26
|
+
<ShowSourceDialog ref="dialog" />
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<style lang="scss" scoped>
|
|
30
|
+
|
|
31
|
+
</style>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { Editor } from "@tiptap/vue-3";
|
|
3
3
|
import TiptapifyDialog from "@tiptapify/components/UI/TiptapifyDialog.vue";
|
|
4
|
-
import { ref,
|
|
4
|
+
import { ref, watch, inject, Ref } from 'vue'
|
|
5
5
|
|
|
6
6
|
const props = defineProps({
|
|
7
7
|
indent: { type: Number, default: 2 },
|
|
@@ -9,6 +9,8 @@ const props = defineProps({
|
|
|
9
9
|
variantField: { type: String, default: 'solo' }
|
|
10
10
|
})
|
|
11
11
|
|
|
12
|
+
defineExpose({ showDialog })
|
|
13
|
+
|
|
12
14
|
const { t } = inject('tiptapifyI18n') as any
|
|
13
15
|
|
|
14
16
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
@@ -52,11 +54,8 @@ const unformatHtml = (html: string): string => {
|
|
|
52
54
|
.replace(/>\s+</g, '><')
|
|
53
55
|
}
|
|
54
56
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return
|
|
58
|
-
}
|
|
59
|
-
sourceCode.value = event.detail.html
|
|
57
|
+
function showDialog () {
|
|
58
|
+
sourceCode.value = editor.value.getHTML()
|
|
60
59
|
|
|
61
60
|
dialog.value.open()
|
|
62
61
|
}
|
|
@@ -67,14 +66,6 @@ const saveChanges = () => {
|
|
|
67
66
|
editor.value.commands.setContent(sourceCode.value, true)
|
|
68
67
|
}
|
|
69
68
|
|
|
70
|
-
onMounted(() => {
|
|
71
|
-
window.addEventListener('tiptapify-show-source', showDialog as EventListener)
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
onUnmounted(() => {
|
|
75
|
-
window.removeEventListener('tiptapify-show-source', showDialog as EventListener)
|
|
76
|
-
})
|
|
77
|
-
|
|
78
69
|
watch(() => formatted.value, () => {
|
|
79
70
|
sourceCode.value = formatted.value ? formatHtml(sourceCode.value) : unformatHtml(sourceCode.value)
|
|
80
71
|
})
|
|
@@ -9,14 +9,11 @@ const { t } = inject('tiptapifyI18n') as any
|
|
|
9
9
|
defineExpose({ open, close })
|
|
10
10
|
|
|
11
11
|
const props = defineProps({
|
|
12
|
-
show: { type: Boolean, default: true },
|
|
13
12
|
fontColor: { type: Boolean, default: false },
|
|
14
13
|
backgroundColor: { type: Boolean, default: false },
|
|
15
14
|
color: { type: String, default: '' },
|
|
16
15
|
})
|
|
17
16
|
|
|
18
|
-
const emit = defineEmits(['close'])
|
|
19
|
-
|
|
20
17
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
21
18
|
|
|
22
19
|
const colorPicker = ref(false)
|
|
@@ -119,14 +116,16 @@ function resetColor() {
|
|
|
119
116
|
}
|
|
120
117
|
|
|
121
118
|
if (props.backgroundColor) {
|
|
122
|
-
|
|
119
|
+
if (initialColor.value) {
|
|
120
|
+
editor.value.chain().focus().setHighlight({ color: initialColor.value }).run()
|
|
121
|
+
} else {
|
|
122
|
+
editor.value.chain().focus().unsetHighlight().run()
|
|
123
|
+
}
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
126
|
|
|
126
127
|
function setColor() {
|
|
127
128
|
colorSelected.value = true
|
|
128
|
-
|
|
129
|
-
emit('close')
|
|
130
129
|
}
|
|
131
130
|
|
|
132
131
|
function unsetColor() {
|
|
@@ -137,8 +136,6 @@ function unsetColor() {
|
|
|
137
136
|
if (props.backgroundColor) {
|
|
138
137
|
editor.value.chain().focus().unsetHighlight().run()
|
|
139
138
|
}
|
|
140
|
-
|
|
141
|
-
emit('close')
|
|
142
139
|
}
|
|
143
140
|
|
|
144
141
|
function isColorActive(color: string): boolean {
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
|
|
3
|
+
import * as mdi from '@mdi/js'
|
|
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 { computed, inject, Ref } from "vue";
|
|
8
|
+
import { useTheme } from "vuetify/framework";
|
|
9
|
+
|
|
10
|
+
defineProps({
|
|
11
|
+
customHeadingLevels: { type: Array<number>, default: () => [] }
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
15
|
+
|
|
16
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
17
|
+
|
|
18
|
+
const appTheme = useTheme()
|
|
19
|
+
|
|
20
|
+
const activeColor = computed(() => {
|
|
21
|
+
const defaultColor = appTheme.global.current.value.dark ? '#fff' : '#000'
|
|
22
|
+
return editor.value.getAttributes('textStyle').color || defaultColor
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
const selectedColor = computed(() => editor.value.getAttributes('textStyle').color || '')
|
|
26
|
+
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<VBtn
|
|
31
|
+
:id="`tiptapify-color-button-${editor.instanceId}`"
|
|
32
|
+
:disabled="!editor.can().chain().focus().toggleHighlight().run()"
|
|
33
|
+
@click="editor.chain().focus().redo().run()"
|
|
34
|
+
size="32"
|
|
35
|
+
>
|
|
36
|
+
<VTooltip activator="parent">
|
|
37
|
+
{{ t('style.color.text') }}
|
|
38
|
+
</VTooltip>
|
|
39
|
+
|
|
40
|
+
<BtnIcon :icon="`mdiSvg:${mdi.mdiFormatColorText}`" />
|
|
41
|
+
<VIcon
|
|
42
|
+
:icon="`mdiSvg:${mdi.mdiColorHelper}`"
|
|
43
|
+
:disabled="!editor.can().chain().focus().toggleHighlight().run()"
|
|
44
|
+
:color="activeColor"
|
|
45
|
+
size="small"
|
|
46
|
+
style="position: absolute; filter: drop-shadow(rgba(0, 0, 0, .75) 1px 1px 2px)"
|
|
47
|
+
/>
|
|
48
|
+
</VBtn>
|
|
49
|
+
|
|
50
|
+
<VMenu :activator="`#tiptapify-color-button-${editor.instanceId}`">
|
|
51
|
+
<StyleColor :font-color="true" :background-color="false" :color="selectedColor" />
|
|
52
|
+
</VMenu>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<style lang="scss" scoped>
|
|
56
|
+
|
|
57
|
+
</style>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
|
|
3
|
+
import * as mdi from '@mdi/js'
|
|
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 { computed, inject, Ref } from "vue";
|
|
9
|
+
|
|
10
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
11
|
+
|
|
12
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
13
|
+
|
|
14
|
+
const activeFontFamily = computed(() => {
|
|
15
|
+
let fontFamily = ''
|
|
16
|
+
for (const font in fonts) {
|
|
17
|
+
if (editor.value.isActive('textStyle', { fontFamily: fonts[font].fontFamily })) {
|
|
18
|
+
fontFamily = fonts[font].fontFamily
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return fontFamily
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
function getColor() {
|
|
27
|
+
let color = ''
|
|
28
|
+
for (const font in fonts) {
|
|
29
|
+
if (editor.value.isActive('textStyle', { fontFamily: fonts[font].fontFamily })) {
|
|
30
|
+
color = 'primary'
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return color
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<VBtn
|
|
42
|
+
:id="`tiptapify-font-family-button-${editor.instanceId}`"
|
|
43
|
+
:disabled="!editor.can().chain().focus().unsetFontFamily().run()"
|
|
44
|
+
:color="getColor()"
|
|
45
|
+
size="32"
|
|
46
|
+
>
|
|
47
|
+
<VTooltip activator="parent">
|
|
48
|
+
{{ t('style.fontFamily') }}
|
|
49
|
+
</VTooltip>
|
|
50
|
+
<BtnIcon :icon="`mdiSvg:${mdi.mdiFormatFont}`" />
|
|
51
|
+
</VBtn>
|
|
52
|
+
|
|
53
|
+
<VMenu :activator="`#tiptapify-font-family-button-${editor.instanceId}`">
|
|
54
|
+
<FontFamily :fonts="fonts" :font-family="activeFontFamily" />
|
|
55
|
+
</VMenu>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<style lang="scss" scoped>
|
|
59
|
+
|
|
60
|
+
</style>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
|
|
3
|
+
import { Editor } from "@tiptap/vue-3";
|
|
4
|
+
|
|
5
|
+
import { computed, inject, Ref, ref } from 'vue'
|
|
6
|
+
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
fonts: { type: Array<{ name: string, fontFamily: string }>, default: [] },
|
|
9
|
+
fontFamily: { type: String, default: '' },
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
13
|
+
|
|
14
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
15
|
+
|
|
16
|
+
const initialFontFamily = ref(computed(() => props.fontFamily).value)
|
|
17
|
+
|
|
18
|
+
const fontSelected = ref<boolean>(false)
|
|
19
|
+
|
|
20
|
+
function hoverFontFamily(font: string) {
|
|
21
|
+
fontSelected.value = false
|
|
22
|
+
|
|
23
|
+
editor.value.chain().focus().setFontFamily(font).run()
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function resetFontFamily() {
|
|
27
|
+
if (fontSelected.value) {
|
|
28
|
+
return
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
initialFontFamily.value
|
|
32
|
+
? editor.value.chain().focus().setFontFamily(initialFontFamily.value).run()
|
|
33
|
+
: editor.value.chain().focus().unsetFontFamily().run()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function clearFontFamily() {
|
|
37
|
+
editor.value.chain().focus().unsetFontFamily().run()
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function setFontFamily() {
|
|
41
|
+
fontSelected.value = true
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function isFontFamilyActive(fontFamily: string): boolean {
|
|
45
|
+
return editor.value.isActive('textStyle', { fontFamily }) || fontFamily === initialFontFamily.value
|
|
46
|
+
}
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<template>
|
|
50
|
+
<VList class="tiptapify-font-family-list">
|
|
51
|
+
<VListItem :disabled="fontFamily === ''" density="compact" @click="clearFontFamily">
|
|
52
|
+
<VListItemTitle class="font-italic text-grey-darken-1">
|
|
53
|
+
{{ t('defaultValue') }}
|
|
54
|
+
</VListItemTitle>
|
|
55
|
+
</VListItem>
|
|
56
|
+
<VListItem
|
|
57
|
+
v-for="font in fonts"
|
|
58
|
+
:active="isFontFamilyActive(font.fontFamily)"
|
|
59
|
+
:color="font.fontFamily === initialFontFamily ? 'primary' : ''"
|
|
60
|
+
density="compact"
|
|
61
|
+
@click="setFontFamily"
|
|
62
|
+
@mouseover="hoverFontFamily(font.fontFamily)"
|
|
63
|
+
@mouseleave="resetFontFamily"
|
|
64
|
+
>
|
|
65
|
+
<VListItemTitle>
|
|
66
|
+
{{ font.name }}
|
|
67
|
+
</VListItemTitle>
|
|
68
|
+
</VListItem>
|
|
69
|
+
</VList>
|
|
70
|
+
</template>
|
|
71
|
+
|
|
72
|
+
<style lang="scss" scoped>
|
|
73
|
+
.tiptapify-font-family-list {
|
|
74
|
+
max-height: 390px;
|
|
75
|
+
}
|
|
76
|
+
</style>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
|
|
3
|
+
import * as mdi from '@mdi/js'
|
|
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 { computed, inject, Ref } from "vue";
|
|
9
|
+
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
fontMeasure: { type: String, default () { return 'px' }}
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
15
|
+
|
|
16
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
17
|
+
|
|
18
|
+
const activeFontSize = computed(() => {
|
|
19
|
+
let fontSize = null
|
|
20
|
+
for (const size of fontSizes) {
|
|
21
|
+
if (editor.value.isActive('textStyle', { fontSize: `${size}${props.fontMeasure}` })) {
|
|
22
|
+
fontSize = size
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return fontSize
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
function getColor() {
|
|
31
|
+
let color = ''
|
|
32
|
+
for (const size of fontSizes) {
|
|
33
|
+
if (editor.value.isActive('textStyle', { fontSize: `${size}${props.fontMeasure}` })) {
|
|
34
|
+
color = 'primary'
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return color
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<template>
|
|
45
|
+
<VBtn
|
|
46
|
+
:id="`tiptapify-font-size-button-${editor.instanceId}`"
|
|
47
|
+
:disabled="!editor.can().chain().focus().unsetFontSize().run()"
|
|
48
|
+
:color="getColor()"
|
|
49
|
+
size="32"
|
|
50
|
+
>
|
|
51
|
+
<VTooltip activator="parent">
|
|
52
|
+
{{ t('style.fontSize') }}
|
|
53
|
+
</VTooltip>
|
|
54
|
+
<BtnIcon :icon="`mdiSvg:${mdi.mdiFormatSize}`" />
|
|
55
|
+
</VBtn>
|
|
56
|
+
|
|
57
|
+
<VMenu :activator="`#tiptapify-font-size-button-${editor.instanceId}`">
|
|
58
|
+
<FontSize :sizes="fontSizes" :measure="fontMeasure" :font-size="activeFontSize" />
|
|
59
|
+
</VMenu>
|
|
60
|
+
</template>
|
|
61
|
+
|
|
62
|
+
<style lang="scss" scoped>
|
|
63
|
+
|
|
64
|
+
</style>
|
|
@@ -12,8 +12,6 @@ const props = defineProps({
|
|
|
12
12
|
|
|
13
13
|
const { t } = inject('tiptapifyI18n') as any
|
|
14
14
|
|
|
15
|
-
const emit = defineEmits(['close'])
|
|
16
|
-
|
|
17
15
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
18
16
|
|
|
19
17
|
const initialFontSize = ref(computed(() => props.fontSize).value)
|
|
@@ -38,13 +36,10 @@ function resetFontSize() {
|
|
|
38
36
|
|
|
39
37
|
function clearFontSize() {
|
|
40
38
|
editor.value.chain().focus().unsetFontSize().run()
|
|
41
|
-
emit('close')
|
|
42
39
|
}
|
|
43
40
|
|
|
44
41
|
function setFontSize() {
|
|
45
42
|
fontSizeSelected.value = true
|
|
46
|
-
|
|
47
|
-
emit('close')
|
|
48
43
|
}
|
|
49
44
|
|
|
50
45
|
function isFontSizeActive(fontSize: number): boolean {
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
|
|
3
|
+
import * as mdi from '@mdi/js'
|
|
4
|
+
import { Editor } from "@tiptap/vue-3";
|
|
5
|
+
import BtnIcon from "@tiptapify/components/UI/BtnIcon.vue";
|
|
6
|
+
import { inject, Ref } from "vue";
|
|
7
|
+
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
customHeadingLevels: { type: Array<number>, default: () => [] }
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
interface MDIIcons {
|
|
13
|
+
[key: string]: string
|
|
14
|
+
}
|
|
15
|
+
const mdiIcons = mdi as MDIIcons
|
|
16
|
+
|
|
17
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
18
|
+
|
|
19
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
20
|
+
|
|
21
|
+
import { headingLevels, setHeadingLevels } from "@tiptapify/constants/style";
|
|
22
|
+
setHeadingLevels(props.customHeadingLevels)
|
|
23
|
+
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<VBtn
|
|
28
|
+
:id="`tiptapify-heading-button-${editor.instanceId}`"
|
|
29
|
+
:color="editor.isActive('heading') ? 'primary' : ''"
|
|
30
|
+
@click="editor.chain().focus().redo().run()"
|
|
31
|
+
size="32"
|
|
32
|
+
>
|
|
33
|
+
<VTooltip activator="parent">
|
|
34
|
+
{{ t('style.heading') }}
|
|
35
|
+
</VTooltip>
|
|
36
|
+
<BtnIcon :icon="`mdiSvg:${mdi.mdiFormatHeaderPound}`" />
|
|
37
|
+
</VBtn>
|
|
38
|
+
|
|
39
|
+
<VMenu :activator="`#tiptapify-heading-button-${editor.instanceId}`">
|
|
40
|
+
<VList density="compact">
|
|
41
|
+
<VListItem link :color="editor.isActive('paragraph') ? 'primary' : ''" @click="editor.chain().focus().setParagraph().run()">
|
|
42
|
+
<VListItemTitle class="d-flex justify-center align-center">
|
|
43
|
+
<BtnIcon :icon="`mdiSvg:${mdiIcons['mdiFormatParagraph']}`" />
|
|
44
|
+
</VListItemTitle>
|
|
45
|
+
</VListItem>
|
|
46
|
+
<VListItem
|
|
47
|
+
v-for="headingLevel in headingLevels" :key="headingLevel"
|
|
48
|
+
:color="editor.isActive('heading', {level: headingLevel}) ? 'primary' : ''"
|
|
49
|
+
@click="editor.chain().focus().toggleHeading({ level: headingLevel }).run()"
|
|
50
|
+
>
|
|
51
|
+
<VListItemTitle class="d-flex justify-center align-center">
|
|
52
|
+
<BtnIcon :icon="`mdiSvg:${mdiIcons[`mdiFormatHeader${headingLevel}`]}`" />
|
|
53
|
+
</VListItemTitle>
|
|
54
|
+
</VListItem>
|
|
55
|
+
</VList>
|
|
56
|
+
</VMenu>
|
|
57
|
+
</template>
|
|
58
|
+
|
|
59
|
+
<style lang="scss" scoped>
|
|
60
|
+
|
|
61
|
+
</style>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
|
|
3
|
+
import * as mdi from '@mdi/js'
|
|
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 { computed, inject, Ref } from "vue";
|
|
8
|
+
import { useTheme } from "vuetify/framework";
|
|
9
|
+
|
|
10
|
+
defineProps({
|
|
11
|
+
customHeadingLevels: { type: Array<number>, default: () => [] }
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
15
|
+
|
|
16
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
17
|
+
|
|
18
|
+
const appTheme = useTheme()
|
|
19
|
+
|
|
20
|
+
const activeColor = computed(() => {
|
|
21
|
+
const defaultColor = appTheme.global.current.value.dark ? '#fff' : '#000'
|
|
22
|
+
return editor.value.getAttributes('highlight').color || defaultColor
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
const selectedColor = computed(() => editor.value.getAttributes('highlight').color || '')
|
|
26
|
+
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<VBtn
|
|
31
|
+
:id="`tiptapify-highlight-button-${editor.instanceId}`"
|
|
32
|
+
:disabled="!editor.can().chain().focus().toggleHighlight().run()"
|
|
33
|
+
@click="editor.chain().focus().redo().run()"
|
|
34
|
+
size="32"
|
|
35
|
+
>
|
|
36
|
+
<VTooltip activator="parent">
|
|
37
|
+
{{ t('style.color.highlight') }}
|
|
38
|
+
</VTooltip>
|
|
39
|
+
|
|
40
|
+
<BtnIcon :icon="`mdiSvg:${mdi.mdiFormatColorFill}`" />
|
|
41
|
+
<VIcon
|
|
42
|
+
:icon="`mdiSvg:${mdi.mdiColorHelper}`"
|
|
43
|
+
:disabled="!editor.can().chain().focus().toggleHighlight().run()"
|
|
44
|
+
:color="activeColor"
|
|
45
|
+
size="small"
|
|
46
|
+
style="position: absolute; filter: drop-shadow(rgba(0, 0, 0, .75) 1px 1px 2px)"
|
|
47
|
+
/>
|
|
48
|
+
</VBtn>
|
|
49
|
+
|
|
50
|
+
<VMenu :activator="`#tiptapify-highlight-button-${editor.instanceId}`">
|
|
51
|
+
<StyleColor :font-color="false" :background-color="true" :color="selectedColor" />
|
|
52
|
+
</VMenu>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<style lang="scss" scoped>
|
|
56
|
+
|
|
57
|
+
</style>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
|
|
3
|
+
import * as mdi from '@mdi/js'
|
|
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 { computed, inject, Ref } from "vue";
|
|
9
|
+
|
|
10
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
11
|
+
|
|
12
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
13
|
+
|
|
14
|
+
const activeLineHeight = computed(() => {
|
|
15
|
+
let lineHeight = null
|
|
16
|
+
for (const height of lineHeights) {
|
|
17
|
+
if (editor.value.isActive('textStyle', { lineHeight: height.toString() })) {
|
|
18
|
+
lineHeight = height
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return lineHeight
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
function getColor() {
|
|
27
|
+
let color = ''
|
|
28
|
+
for (const height of lineHeights) {
|
|
29
|
+
if (editor.value.isActive('textStyle', { lineHeight: height.toString() })) {
|
|
30
|
+
color = 'primary'
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return color
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<VBtn
|
|
42
|
+
:id="`tiptapify-line-height-button-${editor.instanceId}`"
|
|
43
|
+
:disabled="!editor.can().chain().focus().unsetLineHeight().run()"
|
|
44
|
+
:color="getColor()"
|
|
45
|
+
size="32"
|
|
46
|
+
>
|
|
47
|
+
<VTooltip activator="parent">
|
|
48
|
+
{{ t('style.lineHeight') }}
|
|
49
|
+
</VTooltip>
|
|
50
|
+
<BtnIcon :icon="`mdiSvg:${mdi.mdiFormatLineHeight}`" />
|
|
51
|
+
</VBtn>
|
|
52
|
+
|
|
53
|
+
<VMenu :activator="`#tiptapify-line-height-button-${editor.instanceId}`">
|
|
54
|
+
<LineHeight :line-heights="lineHeights" :line-height="activeLineHeight" />
|
|
55
|
+
</VMenu>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<style lang="scss" scoped>
|
|
59
|
+
|
|
60
|
+
</style>
|
|
@@ -11,8 +11,6 @@ const props = defineProps({
|
|
|
11
11
|
|
|
12
12
|
const { t } = inject('tiptapifyI18n') as any
|
|
13
13
|
|
|
14
|
-
const emit = defineEmits(['close'])
|
|
15
|
-
|
|
16
14
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
17
15
|
|
|
18
16
|
const initialLineHeight = ref(computed(() => props.lineHeight).value)
|
|
@@ -37,13 +35,11 @@ function resetLineHeight() {
|
|
|
37
35
|
|
|
38
36
|
function clearLineHeight() {
|
|
39
37
|
editor.value.chain().focus().unsetLineHeight().run()
|
|
40
|
-
emit('close')
|
|
41
38
|
}
|
|
42
39
|
|
|
43
40
|
function setLineHeight() {
|
|
44
41
|
lineHeightSelected.value = true
|
|
45
42
|
|
|
46
|
-
emit('close')
|
|
47
43
|
}
|
|
48
44
|
|
|
49
45
|
function isLineHeightActive(lineHeight: number): boolean {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export enum
|
|
1
|
+
export enum ToolbarSectionsEnum {
|
|
2
2
|
actions = 'actions',
|
|
3
3
|
alignment = 'alignment',
|
|
4
4
|
extra = 'extra',
|
|
@@ -8,4 +8,18 @@ export enum ToolbarSections {
|
|
|
8
8
|
media = 'media',
|
|
9
9
|
misc = 'misc',
|
|
10
10
|
style = 'style',
|
|
11
|
-
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type sectionComponent = {
|
|
14
|
+
name: string,
|
|
15
|
+
component: any,
|
|
16
|
+
extensions?: Array<any>,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type section = {
|
|
20
|
+
section: string,
|
|
21
|
+
group: boolean,
|
|
22
|
+
components: sectionComponent[],
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type toolbarSections = Array<section>
|