tiptapify 0.1.1 → 0.1.2
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 +1 -1
- package/dist/tiptapify.mjs +16400 -16123
- package/dist/tiptapify.umd.js +58 -58
- package/index.d.ts +10 -1
- package/package.json +54 -41
- package/src/components/Tiptapify.vue +31 -45
- package/src/components/index.ts +4 -2
package/index.d.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { Editor } from "@tiptap/vue-3";
|
|
2
|
+
import {
|
|
3
|
+
Component,
|
|
4
|
+
ComponentOptionsMixin, ComponentProvideOptions,
|
|
5
|
+
ComputedOptions, Directive,
|
|
6
|
+
EmitsOptions,
|
|
7
|
+
ExtractDefaultPropTypes,
|
|
8
|
+
MethodOptions,
|
|
9
|
+
PublicProps, SlotsType
|
|
10
|
+
} from "@vue/runtime-core";
|
|
2
11
|
import type { DefineComponent } from 'vue'
|
|
3
12
|
import { toolbarSections } from "./src/types/toolbarTypes";
|
|
4
13
|
|
|
@@ -22,6 +31,7 @@ export interface TiptapifyProps {
|
|
|
22
31
|
}
|
|
23
32
|
|
|
24
33
|
export interface TiptapifyEmits {
|
|
34
|
+
[key: string]: ((...args: any[]) => any) | null
|
|
25
35
|
'editor-ready': (options: {
|
|
26
36
|
getHTML: () => string
|
|
27
37
|
getJSON: () => any
|
|
@@ -31,7 +41,6 @@ export interface TiptapifyEmits {
|
|
|
31
41
|
|
|
32
42
|
export declare const Tiptapify: DefineComponent<TiptapifyProps, {}, {}, {}, {}, {}, {}, TiptapifyEmits>
|
|
33
43
|
|
|
34
|
-
// Плагин
|
|
35
44
|
export interface TiptapifyOptions {
|
|
36
45
|
locale?: string
|
|
37
46
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tiptapify",
|
|
3
3
|
"types": "./index.d.ts",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.2",
|
|
5
5
|
"description": "Tiptap3 editor with Vuetify3 menu implementation",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"scripts": {
|
|
30
30
|
"dev": "vite",
|
|
31
31
|
"build": "vite build",
|
|
32
|
+
"lint": "eslint resources/ts --fix --ext .ts,.js,.cjs,.vue,.tsx,.jsx",
|
|
32
33
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
33
34
|
"build:charmap": "tsx build-charmap.ts",
|
|
34
35
|
"build:emojis": "tsx build-emojis.ts",
|
|
@@ -63,45 +64,45 @@
|
|
|
63
64
|
"repository": "https://github.com/IVoyt/tiptapify",
|
|
64
65
|
"packageManager": "pnpm@10.33.4",
|
|
65
66
|
"dependencies": {
|
|
66
|
-
"@tiptap/core": "^3.
|
|
67
|
-
"@tiptap/extension-blockquote": "^3.
|
|
68
|
-
"@tiptap/extension-bold": "^3.
|
|
69
|
-
"@tiptap/extension-bubble-menu": "^3.
|
|
70
|
-
"@tiptap/extension-code": "^3.
|
|
71
|
-
"@tiptap/extension-code-block": "^3.
|
|
72
|
-
"@tiptap/extension-code-block-lowlight": "^3.
|
|
73
|
-
"@tiptap/extension-color": "^3.
|
|
74
|
-
"@tiptap/extension-document": "^3.
|
|
75
|
-
"@tiptap/extension-floating-menu": "^3.
|
|
76
|
-
"@tiptap/extension-font-family": "^3.
|
|
77
|
-
"@tiptap/extension-hard-break": "^3.
|
|
78
|
-
"@tiptap/extension-heading": "^3.
|
|
79
|
-
"@tiptap/extension-highlight": "^3.
|
|
80
|
-
"@tiptap/extension-horizontal-rule": "^3.
|
|
81
|
-
"@tiptap/extension-image": "^3.
|
|
82
|
-
"@tiptap/extension-invisible-characters": "^3.
|
|
83
|
-
"@tiptap/extension-italic": "^3.
|
|
84
|
-
"@tiptap/extension-link": "^3.
|
|
85
|
-
"@tiptap/extension-list": "^3.
|
|
86
|
-
"@tiptap/extension-list-item": "^3.
|
|
87
|
-
"@tiptap/extension-paragraph": "^3.
|
|
88
|
-
"@tiptap/extension-placeholder": "^3.
|
|
89
|
-
"@tiptap/extension-strike": "^3.
|
|
90
|
-
"@tiptap/extension-subscript": "^3.
|
|
91
|
-
"@tiptap/extension-superscript": "^3.
|
|
92
|
-
"@tiptap/extension-table": "^3.
|
|
93
|
-
"@tiptap/extension-task-item": "^3.
|
|
94
|
-
"@tiptap/extension-task-list": "^3.
|
|
95
|
-
"@tiptap/extension-text": "^3.
|
|
96
|
-
"@tiptap/extension-text-align": "^3.
|
|
97
|
-
"@tiptap/extension-text-style": "^3.
|
|
98
|
-
"@tiptap/extension-typography": "^3.
|
|
99
|
-
"@tiptap/extension-underline": "^3.
|
|
100
|
-
"@tiptap/extension-youtube": "^3.
|
|
101
|
-
"@tiptap/extensions": "^3.
|
|
102
|
-
"@tiptap/pm": "^3.
|
|
103
|
-
"@tiptap/suggestion": "^3.
|
|
104
|
-
"@tiptap/vue-3": "^3.
|
|
67
|
+
"@tiptap/core": "^3.23.5",
|
|
68
|
+
"@tiptap/extension-blockquote": "^3.23.5",
|
|
69
|
+
"@tiptap/extension-bold": "^3.23.5",
|
|
70
|
+
"@tiptap/extension-bubble-menu": "^3.23.5",
|
|
71
|
+
"@tiptap/extension-code": "^3.23.5",
|
|
72
|
+
"@tiptap/extension-code-block": "^3.23.5",
|
|
73
|
+
"@tiptap/extension-code-block-lowlight": "^3.23.5",
|
|
74
|
+
"@tiptap/extension-color": "^3.23.5",
|
|
75
|
+
"@tiptap/extension-document": "^3.23.5",
|
|
76
|
+
"@tiptap/extension-floating-menu": "^3.23.5",
|
|
77
|
+
"@tiptap/extension-font-family": "^3.23.5",
|
|
78
|
+
"@tiptap/extension-hard-break": "^3.23.5",
|
|
79
|
+
"@tiptap/extension-heading": "^3.23.5",
|
|
80
|
+
"@tiptap/extension-highlight": "^3.23.5",
|
|
81
|
+
"@tiptap/extension-horizontal-rule": "^3.23.5",
|
|
82
|
+
"@tiptap/extension-image": "^3.23.5",
|
|
83
|
+
"@tiptap/extension-invisible-characters": "^3.23.5",
|
|
84
|
+
"@tiptap/extension-italic": "^3.23.5",
|
|
85
|
+
"@tiptap/extension-link": "^3.23.5",
|
|
86
|
+
"@tiptap/extension-list": "^3.23.5",
|
|
87
|
+
"@tiptap/extension-list-item": "^3.23.5",
|
|
88
|
+
"@tiptap/extension-paragraph": "^3.23.5",
|
|
89
|
+
"@tiptap/extension-placeholder": "^3.23.5",
|
|
90
|
+
"@tiptap/extension-strike": "^3.23.5",
|
|
91
|
+
"@tiptap/extension-subscript": "^3.23.5",
|
|
92
|
+
"@tiptap/extension-superscript": "^3.23.5",
|
|
93
|
+
"@tiptap/extension-table": "^3.23.5",
|
|
94
|
+
"@tiptap/extension-task-item": "^3.23.5",
|
|
95
|
+
"@tiptap/extension-task-list": "^3.23.5",
|
|
96
|
+
"@tiptap/extension-text": "^3.23.5",
|
|
97
|
+
"@tiptap/extension-text-align": "^3.23.5",
|
|
98
|
+
"@tiptap/extension-text-style": "^3.23.5",
|
|
99
|
+
"@tiptap/extension-typography": "^3.23.5",
|
|
100
|
+
"@tiptap/extension-underline": "^3.23.5",
|
|
101
|
+
"@tiptap/extension-youtube": "^3.23.5",
|
|
102
|
+
"@tiptap/extensions": "^3.23.5",
|
|
103
|
+
"@tiptap/pm": "^3.23.5",
|
|
104
|
+
"@tiptap/suggestion": "^3.23.5",
|
|
105
|
+
"@tiptap/vue-3": "^3.23.5",
|
|
105
106
|
"emoji.json": "^16.0.0",
|
|
106
107
|
"highlight.js": "^11.11.1",
|
|
107
108
|
"linkifyjs": "^4.3.2",
|
|
@@ -119,10 +120,22 @@
|
|
|
119
120
|
"@types/node": "^22.19.15",
|
|
120
121
|
"@vitejs/plugin-vue": "^6.0.5",
|
|
121
122
|
"@vitejs/plugin-vue-jsx": "^5.1.5",
|
|
123
|
+
"eslint": "^10.4.0",
|
|
124
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
125
|
+
"eslint-plugin-case-police": "^2.2.1",
|
|
126
|
+
"eslint-plugin-import": "^2.32.0",
|
|
127
|
+
"eslint-plugin-promise": "^7.3.0",
|
|
128
|
+
"eslint-plugin-regexp": "2.7.0",
|
|
129
|
+
"eslint-plugin-sonarjs": "1.0.4",
|
|
130
|
+
"eslint-plugin-unicorn": "^64.0.0",
|
|
131
|
+
"eslint-plugin-vue": "^10.9.1",
|
|
122
132
|
"rollup-plugin-tsconfig-paths": "^1.5.2",
|
|
123
133
|
"sass-embedded": "^1.98.0",
|
|
134
|
+
"stylelint": "^17.12.0",
|
|
135
|
+
"stylelint-config-standard-scss": "14.0.0",
|
|
124
136
|
"tsx": "^4.21.0",
|
|
125
|
-
"typescript": "^
|
|
137
|
+
"typescript": "^6.0.3",
|
|
138
|
+
"typescript-eslint": "^8.59.4",
|
|
126
139
|
"unplugin-vue-components": "^28.8.0",
|
|
127
140
|
"vite": "^7.3.1",
|
|
128
141
|
"vite-plugin-vuetify": "^2.1.3",
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
|
|
3
|
-
import defaults from
|
|
4
|
-
import { itemsPropType, toolbarSections } from
|
|
5
|
-
import { SlashCommandsConfig } from
|
|
6
|
-
import { computed, onBeforeUnmount, PropType, provide, ref, ShallowRef, watch } from
|
|
7
|
-
import { default as Toolbar } from
|
|
3
|
+
import defaults from '@tiptapify/constants/defaults'
|
|
4
|
+
import { itemsPropType, toolbarSections } from '@tiptapify/types/toolbarTypes'
|
|
5
|
+
import { SlashCommandsConfig } from '@tiptapify/types/slashCommandsTypes'
|
|
6
|
+
import { computed, onBeforeUnmount, PropType, provide, ref, ShallowRef, watch } from 'vue'
|
|
7
|
+
import { default as Toolbar } from '@tiptapify/components/Toolbar/Index.vue'
|
|
8
8
|
import { Editor, EditorContent } from '@tiptap/vue-3'
|
|
9
9
|
import MenuBubble from '@tiptapify/components/MenuBubble.vue'
|
|
10
10
|
import MenuFloating from '@tiptapify/components/MenuFloating.vue'
|
|
11
11
|
|
|
12
|
-
import { useLocale } from
|
|
12
|
+
import { useLocale } from '@tiptapify/i18n'
|
|
13
13
|
|
|
14
|
-
import { getTiptapEditor } from
|
|
14
|
+
import { getTiptapEditor } from '@tiptapify/components/index'
|
|
15
15
|
|
|
16
16
|
import Footer from '@tiptapify/components/Footer.vue'
|
|
17
|
-
import { useTheme } from
|
|
18
|
-
|
|
19
|
-
const { t, i18n, setLocale } = useLocale();
|
|
17
|
+
import { useTheme } from 'vuetify/framework'
|
|
20
18
|
|
|
21
19
|
const props = defineProps({
|
|
22
20
|
locale: { type: String, default () { return 'en' } },
|
|
@@ -25,7 +23,7 @@ const props = defineProps({
|
|
|
25
23
|
variantBtn: { type: String, default () { return defaults.variantBtn } },
|
|
26
24
|
variantField: { type: String, default () { return defaults.variantField } },
|
|
27
25
|
toolbar: { type: Boolean, default () { return true } },
|
|
28
|
-
items: { type: [Array, Object as PropType<itemsPropType>], default() { return [] }},
|
|
26
|
+
items: { type: [Array, Object as PropType<itemsPropType>], default() { return [] } },
|
|
29
27
|
itemsExclude: { type: Boolean, default() { return false } },
|
|
30
28
|
bubbleMenu: { type: Boolean, default () { return true } },
|
|
31
29
|
floatingMenu: { type: Boolean, default () { return true } },
|
|
@@ -40,14 +38,11 @@ const props = defineProps({
|
|
|
40
38
|
interactiveStyles: { type: Boolean, default() { return true } },
|
|
41
39
|
})
|
|
42
40
|
|
|
41
|
+
const { t, setLocale } = useLocale(props.locale)
|
|
42
|
+
|
|
43
43
|
const appTheme = useTheme()
|
|
44
44
|
const currentTheme = ref(appTheme.global.name)
|
|
45
45
|
|
|
46
|
-
const propsItems = computed(() => props.items)
|
|
47
|
-
const propsItemsExclude = computed(() => props.itemsExclude)
|
|
48
|
-
|
|
49
|
-
const interactiveStyles = computed(() => props.interactiveStyles)
|
|
50
|
-
|
|
51
46
|
function contentChanged() {
|
|
52
47
|
emit('content-changed', { html: editor.value?.getHTML(), json: editor.value?.getJSON() })
|
|
53
48
|
}
|
|
@@ -57,36 +52,27 @@ const editor: ShallowRef<Editor | undefined> = getTiptapEditor(
|
|
|
57
52
|
computed(() => props.placeholder || t('content.placeholder')).value,
|
|
58
53
|
props.slashCommands,
|
|
59
54
|
props.customExtensions,
|
|
60
|
-
contentChanged
|
|
55
|
+
contentChanged,
|
|
56
|
+
(editorInstance) => {
|
|
57
|
+
editorInstance.interactiveStyles = props.interactiveStyles
|
|
58
|
+
emit('editor-ready', {
|
|
59
|
+
editor: editorInstance,
|
|
60
|
+
setLocale,
|
|
61
|
+
getHTML: () => editorInstance.getHTML(),
|
|
62
|
+
getJSON: () => editorInstance.getJSON(),
|
|
63
|
+
})
|
|
64
|
+
},
|
|
61
65
|
)
|
|
62
66
|
|
|
63
|
-
const emit = defineEmits(['update:modelValue', 'editor-ready', 'content-changed'])
|
|
67
|
+
const emit = defineEmits(['update:modelValue', 'editor-ready', 'content-changed'])
|
|
64
68
|
|
|
65
69
|
provide('tiptapifyEditor', editor)
|
|
66
70
|
provide('tiptapifyI18n', { t, setLocale })
|
|
67
71
|
|
|
68
72
|
editor.value?.chain().setFontFamily(props.defaultFontFamily).run()
|
|
69
73
|
|
|
70
|
-
watch(() => editor.value, (editorInstance) => {
|
|
71
|
-
if (editorInstance instanceof Editor) {
|
|
72
|
-
editor.value.interactiveStyles = interactiveStyles.value
|
|
73
|
-
emit('editor-ready', {
|
|
74
|
-
editor: editorInstance,
|
|
75
|
-
setLocale,
|
|
76
|
-
getHTML: () => editorInstance.getHTML(),
|
|
77
|
-
getJSON: () => editorInstance.getJSON(),
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}, { immediate: true });
|
|
81
|
-
|
|
82
74
|
watch(() => props.locale, () => {
|
|
83
75
|
setLocale(props.locale)
|
|
84
|
-
}, { immediate: true });
|
|
85
|
-
|
|
86
|
-
watch(() => props.interactiveStyles, (_interactiveStyles) => {
|
|
87
|
-
if (editor.value instanceof Editor) {
|
|
88
|
-
editor.value.interactiveStyles = interactiveStyles
|
|
89
|
-
}
|
|
90
76
|
})
|
|
91
77
|
|
|
92
78
|
onBeforeUnmount(() => {
|
|
@@ -99,15 +85,15 @@ onBeforeUnmount(() => {
|
|
|
99
85
|
<div>
|
|
100
86
|
<template v-if="toolbar">
|
|
101
87
|
<Toolbar
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
88
|
+
v-if="editor"
|
|
89
|
+
:variant-btn="variantBtn"
|
|
90
|
+
:variant-field="variantField"
|
|
91
|
+
:font-measure="fontMeasure"
|
|
92
|
+
:items="items"
|
|
93
|
+
:items-exclude="itemsExclude"
|
|
94
|
+
:rounded="rounded"
|
|
95
|
+
:custom-extensions="customExtensions"
|
|
96
|
+
:theme="currentTheme"
|
|
111
97
|
/>
|
|
112
98
|
</template>
|
|
113
99
|
|
package/src/components/index.ts
CHANGED
|
@@ -9,13 +9,15 @@ export function getTiptapEditor (
|
|
|
9
9
|
placeholder: string,
|
|
10
10
|
slashCommands: SlashCommandsConfig = true,
|
|
11
11
|
customExtensions: toolbarSections,
|
|
12
|
-
onUpdate: Function = () => {}
|
|
12
|
+
onUpdate: Function = () => {},
|
|
13
|
+
onCreate?: (editor: Editor) => void,
|
|
13
14
|
): ShallowRef<Editor | undefined> {
|
|
14
15
|
const extensions = editorExtensions(placeholder, slashCommands, customExtensions)
|
|
15
16
|
|
|
16
17
|
return useEditor({
|
|
17
18
|
content,
|
|
18
19
|
extensions,
|
|
19
|
-
onUpdate: ({ editor }) => onUpdate()
|
|
20
|
+
onUpdate: ({ editor }) => onUpdate(),
|
|
21
|
+
onCreate: onCreate ? ({ editor }) => onCreate(editor) : undefined,
|
|
20
22
|
})
|
|
21
23
|
}
|