cms
cms copied to clipboard
[5.x] Transmit and store Bard values as real objects
Replaces https://github.com/statamic/cms/pull/8684
This PR changes the way Bard values are transmitted and stored in the publish store, so they're real objects rather than JSON encoded. This has a few advantages:
- Improves performance as values don't need to be JSON encoded/decoded on the PHP or JS sides.
- Fixes an issue where fields inside Bard sets would not have their whitespace trimmed.
- Simplifies working with Bard values in the publish store.
- Simplifies the PHP and JS Bard code (and tests).
The issue that submitting Bard values as encoded JSON solves (text nodes being trimmed) has been addressed in a different way. The global TrimStrings middleware will now be skipped for CP requests, and instead a custom middleware has been added. This version checks the data and automatically skips anything that looks like a text node.
Bard fields are no longer registered as JSON submitting fields, which I think means nothing uses that feature anymore. But I haven't touched it since it could still be used by addons etc.
Should target master/v5 (once master is updated), as this is breaking for anyone getting/setting Bard values from the publish store.