Skip to content

Commit c3e0a6a

Browse files
authored
fix: Do not show empty content blocks in preview mode (#4533)
## Description ref #3994 ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 0000) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file
1 parent c265185 commit c3e0a6a

File tree

1 file changed

+5
-1
lines changed
  • apps/builder/app/canvas/features/build-mode

1 file changed

+5
-1
lines changed

apps/builder/app/canvas/features/build-mode/block.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import * as React from "react";
1111
import {
1212
$instances,
1313
$isDesignMode,
14+
$isPreviewMode,
1415
$selectedInstanceSelector,
1516
} from "~/shared/nano-states";
1617

@@ -20,6 +21,7 @@ export const Block = React.forwardRef<
2021
>(({ children, ...props }, ref) => {
2122
const instances = useStore($instances);
2223
const isDesignMode = useStore($isDesignMode);
24+
const isPreviewMode = useStore($isPreviewMode);
2325
const instanceId = props[idAttribute];
2426
const instance = instances.get(instanceId);
2527
const selectedInstanceSelector = useStore($selectedInstanceSelector);
@@ -81,7 +83,9 @@ export const Block = React.forwardRef<
8183
return (
8284
<div ref={ref} style={editableBlockStyle} {...props}>
8385
{childArray}
84-
{hasContent ? null : <div>Editable block you can edit</div>}
86+
{hasContent || isPreviewMode ? null : (
87+
<div>Editable block you can edit</div>
88+
)}
8589
</div>
8690
);
8791
}) as AnyComponent;

0 commit comments

Comments
 (0)