-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4afa9d5
commit 14e0a77
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |