Skip to content
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

Converting blocks lose anchor tags #7335

Closed
Clorith opened this issue Jun 17, 2018 · 6 comments
Closed

Converting blocks lose anchor tags #7335

Clorith opened this issue Jun 17, 2018 · 6 comments
Labels
[Feature] Paste [Type] Bug An existing feature does not function as intended
Milestone

Comments

@Clorith
Copy link
Member

Clorith commented Jun 17, 2018

Describe the bug
When converting a classic page to blocks, any existing anchor tags on titles are lost. This is despite the block and the original classic content both utilize the id attribute to provide the anchor tag.

To Reproduce
Steps to reproduce the behavior:

  1. Create a post in the classic editor
  2. Edit the HTML of the post and add an anchor tag using the id attribute on a heading.
  3. Save the post and leave
  4. Open the post in Gutenberg
  5. Choose to convert the post to blocks

Expected behavior
Elements that are supported in Gutenberg should be retained when converting, as an aside would it be an idea to not strip non-supported attributes but rather leave in the HTML to avoid breaking content?

Additional context
Gutenberg 3.0.1 (running on WordPress.org, in case there's something special introduced there?)

@danielbachhuber danielbachhuber added [Type] Try Gutenberg Blocker [Type] Bug An existing feature does not function as intended [Feature] Paste labels Jun 19, 2018
@danielbachhuber
Copy link
Member

Related #6581 #6096 #4498

@danielbachhuber
Copy link
Member

@WordPress/gutenberg-core Do we want to handle this with an abstraction similar to className, or should we simply add this feature to the blocks that it's relevant to? And, in either case, what should the attribute name be?

@brandonpayton
Copy link
Member

It appears #8124 is meant to address this issue.

@Clorith
Copy link
Member Author

Clorith commented Jul 23, 2018

#8124 only allows ID attributes, what about other attributes that users may have previously added manually for plugins and such for example?

We shouldn't be stripping anything when converting, if we do it should be a migration instead, and it should be clear that attribute data may be lost if it does not adhere to our pre-defined standards.

@brandonpayton
Copy link
Member

👍 You're right. It just addresses a specific instance of this issue. Thanks for correcting.

@pento
Copy link
Member

pento commented Jul 25, 2018

#8124 fixes the issue with the id attribute, #6878 continues the broader conversation of how to handle random attributes that we don't explicitly support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Paste [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

5 participants