unfortunately I can test this in dev...
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 48s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 48s
This commit is contained in:
@@ -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 = () => {
|
openMediaLibrary = () => {
|
||||||
this.props.mediaLibrary.open({
|
this.props.mediaLibrary.open({
|
||||||
allowMultiple: false,
|
allowMultiple: false,
|
||||||
@@ -31,17 +38,18 @@ class PrefixedImageControl extends React.Component {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const PrefixedImageWidget = {
|
const PrefixedImageWidget = {
|
||||||
name: "prefixed-image",
|
name: "prefixed-image",
|
||||||
controlComponent: PrefixedImageControl,
|
controlComponent: PrefixedImageControl,
|
||||||
previewComponent: ({ value }) =>
|
previewComponent: ({ value }) =>
|
||||||
value ? React.createElement("img", { src: value, alt: "", style: { maxWidth: "200px" } }) : null,
|
value ? React.createElement("img", { src: value, alt: "", style: { maxWidth: "200px" } }) : null,
|
||||||
};
|
};
|
||||||
|
|
||||||
window.CMS.registerWidget(
|
window.CMS.registerWidget(
|
||||||
PrefixedImageWidget.name,
|
PrefixedImageWidget.name,
|
||||||
PrefixedImageWidget.controlComponent,
|
PrefixedImageWidget.controlComponent,
|
||||||
PrefixedImageWidget.previewComponent
|
PrefixedImageWidget.previewComponent
|
||||||
);
|
);
|
||||||
|
})();
|
||||||
Reference in New Issue
Block a user