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

potential fix for icon list validation when there's an embedded link … #523

Closed
wants to merge 5 commits into from

Conversation

mark-c-woodard
Copy link
Contributor

@mark-c-woodard mark-c-woodard commented Aug 6, 2024

…within a wrapper link

There's an issue where grabbing an attribute with a source/selector combo runs the whole block through html dom parsing first. This is usually fine, but we can sometimes save "invalid" markup to the database, such as the <a><span><a></a></span</a> structure you'll find when you have embedded text within a wrapper link. After this is parsed the selector attribute may no longer find the content it's looking for. The structure in this case would have changed to <a><span></span</a><a></a>. This can lead to block validation errors.

so you can see the solution I came up with. I xml parse the full block content instead of letting it run through the html parser and grabbing the attribute we're looking for that way. This solution apparently doesn't work with deprecations, so it had to be in the edit/save funcitons.

The other solution to this whole thing is to change to a fully dynamic block instead of static. But that's a different conversation.

There's also a bit of change to the allowed text formats so you can't embed links while you have a wrapper link.

Also a deprecation just in case there's some difference in the xml parsed content versus the html parsed.

🎫 https://stellarwp.atlassian.net/browse/KAD-3041

...

Issue Info

  • Were you able to reproduce the issue?
  • Is the issue from the ticket solved? (If not, why?)

Checklist

  • I have performed a self-review.
  • No unrelated files are modified.
  • No debugging statements exist (Ex: console.log, error_log).
  • There are no warnings or notices in the wordpress error log.
  • Passes all tests (linting, acceptance, & unit)

Block specific checklist (where relevant)

  • Tested with an existing instance of this block .
  • Tested creating a new instance of this block.
  • Tested with Dynamic content & Elements.

Are there dependent changes in another repository?

  • No.
  • Yes. Please provide the link to the PR.

@mark-c-woodard
Copy link
Contributor Author

mark-c-woodard commented Aug 7, 2024

this ended up just adding jank to fix jank. The solution at the end of the day is to make it so the icon list block doesn't wrap links with links and we've added that code to master separately.
Fascinating that this worked though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant