From e117993b7f8f8ecf6f49ad171bc4d10121131c63 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Wed, 23 Jan 2019 08:48:04 +0100 Subject: [PATCH] Fix HTML preview for themes applying global margins (#13416) --- packages/block-library/src/html/edit.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/block-library/src/html/edit.js b/packages/block-library/src/html/edit.js index d9bbe4e07211f3..44aa79544415b5 100644 --- a/packages/block-library/src/html/edit.js +++ b/packages/block-library/src/html/edit.js @@ -20,7 +20,22 @@ class HTMLEdit extends Component { componentDidMount() { const { styles } = this.props; - this.setState( { styles: transformStyles( styles ) } ); + + // Default styles used to unset some of the styles + // that might be inherited from the editor style. + const defaultStyles = ` + html,body,:root { + margin: 0 !important; + padding: 0 !important; + overflow: visible !important; + min-height: auto !important; + } + `; + + this.setState( { styles: [ + defaultStyles, + ...transformStyles( styles ), + ] } ); } switchToPreview() {