Automattic / jetpack

Security, performance, marketing, and design tools — Jetpack is made by WordPress experts to make WP sites safer and faster, and help you grow your traffic.
https://jetpack.com/
Other
1.58k stars 799 forks source link

Contact form: Converting form shortcode to a block does not include form field shortcodes #11898

Open aldavigdis opened 5 years ago

aldavigdis commented 5 years ago

The support for the conversion of shortcodes into blocks seems quite limited compared to the conversion of blocks between different types, even if it uses the same API.

This means that shortcodes nested inside others — in our cases form fields inside of a contact form — cannot be parsed properly by Gutenberg. Currently, defaults from the JetpackContactForm component found in jetpack-contact-form.jsx are used, which essentially sets each form block to a default state, replacing any user-defined field.

The Gutenberg API documentation does not explicitly indicate the limitation of shortcode conversions. I do think it should be a bit clearer on that, if this is not possible to do.

A PR for the WIP and R&D is at https://github.com/Automattic/wp-calypso/pull/28611

An issue ticket has been created within Gutenberg related to this at https://github.com/WordPress/gutenberg/issues/12235

aldavigdis commented 5 years ago

If this remains unsolvable, we could for perhaps hook into the "convert to blocks" event and display a warning about the contact form being reset, reminding the user that an undo may be performed to restore the form to its previous state.