Open dnnsjsk opened 1 year ago
I've run into this exact issue before. I hide the x-data when $is_preview == true. I'm not sure if there's a better solution.
I disabled jsx and got alpine x-data working by adding the following to my block.json. Any drawbacks?
"supports": {
"jsx": false
}
You can use the acf_blocks_parse_node_attr
JS filter to not convert/parse elements that have attributes starting with x-
:
add_action('acf/input/admin_footer', function () {
?>
<script>
acf.addFilter('acf_blocks_parse_node_attr', (currentValue, nodeAttr) => {
return nodeAttr.name.startsWith('x-') ? nodeAttr : currentValue;
});
</script>
<?php
});
@cearls The drawback of disabling jsx
is that you can no longer use <InnerBlocks />
within that particular block. May or may not be an issue depending on the block.
@retlehs Thanks for the filter!
Hey,
InnerBlocks are not displayed in the editor if using something like https://alpinejs.dev/ and using inline objects like so: