JavaScript for WordPress Forums Gutenberg Development Inline Styles on all native blocks Reply To: Inline Styles on all native blocks

#142309
Ben Beard
Participant

Sorry, I tried to edit to include more info…

So I added an extra attribute to store the background img url (named backgroundImg)

I am trying to use blocks.getSaveContent.extraProps to apply the background image to the inline style like so..

	if ("wp-block-column" === props.className) {
		return lodash.merge(props, {
			style: {
				backgroundImage: "url(" + props.backgroundImg + ")",
			},
		});
	}

What am I missing

  • This reply was modified 2 years, 4 months ago by Ben Beard. Reason: typo
  • This reply was modified 2 years, 4 months ago by Ben Beard. Reason: made another error