Skip to content

Commit 25033b8

Browse files
committed
Fix: added outline to image on select
1 parent 8889f48 commit 25033b8

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/components/controls/image.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ const ImageControls = () => {
1616
const onUpload = async (e) => {
1717
const f = e.target.files[0];
1818
if (!f) return;
19-
if (f.size > 300000) {
20-
alert("Image size should be less than 300kb");
19+
if (f.size > 1024000) {
20+
alert("Image size should be less than 1MB");
2121
return;
2222
}
2323
setFile(await toBase64(f));

src/components/workspace/elements/image.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export interface IImageProps extends IImage {
1111

1212
const Image: React.FC<IImageProps> = forwardRef(
1313
// eslint-disable-next-line @typescript-eslint/no-unused-vars
14-
({ x, y, id, href, width, height, consumer, isSelected: _, element: __, ...props }, ref: any) => {
14+
({ x, y, id, href, width, height, consumer, isSelected, element: _, ...props }, ref: any) => {
1515
return (
1616
<image
1717
ref={ref}
@@ -23,8 +23,9 @@ const Image: React.FC<IImageProps> = forwardRef(
2323
height={height}
2424
{...props}
2525
className={twMerge(
26-
props.className,
2726
"resizable fill-transparent object-cover",
27+
isSelected && "outline outline-2 outline-blue-500 -outline-offset-2",
28+
props.className,
2829
consumer.styles?.elements?.image?.base?.className
2930
)}
3031
preserveAspectRatio="none"

src/store/reducers/editor/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ export const slice = createSlice({
241241
state.location = name ?? state.location;
242242
state.sections = sections ? [noSection, ...sections] : state.sections;
243243
state.initialViewBoxScale = data.workspace?.initialViewBoxScale;
244+
state.initialViewBoxScaleForWidth = data.workspace?.initialViewBoxScaleForWidth;
244245
state.visibilityOffset = data.workspace?.visibilityOffset ?? state.visibilityOffset;
245246
Object.keys(data).forEach((key) => {
246247
state[key] = data[key] ?? state[key];

0 commit comments

Comments
 (0)