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

Block: Web components' class gets incorrectly transformed to classname #849

Closed
arjendejong12 opened this issue Jul 13, 2023 · 1 comment
Closed

Comments

@arjendejong12
Copy link

I'm using the following web component in my view:
<iconify-icon icon="<?php echo $icon; ?>" class="<?php echo $icon_classes; ?>"></iconify-icon>
In the Gutenberg editor, this gets incorrectly transformed to:
image
The classes are not applied to the web component. Is this something that can be fixed in the plugin? Thanks!

@arjendejong12 arjendejong12 changed the title Web components' class gets incorrectly transformed to classname Block: Web components' class gets incorrectly transformed to classname Oct 24, 2023
@arjendejong12
Copy link
Author

Fixed this by using the acf_blocks_parse_node_attr JS filter:

acf.addFilter("acf_blocks_parse_node_attr", function (shortcut, nodeAttr) {
  if (nodeAttr.name === "class" && nodeAttr.value.indexOf("iconify") !== -1) {
    return {
      name: nodeAttr.name,
      value: nodeAttr.value,
    };
  }
 
  return shortcut;
});

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

No branches or pull requests

1 participant