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>
29 lines
743 B
JavaScript
29 lines
743 B
JavaScript
// Can unquote attribute detection
|
|
// Adopted implementation of Mathias Bynens
|
|
// https://github.com/mathiasbynens/mothereff.in/blob/master/unquoted-attributes/eff.js
|
|
const blockUnquoteRx = /^(-?\d|--)|[\u0000-\u002c\u002e\u002f\u003A-\u0040\u005B-\u005E\u0060\u007B-\u009f]/;
|
|
|
|
function canUnquote(value) {
|
|
if (value === '' || value === '-') {
|
|
return false;
|
|
}
|
|
|
|
return !blockUnquoteRx.test(value);
|
|
}
|
|
|
|
export default function(node) {
|
|
const attrValue = node.value;
|
|
|
|
if (!attrValue || attrValue.type !== 'String') {
|
|
return;
|
|
}
|
|
|
|
if (canUnquote(attrValue.value)) {
|
|
node.value = {
|
|
type: 'Identifier',
|
|
loc: attrValue.loc,
|
|
name: attrValue.value
|
|
};
|
|
}
|
|
};
|