Pasting text with line breaks on portable text generates wrong structure
See original GitHub issueWhen pasting a text with line breaks in Sanity Studio, the wrong structure is generated. Maybe it’s also worth emphasizing that I’m using Ubuntu. Example:
This is a paragraph.
This is another paragraph.
This is yet another paragraph.
NOTE: DO NOT directly copy this text from here. Paste it in a notepad, copy from there and then paste it into a portable text.
Current structure:
{
"content": [
{
"_type": "block",
"markDefs": [],
"style": "normal",
"children": [
{
"_type": "span",
"marks": [],
"text": "This is a paragraph.\n\nThis is another paragraph.\n\nThis is yet another paragraph.",
"_key": "29d0113c9888"
}
],
"_key": "92731c203548"
}
]
},
Expected structure:
{
"content": [
{
"_type": "block",
"markDefs": [],
"style": "normal",
"children": [
{
"_type": "span",
"marks": [],
"text": "This is a paragraph.",
"_key": "e4f2a496b9be"
}
],
"_key": "92731c203548"
},
{
"_type": "block",
"markDefs": [],
"style": "normal",
"children": [
{
"_type": "span",
"marks": [],
"text": "This is another paragraph.",
"_key": "a00ddcc208bd0"
}
],
"_key": "469131fa9abf"
},
{
"_type": "block",
"markDefs": [],
"style": "normal",
"children": [
{
"_type": "span",
"marks": [],
"text": "This is yet another paragraph.",
"_key": "7c0240d5fa0e0"
}
],
"_key": "ee655e6d00c1"
}
]
}
Which versions of Sanity are you using?
@sanity/cli 2.12.0 (up to date)
@sanity/base 2.12.0 (up to date)
@sanity/cli 2.12.0 (up to date)
@sanity/color-input 2.11.0 (up to date)
@sanity/components 2.2.6 (up to date)
@sanity/core 2.12.0 (up to date)
@sanity/dashboard 2.10.5 (up to date)
@sanity/default-layout 2.12.0 (up to date)
@sanity/default-login 2.11.1 (up to date)
@sanity/desk-tool 2.12.1 (up to date)
@sanity/production-preview 2.2.6 (up to date)
What operating system are you using?
Ubuntu 20.04
Which versions of Node.js / npm are you running?
> npm -v && node -v
6.14.12
v14.16.1
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Reader Question: Getting rid of hard line breaks in pasted text
I've always done it this very simple way: Select find/replace. Click more, click special, select “paragraph mark” (top of list). Click in replace...
Read more >Pasting text from Word document insert line breaks
Pasted text preserves its formatting and structure. Pasting text from a Word document inserts lots of line breaks. Didn't have this problem ...
Read more >Breaks for Portable Text - Sanity.io schema
This implementation lets you define what types of breaks you want to make available in your content model and how you can choose...
Read more >Problem with Copy pasting text from a document on ubuntu
This is just how text in PDFs works - when you copy text that spans multiple lines, you get line breaks. Other forums...
Read more >Removing Line Breaks - LibreOffice Help
Use the AutoCorrect feature to remove line breaks that occur within sentences. Unwanted line breaks can occur when you copy text from another...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Great work! I’m able to reproduce it locally in Chrome on macOS as well. We’ll look more into this.
This should be fixed now in v.
2.25.0
. Closing this.