From 7a6c1f2ee503619823931c999381ad9d66591754 Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Tue, 31 Aug 2021 12:29:48 +1000 Subject: [PATCH 1/3] Allow Site Title and Logo inside Navigation block. (#33316) * Allow Site Title and Logo inside Navigation block. * Fix space-between issue. * Include site title and logo in list of links * Fix php linting errors * Add navigation item class to list item wrappers. Co-authored-by: jasmussen --- packages/block-library/src/navigation/edit.js | 2 ++ packages/block-library/src/navigation/index.php | 10 +++++++--- packages/block-library/src/navigation/style.scss | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/block-library/src/navigation/edit.js b/packages/block-library/src/navigation/edit.js index 0f55e958e5b978..79e06d370460a2 100644 --- a/packages/block-library/src/navigation/edit.js +++ b/packages/block-library/src/navigation/edit.js @@ -46,6 +46,8 @@ const ALLOWED_BLOCKS = [ 'core/page-list', 'core/spacer', 'core/home-link', + 'core/site-title', + 'core/site-logo', ]; const LAYOUT = { diff --git a/packages/block-library/src/navigation/index.php b/packages/block-library/src/navigation/index.php index df93471feecbc6..68246111ffe0e4 100644 --- a/packages/block-library/src/navigation/index.php +++ b/packages/block-library/src/navigation/index.php @@ -256,15 +256,19 @@ function render_block_core_navigation( $attributes, $content, $block ) { $inner_blocks_html = ''; $is_list_open = false; foreach ( $inner_blocks as $inner_block ) { - if ( ( 'core/navigation-link' === $inner_block->name || 'core/home-link' === $inner_block->name ) && ! $is_list_open ) { + if ( ( 'core/navigation-link' === $inner_block->name || 'core/home-link' === $inner_block->name || 'core/site-title' === $inner_block->name || 'core/site-logo' === $inner_block->name ) && ! $is_list_open ) { $is_list_open = true; $inner_blocks_html .= ''; } - $inner_blocks_html .= $inner_block->render(); + if ( 'core/site-title' === $inner_block->name || 'core/site-logo' === $inner_block->name ) { + $inner_blocks_html .= '
  • ' . $inner_block->render() . '
  • '; + } else { + $inner_blocks_html .= $inner_block->render(); + } } if ( $is_list_open ) { diff --git a/packages/block-library/src/navigation/style.scss b/packages/block-library/src/navigation/style.scss index b96353903e7d6e..bfccc9cb142bf0 100644 --- a/packages/block-library/src/navigation/style.scss +++ b/packages/block-library/src/navigation/style.scss @@ -345,6 +345,7 @@ .items-justified-space-between .wp-block-navigation__container { justify-content: space-between; + flex: 1; } // Vertical justification. From 9506b08dead0bb5676a402706f2c0793e175f5fc Mon Sep 17 00:00:00 2001 From: Glen Davies Date: Tue, 31 Aug 2021 15:39:24 +1200 Subject: [PATCH 2/3] Remove IE specific CSS hacks from the gallery block css (#34372) Co-authored-by: Glen Davies --- .../block-library/src/gallery/deprecated.scss | 32 +++-------- packages/block-library/src/gallery/style.scss | 57 +++++-------------- 2 files changed, 21 insertions(+), 68 deletions(-) diff --git a/packages/block-library/src/gallery/deprecated.scss b/packages/block-library/src/gallery/deprecated.scss index c72fecd994fdea..e0503e991e2b38 100644 --- a/packages/block-library/src/gallery/deprecated.scss +++ b/packages/block-library/src/gallery/deprecated.scss @@ -29,27 +29,16 @@ figure { margin: 0; height: 100%; - - // IE doesn't support flex so omit that. - @supports (position: sticky) { - display: flex; - align-items: flex-end; - justify-content: flex-start; - } + display: flex; + align-items: flex-end; + justify-content: flex-start; } img { display: block; max-width: 100%; height: auto; - - // IE doesn't handle cropping, so we need an explicit width here. - width: 100%; - - // IE11 doesn't read rules inside this query. They are applied only to modern browsers. - @supports (position: sticky) { - width: auto; - } + width: auto; } figcaption { @@ -81,16 +70,9 @@ &.is-cropped .blocks-gallery-item { a, img { - // IE11 doesn't support object-fit, so just make sure images aren't skewed. - // The following rules are for all browsers. - width: 100%; - - // IE11 doesn't read rules inside this query. They are applied only to modern browsers. - @supports (position: sticky) { - height: 100%; - flex: 1; - object-fit: cover; - } + height: 100%; + flex: 1; + object-fit: cover; } } diff --git a/packages/block-library/src/gallery/style.scss b/packages/block-library/src/gallery/style.scss index e1e8300936b60e..9f2f59213f8af9 100644 --- a/packages/block-library/src/gallery/style.scss +++ b/packages/block-library/src/gallery/style.scss @@ -29,33 +29,20 @@ position: relative; margin-top: auto; margin-bottom: auto; - // IE11 doesn't like the "flex-direction: column;" here. - @supports ( position: sticky ) { - flex-direction: column; - } + flex-direction: column; > div, > a { margin: 0; - - // Avoid applying flex styles to IE11. - @supports ( position: sticky ) { - flex-direction: column; - flex-grow: 1; - } + flex-direction: column; + flex-grow: 1; } img { display: block; height: auto; max-width: 100%; - width: 100%; - - // IE doesn't handle cropping, so we need an explicit width here. - // IE11 doesn't read rules inside this query. They are applied only to modern browsers. - @supports ( position: sticky ) { - width: auto; - } + width: auto; } figcaption { @@ -80,22 +67,15 @@ &.is-style-rounded { > div, > a { - // Not supported in IE11. - @supports ( position: sticky ) { - flex: 1 1 auto; - } + flex: 1 1 auto; } figcaption { + flex: initial; background: none; - // Not supported in IE11. - @supports ( position: sticky ) { - flex: initial; - background: none; - color: inherit; - margin: 0; - padding: 10px 10px 9px; - position: relative; - } + color: inherit; + margin: 0; + padding: 10px 10px 9px; + position: relative; } } } @@ -127,24 +107,15 @@ align-self: inherit; > div:not(.components-drop-zone), > a { - display: block; // Thanks to IE11 not supporting object-fit fall back to display: block. - - // Without IE11 object-fit support "display: flex;" here causes distortion of aspect ratio. - @supports ( position: sticky ) { - display: flex; - } + display: flex; } a, img { width: 100%; - - // IE11 doesn't read rules inside this query. They are applied only to modern browsers. - @supports ( position: sticky ) { - flex: 1 0 0%; - height: 100%; - object-fit: cover; - } + flex: 1 0 0%; + height: 100%; + object-fit: cover; } } From 7c5cd026f624d9c39fb773b11d39557e6766ca7b Mon Sep 17 00:00:00 2001 From: Romario Date: Tue, 31 Aug 2021 00:52:10 -0500 Subject: [PATCH 3/3] Correct typo (#34396) Change `assing` to `assign` for `Object.assign` --- packages/blocks/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/blocks/README.md b/packages/blocks/README.md index ba65fdd0ac1832..aabe50096d62c3 100644 --- a/packages/blocks/README.md +++ b/packages/blocks/README.md @@ -142,7 +142,7 @@ add_action( 'enqueue_block_editor_assets', 'random_image_enqueue_block_editor_as return el( 'form', - Object.assing( blockProps, { onSubmit: setCategory } ), + Object.assign( blockProps, { onSubmit: setCategory } ), children ); },