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.

support alt/shift keyboard increments, lock tooltip

Sultan23facb30431c
diff --git a/apps/designer/app/designer/features/style-panel/controls/text/text-control.tsx b/apps/designer/app/designer/features/style-panel/controls/text/text-control.tsx
index 0caaee7a7b..c3315d7eca 100644
--- a/apps/designer/app/designer/features/style-panel/controls/text/text-control.tsx
+++ b/apps/designer/app/designer/features/style-panel/controls/text/text-control.tsx
@@ -79,7 +79,7 @@ export const TextControl = ({
>
<Tooltip
content={styleConfig.label}
- delayDuration={700 / 4}
+ delayDuration={200}
disableHoverableContent={true}
>
<IconButton
@@ -123,9 +123,23 @@ export const TextControl = ({
onFocus={(event: FocusEvent<HTMLInputElement>) => event.target.select()}
onKeyDown={(event: KeyboardEvent<HTMLInputElement>) => {
if (value.type !== "unit") return;
+ if (!["ArrowUp", "ArrowDown"].includes(event.code)) return;
event.preventDefault();
- if (event.code === "ArrowUp") setValue(String(value.value + 1));
- if (event.code === "ArrowDown") setValue(String(value.value - 1));
+ let currentValue = value.value;
+ let currentDelta = 1;
+ if (event.shiftKey) currentDelta = 10;
+ if (event.altKey) currentDelta = 0.1;
+ if (event.code === "ArrowUp")
+ currentValue = currentValue + currentDelta;
+ if (event.code === "ArrowDown")
+ currentValue = currentValue - currentDelta;
+ const currentValueAsString =
+ currentValue % 1
+ ? currentValue.toPrecision(
+ Math.abs(currentValue).toString().indexOf(".") + 2
+ )
+ : String(currentValue);
+ setValue(currentValueAsString);
}}
/>
{value.type === "unit" ? (
diff --git a/apps/designer/app/designer/features/style-panel/shared/lock.tsx b/apps/designer/app/designer/features/style-panel/shared/lock.tsx
index 2b6486d6ac..09109bde07 100644
--- a/apps/designer/app/designer/features/style-panel/shared/lock.tsx
+++ b/apps/designer/app/designer/features/style-panel/shared/lock.tsx
@@ -1,5 +1,5 @@
import { useState, useEffect } from "react";
-import { IconButton } from "@webstudio-is/design-system";
+import { IconButton, Tooltip } from "@webstudio-is/design-system";
import { LockOpenIcon, LockCloseIcon } from "@webstudio-is/icons";
import type { Style } from "@webstudio-is/react-sdk";
import type { CreateBatchUpdate } from "./use-style-data";
@@ -30,12 +30,18 @@ export const Lock = ({
}, [batchUpdate, isPaired, aKey, bKey, aVal, bVal]);
return (
- <IconButton
- data-property={name}
- css={{ width: "100%", gridArea: name }}
- onClick={() => setIsPaired((value) => !value)}
+ <Tooltip
+ content={isPaired ? "Locked" : "Unlocked"}
+ delayDuration={400}
+ disableHoverableContent={true}
>
- {isPaired ? <LockCloseIcon /> : <LockOpenIcon />}
- </IconButton>
+ <IconButton
+ data-property={name}
+ css={{ width: "100%", gridArea: name }}
+ onClick={() => setIsPaired((value) => !value)}
+ >
+ {isPaired ? <LockCloseIcon /> : <LockOpenIcon />}
+ </IconButton>
+ </Tooltip>
);
};
diff --git a/packages/design-system/src/components/icon-button-with-menu.tsx b/packages/design-system/src/components/icon-button-with-menu.tsx
index 7176296eca..c55280c547 100644
--- a/packages/design-system/src/components/icon-button-with-menu.tsx
+++ b/packages/design-system/src/components/icon-button-with-menu.tsx
@@ -94,7 +94,7 @@ export const IconButtonWithMenu = ({
<DropdownMenuPrimitive.Root modal={false}>
<Tooltip
content={label}
- delayDuration={700 * 2}
+ delayDuration={400}
disableHoverableContent={true}
>
<DropdownMenuPrimitive.Trigger asChild>