I am developing a custom Gutenberg block. I take a few inputs (title, button text, etc) and an iframe gets displayed. The values of these attributes are query params in iframe's url. When I try to edit that block, I am trying to pull these values from that iframe, but I keep failing. My plan B is to save an invisible div with these values, or pass some data attributes to iframe and then get values back that way, because I don't know how to parse src for query params.
registerBlockType('box-card/conversion-boxes', {
title: 'Conversion boxes',
icon: 'nametag',
category: 'common',
attributes: {
title: {
source: 'attribute',
selector: 'iframe',
attribute: 'src'
},
button: {
source: 'attribute',
selector: 'iframe',
attribute: 'src'
},
}
What my src looks like is:
src="/modularconvbox/modularconvbox.php?type=newsletter&title=test-title&button=test-button"
How do I retrieve the correct values for title and button in React? Any ideas?