This repository has been archived by the owner on Feb 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Paste header adding unstyled block #1219
Comments
facebook-github-bot
pushed a commit
that referenced
this issue
Sep 7, 2017
Summary: Preserve block style when pasting plain text. That would allow pasting into code blocks and lists and applying respective styles to new blocks. That should work for any type of block: code, list, quote, heading... Probably related github issues: - #1276 - #1219 Reviewed By: sophiebits Differential Revision: D5786405 fbshipit-source-id: 3c6d074b0c3fe200761164ec6c5ccf1a82df5072
Can you test if e8d1011 has fixed this for you? If not, more detailed repro steps would be helpful. |
I can't reproduce this with Draft.js v0.10.4 (didn't try before). Here is a GIF: ContentState before/afterBefore: {
"entityMap": {},
"blocks": [
{
"key": "6ilcg",
"text": "p",
"type": "unstyled",
"depth": 0,
"inlineStyleRanges": [],
"entityRanges": [],
"data": {}
},
{
"key": "60snn",
"text": "h2",
"type": "header-two",
"depth": 0,
"inlineStyleRanges": [],
"entityRanges": [],
"data": {}
},
{
"key": "bga03",
"text": "p",
"type": "unstyled",
"depth": 0,
"inlineStyleRanges": [],
"entityRanges": [],
"data": {}
}
]
} After: {
"entityMap": {},
"blocks": [
{
"key": "5ukbj",
"text": "p",
"type": "unstyled",
"depth": 0,
"inlineStyleRanges": [],
"entityRanges": [],
"data": {}
},
{
"key": "8h39i",
"text": "h2",
"type": "header-two",
"depth": 0,
"inlineStyleRanges": [],
"entityRanges": [],
"data": {}
},
{
"key": "416ut",
"text": "p",
"type": "unstyled",
"depth": 0,
"inlineStyleRanges": [],
"entityRanges": [],
"data": {}
}
]
} |
midas19910709
added a commit
to midas19910709/draft-js
that referenced
this issue
Mar 30, 2022
Summary: Preserve block style when pasting plain text. That would allow pasting into code blocks and lists and applying respective styles to new blocks. That should work for any type of block: code, list, quote, heading... Probably related github issues: - facebookarchive/draft-js#1276 - facebookarchive/draft-js#1219 Reviewed By: sophiebits Differential Revision: D5786405 fbshipit-source-id: 3c6d074b0c3fe200761164ec6c5ccf1a82df5072
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi,
I have a bug when I'm trying to paste header, the editor adds unstyled block above the header.
If I remove the empty block, the block that had header type get unstyled type.
This is json after pasting:
{
"entityMap": {},
"blocks": [
{
"key": "dv8b1",
"text": " ",
"type": "unstyled",
"depth": 0,
"inlineStyleRanges": [],
"entityRanges": [],
"data": {}
},
{
"key": "6cqrb",
"text": "rem Ipsum?",
"type": "header-two",
"depth": 0,
"inlineStyleRanges": [],
"entityRanges": [],
"data": {}
},
{
"key": "8jdmm",
"text": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining ess",
"type": "unstyled",
"depth": 0,
"inlineStyleRanges": [
{
"offset": 0,
"length": 11,
"style": "BOLD"
}
],
"entityRanges": [],
"data": {}
}
]
}
json after removing the empty block.
{
"entityMap": {},
"blocks": [
{
"key": "dv8b1",
"text": "rem Ipsum?",
"type": "unstyled",
"depth": 0,
"inlineStyleRanges": [],
"entityRanges": [],
"data": {}
},
{
"key": "8jdmm",
"text": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining ess",
"type": "unstyled",
"depth": 0,
"inlineStyleRanges": [
{
"offset": 0,
"length": 11,
"style": "BOLD"
}
],
"entityRanges": [],
"data": {}
}
]
}
Thanks
The text was updated successfully, but these errors were encountered: