tiptapify 0.0.23 → 0.0.26
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 +40 -3
- package/dist/tiptapify.css +1 -1
- package/dist/tiptapify.mjs +22762 -22314
- package/dist/tiptapify.umd.js +53 -38
- package/index.d.ts +2 -2
- package/package.json +45 -47
- package/src/components/Tiptapify.vue +52 -27
- package/src/components/Toolbar/Index.vue +127 -9
- package/src/components/Toolbar/Items.vue +11 -5
- package/src/components/Toolbar/items.ts +14 -2
- package/src/components/Toolbar/misc.ts +5 -0
- package/src/components/Toolbar/style.ts +1 -1
- package/src/components/UI/BtnIcon.vue +3 -3
- package/src/components/UI/TiptapifyDialog.vue +5 -1
- package/src/components/editorExtensions.ts +4 -5
- package/src/components/index.ts +3 -4
- package/src/constants/defaults.ts +4 -0
- package/src/extensions/components/actions/redo/Button.vue +7 -0
- package/src/extensions/components/actions/undo/Button.vue +7 -0
- package/src/extensions/components/alignment/center/Button.vue +7 -0
- package/src/extensions/components/alignment/justify/Button.vue +7 -0
- package/src/extensions/components/alignment/left/Button.vue +7 -0
- package/src/extensions/components/alignment/right/Button.vue +7 -0
- package/src/extensions/components/format/bold/Button.vue +7 -0
- package/src/extensions/components/format/italic/Button.vue +7 -0
- package/src/extensions/components/format/strike/Button.vue +7 -0
- package/src/extensions/components/format/underline/Button.vue +7 -0
- package/src/extensions/components/formatExtra/code/Button.vue +7 -0
- package/src/extensions/components/formatExtra/codeBlock/Button.vue +7 -0
- package/src/extensions/components/formatExtra/quote/Button.vue +7 -0
- package/src/extensions/components/formatExtra/sub/Button.vue +7 -0
- package/src/extensions/components/formatExtra/sup/Button.vue +7 -0
- package/src/extensions/components/list/bullet/Button.vue +103 -1
- package/src/extensions/components/list/bullet/index.ts +101 -0
- package/src/extensions/components/list/indent/Button.vue +7 -0
- package/src/extensions/components/list/numbered/Button.vue +7 -0
- package/src/extensions/components/list/outdent/Button.vue +7 -0
- package/src/extensions/components/list/task/Button.vue +7 -0
- package/src/extensions/components/media/emoji/Button.vue +8 -2
- package/src/extensions/components/media/image/Button.vue +7 -0
- package/src/extensions/components/media/image/ImageDialog.vue +3 -2
- package/src/extensions/components/media/link/Button.vue +7 -0
- package/src/extensions/components/media/link/LinkDialog.vue +2 -1
- package/src/extensions/components/media/table/Button.vue +7 -0
- package/src/extensions/components/media/video/Button.vue +7 -0
- package/src/extensions/components/media/video/VideoDialog.vue +3 -2
- package/src/extensions/components/misc/break/Button.vue +7 -1
- package/src/extensions/components/misc/formatClear/Button.vue +7 -0
- package/src/extensions/components/misc/fullscreen/Button.vue +61 -0
- package/src/extensions/components/misc/invisibleChar/Button.vue +7 -0
- package/src/extensions/components/misc/line/Button.vue +7 -1
- package/src/extensions/components/misc/preview/Button.vue +7 -1
- package/src/extensions/components/misc/source/Button.vue +8 -2
- package/src/extensions/components/misc/source/ShowSourceDialog.vue +2 -1
- package/src/extensions/components/style/StyleColor.vue +4 -2
- package/src/extensions/components/style/color/Button.vue +4 -1
- package/src/extensions/components/style/fontFamily/Button.vue +7 -0
- package/src/extensions/components/style/fontSize/Button.vue +5 -1
- package/src/extensions/components/style/heading/Button.vue +14 -6
- package/src/extensions/components/style/highlight/Button.vue +4 -1
- package/src/extensions/components/style/lineHeight/Button.vue +7 -0
- package/src/types/{toolbarSections.ts → toolbarTypes.ts} +4 -1
- package/src/extensions/components/misc/preview/index.ts +0 -41
- package/src/extensions/components/misc/source/index.ts +0 -49
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import { Editor } from "@tiptap/vue-3";
|
|
4
4
|
import TiptapifyDialog from "@tiptapify/components/UI/TiptapifyDialog.vue";
|
|
5
|
+
import defaults from "@tiptapify/constants/defaults";
|
|
5
6
|
|
|
6
7
|
import { computed, inject, onMounted, onUnmounted, Ref, ref } from 'vue'
|
|
7
8
|
|
|
8
9
|
defineProps({
|
|
9
|
-
variantBtn: { type: String, default() { return
|
|
10
|
-
variantField: { type: String, default() { return
|
|
10
|
+
variantBtn: { type: String, default() { return defaults.variantBtn }},
|
|
11
|
+
variantField: { type: String, default() { return defaults.variantField }}
|
|
11
12
|
})
|
|
12
13
|
|
|
13
14
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
@@ -6,6 +6,12 @@ import BtnIcon from "@tiptapify/components/UI/BtnIcon.vue";
|
|
|
6
6
|
import LinkDialog from "@tiptapify/extensions/components/media/link/LinkDialog.vue";
|
|
7
7
|
import { computed, inject, Ref } from "vue";
|
|
8
8
|
|
|
9
|
+
import defaults from '@tiptapify/constants/defaults'
|
|
10
|
+
|
|
11
|
+
defineProps({
|
|
12
|
+
variantBtn: { type: String, default: defaults.variantBtn }
|
|
13
|
+
})
|
|
14
|
+
|
|
9
15
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
16
|
|
|
11
17
|
const { t } = inject('tiptapifyI18n') as any
|
|
@@ -17,6 +23,7 @@ const icon = computed(() => editor.value.isActive('tiptapifyLink') ? `mdiSvg:${m
|
|
|
17
23
|
<template>
|
|
18
24
|
<VBtn
|
|
19
25
|
:color="editor.isActive('link') ? 'primary' : ''"
|
|
26
|
+
:variant="variantBtn"
|
|
20
27
|
@click="editor.commands.showLink()"
|
|
21
28
|
size="32"
|
|
22
29
|
>
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
|
|
3
3
|
import { Editor } from "@tiptap/vue-3";
|
|
4
|
+
import defaults from "@tiptapify/constants/defaults";
|
|
4
5
|
|
|
5
6
|
import { computed, inject, onMounted, onUnmounted, Ref, ref, watch } from 'vue'
|
|
6
7
|
|
|
7
8
|
import TiptapifyDialog from "@tiptapify/components/UI/TiptapifyDialog.vue"
|
|
8
9
|
|
|
9
10
|
defineProps({
|
|
10
|
-
variantBtn: { type: String, default() { return
|
|
11
|
+
variantBtn: { type: String, default() { return defaults.variantBtn }},
|
|
11
12
|
variantField: { type: String, default() { return 'outlined' }}
|
|
12
13
|
})
|
|
13
14
|
|
|
@@ -8,6 +8,12 @@ import RowActions from "@tiptapify/extensions/components/media/table/RowActions.
|
|
|
8
8
|
import TableBuilder from "@tiptapify/extensions/components/media/table/TableBuilder.vue";
|
|
9
9
|
import { inject, Ref } from "vue";
|
|
10
10
|
|
|
11
|
+
import defaults from '@tiptapify/constants/defaults'
|
|
12
|
+
|
|
13
|
+
defineProps({
|
|
14
|
+
variantBtn: { type: String, default: defaults.variantBtn }
|
|
15
|
+
})
|
|
16
|
+
|
|
11
17
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
12
18
|
|
|
13
19
|
const { t } = inject('tiptapifyI18n') as any
|
|
@@ -31,6 +37,7 @@ const columnActionsDisabled = () => {
|
|
|
31
37
|
:id="`tiptapify-table-button-${editor.instanceId}`"
|
|
32
38
|
:color="editor.isActive('table') ? 'primary' : ''"
|
|
33
39
|
:disabled="!editor.can().chain().focus().insertTable().run()"
|
|
40
|
+
:variant="variantBtn"
|
|
34
41
|
size="32"
|
|
35
42
|
>
|
|
36
43
|
<BtnIcon :icon="`mdiSvg:${mdi.mdiTable}`" />
|
|
@@ -5,6 +5,12 @@ import BtnIcon from "@tiptapify/components/UI/BtnIcon.vue";
|
|
|
5
5
|
import VideoDialog from "@tiptapify/extensions/components/media/video/VideoDialog.vue";
|
|
6
6
|
import { inject, Ref } from "vue";
|
|
7
7
|
|
|
8
|
+
import defaults from '@tiptapify/constants/defaults'
|
|
9
|
+
|
|
10
|
+
defineProps({
|
|
11
|
+
variantBtn: { type: String, default: defaults.variantBtn }
|
|
12
|
+
})
|
|
13
|
+
|
|
8
14
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
9
15
|
|
|
10
16
|
const { t } = inject('tiptapifyI18n') as any
|
|
@@ -15,6 +21,7 @@ const icon = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" vie
|
|
|
15
21
|
<template>
|
|
16
22
|
<VBtn
|
|
17
23
|
:color="editor.isActive('video') ? 'primary' : ''"
|
|
24
|
+
:variant="variantBtn"
|
|
18
25
|
@click="editor.commands.showTiptapifyVideo()"
|
|
19
26
|
size="32"
|
|
20
27
|
>
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import { Editor } from "@tiptap/vue-3";
|
|
4
4
|
import TiptapifyDialog from "@tiptapify/components/UI/TiptapifyDialog.vue";
|
|
5
|
+
import defaults from "@tiptapify/constants/defaults";
|
|
5
6
|
|
|
6
7
|
import { computed, inject, onMounted, onUnmounted, Ref, ref } from 'vue'
|
|
7
8
|
|
|
8
9
|
defineProps({
|
|
9
|
-
variantBtn: { type: String, default() { return
|
|
10
|
-
variantField: { type: String, default() { return
|
|
10
|
+
variantBtn: { type: String, default() { return defaults.variantBtn }},
|
|
11
|
+
variantField: { type: String, default() { return defaults.variantField }}
|
|
11
12
|
})
|
|
12
13
|
|
|
13
14
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
@@ -5,6 +5,12 @@ import { Editor } from "@tiptap/vue-3";
|
|
|
5
5
|
import BtnIcon from "@tiptapify/components/UI/BtnIcon.vue";
|
|
6
6
|
import { inject, Ref } from "vue";
|
|
7
7
|
|
|
8
|
+
import defaults from '@tiptapify/constants/defaults'
|
|
9
|
+
|
|
10
|
+
defineProps({
|
|
11
|
+
variantBtn: { type: String, default: defaults.variantBtn }
|
|
12
|
+
})
|
|
13
|
+
|
|
8
14
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
9
15
|
|
|
10
16
|
const { t } = inject('tiptapifyI18n') as any
|
|
@@ -12,7 +18,7 @@ const { t } = inject('tiptapifyI18n') as any
|
|
|
12
18
|
</script>
|
|
13
19
|
|
|
14
20
|
<template>
|
|
15
|
-
<VBtn @click="editor.chain().focus().setHardBreak().run()" size="32">
|
|
21
|
+
<VBtn @click="editor.chain().focus().setHardBreak().run()" size="32" :variant="variantBtn">
|
|
16
22
|
<VTooltip activator="parent">
|
|
17
23
|
{{ t('format.break') }}
|
|
18
24
|
</VTooltip>
|
|
@@ -5,6 +5,12 @@ import { Editor } from "@tiptap/vue-3";
|
|
|
5
5
|
import BtnIcon from "@tiptapify/components/UI/BtnIcon.vue";
|
|
6
6
|
import { inject, Ref } from "vue";
|
|
7
7
|
|
|
8
|
+
import defaults from '@tiptapify/constants/defaults'
|
|
9
|
+
|
|
10
|
+
defineProps({
|
|
11
|
+
variantBtn: { type: String, default: defaults.variantBtn }
|
|
12
|
+
})
|
|
13
|
+
|
|
8
14
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
9
15
|
|
|
10
16
|
const { t } = inject('tiptapifyI18n') as any
|
|
@@ -14,6 +20,7 @@ const { t } = inject('tiptapifyI18n') as any
|
|
|
14
20
|
<template>
|
|
15
21
|
<VBtn
|
|
16
22
|
:disabled="!editor.can().chain().focus().unsetAllMarks().run()"
|
|
23
|
+
:variant="variantBtn"
|
|
17
24
|
@click="editor.chain().focus().unsetAllMarks().clearNodes().run()"
|
|
18
25
|
size="32"
|
|
19
26
|
>
|
|
@@ -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, nextTick, ref, Ref } from "vue";
|
|
7
|
+
|
|
8
|
+
import defaults from '@tiptapify/constants/defaults'
|
|
9
|
+
|
|
10
|
+
defineProps({
|
|
11
|
+
variantBtn: { type: String, default: defaults.variantBtn }
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
15
|
+
|
|
16
|
+
const { t } = inject('tiptapifyI18n') as any
|
|
17
|
+
|
|
18
|
+
const dialog = ref(false)
|
|
19
|
+
|
|
20
|
+
async function dialogOpen() {
|
|
21
|
+
dialog.value = true
|
|
22
|
+
|
|
23
|
+
await changeEditorContainer('tiptapify-editor', 'tiptapify-editor-fullscreen')
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async function dialogClose() {
|
|
27
|
+
dialog.value = false
|
|
28
|
+
|
|
29
|
+
await changeEditorContainer('tiptapify-editor-fullscreen', 'tiptapify-editor')
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async function changeEditorContainer(source: string, target: string) {
|
|
33
|
+
await nextTick()
|
|
34
|
+
|
|
35
|
+
const sourceElm = document.querySelector(`#${source}-${editor.value.instanceId} > div`);
|
|
36
|
+
|
|
37
|
+
const targetElm = document.querySelector(`#${target}-${editor.value.instanceId}`);
|
|
38
|
+
|
|
39
|
+
targetElm.appendChild(sourceElm);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<template>
|
|
45
|
+
<VBtn @click="dialog ? dialogClose() : dialogOpen()" size="32" :variant="variantBtn">
|
|
46
|
+
<VTooltip activator="parent">
|
|
47
|
+
{{ t('misc.preview') }}
|
|
48
|
+
</VTooltip>
|
|
49
|
+
<BtnIcon :icon="dialog ? `mdiSvg:${mdi.mdiFullscreenExit}` : `mdiSvg:${mdi.mdiFullscreen}`" />
|
|
50
|
+
</VBtn>
|
|
51
|
+
|
|
52
|
+
<VDialog v-model="dialog" fullscreen @close="dialogClose()" @update:modelValue="!dialog ? dialogClose() : ''">
|
|
53
|
+
<VCard>
|
|
54
|
+
<div :id="`tiptapify-editor-fullscreen-${editor?.instanceId}`"></div>
|
|
55
|
+
</VCard>
|
|
56
|
+
</VDialog>
|
|
57
|
+
</template>
|
|
58
|
+
|
|
59
|
+
<style lang="scss" scoped>
|
|
60
|
+
|
|
61
|
+
</style>
|
|
@@ -4,6 +4,12 @@ import { Editor } from "@tiptap/vue-3";
|
|
|
4
4
|
import BtnIcon from "@tiptapify/components/UI/BtnIcon.vue";
|
|
5
5
|
import { inject, Ref } from "vue";
|
|
6
6
|
|
|
7
|
+
import defaults from '@tiptapify/constants/defaults'
|
|
8
|
+
|
|
9
|
+
defineProps({
|
|
10
|
+
variantBtn: { type: String, default: defaults.variantBtn }
|
|
11
|
+
})
|
|
12
|
+
|
|
7
13
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
8
14
|
|
|
9
15
|
const { t } = inject('tiptapifyI18n') as any
|
|
@@ -15,6 +21,7 @@ const icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><pat
|
|
|
15
21
|
<template>
|
|
16
22
|
<VBtn
|
|
17
23
|
:color="editor.storage.invisibleCharacters.visibility() ? 'primary' : ''"
|
|
24
|
+
:variant="variantBtn"
|
|
18
25
|
@click="editor.commands.toggleInvisibleCharacters()"
|
|
19
26
|
size="32"
|
|
20
27
|
>
|
|
@@ -5,6 +5,12 @@ import { Editor } from "@tiptap/vue-3";
|
|
|
5
5
|
import BtnIcon from "@tiptapify/components/UI/BtnIcon.vue";
|
|
6
6
|
import { inject, Ref } from "vue";
|
|
7
7
|
|
|
8
|
+
import defaults from '@tiptapify/constants/defaults'
|
|
9
|
+
|
|
10
|
+
defineProps({
|
|
11
|
+
variantBtn: { type: String, default: defaults.variantBtn }
|
|
12
|
+
})
|
|
13
|
+
|
|
8
14
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
9
15
|
|
|
10
16
|
const { t } = inject('tiptapifyI18n') as any
|
|
@@ -12,7 +18,7 @@ const { t } = inject('tiptapifyI18n') as any
|
|
|
12
18
|
</script>
|
|
13
19
|
|
|
14
20
|
<template>
|
|
15
|
-
<VBtn @click="editor.chain().focus().setHorizontalRule().run()" size="32">
|
|
21
|
+
<VBtn @click="editor.chain().focus().setHorizontalRule().run()" size="32" :variant="variantBtn">
|
|
16
22
|
<VTooltip activator="parent">
|
|
17
23
|
{{ t('format.line') }}
|
|
18
24
|
</VTooltip>
|
|
@@ -6,6 +6,12 @@ import BtnIcon from "@tiptapify/components/UI/BtnIcon.vue";
|
|
|
6
6
|
import TiptapifyDialog from "@tiptapify/components/UI/TiptapifyDialog.vue";
|
|
7
7
|
import { inject, ref, Ref } from "vue";
|
|
8
8
|
|
|
9
|
+
import defaults from '@tiptapify/constants/defaults'
|
|
10
|
+
|
|
11
|
+
defineProps({
|
|
12
|
+
variantBtn: { type: String, default: defaults.variantBtn }
|
|
13
|
+
})
|
|
14
|
+
|
|
9
15
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
10
16
|
|
|
11
17
|
const { t } = inject('tiptapifyI18n') as any
|
|
@@ -15,7 +21,7 @@ const dialog = ref(null)
|
|
|
15
21
|
</script>
|
|
16
22
|
|
|
17
23
|
<template>
|
|
18
|
-
<VBtn @click="dialog.open()" size="32">
|
|
24
|
+
<VBtn @click="dialog.open()" size="32" :variant="variantBtn">
|
|
19
25
|
<VTooltip activator="parent">
|
|
20
26
|
{{ t('misc.preview') }}
|
|
21
27
|
</VTooltip>
|
|
@@ -3,7 +3,13 @@
|
|
|
3
3
|
import * as mdi from '@mdi/js'
|
|
4
4
|
import BtnIcon from "@tiptapify/components/UI/BtnIcon.vue";
|
|
5
5
|
import ShowSourceDialog from "@tiptapify/extensions/components/misc/source/ShowSourceDialog.vue";
|
|
6
|
-
import { inject, ref
|
|
6
|
+
import { inject, ref } from "vue";
|
|
7
|
+
|
|
8
|
+
import defaults from '@tiptapify/constants/defaults'
|
|
9
|
+
|
|
10
|
+
defineProps({
|
|
11
|
+
variantBtn: { type: String, default: defaults.variantBtn }
|
|
12
|
+
})
|
|
7
13
|
|
|
8
14
|
const { t } = inject('tiptapifyI18n') as any
|
|
9
15
|
|
|
@@ -16,7 +22,7 @@ function showDialog() {
|
|
|
16
22
|
</script>
|
|
17
23
|
|
|
18
24
|
<template>
|
|
19
|
-
<VBtn @click="showDialog()" size="32">
|
|
25
|
+
<VBtn @click="showDialog()" size="32" :variant="variantBtn">
|
|
20
26
|
<VTooltip activator="parent">
|
|
21
27
|
{{ t('misc.source') }}
|
|
22
28
|
</VTooltip>
|
|
@@ -1,12 +1,13 @@
|
|
|
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 defaults from "@tiptapify/constants/defaults";
|
|
4
5
|
import { ref, watch, inject, Ref } from 'vue'
|
|
5
6
|
|
|
6
7
|
const props = defineProps({
|
|
7
8
|
indent: { type: Number, default: 2 },
|
|
8
9
|
variantBtn: { type: String, default: 'elevated' },
|
|
9
|
-
variantField: { type: String, default:
|
|
10
|
+
variantField: { type: String, default: defaults.variantField }
|
|
10
11
|
})
|
|
11
12
|
|
|
12
13
|
defineExpose({ showDialog })
|
|
@@ -93,11 +93,13 @@ function hexToRgb(hex: string): Color {
|
|
|
93
93
|
function hoverColor(color: string) {
|
|
94
94
|
colorSelected.value = false
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
const interactiveStyles = editor.value.interactiveStyles
|
|
97
|
+
|
|
98
|
+
if (props.fontColor && interactiveStyles) {
|
|
97
99
|
editor.value.chain().focus().setColor(color).run()
|
|
98
100
|
}
|
|
99
101
|
|
|
100
|
-
if (props.backgroundColor) {
|
|
102
|
+
if (props.backgroundColor && interactiveStyles) {
|
|
101
103
|
editor.value.chain().focus().setHighlight({ color: color }).run()
|
|
102
104
|
}
|
|
103
105
|
}
|
|
@@ -7,8 +7,10 @@ import StyleColor from "@tiptapify/extensions/components/style/StyleColor.vue";
|
|
|
7
7
|
import { computed, inject, Ref } from "vue";
|
|
8
8
|
import { useTheme } from "vuetify/framework";
|
|
9
9
|
|
|
10
|
+
import defaults from '@tiptapify/constants/defaults'
|
|
11
|
+
|
|
10
12
|
defineProps({
|
|
11
|
-
|
|
13
|
+
variantBtn: { type: String, default: defaults.variantBtn }
|
|
12
14
|
})
|
|
13
15
|
|
|
14
16
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
@@ -30,6 +32,7 @@ const selectedColor = computed(() => editor.value.getAttributes('textStyle').col
|
|
|
30
32
|
<VBtn
|
|
31
33
|
:id="`tiptapify-color-button-${editor.instanceId}`"
|
|
32
34
|
:disabled="!editor.can().chain().focus().toggleHighlight().run()"
|
|
35
|
+
:variant="variantBtn"
|
|
33
36
|
@click="editor.chain().focus().redo().run()"
|
|
34
37
|
size="32"
|
|
35
38
|
>
|
|
@@ -7,6 +7,12 @@ import FontFamily from "@tiptapify/extensions/components/style/fontFamily/FontFa
|
|
|
7
7
|
import { fonts } from "@tiptapify/constants/style";
|
|
8
8
|
import { computed, inject, Ref } from "vue";
|
|
9
9
|
|
|
10
|
+
import defaults from '@tiptapify/constants/defaults'
|
|
11
|
+
|
|
12
|
+
defineProps({
|
|
13
|
+
variantBtn: { type: String, default: defaults.variantBtn }
|
|
14
|
+
})
|
|
15
|
+
|
|
10
16
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
11
17
|
|
|
12
18
|
const { t } = inject('tiptapifyI18n') as any
|
|
@@ -42,6 +48,7 @@ function getColor() {
|
|
|
42
48
|
:id="`tiptapify-font-family-button-${editor.instanceId}`"
|
|
43
49
|
:disabled="!editor.can().chain().focus().unsetFontFamily().run()"
|
|
44
50
|
:color="getColor()"
|
|
51
|
+
:variant="variantBtn"
|
|
45
52
|
size="32"
|
|
46
53
|
>
|
|
47
54
|
<VTooltip activator="parent">
|
|
@@ -7,8 +7,11 @@ import FontSize from "@tiptapify/extensions/components/style/fontSize/FontSize.v
|
|
|
7
7
|
import { fontSizes } from "@tiptapify/constants/style";
|
|
8
8
|
import { computed, inject, Ref } from "vue";
|
|
9
9
|
|
|
10
|
+
import defaults from '@tiptapify/constants/defaults'
|
|
11
|
+
|
|
10
12
|
const props = defineProps({
|
|
11
|
-
fontMeasure: { type: String, default () { return 'px' }}
|
|
13
|
+
fontMeasure: { type: String, default () { return 'px' }},
|
|
14
|
+
variantBtn: { type: String, default: defaults.variantBtn }
|
|
12
15
|
})
|
|
13
16
|
|
|
14
17
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
@@ -46,6 +49,7 @@ function getColor() {
|
|
|
46
49
|
:id="`tiptapify-font-size-button-${editor.instanceId}`"
|
|
47
50
|
:disabled="!editor.can().chain().focus().unsetFontSize().run()"
|
|
48
51
|
:color="getColor()"
|
|
52
|
+
:variant="variantBtn"
|
|
49
53
|
size="32"
|
|
50
54
|
>
|
|
51
55
|
<VTooltip activator="parent">
|
|
@@ -5,13 +5,15 @@ import { Editor } from "@tiptap/vue-3";
|
|
|
5
5
|
import BtnIcon from "@tiptapify/components/UI/BtnIcon.vue";
|
|
6
6
|
import { inject, Ref } from "vue";
|
|
7
7
|
|
|
8
|
+
import defaults from '@tiptapify/constants/defaults'
|
|
9
|
+
|
|
8
10
|
const props = defineProps({
|
|
9
|
-
customHeadingLevels: { type: Array<number>, default: () => [] }
|
|
11
|
+
customHeadingLevels: { type: Array<number>, default: () => [] },
|
|
12
|
+
withParagraph: { type: Boolean, default: () => true },
|
|
13
|
+
variantBtn: { type: String, default: defaults.variantBtn }
|
|
10
14
|
})
|
|
11
15
|
|
|
12
|
-
interface MDIIcons {
|
|
13
|
-
[key: string]: string
|
|
14
|
-
}
|
|
16
|
+
interface MDIIcons { [key: string]: string }
|
|
15
17
|
const mdiIcons = mdi as MDIIcons
|
|
16
18
|
|
|
17
19
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
@@ -27,6 +29,7 @@ setHeadingLevels(props.customHeadingLevels)
|
|
|
27
29
|
<VBtn
|
|
28
30
|
:id="`tiptapify-heading-button-${editor.instanceId}`"
|
|
29
31
|
:color="editor.isActive('heading') ? 'primary' : ''"
|
|
32
|
+
:variant="variantBtn"
|
|
30
33
|
@click="editor.chain().focus().redo().run()"
|
|
31
34
|
size="32"
|
|
32
35
|
>
|
|
@@ -38,14 +41,19 @@ setHeadingLevels(props.customHeadingLevels)
|
|
|
38
41
|
|
|
39
42
|
<VMenu :activator="`#tiptapify-heading-button-${editor.instanceId}`">
|
|
40
43
|
<VList density="compact">
|
|
41
|
-
<VListItem
|
|
44
|
+
<VListItem
|
|
45
|
+
v-if="withParagraph"
|
|
46
|
+
link
|
|
47
|
+
:color="editor.isActive('paragraph') ? 'primary' : ''"
|
|
48
|
+
@click="editor.chain().focus().setParagraph().run()"
|
|
49
|
+
>
|
|
42
50
|
<VListItemTitle class="d-flex justify-center align-center">
|
|
43
51
|
<BtnIcon :icon="`mdiSvg:${mdiIcons['mdiFormatParagraph']}`" />
|
|
44
52
|
</VListItemTitle>
|
|
45
53
|
</VListItem>
|
|
46
54
|
<VListItem
|
|
47
55
|
v-for="headingLevel in headingLevels" :key="headingLevel"
|
|
48
|
-
:color="editor.isActive('heading', {level: headingLevel}) ? 'primary' : ''"
|
|
56
|
+
:color="editor.isActive('heading', { level: headingLevel }) ? 'primary' : ''"
|
|
49
57
|
@click="editor.chain().focus().toggleHeading({ level: headingLevel }).run()"
|
|
50
58
|
>
|
|
51
59
|
<VListItemTitle class="d-flex justify-center align-center">
|
|
@@ -7,8 +7,10 @@ import StyleColor from "@tiptapify/extensions/components/style/StyleColor.vue";
|
|
|
7
7
|
import { computed, inject, Ref } from "vue";
|
|
8
8
|
import { useTheme } from "vuetify/framework";
|
|
9
9
|
|
|
10
|
+
import defaults from '@tiptapify/constants/defaults'
|
|
11
|
+
|
|
10
12
|
defineProps({
|
|
11
|
-
|
|
13
|
+
variantBtn: { type: String, default: defaults.variantBtn }
|
|
12
14
|
})
|
|
13
15
|
|
|
14
16
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
@@ -30,6 +32,7 @@ const selectedColor = computed(() => editor.value.getAttributes('highlight').col
|
|
|
30
32
|
<VBtn
|
|
31
33
|
:id="`tiptapify-highlight-button-${editor.instanceId}`"
|
|
32
34
|
:disabled="!editor.can().chain().focus().toggleHighlight().run()"
|
|
35
|
+
:variant="variantBtn"
|
|
33
36
|
@click="editor.chain().focus().redo().run()"
|
|
34
37
|
size="32"
|
|
35
38
|
>
|
|
@@ -7,6 +7,12 @@ import LineHeight from "@tiptapify/extensions/components/style/lineHeight/LineHe
|
|
|
7
7
|
import { lineHeights } from "@tiptapify/constants/style";
|
|
8
8
|
import { computed, inject, Ref } from "vue";
|
|
9
9
|
|
|
10
|
+
import defaults from '@tiptapify/constants/defaults'
|
|
11
|
+
|
|
12
|
+
defineProps({
|
|
13
|
+
variantBtn: { type: String, default: defaults.variantBtn }
|
|
14
|
+
})
|
|
15
|
+
|
|
10
16
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
11
17
|
|
|
12
18
|
const { t } = inject('tiptapifyI18n') as any
|
|
@@ -42,6 +48,7 @@ function getColor() {
|
|
|
42
48
|
:id="`tiptapify-line-height-button-${editor.instanceId}`"
|
|
43
49
|
:disabled="!editor.can().chain().focus().unsetLineHeight().run()"
|
|
44
50
|
:color="getColor()"
|
|
51
|
+
:variant="variantBtn"
|
|
45
52
|
size="32"
|
|
46
53
|
>
|
|
47
54
|
<VTooltip activator="parent">
|
|
@@ -13,6 +13,7 @@ export enum ToolbarSectionsEnum {
|
|
|
13
13
|
export type sectionComponent = {
|
|
14
14
|
name: string,
|
|
15
15
|
component: any,
|
|
16
|
+
props?: { [key: string]: any }
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
export type section = {
|
|
@@ -22,4 +23,6 @@ export type section = {
|
|
|
22
23
|
extensions?: Array<any>,
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
export type toolbarSections = Array<section>
|
|
26
|
+
export type toolbarSections = Array<section>
|
|
27
|
+
|
|
28
|
+
export type itemsPropType = { [key: string]: Array<string> } | Array<string>
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core'
|
|
2
|
-
import { Plugin, PluginKey } from '@tiptap/pm/state'
|
|
3
|
-
|
|
4
|
-
const name: string = 'preview'
|
|
5
|
-
|
|
6
|
-
declare module '@tiptap/core' {
|
|
7
|
-
interface Commands<ReturnType> {
|
|
8
|
-
preview: {
|
|
9
|
-
showPreview: () => ReturnType
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const Preview = Extension.create({
|
|
15
|
-
name,
|
|
16
|
-
|
|
17
|
-
addCommands() {
|
|
18
|
-
return {
|
|
19
|
-
showPreview: () => ({ editor }) => {
|
|
20
|
-
const event = new CustomEvent(`tiptapify-show-${name}`, {
|
|
21
|
-
detail: {
|
|
22
|
-
html: editor.getHTML(),
|
|
23
|
-
editorId: editor.instanceId
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
window.dispatchEvent(event)
|
|
28
|
-
|
|
29
|
-
return true
|
|
30
|
-
},
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
addProseMirrorPlugins() {
|
|
35
|
-
return [
|
|
36
|
-
new Plugin({
|
|
37
|
-
key: new PluginKey(name),
|
|
38
|
-
}),
|
|
39
|
-
]
|
|
40
|
-
},
|
|
41
|
-
})
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core'
|
|
2
|
-
import { Plugin, PluginKey } from '@tiptap/pm/state'
|
|
3
|
-
|
|
4
|
-
export interface ViewSourceOptions {
|
|
5
|
-
HTMLAttributes: Record<string, any>
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
declare module '@tiptap/core' {
|
|
9
|
-
interface Commands<ReturnType> {
|
|
10
|
-
viewSource: {
|
|
11
|
-
showSource: () => ReturnType
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const ViewSource = Extension.create<ViewSourceOptions>({
|
|
17
|
-
name: 'viewSource',
|
|
18
|
-
|
|
19
|
-
addOptions() {
|
|
20
|
-
return {
|
|
21
|
-
HTMLAttributes: {},
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
addCommands() {
|
|
26
|
-
return {
|
|
27
|
-
showSource: () => ({ editor }) => {
|
|
28
|
-
const event = new CustomEvent('tiptapify-show-source', {
|
|
29
|
-
detail: {
|
|
30
|
-
html: editor.getHTML(),
|
|
31
|
-
editorId: editor.instanceId
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
window.dispatchEvent(event)
|
|
36
|
-
|
|
37
|
-
return true
|
|
38
|
-
},
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
addProseMirrorPlugins() {
|
|
43
|
-
return [
|
|
44
|
-
new Plugin({
|
|
45
|
-
key: new PluginKey('viewSource'),
|
|
46
|
-
}),
|
|
47
|
-
]
|
|
48
|
-
},
|
|
49
|
-
})
|