Skip to content

Commit

Permalink
chore: update faq
Browse files Browse the repository at this point in the history
  • Loading branch information
nperez0111 committed Jan 10, 2025
1 parent 14e0a77 commit 4f9eeeb
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/content/guides/faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,23 @@ new Editor({

Which will make the clipboard serializer use a single newline as a separator between blocks.

## Why can't I use React context within a nodeView
## I'm having issues with React context with NodeViews

NodeViews have to be handed off to ProseMirror, which means they can't be structured like a typical React component. The `<NodeViewContent>` is serving as a div to mount elements into, but does not render the children as a React component would. Therefore, React context does not work within a NodeView.
To use React context within a NodeView, you need to wrapp the EditorContent component with the context provider. Within the nodeview, the context should be available within the NodeView component.

```jsx
import React from 'react'
import { EditorContent } from '@tiptap/react'

const TiptapEditor = ({ editor }) => {
return (
<MyContext.Provider value={{ foo: 'bar' }}>
<EditorContent editor={editor} />
</MyContext.Provider>
)
}
```

## Drag & Drop isn't working

Some libraries like react-dnd or react-beautiful-dnd might interfere with the drag & drop functionality of Tiptap. If you're using one of these libraries, you might have to disable them (or at least confine the elements that they listen to) for the drag and drop functionality of the editor to work properly.

0 comments on commit 4f9eeeb

Please sign in to comment.