diff --git a/changelog.txt b/changelog.txt index 7dd4097cad1aee..a8e1c97339697f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,177 @@ == Changelog == += 11.0.0-rc.1 = + + + +### Enhancements + +- Polish block manager search. ([32922](https://github.com/WordPress/gutenberg/pull/32922)) +- Allow left/right/center alignments when a layout is defined. ([32810](https://github.com/WordPress/gutenberg/pull/32810)) +- [Block Library - Query Loop]: Select first Query Loop found from pattern selection. ([32737](https://github.com/WordPress/gutenberg/pull/32737)) +- Remove the widget switcher block toolbar button. ([32733](https://github.com/WordPress/gutenberg/pull/32733)) +- Block categories: Clean these up by moving several blocks from Design to Theme. ([32568](https://github.com/WordPress/gutenberg/pull/32568)) +- Allow longhand and shorthand properties in `theme.json` and block attributes. ([31641](https://github.com/WordPress/gutenberg/pull/31641)) +- Media & Text: Allow drag n drop media replacement. ([29710](https://github.com/WordPress/gutenberg/pull/29710)) + +### New APIs + +- Allow making context specific requests using the data module. ([32961](https://github.com/WordPress/gutenberg/pull/32961)) +- Add an API to define the default template used for the template mode. ([32771](https://github.com/WordPress/gutenberg/pull/32771)) + +### Bug Fixes + +- Fix flaky widgets-related end-to-end tests. ([33066](https://github.com/WordPress/gutenberg/pull/33066)) +- Remove "is-dark-theme" rules from mixins. ([33058](https://github.com/WordPress/gutenberg/pull/33058)) +- Group Block: Avoid rendering the layout configuration twice. ([33045](https://github.com/WordPress/gutenberg/pull/33045)) +- [Block Library - Query Loop] Fix race condition for making Post blocks inside uneditable. ([33037](https://github.com/WordPress/gutenberg/pull/33037)) +- Fix switcher focus style. ([33031](https://github.com/WordPress/gutenberg/pull/33031)) +- Fix drag and drop indicator above first block and RTL drop indicators. ([33024](https://github.com/WordPress/gutenberg/pull/33024)) +- Button: Update to use border support provided styles and classes. ([33017](https://github.com/WordPress/gutenberg/pull/33017)) +- [Block Library - Categories]: Fix handling for low privileged users. ([32994](https://github.com/WordPress/gutenberg/pull/32994)) +- [Block Library - Categories]: Fix crash when trying to access categories on insertion. ([32989](https://github.com/WordPress/gutenberg/pull/32989)) +- Fix to remove default indent from Latest Posts and Latest Comments block in various editors. ([32983](https://github.com/WordPress/gutenberg/pull/32983)) +- Avoid adding default block to empty widget areas in customizer. ([32979](https://github.com/WordPress/gutenberg/pull/32979)) +- Add custom classes to archive dropdown. ([32971](https://github.com/WordPress/gutenberg/pull/32971)) +- [Block Library - Post Terms]: Fix handling for low privileged users. ([32947](https://github.com/WordPress/gutenberg/pull/32947)) +- Fix: Template editor header area is difficult to navigate with screenreaders. ([32938](https://github.com/WordPress/gutenberg/pull/32938)) +- Fix glitchy block focus style when multiselecting blocks. ([32927](https://github.com/WordPress/gutenberg/pull/32927)) +- Fix a regression where `custom-units` are forced as an array. ([32898](https://github.com/WordPress/gutenberg/pull/32898)) +- Fix collapsing appender when paragraph disabled. ([32894](https://github.com/WordPress/gutenberg/pull/32894)) +- Fix unintended search http request in . ([32857](https://github.com/WordPress/gutenberg/pull/32857)) +- CI: Recursively clear node modules when building for ci. ([32856](https://github.com/WordPress/gutenberg/pull/32856)) +- Fixed a problem with double encoding of URLs. ([32840](https://github.com/WordPress/gutenberg/pull/32840)) +- Fix incorrect block insertion point after blurring post title. ([32831](https://github.com/WordPress/gutenberg/pull/32831)) +- RNMobile: Fix column wrapping. ([32830](https://github.com/WordPress/gutenberg/pull/32830)) +- [Block Library - Site Title, Site Tagline] - Readonly view when user has no the right permissions. ([32817](https://github.com/WordPress/gutenberg/pull/32817)) +- useNavigateRegions: Don't remove click event if there's no element. ([32816](https://github.com/WordPress/gutenberg/pull/32816)) +- Block Library: Unify handling for block view scripts. ([32814](https://github.com/WordPress/gutenberg/pull/32814)) +- Do not allow users to create templates with blank titles. ([32809](https://github.com/WordPress/gutenberg/pull/32809)) +- Remove @wordpress/editor as a dependency from @wordpress/block-library. ([32801](https://github.com/WordPress/gutenberg/pull/32801)) +- Fix drag and drop indices when block list contains a style element. ([32776](https://github.com/WordPress/gutenberg/pull/32776)) +- Customize Widgets: Fix block toolbar deselection when clicking scrollbar. ([32762](https://github.com/WordPress/gutenberg/pull/32762)) +- Fix apparent overflow in Customizer caused by widgets editor. ([32749](https://github.com/WordPress/gutenberg/pull/32749)) +- components: Stop modifying the parent context and correctly memoize it. ([32745](https://github.com/WordPress/gutenberg/pull/32745)) +- TemplatePanel: Fixed a problem that when a new template is created, the template is not displayed in the select box. ([32744](https://github.com/WordPress/gutenberg/pull/32744)) +- Clear event listeners on unmount in Tooltip component. ([32729](https://github.com/WordPress/gutenberg/pull/32729)) +- Fix: Allow decimals in spacing controls. ([32692](https://github.com/WordPress/gutenberg/pull/32692)) +- Ensure only valid URLs or anchors within text are automatically created as links. ([32663](https://github.com/WordPress/gutenberg/pull/32663)) +- [Image Block]: Fix block validation errors when clearing height/width. ([32524](https://github.com/WordPress/gutenberg/pull/32524)) +- Fix scroll jitter in Customize Widgets. ([32479](https://github.com/WordPress/gutenberg/pull/32479)) +- Image Block: Correctly set image size slug. ([32364](https://github.com/WordPress/gutenberg/pull/32364)) +- Fix: Adding buttons should respect the preferred style. ([31089](https://github.com/WordPress/gutenberg/pull/31089)) + +### Experiments + +- Navigation: Skip flakey tests. ([33074](https://github.com/WordPress/gutenberg/pull/33074)) +- Adjust widget form margins in the new widget editor. ([33040](https://github.com/WordPress/gutenberg/pull/33040)) +- Set display only when form not hidden. ([33015](https://github.com/WordPress/gutenberg/pull/33015)) +- Widgets: Fix creating and editing non-multi widgets. ([32978](https://github.com/WordPress/gutenberg/pull/32978)) +- Fix wide widget styles to allow floated contents. ([32976](https://github.com/WordPress/gutenberg/pull/32976)) +- Adjust legacy widget form styles to match editor. ([32974](https://github.com/WordPress/gutenberg/pull/32974)) +- Improve insertion point and drag-n-drop in the widgets screen. ([32953](https://github.com/WordPress/gutenberg/pull/32953)) +- Widget Editor: Fix allow adding same image twice. ([32951](https://github.com/WordPress/gutenberg/pull/32951)) +- [Block Library - Site Logo]: Add permissions handling. ([32919](https://github.com/WordPress/gutenberg/pull/32919)) +- Navigation: Update the function name and correct the comment. ([32918](https://github.com/WordPress/gutenberg/pull/32918)) +- Stretch Widgets editor layout to full height. ([32905](https://github.com/WordPress/gutenberg/pull/32905)) +- Don't display admin notices on widgets screen. ([32877](https://github.com/WordPress/gutenberg/pull/32877)) +- Fix legacy widget edit style bleed. ([32871](https://github.com/WordPress/gutenberg/pull/32871)) +- Rename .interface-interface-skeleton__body z-index to .interface-interface-skeleton__content. ([32869](https://github.com/WordPress/gutenberg/pull/32869)) +- Legacy custom html widget should have option to transform to custom html block. ([32862](https://github.com/WordPress/gutenberg/pull/32862)) +- Wire handle_legacy_widget_preview_iframe to admin_init_hook. ([32854](https://github.com/WordPress/gutenberg/pull/32854)) +- Remove classic block in widgets editor. ([32800](https://github.com/WordPress/gutenberg/pull/32800)) +- Fix: Logic error on site editor useSetting. ([32793](https://github.com/WordPress/gutenberg/pull/32793)) +- Widget preivew not working if widget registered via a instance. ([32781](https://github.com/WordPress/gutenberg/pull/32781)) +- Disable "FSE" blocks in Widgets Editor. ([32761](https://github.com/WordPress/gutenberg/pull/32761)) +- Update filter in Widget Block Editor documentation. ([32759](https://github.com/WordPress/gutenberg/pull/32759)) +- Widgets editor: Display shortcuts for navigating regions. ([32757](https://github.com/WordPress/gutenberg/pull/32757)) +- Set explicit z-index on interface body to ensure it’s pinned under interface header. ([32732](https://github.com/WordPress/gutenberg/pull/32732)) +- Fix widgets background when loading theme styles. ([32683](https://github.com/WordPress/gutenberg/pull/32683)) +- Navigation block: Add an unstable location attribute. ([32491](https://github.com/WordPress/gutenberg/pull/32491)) +- Fix oembeds not working in block template parts. ([32331](https://github.com/WordPress/gutenberg/pull/32331)) +- Global Styles: Allow custom properties to merge. ([31840](https://github.com/WordPress/gutenberg/pull/31840)) +- Add post-classes in the loop. ([30497](https://github.com/WordPress/gutenberg/pull/30497)) + +### Documentation + +- ServerSideRender: Update documentation for placeholder props. ([33030](https://github.com/WordPress/gutenberg/pull/33030)) +- Add some technical implementation details for Widgets Customizer. ([33026](https://github.com/WordPress/gutenberg/pull/33026)) +- Docs: Add link color suppots to Block API documentation. ([32936](https://github.com/WordPress/gutenberg/pull/32936)) +- Add a schema explaining the relationship between the packages that make the post editor. ([32921](https://github.com/WordPress/gutenberg/pull/32921)) +- Handbook: Polish the Gutenberg release docs, performance audit section. ([32770](https://github.com/WordPress/gutenberg/pull/32770)) +- Fix abort error thrown by `api-fetch` and add documentation. ([32530](https://github.com/WordPress/gutenberg/pull/32530)) +- Update the block toolbar ESnext code. ([32422](https://github.com/WordPress/gutenberg/pull/32422)) +- Unify Block Editor readme language and example. ([31850](https://github.com/WordPress/gutenberg/pull/31850)) + +### Code Quality + +- data: Type `promise-middleware`. ([32967](https://github.com/WordPress/gutenberg/pull/32967)) +- data: Add types to redux-store/metadata/selectors. ([32965](https://github.com/WordPress/gutenberg/pull/32965)) +- data: Add types to redux-store metadata reducer. ([32942](https://github.com/WordPress/gutenberg/pull/32942)) +- Block Library: Ensure there is no direct import from core/editor store. ([32866](https://github.com/WordPress/gutenberg/pull/32866)) +- data: Begin adding types, starting with redus-store/meta/actions. ([32855](https://github.com/WordPress/gutenberg/pull/32855)) +- components: Remove duplicated space utilities. ([32852](https://github.com/WordPress/gutenberg/pull/32852)) +- Correct the case of navigation __unstableLocation. ([32783](https://github.com/WordPress/gutenberg/pull/32783)) +- Unit control Utils: Update JS documentation and add basic test coverage. ([32774](https://github.com/WordPress/gutenberg/pull/32774)) +- Quality: Promote lint rule to error when validating store string literals. ([32537](https://github.com/WordPress/gutenberg/pull/32537)) +- Cleanup PHP Codesniffer warnings and enable fail. ([26516](https://github.com/WordPress/gutenberg/pull/26516)) +- Redux routine: Add types. ([21313](https://github.com/WordPress/gutenberg/pull/21313)) + +### Tools + +- components: Restrict imports of @emotion/css. ([33051](https://github.com/WordPress/gutenberg/pull/33051)) +- end-to-end Test Utils: Add getCurrentUser(), and use it for user switching. ([33050](https://github.com/WordPress/gutenberg/pull/33050)) +- Disable Android end-to-end tests while we investigate foundational breakage. ([32934](https://github.com/WordPress/gutenberg/pull/32934)) +- [E2E Tests]: Fix WP editor metabox test. ([32915](https://github.com/WordPress/gutenberg/pull/32915)) +- Fix eslint-import resolver with extraneous dependencies. ([32906](https://github.com/WordPress/gutenberg/pull/32906)) +- Fix broken the post-template-editor test. ([32904](https://github.com/WordPress/gutenberg/pull/32904)) +- Testing: Fix failing PHPUnit test caused by changes in WP core. ([32888](https://github.com/WordPress/gutenberg/pull/32888)) +- Skip failing image caption caret test. ([32847](https://github.com/WordPress/gutenberg/pull/32847)) +- @wordpress/scripts: Support path-based chunk names in FixStyleWebpackPlugin. ([32834](https://github.com/WordPress/gutenberg/pull/32834)) +- Improve image caret e2e-test. ([32832](https://github.com/WordPress/gutenberg/pull/32832)) +- Docs: Update testing overview documentation. ([32829](https://github.com/WordPress/gutenberg/pull/32829)) +- Scripts: Update `lint-md-docs` script to use ignore-path. ([32633](https://github.com/WordPress/gutenberg/pull/32633)) +- Workflows: Allow point releases after a new RC is out. ([32560](https://github.com/WordPress/gutenberg/pull/32560)) + +### Various + +- Add a label for screen reader in categories block. ([33060](https://github.com/WordPress/gutenberg/pull/33060)) +- Focus style followup. ([33022](https://github.com/WordPress/gutenberg/pull/33022)) +- Typo correction. ([33013](https://github.com/WordPress/gutenberg/pull/33013)) +- Iframed editor: Add Masonry integration end-to-end test. ([33008](https://github.com/WordPress/gutenberg/pull/33008)) +- Handle context on `edits`. ([32991](https://github.com/WordPress/gutenberg/pull/32991)) +- Block Library: Improve view script integration to account for WordPress Core. ([32977](https://github.com/WordPress/gutenberg/pull/32977)) +- Revert mistaken push to trunk. ([32948](https://github.com/WordPress/gutenberg/pull/32948)) +- Upgrade to Emotion 11. ([32930](https://github.com/WordPress/gutenberg/pull/32930)) +- Replace FullscreenMode from Class components to functional components. ([32925](https://github.com/WordPress/gutenberg/pull/32925)) +- Query block: Fix full width children from scrolling horizontally only in the editor. ([32892](https://github.com/WordPress/gutenberg/pull/32892)) +- Prepublish Panel: Disable the Publish and Cancel buttons while saving. ([32889](https://github.com/WordPress/gutenberg/pull/32889)) +- Update pre-publish setting copy. ([32874](https://github.com/WordPress/gutenberg/pull/32874)) +- Query Loop Patterns: Use plain `div` for wrapper element. ([32867](https://github.com/WordPress/gutenberg/pull/32867)) +- Properly handle 404 errors while publishing Android artifacts. ([32860](https://github.com/WordPress/gutenberg/pull/32860)) +- Auto-enable the template editor for themes with theme.json only. ([32858](https://github.com/WordPress/gutenberg/pull/32858)) +- Safari: See if compositing layer size is more reasonable when position fixed divs are not inserted into content. ([32824](https://github.com/WordPress/gutenberg/pull/32824)) +- Remove `gutenberg` domain from Post Template block. ([32804](https://github.com/WordPress/gutenberg/pull/32804)) +- Add regression end-to-end test for the bug that caused some wp_options to get corrupted data. ([32797](https://github.com/WordPress/gutenberg/pull/32797)) +- components: Allow for non-polymorphic components. ([32796](https://github.com/WordPress/gutenberg/pull/32796)) +- Revert accidental commit. ([32777](https://github.com/WordPress/gutenberg/pull/32777)) +- Card: Delete old version of the g2 implementation. ([32764](https://github.com/WordPress/gutenberg/pull/32764)) +- Card: Update Storybook story. ([32763](https://github.com/WordPress/gutenberg/pull/32763)) +- Avoid flash of background color when scrolling in safari. ([32747](https://github.com/WordPress/gutenberg/pull/32747)) +- Add 'area' key to function doc for `gutenberg_get_block_templates`. ([32746](https://github.com/WordPress/gutenberg/pull/32746)) +- Components: Update components provider story. ([32743](https://github.com/WordPress/gutenberg/pull/32743)) +- Implement basic in memory cache for rich link previews data. ([32741](https://github.com/WordPress/gutenberg/pull/32741)) +- Rename native editor onboarding properties for clarity. ([32739](https://github.com/WordPress/gutenberg/pull/32739)) +- Try: Align widget sidebar button. ([32738](https://github.com/WordPress/gutenberg/pull/32738)) +- Card: Update to g2 implementation. ([32566](https://github.com/WordPress/gutenberg/pull/32566)) +- Rnmobile/fix/disable controls when template lock is set. ([32495](https://github.com/WordPress/gutenberg/pull/32495)) +- Added filters to get block templates functions. ([31806](https://github.com/WordPress/gutenberg/pull/31806)) +- Template Parts & Reusable Blocks - try overlay element for clickthrough to edit pattern. ([31109](https://github.com/WordPress/gutenberg/pull/31109)) +- [RN Mobile][Global Styles] Adds new Prop for Global Styles Settings. ([30544](https://github.com/WordPress/gutenberg/pull/30544)) + + + + = 10.9.1 = ### Bug Fixes diff --git a/gutenberg.php b/gutenberg.php index 67eaf6c630c4c9..ab7049ffb7bf9e 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.6 * Requires PHP: 5.6 - * Version: 10.9.2 + * Version: 11.0.0-rc.1 * Author: Gutenberg Team * Text Domain: gutenberg * diff --git a/package-lock.json b/package-lock.json index 143e4ed03fbe7a..ca2d654ff162ae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "gutenberg", - "version": "10.9.2", + "version": "11.0.0-rc.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index c97eab3386806f..4546293f5555aa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gutenberg", - "version": "10.9.2", + "version": "11.0.0-rc.1", "private": true, "description": "A new WordPress editor experience.", "author": "The WordPress Contributors", diff --git a/packages/block-editor/src/components/block-icon/style.scss b/packages/block-editor/src/components/block-icon/style.scss index 7c81a32be891cf..033e0d3129d741 100644 --- a/packages/block-editor/src/components/block-icon/style.scss +++ b/packages/block-editor/src/components/block-icon/style.scss @@ -8,6 +8,12 @@ &.has-colors { svg { fill: currentColor; + + // Optimizate for high contrast modes. + // See also https://blogs.windows.com/msedgedev/2020/09/17/styling-for-windows-high-contrast-with-new-standards-for-forced-colors/. + @media (forced-colors: active) { + fill: CanvasText; + } } } diff --git a/packages/block-editor/src/components/inserter/style.scss b/packages/block-editor/src/components/inserter/style.scss index 45b0091508ba60..cb8f94f93eb6e0 100644 --- a/packages/block-editor/src/components/inserter/style.scss +++ b/packages/block-editor/src/components/inserter/style.scss @@ -16,6 +16,10 @@ $block-inserter-tabs-height: 44px; } } +.block-editor-inserter__content { + position: relative; +} + .block-editor-inserter__popover.is-quick { .components-popover__content { border: none; diff --git a/packages/block-editor/src/components/link-control/README.md b/packages/block-editor/src/components/link-control/README.md index d143b7b5fcb3ed..45da4a723c07c2 100644 --- a/packages/block-editor/src/components/link-control/README.md +++ b/packages/block-editor/src/components/link-control/README.md @@ -127,6 +127,14 @@ This `suggestion` will then be _automatically_ passed to the `onChange` handler As a result of the above, this prop is often used to allow on the fly creation of new entities (eg: `Posts`, `Pages`) based on the text the user has entered into the link search UI. As an example, the Navigation Block uses `createSuggestion` to create Pages on the fly from within the Block itself. +### onRemove + +- Type: `Function` +- Required: No +- Default: null + +An optional handler, which when passed will trigger the display of an `Unlink` UI within the control. This handler is expected to remove the current `value` of the control thus resetting it back to a default state. The key use case for this is allowing users to remove a link from the control without relying on there being an "unlink" control in the block toolbar. + #### Search `suggestion` values A `suggestion` should have the following shape: diff --git a/packages/block-editor/src/components/link-control/index.js b/packages/block-editor/src/components/link-control/index.js index b9a63ceb71da3c..db6b005ac79fab 100644 --- a/packages/block-editor/src/components/link-control/index.js +++ b/packages/block-editor/src/components/link-control/index.js @@ -106,6 +106,7 @@ function LinkControl( { value, settings, onChange = noop, + onRemove, noDirectEntry = false, showSuggestions = true, showInitialSuggestions, @@ -260,11 +261,23 @@ function LinkControl( { /> ) } - +
+ + { onRemove && value && ! isEditingLink && ! isCreatingPage && ( + + ) } +
); } diff --git a/packages/block-editor/src/components/link-control/style.scss b/packages/block-editor/src/components/link-control/style.scss index b1b6958dbe5f8c..3d5d5941bb7749 100644 --- a/packages/block-editor/src/components/link-control/style.scss +++ b/packages/block-editor/src/components/link-control/style.scss @@ -380,10 +380,23 @@ $preview-image-height: 140px; padding: 10px; } -.block-editor-link-control__settings { +.block-editor-link-control__tools { + display: flex; + align-items: center; border-top: $border-width solid $gray-300; margin: 0; padding: $grid-unit-20 $grid-unit-30; +} + +.block-editor-link-control__unlink { + padding-left: $grid-unit-20; + padding-right: $grid-unit-20; +} + +.block-editor-link-control__settings { + flex: 1; + margin: 0; + :last-child { margin-bottom: 0; diff --git a/packages/block-editor/src/components/link-control/test/index.js b/packages/block-editor/src/components/link-control/test/index.js index 27e1665d869ff2..250e4656d3708d 100644 --- a/packages/block-editor/src/components/link-control/test/index.js +++ b/packages/block-editor/src/components/link-control/test/index.js @@ -227,6 +227,49 @@ describe( 'Basic rendering', () => { expect( isEditing() ).toBe( false ); } ); } ); + + describe( 'Unlinking', () => { + it( 'should not show "Unlink" button if no onRemove handler is provided', () => { + act( () => { + render( + , + container + ); + } ); + + const unLinkButton = queryByRole( container, 'button', { + name: 'Unlink', + } ); + + expect( unLinkButton ).toBeNull(); + expect( unLinkButton ).not.toBeInTheDocument(); + } ); + + it( 'should show "Unlink" button if a onRemove handler is provided', () => { + const mockOnRemove = jest.fn(); + act( () => { + render( + , + container + ); + } ); + + const unLinkButton = queryByRole( container, 'button', { + name: 'Unlink', + } ); + expect( unLinkButton ).toBeTruthy(); + expect( unLinkButton ).toBeInTheDocument(); + + act( () => { + Simulate.click( unLinkButton ); + } ); + + expect( mockOnRemove ).toHaveBeenCalled(); + } ); + } ); } ); describe( 'Searching for a link', () => { diff --git a/packages/block-library/src/button/deprecated.js b/packages/block-library/src/button/deprecated.js index 2d22972f5d1165..1c56218245a27f 100644 --- a/packages/block-library/src/button/deprecated.js +++ b/packages/block-library/src/button/deprecated.js @@ -18,8 +18,18 @@ import { compose } from '@wordpress/compose'; const migrateBorderRadius = ( attributes ) => { const { borderRadius, ...newAttributes } = attributes; - - if ( ! borderRadius && borderRadius !== 0 ) { + // We have to check old property `borderRadius` and if + // `styles.border.radius` is a `number` + const oldBorderRadius = [ + borderRadius, + newAttributes.style?.border?.radius, + ].find( ( possibleBorderRadius ) => { + return ( + typeof possibleBorderRadius === 'number' && + possibleBorderRadius !== 0 + ); + } ); + if ( ! oldBorderRadius ) { return newAttributes; } @@ -27,7 +37,10 @@ const migrateBorderRadius = ( attributes ) => { ...newAttributes, style: { ...newAttributes.style, - border: { radius: `${ borderRadius }px` }, + border: { + ...newAttributes.style?.border, + radius: `${ oldBorderRadius }px`, + }, }, }; }; @@ -100,6 +113,112 @@ const blockAttributes = { }; const deprecated = [ + { + supports: { + anchor: true, + align: true, + alignWide: false, + color: { + __experimentalSkipSerialization: true, + gradients: true, + }, + typography: { + fontSize: true, + __experimentalFontFamily: true, + }, + reusable: false, + __experimentalSelector: '.wp-block-button__link', + }, + attributes: { + ...blockAttributes, + linkTarget: { + type: 'string', + source: 'attribute', + selector: 'a', + attribute: 'target', + }, + rel: { + type: 'string', + source: 'attribute', + selector: 'a', + attribute: 'rel', + }, + placeholder: { + type: 'string', + }, + backgroundColor: { + type: 'string', + }, + textColor: { + type: 'string', + }, + gradient: { + type: 'string', + }, + width: { + type: 'number', + }, + }, + isEligible( { style } ) { + return typeof style?.border?.radius === 'number'; + }, + save( { attributes, className } ) { + const { + fontSize, + linkTarget, + rel, + style, + text, + title, + url, + width, + } = attributes; + + if ( ! text ) { + return null; + } + + const borderRadius = style?.border?.radius; + const colorProps = getColorClassesAndStyles( attributes ); + const buttonClasses = classnames( + 'wp-block-button__link', + colorProps.className, + { + 'no-border-radius': style?.border?.radius === 0, + } + ); + const buttonStyle = { + borderRadius: borderRadius ? borderRadius : undefined, + ...colorProps.style, + }; + + // The use of a `title` attribute here is soft-deprecated, but still applied + // if it had already been assigned, for the sake of backward-compatibility. + // A title will no longer be assigned for new or updated button block links. + + const wrapperClasses = classnames( className, { + [ `has-custom-width wp-block-button__width-${ width }` ]: width, + [ `has-custom-font-size` ]: + fontSize || style?.typography?.fontSize, + } ); + + return ( +
+ +
+ ); + }, + migrate: migrateBorderRadius, + }, { supports: { anchor: true, diff --git a/packages/block-library/src/image/image.js b/packages/block-library/src/image/image.js index be710aa4e523e4..103ff545fe375d 100644 --- a/packages/block-library/src/image/image.js +++ b/packages/block-library/src/image/image.js @@ -32,11 +32,7 @@ import { import { useEffect, useState, useRef } from '@wordpress/element'; import { __, sprintf, isRTL } from '@wordpress/i18n'; import { getPath } from '@wordpress/url'; -import { - createBlock, - getBlockType, - switchToBlockType, -} from '@wordpress/blocks'; +import { createBlock, switchToBlockType } from '@wordpress/blocks'; import { crop, overlayText, upload } from '@wordpress/icons'; import { store as noticesStore } from '@wordpress/notices'; import { store as coreStore } from '@wordpress/core-data'; @@ -61,27 +57,6 @@ function getFilename( url ) { } } -/** - * Checks if the given block is registered and is in the allowed blocks list. - * - * @param {string} name Block name. - * @param {boolean|Array} list Allowed block types. - * - * @return {boolean} Whether the block exists. - */ -function checkBlockExists( name, list ) { - if ( ! getBlockType( name ) ) { - return false; - } - - // The allowed blocks list has a boolean value so return it. - if ( ! Array.isArray( list ) ) { - return list; - } - - return list.includes( name ); -} - export default function Image( { temporaryURL, attributes: { @@ -133,21 +108,37 @@ export default function Image( { [ id, isSelected ] ); const { - allowedBlockTypes, + canInsertCover, imageEditing, imageSizes, maxWidth, mediaUpload, - } = useSelect( ( select ) => { - const { getSettings } = select( blockEditorStore ); - return pick( getSettings(), [ - 'allowedBlockTypes', - 'imageEditing', - 'imageSizes', - 'maxWidth', - 'mediaUpload', - ] ); - } ); + } = useSelect( + ( select ) => { + const { + canInsertBlockType, + getBlockRootClientId, + getSettings, + } = select( blockEditorStore ); + + const rootClientId = getBlockRootClientId( clientId ); + const settings = pick( getSettings(), [ + 'imageEditing', + 'imageSizes', + 'maxWidth', + 'mediaUpload', + ] ); + + return { + ...settings, + canInsertCover: canInsertBlockType( + 'core/cover', + rootClientId + ), + }; + }, + [ clientId ] + ); const { replaceBlocks, toggleSelection } = useDispatch( blockEditorStore ); const { createErrorNotice, createSuccessNotice } = useDispatch( noticesStore @@ -166,12 +157,6 @@ export default function Image( { ( { name, slug } ) => ( { value: slug, label: name } ) ); - // Check if the cover block is registered and in allowed block list. - const coverBlockExists = checkBlockExists( - 'core/cover', - allowedBlockTypes - ); - // If an image is externally hosted, try to fetch the image data. This may // fail if the image host doesn't allow CORS with the domain. If it works, // we can enable a button in the toolbar to upload the image. @@ -326,7 +311,7 @@ export default function Image( { label={ __( 'Upload external image' ) } /> ) } - { ! multiImageSelection && coverBlockExists && ( + { ! multiImageSelection && canInsertCover && ( $location, - 'container' => '', - 'items_wrap' => '%3$s', - 'fallback_cb' => false, - 'echo' => false, + 'theme_location' => $location, + 'container' => '', + 'items_wrap' => '%3$s', + 'block_attributes' => $attributes, + 'fallback_cb' => false, + 'echo' => false, ) ); } @@ -154,7 +156,7 @@ function render_block_core_navigation( $attributes, $content, $block ) { if ( empty( $block->inner_blocks ) ) { if ( array_key_exists( '__unstableLocation', $attributes ) ) { $location = $attributes['__unstableLocation']; - $maybe_classic_navigation = gutenberg_render_menu_from_location( $location ); + $maybe_classic_navigation = gutenberg_render_menu_from_location( $location, $attributes ); if ( $maybe_classic_navigation ) { return $maybe_classic_navigation; } diff --git a/packages/block-library/src/search/edit.js b/packages/block-library/src/search/edit.js index 8301ca2c0616be..1cc7484502571e 100644 --- a/packages/block-library/src/search/edit.js +++ b/packages/block-library/src/search/edit.js @@ -11,6 +11,7 @@ import { BlockControls, InspectorControls, RichText, + __experimentalUseBorderProps as useBorderProps, __experimentalUnitControl as UnitControl, } from '@wordpress/block-editor'; import { @@ -73,6 +74,15 @@ export default function SearchEdit( { } = attributes; const borderRadius = style?.border?.radius; + const borderProps = useBorderProps( attributes ); + + // Check for old deprecated numerical border radius. Done as a separate + // check so that a borderRadius style won't overwrite the longhand + // per-corner styles. + if ( typeof borderRadius === 'number' ) { + borderProps.style.borderRadius = `${ borderRadius }px`; + } + const unitControlInstanceId = useInstanceId( UnitControl ); const unitControlInputId = `wp-block-search__width-${ unitControlInstanceId }`; @@ -133,7 +143,7 @@ export default function SearchEdit( { return ( ) } { ! buttonUseIcon && ( ); + const padBorderRadius = ( radius ) => + radius ? `calc(${ radius } + ${ DEFAULT_INNER_PADDING })` : undefined; + const getWrapperStyles = () => { - if ( 'button-inside' === buttonPosition && style?.border?.radius ) { + const isNonZeroBorderRadius = parseInt( borderRadius, 10 ) !== 0; + + if ( 'button-inside' === buttonPosition && isNonZeroBorderRadius ) { // We have button inside wrapper and a border radius value to apply. // Add default padding so we don't get "fat" corners. // - // CSS calc() is used here to support non-pixel units. The inline - // style using calc() will only apply if both values have units. + // CSS calc() is used here to support non-pixel units. + + if ( typeof borderRadius === 'object' ) { + // Individual corner border radii present. + const { + topLeft, + topRight, + bottomLeft, + bottomRight, + } = borderRadius; + + return { + borderTopLeftRadius: padBorderRadius( topLeft ), + borderTopRightRadius: padBorderRadius( topRight ), + borderBottomLeftRadius: padBorderRadius( bottomLeft ), + borderBottomRightRadius: padBorderRadius( bottomRight ), + }; + } + + // The inline style using calc() will only apply if both values + // supplied to calc() have units. Deprecated block's may have + // unitless integer. const radius = Number.isInteger( borderRadius ) ? `${ borderRadius }px` : borderRadius; diff --git a/packages/block-library/src/search/index.php b/packages/block-library/src/search/index.php index faf8741ce7e8bc..2b6d74d52a1c0e 100644 --- a/packages/block-library/src/search/index.php +++ b/packages/block-library/src/search/index.php @@ -188,25 +188,51 @@ function styles_for_block_core_search( $attributes ) { $has_border_radius = ! empty( $attributes['style']['border']['radius'] ); if ( $has_border_radius ) { - // Shared style for button and input radius values. + $default_padding = '4px'; $border_radius = $attributes['style']['border']['radius']; - $border_radius = is_numeric( $border_radius ) ? $border_radius . 'px' : $border_radius; - $shared_styles[] = sprintf( 'border-radius: %s;', esc_attr( $border_radius ) ); - - // Apply wrapper border radius if button placed inside. - $button_inside = ! empty( $attributes['buttonPosition'] ) && + $button_inside = ! empty( $attributes['buttonPosition'] ) && 'button-inside' === $attributes['buttonPosition']; - if ( $button_inside ) { - // We adjust the border radius value for the outer wrapper element - // to make it visually consistent with the radius applied to inner - // elements. calc() is used to support non-pixel CSS units. - $default_padding = '4px'; - $wrapper_styles[] = sprintf( - 'border-radius: calc(%s + %s);', - esc_attr( $border_radius ), - esc_attr( $default_padding ) - ); + if ( is_array( $border_radius ) ) { + // Apply styles for individual corner border radii. + foreach ( $border_radius as $key => $value ) { + if ( null !== $value ) { + // Convert camelCase key to kebab-case. + $name = strtolower( preg_replace( '/(? { const selectOption = { @@ -53,6 +72,16 @@ function TagCloudEdit( { attributes, setAttributes, taxonomies } ) { setAttributes( { showTagCounts: ! showTagCounts } ) } /> + + setAttributes( { numberOfTags: value } ) + } + min={ MIN_TAGS } + max={ MAX_TAGS } + required + /> ); diff --git a/packages/block-library/src/tag-cloud/index.php b/packages/block-library/src/tag-cloud/index.php index cdebc9227138a4..0658998d4e8cb8 100644 --- a/packages/block-library/src/tag-cloud/index.php +++ b/packages/block-library/src/tag-cloud/index.php @@ -17,6 +17,7 @@ function render_block_core_tag_cloud( $attributes ) { 'echo' => false, 'taxonomy' => $attributes['taxonomy'], 'show_count' => $attributes['showTagCounts'], + 'number' => $attributes['numberOfTags'], ); $tag_cloud = wp_tag_cloud( $args ); diff --git a/packages/components/src/autocomplete/style.scss b/packages/components/src/autocomplete/style.scss index 3bef5a13a47b6e..b7060e4a469189 100644 --- a/packages/components/src/autocomplete/style.scss +++ b/packages/components/src/autocomplete/style.scss @@ -11,6 +11,6 @@ width: 100%; &.is-selected { - box-shadow: 0 0 0 2px var(--wp-admin-theme-color); + box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); } } diff --git a/packages/components/src/box-control/vertical-horizontal-input-controls.js b/packages/components/src/box-control/axial-input-controls.js similarity index 97% rename from packages/components/src/box-control/vertical-horizontal-input-controls.js rename to packages/components/src/box-control/axial-input-controls.js index 6c7b5a9ad396ee..f4b014e8f5e804 100644 --- a/packages/components/src/box-control/vertical-horizontal-input-controls.js +++ b/packages/components/src/box-control/axial-input-controls.js @@ -7,7 +7,7 @@ import { Layout } from './styles/box-control-styles'; const groupedSides = [ 'vertical', 'horizontal' ]; -export default function VerticalHorizontalInputControls( { +export default function AxialInputControls( { onChange, onFocus, onHoverOn, diff --git a/packages/components/src/box-control/index.js b/packages/components/src/box-control/index.js index e651020069bbde..3f23a17d7ea47b 100644 --- a/packages/components/src/box-control/index.js +++ b/packages/components/src/box-control/index.js @@ -17,7 +17,7 @@ import Button from '../button'; import { FlexItem, FlexBlock } from '../flex'; import AllInputControl from './all-input-control'; import InputControls from './input-controls'; -import VerticalHorizontalInputControls from './vertical-horizontal-input-controls'; +import AxialInputControls from './axial-input-controls'; import BoxControlIcon from './icon'; import { Text } from '../text'; import LinkedButton from './linked-button'; @@ -157,9 +157,7 @@ export default function BoxControl( { ) } { ! isLinked && splitOnAxis && ( - + ) } { ! hasOneSide && ( diff --git a/packages/components/src/box-control/stories/index.js b/packages/components/src/box-control/stories/index.js index f5ba9ee7bcbecf..03f71885edb535 100644 --- a/packages/components/src/box-control/stories/index.js +++ b/packages/components/src/box-control/stories/index.js @@ -87,11 +87,11 @@ export const singleSide = () => { ); }; -export const verticalHorizontalControls = () => { +export const axialControls = () => { return ; }; -export const verticalHorizontalControlsWithSingleSide = () => { +export const axialControlsWithSingleSide = () => { return ( img, -.emotion-19>iframe { +.emotion-21>img, +.emotion-21>iframe { display: block; height: auto; max-width: 100%; width: 100%; } -.emotion-19:first-of-type { +.emotion-21:first-of-type { border-top-left-radius: 2px; border-top-right-radius: 2px; } -.emotion-19:last-of-type { +.emotion-21:last-of-type { border-bottom-left-radius: 2px; border-bottom-right-radius: 2px; } -.emotion-22 { +.emotion-24 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -353,29 +356,29 @@ Object { padding: calc(4px * 4) calc(4px * 6); } -.emotion-22>*+*:not(marquee) { +.emotion-24>*+*:not(marquee) { margin-left: calc(4px * 2); } -.emotion-22>* { +.emotion-24>* { min-width: 0; } -.emotion-22:first-child { +.emotion-24:first-child { border-top: none; } -.emotion-22:first-of-type { +.emotion-24:first-of-type { border-top-left-radius: 2px; border-top-right-radius: 2px; } -.emotion-22:last-of-type { +.emotion-24:last-of-type { border-bottom-left-radius: 2px; border-bottom-right-radius: 2px; } -.emotion-25 { +.emotion-27 { background: transparent; display: block; margin: 0!important; @@ -427,7 +430,7 @@ Object {
@@ -450,7 +453,7 @@ Object { />
-
diff --git a/packages/editor/src/components/post-publish-panel/test/__snapshots__/index.js.snap b/packages/editor/src/components/post-publish-panel/test/__snapshots__/index.js.snap index e7507902cb5fea..7bd560d187275c 100644 --- a/packages/editor/src/components/post-publish-panel/test/__snapshots__/index.js.snap +++ b/packages/editor/src/components/post-publish-panel/test/__snapshots__/index.js.snap @@ -135,7 +135,6 @@ exports[`PostPublishPanel should render the pre-publish panel if the post is not className="editor-post-publish-panel__header-cancel-button" > Cancel @@ -176,7 +175,6 @@ exports[`PostPublishPanel should render the spinner if the post is being saved 1 className="editor-post-publish-panel__header-cancel-button" > Cancel diff --git a/packages/format-library/src/link/inline.js b/packages/format-library/src/link/inline.js index d015267a8e38f7..8a9e7efae2fa1e 100644 --- a/packages/format-library/src/link/inline.js +++ b/packages/format-library/src/link/inline.js @@ -11,6 +11,7 @@ import { isCollapsed, applyFormat, useAnchorRef, + removeFormat, } from '@wordpress/rich-text'; import { __experimentalLinkControl as LinkControl } from '@wordpress/block-editor'; @@ -48,6 +49,13 @@ function InlineLinkUI( { ...nextLinkValue, }; + function removeLink() { + const newValue = removeFormat( value, 'core/link' ); + onChange( newValue ); + stopAddingLink(); + speak( __( 'Link removed.' ), 'assertive' ); + } + function onChangeLink( nextValue ) { // Merge with values from state, both for the purpose of assigning the // next state value, and for use in constructing the new link format if @@ -139,6 +147,7 @@ function InlineLinkUI( { diff --git a/packages/react-native-editor/README.md b/packages/react-native-editor/README.md index 11b36ef6f850d7..1401929b0c1a9f 100644 --- a/packages/react-native-editor/README.md +++ b/packages/react-native-editor/README.md @@ -4,7 +4,7 @@ This package provides a demo application to simplify the environment setup requi ## Getting Started -Please review [Getting Started for the React Native based Mobile Gutenberg](/docs/contributors/getting-started-native-mobile.md) to learn how to set up and run this demo application. +Please review [Getting Started for the React Native based Mobile Gutenberg](/docs/contributors/code/getting-started-native-mobile.md) to learn how to set up and run this demo application. ## License diff --git a/readme.txt b/readme.txt index be70c005bbceac..94bfddb91a1420 100644 --- a/readme.txt +++ b/readme.txt @@ -55,4 +55,4 @@ View release page. +To read the changelog for Gutenberg 11.0.0-rc.1, please navigate to the release page.