Skip to content

Commit

Permalink
wip: faq page
Browse files Browse the repository at this point in the history
  • Loading branch information
nperez0111 committed Dec 20, 2024
1 parent 4afa9d5 commit 14e0a77
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions src/content/guides/faq.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## When I copy the content of the editor, into a text field I get a bunch of newlines

By default, in Tiptap, the clipboard text serializer is set to produce paragraphs with 2 newlines in between (like you would do in Markdown).

So you'd paste content and it would look like this:

```text
This is a paragraph.
This is another paragraph.
```

When you probably want it to look like this:

```text
This is a paragraph.
This is another paragraph.
```

To do this you have to change the `clipboardTextSerializer` to use a single newline instead of two.

Like this:

```js
new Editor({
// other options
coreExtensionOptions: {
clipboardTextSerializer: {
blockSeparator: '\n',
},
},
})
```

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

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.

0 comments on commit 14e0a77

Please sign in to comment.