From 82afb917abb8a0aab25944dfe04e0a00526e8811 Mon Sep 17 00:00:00 2001 From: Ivan Ramljak Date: Thu, 7 Nov 2024 16:06:10 +0100 Subject: [PATCH 1/6] Fix image responsive breakpoints render Co-authored-by: goran.alkovic@infinum.com --- blocks/init/src/Blocks/components/image/image.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/blocks/init/src/Blocks/components/image/image.php b/blocks/init/src/Blocks/components/image/image.php index 215e047..28ebca5 100644 --- a/blocks/init/src/Blocks/components/image/image.php +++ b/blocks/init/src/Blocks/components/image/image.php @@ -22,10 +22,10 @@ $imageAlt = get_post_meta($imageData['_default']['id'], '_wp_attachment_image_alt', true) ?? ''; -$isMobileFirst = $imageData['_desktopFirst'] ?? false; +$isDesktopFirst = $imageData['_desktopFirst'] ?? false; $breakpointData = Helpers::getSettingsGlobalVariablesBreakpoints(); -$breakpoints = Helpers::getTwBreakpoints($isMobileFirst); +$breakpoints = Helpers::getTwBreakpoints(); ?> '; + echo ''; ?> @@ -60,3 +60,4 @@ class="" class="" /> + From e76150013f2d3237a5d9d0b19ce83665bfbc8c48 Mon Sep 17 00:00:00 2001 From: Ivan Ramljak Date: Thu, 7 Nov 2024 22:43:53 +0100 Subject: [PATCH 2/6] Update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c135ec..365ea48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a --- +## [1.4.5] + +### Fixed + +- Image responsive breakpoints render order in the frontend. + ## [1.4.4] ### Added From bf396eaaf8b4ad19e2a8191fbc3a214831179663 Mon Sep 17 00:00:00 2001 From: Ivan Ramljak Date: Thu, 7 Nov 2024 22:46:11 +0100 Subject: [PATCH 3/6] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7681eb1..c3a828a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@eightshift/frontend-libs-tailwind", - "version": "1.4.4", + "version": "1.4.5", "description": "A framework for creating modern Gutenberg themes with styling provided by Tailwind CSS.", "author": { "name": "Eightshift team", From 5bd2f970b080ce759729fe21f0ad245b2fb716af Mon Sep 17 00:00:00 2001 From: Ivan Ramljak Date: Fri, 8 Nov 2024 13:30:22 +0100 Subject: [PATCH 4/6] Forecast next release compare URL --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 365ea48..e568d39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -148,6 +148,7 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a - Initial release. [Unreleased]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/master...HEAD +[1.4.5]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.4.4...1.4.5 [1.4.4]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.4.3...1.4.4 [1.4.3]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.4.2...1.4.3 [1.4.2]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.4.1...1.4.2 From c4ef708a1232c293cab0fe459671659dca9ba8d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Goran=20Alkovi=C4=87?= <77000136+goranalkovic-infinum@users.noreply.github.com> Date: Fri, 8 Nov 2024 17:18:22 +0100 Subject: [PATCH 5/6] tweak BlockInserter behavior --- scripts/components/block-inserter.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/scripts/components/block-inserter.js b/scripts/components/block-inserter.js index f39a5d0..3b146cd 100644 --- a/scripts/components/block-inserter.js +++ b/scripts/components/block-inserter.js @@ -1,6 +1,7 @@ import React from 'react'; import { __, sprintf } from '@wordpress/i18n'; import { Inserter } from '@wordpress/block-editor'; +import { useSuspenseSelect } from '@wordpress/data'; import { Button } from '@eightshift/ui-components'; import { icons } from '@eightshift/ui-components/icons'; import { clsx } from '@eightshift/ui-components/utilities'; @@ -15,6 +16,7 @@ import { clsx } from '@eightshift/ui-components/utilities'; * @param {boolean} [props.small] - If `true`, the button's size is reduced, perfect for added visual separation in hierarchical InnerBlocks. * @param {string} [props.className] - Additional classes to add to the control base. * @param {boolean} [props.prioritizePatterns] - Whether to show patterns before blocks in the inserter. + * @param {boolean} [props.alwaysVisible=false] - If `true`, the inserter is always visible, regardless of whether the block is selected. * @param {boolean} [props.hidden] - If `true`, the component is not rendered. * * @returns {JSX.Element} The BlockInserter component. @@ -25,12 +27,26 @@ import { clsx } from '@eightshift/ui-components/utilities'; * @preserve */ export const BlockInserter = (props) => { - const { clientId, label, small = false, className, prioritizePatterns = false, hidden } = props; + const { + clientId, + label, + small = false, + className, + prioritizePatterns = false, + alwaysVisible = false, + hidden, + } = props; + + const currentBlockClientId = useSuspenseSelect((select) => select('core/block-editor')?.getSelectedBlockClientId()); if (hidden) { return null; } + if (!alwaysVisible && currentBlockClientId !== clientId) { + return null; + } + return ( Date: Fri, 8 Nov 2024 17:19:09 +0100 Subject: [PATCH 6/6] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e568d39..05c2710 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a ## [1.4.5] +### Changed + +- `BlockInserter` is now only visible when the block it's assigned to is selected. This behavior can be changed by setting `alwaysVisible`. + ### Fixed - Image responsive breakpoints render order in the frontend.