From f38f6ce270e1fec0108ecdf43ef8cae27fa43693 Mon Sep 17 00:00:00 2001 From: Benno Lorenz Date: Tue, 10 Jun 2025 21:36:59 +0200 Subject: [PATCH] fixed import and jsx --- static/admin/prefixed-image-widget.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/static/admin/prefixed-image-widget.js b/static/admin/prefixed-image-widget.js index ea17b6a..0f7d15b 100644 --- a/static/admin/prefixed-image-widget.js +++ b/static/admin/prefixed-image-widget.js @@ -1,5 +1,3 @@ -import React from "react"; - class PrefixedImageControl extends React.Component { openMediaLibrary = () => { this.props.mediaLibrary.open({ @@ -25,12 +23,12 @@ class PrefixedImageControl extends React.Component { render() { const value = this.props.value || ""; return ( -
- - {value && } -
+ React.createElement("div", null, + React.createElement("button", { type: "button", onClick: this.openMediaLibrary }, + value ? "Change Image" : "Add Image" + ), + value && React.createElement("img", { src: value, alt: "", style: { maxWidth: "200px", display: "block", marginTop: "1em" } }) + ) ); } } @@ -39,7 +37,7 @@ const PrefixedImageWidget = { name: "prefixed-image", controlComponent: PrefixedImageControl, previewComponent: ({ value }) => - value ? : null, + value ? React.createElement("img", { src: value, alt: "", style: { maxWidth: "200px" } }) : null, }; window.CMS.registerWidget(