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>
48 lines
1.2 KiB
JavaScript
48 lines
1.2 KiB
JavaScript
import { createElement } from "react";
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
import { MediaPlaceholder } from './styles/focal-point-picker-style';
|
|
import { isVideoType } from './utils';
|
|
export default function Media({
|
|
alt,
|
|
autoPlay,
|
|
src,
|
|
onLoad,
|
|
mediaRef,
|
|
// Exposing muted prop for test rendering purposes
|
|
// https://github.com/testing-library/react-testing-library/issues/470
|
|
muted = true,
|
|
...props
|
|
}) {
|
|
if (!src) {
|
|
return createElement(MediaPlaceholder, {
|
|
className: "components-focal-point-picker__media components-focal-point-picker__media--placeholder",
|
|
ref: mediaRef,
|
|
...props
|
|
});
|
|
}
|
|
const isVideo = isVideoType(src);
|
|
return isVideo ? createElement("video", {
|
|
...props,
|
|
autoPlay: autoPlay,
|
|
className: "components-focal-point-picker__media components-focal-point-picker__media--video",
|
|
loop: true,
|
|
muted: muted,
|
|
onLoadedData: onLoad,
|
|
ref: mediaRef,
|
|
src: src
|
|
}) : createElement("img", {
|
|
...props,
|
|
alt: alt,
|
|
className: "components-focal-point-picker__media components-focal-point-picker__media--image",
|
|
onLoad: onLoad,
|
|
ref: mediaRef,
|
|
src: src
|
|
});
|
|
}
|
|
//# sourceMappingURL=media.js.map
|