-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pasting Mixed Tagname HTML Breaks if 'core/heading' Block Has Been Disabled #19036
Comments
The code that I am using to disable the 'core/heading' block is:
|
@Kelderic I think this could be considered a bug. Ideally the editor wouldn't just ignore the pasted content even when some blocks are disabled. I think the Classic block or Custom HTML block could be considered fallbacks for content that can't be matched to a block, but the paste was still ignored when I tried with those blocks enabled.
Yep, that's handled using the transform system as a 'raw' transform. Here's how the Heading block handles it: gutenberg/packages/block-library/src/heading/transforms.js Lines 26 to 58 in 21936b5
Unfortunately there aren't a lot of docs for raw transforms, but the main bit you'd be concerned about is the transform function and creating your block with the right attributes instead of the core/heading block. |
Describe the bug
When using the default 'core/paragraph' and 'core/heading' blocks, I can copy text from another website that includes
<p>
tags and<h2>
tags mixed within the copied content. I can then paste it into Gutenberg and the content is properly split. However, if the 'core/heading' is disabled, (say to replace it with a custom one), then pasting stops working altogether if the pasted content contains mixed text.To reproduce
Steps to reproduce the behavior:
<h2>
as the wrapper.<p>First line</p><h2>Second line.</h2><p>Third line</p>
Expected behavior
I would expect the content to be pasted into three blocks. A paragraph, a custom heading, and a paragraph. Or, I'd at least expect a console error message.
Actual behavior
Nothing happens. Pasting just does nothing.
Screenshots
![Untitled Project](https://user-images.githubusercontent.com/1747252/70539208-59133580-1b31-11ea-959f-929a5308ef76.gif)
Desktop (please complete the following information):
Custom block RichText Element:
Does there need to be a way to register a custom block as the recipient of certain HTML paste types?
The text was updated successfully, but these errors were encountered: