Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
fix: reset image url in inputs when users select a uploaded image after adding a remote url to the same. (#3512)
Jaya Krishna Namburuc1c43213c308
diff --git a/apps/builder/app/builder/features/style-panel/controls/image/image-control.tsx b/apps/builder/app/builder/features/style-panel/controls/image/image-control.tsxindex 01a045a421..d3a895e283 100644--- a/apps/builder/app/builder/features/style-panel/controls/image/image-control.tsx+++ b/apps/builder/app/builder/features/style-panel/controls/image/image-control.tsx@@ -36,6 +36,10 @@ export const ImageControl = ({if (styleValue?.type === "image" && styleValue.value.type === "url") {setRemoteImageURL({ type: "intermediate", value: styleValue.value.url });}++ if (styleValue?.type === "image" && styleValue.value.type === "asset") {+ setRemoteImageURL(undefined);+ }}, [styleValue]);if (styleValue === undefined) {diff --git a/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-image.tsx b/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-image.tsxindex 68cb860590..48fad38c99 100644--- a/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-image.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-image.tsx@@ -5,14 +5,17 @@ import {Flex,theme,InputErrorsTooltip,+ Label,+ Tooltip,+ Text,} from "@webstudio-is/design-system";import { useRef, useState, useEffect } from "react";import type { ControlProps } from "../../controls";-import { NonResetablePropertyName } from "../../shared/property-name";import { useStore } from "@nanostores/react";import { $assets } from "~/shared/nano-states";import { parseCssValue } from "@webstudio-is/css-data";import type { StyleUpdateOptions } from "../../shared/use-style-data";+import { InfoCircleIcon } from "@webstudio-is/icons";const property: StyleProperty = "backgroundImage";@@ -161,11 +164,24 @@ export const BackgroundImage = (gap: theme.spacing[3],}}>- <NonResetablePropertyName- style={props.currentStyle}- properties={[property]}- label="Image"- />+ <Label>+ <Flex align="center" gap="1">+ Code+ <Tooltip+ variant="wrapped"+ content={+ <Text>+ Paste a background-image CSS property value here. You can use+ the URL of an asset in your project or an external URL.+ <br /> <br />+ <Text variant="monoBold">url("image.jpg")</Text>+ </Text>+ }+ >+ <InfoCircleIcon />+ </Tooltip>+ </Flex>+ </Label><InputErrorsTooltip errors={errors}><TextArea