Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor Canvas: Fix animation when device type changes #56970

Merged
merged 3 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# useResizeCanvas

This React hook generates inline CSS suitable for resizing a container to fit a device's dimensions. It adjusts the CSS according to the current device dimensions. It has no effect on desktop.
This React hook generates inline CSS suitable for resizing a container to fit a device's dimensions. It adjusts the CSS according to the current device dimensions.

On-page CSS media queries are also updated to match the width of the device.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ export default function useResizeCanvas( deviceType ) {
overflowY: 'auto',
};
default:
return null;
return {
marginLeft: marginHorizontal,
marginRight: marginHorizontal,
};
}
};

Expand Down
5 changes: 4 additions & 1 deletion packages/editor/src/components/editor-canvas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,10 @@ function EditorCanvas(
height="100%"
iframeProps={ {
...iframeProps,
style: { ...iframeProps?.style, ...deviceStyles },
style: {
...iframeProps?.style,
...deviceStyles,
},
} }
>
{ themeSupportsLayout &&
Expand Down
Loading