Skip to content

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.

fix: Fix reset on gap icons (#4908)

Oleg Isonena8146c5493d3
diff --git a/apps/builder/app/builder/features/style-panel/sections/layout/layout.tsx b/apps/builder/app/builder/features/style-panel/sections/layout/layout.tsx
index 086f241acc..6f31b175ff 100644
--- a/apps/builder/app/builder/features/style-panel/sections/layout/layout.tsx
+++ b/apps/builder/app/builder/features/style-panel/sections/layout/layout.tsx
@@ -94,12 +94,13 @@ const GapTooltip = ({
// prevent closing tooltip on content click
onPointerDown={(event) => event.preventDefault()}
triggerProps={{
- onClick: (event) => {
+ onClick(event) {
if (event.altKey) {
event.preventDefault();
onReset();
return;
}
+ setIsOpen(true);
},
}}
content={
diff --git a/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.tsx b/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.tsx
index 092519209d..97ae60c8fc 100644
--- a/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.tsx
+++ b/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.tsx
@@ -35,6 +35,7 @@ import {
useState,
useMemo,
type ComponentProps,
+ type RefObject,
} from "react";
import { useUnitSelect, type UnitOption } from "./unit-select";
import { parseIntermediateOrInvalidValue } from "./parse-intermediate-or-invalid-value";
@@ -99,11 +100,11 @@ const useScrub = ({
onAbort: () => void;
shouldHandleEvent?: (node: Node) => boolean;
}): [
- React.RefObject<HTMLDivElement | null>,
- React.RefObject<HTMLInputElement | null>,
+ RefObject<HTMLInputElement | null>,
+ RefObject<HTMLInputElement | null>,
] => {
- const scrubRef = useRef<HTMLDivElement | null>(null);
- const inputRef = useRef<HTMLInputElement | null>(null);
+ const scrubRef = useRef<HTMLInputElement>(null);
+ const inputRef = useRef<HTMLInputElement>(null);
const onChangeRef = useRef(onChange);
const onChangeCompleteRef = useRef(onChangeComplete);
@@ -991,8 +992,11 @@ export const CssValueInput = ({
autoFocus={autoFocus}
onBlur={handleOnBlur}
onKeyDown={inputPropsHandleKeyDown}
- containerRef={disabled ? undefined : scrubRef}
- inputRef={mergeRefs(inputRef, props.inputRef ?? null)}
+ inputRef={mergeRefs(
+ inputRef,
+ props.inputRef,
+ disabled ? undefined : scrubRef
+ )}
name={property}
color={value.type === "invalid" ? "error" : undefined}
prefix={finalPrefix}