diff --git a/changelog.txt b/changelog.txt index 09b5eb03b3ffa1..860f5601399889 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,243 @@ == Changelog == += 9.9.2 = + +### Bug fixes + +- Remove duplication of editor styles ([28837](https://github.com/WordPress/gutenberg/pull/28837)) +- Add useMergeRefs hook ([27768](https://github.com/WordPress/gutenberg/pull/27768)) (dependency of 28837) +- Cover: add missing align attr to deprecation ([28796](https://github.com/WordPress/gutenberg/pull/28796)) + += 9.9.1 = + +### Bug fixes + +- Global Styles: enqueue preset classes in the front-end. +- Global Styles: load styles in iframed site editor. + + += 9.9.0 = + +### Enhancements + +- Try more muted sibling inserter. ([28550](https://github.com/WordPress/gutenberg/pull/28550)) +- Make sure toggleProps doesn't replace important props on ToolbarGroup. ([28401](https://github.com/WordPress/gutenberg/pull/28401)) +- Improve visual clarity of reusable block. ([28318](https://github.com/WordPress/gutenberg/pull/28318)) +- Dark Theme Support: Allow for theme modifications. ([28233](https://github.com/WordPress/gutenberg/pull/28233)) +- Add disabled support in ToggleControl and FormToggle. ([28228](https://github.com/WordPress/gutenberg/pull/28228)) +- Show the spacer block background on hover. ([28129](https://github.com/WordPress/gutenberg/pull/28129)) +- Social Icons: Add icon & background color options. ([28084](https://github.com/WordPress/gutenberg/pull/28084)) +- Support both horizontal and vertical in-between inserters. ([27860](https://github.com/WordPress/gutenberg/pull/27860)) +- Image Block: Add border radius support. ([27667](https://github.com/WordPress/gutenberg/pull/27667)) +- Overlay on disabled elements, to catch events and show tooltips. ([27529](https://github.com/WordPress/gutenberg/pull/27529)) +- Try: System font for vanilla editor styles. ([26822](https://github.com/WordPress/gutenberg/pull/26822)) +- Only consider legal block types for the block list when transforming files to blocks. ([26816](https://github.com/WordPress/gutenberg/pull/26816)) + +### New APIs + +- Block API: Allow overriding the category for block variations. ([28482](https://github.com/WordPress/gutenberg/pull/28482)) +- Create Block: Add optional support for wp-env. ([28234](https://github.com/WordPress/gutenberg/pull/28234)) +- Make i18n functions filter their return values. ([27966](https://github.com/WordPress/gutenberg/pull/27966)) + +### Breaking Change + +The [format](https://developer.wordpress.org/block-editor/developers/themes/theme-json/) of the `experimental-theme.json` has been updated as per + +- Split global block selector into root and defaults. ([28533](https://github.com/WordPress/gutenberg/pull/28533)) +- Make settings and style top-level keys. ([28110](https://github.com/WordPress/gutenberg/pull/28110)) + +Before: + +```json +{ + "global": { + "settings": { ... }, + "styles": { ... } + }, + "core/paragraph": { + "settings": { ... }, + "styles": { ... } + } +} +``` + +After: + +```json +{ + "settings": { + "defaults": { ... }, + "root": { ... }, + "core/paragraph": { ... } + }, + "styles": { + "root": { ... }, + "core/paragraph": { ... } + } +} +``` + +### Bug Fixes + +- Fix sibling inserter color. ([28579](https://github.com/WordPress/gutenberg/pull/28579)) +- Fix issues causing the cover block to black out with a fixed background. ([28565](https://github.com/WordPress/gutenberg/pull/28565)) +- Fix site editor pins. ([28547](https://github.com/WordPress/gutenberg/pull/28547)) +- Resolve issue where insertion point is in incorrect position after changing block selection. ([28542](https://github.com/WordPress/gutenberg/pull/28542)) +- Components: Fix truncate export. ([28527](https://github.com/WordPress/gutenberg/pull/28527)) +- Pinned items regression followup. ([28526](https://github.com/WordPress/gutenberg/pull/28526)) +- Fix regression with pinned plugin items on mobile. ([28521](https://github.com/WordPress/gutenberg/pull/28521)) +- Fix margins and width of 100%-width buttons. ([28467](https://github.com/WordPress/gutenberg/pull/28467)) +- Fix regression caused by #28395. ([28462](https://github.com/WordPress/gutenberg/pull/28462)) +- Fix aborted rendering of non-nested reusable blocks. ([28461](https://github.com/WordPress/gutenberg/pull/28461)) +- Show insertion point after the last block in a container. ([28418](https://github.com/WordPress/gutenberg/pull/28418)) +- Reusable blocks: Prevent infinite recursion. ([28405](https://github.com/WordPress/gutenberg/pull/28405)) +- Fix block inserter automatic reorder. ([28392](https://github.com/WordPress/gutenberg/pull/28392)) +- Create Block: Extract the package name from the template value. ([28383](https://github.com/WordPress/gutenberg/pull/28383)) +- Fix handling of raw transforms that return multiple blocks. ([28371](https://github.com/WordPress/gutenberg/pull/28371)) +- Fix repeated backgrounds with transparent images. ([28362](https://github.com/WordPress/gutenberg/pull/28362)) +- Ensure inline image width popover doesn't appear over media library modal. ([28333](https://github.com/WordPress/gutenberg/pull/28333)) +- Fix bad var name in BlockParentSelector. ([28325](https://github.com/WordPress/gutenberg/pull/28325)) +- Fix repeated backgrounds for cover srcset. ([28310](https://github.com/WordPress/gutenberg/pull/28310)) +- Simple wording fix. ([28288](https://github.com/WordPress/gutenberg/pull/28288)) +- Fix allowedFormats in RichText component. ([28282](https://github.com/WordPress/gutenberg/pull/28282)) +- Fix file formatting for end-to-end test plugin. ([28266](https://github.com/WordPress/gutenberg/pull/28266)) +- Fix backwards compatibility issue with Inline Image format. ([28223](https://github.com/WordPress/gutenberg/pull/28223)) +- Inserter: Fix left padding on Block Pattern Inserter dropdown. ([28150](https://github.com/WordPress/gutenberg/pull/28150)) +- Fix toolbar keyboard navigation after pressing alt+F10. ([28068](https://github.com/WordPress/gutenberg/pull/28068)) +- Image Block: Update linkDestination when editing image link URL. ([27801](https://github.com/WordPress/gutenberg/pull/27801)) +- Fix for: [Interface Skeleton] Limit the editor width to prevent some blocks to grow infinitely wide. ([27695](https://github.com/WordPress/gutenberg/pull/27695)) +- Button component: Add margin around the dash icon. ([27461](https://github.com/WordPress/gutenberg/pull/27461)) +- Fix issue where resetBlocks can result in an incorrect block selection. ([21598](https://github.com/WordPress/gutenberg/pull/21598)) +- Fix Cover block position. ([28653](https://github.com/WordPress/gutenberg/pull/28653)) +- Add minHeightUnit to latest core/cover deprecation. ([28627](https://github.com/WordPress/gutenberg/pull/28627)) + +### Experiments + +- Try: Fix menu item word wrap. ([28516](https://github.com/WordPress/gutenberg/pull/28516)) +- Fix URL cutoff. ([28515](https://github.com/WordPress/gutenberg/pull/28515)) +- Mark Post Comments Warning as block. ([28511](https://github.com/WordPress/gutenberg/pull/28511)) +- Add widget id to blocks in the widgets screen. ([28379](https://github.com/WordPress/gutenberg/pull/28379)) +- Remove new navigation block features in the navigation editor. ([28378](https://github.com/WordPress/gutenberg/pull/28378)) +- Full Site Editing: Update theme attribute injection and removal. ([28368](https://github.com/WordPress/gutenberg/pull/28368)) +- Template Part - fix labels shown - use title instead of slug. ([28330](https://github.com/WordPress/gutenberg/pull/28330)) +- Root element & border radius. ([28320](https://github.com/WordPress/gutenberg/pull/28320)) +- FSE: Parse the template before
gets rendered. ([28319](https://github.com/WordPress/gutenberg/pull/28319)) +- Site Editor: Use correct title property in snackbar after inserting Template Part. ([28306](https://github.com/WordPress/gutenberg/pull/28306)) +- Edit Site: Fix templates export. ([28292](https://github.com/WordPress/gutenberg/pull/28292)) +- Hide query block toolbar settings if query is inherited. ([28290](https://github.com/WordPress/gutenberg/pull/28290)) +- Site Editor: Add template part missing state. ([28277](https://github.com/WordPress/gutenberg/pull/28277)) +- Site Editor: Hide resize handle. ([28272](https://github.com/WordPress/gutenberg/pull/28272)) +- Fix save, undo and redo keyboard shortcuts in navigation editor. ([28257](https://github.com/WordPress/gutenberg/pull/28257)) +- Fix template part border states. ([28241](https://github.com/WordPress/gutenberg/pull/28241)) +- Fix entity spotlight system. ([28239](https://github.com/WordPress/gutenberg/pull/28239)) +- Fix the nav menu justify controls menu style. ([28222](https://github.com/WordPress/gutenberg/pull/28222)) +- Polish the appender focus style. ([28219](https://github.com/WordPress/gutenberg/pull/28219)) +- Core Data: Add __experimentalBatch(). ([28210](https://github.com/WordPress/gutenberg/pull/28210)) +- Post Title block: Add placeholder state. ([28198](https://github.com/WordPress/gutenberg/pull/28198)) +- Fix navigation editor error. ([28190](https://github.com/WordPress/gutenberg/pull/28190)) +- Try: Allow space between on menu items. ([28169](https://github.com/WordPress/gutenberg/pull/28169)) +- Query pagination with InnerBlocks. ([28125](https://github.com/WordPress/gutenberg/pull/28125)) +- Template Parts: Fix loading issue. ([28088](https://github.com/WordPress/gutenberg/pull/28088)) +- Add support for border configuration via theme.json. ([28049](https://github.com/WordPress/gutenberg/pull/28049)) +- [Widgets screen] Fix categorization not showing in the global inserter. ([28036](https://github.com/WordPress/gutenberg/pull/28036)) +- Update the layout of the title in the top bar while template editing. ([27845](https://github.com/WordPress/gutenberg/pull/27845)) +- Expose group/ungroup buttons in site editor. ([27611](https://github.com/WordPress/gutenberg/pull/27611)) +- Disable alignment for innerBlocks of Nav Block. ([27365](https://github.com/WordPress/gutenberg/pull/27365)) +- Add thunk actions to replace rungen and controls. ([27276](https://github.com/WordPress/gutenberg/pull/27276)) +- Navigation Block: Placeholder empty state. ([26947](https://github.com/WordPress/gutenberg/pull/26947)) +- Open dropdown before focus on submenu item. ([25322](https://github.com/WordPress/gutenberg/pull/25322)) + +### Documentation + +- Docs: Add new page for i18n filters. ([28553](https://github.com/WordPress/gutenberg/pull/28553)) +- Docs: Update list of core block categories. ([28483](https://github.com/WordPress/gutenberg/pull/28483)) +- Fixed gramatical error. ([28452](https://github.com/WordPress/gutenberg/pull/28452)) +- Update the main readme with the current Gutenberg project phase. ([28359](https://github.com/WordPress/gutenberg/pull/28359)) +- Docs: Update links used in the developer portal. ([28354](https://github.com/WordPress/gutenberg/pull/28354)) +- Docs: Update links to reference HEAD instead of a specific branch. ([28331](https://github.com/WordPress/gutenberg/pull/28331)) +- Docs: Fix supports color gradient(s). ([28328](https://github.com/WordPress/gutenberg/pull/28328)) +- Chore: Add changelog for 28231. ([28232](https://github.com/WordPress/gutenberg/pull/28232)) +- Block Card: Update readme. ([28226](https://github.com/WordPress/gutenberg/pull/28226)) +- Improve the intro page of the Block Editor Handbook. ([28142](https://github.com/WordPress/gutenberg/pull/28142)) +- Update documentation to use allowedFormats instead of the deprecated formattingControls. ([25639](https://github.com/WordPress/gutenberg/pull/25639)) + +### Code Quality + +- Try: Polish block menu and show only fills when available. ([28486](https://github.com/WordPress/gutenberg/pull/28486)) +- Rename some template part icons. ([28458](https://github.com/WordPress/gutenberg/pull/28458)) +- Block Editor: Add hook: UseNoRecursiveRenders. ([28428](https://github.com/WordPress/gutenberg/pull/28428)) +- Coding Standards: Fix PHPCS warnings. ([28343](https://github.com/WordPress/gutenberg/pull/28343)) +- Change the way RTL styles get enqueued. ([28274](https://github.com/WordPress/gutenberg/pull/28274)) +- Remove code no longer necessary. ([28188](https://github.com/WordPress/gutenberg/pull/28188)) +- Update/simplify case transforms. ([28171](https://github.com/WordPress/gutenberg/pull/28171)) +- Fix non static method WP_Block_Parser::Freeform called statically. ([28017](https://github.com/WordPress/gutenberg/pull/28017)) +- Refactor out CSS gradient from custom-gradient-bar. ([27936](https://github.com/WordPress/gutenberg/pull/27936)) + +### Tools + +- Dependencies: Upgrade TypeScript. ([28586](https://github.com/WordPress/gutenberg/pull/28586)) +- ESLint Plugin: Add missing eslint-plugin-import dependency. ([28545](https://github.com/WordPress/gutenberg/pull/28545)) +- Wp-env: Add MySQL port info to start logs. ([28441](https://github.com/WordPress/gutenberg/pull/28441)) +- Run the load time indicator computation multiple times. ([28419](https://github.com/WordPress/gutenberg/pull/28419)) +- Don't add default-custom-properties styles to all compiled files. ([28395](https://github.com/WordPress/gutenberg/pull/28395)) +- Fix typewriter test by using mouse.wheel and waiting for scroll. ([28376](https://github.com/WordPress/gutenberg/pull/28376)) +- Fix end-to-end tests in widgets screen. ([28375](https://github.com/WordPress/gutenberg/pull/28375)) +- Replace deprecated waitFor in end-to-end tests. ([28360](https://github.com/WordPress/gutenberg/pull/28360)) +- Improve robustness of nav screen test. ([28344](https://github.com/WordPress/gutenberg/pull/28344)) +- Preferences modal redesign. ([28329](https://github.com/WordPress/gutenberg/pull/28329)) +- Site Editor: Add end-to-end tests for templates export. ([28324](https://github.com/WordPress/gutenberg/pull/28324)) +- Site Editor: Add unit test for site templates export. ([28323](https://github.com/WordPress/gutenberg/pull/28323)) +- Fix widgets screen end-to-end tests. ([28264](https://github.com/WordPress/gutenberg/pull/28264)) +- Add more tests for processing theme.json logic. ([28202](https://github.com/WordPress/gutenberg/pull/28202)) +- Update nosolosw notifs. ([28189](https://github.com/WordPress/gutenberg/pull/28189)) +- Remove @talldan from some codeowners paths. ([28182](https://github.com/WordPress/gutenberg/pull/28182)) +- Add stale issue workflow for issues with need info requested. ([28179](https://github.com/WordPress/gutenberg/pull/28179)) +- Custom script distclean to remove node_modules of all packages. ([28177](https://github.com/WordPress/gutenberg/pull/28177)) +- Add some basic end-to-end tests for the widgets screen. ([28160](https://github.com/WordPress/gutenberg/pull/28160)) +- Testing: Add CI workflow covering Node.js 12. ([28139](https://github.com/WordPress/gutenberg/pull/28139)) +- wp-env: Fix upload directory conflict in phpunit service. ([28120](https://github.com/WordPress/gutenberg/pull/28120)) +- Update issue templates. ([27570](https://github.com/WordPress/gutenberg/pull/27570)) + +### Various + +- Make custom spacing work with core. ([28548](https://github.com/WordPress/gutenberg/pull/28548)) +- Component System: Add Grid Component. ([28531](https://github.com/WordPress/gutenberg/pull/28531)) +- Block Validation: Allow unitless zero CSS lengths. ([28501](https://github.com/WordPress/gutenberg/pull/28501)) +- Add check for zero to the FocalPointPicker mediaRef which prevents a division by zero error. ([28499](https://github.com/WordPress/gutenberg/pull/28499)) +- Social Link: Add a class to the anchor element. ([28494](https://github.com/WordPress/gutenberg/pull/28494)) +- Components: Integrate G2 Text component. ([28475](https://github.com/WordPress/gutenberg/pull/28475)) +- Block Mover wording: 'Move block position' to 'Change block position'. ([28454](https://github.com/WordPress/gutenberg/pull/28454)) +- [Documentation] : Fixing grammar. ([28447](https://github.com/WordPress/gutenberg/pull/28447)) +- Docs: Update tree and raw-content links to reference HEAD instead of a specific branch. ([28431](https://github.com/WordPress/gutenberg/pull/28431)) +- Image: Add flow for converting to cover block from toolbar. ([28414](https://github.com/WordPress/gutenberg/pull/28414)) +- Cover: Improve various states. ([28384](https://github.com/WordPress/gutenberg/pull/28384)) +- Update HTML Anchor description to refer to block instead of heading. ([28367](https://github.com/WordPress/gutenberg/pull/28367)) +- Packages: Use canary flag for npm releases with next dist tag. ([28357](https://github.com/WordPress/gutenberg/pull/28357)) +- Packages: Fully automate npm publishing with the latest and next tags. ([28335](https://github.com/WordPress/gutenberg/pull/28335)) +- CODEOWNERS: Tweak for ella. ([28326](https://github.com/WordPress/gutenberg/pull/28326)) +- Block Transform: Fix isMultiBlock property name. ([28321](https://github.com/WordPress/gutenberg/pull/28321)) +- Warning component: Remove extra margin. ([28316](https://github.com/WordPress/gutenberg/pull/28316)) +- Block Directory: Silently avoid re-installing local blocks. ([28304](https://github.com/WordPress/gutenberg/pull/28304)) +- Inserter: Add description to content used in search. ([28301](https://github.com/WordPress/gutenberg/pull/28301)) +- Try: Show reusable block parent border when child selected. ([28283](https://github.com/WordPress/gutenberg/pull/28283)) +- Components: Update dependencies shared with G2 components. ([28280](https://github.com/WordPress/gutenberg/pull/28280)) +- Try: Zero width space in empty paragraph. ([28268](https://github.com/WordPress/gutenberg/pull/28268)) +- Alow setting the crossOrigin attribute for the image transform's image using a filter. ([28255](https://github.com/WordPress/gutenberg/pull/28255)) +- Navigation component: Fix button outline. ([28230](https://github.com/WordPress/gutenberg/pull/28230)) +- Components: Add truncate. ([28176](https://github.com/WordPress/gutenberg/pull/28176)) +- Add panel button props. ([28147](https://github.com/WordPress/gutenberg/pull/28147)) +- Add "Show block breadcrumbs" preference. ([28133](https://github.com/WordPress/gutenberg/pull/28133)) +- NavigationMenu component: Add isSearchDebouncing prop. ([28102](https://github.com/WordPress/gutenberg/pull/28102)) +- Try: Make empty paragraphs take up the same space on the frontend, as in the editor. ([27995](https://github.com/WordPress/gutenberg/pull/27995)) +- Change the block editor inserter quick inserter border color. ([27866](https://github.com/WordPress/gutenberg/pull/27866)) +- Save editors value on change. ([27717](https://github.com/WordPress/gutenberg/pull/27717)) +- Component System: Upgrade FontSizePicker. ([27594](https://github.com/WordPress/gutenberg/pull/27594)) +- Adjust borders on gallery to prevent overlap. ([27312](https://github.com/WordPress/gutenberg/pull/27312)) +- Pattern Directory: Create endpoints to proxy api.w.org/patterns. ([26578](https://github.com/WordPress/gutenberg/pull/26578)) +- Show text labels in block toolbars when option is set. ([26135](https://github.com/WordPress/gutenberg/pull/26135)) +- Block Directory: Filter out disallowed blocks before showing available blocks. ([25926](https://github.com/WordPress/gutenberg/pull/25926)) + + = 9.8.2 = ### Bug Fixes diff --git a/gutenberg.php b/gutenberg.php index a29903a341f3aa..731127c427f249 100644 --- a/gutenberg.php +++ b/gutenberg.php @@ -5,7 +5,7 @@ * Description: Printing since 1440. This is the development plugin for the new block editor in core. * Requires at least: 5.3 * Requires PHP: 5.6 - * Version: 9.8.2 + * Version: 9.9.2 * Author: Gutenberg Team * Text Domain: gutenberg * diff --git a/lib/class-wp-theme-json.php b/lib/class-wp-theme-json.php index 7a457e5d3941d7..51f1abf76d989c 100644 --- a/lib/class-wp-theme-json.php +++ b/lib/class-wp-theme-json.php @@ -991,7 +991,7 @@ private function get_block_styles() { $metadata = $this->get_blocks_metadata(); foreach ( $metadata as $block_selector => $metadata ) { - if ( empty( $metadata['selector'] ) || empty( $metadata['supports'] ) ) { + if ( empty( $metadata['selector'] ) ) { continue; } diff --git a/package-lock.json b/package-lock.json index 593b8323a19f60..bc641dec623547 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "gutenberg", - "version": "9.8.2", + "version": "9.9.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -11827,7 +11827,6 @@ "lodash": "^4.17.19", "memize": "^1.1.0", "react-autosize-textarea": "^7.1.0", - "react-merge-refs": "^1.0.0", "react-spring": "^8.0.19", "redux-multi": "^0.1.12", "rememo": "^3.0.0", @@ -11873,7 +11872,15 @@ "memize": "^1.1.0", "moment": "^2.22.1", "react-easy-crop": "^3.0.0", + "react-merge-refs": "^1.1.0", "tinycolor2": "^1.4.2" + }, + "dependencies": { + "react-merge-refs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/react-merge-refs/-/react-merge-refs-1.1.0.tgz", + "integrity": "sha512-alTKsjEL0dKH/ru1Iyn7vliS2QRcBp9zZPGoWxUOvRGWPUYgjo+V01is7p04It6KhgrzhJGnIj9GgX8W4bZoCQ==" + } } }, "@wordpress/block-serialization-default-parser": { @@ -11956,7 +11963,6 @@ "moment": "^2.22.1", "re-resizable": "^6.4.0", "react-dates": "^17.1.1", - "react-merge-refs": "^1.0.0", "react-resize-aware": "^3.1.0", "react-spring": "^8.0.20", "react-use-gesture": "^9.0.0", @@ -11980,7 +11986,6 @@ "lodash": "^4.17.19", "memize": "^1.1.0", "mousetrap": "^1.6.5", - "react-merge-refs": "^1.0.0", "react-resize-aware": "^3.1.0", "use-memo-one": "^1.1.1" } @@ -12199,7 +12204,6 @@ "classnames": "^2.2.5", "lodash": "^4.17.19", "memize": "^1.1.0", - "react-merge-refs": "^1.0.0", "rememo": "^3.0.0" } }, @@ -12421,6 +12425,7 @@ "requires": { "@babel/runtime": "^7.12.5", "@wordpress/components": "file:packages/components", + "@wordpress/compose": "file:packages/compose", "@wordpress/data": "file:packages/data", "@wordpress/deprecated": "file:packages/deprecated", "@wordpress/element": "file:packages/element", @@ -12429,8 +12434,7 @@ "@wordpress/plugins": "file:packages/plugins", "@wordpress/viewport": "file:packages/viewport", "classnames": "^2.2.5", - "lodash": "^4.17.19", - "react-merge-refs": "^1.0.0" + "lodash": "^4.17.19" } }, "@wordpress/is-shallow-equal": { @@ -47167,11 +47171,6 @@ "integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==", "dev": true }, - "react-merge-refs": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/react-merge-refs/-/react-merge-refs-1.0.0.tgz", - "integrity": "sha512-VkvWuCR5VoTjb+VYUcOjkFo66HDv1Hw8VjKcwQtWr2lJnT8g7epRRyfz8+Zkl2WhwqNeqR0gIe0XYrBa9ePeXg==" - }, "react-moment-proptypes": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/react-moment-proptypes/-/react-moment-proptypes-1.7.0.tgz", diff --git a/package.json b/package.json index 96df6b474a836e..5caecca7f73c90 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gutenberg", - "version": "9.8.2", + "version": "9.9.2", "private": true, "description": "A new WordPress editor experience.", "author": "The WordPress Contributors", diff --git a/packages/block-editor/package.json b/packages/block-editor/package.json index 0e755c2b46b4a8..d8c47dcf9426b1 100644 --- a/packages/block-editor/package.json +++ b/packages/block-editor/package.json @@ -60,7 +60,6 @@ "lodash": "^4.17.19", "memize": "^1.1.0", "react-autosize-textarea": "^7.1.0", - "react-merge-refs": "^1.0.0", "react-spring": "^8.0.19", "redux-multi": "^0.1.12", "rememo": "^3.0.0", diff --git a/packages/block-editor/src/components/editor-styles/index.js b/packages/block-editor/src/components/editor-styles/index.js index a017a764a173f9..0f873ba595990f 100644 --- a/packages/block-editor/src/components/editor-styles/index.js +++ b/packages/block-editor/src/components/editor-styles/index.js @@ -1,62 +1,57 @@ /** * External dependencies */ -import { compact, map } from 'lodash'; import tinycolor from 'tinycolor2'; /** * WordPress dependencies */ -import { useCallback, useRef } from '@wordpress/element'; +import { useCallback } from '@wordpress/element'; /** * Internal dependencies */ import transformStyles from '../../utils/transform-styles'; -function syncDarkThemeBodyClassname( node ) { - const backgroundColor = window - .getComputedStyle( node, null ) - .getPropertyValue( 'background-color' ); - - const { ownerDocument } = node; - const body = ownerDocument.getElementsByTagName( 'body' )[ 0 ]; - - if ( tinycolor( backgroundColor ).getLuminance() > 0.5 ) { - body.classList.remove( 'is-dark-theme' ); - } else { - body.classList.add( 'is-dark-theme' ); - } -} - -export default function useEditorStyles( styles ) { - const nodes = useRef( [] ); +const EDITOR_STYLES_SELECTOR = '.editor-styles-wrapper'; +function useDarkThemeBodyClassName( styles ) { return useCallback( ( node ) => { if ( ! node ) { - nodes.current.forEach( ( styleElement ) => - styleElement.ownerDocument.body.removeChild( styleElement ) - ); return; } - const updatedStyles = transformStyles( - styles, - '.editor-styles-wrapper' - ); - const { ownerDocument } = node; - nodes.current = map( compact( updatedStyles ), ( updatedCSS ) => { - const styleElement = ownerDocument.createElement( 'style' ); - styleElement.innerHTML = updatedCSS; - ownerDocument.body.appendChild( styleElement ); - - return styleElement; - } ); - - syncDarkThemeBodyClassname( node ); + const { defaultView, body } = ownerDocument; + const canvas = ownerDocument.querySelector( + EDITOR_STYLES_SELECTOR + ); + const backgroundColor = defaultView + .getComputedStyle( canvas, null ) + .getPropertyValue( 'background-color' ); + + if ( tinycolor( backgroundColor ).getLuminance() > 0.5 ) { + body.classList.remove( 'is-dark-theme' ); + } else { + body.classList.add( 'is-dark-theme' ); + } }, [ styles ] ); } + +export default function EditorStyles( { styles } ) { + return ( + <> + { /* Use an empty style element to have a document reference, + but this could be any element. */ } + + { transformStyles( styles, EDITOR_STYLES_SELECTOR ).map( + ( css, index ) => ( + + ) + ) } + > + ); +} diff --git a/packages/block-editor/src/components/iframe/index.js b/packages/block-editor/src/components/iframe/index.js index 1407ad0bdc73d1..dc581352c1c50c 100644 --- a/packages/block-editor/src/components/iframe/index.js +++ b/packages/block-editor/src/components/iframe/index.js @@ -1,8 +1,3 @@ -/** - * External dependencies - */ -import mergeRefs from 'react-merge-refs'; - /** * WordPress dependencies */ @@ -13,6 +8,7 @@ import { forwardRef, } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; +import { useMergeRefs } from '@wordpress/compose'; const BODY_CLASS_NAME = 'editor-styles-wrapper'; const BLOCK_PREFIX = 'wp-block'; @@ -136,7 +132,7 @@ function setHead( doc, head ) { '' + head; } -function Iframe( { contentRef, children, head, ...props }, ref ) { +function Iframe( { contentRef, children, head, headHTML, ...props }, ref ) { const [ iframeDocument, setIframeDocument ] = useState(); const setRef = useCallback( ( node ) => { @@ -146,19 +142,24 @@ function Iframe( { contentRef, children, head, ...props }, ref ) { function setDocumentIfReady() { const { contentDocument } = node; - const { readyState } = contentDocument; + const { readyState, body } = contentDocument; if ( readyState !== 'interactive' && readyState !== 'complete' ) { return false; } - contentRef.current = contentDocument.body; - setIframeDocument( contentDocument ); - setHead( contentDocument, head ); + if ( typeof contentRef === 'function' ) { + contentRef( body ); + } else if ( contentRef ) { + contentRef.current = body; + } + + setHead( contentDocument, headHTML ); setBodyClassName( contentDocument ); styleSheetsCompat( contentDocument ); bubbleEvents( contentDocument ); setBodyClassName( contentDocument ); + setIframeDocument( contentDocument ); return true; } @@ -176,12 +177,13 @@ function Iframe( { contentRef, children, head, ...props }, ref ) { return ( ); } diff --git a/packages/block-editor/src/components/index.js b/packages/block-editor/src/components/index.js index 2d92fe962aadef..6673cc4cc6bc01 100644 --- a/packages/block-editor/src/components/index.js +++ b/packages/block-editor/src/components/index.js @@ -95,7 +95,7 @@ export { useClipboardHandler as __unstableUseClipboardHandler, } from './copy-handler'; export { default as DefaultBlockAppender } from './default-block-appender'; -export { default as __unstableUseEditorStyles } from './editor-styles'; +export { default as __unstableEditorStyles } from './editor-styles'; export { default as Inserter } from './inserter'; export { default as __experimentalLibrary } from './inserter/library'; export { default as __experimentalSearchForm } from './inserter/search-form'; diff --git a/packages/block-library/CHANGELOG.md b/packages/block-library/CHANGELOG.md index 3a0624b02baa1f..29cb6c7cfd2517 100644 --- a/packages/block-library/CHANGELOG.md +++ b/packages/block-library/CHANGELOG.md @@ -6,6 +6,10 @@ - Allow setting the `crossOrigin` attribute so the `useTransformImage` hook can use cross-origin sources ([#28255](https://github.com/WordPress/gutenberg/pull/28255/)). +### Bug Fixes + +- Fix a regression where the Cover block migration would not work with custom units for `minHeight` ([#28627](https://github.com/WordPress/gutenberg/pull/28627)) + ## 2.27.0 (2020-12-17) ### Enhancement diff --git a/packages/block-library/package.json b/packages/block-library/package.json index 7ec7394a5d8988..64cdec7d410ce0 100644 --- a/packages/block-library/package.json +++ b/packages/block-library/package.json @@ -61,6 +61,7 @@ "memize": "^1.1.0", "moment": "^2.22.1", "react-easy-crop": "^3.0.0", + "react-merge-refs": "^1.1.0", "tinycolor2": "^1.4.2" }, "publishConfig": { diff --git a/packages/block-library/src/cover/deprecated.js b/packages/block-library/src/cover/deprecated.js index b214f3e0ce3ae0..d3f1588944c1b9 100644 --- a/packages/block-library/src/cover/deprecated.js +++ b/packages/block-library/src/cover/deprecated.js @@ -79,6 +79,9 @@ const deprecated = [ minHeight: { type: 'number', }, + minHeightUnit: { + type: 'string', + }, gradient: { type: 'string', }, @@ -86,6 +89,9 @@ const deprecated = [ type: 'string', }, }, + supports: { + align: true, + }, save( { attributes } ) { const { backgroundType, @@ -216,6 +222,9 @@ const deprecated = [ type: 'string', }, }, + supports: { + align: true, + }, save( { attributes } ) { const { backgroundType, @@ -319,6 +328,9 @@ const deprecated = [ type: 'string', }, }, + supports: { + align: true, + }, save( { attributes } ) { const { backgroundType, diff --git a/packages/block-library/src/embed/style.scss b/packages/block-library/src/embed/style.scss index 05b2f5f8081648..4099b1bda010f2 100644 --- a/packages/block-library/src/embed/style.scss +++ b/packages/block-library/src/embed/style.scss @@ -13,6 +13,12 @@ } } +// Supply a min-width when inside a cover block, to prevent it from collapsing. +.wp-block-cover .wp-block-embed { + min-width: 320px; + min-height: 240px; +} + .wp-block-embed { // Supply caption styles to embeds, even if the theme hasn't opted in. // Reason being: the new markup, figcaptions, are not likely to be styled in the majority of existing themes, diff --git a/packages/block-library/src/navigation/edit.js b/packages/block-library/src/navigation/edit.js index c22be04525c8cd..d6fbce8c4f1289 100644 --- a/packages/block-library/src/navigation/edit.js +++ b/packages/block-library/src/navigation/edit.js @@ -2,11 +2,12 @@ * External dependencies */ import classnames from 'classnames'; +import mergeRefs from 'react-merge-refs'; /** * WordPress dependencies */ -import { useState } from '@wordpress/element'; +import { useCallback, useMemo, useRef, useState } from '@wordpress/element'; import { InnerBlocks, __experimentalUseInnerBlocksProps as useInnerBlocksProps, @@ -29,6 +30,8 @@ import { justifyRight, justifySpaceBetween, } from '@wordpress/icons'; +import useAutohide from './use-autohide'; +import useMaxHeight from './use-max-height'; import NavigationPlaceholder from './placeholder'; import PlaceholderPreview from './placeholder-preview'; @@ -38,6 +41,7 @@ function Navigation( { setAttributes, clientId, hasExistingNavItems, + innerBlocks, isImmediateParentOfSelectedBlock, isSelected, updateInnerBlocks, @@ -57,13 +61,27 @@ function Navigation( { ! hasExistingNavItems ); + const navElement = useRef( null ); + const navItemsElement = useRef( null ); + const { selectBlock } = useDispatch( 'core/block-editor' ); + const autohideParams = useMemo( + () => [ clientId, innerBlocks, navItemsElement ], + [ innerBlocks ] + ); + const containerHeight = useMaxHeight( navItemsElement ); + const { isWrapping } = useAutohide( ...autohideParams ); + const blockProps = useBlockProps( { className: classnames( className, { [ `items-justified-${ attributes.itemsJustification }` ]: attributes.itemsJustification, 'is-vertical': attributes.orientation === 'vertical', + wrapping: isWrapping, } ), + style: { + height: containerHeight || 'auto', + }, } ); const { navigatorToolbarButton, navigatorModal } = useBlockNavigator( @@ -101,6 +119,15 @@ function Navigation( { } ); + const mergedNavRefs = useCallback( + mergeRefs( [ blockProps.ref, navElement ] ), + [ blockProps.ref, navElement ] + ); + const mergedInnerBlocksRefs = useCallback( + mergeRefs( [ innerBlocksProps.ref, navItemsElement ] ), + [ innerBlocksProps.ref, navItemsElement ] + ); + if ( isPlaceholderShown ) { return (