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>
42 lines
1.0 KiB
JavaScript
42 lines
1.0 KiB
JavaScript
"use strict";
|
|
|
|
exports.__esModule = true;
|
|
exports.default = void 0;
|
|
|
|
var _utils = require("../utils");
|
|
|
|
var _options = require("../options");
|
|
|
|
async function toMatch(instance, matcher, options) {
|
|
options = (0, _options.defaultOptions)(options);
|
|
const {
|
|
page,
|
|
handle
|
|
} = await (0, _utils.getContext)(instance, () => document.body);
|
|
const {
|
|
text,
|
|
regexp
|
|
} = (0, _utils.expandSearchExpr)(matcher);
|
|
|
|
try {
|
|
await page.waitForFunction((handle, text, regexp) => {
|
|
if (!handle) return false;
|
|
|
|
if (regexp !== null) {
|
|
const [, pattern, flags] = regexp.match(/\/(.*)\/(.*)?/);
|
|
return handle.textContent.replace(/\s+/g, ' ').trim().match(new RegExp(pattern, flags)) !== null;
|
|
}
|
|
|
|
if (text !== null) {
|
|
return handle.textContent.replace(/\s+/g, ' ').trim().includes(text);
|
|
}
|
|
|
|
return false;
|
|
}, options, handle, text, regexp);
|
|
} catch (error) {
|
|
throw (0, _utils.enhanceError)(error, `Text not found "${matcher}"`);
|
|
}
|
|
}
|
|
|
|
var _default = toMatch;
|
|
exports.default = _default; |