tiptapify 0.0.22 → 0.0.23
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 +27 -19
- package/dist/tiptapify.umd.js +1 -1
- package/package.json +1 -1
- package/src/components/Tiptapify.vue +7 -2
- package/src/components/index.ts +3 -1
package/package.json
CHANGED
|
@@ -40,14 +40,19 @@ const props = defineProps({
|
|
|
40
40
|
const appTheme = useTheme()
|
|
41
41
|
const currentTheme = ref(appTheme.global.name)
|
|
42
42
|
|
|
43
|
+
function contentChanged() {
|
|
44
|
+
emit('content-changed', { html: editor.value?.getHTML(), json: editor.value?.getJSON() })
|
|
45
|
+
}
|
|
46
|
+
|
|
43
47
|
const editor: ShallowRef<Editor | undefined> = getTiptapEditor(
|
|
44
48
|
props.content,
|
|
45
49
|
computed(() => props.placeholder || t('content.placeholder')).value,
|
|
46
50
|
props.slashCommands,
|
|
47
|
-
props.customExtensions
|
|
51
|
+
props.customExtensions,
|
|
52
|
+
contentChanged
|
|
48
53
|
)
|
|
49
54
|
|
|
50
|
-
const emit = defineEmits(['update:modelValue', 'editor-ready']);
|
|
55
|
+
const emit = defineEmits(['update:modelValue', 'editor-ready', 'content-changed']);
|
|
51
56
|
|
|
52
57
|
provide('tiptapifyEditor', editor)
|
|
53
58
|
provide('tiptapifyI18n', { t, setLocale })
|
package/src/components/index.ts
CHANGED
|
@@ -7,12 +7,14 @@ export function getTiptapEditor (
|
|
|
7
7
|
content: any,
|
|
8
8
|
placeholder: string,
|
|
9
9
|
slashCommands: boolean = true,
|
|
10
|
-
customExtensions: toolbarSections
|
|
10
|
+
customExtensions: toolbarSections,
|
|
11
|
+
onUpdate: Function = () => {}
|
|
11
12
|
): ShallowRef<Editor | undefined> {
|
|
12
13
|
const extensions = editorExtensions(placeholder, slashCommands, customExtensions)
|
|
13
14
|
const editor: ShallowRef<Editor | undefined> = useEditor({
|
|
14
15
|
content,
|
|
15
16
|
extensions,
|
|
17
|
+
onUpdate: ({ editor }) => onUpdate()
|
|
16
18
|
})
|
|
17
19
|
|
|
18
20
|
return editor
|