unfortunately I can test this in dev...
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 48s

This commit is contained in:
2025-06-10 21:41:57 +02:00
parent f38f6ce270
commit 41d7d4ffc6

View File

@@ -1,4 +1,11 @@
class PrefixedImageControl extends React.Component {
(function waitForCMSAndReact() {
if (!(window.CMS && window.React)) {
setTimeout(waitForCMSAndReact, 50);
return;
}
const React = window.React;
class PrefixedImageControl extends React.Component {
openMediaLibrary = () => {
this.props.mediaLibrary.open({
allowMultiple: false,
@@ -31,17 +38,18 @@ class PrefixedImageControl extends React.Component {
)
);
}
}
}
const PrefixedImageWidget = {
const PrefixedImageWidget = {
name: "prefixed-image",
controlComponent: PrefixedImageControl,
previewComponent: ({ value }) =>
value ? React.createElement("img", { src: value, alt: "", style: { maxWidth: "200px" } }) : null,
};
};
window.CMS.registerWidget(
window.CMS.registerWidget(
PrefixedImageWidget.name,
PrefixedImageWidget.controlComponent,
PrefixedImageWidget.previewComponent
);
);
})();