Add coexistence checks to all enqueue methods to prevent loading both React and Grid.js assets simultaneously. Changes: - ReactAdmin.php: Only enqueue React assets when ?react=1 - Init.php: Skip Grid.js when React active on admin pages - Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0 - Customer.php, Product.php, License.php: Add coexistence checks Now the toggle between Classic and React versions works correctly. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
30 lines
1.1 KiB
JavaScript
30 lines
1.1 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.setGutenbergExperiments = void 0;
|
|
/**
|
|
* Sets the Gutenberg experiments.
|
|
*
|
|
* @param this
|
|
* @param experiments Array of experimental flags to enable. Pass in an empty array to disable all experiments.
|
|
*/
|
|
async function setGutenbergExperiments(experiments) {
|
|
const response = await this.request.get('/wp-admin/admin.php?page=gutenberg-experiments');
|
|
const html = await response.text();
|
|
const nonce = html.match(/name="_wpnonce" value="([^"]+)"/)[1];
|
|
await this.request.post('/wp-admin/options.php', {
|
|
form: {
|
|
option_page: 'gutenberg-experiments',
|
|
action: 'update',
|
|
_wpnonce: nonce,
|
|
_wp_http_referer: '/wp-admin/admin.php?page=gutenberg-experiments',
|
|
...Object.fromEntries(experiments.map((experiment) => [
|
|
`gutenberg-experiments[${experiment}]`,
|
|
1,
|
|
])),
|
|
submit: 'Save Changes',
|
|
},
|
|
failOnStatusCode: true,
|
|
});
|
|
}
|
|
exports.setGutenbergExperiments = setGutenbergExperiments;
|
|
//# sourceMappingURL=gutenberg-experiments.js.map
|