#Nuxt TipTap, how to get the content to a parent component
3 messages · Page 1 of 1 (latest)
Hi @pseudo hull. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
I apologize, but I don't have enough specific information in the provided knowledge sources to answer your question about Nuxt TipTap and getting content from the editor to a parent component. The knowledge sources don't contain any information about TipTap integration with Nuxt.
However, I can provide some general guidance on passing data from child to parent components in Nuxt based on the available information:
In Nuxt and Vue, you typically use events to pass data from a child component to a parent component. This is often done using the emit method in the child component and listening for that event in the parent.
Here's a general pattern you could adapt:
- In the child component (your TipTap editor component), you would emit an event with the editor content:
<script setup>
const emit = defineEmits(['update:content'])
// When the editor content changes
function onUpdate({ editor }) {
emit('update:content', editor.getHTML())
}
</script>
- In the parent component, you would listen for this event:
<template>
<TipTapEditor @update:content="handleContentUpdate" />
</template>
<script setup>
function handleContentUpdate(content) {
// Do something with the content
console.log(content)
}
</script>
This pattern is demonstrated in the Stack Overflow post about emitting input values, though it's not specific to TipTap.