"paste-html" – error when pasting content in which A tag is wrapped in a text-formatting tag (i.e. STRONG)
See original GitHub issueDo you want to request a feature or report a bug?
Bug
What’s the current behavior?
Go to https://hungerlyyak.htmlpasta.com/ and copy the content. The HTML is below:
<p>The most important thing is to copy this text <strong><a href="https://example.com/">and this A link</a></strong> that is wrapped in STRONG tags.</p>
<p>Open your console and see what it says when you paste.</p>
Then, go to the paste-html example. Open your developer console. Paste the content in the Slate Editor. It triggers an error:
Uncaught Error: The <text> hyperscript tag can only contain text content as children.
This is because the <strong>
tag becomes a text tag (with bold: true
) and then, there is an Element
nested in it ({ type: "link", url:"https://example.com/", children: [{ text: "and this A link" }] }
– which is a forbidden nesting as per Slate’s constraints.
Slate: 0.56.9 Browser: All OS: Mac
What’s the expected behavior?
I think the bolding should transfer and apply to the Text leaves
nested within the Link Element
.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:11
Top Results From Across the Web
Outlook desktop email content pasted into web email gives error
It's the HTML formatting from Office. Outlook adds the P tag (for paragraphs) while gmail just uses DIV tags. I would not copy...
Read more >Javascript trick for 'paste as plain text` in execCommand
Possible Solution: The way I can think of is to set listener for keyup events for ( Ctrl + V ) and strip...
Read more >Basic Formatting | HTML text formatting, paragraphs and line ...
Note that when closing the original tag ( p ), all its attributes are taken with it, and all you need is the...
Read more >dafont copy and paste
Many apps provide text formatting options to make the fonts look bold, for example ... content in invites or titles in labels and...
Read more >Add text to frames in InDesign - Adobe Support
Add, paste, drag and drop, and place text in InDesign frames and ... The following options are available when you import a tagged-text...
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 FreeTop 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
Top GitHub Comments
Maybe I’m misunderstanding your logic, but I’m thinking the goal is to return only valid children of the text node. Since find() returns ‘undefined’ if there aren’t any, but filter() will always return an array, it just seems cleaner to me.
in my case i just did this and it works but there was just a
{type: "link"}
maybe in some other cases that can doesn’t work fine