libreform / wp-libre-form

Easy native HTML5 forms for WordPress. Version 1.5 is unmaintained, but works without issue. 2.0 has been rewritten from the ground, and can be found at https://github.com/libreform/libreform
https://wordpress.org/plugins/wp-libre-form
GNU General Public License v3.0
67 stars 27 forks source link

(UI?) option for disabling shortcode parsing in REST API requests #163

Closed k1sul1 closed 5 years ago

k1sul1 commented 5 years ago

When working with something like a React single page application, HTML is a bit of a nuisance. Attaching random event listeners is not exactly the React way of doing things, so the form html has to be stripped out of the content before rendering, and replaced with a component.

It would be much easier to do said search-replace if the content looked like

<p>lorem ipsum</p>[libre-form id="123"]<p>lorem ipsum</p>

instead of

<p>lorem ipsum</p><form data-id="123"><input name="random-unknown-elements"><input type="submit"></form><p>lorem ipsum</p>

The latter "requires" a DOM parser, while the first one is doable with a regular expression.

Since #153 warrants for an UI option, this could be made controllable within the UI, but a filter or a constant would work as well.

k1sul1 commented 5 years ago

Will be added in #153