diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 1d898d92aab66f..41811f7fd0fffb 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -129,14 +129,14 @@ /packages/env @noahtallen # PHP -/lib @timothybjacobs @spacedmonkey -/lib/global-styles.php @timothybjabocs @spacedmonkey @oandregal -/lib/theme.json @timothybjabocs @spacedmonkey @oandregal -/lib/theme-i18n.json @timothybjabocs @spacedmonkey @oandregal -/lib/class-wp-theme-json-gutenberg.php @timothybjabocs @spacedmonkey @oandregal -/lib/class-wp-theme-json-resolver-gutenberg.php @timothybjabocs @spacedmonkey @oandregal -/lib/full-site-editing @janw-me -/phpunit/class-wp-theme-json-test.php @oandregal +/lib @timothybjacobs @spacedmonkey +/lib/global-styles.php @timothybjabocs @spacedmonkey @oandregal +/lib/compat/wordpress-5.9/theme.json @timothybjabocs @spacedmonkey @oandregal +/lib/compat/wordpress-5.9/theme-i18n.json @timothybjabocs @spacedmonkey @oandregal +/lib/compat/wordpress-5.9/class-wp-theme-json-gutenberg.php @timothybjabocs @spacedmonkey @oandregal +/lib/compat/wordpress-5.9/class-wp-theme-json-resolver-gutenberg.php @timothybjabocs @spacedmonkey @oandregal +/lib/full-site-editing @janw-me +/phpunit/class-wp-theme-json-test.php @oandregal # Web App /packages/admin-manifest @ellatrix diff --git a/changelog.txt b/changelog.txt index 00eac97c122b0c..8a8ad800535256 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,308 @@ == Changelog == += 12.1.0-rc.1 = + + + +### Enhancements + +#### Components +- Add `__unstable-large` size variant on `InputControl` `SelectControl` `UnitControl`. ([35646](https://github.com/WordPress/gutenberg/pull/35646)) +- Font Size Picker: Allow non-integers as simple CSS values and in hints. ([36636](https://github.com/WordPress/gutenberg/pull/36636)) +- Improve `vertical` and RTL support for `Divider`. ([36579](https://github.com/WordPress/gutenberg/pull/36579)) +- ItemGroup: Experimenting with chevron icon. ([36654](https://github.com/WordPress/gutenberg/pull/36654)) +- Toggle Group Control: Add tooltip. ([36726](https://github.com/WordPress/gutenberg/pull/36726)) +- `Modal`: Add `__experimentalHideHeader` prop, wrap in `forwardref`. ([36831](https://github.com/WordPress/gutenberg/pull/36831)) +- `ZStack`: Support RTL layouts when applying `offset`. ([36769](https://github.com/WordPress/gutenberg/pull/36769)) + +#### Site Editor +- Add icons to navigation sidebar items. ([36893](https://github.com/WordPress/gutenberg/pull/36893)) +- Allow editing custom template title. ([36933](https://github.com/WordPress/gutenberg/pull/36933)) +- Only render the site editor canvas when the global styles are ready. ([36643](https://github.com/WordPress/gutenberg/pull/36643)) +- Remove extra border radius. ([37022](https://github.com/WordPress/gutenberg/pull/37022)) +- Show theme, plugin or author in Added By column with appropriate icon or avatar. ([36763](https://github.com/WordPress/gutenberg/pull/36763)) +- Update navigation sidebar responsiveness. ([36638](https://github.com/WordPress/gutenberg/pull/36638)) + +#### Global Styles +- Borders: Switch to ToolsPanel for displaying UI. ([33743](https://github.com/WordPress/gutenberg/pull/33743)) +- Custom color palette: Add default color name. ([36940](https://github.com/WordPress/gutenberg/pull/36940)) +- Polish unset color indicator. ([36994](https://github.com/WordPress/gutenberg/pull/36994)) + +#### Block Editor +- Always show the block appender when its parent is selected. ([36656](https://github.com/WordPress/gutenberg/pull/36656)) +- Insertion point bar: Hide onBlur and onMouseLeave. ([36798](https://github.com/WordPress/gutenberg/pull/36798)) +- Writing Flow: Double escape unselects all blocks. ([36945](https://github.com/WordPress/gutenberg/pull/36945)) + +#### Block Library +- Add spacing attributes to comment author avatar. ([36322](https://github.com/WordPress/gutenberg/pull/36322)) +- Only show submenu options and Show arrow button when relevant. ([36826](https://github.com/WordPress/gutenberg/pull/36826)) + + +### Bug Fixes + +- Dependency Extraction Webpack Plugin: Make the plugin work when using `optimizations.runtimeChunk = 'single'`. ([26214](https://github.com/WordPress/gutenberg/pull/26214)) +- Fix document typo. ([36776](https://github.com/WordPress/gutenberg/pull/36776)) +- Prevent CleanWebpackPlugin webpack plugin from deleting webpack assets. ([35986](https://github.com/WordPress/gutenberg/pull/35986)) +- Try: Hide the columns inserter in pattern previews. ([36626](https://github.com/WordPress/gutenberg/pull/36626)) +- Update theme.json version. ([36917](https://github.com/WordPress/gutenberg/pull/36917)) + +#### Block Library +- Add page list to navigation direct insert conditions. ([36591](https://github.com/WordPress/gutenberg/pull/36591)) +- Cover: Fix undo trap. ([36807](https://github.com/WordPress/gutenberg/pull/36807)) +- Fix Nav block editing wrong entity on creation of new Menu. ([36880](https://github.com/WordPress/gutenberg/pull/36880)) +- Fix Nav block fallback DB query to match on full block grammar start tag. ([36854](https://github.com/WordPress/gutenberg/pull/36854)) +- Fix icon scaling. ([36948](https://github.com/WordPress/gutenberg/pull/36948)) +- Fix non existent menu handling in nav block. ([36507](https://github.com/WordPress/gutenberg/pull/36507)) +- Fix page list missing button styles when set to open on click. ([36601](https://github.com/WordPress/gutenberg/pull/36601)) +- Fix template part slug generation when creating through the block placeholder. ([36764](https://github.com/WordPress/gutenberg/pull/36764)) +- Gallery v1: Allow clicks within replace media placeholder state. ([36804](https://github.com/WordPress/gutenberg/pull/36804)) +- Gallery: Fix stuck image size options loader. ([36806](https://github.com/WordPress/gutenberg/pull/36806)) +- Include cascading properties in Navigation deprecation. ([36432](https://github.com/WordPress/gutenberg/pull/36432)) +- Navigation: Scale submenu icon. ([36714](https://github.com/WordPress/gutenberg/pull/36714)) +- Navigation: Try removing absorb toolbar prop. ([36990](https://github.com/WordPress/gutenberg/pull/36990)) +- Post Featured Image: Add the "Reset" button. ([36572](https://github.com/WordPress/gutenberg/pull/36572)) +- [Post Title]: Fix render error when setting Page to homepage. ([36786](https://github.com/WordPress/gutenberg/pull/36786)) +- [Query Pagination Next/Previous]: Remove text and link color support. ([36954](https://github.com/WordPress/gutenberg/pull/36954)) + +#### Site Editor +- Stabilize export endpoint. ([36559](https://github.com/WordPress/gutenberg/pull/36559)) +- Templat list fallback to slug. ([36947](https://github.com/WordPress/gutenberg/pull/36947)) +- Templates Controller: Add missing 'is_custom' prop. ([36911](https://github.com/WordPress/gutenberg/pull/36911)) +- Update hrefs to not specifically refer to themes.php?page=gutenberg-edit-site. ([36705](https://github.com/WordPress/gutenberg/pull/36705)) +- Validate the postType query argument. ([36706](https://github.com/WordPress/gutenberg/pull/36706)) + +#### Components +- Color Picker: Re-instate debounce and controlled value to fix issue with gradient picker. ([36941](https://github.com/WordPress/gutenberg/pull/36941)) +- ColorPicker: Replace hardcoded "blue" with theme color. ([36153](https://github.com/WordPress/gutenberg/pull/36153)) +- Tools Panel: Fix race conditions caused by conditionally displayed ToolsPanelItems. ([36588](https://github.com/WordPress/gutenberg/pull/36588)) +- `DateTimePicker`: Set PM hours correctly. ([36878](https://github.com/WordPress/gutenberg/pull/36878)) + +#### Themes +- Block Templates: Fix PHP notices on WP 5.8. ([36964](https://github.com/WordPress/gutenberg/pull/36964)) +- Don't try and render unstable location if Nav block has ID. ([36863](https://github.com/WordPress/gutenberg/pull/36863)) +- Fix duotone first render in Safari. ([36754](https://github.com/WordPress/gutenberg/pull/36754)) + +#### Accessibility +- Add accessible labelling to submenu buttons. ([36631](https://github.com/WordPress/gutenberg/pull/36631)) +- Add aria-current="page" to active navigation item. ([36946](https://github.com/WordPress/gutenberg/pull/36946)) +- Fix site editor region navigation. ([36709](https://github.com/WordPress/gutenberg/pull/36709)) + +#### Block Editor +- Fix wordbreak for URLs. ([36993](https://github.com/WordPress/gutenberg/pull/36993)) +- Writing Flow Multi-select: Ensure post title content editable after multi-select. ([36843](https://github.com/WordPress/gutenberg/pull/36843)) + +#### Full Site Editing +- Highlight "Site" in the navigation panel. ([36762](https://github.com/WordPress/gutenberg/pull/36762)) +- Show all templates and template parts on the site editor list screens. ([36761](https://github.com/WordPress/gutenberg/pull/36761)) + +#### Design Tools +- Border panel: Update to display multiple palette origins. ([36753](https://github.com/WordPress/gutenberg/pull/36753)) +- Cover: Move BoxControlVisualizer in the markup to make it visible. ([36635](https://github.com/WordPress/gutenberg/pull/36635)) + +#### Icons +- [Icons]: Fix Comment Author Name icon. ([36738](https://github.com/WordPress/gutenberg/pull/36738)) +- [Icons]: Fix property names for Comment Author Avatar icon. ([36737](https://github.com/WordPress/gutenberg/pull/36737)) + +#### Block Variations +- Block Styles: Check for existence of scroll container. ([37010](https://github.com/WordPress/gutenberg/pull/37010)) + +#### Style Variations +- Block Styles: Add a separating margin to the default picker. ([36976](https://github.com/WordPress/gutenberg/pull/36976)) + +#### Testing +- Fix: Failing PHPUnit test. ([36931](https://github.com/WordPress/gutenberg/pull/36931)) + +#### Widgets Editor +- Add CSS fix for 33580. ([36759](https://github.com/WordPress/gutenberg/pull/36759)) + +#### Post Editor +- Multi-entity save: Only set site entity to pending if really saving. ([36573](https://github.com/WordPress/gutenberg/pull/36573)) + +#### Global Styles +- Make the core color palette opt-in for themes with not `theme.json`. ([36496](https://github.com/WordPress/gutenberg/pull/36496)) + +#### Data Layer +- Data: Update types and fix type error. ([36190](https://github.com/WordPress/gutenberg/pull/36190)) + + +### Performance + +#### Block Library +- Improve performance of wp_navigation lookup.. ([36891](https://github.com/WordPress/gutenberg/pull/36891)) + + +### Experiments + +#### Global Styles +- Add elements support to the typography panel in global styles. ([36718](https://github.com/WordPress/gutenberg/pull/36718)) +- Add: Border indication to global styles colors. ([36959](https://github.com/WordPress/gutenberg/pull/36959)) +- Add: Corners to custom color picker popover. ([37015](https://github.com/WordPress/gutenberg/pull/37015)) +- Add: Gradient palette editor. ([36820](https://github.com/WordPress/gutenberg/pull/36820)) +- Add: Missing margin to the color picker clear button. ([37016](https://github.com/WordPress/gutenberg/pull/37016)) +- Add: Transparency support on global styles colors. ([36840](https://github.com/WordPress/gutenberg/pull/36840)) +- Add: Uneditable duotone palette on the palette gradient panel. ([36920](https://github.com/WordPress/gutenberg/pull/36920)) +- Call "palettes" and not "color palettes" on panel label. ([36921](https://github.com/WordPress/gutenberg/pull/36921)) +- Color Picker: Improve border, padding, and box shadow styles. ([36963](https://github.com/WordPress/gutenberg/pull/36963)) +- Color UI component: Reorder palettes and update names (core by defaults, user by custom). ([36622](https://github.com/WordPress/gutenberg/pull/36622)) +- Fix: Apply by slug on all origins. ([36841](https://github.com/WordPress/gutenberg/pull/36841)) +- Fix: Color palette is not being stored. ([36817](https://github.com/WordPress/gutenberg/pull/36817)) +- Fix: Custom color picker popover position. ([36965](https://github.com/WordPress/gutenberg/pull/36965)) +- Fix: Theme colors cannot override defaults. ([36811](https://github.com/WordPress/gutenberg/pull/36811)) +- GlobalStyles sidebar: Do not show default palette if theme opts-out. ([36639](https://github.com/WordPress/gutenberg/pull/36639)) +- Make links plural in global styles. ([36819](https://github.com/WordPress/gutenberg/pull/36819)) +- Make user able to change all color palette origins. ([36674](https://github.com/WordPress/gutenberg/pull/36674)) +- Rename `core` origin key to `default` for presets. ([36645](https://github.com/WordPress/gutenberg/pull/36645)) +- Update function names for the public global styles API functions. ([36907](https://github.com/WordPress/gutenberg/pull/36907)) +- Update: Global Styes: Count all color palette origins on the palette counter. ([36922](https://github.com/WordPress/gutenberg/pull/36922)) +- Update: Rename user preset origin to custom. ([36748](https://github.com/WordPress/gutenberg/pull/36748)) +- theme.json: Add `appearanceTools` flag to opt-in into appearance UI controls. ([36646](https://github.com/WordPress/gutenberg/pull/36646)) + +#### Block Library +- Allow filtering of Nav block fallback. ([36850](https://github.com/WordPress/gutenberg/pull/36850)) +- Deprecate navigation areas. ([36727](https://github.com/WordPress/gutenberg/pull/36727)) +- Implement suitable fallback for Nav block on front end of site when no menu selected. ([36724](https://github.com/WordPress/gutenberg/pull/36724)) +- Navigation: Fix space-between. ([36441](https://github.com/WordPress/gutenberg/pull/36441)) +- Remove navigationArea context. ([36981](https://github.com/WordPress/gutenberg/pull/36981)) +- Remove unstable max pages attribute from Nav block. ([36877](https://github.com/WordPress/gutenberg/pull/36877)) +- Rename navigationMenuId to ref. ([36739](https://github.com/WordPress/gutenberg/pull/36739)) +- Render empty Nav block if no fallback block can be utilised. ([36849](https://github.com/WordPress/gutenberg/pull/36849)) +- Try always generating navigation post title. ([36760](https://github.com/WordPress/gutenberg/pull/36760)) +- Use first non-empty Nav post as primary fallback for Nav block. ([36740](https://github.com/WordPress/gutenberg/pull/36740)) + +#### Full Site Editing +- Add success and error snackbars to the templates list page. ([36808](https://github.com/WordPress/gutenberg/pull/36808)) +- Add templates list page for site editor. ([36379](https://github.com/WordPress/gutenberg/pull/36379)) +- Implement "Add New" for templates list in Site Editor. ([36592](https://github.com/WordPress/gutenberg/pull/36592)) +- Remove block template resolution unit tests. ([36855](https://github.com/WordPress/gutenberg/pull/36855)) +- Remove the Styles link in Site Editor. ([36637](https://github.com/WordPress/gutenberg/pull/36637)) +- Update and align template descriptions. ([36000](https://github.com/WordPress/gutenberg/pull/36000)) +- [REST] Restore the missing double slash in the ID received by /templates. ([36881](https://github.com/WordPress/gutenberg/pull/36881)) + +#### Accessibility +- Use table layout in templates list screen. ([36707](https://github.com/WordPress/gutenberg/pull/36707)) + + +### Documentation + +- Add brief information about blockGap to the theme.json how-to guide. ([36558](https://github.com/WordPress/gutenberg/pull/36558)) +- Add placeholder in URLInput documentation. ([36799](https://github.com/WordPress/gutenberg/pull/36799)) +- Block Supports: Update block supports documentation after typography reshaping. ([36894](https://github.com/WordPress/gutenberg/pull/36894)) +- Docs: Alphabetize the How to Guides section. ([35904](https://github.com/WordPress/gutenberg/pull/35904)) +- Docs: Fix broken link to @wordpress/stylelint-config. ([36936](https://github.com/WordPress/gutenberg/pull/36936)) +- Docs: Improvements on `Create a Block Tutorial` from `Block Editor handbook`. ([36553](https://github.com/WordPress/gutenberg/pull/36553)) +- Docs: Update history.md with description of the page. ([36888](https://github.com/WordPress/gutenberg/pull/36888)) +- Update Getting Started with info to stay informed. ([36498](https://github.com/WordPress/gutenberg/pull/36498)) +- Update Pattern block category and add documentation. ([36144](https://github.com/WordPress/gutenberg/pull/36144)) +- Various inline docblock corrections. ([36793](https://github.com/WordPress/gutenberg/pull/36793)) + +#### Components +- ToolsPanel: Update panel readme and stories. ([36557](https://github.com/WordPress/gutenberg/pull/36557)) + + +### Code Quality + +- Blocks: Refactor generator-based actions to thunks. ([36468](https://github.com/WordPress/gutenberg/pull/36468)) +- Remove useless bubblesVirtually prop from BlockInspector. ([37024](https://github.com/WordPress/gutenberg/pull/37024)) + +#### Global Styles +- Move Global Styles code to `lib/compat/wordpress-5.9` folder. ([36978](https://github.com/WordPress/gutenberg/pull/36978)) +- Rename `gutenberg_` to `wp_` for some functions that land in WordPress 5.9. ([36913](https://github.com/WordPress/gutenberg/pull/36913)) +- Update global styles public API. ([36610](https://github.com/WordPress/gutenberg/pull/36610)) +- Update the `WP_Theme_JSON_Gutenberg` class to be like the core one. ([36973](https://github.com/WordPress/gutenberg/pull/36973)) +- Update the `WP_Theme_JSON_Resolver_Gutenberg` class to be like the core one. ([36974](https://github.com/WordPress/gutenberg/pull/36974)) +- `theme.json`: Sort keys alphabetically. ([36968](https://github.com/WordPress/gutenberg/pull/36968)) + +#### Block Library +- Navigation: Remove outdated separate "Home" link styles. ([36608](https://github.com/WordPress/gutenberg/pull/36608)) +- Post Featured Image: Remove withNotices HOC. ([36596](https://github.com/WordPress/gutenberg/pull/36596)) +- [Comment Author Avatar]: Remove extraneous color link support flag. ([36956](https://github.com/WordPress/gutenberg/pull/36956)) + +#### Post Editor +- [Edit Post]: Remove EditPostSettings context provider. ([36949](https://github.com/WordPress/gutenberg/pull/36949)) + + +### Tools + +- Add ajlende to JSON Schema codeowners. ([36580](https://github.com/WordPress/gutenberg/pull/36580)) +- Report dependencies externalized with Dependency Extraction Plugin. ([35106](https://github.com/WordPress/gutenberg/pull/35106)) +- Update CODEOWNERS for @mkaz and documentation cleanup. ([36581](https://github.com/WordPress/gutenberg/pull/36581)) +- Update mkaz codeowner on schemas. ([36686](https://github.com/WordPress/gutenberg/pull/36686)) + +#### Testing +- Reorganize end-to-end tests folders and files. ([36734](https://github.com/WordPress/gutenberg/pull/36734)) +- Scripts: Upgrade Puppeteer to v11. ([36040](https://github.com/WordPress/gutenberg/pull/36040)) +- Update template controller unit test now that author support is in WP core. ([36987](https://github.com/WordPress/gutenberg/pull/36987)) +- end-to-end Tests: Fix failing image end-to-end test by waiting for required element. ([36982](https://github.com/WordPress/gutenberg/pull/36982)) + + +### Security + +#### Block Library +- [ Comment Author Avatar Block ] - Escape styles attribute. ([36988](https://github.com/WordPress/gutenberg/pull/36988)) + + +### Various + +- Add button text when no colors found. ([36684](https://github.com/WordPress/gutenberg/pull/36684)) +- Add origin and author to template rest api. ([36896](https://github.com/WordPress/gutenberg/pull/36896)) +- Change .nvmrc and documentation for Node.js version (LTS to 14.18.1). ([36744](https://github.com/WordPress/gutenberg/pull/36744)) +- Clarify i18n context for PostTemplateActions's "New" label. ([36679](https://github.com/WordPress/gutenberg/pull/36679)) +- Mobile - Preformatted block - Fix showing the default background color. ([36883](https://github.com/WordPress/gutenberg/pull/36883)) +- Mobile - RichText - Fixes an issue where the font size value won't update. ([36621](https://github.com/WordPress/gutenberg/pull/36621)) +- Revert erroneous native editor package version bumps. ([36633](https://github.com/WordPress/gutenberg/pull/36633)) +- Schemas: Allow custom blocks in theme.json styles. ([36411](https://github.com/WordPress/gutenberg/pull/36411)) +- Site Editor: Sync export API. ([36908](https://github.com/WordPress/gutenberg/pull/36908)) +- Update: Migrate global styles user database data on the rest endpoint. ([36747](https://github.com/WordPress/gutenberg/pull/36747)) + +#### Site Editor +- Add 'Clear customizations' button to template list page. ([36802](https://github.com/WordPress/gutenberg/pull/36802)) +- Make Reusable blocks available in the Site Editor. ([36511](https://github.com/WordPress/gutenberg/pull/36511)) +- Remove color, spacing, and layout options for Template Part block. ([36571](https://github.com/WordPress/gutenberg/pull/36571)) +- Set the on the list page to be same as the CPT name. ([36805](https://github.com/WordPress/gutenberg/pull/36805)) +- Template list add rename action. ([36879](https://github.com/WordPress/gutenberg/pull/36879)) +- Update delete template button. ([36815](https://github.com/WordPress/gutenberg/pull/36815)) +- Update some small style regressions in the template list. ([36822](https://github.com/WordPress/gutenberg/pull/36822)) + +#### Block Library +- Block Library: Add the Comments Pagination block. ([36872](https://github.com/WordPress/gutenberg/pull/36872)) +- Gallery block: Turn on auto-migration of v1 Gallery blocks to v2 format when edited. ([36191](https://github.com/WordPress/gutenberg/pull/36191)) +- Remove reference to gutenberg_, swap with wp_. ([36652](https://github.com/WordPress/gutenberg/pull/36652)) +- Update featured image placeholder graphic. ([36712](https://github.com/WordPress/gutenberg/pull/36712)) +- [Template Part]:Remove support for conversion to Reusable block. ([36918](https://github.com/WordPress/gutenberg/pull/36918)) + +#### Components +- Add experimental `ConfirmDialog`. ([34153](https://github.com/WordPress/gutenberg/pull/34153)) +- Offset the parent iframe when computing Popover position. ([36876](https://github.com/WordPress/gutenberg/pull/36876)) +- ToolsPanel: Prevent tools panel menu increasing empty panel height. ([36895](https://github.com/WordPress/gutenberg/pull/36895)) +- Update destructive tertiary button styles, and template list. ([36915](https://github.com/WordPress/gutenberg/pull/36915)) + +#### Themes +- Move the theme editor under tools for FSE themes. ([36723](https://github.com/WordPress/gutenberg/pull/36723)) +- Update the block theme folders to templates and parts. ([36647](https://github.com/WordPress/gutenberg/pull/36647)) + +#### Block Editor +- Make appender fixed position to avoid jumps in the UI. ([36605](https://github.com/WordPress/gutenberg/pull/36605)) +- [Inserter]: Adjust order of theme blocks and reorder inserter items. ([36719](https://github.com/WordPress/gutenberg/pull/36719)) + +#### Block Validation/Deprecation +- Add plugin meta data to Nav Area block deprecation notice. ([36777](https://github.com/WordPress/gutenberg/pull/36777)) + +#### Design Tools +- Post Featured Image: Move width and height controls into the Dimensions panel via SlotFill. ([36540](https://github.com/WordPress/gutenberg/pull/36540)) + +#### Template Editor +- Update resize handle styling in template part focus mode. ([36410](https://github.com/WordPress/gutenberg/pull/36410)) + +#### Data Layer +- Data: Remove usage of deprecated register methods. ([36344](https://github.com/WordPress/gutenberg/pull/36344)) + +#### Accessibility +- Block Editor List View: Use anchor elements instead of buttons. ([35655](https://github.com/WordPress/gutenberg/pull/35655)) + + + + + = 12.0.1 = ### Enhancements diff --git a/composer.json b/composer.json index cf0658add1f678..3d0056fcc5db57 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,8 @@ "sirbrillig/phpcs-variable-analysis": "^2.8", "wp-phpunit/wp-phpunit": "^5.4", "phpunit/phpunit": "^8.5", - "spatie/phpunit-watcher": "^1.23" + "spatie/phpunit-watcher": "^1.23", + "yoast/phpunit-polyfills": "^1.0" }, "require": { "composer/installers": "~1.0" diff --git a/composer.lock b/composer.lock index 5a0d86e54a1bdb..33ef4e01dfdc34 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1072fbf86d89fdd06d9702e33d12d114", + "content-hash": "685f90a68fbd475bec0f491b58ecc999", "packages": [ { "name": "composer/installers", - "version": "v1.10.0", + "version": "v1.12.0", "source": { "type": "git", "url": "https://github.com/composer/installers.git", - "reference": "1a0357fccad9d1cc1ea0c9a05b8847fbccccb78d" + "reference": "d20a64ed3c94748397ff5973488761b22f6d3f19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/installers/zipball/1a0357fccad9d1cc1ea0c9a05b8847fbccccb78d", - "reference": "1a0357fccad9d1cc1ea0c9a05b8847fbccccb78d", + "url": "https://api.github.com/repos/composer/installers/zipball/d20a64ed3c94748397ff5973488761b22f6d3f19", + "reference": "d20a64ed3c94748397ff5973488761b22f6d3f19", "shasum": "" }, "require": { @@ -111,10 +111,12 @@ "majima", "mako", "mediawiki", + "miaoxing", "modulework", "modx", "moodle", "osclass", + "pantheon", "phpbb", "piwik", "ppi", @@ -128,6 +130,7 @@ "sydes", "sylius", "symfony", + "tastyigniter", "typo3", "wordpress", "yawik", @@ -136,7 +139,7 @@ ], "support": { "issues": "https://github.com/composer/installers/issues", - "source": "https://github.com/composer/installers/tree/v1.10.0" + "source": "https://github.com/composer/installers/tree/v1.12.0" }, "funding": [ { @@ -152,30 +155,30 @@ "type": "tidelift" } ], - "time": "2021-01-14T11:07:16+00:00" + "time": "2021-09-13T08:19:44+00:00" } ], "packages-dev": [ { "name": "clue/stdio-react", - "version": "v2.4.0", + "version": "v2.5.0", "source": { "type": "git", "url": "https://github.com/clue/reactphp-stdio.git", - "reference": "5722686d3cc0cdf2ccedb6079bfd066220611f00" + "reference": "c73bcdc228eca627992c0088f7bc30b794fde8da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/clue/reactphp-stdio/zipball/5722686d3cc0cdf2ccedb6079bfd066220611f00", - "reference": "5722686d3cc0cdf2ccedb6079bfd066220611f00", + "url": "https://api.github.com/repos/clue/reactphp-stdio/zipball/c73bcdc228eca627992c0088f7bc30b794fde8da", + "reference": "c73bcdc228eca627992c0088f7bc30b794fde8da", "shasum": "" }, "require": { "clue/term-react": "^1.0 || ^0.1.1", "clue/utf8-react": "^1.0 || ^0.1", "php": ">=5.3", - "react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3", - "react/stream": "^1.0 || ^0.7 || ^0.6" + "react/event-loop": "^1.2", + "react/stream": "^1.2" }, "require-dev": { "clue/arguments": "^2.0", @@ -218,7 +221,7 @@ ], "support": { "issues": "https://github.com/clue/reactphp-stdio/issues", - "source": "https://github.com/clue/reactphp-stdio/tree/v2.4.0" + "source": "https://github.com/clue/reactphp-stdio/tree/v2.5.0" }, "funding": [ { @@ -230,7 +233,7 @@ "type": "github" } ], - "time": "2020-11-20T14:28:39+00:00" + "time": "2021-10-25T08:01:22+00:00" }, { "name": "clue/term-react", @@ -556,16 +559,16 @@ }, { "name": "jolicode/jolinotif", - "version": "v2.2.0", + "version": "v2.3.0", "source": { "type": "git", "url": "https://github.com/jolicode/JoliNotif.git", - "reference": "52f5b98f964f6009b8ec4c0e951edcd0862e2ac7" + "reference": "9cca717bbc47aa2ffeca51d77daa13b824a489ee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jolicode/JoliNotif/zipball/52f5b98f964f6009b8ec4c0e951edcd0862e2ac7", - "reference": "52f5b98f964f6009b8ec4c0e951edcd0862e2ac7", + "url": "https://api.github.com/repos/jolicode/JoliNotif/zipball/9cca717bbc47aa2ffeca51d77daa13b824a489ee", + "reference": "9cca717bbc47aa2ffeca51d77daa13b824a489ee", "shasum": "" }, "require": { @@ -583,7 +586,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1.x-dev" + "dev-master": "2.3.x-dev" } }, "autoload": { @@ -611,7 +614,7 @@ ], "support": { "issues": "https://github.com/jolicode/JoliNotif/issues", - "source": "https://github.com/jolicode/JoliNotif/tree/v2.2.0" + "source": "https://github.com/jolicode/JoliNotif/tree/v2.3.0" }, "funding": [ { @@ -619,7 +622,7 @@ "type": "tidelift" } ], - "time": "2020-06-17T08:25:38+00:00" + "time": "2021-03-07T12:30:00+00:00" }, { "name": "myclabs/deep-copy", @@ -681,16 +684,16 @@ }, { "name": "phar-io/manifest", - "version": "2.0.1", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133" + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", - "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", "shasum": "" }, "require": { @@ -735,22 +738,22 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/master" + "source": "https://github.com/phar-io/manifest/tree/2.0.3" }, - "time": "2020-06-27T14:33:11+00:00" + "time": "2021-07-20T11:28:43+00:00" }, { "name": "phar-io/version", - "version": "3.0.4", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "e4782611070e50613683d2b9a57730e9a3ba5451" + "reference": "bae7c545bef187884426f042434e561ab1ddb182" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/e4782611070e50613683d2b9a57730e9a3ba5451", - "reference": "e4782611070e50613683d2b9a57730e9a3ba5451", + "url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182", + "reference": "bae7c545bef187884426f042434e561ab1ddb182", "shasum": "" }, "require": { @@ -786,9 +789,9 @@ "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.0.4" + "source": "https://github.com/phar-io/version/tree/3.1.0" }, - "time": "2020-12-13T23:18:30+00:00" + "time": "2021-02-23T14:00:09+00:00" }, { "name": "phpcompatibility/php-compatibility", @@ -907,16 +910,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.2.2", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", "shasum": "" }, "require": { @@ -927,7 +930,8 @@ "webmozart/assert": "^1.9.1" }, "require-dev": { - "mockery/mockery": "~1.3.2" + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -957,22 +961,22 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" }, - "time": "2020-09-03T19:13:55+00:00" + "time": "2021-10-19T17:43:47+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.4.0", + "version": "1.5.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" + "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae", + "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae", "shasum": "" }, "require": { @@ -980,7 +984,8 @@ "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "*" + "ext-tokenizer": "*", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -1006,39 +1011,39 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.1" }, - "time": "2020-09-17T18:55:26+00:00" + "time": "2021-10-02T14:08:47+00:00" }, { "name": "phpspec/prophecy", - "version": "1.12.2", + "version": "1.14.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "245710e971a030f42e08f4912863805570f23d39" + "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/245710e971a030f42e08f4912863805570f23d39", - "reference": "245710e971a030f42e08f4912863805570f23d39", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", + "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.1", + "php": "^7.2 || ~8.0, <8.2", "phpdocumentor/reflection-docblock": "^5.2", "sebastian/comparator": "^3.0 || ^4.0", "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^6.0", + "phpspec/phpspec": "^6.0 || ^7.0", "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -1073,22 +1078,22 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/1.12.2" + "source": "https://github.com/phpspec/prophecy/tree/1.14.0" }, - "time": "2020-12-19T10:15:11+00:00" + "time": "2021-09-10T09:02:12+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "7.0.14", + "version": "7.0.15", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "bb7c9a210c72e4709cdde67f8b7362f672f2225c" + "reference": "819f92bba8b001d4363065928088de22f25a3a48" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/bb7c9a210c72e4709cdde67f8b7362f672f2225c", - "reference": "bb7c9a210c72e4709cdde67f8b7362f672f2225c", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/819f92bba8b001d4363065928088de22f25a3a48", + "reference": "819f92bba8b001d4363065928088de22f25a3a48", "shasum": "" }, "require": { @@ -1097,7 +1102,7 @@ "php": ">=7.2", "phpunit/php-file-iterator": "^2.0.2", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.1.1 || ^4.0", + "phpunit/php-token-stream": "^3.1.3 || ^4.0", "sebastian/code-unit-reverse-lookup": "^1.0.1", "sebastian/environment": "^4.2.2", "sebastian/version": "^2.0.1", @@ -1140,7 +1145,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/7.0.14" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/7.0.15" }, "funding": [ { @@ -1148,20 +1153,20 @@ "type": "github" } ], - "time": "2020-12-02T13:39:03+00:00" + "time": "2021-07-26T12:20:09+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "4b49fb70f067272b659ef0174ff9ca40fdaa6357" + "reference": "28af674ff175d0768a5a978e6de83f697d4a7f05" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/4b49fb70f067272b659ef0174ff9ca40fdaa6357", - "reference": "4b49fb70f067272b659ef0174ff9ca40fdaa6357", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/28af674ff175d0768a5a978e6de83f697d4a7f05", + "reference": "28af674ff175d0768a5a978e6de83f697d4a7f05", "shasum": "" }, "require": { @@ -1200,7 +1205,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/2.0.3" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/2.0.4" }, "funding": [ { @@ -1208,7 +1213,7 @@ "type": "github" } ], - "time": "2020-11-30T08:25:21+00:00" + "time": "2021-07-19T06:46:01+00:00" }, { "name": "phpunit/php-text-template", @@ -1376,16 +1381,16 @@ }, { "name": "phpunit/phpunit", - "version": "8.5.14", + "version": "8.5.21", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c25f79895d27b6ecd5abfa63de1606b786a461a3" + "reference": "50a58a60b85947b0bee4c8ecfe0f4bbdcf20e984" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c25f79895d27b6ecd5abfa63de1606b786a461a3", - "reference": "c25f79895d27b6ecd5abfa63de1606b786a461a3", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/50a58a60b85947b0bee4c8ecfe0f4bbdcf20e984", + "reference": "50a58a60b85947b0bee4c8ecfe0f4bbdcf20e984", "shasum": "" }, "require": { @@ -1397,12 +1402,12 @@ "ext-xml": "*", "ext-xmlwriter": "*", "myclabs/deep-copy": "^1.10.0", - "phar-io/manifest": "^2.0.1", + "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.2", "phpspec/prophecy": "^1.10.3", "phpunit/php-code-coverage": "^7.0.12", - "phpunit/php-file-iterator": "^2.0.2", + "phpunit/php-file-iterator": "^2.0.4", "phpunit/php-text-template": "^1.2.1", "phpunit/php-timer": "^2.1.2", "sebastian/comparator": "^3.0.2", @@ -1457,7 +1462,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.14" + "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.21" }, "funding": [ { @@ -1469,29 +1474,29 @@ "type": "github" } ], - "time": "2021-01-17T07:37:30+00:00" + "time": "2021-09-25T07:37:20+00:00" }, { "name": "psr/container", - "version": "1.0.0", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=7.4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1506,7 +1511,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common Container Interface (PHP FIG PSR-11)", @@ -1520,29 +1525,29 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/master" + "source": "https://github.com/php-fig/container/tree/2.0.2" }, - "time": "2017-02-14T16:28:37+00:00" + "time": "2021-11-05T16:47:00+00:00" }, { "name": "react/event-loop", - "version": "v1.1.1", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/reactphp/event-loop.git", - "reference": "6d24de090cd59cfc830263cfba965be77b563c13" + "reference": "be6dee480fc4692cec0504e65eb486e3be1aa6f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/event-loop/zipball/6d24de090cd59cfc830263cfba965be77b563c13", - "reference": "6d24de090cd59cfc830263cfba965be77b563c13", + "url": "https://api.github.com/repos/reactphp/event-loop/zipball/be6dee480fc4692cec0504e65eb486e3be1aa6f2", + "reference": "be6dee480fc4692cec0504e65eb486e3be1aa6f2", "shasum": "" }, "require": { "php": ">=5.3.0" }, "require-dev": { - "phpunit/phpunit": "^7.0 || ^6.4 || ^5.7 || ^4.8.35" + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35" }, "suggest": { "ext-event": "~1.0 for ExtEventLoop", @@ -1559,6 +1564,28 @@ "license": [ "MIT" ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], "description": "ReactPHP's core reactor event loop that libraries can use for evented I/O.", "keywords": [ "asynchronous", @@ -1566,32 +1593,42 @@ ], "support": { "issues": "https://github.com/reactphp/event-loop/issues", - "source": "https://github.com/reactphp/event-loop/tree/v1.1.1" + "source": "https://github.com/reactphp/event-loop/tree/v1.2.0" }, - "time": "2020-01-01T18:39:52+00:00" + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2021-07-11T12:31:24+00:00" }, { "name": "react/stream", - "version": "v1.1.1", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/reactphp/stream.git", - "reference": "7c02b510ee3f582c810aeccd3a197b9c2f52ff1a" + "reference": "7a423506ee1903e89f1e08ec5f0ed430ff784ae9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/stream/zipball/7c02b510ee3f582c810aeccd3a197b9c2f52ff1a", - "reference": "7c02b510ee3f582c810aeccd3a197b9c2f52ff1a", + "url": "https://api.github.com/repos/reactphp/stream/zipball/7a423506ee1903e89f1e08ec5f0ed430ff784ae9", + "reference": "7a423506ee1903e89f1e08ec5f0ed430ff784ae9", "shasum": "" }, "require": { "evenement/evenement": "^3.0 || ^2.0 || ^1.0", "php": ">=5.3.8", - "react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3.5" + "react/event-loop": "^1.2" }, "require-dev": { "clue/stream-filter": "~1.2", - "phpunit/phpunit": "^7.0 || ^6.4 || ^5.7 || ^4.8.35" + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35" }, "type": "library", "autoload": { @@ -1603,6 +1640,28 @@ "license": [ "MIT" ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], "description": "Event-driven readable and writable streams for non-blocking I/O in ReactPHP", "keywords": [ "event-driven", @@ -1616,9 +1675,19 @@ ], "support": { "issues": "https://github.com/reactphp/stream/issues", - "source": "https://github.com/reactphp/stream/tree/v1.1.1" + "source": "https://github.com/reactphp/stream/tree/v1.2.0" }, - "time": "2020-05-04T10:17:57+00:00" + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2021-07-11T12:37:55+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -1880,16 +1949,16 @@ }, { "name": "sebastian/exporter", - "version": "3.1.3", + "version": "3.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "6b853149eab67d4da22291d36f5b0631c0fd856e" + "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/6b853149eab67d4da22291d36f5b0631c0fd856e", - "reference": "6b853149eab67d4da22291d36f5b0631c0fd856e", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", + "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", "shasum": "" }, "require": { @@ -1898,7 +1967,7 @@ }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { @@ -1945,7 +2014,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/3.1.3" + "source": "https://github.com/sebastianbergmann/exporter/tree/3.1.4" }, "funding": [ { @@ -1953,7 +2022,7 @@ "type": "github" } ], - "time": "2020-11-30T07:47:53+00:00" + "time": "2021-11-11T13:51:24+00:00" }, { "name": "sebastian/global-state", @@ -2351,16 +2420,16 @@ }, { "name": "sirbrillig/phpcs-variable-analysis", - "version": "v2.10.2", + "version": "v2.11.2", "source": { "type": "git", "url": "https://github.com/sirbrillig/phpcs-variable-analysis.git", - "reference": "0775e0c683badad52c03b11c2cd86a9fdecb937a" + "reference": "3fad28475bfbdbf8aa5c440f8a8f89824983d85e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/0775e0c683badad52c03b11c2cd86a9fdecb937a", - "reference": "0775e0c683badad52c03b11c2cd86a9fdecb937a", + "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/3fad28475bfbdbf8aa5c440f8a8f89824983d85e", + "reference": "3fad28475bfbdbf8aa5c440f8a8f89824983d85e", "shasum": "" }, "require": { @@ -2400,29 +2469,30 @@ "source": "https://github.com/sirbrillig/phpcs-variable-analysis", "wiki": "https://github.com/sirbrillig/phpcs-variable-analysis/wiki" }, - "time": "2021-01-08T16:31:05+00:00" + "time": "2021-07-06T23:45:17+00:00" }, { "name": "spatie/phpunit-watcher", - "version": "1.23.1", + "version": "1.23.2", "source": { "type": "git", "url": "https://github.com/spatie/phpunit-watcher.git", - "reference": "0c70d569658a1cad9a6869716a4351d2ccfec4d1" + "reference": "548be41abab87336ef95cef5bf5cbd564bce5c26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/phpunit-watcher/zipball/0c70d569658a1cad9a6869716a4351d2ccfec4d1", - "reference": "0c70d569658a1cad9a6869716a4351d2ccfec4d1", + "url": "https://api.github.com/repos/spatie/phpunit-watcher/zipball/548be41abab87336ef95cef5bf5cbd564bce5c26", + "reference": "548be41abab87336ef95cef5bf5cbd564bce5c26", "shasum": "" }, "require": { - "clue/stdio-react": "^2.0", - "jolicode/jolinotif": "^2.0", + "clue/stdio-react": "^2.4", + "jolicode/jolinotif": "^2.2", "php": "^7.2 | ^8.0", - "symfony/console": "^5.0", - "symfony/process": "^5.0", - "symfony/yaml": "^5.0", + "symfony/console": "^5.2", + "symfony/finder": "^5.2", + "symfony/process": "^5.2", + "symfony/yaml": "^5.2", "yosymfony/resource-watcher": "^2.0" }, "conflict": { @@ -2460,22 +2530,22 @@ ], "support": { "issues": "https://github.com/spatie/phpunit-watcher/issues", - "source": "https://github.com/spatie/phpunit-watcher/tree/1.23.1" + "source": "https://github.com/spatie/phpunit-watcher/tree/1.23.2" }, - "time": "2020-10-31T17:47:29+00:00" + "time": "2021-02-26T08:00:42+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "3.5.8", + "version": "3.6.1", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "9d583721a7157ee997f235f327de038e7ea6dac4" + "reference": "f268ca40d54617c6e06757f83f699775c9b3ff2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/9d583721a7157ee997f235f327de038e7ea6dac4", - "reference": "9d583721a7157ee997f235f327de038e7ea6dac4", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/f268ca40d54617c6e06757f83f699775c9b3ff2e", + "reference": "f268ca40d54617c6e06757f83f699775c9b3ff2e", "shasum": "" }, "require": { @@ -2518,31 +2588,33 @@ "source": "https://github.com/squizlabs/PHP_CodeSniffer", "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" }, - "time": "2020-10-23T02:01:07+00:00" + "time": "2021-10-11T04:00:11+00:00" }, { "name": "symfony/console", - "version": "v5.2.2", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "d62ec79478b55036f65e2602e282822b8eaaff0a" + "reference": "ec3661faca1d110d6c307e124b44f99ac54179e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/d62ec79478b55036f65e2602e282822b8eaaff0a", - "reference": "d62ec79478b55036f65e2602e282822b8eaaff0a", + "url": "https://api.github.com/repos/symfony/console/zipball/ec3661faca1d110d6c307e124b44f99ac54179e3", + "reference": "ec3661faca1d110d6c307e124b44f99ac54179e3", "shasum": "" }, "require": { "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-php73": "^1.8", - "symfony/polyfill-php80": "^1.15", - "symfony/service-contracts": "^1.1|^2", - "symfony/string": "^5.1" + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.1|^6.0" }, "conflict": { + "psr/log": ">=3", "symfony/dependency-injection": "<4.4", "symfony/dotenv": "<5.1", "symfony/event-dispatcher": "<4.4", @@ -2550,16 +2622,16 @@ "symfony/process": "<4.4" }, "provide": { - "psr/log-implementation": "1.0" + "psr/log-implementation": "1.0|2.0" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" + "psr/log": "^1|^2", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/lock": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" }, "suggest": { "psr/log": "For using the console logger", @@ -2599,7 +2671,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.2.2" + "source": "https://github.com/symfony/console/tree/v5.4.0" }, "funding": [ { @@ -2615,29 +2687,29 @@ "type": "tidelift" } ], - "time": "2021-01-27T10:15:41+00:00" + "time": "2021-11-29T15:30:56+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.2.0", + "version": "v3.0.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "5fa56b4074d1ae755beb55617ddafe6f5d78f665" + "reference": "c726b64c1ccfe2896cb7df2e1331c357ad1c8ced" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5fa56b4074d1ae755beb55617ddafe6f5d78f665", - "reference": "5fa56b4074d1ae755beb55617ddafe6f5d78f665", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/c726b64c1ccfe2896cb7df2e1331c357ad1c8ced", + "reference": "c726b64c1ccfe2896cb7df2e1331c357ad1c8ced", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.0.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -2666,7 +2738,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/master" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.0" }, "funding": [ { @@ -2682,24 +2754,26 @@ "type": "tidelift" } ], - "time": "2020-09-07T11:33:47+00:00" + "time": "2021-11-01T23:48:49+00:00" }, { "name": "symfony/finder", - "version": "v5.2.2", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "196f45723b5e618bf0e23b97e96d11652696ea9e" + "reference": "d2f29dac98e96a98be467627bd49c2efb1bc2590" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/196f45723b5e618bf0e23b97e96d11652696ea9e", - "reference": "196f45723b5e618bf0e23b97e96d11652696ea9e", + "url": "https://api.github.com/repos/symfony/finder/zipball/d2f29dac98e96a98be467627bd49c2efb1bc2590", + "reference": "d2f29dac98e96a98be467627bd49c2efb1bc2590", "shasum": "" }, "require": { - "php": ">=7.2.5" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php80": "^1.16" }, "type": "library", "autoload": { @@ -2727,7 +2801,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.2.2" + "source": "https://github.com/symfony/finder/tree/v5.4.0" }, "funding": [ { @@ -2743,20 +2817,20 @@ "type": "tidelift" } ], - "time": "2021-01-27T10:01:46+00:00" + "time": "2021-11-28T15:25:38+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.22.0", + "version": "v1.23.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "c6c942b1ac76c82448322025e084cadc56048b4e" + "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e", - "reference": "c6c942b1ac76c82448322025e084cadc56048b4e", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", "shasum": "" }, "require": { @@ -2768,7 +2842,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2806,7 +2880,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" }, "funding": [ { @@ -2822,20 +2896,20 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2021-02-19T12:13:01+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.22.0", + "version": "v1.23.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "267a9adeb8ecb8071040a740930e077cdfb987af" + "reference": "16880ba9c5ebe3642d1995ab866db29270b36535" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/267a9adeb8ecb8071040a740930e077cdfb987af", - "reference": "267a9adeb8ecb8071040a740930e077cdfb987af", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/16880ba9c5ebe3642d1995ab866db29270b36535", + "reference": "16880ba9c5ebe3642d1995ab866db29270b36535", "shasum": "" }, "require": { @@ -2847,7 +2921,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2887,7 +2961,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.22.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.23.1" }, "funding": [ { @@ -2903,20 +2977,20 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2021-05-27T12:26:48+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.22.0", + "version": "v1.23.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "6e971c891537eb617a00bb07a43d182a6915faba" + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/6e971c891537eb617a00bb07a43d182a6915faba", - "reference": "6e971c891537eb617a00bb07a43d182a6915faba", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", "shasum": "" }, "require": { @@ -2928,7 +3002,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2971,7 +3045,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.22.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0" }, "funding": [ { @@ -2987,20 +3061,20 @@ "type": "tidelift" } ], - "time": "2021-01-07T17:09:11+00:00" + "time": "2021-02-19T12:13:01+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.22.0", + "version": "v1.23.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13" + "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f377a3dd1fde44d37b9831d68dc8dea3ffd28e13", - "reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6", + "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6", "shasum": "" }, "require": { @@ -3012,7 +3086,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3051,7 +3125,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.22.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1" }, "funding": [ { @@ -3067,20 +3141,20 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2021-05-27T12:26:48+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.22.0", + "version": "v1.23.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2" + "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/a678b42e92f86eca04b7fa4c0f6f19d097fb69e2", - "reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", + "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", "shasum": "" }, "require": { @@ -3089,7 +3163,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3130,7 +3204,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.22.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.23.0" }, "funding": [ { @@ -3146,20 +3220,20 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2021-02-19T12:13:01+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.22.0", + "version": "v1.23.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91" + "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/dc3063ba22c2a1fd2f45ed856374d79114998f91", - "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be", + "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be", "shasum": "" }, "require": { @@ -3168,7 +3242,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3213,7 +3287,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.22.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.23.1" }, "funding": [ { @@ -3229,25 +3303,25 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2021-07-28T13:41:28+00:00" }, { "name": "symfony/process", - "version": "v5.2.2", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "313a38f09c77fbcdc1d223e57d368cea76a2fd2f" + "reference": "5be20b3830f726e019162b26223110c8f47cf274" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/313a38f09c77fbcdc1d223e57d368cea76a2fd2f", - "reference": "313a38f09c77fbcdc1d223e57d368cea76a2fd2f", + "url": "https://api.github.com/repos/symfony/process/zipball/5be20b3830f726e019162b26223110c8f47cf274", + "reference": "5be20b3830f726e019162b26223110c8f47cf274", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.15" + "symfony/polyfill-php80": "^1.16" }, "type": "library", "autoload": { @@ -3275,7 +3349,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.2.2" + "source": "https://github.com/symfony/process/tree/v5.4.0" }, "funding": [ { @@ -3291,25 +3365,28 @@ "type": "tidelift" } ], - "time": "2021-01-27T10:15:41+00:00" + "time": "2021-11-28T15:25:38+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.2.0", + "version": "v3.0.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1" + "reference": "36715ebf9fb9db73db0cb24263c79077c6fe8603" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d15da7ba4957ffb8f1747218be9e1a121fd298a1", - "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/36715ebf9fb9db73db0cb24263c79077c6fe8603", + "reference": "36715ebf9fb9db73db0cb24263c79077c6fe8603", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/container": "^1.0" + "php": ">=8.0.2", + "psr/container": "^2.0" + }, + "conflict": { + "ext-psr": "<1.1|>=2" }, "suggest": { "symfony/service-implementation": "" @@ -3317,7 +3394,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -3354,7 +3431,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/master" + "source": "https://github.com/symfony/service-contracts/tree/v3.0.0" }, "funding": [ { @@ -3370,35 +3447,37 @@ "type": "tidelift" } ], - "time": "2020-09-07T11:33:47+00:00" + "time": "2021-11-04T17:53:12+00:00" }, { "name": "symfony/string", - "version": "v5.2.2", + "version": "v6.0.0", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "c95468897f408dd0aca2ff582074423dd0455122" + "reference": "ba727797426af0f587f4800566300bdc0cda0777" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/c95468897f408dd0aca2ff582074423dd0455122", - "reference": "c95468897f408dd0aca2ff582074423dd0455122", + "url": "https://api.github.com/repos/symfony/string/zipball/ba727797426af0f587f4800566300bdc0cda0777", + "reference": "ba727797426af0f587f4800566300bdc0cda0777", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.0.2", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "~1.15" + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/translation-contracts": "<2.0" }, "require-dev": { - "symfony/error-handler": "^4.4|^5.0", - "symfony/http-client": "^4.4|^5.0", - "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0" + "symfony/error-handler": "^5.4|^6.0", + "symfony/http-client": "^5.4|^6.0", + "symfony/translation-contracts": "^2.0|^3.0", + "symfony/var-exporter": "^5.4|^6.0" }, "type": "library", "autoload": { @@ -3437,7 +3516,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.2.2" + "source": "https://github.com/symfony/string/tree/v6.0.0" }, "funding": [ { @@ -3453,32 +3532,32 @@ "type": "tidelift" } ], - "time": "2021-01-25T15:14:59+00:00" + "time": "2021-10-29T07:35:21+00:00" }, { "name": "symfony/yaml", - "version": "v5.2.2", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "6bb8b36c6dea8100268512bf46e858c8eb5c545e" + "reference": "034ccc0994f1ae3f7499fa5b1f2e75d5e7a94efc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/6bb8b36c6dea8100268512bf46e858c8eb5c545e", - "reference": "6bb8b36c6dea8100268512bf46e858c8eb5c545e", + "url": "https://api.github.com/repos/symfony/yaml/zipball/034ccc0994f1ae3f7499fa5b1f2e75d5e7a94efc", + "reference": "034ccc0994f1ae3f7499fa5b1f2e75d5e7a94efc", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/polyfill-ctype": "~1.8" + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/console": "<4.4" + "symfony/console": "<5.3" }, "require-dev": { - "symfony/console": "^4.4|^5.0" + "symfony/console": "^5.3|^6.0" }, "suggest": { "symfony/console": "For validating YAML files using the lint command" @@ -3512,7 +3591,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v5.2.2" + "source": "https://github.com/symfony/yaml/tree/v5.4.0" }, "funding": [ { @@ -3528,20 +3607,20 @@ "type": "tidelift" } ], - "time": "2021-01-27T10:01:46+00:00" + "time": "2021-11-28T15:25:38+00:00" }, { "name": "theseer/tokenizer", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "75a63c33a8577608444246075ea0af0d052e452a" + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a", - "reference": "75a63c33a8577608444246075ea0af0d052e452a", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", "shasum": "" }, "require": { @@ -3570,7 +3649,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/master" + "source": "https://github.com/theseer/tokenizer/tree/1.2.1" }, "funding": [ { @@ -3578,34 +3657,39 @@ "type": "github" } ], - "time": "2020-07-12T23:59:07+00:00" + "time": "2021-07-28T10:34:58+00:00" }, { "name": "webmozart/assert", - "version": "1.9.1", + "version": "1.10.0", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0 || ^8.0", + "php": "^7.2 || ^8.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<3.9.1" + "vimeo/psalm": "<4.6.1 || 4.6.2" }, "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.5.13" + "phpunit/phpunit": "^8.5.13" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -3629,9 +3713,9 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.9.1" + "source": "https://github.com/webmozarts/assert/tree/1.10.0" }, - "time": "2020-07-08T17:02:28+00:00" + "time": "2021-03-09T10:59:23+00:00" }, { "name": "wp-coding-standards/wpcs", @@ -3686,16 +3770,16 @@ }, { "name": "wp-phpunit/wp-phpunit", - "version": "5.6.0", + "version": "5.8.2", "source": { "type": "git", "url": "https://github.com/wp-phpunit/wp-phpunit.git", - "reference": "7130a214573cc8c12a0f8fe8a74b18b453bce1e9" + "reference": "0cefcc49fd8a7e8c2f8d755e314532441618aee5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-phpunit/wp-phpunit/zipball/7130a214573cc8c12a0f8fe8a74b18b453bce1e9", - "reference": "7130a214573cc8c12a0f8fe8a74b18b453bce1e9", + "url": "https://api.github.com/repos/wp-phpunit/wp-phpunit/zipball/0cefcc49fd8a7e8c2f8d755e314532441618aee5", + "reference": "0cefcc49fd8a7e8c2f8d755e314532441618aee5", "shasum": "" }, "type": "library", @@ -3730,7 +3814,68 @@ "issues": "https://github.com/wp-phpunit/issues", "source": "https://github.com/wp-phpunit/wp-phpunit" }, - "time": "2020-12-09T18:06:02+00:00" + "time": "2021-11-10T19:49:29+00:00" + }, + { + "name": "yoast/phpunit-polyfills", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/Yoast/PHPUnit-Polyfills.git", + "reference": "5ea3536428944955f969bc764bbe09738e151ada" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/5ea3536428944955f969bc764bbe09738e151ada", + "reference": "5ea3536428944955f969bc764bbe09738e151ada", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "require-dev": { + "yoast/yoastcs": "^2.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "autoload": { + "files": [ + "phpunitpolyfills-autoload.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Team Yoast", + "email": "support@yoast.com", + "homepage": "https://yoast.com" + }, + { + "name": "Contributors", + "homepage": "https://github.com/Yoast/PHPUnit-Polyfills/graphs/contributors" + } + ], + "description": "Set of polyfills for changed PHPUnit functionality to allow for creating PHPUnit cross-version compatible tests", + "homepage": "https://github.com/Yoast/PHPUnit-Polyfills", + "keywords": [ + "phpunit", + "polyfill", + "testing" + ], + "support": { + "issues": "https://github.com/Yoast/PHPUnit-Polyfills/issues", + "source": "https://github.com/Yoast/PHPUnit-Polyfills" + }, + "time": "2021-11-23T01:37:03+00:00" }, { "name": "yosymfony/resource-watcher", @@ -3797,5 +3942,5 @@ "prefer-lowest": false, "platform": [], "platform-dev": [], - "plugin-api-version": "2.0.0" + "plugin-api-version": "2.1.0" } diff --git a/lib/compat.php b/lib/compat.php index 8d1f908161870e..f328928085efa9 100644 --- a/lib/compat.php +++ b/lib/compat.php @@ -191,3 +191,54 @@ function gutenberg_safe_style_attrs( $attrs ) { return $attrs; } add_filter( 'safe_style_css', 'gutenberg_safe_style_attrs' ); + +/** + * The new gallery block format is not compatible with the use_BalanceTags option + * in WP versions <= 5.8 https://core.trac.wordpress.org/ticket/54130. + * This method adds a variable to the wp namespace to indicate if the new gallery block + * format can be enabled or not. It needs to be added this early and to the wp namespace + * as it needs to be available when the intial block parsing runs on editor load, and most of + * the editor store and standard flags are not loaded yet at that point + * + * @since 12.1.0 + * @todo This should be removed when the minimum required WP version is >= 5.9. + * + * @return void. + */ +function gutenberg_check_gallery_block_v2_compatibility() { + $use_balance_tags = (int) get_option( 'use_balanceTags' ); + $v2_gallery_enabled = boolval( 1 !== $use_balance_tags || is_wp_version_compatible( '5.9' ) ) ? 'true' : 'false'; + + wp_add_inline_script( + 'wp-dom-ready', + 'wp.galleryBlockV2Enabled = ' . $v2_gallery_enabled . ';', + 'after' + ); +} +add_action( 'init', 'gutenberg_check_gallery_block_v2_compatibility' ); + +/** + * Prevent use_balanceTags being enabled on WordPress 5.8 or earlier as it breaks + * the layout of the new Gallery block. + * + * @since 12.1.0 + * @todo This should be removed when the minimum required WP version is >= 5.9. + * + * @param int $new_value The new value for use_balanceTags. + */ +function gutenberg_use_balancetags_check( $new_value ) { + global $wp_version; + + if ( 1 === (int) $new_value && version_compare( $wp_version, '5.9', '<' ) ) { + /* translators: %s: Minimum required version */ + $message = sprintf( __( 'Gutenberg requires WordPress %s or later in order to enable the “Correct invalidly nested XHTML automatically” option. Please upgrade WordPress before enabling.', 'gutenberg' ), '5.9' ); + add_settings_error( 'gutenberg_use_balancetags_check', 'gutenberg_use_balancetags_check', $message, 'error' ); + if ( class_exists( 'WP_CLI' ) ) { + WP_CLI::error( $message ); + } + return 0; + } + + return $new_value; +} +add_filter( 'pre_update_option_use_balanceTags', 'gutenberg_use_balancetags_check' ); diff --git a/lib/class-wp-theme-json-gutenberg.php b/lib/compat/wordpress-5.9/class-wp-theme-json-gutenberg.php similarity index 100% rename from lib/class-wp-theme-json-gutenberg.php rename to lib/compat/wordpress-5.9/class-wp-theme-json-gutenberg.php diff --git a/lib/class-wp-theme-json-resolver-gutenberg.php b/lib/compat/wordpress-5.9/class-wp-theme-json-resolver-gutenberg.php similarity index 100% rename from lib/class-wp-theme-json-resolver-gutenberg.php rename to lib/compat/wordpress-5.9/class-wp-theme-json-resolver-gutenberg.php diff --git a/lib/class-wp-theme-json-schema-gutenberg.php b/lib/compat/wordpress-5.9/class-wp-theme-json-schema-gutenberg.php similarity index 100% rename from lib/class-wp-theme-json-schema-gutenberg.php rename to lib/compat/wordpress-5.9/class-wp-theme-json-schema-gutenberg.php diff --git a/lib/theme-i18n.json b/lib/compat/wordpress-5.9/theme-i18n.json similarity index 100% rename from lib/theme-i18n.json rename to lib/compat/wordpress-5.9/theme-i18n.json diff --git a/lib/theme.json b/lib/compat/wordpress-5.9/theme.json similarity index 100% rename from lib/theme.json rename to lib/compat/wordpress-5.9/theme.json diff --git a/lib/experiments-page.php b/lib/experiments-page.php index bd4ca968073f8a..75d4b529ee2256 100644 --- a/lib/experiments-page.php +++ b/lib/experiments-page.php @@ -101,7 +101,7 @@ function gutenberg_experiments_editor_settings( $settings ) { // This bypass needs to remain in place until this is resolved and a patch released. // https://core.trac.wordpress.org/ticket/54130. $experiments_settings = array( - '__unstableGalleryWithImageBlocks' => (int) get_option( 'use_balanceTags' ) !== 1, + '__unstableGalleryWithImageBlocks' => (int) get_option( 'use_balanceTags' ) !== 1 || is_wp_version_compatible( '5.9' ), ); return array_merge( $settings, $experiments_settings ); } diff --git a/lib/load.php b/lib/load.php index b34b9c1acbeb92..1262c56f0dd304 100644 --- a/lib/load.php +++ b/lib/load.php @@ -106,9 +106,9 @@ function gutenberg_is_experiment_enabled( $name ) { // These are used by some FSE features // as well as global styles. -require __DIR__ . '/class-wp-theme-json-schema-gutenberg.php'; -require __DIR__ . '/class-wp-theme-json-gutenberg.php'; -require __DIR__ . '/class-wp-theme-json-resolver-gutenberg.php'; +require __DIR__ . '/compat/wordpress-5.9/class-wp-theme-json-schema-gutenberg.php'; +require __DIR__ . '/compat/wordpress-5.9/class-wp-theme-json-gutenberg.php'; +require __DIR__ . '/compat/wordpress-5.9/class-wp-theme-json-resolver-gutenberg.php'; require __DIR__ . '/full-site-editing/full-site-editing.php'; require __DIR__ . '/full-site-editing/block-templates.php'; diff --git a/package-lock.json b/package-lock.json index 061152b2fb71df..949c5154992645 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "gutenberg", - "version": "12.0.1", + "version": "12.1.0-rc.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 3f6ceca845257f..1610767188b47f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gutenberg", - "version": "12.0.1", + "version": "12.1.0-rc.1", "private": true, "description": "A new WordPress editor experience.", "author": "The WordPress Contributors", diff --git a/packages/block-editor/src/components/block-inspector/index.js b/packages/block-editor/src/components/block-inspector/index.js index 46bcd7baba5232..735a7cf8e4a6db 100644 --- a/packages/block-editor/src/components/block-inspector/index.js +++ b/packages/block-editor/src/components/block-inspector/index.js @@ -30,10 +30,7 @@ import BlockVariationTransforms from '../block-variation-transforms'; import useBlockDisplayInformation from '../use-block-display-information'; import { store as blockEditorStore } from '../../store'; -const BlockInspector = ( { - showNoBlockSelectedMessage = true, - bubblesVirtually = true, -} ) => { +const BlockInspector = ( { showNoBlockSelectedMessage = true } ) => { const { count, hasBlockStyles, @@ -69,7 +66,7 @@ const BlockInspector = ( { return ( <div className="block-editor-block-inspector"> <MultiSelectionInspector /> - <InspectorControls.Slot bubblesVirtually={ bubblesVirtually } /> + <InspectorControls.Slot /> </div> ); } @@ -100,7 +97,6 @@ const BlockInspector = ( { clientId={ selectedBlockClientId } blockName={ blockType.name } hasBlockStyles={ hasBlockStyles } - bubblesVirtually={ bubblesVirtually } /> ); }; @@ -109,7 +105,6 @@ const BlockInspectorSingleBlock = ( { clientId, blockName, hasBlockStyles, - bubblesVirtually, } ) => { const blockInformation = useBlockDisplayInformation( clientId ); return ( @@ -122,7 +117,6 @@ const BlockInspectorSingleBlock = ( { <BlockStyles scope="core/edit-post" clientId={ clientId } - className="block-inspector__block-styles" /> { hasBlockSupport( blockName, @@ -132,31 +126,28 @@ const BlockInspectorSingleBlock = ( { </PanelBody> </div> ) } - <InspectorControls.Slot bubblesVirtually={ bubblesVirtually } /> + <InspectorControls.Slot /> <InspectorControls.Slot __experimentalGroup="typography" - bubblesVirtually={ bubblesVirtually } label={ __( 'Typography' ) } /> <InspectorControls.Slot __experimentalGroup="border" - bubblesVirtually={ bubblesVirtually } label={ __( 'Border' ) } /> <InspectorControls.Slot __experimentalGroup="dimensions" - bubblesVirtually={ bubblesVirtually } label={ __( 'Dimensions' ) } /> <div> - <AdvancedControls bubblesVirtually={ bubblesVirtually } /> + <AdvancedControls /> </div> <SkipToSelectedBlock key="back" /> </div> ); }; -const AdvancedControls = ( { bubblesVirtually } ) => { +const AdvancedControls = () => { const slot = useSlot( InspectorAdvancedControls.slotName ); const hasFills = Boolean( slot.fills && slot.fills.length ); @@ -170,10 +161,7 @@ const AdvancedControls = ( { bubblesVirtually } ) => { title={ __( 'Advanced' ) } initialOpen={ false } > - <InspectorControls.Slot - __experimentalGroup="advanced" - bubblesVirtually={ bubblesVirtually } - /> + <InspectorControls.Slot __experimentalGroup="advanced" /> </PanelBody> ); }; diff --git a/packages/block-editor/src/components/block-styles/index.js b/packages/block-editor/src/components/block-styles/index.js index 74c568d5db84c1..412e706f5221e7 100644 --- a/packages/block-editor/src/components/block-styles/index.js +++ b/packages/block-editor/src/components/block-styles/index.js @@ -35,6 +35,11 @@ function BlockStylesPreviewPanelFill( { children, scope, ...props } ) { ); } +// Top position (in px) of the Block Styles container +// relative to the editor pane. +// The value is the equivalent of the container's right position. +const DEFAULT_POSITION_TOP = 16; + // Block Styles component for the Settings Sidebar. function BlockStyles( { clientId, @@ -60,7 +65,8 @@ function BlockStyles( { const scrollContainer = document.querySelector( '.interface-interface-skeleton__content' ); - setContainerScrollTop( scrollContainer.scrollTop + 16 ); + const scrollTop = scrollContainer?.scrollTop || 0; + setContainerScrollTop( scrollTop + DEFAULT_POSITION_TOP ); }, [ hoveredStyle ] ); if ( ! stylesToRender || stylesToRender.length === 0 ) { diff --git a/packages/block-editor/src/components/block-styles/style.scss b/packages/block-editor/src/components/block-styles/style.scss index 5878b340f96f91..af408dbea9e425 100644 --- a/packages/block-editor/src/components/block-styles/style.scss +++ b/packages/block-editor/src/components/block-styles/style.scss @@ -1,3 +1,7 @@ +.block-editor-block-styles + .default-style-picker__default-switcher { + margin-top: $grid-unit-20; +} + .block-editor-block-styles__preview-panel { display: none; position: absolute; diff --git a/packages/block-editor/src/components/colors-gradients/control.js b/packages/block-editor/src/components/colors-gradients/control.js index 9cb4342fb3a2f1..783b35a6a5c221 100644 --- a/packages/block-editor/src/components/colors-gradients/control.js +++ b/packages/block-editor/src/components/colors-gradients/control.js @@ -36,6 +36,7 @@ function ColorGradientControlInner( { disableCustomColors, disableCustomGradients, __experimentalHasMultipleOrigins, + __experimentalIsRenderedInSidebar, className, label, onColorChange, @@ -109,6 +110,9 @@ function ColorGradientControlInner( { __experimentalHasMultipleOrigins={ __experimentalHasMultipleOrigins } + __experimentalIsRenderedInSidebar={ + __experimentalIsRenderedInSidebar + } clearable={ clearable } enableAlpha={ enableAlpha } /> diff --git a/packages/block-editor/src/components/colors-gradients/panel-color-gradient-settings.js b/packages/block-editor/src/components/colors-gradients/panel-color-gradient-settings.js index d2b5b383ddf686..02b7c086c27ea6 100644 --- a/packages/block-editor/src/components/colors-gradients/panel-color-gradient-settings.js +++ b/packages/block-editor/src/components/colors-gradients/panel-color-gradient-settings.js @@ -93,6 +93,7 @@ export const PanelColorGradientSettingsInner = ( { title, showTitle = true, __experimentalHasMultipleOrigins, + __experimentalIsRenderedInSidebar, enableAlpha, ...props } ) => { @@ -145,6 +146,7 @@ export const PanelColorGradientSettingsInner = ( { disableCustomColors, disableCustomGradients, __experimentalHasMultipleOrigins, + __experimentalIsRenderedInSidebar, enableAlpha, ...setting, } } diff --git a/packages/block-editor/src/components/default-style-picker/index.js b/packages/block-editor/src/components/default-style-picker/index.js index c8c565b6fc8254..a897e1883763f2 100644 --- a/packages/block-editor/src/components/default-style-picker/index.js +++ b/packages/block-editor/src/components/default-style-picker/index.js @@ -57,12 +57,14 @@ export default function DefaultStylePicker( { blockName } ) { return ( onUpdatePreferredStyleVariations && ( - <SelectControl - options={ selectOptions } - value={ preferredStyle || '' } - label={ __( 'Default Style' ) } - onChange={ selectOnChange } - /> + <div className="default-style-picker__default-switcher"> + <SelectControl + options={ selectOptions } + value={ preferredStyle || '' } + label={ __( 'Default Style' ) } + onChange={ selectOnChange } + /> + </div> ) ); } diff --git a/packages/block-editor/src/components/default-style-picker/style.scss b/packages/block-editor/src/components/default-style-picker/style.scss deleted file mode 100644 index af1ec4c5cc1cff..00000000000000 --- a/packages/block-editor/src/components/default-style-picker/style.scss +++ /dev/null @@ -1,3 +0,0 @@ -.default-style-picker__default-switcher { - text-align: center; -} diff --git a/packages/block-editor/src/components/inserter/index.native.js b/packages/block-editor/src/components/inserter/index.native.js index c370dfc55ed1e1..45ed8c1bfd8f9b 100644 --- a/packages/block-editor/src/components/inserter/index.native.js +++ b/packages/block-editor/src/components/inserter/index.native.js @@ -7,7 +7,7 @@ import { delay } from 'lodash'; /** * WordPress dependencies */ -import { __ } from '@wordpress/i18n'; +import { __, _x } from '@wordpress/i18n'; import { Dropdown, ToolbarButton, Picker } from '@wordpress/components'; import { Component } from '@wordpress/element'; import { withDispatch, withSelect } from '@wordpress/data'; @@ -34,7 +34,7 @@ const VOICE_OVER_ANNOUNCEMENT_DELAY = 1000; const defaultRenderToggle = ( { onToggle, disabled, style, onLongPress } ) => ( <ToolbarButton - title={ __( 'Add block' ) } + title={ _x( 'Add block', 'Generic label for block inserter button' ) } icon={ <Icon icon={ plusCircleFilled } diff --git a/packages/block-editor/src/components/inspector-controls/block-support-slot-container.js b/packages/block-editor/src/components/inspector-controls/block-support-slot-container.js index e450ab8b0d4073..fb53e47afbd82e 100644 --- a/packages/block-editor/src/components/inspector-controls/block-support-slot-container.js +++ b/packages/block-editor/src/components/inspector-controls/block-support-slot-container.js @@ -6,5 +6,7 @@ import { useContext } from '@wordpress/element'; export default function BlockSupportSlotContainer( { Slot, ...props } ) { const toolsPanelContext = useContext( ToolsPanelContext ); - return <Slot { ...props } fillProps={ toolsPanelContext } />; + return ( + <Slot { ...props } fillProps={ toolsPanelContext } bubblesVirtually /> + ); } diff --git a/packages/block-editor/src/components/inspector-controls/slot.js b/packages/block-editor/src/components/inspector-controls/slot.js index c9da21817103d3..1f30357cf7815e 100644 --- a/packages/block-editor/src/components/inspector-controls/slot.js +++ b/packages/block-editor/src/components/inspector-controls/slot.js @@ -13,7 +13,6 @@ import groups from './groups'; export default function InspectorControlsSlot( { __experimentalGroup: group = 'default', - bubblesVirtually = true, label, ...props } ) { @@ -32,14 +31,10 @@ export default function InspectorControlsSlot( { if ( label ) { return ( <BlockSupportToolsPanel group={ group } label={ label }> - <BlockSupportSlotContainer - { ...props } - bubblesVirtually={ bubblesVirtually } - Slot={ Slot } - /> + <BlockSupportSlotContainer { ...props } Slot={ Slot } /> </BlockSupportToolsPanel> ); } - return <Slot { ...props } bubblesVirtually={ bubblesVirtually } />; + return <Slot { ...props } bubblesVirtually />; } diff --git a/packages/block-editor/src/components/link-control/style.scss b/packages/block-editor/src/components/link-control/style.scss index ecaaa8cc2a6047..29b1028d489a86 100644 --- a/packages/block-editor/src/components/link-control/style.scss +++ b/packages/block-editor/src/components/link-control/style.scss @@ -197,12 +197,16 @@ $preview-image-height: 140px; // of text, particular those with no spaces. // See: https://github.com/WordPress/gutenberg/issues/33586#issuecomment-888921188 white-space: pre-wrap; - word-wrap: break-word; + overflow-wrap: break-word; + + .block-editor-link-control__search-item-info { + word-break: break-all; + } } &.is-preview .block-editor-link-control__search-item-header { display: flex; - flex: 1; // fill available space. + flex: 1; // Fill available space. } &.is-error .block-editor-link-control__search-item-header { diff --git a/packages/block-editor/src/hooks/border-color.js b/packages/block-editor/src/hooks/border-color.js index 6c7e00a08c5974..5b5926462e9268 100644 --- a/packages/block-editor/src/hooks/border-color.js +++ b/packages/block-editor/src/hooks/border-color.js @@ -96,6 +96,7 @@ export function BorderColorEdit( props ) { onColorChange={ onChangeColor } clearable={ false } __experimentalHasMultipleOrigins + __experimentalIsRenderedInSidebar { ...colorGradientSettings } /> ); diff --git a/packages/block-editor/src/hooks/color-panel.js b/packages/block-editor/src/hooks/color-panel.js index e52b628a5a5265..9c018f6c649c43 100644 --- a/packages/block-editor/src/hooks/color-panel.js +++ b/packages/block-editor/src/hooks/color-panel.js @@ -61,6 +61,7 @@ export default function ColorPanel( { settings={ settings } showTitle={ showTitle } __experimentalHasMultipleOrigins + __experimentalIsRenderedInSidebar > { enableContrastChecking && ( <ContrastChecker diff --git a/packages/block-editor/src/style.scss b/packages/block-editor/src/style.scss index 40a672fb2890be..6f20a3b1b29012 100644 --- a/packages/block-editor/src/style.scss +++ b/packages/block-editor/src/style.scss @@ -30,7 +30,6 @@ @import "./components/colors-gradients/style.scss"; @import "./components/contrast-checker/style.scss"; @import "./components/default-block-appender/style.scss"; -@import "./components/default-style-picker/style.scss"; @import "./components/duotone-control/style.scss"; @import "./components/font-appearance-control/style.scss"; @import "./components/image-size-control/style.scss"; diff --git a/packages/block-library/src/comments-pagination/block.json b/packages/block-library/src/comments-pagination/block.json new file mode 100644 index 00000000000000..f81e64adf028ef --- /dev/null +++ b/packages/block-library/src/comments-pagination/block.json @@ -0,0 +1,38 @@ +{ + "$schema": "https://schemas.wp.org/trunk/block.json", + "apiVersion": 2, + "name": "core/comments-pagination", + "title": "Comments Pagination", + "category": "design", + "parent": [ "core/comments-query-loop" ], + "description": "Displays a paginated navigation to next/previous set of comments, when applicable.", + "textdomain": "default", + "attributes": { + "paginationArrow": { + "type": "string", + "default": "none" + } + }, + "providesContext": { + "paginationArrow": "paginationArrow" + }, + "supports": { + "align": true, + "reusable": false, + "html": false, + "inserter": false, + "color": { + "gradients": true, + "link": true + }, + "__experimentalLayout": { + "allowSwitching": false, + "allowInheriting": false, + "default": { + "type": "flex" + } + } + }, + "editorStyle": "wp-block-comments-pagination-editor", + "style": "wp-block-comments-pagination" +} diff --git a/packages/block-library/src/comments-pagination/comments-pagination-arrow-controls.js b/packages/block-library/src/comments-pagination/comments-pagination-arrow-controls.js new file mode 100644 index 00000000000000..03b1b26cd80000 --- /dev/null +++ b/packages/block-library/src/comments-pagination/comments-pagination-arrow-controls.js @@ -0,0 +1,44 @@ +/** + * WordPress dependencies + */ +import { __, _x } from '@wordpress/i18n'; +import { + __experimentalToggleGroupControl as ToggleGroupControl, + __experimentalToggleGroupControlOption as ToggleGroupControlOption, +} from '@wordpress/components'; + +export function CommentsPaginationArrowControls( { value, onChange } ) { + return ( + <ToggleGroupControl + label={ __( 'Arrow' ) } + value={ value } + onChange={ onChange } + help={ __( + 'A decorative arrow appended to the next and previous comments link.' + ) } + isBlock + > + <ToggleGroupControlOption + value="none" + label={ _x( + 'None', + 'Arrow option for Comments Pagination Next/Previous blocks' + ) } + /> + <ToggleGroupControlOption + value="arrow" + label={ _x( + 'Arrow', + 'Arrow option for Comments Pagination Next/Previous blocks' + ) } + /> + <ToggleGroupControlOption + value="chevron" + label={ _x( + 'Chevron', + 'Arrow option for Comments Pagination Next/Previous blocks' + ) } + /> + </ToggleGroupControl> + ); +} diff --git a/packages/block-library/src/comments-pagination/edit.js b/packages/block-library/src/comments-pagination/edit.js new file mode 100644 index 00000000000000..b75cd887b69582 --- /dev/null +++ b/packages/block-library/src/comments-pagination/edit.js @@ -0,0 +1,70 @@ +/** + * WordPress dependencies + */ +import { __ } from '@wordpress/i18n'; +import { + InspectorControls, + useBlockProps, + useInnerBlocksProps, + store as blockEditorStore, +} from '@wordpress/block-editor'; +import { useSelect } from '@wordpress/data'; +import { getBlockSupport } from '@wordpress/blocks'; +import { PanelBody } from '@wordpress/components'; + +/** + * Internal dependencies + */ +import { CommentsPaginationArrowControls } from './comments-pagination-arrow-controls'; + +const getDefaultBlockLayout = ( blockTypeOrName ) => { + const layoutBlockSupportConfig = getBlockSupport( + blockTypeOrName, + '__experimentalLayout' + ); + return layoutBlockSupportConfig?.default; +}; + +export default function QueryPaginationEdit( { + attributes: { paginationArrow, layout }, + setAttributes, + clientId, + name, +} ) { + const usedLayout = layout || getDefaultBlockLayout( name ); + const hasNextPreviousBlocks = useSelect( ( select ) => { + const { getBlocks } = select( blockEditorStore ); + const innerBlocks = getBlocks( clientId ); + /** + * Show the `paginationArrow` control only if a + * `QueryPaginationNext/Previous` block exists. + */ + return innerBlocks?.find( ( innerBlock ) => { + return [ + 'core/query-pagination-next', + 'core/query-pagination-previous', + ].includes( innerBlock.name ); + } ); + }, [] ); + const blockProps = useBlockProps(); + const innerBlocksProps = useInnerBlocksProps( blockProps, { + __experimentalLayout: usedLayout, + } ); + return ( + <> + { hasNextPreviousBlocks && ( + <InspectorControls> + <PanelBody title={ __( 'Settings' ) }> + <CommentsPaginationArrowControls + value={ paginationArrow } + onChange={ ( value ) => { + setAttributes( { paginationArrow: value } ); + } } + /> + </PanelBody> + </InspectorControls> + ) } + <div { ...innerBlocksProps } /> + </> + ); +} diff --git a/packages/block-library/src/comments-pagination/editor.scss b/packages/block-library/src/comments-pagination/editor.scss new file mode 100644 index 00000000000000..dbf7e60ff65c06 --- /dev/null +++ b/packages/block-library/src/comments-pagination/editor.scss @@ -0,0 +1,34 @@ +$pagination-margin: 0.5em; + +// Center flex items. This has an equivalent in style.scss. +.wp-block[data-align="center"] > .wp-block-comments-pagination { + justify-content: center; +} + +.editor-styles-wrapper { + .wp-block-comments-pagination { + max-width: 100%; + &.block-editor-block-list__layout { + margin: 0; + } + } +} + +.wp-block-comments-pagination { + > .wp-block-comments-pagination-next, + > .wp-block-comments-pagination-previous, + > .wp-block-comments-pagination-numbers { + // Override editor auto block margins. + margin-left: 0; + margin-top: $pagination-margin; + + /*rtl:ignore*/ + margin-right: $pagination-margin; + margin-bottom: $pagination-margin; + + &:last-child { + /*rtl:ignore*/ + margin-right: 0; + } + } +} diff --git a/packages/block-library/src/comments-pagination/index.js b/packages/block-library/src/comments-pagination/index.js new file mode 100644 index 00000000000000..a15bdd4389cee5 --- /dev/null +++ b/packages/block-library/src/comments-pagination/index.js @@ -0,0 +1,20 @@ +/** + * WordPress dependencies + */ +import { queryPagination as icon } from '@wordpress/icons'; + +/** + * Internal dependencies + */ +import metadata from './block.json'; +import edit from './edit'; +import save from './save'; + +const { name } = metadata; +export { metadata, name }; + +export const settings = { + icon, + edit, + save, +}; diff --git a/packages/block-library/src/comments-pagination/index.php b/packages/block-library/src/comments-pagination/index.php new file mode 100644 index 00000000000000..d7248d03b7381f --- /dev/null +++ b/packages/block-library/src/comments-pagination/index.php @@ -0,0 +1,39 @@ +<?php +/** + * Server-side rendering of the `core/comments-pagination` block. + * + * @package WordPress + */ + +/** + * Renders the `core/comments-pagination` block on the server. + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * + * @return string Returns the wrapper for the Comments pagination. + */ +function render_block_core_comments_pagination( $attributes, $content ) { + if ( empty( trim( $content ) ) ) { + return ''; + } + + return sprintf( + '<div %1$s>%2$s</div>', + get_block_wrapper_attributes(), + $content + ); +} + +/** + * Registers the `core/comments-pagination` block on the server. + */ +function register_block_core_comments_pagination() { + register_block_type_from_metadata( + __DIR__ . '/comments-pagination', + array( + 'render_callback' => 'render_block_core_comments_pagination', + ) + ); +} +add_action( 'init', 'register_block_core_comments_pagination' ); diff --git a/packages/block-library/src/comments-pagination/save.js b/packages/block-library/src/comments-pagination/save.js new file mode 100644 index 00000000000000..17571d8f30d2de --- /dev/null +++ b/packages/block-library/src/comments-pagination/save.js @@ -0,0 +1,8 @@ +/** + * WordPress dependencies + */ +import { InnerBlocks } from '@wordpress/block-editor'; + +export default function save() { + return <InnerBlocks.Content />; +} diff --git a/packages/block-library/src/comments-pagination/style.scss b/packages/block-library/src/comments-pagination/style.scss new file mode 100644 index 00000000000000..c6b5d9a0a29e91 --- /dev/null +++ b/packages/block-library/src/comments-pagination/style.scss @@ -0,0 +1,38 @@ +$pagination-margin: 0.5em; +.wp-block-comments-pagination { + // Increased specificity to override blocks default margin. + > .wp-block-comments-pagination-next, + > .wp-block-comments-pagination-previous, + > .wp-block-comments-pagination-numbers { + /*rtl:ignore*/ + margin-right: $pagination-margin; + margin-bottom: $pagination-margin; + + &:last-child { + /*rtl:ignore*/ + margin-right: 0; + } + } + .wp-block-comments-pagination-previous-arrow { + margin-right: 1ch; + display: inline-block; // Needed so that the transform works. + // chevron(`»`) symbol doesn't need the mirroring by us. + &:not(.is-arrow-chevron) { + // Flip for RTL. + transform: scaleX(1) #{"/*rtl:scaleX(-1);*/"}; // This points the arrow right for LTR and left for RTL. + } + } + .wp-block-comments-pagination-next-arrow { + margin-left: 1ch; + display: inline-block; // Needed so that the transform works. + // chevron(`»`) symbol doesn't need the mirroring by us. + &:not(.is-arrow-chevron) { + // Flip for RTL. + transform: scaleX(1) #{"/*rtl:scaleX(-1);*/"}; // This points the arrow right for LTR and left for RTL. + } + } + + &.aligncenter { + justify-content: center; + } +} diff --git a/packages/block-library/src/cover/edit.js b/packages/block-library/src/cover/edit.js index cdab1cfca26e0f..ba63d4f28df733 100644 --- a/packages/block-library/src/cover/edit.js +++ b/packages/block-library/src/cover/edit.js @@ -547,6 +547,7 @@ function CoverEdit( { ) } <PanelColorGradientSettings __experimentalHasMultipleOrigins + __experimentalIsRenderedInSidebar title={ __( 'Overlay' ) } initialOpen={ true } settings={ [ diff --git a/packages/block-library/src/gallery/deprecated.js b/packages/block-library/src/gallery/deprecated.js index bc89ebbcc9ab16..001bbba8ea8366 100644 --- a/packages/block-library/src/gallery/deprecated.js +++ b/packages/block-library/src/gallery/deprecated.js @@ -7,7 +7,22 @@ import { map, some } from 'lodash'; /** * WordPress dependencies */ -import { RichText } from '@wordpress/block-editor'; +import { RichText, useBlockProps } from '@wordpress/block-editor'; + +import { createBlock } from '@wordpress/blocks'; + +/** + * Internal dependencies + */ +import { + LINK_DESTINATION_ATTACHMENT, + LINK_DESTINATION_MEDIA, + LINK_DESTINATION_NONE, +} from './constants'; +import { isGalleryV2Enabled } from './shared'; + +const DEPRECATED_LINK_DESTINATION_MEDIA = 'file'; +const DEPRECATED_LINK_DESTINATION_ATTACHMENT = 'post'; /** * Original function to determine default number of columns from a block's @@ -19,422 +34,202 @@ import { RichText } from '@wordpress/block-editor'; * @return {number} Default number of columns for the gallery. */ export function defaultColumnsNumberV1( attributes ) { - return Math.min( 3, attributes.images.length ); + return Math.min( 3, attributes?.images?.length ); } -const deprecated = [ - { - attributes: { - images: { - type: 'array', - default: [], - source: 'query', - selector: '.blocks-gallery-item', - query: { - url: { - type: 'string', - source: 'attribute', - selector: 'img', - attribute: 'src', - }, - fullUrl: { - type: 'string', - source: 'attribute', - selector: 'img', - attribute: 'data-full-url', - }, - link: { - type: 'string', - source: 'attribute', - selector: 'img', - attribute: 'data-link', - }, - alt: { - type: 'string', - source: 'attribute', - selector: 'img', - attribute: 'alt', - default: '', - }, - id: { - type: 'string', - source: 'attribute', - selector: 'img', - attribute: 'data-id', - }, - caption: { - type: 'string', - source: 'html', - selector: '.blocks-gallery-item__caption', - }, - }, - }, - ids: { - type: 'array', - items: { - type: 'number', - }, - default: [], - }, - columns: { - type: 'number', - minimum: 1, - maximum: 8, - }, - caption: { - type: 'string', - source: 'html', - selector: '.blocks-gallery-caption', - }, - imageCrop: { - type: 'boolean', - default: true, - }, - linkTo: { - type: 'string', - default: 'none', - }, - sizeSlug: { - type: 'string', - default: 'large', - }, - }, - supports: { - align: true, - }, - isEligible( { linkTo } ) { - return ! linkTo || linkTo === 'attachment' || linkTo === 'media'; - }, - migrate( attributes ) { - let linkTo = attributes.linkTo; - if ( ! attributes.linkTo ) { - linkTo = 'none'; - } else if ( attributes.linkTo === 'attachment' ) { - linkTo = 'post'; - } else if ( attributes.linkTo === 'media' ) { - linkTo = 'file'; - } +/** + * Original function to determine new href and linkDestination values for an image block from the + * supplied Gallery link destination. + * + * Used in deprecations: v1-6. + * + * @param {Object} image Gallery image. + * @param {string} destination Gallery's selected link destination. + * @return {Object} New attributes to assign to image block. + */ +export function getHrefAndDestination( image, destination ) { + // Need to determine the URL that the selected destination maps to. + // Gutenberg and WordPress use different constants so the new link + // destination also needs to be tweaked. + switch ( destination ) { + case DEPRECATED_LINK_DESTINATION_MEDIA: return { - ...attributes, - linkTo, + href: image?.source_url || image?.url, // eslint-disable-line camelcase + linkDestination: LINK_DESTINATION_MEDIA, }; - }, - save( { attributes } ) { - const { - images, - columns = defaultColumnsNumberV1( attributes ), - imageCrop, - caption, - linkTo, - } = attributes; - - return ( - <figure - className={ `columns-${ columns } ${ - imageCrop ? 'is-cropped' : '' - }` } - > - <ul className="blocks-gallery-grid"> - { images.map( ( image ) => { - let href; - - switch ( linkTo ) { - case 'media': - href = image.fullUrl || image.url; - break; - case 'attachment': - href = image.link; - break; - } + case DEPRECATED_LINK_DESTINATION_ATTACHMENT: + return { + href: image?.link, + linkDestination: LINK_DESTINATION_ATTACHMENT, + }; + case LINK_DESTINATION_MEDIA: + return { + href: image?.source_url || image?.url, // eslint-disable-line camelcase + linkDestination: LINK_DESTINATION_MEDIA, + }; + case LINK_DESTINATION_ATTACHMENT: + return { + href: image?.link, + linkDestination: LINK_DESTINATION_ATTACHMENT, + }; + case LINK_DESTINATION_NONE: + return { + href: undefined, + linkDestination: LINK_DESTINATION_NONE, + }; + } - const img = ( - <img - src={ image.url } - alt={ image.alt } - data-id={ image.id } - data-full-url={ image.fullUrl } - data-link={ image.link } - className={ - image.id - ? `wp-image-${ image.id }` - : null - } - /> - ); - - return ( - <li - key={ image.id || image.url } - className="blocks-gallery-item" - > - <figure> - { href ? ( - <a href={ href }>{ img }</a> - ) : ( - img - ) } - { ! RichText.isEmpty( - image.caption - ) && ( - <RichText.Content - tagName="figcaption" - className="blocks-gallery-item__caption" - value={ image.caption } - /> - ) } - </figure> - </li> - ); - } ) } - </ul> - { ! RichText.isEmpty( caption ) && ( - <RichText.Content - tagName="figcaption" - className="blocks-gallery-caption" - value={ caption } - /> - ) } - </figure> - ); + return {}; +} + +function runV2Migration( attributes ) { + let linkTo = attributes.linkTo ? attributes.linkTo : 'none'; + + if ( linkTo === 'post' ) { + linkTo = 'attachment'; + } else if ( linkTo === 'file' ) { + linkTo = 'media'; + } + + const imageBlocks = attributes.images.map( ( image ) => { + return getImageBlock( image, attributes.sizeSlug, linkTo ); + } ); + + return [ + { + caption: attributes.caption, + columns: attributes.columns, + imageCrop: attributes.imageCrop, + linkTo, + sizeSlug: attributes.sizeSlug, + allowResize: false, }, - }, - { - attributes: { - images: { - type: 'array', - default: [], - source: 'query', - selector: '.blocks-gallery-item', - query: { - url: { - source: 'attribute', - selector: 'img', - attribute: 'src', - }, - fullUrl: { - source: 'attribute', - selector: 'img', - attribute: 'data-full-url', - }, - link: { - source: 'attribute', - selector: 'img', - attribute: 'data-link', - }, - alt: { - source: 'attribute', - selector: 'img', - attribute: 'alt', - default: '', - }, - id: { - source: 'attribute', - selector: 'img', - attribute: 'data-id', - }, - caption: { - type: 'string', - source: 'html', - selector: '.blocks-gallery-item__caption', - }, + imageBlocks, + ]; +} +/** + * Gets an Image block from gallery image data + * + * Used to migrate Galleries to nested Image InnerBlocks. + * + * @param {Object} image Image properties. + * @param {string} sizeSlug Gallery sizeSlug attribute. + * @param {string} linkTo Gallery linkTo attribute. + * @return {Object} Image block. + */ +export function getImageBlock( image, sizeSlug, linkTo ) { + return createBlock( 'core/image', { + ...( image.id && { id: parseInt( image.id ) } ), + url: image.url, + alt: image.alt, + caption: image.caption, + sizeSlug, + ...getHrefAndDestination( image, linkTo ), + } ); +} + +const v6 = { + attributes: { + images: { + type: 'array', + default: [], + source: 'query', + selector: '.blocks-gallery-item', + query: { + url: { + type: 'string', + source: 'attribute', + selector: 'img', + attribute: 'src', + }, + fullUrl: { + type: 'string', + source: 'attribute', + selector: 'img', + attribute: 'data-full-url', + }, + link: { + type: 'string', + source: 'attribute', + selector: 'img', + attribute: 'data-link', + }, + alt: { + type: 'string', + source: 'attribute', + selector: 'img', + attribute: 'alt', + default: '', + }, + id: { + type: 'string', + source: 'attribute', + selector: 'img', + attribute: 'data-id', + }, + caption: { + type: 'string', + source: 'html', + selector: '.blocks-gallery-item__caption', }, }, - ids: { - type: 'array', - default: [], - }, - columns: { + }, + ids: { + type: 'array', + items: { type: 'number', }, - caption: { - type: 'string', - source: 'html', - selector: '.blocks-gallery-caption', - }, - imageCrop: { - type: 'boolean', - default: true, - }, - linkTo: { - type: 'string', - default: 'none', - }, + default: [], }, - supports: { - align: true, + columns: { + type: 'number', + minimum: 1, + maximum: 8, }, - isEligible( { ids } ) { - return ids && ids.some( ( id ) => typeof id === 'string' ); + caption: { + type: 'string', + source: 'html', + selector: '.blocks-gallery-caption', }, - migrate( attributes ) { - return { - ...attributes, - ids: map( attributes.ids, ( id ) => { - const parsedId = parseInt( id, 10 ); - return Number.isInteger( parsedId ) ? parsedId : null; - } ), - }; + imageCrop: { + type: 'boolean', + default: true, }, - save( { attributes } ) { - const { - images, - columns = defaultColumnsNumberV1( attributes ), - imageCrop, - caption, - linkTo, - } = attributes; - - return ( - <figure - className={ `columns-${ columns } ${ - imageCrop ? 'is-cropped' : '' - }` } - > - <ul className="blocks-gallery-grid"> - { images.map( ( image ) => { - let href; - - switch ( linkTo ) { - case 'media': - href = image.fullUrl || image.url; - break; - case 'attachment': - href = image.link; - break; - } - - const img = ( - <img - src={ image.url } - alt={ image.alt } - data-id={ image.id } - data-full-url={ image.fullUrl } - data-link={ image.link } - className={ - image.id - ? `wp-image-${ image.id }` - : null - } - /> - ); - - return ( - <li - key={ image.id || image.url } - className="blocks-gallery-item" - > - <figure> - { href ? ( - <a href={ href }>{ img }</a> - ) : ( - img - ) } - { ! RichText.isEmpty( - image.caption - ) && ( - <RichText.Content - tagName="figcaption" - className="blocks-gallery-item__caption" - value={ image.caption } - /> - ) } - </figure> - </li> - ); - } ) } - </ul> - { ! RichText.isEmpty( caption ) && ( - <RichText.Content - tagName="figcaption" - className="blocks-gallery-caption" - value={ caption } - /> - ) } - </figure> - ); + linkTo: { + type: 'string', }, - }, - { - attributes: { - images: { - type: 'array', - default: [], - source: 'query', - selector: 'ul.wp-block-gallery .blocks-gallery-item', - query: { - url: { - source: 'attribute', - selector: 'img', - attribute: 'src', - }, - fullUrl: { - source: 'attribute', - selector: 'img', - attribute: 'data-full-url', - }, - alt: { - source: 'attribute', - selector: 'img', - attribute: 'alt', - default: '', - }, - id: { - source: 'attribute', - selector: 'img', - attribute: 'data-id', - }, - link: { - source: 'attribute', - selector: 'img', - attribute: 'data-link', - }, - caption: { - type: 'array', - source: 'children', - selector: 'figcaption', - }, - }, - }, - ids: { - type: 'array', - default: [], - }, - columns: { - type: 'number', - }, - imageCrop: { - type: 'boolean', - default: true, - }, - linkTo: { - type: 'string', - default: 'none', - }, + sizeSlug: { + type: 'string', + default: 'large', }, - supports: { - align: true, - }, - save( { attributes } ) { - const { - images, - columns = defaultColumnsNumberV1( attributes ), - imageCrop, - linkTo, - } = attributes; - return ( - <ul - className={ `columns-${ columns } ${ - imageCrop ? 'is-cropped' : '' - }` } - > + }, + supports: { + anchor: true, + align: true, + }, + save( { attributes } ) { + const { + images, + columns = defaultColumnsNumberV1( attributes ), + imageCrop, + caption, + linkTo, + } = attributes; + const className = `columns-${ columns } ${ + imageCrop ? 'is-cropped' : '' + }`; + + return ( + <figure { ...useBlockProps.save( { className } ) }> + <ul className="blocks-gallery-grid"> { images.map( ( image ) => { let href; switch ( linkTo ) { - case 'media': + case DEPRECATED_LINK_DESTINATION_MEDIA: href = image.fullUrl || image.url; break; - case 'attachment': + case DEPRECATED_LINK_DESTINATION_ATTACHMENT: href = image.link; break; } @@ -463,116 +258,159 @@ const deprecated = [ ) : ( img ) } - { image.caption && - image.caption.length > 0 && ( - <RichText.Content - tagName="figcaption" - value={ image.caption } - /> - ) } + { ! RichText.isEmpty( image.caption ) && ( + <RichText.Content + tagName="figcaption" + className="blocks-gallery-item__caption" + value={ image.caption } + /> + ) } </figure> </li> ); } ) } </ul> - ); - }, + { ! RichText.isEmpty( caption ) && ( + <RichText.Content + tagName="figcaption" + className="blocks-gallery-caption" + value={ caption } + /> + ) } + </figure> + ); }, - { - attributes: { - images: { - type: 'array', - default: [], - source: 'query', - selector: 'ul.wp-block-gallery .blocks-gallery-item', - query: { - url: { - source: 'attribute', - selector: 'img', - attribute: 'src', - }, - alt: { - source: 'attribute', - selector: 'img', - attribute: 'alt', - default: '', - }, - id: { - source: 'attribute', - selector: 'img', - attribute: 'data-id', - }, - link: { - source: 'attribute', - selector: 'img', - attribute: 'data-link', - }, - caption: { - type: 'array', - source: 'children', - selector: 'figcaption', - }, + migrate( attributes ) { + if ( isGalleryV2Enabled() ) { + return runV2Migration( attributes ); + } + + return attributes; + }, +}; +const v5 = { + attributes: { + images: { + type: 'array', + default: [], + source: 'query', + selector: '.blocks-gallery-item', + query: { + url: { + type: 'string', + source: 'attribute', + selector: 'img', + attribute: 'src', + }, + fullUrl: { + type: 'string', + source: 'attribute', + selector: 'img', + attribute: 'data-full-url', + }, + link: { + type: 'string', + source: 'attribute', + selector: 'img', + attribute: 'data-link', + }, + alt: { + type: 'string', + source: 'attribute', + selector: 'img', + attribute: 'alt', + default: '', + }, + id: { + type: 'string', + source: 'attribute', + selector: 'img', + attribute: 'data-id', + }, + caption: { + type: 'string', + source: 'html', + selector: '.blocks-gallery-item__caption', }, }, - columns: { + }, + ids: { + type: 'array', + items: { type: 'number', }, - imageCrop: { - type: 'boolean', - default: true, - }, - linkTo: { - type: 'string', - default: 'none', - }, + default: [], }, - isEligible( { images, ids } ) { - return ( - images && - images.length > 0 && - ( ( ! ids && images ) || - ( ids && images && ids.length !== images.length ) || - some( images, ( id, index ) => { - if ( ! id && ids[ index ] !== null ) { - return true; - } - return parseInt( id, 10 ) !== ids[ index ]; - } ) ) - ); + columns: { + type: 'number', + minimum: 1, + maximum: 8, }, - migrate( attributes ) { - return { - ...attributes, - ids: map( attributes.images, ( { id } ) => { - if ( ! id ) { - return null; - } - return parseInt( id, 10 ); - } ), - }; + caption: { + type: 'string', + source: 'html', + selector: '.blocks-gallery-caption', + }, + imageCrop: { + type: 'boolean', + default: true, + }, + linkTo: { + type: 'string', + default: 'none', }, - supports: { - align: true, - }, - save( { attributes } ) { - const { - images, - columns = defaultColumnsNumberV1( attributes ), - imageCrop, - linkTo, - } = attributes; - return ( - <ul - className={ `columns-${ columns } ${ - imageCrop ? 'is-cropped' : '' - }` } - > + sizeSlug: { + type: 'string', + default: 'large', + }, + }, + supports: { + align: true, + }, + isEligible( { linkTo } ) { + return ! linkTo || linkTo === 'attachment' || linkTo === 'media'; + }, + migrate( attributes ) { + if ( isGalleryV2Enabled() ) { + return runV2Migration( attributes ); + } + + let linkTo = attributes.linkTo; + + if ( ! attributes.linkTo ) { + linkTo = 'none'; + } else if ( attributes.linkTo === 'attachment' ) { + linkTo = 'post'; + } else if ( attributes.linkTo === 'media' ) { + linkTo = 'file'; + } + return { + ...attributes, + linkTo, + }; + }, + save( { attributes } ) { + const { + images, + columns = defaultColumnsNumberV1( attributes ), + imageCrop, + caption, + linkTo, + } = attributes; + + return ( + <figure + className={ `columns-${ columns } ${ + imageCrop ? 'is-cropped' : '' + }` } + > + <ul className="blocks-gallery-grid"> { images.map( ( image ) => { let href; switch ( linkTo ) { case 'media': - href = image.url; + href = image.fullUrl || image.url; break; case 'attachment': href = image.link; @@ -584,6 +422,7 @@ const deprecated = [ src={ image.url } alt={ image.alt } data-id={ image.id } + data-full-url={ image.fullUrl } data-link={ image.link } className={ image.id ? `wp-image-${ image.id }` : null @@ -602,84 +441,133 @@ const deprecated = [ ) : ( img ) } - { image.caption && - image.caption.length > 0 && ( - <RichText.Content - tagName="figcaption" - value={ image.caption } - /> - ) } + { ! RichText.isEmpty( image.caption ) && ( + <RichText.Content + tagName="figcaption" + className="blocks-gallery-item__caption" + value={ image.caption } + /> + ) } </figure> </li> ); } ) } </ul> - ); - }, + { ! RichText.isEmpty( caption ) && ( + <RichText.Content + tagName="figcaption" + className="blocks-gallery-caption" + value={ caption } + /> + ) } + </figure> + ); }, - { - attributes: { - images: { - type: 'array', - default: [], - source: 'query', - selector: - 'div.wp-block-gallery figure.blocks-gallery-image img', - query: { - url: { - source: 'attribute', - attribute: 'src', - }, - alt: { - source: 'attribute', - attribute: 'alt', - default: '', - }, - id: { - source: 'attribute', - attribute: 'data-id', - }, +}; + +const v4 = { + attributes: { + images: { + type: 'array', + default: [], + source: 'query', + selector: '.blocks-gallery-item', + query: { + url: { + source: 'attribute', + selector: 'img', + attribute: 'src', + }, + fullUrl: { + source: 'attribute', + selector: 'img', + attribute: 'data-full-url', + }, + link: { + source: 'attribute', + selector: 'img', + attribute: 'data-link', + }, + alt: { + source: 'attribute', + selector: 'img', + attribute: 'alt', + default: '', + }, + id: { + source: 'attribute', + selector: 'img', + attribute: 'data-id', + }, + caption: { + type: 'string', + source: 'html', + selector: '.blocks-gallery-item__caption', }, - }, - columns: { - type: 'number', - }, - imageCrop: { - type: 'boolean', - default: true, - }, - linkTo: { - type: 'string', - default: 'none', - }, - align: { - type: 'string', - default: 'none', }, }, - supports: { - align: true, - }, - save( { attributes } ) { - const { - images, - columns = defaultColumnsNumberV1( attributes ), - align, - imageCrop, - linkTo, - } = attributes; - const className = classnames( `columns-${ columns }`, { - alignnone: align === 'none', - 'is-cropped': imageCrop, - } ); - return ( - <div className={ className }> + ids: { + type: 'array', + default: [], + }, + columns: { + type: 'number', + }, + caption: { + type: 'string', + source: 'html', + selector: '.blocks-gallery-caption', + }, + imageCrop: { + type: 'boolean', + default: true, + }, + linkTo: { + type: 'string', + default: 'none', + }, + }, + supports: { + align: true, + }, + isEligible( { ids } ) { + return ids && ids.some( ( id ) => typeof id === 'string' ); + }, + migrate( attributes ) { + if ( isGalleryV2Enabled() ) { + return runV2Migration( attributes ); + } + + return { + ...attributes, + ids: map( attributes.ids, ( id ) => { + const parsedId = parseInt( id, 10 ); + return Number.isInteger( parsedId ) ? parsedId : null; + } ), + }; + }, + save( { attributes } ) { + const { + images, + columns = defaultColumnsNumberV1( attributes ), + imageCrop, + caption, + linkTo, + } = attributes; + + return ( + <figure + className={ `columns-${ columns } ${ + imageCrop ? 'is-cropped' : '' + }` } + > + <ul className="blocks-gallery-grid"> { images.map( ( image ) => { let href; switch ( linkTo ) { case 'media': - href = image.url; + href = image.fullUrl || image.url; break; case 'attachment': href = image.link; @@ -691,22 +579,406 @@ const deprecated = [ src={ image.url } alt={ image.alt } data-id={ image.id } + data-full-url={ image.fullUrl } + data-link={ image.link } + className={ + image.id ? `wp-image-${ image.id }` : null + } /> ); return ( - <figure + <li key={ image.id || image.url } - className="blocks-gallery-image" + className="blocks-gallery-item" > - { href ? <a href={ href }>{ img }</a> : img } - </figure> + <figure> + { href ? ( + <a href={ href }>{ img }</a> + ) : ( + img + ) } + { ! RichText.isEmpty( image.caption ) && ( + <RichText.Content + tagName="figcaption" + className="blocks-gallery-item__caption" + value={ image.caption } + /> + ) } + </figure> + </li> ); } ) } - </div> - ); + </ul> + { ! RichText.isEmpty( caption ) && ( + <RichText.Content + tagName="figcaption" + className="blocks-gallery-caption" + value={ caption } + /> + ) } + </figure> + ); + }, +}; +const v3 = { + attributes: { + images: { + type: 'array', + default: [], + source: 'query', + selector: 'ul.wp-block-gallery .blocks-gallery-item', + query: { + url: { + source: 'attribute', + selector: 'img', + attribute: 'src', + }, + fullUrl: { + source: 'attribute', + selector: 'img', + attribute: 'data-full-url', + }, + alt: { + source: 'attribute', + selector: 'img', + attribute: 'alt', + default: '', + }, + id: { + source: 'attribute', + selector: 'img', + attribute: 'data-id', + }, + link: { + source: 'attribute', + selector: 'img', + attribute: 'data-link', + }, + caption: { + type: 'array', + source: 'children', + selector: 'figcaption', + }, + }, + }, + ids: { + type: 'array', + default: [], }, + columns: { + type: 'number', + }, + imageCrop: { + type: 'boolean', + default: true, + }, + linkTo: { + type: 'string', + default: 'none', + }, + }, + supports: { + align: true, + }, + save( { attributes } ) { + const { + images, + columns = defaultColumnsNumberV1( attributes ), + imageCrop, + linkTo, + } = attributes; + return ( + <ul + className={ `columns-${ columns } ${ + imageCrop ? 'is-cropped' : '' + }` } + > + { images.map( ( image ) => { + let href; + + switch ( linkTo ) { + case 'media': + href = image.fullUrl || image.url; + break; + case 'attachment': + href = image.link; + break; + } + + const img = ( + <img + src={ image.url } + alt={ image.alt } + data-id={ image.id } + data-full-url={ image.fullUrl } + data-link={ image.link } + className={ + image.id ? `wp-image-${ image.id }` : null + } + /> + ); + + return ( + <li + key={ image.id || image.url } + className="blocks-gallery-item" + > + <figure> + { href ? <a href={ href }>{ img }</a> : img } + { image.caption && image.caption.length > 0 && ( + <RichText.Content + tagName="figcaption" + value={ image.caption } + /> + ) } + </figure> + </li> + ); + } ) } + </ul> + ); + }, + migrate( attributes ) { + if ( isGalleryV2Enabled() ) { + return runV2Migration( attributes ); + } + return attributes; + }, +}; +const v2 = { + attributes: { + images: { + type: 'array', + default: [], + source: 'query', + selector: 'ul.wp-block-gallery .blocks-gallery-item', + query: { + url: { + source: 'attribute', + selector: 'img', + attribute: 'src', + }, + alt: { + source: 'attribute', + selector: 'img', + attribute: 'alt', + default: '', + }, + id: { + source: 'attribute', + selector: 'img', + attribute: 'data-id', + }, + link: { + source: 'attribute', + selector: 'img', + attribute: 'data-link', + }, + caption: { + type: 'array', + source: 'children', + selector: 'figcaption', + }, + }, + }, + columns: { + type: 'number', + }, + imageCrop: { + type: 'boolean', + default: true, + }, + linkTo: { + type: 'string', + default: 'none', + }, + }, + isEligible( { images, ids } ) { + return ( + images && + images.length > 0 && + ( ( ! ids && images ) || + ( ids && images && ids.length !== images.length ) || + some( images, ( id, index ) => { + if ( ! id && ids[ index ] !== null ) { + return true; + } + return parseInt( id, 10 ) !== ids[ index ]; + } ) ) + ); + }, + migrate( attributes ) { + if ( isGalleryV2Enabled() ) { + return runV2Migration( attributes ); + } + return { + ...attributes, + ids: map( attributes.images, ( { id } ) => { + if ( ! id ) { + return null; + } + return parseInt( id, 10 ); + } ), + }; + }, + supports: { + align: true, + }, + save( { attributes } ) { + const { + images, + columns = defaultColumnsNumberV1( attributes ), + imageCrop, + linkTo, + } = attributes; + return ( + <ul + className={ `columns-${ columns } ${ + imageCrop ? 'is-cropped' : '' + }` } + > + { images.map( ( image ) => { + let href; + + switch ( linkTo ) { + case 'media': + href = image.url; + break; + case 'attachment': + href = image.link; + break; + } + + const img = ( + <img + src={ image.url } + alt={ image.alt } + data-id={ image.id } + data-link={ image.link } + className={ + image.id ? `wp-image-${ image.id }` : null + } + /> + ); + + return ( + <li + key={ image.id || image.url } + className="blocks-gallery-item" + > + <figure> + { href ? <a href={ href }>{ img }</a> : img } + { image.caption && image.caption.length > 0 && ( + <RichText.Content + tagName="figcaption" + value={ image.caption } + /> + ) } + </figure> + </li> + ); + } ) } + </ul> + ); + }, +}; + +const v1 = { + attributes: { + images: { + type: 'array', + default: [], + source: 'query', + selector: 'div.wp-block-gallery figure.blocks-gallery-image img', + query: { + url: { + source: 'attribute', + attribute: 'src', + }, + alt: { + source: 'attribute', + attribute: 'alt', + default: '', + }, + id: { + source: 'attribute', + attribute: 'data-id', + }, + }, + }, + columns: { + type: 'number', + }, + imageCrop: { + type: 'boolean', + default: true, + }, + linkTo: { + type: 'string', + default: 'none', + }, + align: { + type: 'string', + default: 'none', + }, + }, + supports: { + align: true, + }, + save( { attributes } ) { + const { + images, + columns = defaultColumnsNumberV1( attributes ), + align, + imageCrop, + linkTo, + } = attributes; + const className = classnames( `columns-${ columns }`, { + alignnone: align === 'none', + 'is-cropped': imageCrop, + } ); + return ( + <div className={ className }> + { images.map( ( image ) => { + let href; + + switch ( linkTo ) { + case 'media': + href = image.url; + break; + case 'attachment': + href = image.link; + break; + } + + const img = ( + <img + src={ image.url } + alt={ image.alt } + data-id={ image.id } + /> + ); + + return ( + <figure + key={ image.id || image.url } + className="blocks-gallery-image" + > + { href ? <a href={ href }>{ img }</a> : img } + </figure> + ); + } ) } + </div> + ); + }, + migrate( attributes ) { + if ( isGalleryV2Enabled() ) { + return runV2Migration( attributes ); + } + + return attributes; }, -]; +}; -export default deprecated; +export default [ v6, v5, v4, v3, v2, v1 ]; diff --git a/packages/block-library/src/gallery/edit-wrapper.js b/packages/block-library/src/gallery/edit-wrapper.js index 0e101dfa85e216..2c81271902d312 100644 --- a/packages/block-library/src/gallery/edit-wrapper.js +++ b/packages/block-library/src/gallery/edit-wrapper.js @@ -1,47 +1,27 @@ /** * WordPress dependencies */ -import { store as blockEditorStore } from '@wordpress/block-editor'; -import { useSelect } from '@wordpress/data'; +import { compose } from '@wordpress/compose'; +import { withNotices } from '@wordpress/components'; /** * Internal dependencies */ import EditWithInnerBlocks from './edit'; import EditWithoutInnerBlocks from './v1/edit'; +import { isGalleryV2Enabled } from './shared'; /* * Using a wrapper around the logic to load the edit for v1 of Gallery block * or the refactored version with InnerBlocks. This is to prevent conditional * use of hooks lint errors if adding this logic to the top of the edit component. */ -export default function GalleryEditWrapper( props ) { - const { attributes, clientId } = props; - - const innerBlockImages = useSelect( - ( select ) => { - return select( blockEditorStore ).getBlock( clientId )?.innerBlocks; - }, - [ clientId ] - ); - - const __unstableGalleryWithImageBlocks = useSelect( ( select ) => { - const settings = select( blockEditorStore ).getSettings(); - return settings.__unstableGalleryWithImageBlocks; - }, [] ); - - // This logic is used to infer version information from content with higher - // precedence than the flag. New galleries (and existing empty galleries) will - // honor the flag. - const hasNewVersionContent = !! innerBlockImages?.length; - const hasOldVersionContent = - 0 < attributes?.ids?.length || 0 < attributes?.images?.length; - if ( - hasOldVersionContent || - ( ! hasNewVersionContent && ! __unstableGalleryWithImageBlocks ) - ) { +function GalleryEditWrapper( props ) { + if ( ! isGalleryV2Enabled() ) { return <EditWithoutInnerBlocks { ...props } />; } return <EditWithInnerBlocks { ...props } />; } + +export default compose( [ withNotices ] )( GalleryEditWrapper ); diff --git a/packages/block-library/src/gallery/edit.js b/packages/block-library/src/gallery/edit.js index e7cbe537c4922d..492275995ca269 100644 --- a/packages/block-library/src/gallery/edit.js +++ b/packages/block-library/src/gallery/edit.js @@ -154,7 +154,7 @@ function GalleryEdit( props ) { useEffect( () => { newImages?.forEach( ( newImage ) => { updateBlockAttributes( newImage.clientId, { - ...buildImageAttributes( false, newImage.attributes ), + ...buildImageAttributes( newImage.attributes ), id: newImage.id, align: undefined, } ); @@ -186,26 +186,24 @@ function GalleryEdit( props ) { * it already existed in the gallery. If the image is in fact new, we need * to apply the gallery's current settings to the image. * - * @param {Object} existingBlock Existing Image block that still exists after gallery update. - * @param {Object} image Media object for the actual image. - * @return {Object} Attributes to set on the new image block. + * @param {Object} imageAttributes Media object for the actual image. + * @return {Object} Attributes to set on the new image block. */ - function buildImageAttributes( existingBlock, image ) { - if ( existingBlock ) { - return existingBlock.attributes; - } + function buildImageAttributes( imageAttributes ) { + const image = imageAttributes.id + ? find( imageData, { id: imageAttributes.id } ) + : null; let newClassName; - if ( image.className && image.className !== '' ) { - newClassName = image.className; + if ( imageAttributes.className && imageAttributes.className !== '' ) { + newClassName = imageAttributes.className; } else { newClassName = preferredStyle ? `is-style-${ preferredStyle }` : undefined; } - return { - ...pickRelevantMediaFiles( image, sizeSlug ), + ...pickRelevantMediaFiles( imageAttributes, sizeSlug ), ...getHrefAndDestination( image, linkTo ), ...getUpdatedLinkTargetSettings( linkTarget, attributes ), className: newClassName, diff --git a/packages/block-library/src/gallery/save.js b/packages/block-library/src/gallery/save.js index 781b96d2aedbe9..655a1823020fc5 100644 --- a/packages/block-library/src/gallery/save.js +++ b/packages/block-library/src/gallery/save.js @@ -16,9 +16,10 @@ import { * Internal dependencies */ import saveWithoutInnerBlocks from './v1/save'; +import { isGalleryV2Enabled } from './shared'; export default function saveWithInnerBlocks( { attributes } ) { - if ( attributes?.ids?.length > 0 || attributes?.images?.length > 0 ) { + if ( ! isGalleryV2Enabled() ) { return saveWithoutInnerBlocks( { attributes } ); } diff --git a/packages/block-library/src/gallery/shared.js b/packages/block-library/src/gallery/shared.js index 0de4e8586c33ab..e2c2e717d0f707 100644 --- a/packages/block-library/src/gallery/shared.js +++ b/packages/block-library/src/gallery/shared.js @@ -21,3 +21,19 @@ export const pickRelevantMediaFiles = ( image, sizeSlug = 'large' ) => { } return imageProps; }; + +/** + * The new gallery block format is not compatible with the use_BalanceTags option + * in WP versions <= 5.8 https://core.trac.wordpress.org/ticket/54130. The + * window.wp.galleryBlockV2Enabled flag is set in lib/compat.php. This method + * can be removed when minimum supported WP version >=5.9. + */ +export function isGalleryV2Enabled() { + // We want to fail early here, at least during beta testing phase, to ensure + // there aren't instances where undefined values cause false negatives. + if ( ! window.wp || typeof window.wp.galleryBlockV2Enabled !== 'boolean' ) { + throw 'window.wp.galleryBlockV2Enabled is not defined'; + } + + return window.wp.galleryBlockV2Enabled; +} diff --git a/packages/block-library/src/gallery/test/use-get-new-images.js b/packages/block-library/src/gallery/test/use-get-new-images.js new file mode 100644 index 00000000000000..9b126340302143 --- /dev/null +++ b/packages/block-library/src/gallery/test/use-get-new-images.js @@ -0,0 +1,93 @@ +/** + * External dependencies + */ +import { render, screen } from '@testing-library/react'; + +/** + * Internal dependencies + */ +import useGetNewImages from '../use-get-new-images'; + +const TestComponent = ( { images, imageData } ) => { + const newImages = useGetNewImages( images, imageData ); + return <div title="testResult">{ JSON.stringify( newImages ) }</div>; +}; + +describe( 'gallery block useGetNewImages hook', () => { + it( 'returns null if no images currently in the gallery', () => { + render( <TestComponent images={ [] } imageData={ [] } /> ); + expect( screen.getByTitle( 'testResult' ) ).toHaveTextContent( 'null' ); + } ); + + it( 'should not return images that have been loaded from the saved post content', () => { + render( + <TestComponent + images={ [ + { clientId: 'abc123', id: 1, fromSavedContent: true }, + ] } + imageData={ [ { id: 1 } ] } + /> + ); + expect( screen.getByTitle( 'testResult' ) ).toHaveTextContent( 'null' ); + } ); + + it( 'returns array of new images that have been added since the last render', () => { + const { rerender } = render( + <TestComponent + images={ [ { clientId: 'abc123', id: 1 } ] } + imageData={ [ { id: 1 } ] } + /> + ); + + expect( screen.getByTitle( 'testResult' ) ).toHaveTextContent( + '[{"clientId":"abc123","id":1}]' + ); + + rerender( + <TestComponent + images={ [ + { clientId: 'abc123', id: 1 }, + { clientId: 'efg456', id: 2 }, + ] } + imageData={ [ { id: 1 }, { id: 2 } ] } + /> + ); + + expect( screen.getByTitle( 'testResult' ) ).toHaveTextContent( + '[{"clientId":"efg456","id":2}]' + ); + } ); + + it( 'sees an image as new if it has been deleted and added again', () => { + const { rerender } = render( + <TestComponent + images={ [ + { clientId: 'abc123', id: 1 }, + { clientId: 'efg456', id: 2 }, + ] } + imageData={ [ { id: 1 }, { id: 2 } ] } + /> + ); + + rerender( + <TestComponent + images={ [ { clientId: 'abc123', id: 1 } ] } + imageData={ [ { id: 1 } ] } + /> + ); + + rerender( + <TestComponent + images={ [ + { clientId: 'abc123', id: 1 }, + { clientId: 'efg456', id: 2 }, + ] } + imageData={ [ { id: 1 }, { id: 2 } ] } + /> + ); + + expect( screen.getByTitle( 'testResult' ) ).toHaveTextContent( + '[{"clientId":"efg456","id":2}]' + ); + } ); +} ); diff --git a/packages/block-library/src/gallery/transforms.js b/packages/block-library/src/gallery/transforms.js index f5fe6b341cd9e6..36106b4bb0664a 100644 --- a/packages/block-library/src/gallery/transforms.js +++ b/packages/block-library/src/gallery/transforms.js @@ -8,8 +8,6 @@ import { filter, every, toString } from 'lodash'; */ import { createBlock } from '@wordpress/blocks'; import { createBlobURL } from '@wordpress/blob'; -import { select } from '@wordpress/data'; -import { store as blockEditorStore } from '@wordpress/block-editor'; import { addFilter } from '@wordpress/hooks'; /** @@ -24,7 +22,7 @@ import { LINK_DESTINATION_ATTACHMENT as DEPRECATED_LINK_DESTINATION_ATTACHMENT, LINK_DESTINATION_MEDIA as DEPRECATED_LINK_DESTINATION_MEDIA, } from './v1/constants'; -import { pickRelevantMediaFiles } from './shared'; +import { pickRelevantMediaFiles, isGalleryV2Enabled } from './shared'; const parseShortcodeIds = ( ids ) => { if ( ! ids ) { @@ -49,9 +47,8 @@ const parseShortcodeIds = ( ids ) => { * @return {Block} The transformed block. */ function updateThirdPartyTransformToGallery( block ) { - const settings = select( blockEditorStore ).getSettings(); if ( - settings.__unstableGalleryWithImageBlocks && + isGalleryV2Enabled() && block.name === 'core/gallery' && block.attributes?.images.length > 0 ) { @@ -145,8 +142,7 @@ const transforms = { const validImages = filter( attributes, ( { url } ) => url ); - const settings = select( blockEditorStore ).getSettings(); - if ( settings.__unstableGalleryWithImageBlocks ) { + if ( isGalleryV2Enabled() ) { const innerBlocks = validImages.map( ( image ) => { return createBlock( 'core/image', image ); } ); @@ -184,10 +180,7 @@ const transforms = { images: { type: 'array', shortcode: ( { named: { ids } } ) => { - const settings = select( - blockEditorStore - ).getSettings(); - if ( ! settings.__unstableGalleryWithImageBlocks ) { + if ( ! isGalleryV2Enabled() ) { return parseShortcodeIds( ids ).map( ( id ) => ( { id: toString( id ), } ) ); @@ -197,10 +190,7 @@ const transforms = { ids: { type: 'array', shortcode: ( { named: { ids } } ) => { - const settings = select( - blockEditorStore - ).getSettings(); - if ( ! settings.__unstableGalleryWithImageBlocks ) { + if ( ! isGalleryV2Enabled() ) { return parseShortcodeIds( ids ); } }, @@ -208,10 +198,7 @@ const transforms = { shortCodeTransforms: { type: 'array', shortcode: ( { named: { ids } } ) => { - const settings = select( - blockEditorStore - ).getSettings(); - if ( settings.__unstableGalleryWithImageBlocks ) { + if ( isGalleryV2Enabled() ) { return parseShortcodeIds( ids ).map( ( id ) => ( { id: parseInt( id ), } ) ); @@ -227,10 +214,7 @@ const transforms = { linkTo: { type: 'string', shortcode: ( { named: { link } } ) => { - const settings = select( - blockEditorStore - ).getSettings(); - if ( ! settings.__unstableGalleryWithImageBlocks ) { + if ( ! isGalleryV2Enabled() ) { switch ( link ) { case 'post': return DEPRECATED_LINK_DESTINATION_ATTACHMENT; @@ -273,8 +257,7 @@ const transforms = { ); }, transform( files ) { - const settings = select( blockEditorStore ).getSettings(); - if ( settings.__unstableGalleryWithImageBlocks ) { + if ( isGalleryV2Enabled() ) { const innerBlocks = files.map( ( file ) => createBlock( 'core/image', { url: createBlobURL( file ), @@ -299,8 +282,7 @@ const transforms = { type: 'block', blocks: [ 'core/image' ], transform: ( { align, images, ids, sizeSlug }, innerBlocks ) => { - const settings = select( blockEditorStore ).getSettings(); - if ( settings.__unstableGalleryWithImageBlocks ) { + if ( isGalleryV2Enabled() ) { if ( innerBlocks.length > 0 ) { return innerBlocks.map( ( { diff --git a/packages/block-library/src/gallery/use-mobile-warning.js b/packages/block-library/src/gallery/use-mobile-warning.js index 6567d8f73349b7..95d0f4c86432fc 100644 --- a/packages/block-library/src/gallery/use-mobile-warning.js +++ b/packages/block-library/src/gallery/use-mobile-warning.js @@ -20,7 +20,7 @@ export default function useMobileWarning( newImages ) { createWarningNotice( __( - 'Editing this Gallery in the WordPress mobile app requires version 18.2 or higher.' + 'If you want to edit the gallery you just added in the mobile app, to avoid losing any data please make sure you use version 18.2 of the app or above.' ), { type: 'snackbar', explicitDismiss: true } ); diff --git a/packages/block-library/src/gallery/v1/edit.js b/packages/block-library/src/gallery/v1/edit.js index cfa1755445d8a0..ca57494142feb9 100644 --- a/packages/block-library/src/gallery/v1/edit.js +++ b/packages/block-library/src/gallery/v1/edit.js @@ -24,10 +24,8 @@ import { ToggleControl, withNotices, RangeControl, - ToolbarButton, } from '@wordpress/components'; import { - BlockControls, MediaPlaceholder, InspectorControls, useBlockProps, @@ -53,7 +51,6 @@ import { LINK_DESTINATION_MEDIA, LINK_DESTINATION_NONE, } from './constants'; -import UpdateGalleryModal from './update-gallery-modal'; const MAX_COLUMNS = 8; const linkOptions = [ @@ -102,13 +99,10 @@ function GalleryEdit( props ) { mediaUpload, getMedia, wasBlockJustInserted, - __unstableGalleryWithImageBlocks, } = useSelect( ( select ) => { const settings = select( blockEditorStore ).getSettings(); return { - __unstableGalleryWithImageBlocks: - settings.__unstableGalleryWithImageBlocks, imageSizes: settings.imageSizes, mediaUpload: settings.mediaUpload, getMedia: select( coreStore ).getMedia, @@ -414,10 +408,6 @@ function GalleryEdit( props ) { /> ); - const [ isUpdateOpen, setUpdateOpen ] = useState( false ); - const openUpdateModal = () => setUpdateOpen( true ); - const closeUpdateModal = () => setUpdateOpen( false ); - const blockProps = useBlockProps(); if ( ! hasImages ) { @@ -466,24 +456,7 @@ function GalleryEdit( props ) { ) } </PanelBody> </InspectorControls> - { /* TODO: Remove platform condition when native conversion is ready */ } - { Platform.isWeb && __unstableGalleryWithImageBlocks && ( - <BlockControls group="other"> - <ToolbarButton - onClick={ openUpdateModal } - title={ __( 'Update' ) } - label={ __( 'Update to the new gallery format' ) } - > - { __( 'Update' ) } - </ToolbarButton> - </BlockControls> - ) } - { Platform.isWeb && isUpdateOpen && ( - <UpdateGalleryModal - onClose={ closeUpdateModal } - clientId={ clientId } - /> - ) } + { noticeUI } <Gallery { ...props } diff --git a/packages/block-library/src/gallery/v1/update-gallery-modal.js b/packages/block-library/src/gallery/v1/update-gallery-modal.js deleted file mode 100644 index 86510ade478502..00000000000000 --- a/packages/block-library/src/gallery/v1/update-gallery-modal.js +++ /dev/null @@ -1,97 +0,0 @@ -/** - * WordPress dependencies - */ -import { Button, Modal } from '@wordpress/components'; -import { __ } from '@wordpress/i18n'; -import { useDispatch, useSelect } from '@wordpress/data'; -import { createBlock } from '@wordpress/blocks'; -import { store as blockEditorStore } from '@wordpress/block-editor'; - -/** - * Internal dependencies - */ -import { - LINK_DESTINATION_ATTACHMENT, - LINK_DESTINATION_NONE, - LINK_DESTINATION_MEDIA, -} from './constants'; - -export const updateGallery = ( { - clientId, - getBlock, - replaceBlocks, -} ) => () => { - let link; - const { - attributes: { sizeSlug, linkTo, images, caption }, - } = getBlock( clientId ); - - switch ( linkTo ) { - case 'post': - link = LINK_DESTINATION_ATTACHMENT; - break; - case 'file': - link = LINK_DESTINATION_MEDIA; - break; - default: - link = LINK_DESTINATION_NONE; - break; - } - const innerBlocks = images.map( ( image ) => - createBlock( 'core/image', { - id: image.id ? parseInt( image.id, 10 ) : null, - url: image.url, - alt: image.alt, - caption: image.caption, - linkDestination: link, - } ) - ); - - replaceBlocks( - clientId, - createBlock( - 'core/gallery', - { sizeSlug, linkTo: link, caption }, - innerBlocks - ) - ); -}; - -export default function UpdateGalleryModal( { onClose, clientId } ) { - const { getBlock } = useSelect( blockEditorStore ); - const { replaceBlocks } = useDispatch( blockEditorStore ); - return ( - <Modal - closeLabel={ __( 'Close' ) } - onRequestClose={ onClose } - title={ __( 'Update gallery' ) } - className={ 'wp-block-update-gallery-modal' } - aria={ { - describedby: 'wp-block-update-gallery-modal__description', - } } - > - <p id={ 'wp-block-update-gallery-modal__description' }> - { __( - 'Updating to the new format adds the ability to use custom links or styles on individual images in the gallery, and makes it easier to add or move them around.' - ) } - </p> - - <div className="wp-block-update-gallery-modal-buttons"> - <Button isTertiary onClick={ onClose }> - { __( 'Cancel' ) } - </Button> - <Button - isPrimary - onClick={ updateGallery( { - replaceBlocks, - getBlock, - clientId, - createBlock, - } ) } - > - { __( 'Update' ) } - </Button> - </div> - </Modal> - ); -} diff --git a/packages/block-library/src/index.js b/packages/block-library/src/index.js index 0f445ac78424bc..76ac03d8ef5f34 100644 --- a/packages/block-library/src/index.js +++ b/packages/block-library/src/index.js @@ -30,6 +30,7 @@ import * as commentEditLink from './comment-edit-link'; import * as commentReplyLink from './comment-reply-link'; import * as commentTemplate from './comment-template'; import * as commentsQueryLoop from './comments-query-loop'; +import * as commentsPagination from './comments-pagination'; import * as cover from './cover'; import * as embed from './embed'; import * as file from './file'; @@ -254,6 +255,7 @@ export const __experimentalRegisterExperimentalCoreBlocks = commentReplyLink, commentTemplate, commentsQueryLoop, + commentsPagination, navigationArea, postComment, postCommentsCount, diff --git a/packages/block-library/src/navigation-area/block.json b/packages/block-library/src/navigation-area/block.json index ce80174a0941f7..07a6188efa1379 100644 --- a/packages/block-library/src/navigation-area/block.json +++ b/packages/block-library/src/navigation-area/block.json @@ -18,6 +18,6 @@ }, "supports": { "html": false, - "inserter": true + "inserter": false } } diff --git a/packages/block-library/src/navigation-submenu/edit.js b/packages/block-library/src/navigation-submenu/edit.js index 69fffeb6e996e9..02abd4a35dbca6 100644 --- a/packages/block-library/src/navigation-submenu/edit.js +++ b/packages/block-library/src/navigation-submenu/edit.js @@ -508,6 +508,12 @@ export default function NavigationSubmenuEdit( { allowedBlocks: ALLOWED_BLOCKS, __experimentalDefaultBlock: DEFAULT_BLOCK, __experimentalDirectInsert: true, + + // Ensure block toolbar is not too far removed from item + // being edited. + // see: https://github.com/WordPress/gutenberg/pull/34615. + __experimentalCaptureToolbars: true, + renderAppender: isSelected || ( isImmediateParentOfSelectedBlock && diff --git a/packages/block-library/src/navigation/edit/index.js b/packages/block-library/src/navigation/edit/index.js index c27bccadc69cb9..c6ab2f38d0e98a 100644 --- a/packages/block-library/src/navigation/edit/index.js +++ b/packages/block-library/src/navigation/edit/index.js @@ -452,6 +452,7 @@ function Navigation( { { hasColorSettings && ( <PanelColorSettings __experimentalHasMultipleOrigins + __experimentalIsRenderedInSidebar title={ __( 'Color' ) } initialOpen={ false } colorSettings={ [ diff --git a/packages/block-library/src/navigation/edit/inner-blocks.js b/packages/block-library/src/navigation/edit/inner-blocks.js index 7b8d8eb39da326..8a893c254f0999 100644 --- a/packages/block-library/src/navigation/edit/inner-blocks.js +++ b/packages/block-library/src/navigation/edit/inner-blocks.js @@ -110,11 +110,6 @@ export default function NavigationInnerBlocks( { __experimentalDirectInsert: shouldDirectInsert, orientation, renderAppender: CustomAppender || appender, - - // Ensure block toolbar is not too far removed from item - // being edited when in vertical mode. - // see: https://github.com/WordPress/gutenberg/pull/34615. - __experimentalCaptureToolbars: orientation !== 'vertical', // Template lock set to false here so that the Nav // Block on the experimental menus screen does not // inherit templateLock={ 'all' }. diff --git a/packages/block-library/src/navigation/style.scss b/packages/block-library/src/navigation/style.scss index e4809785e5b3a7..f96e02af2acff0 100644 --- a/packages/block-library/src/navigation/style.scss +++ b/packages/block-library/src/navigation/style.scss @@ -426,7 +426,10 @@ button.wp-block-navigation-item__content { align-items: var(--layout-justification-setting, inherit); // Always align the contents of the menu to the top. - justify-content: flex-start; + &, + .wp-block-navigation__container { + justify-content: flex-start; + } // Allow menu to scroll. overflow: auto; diff --git a/packages/block-library/src/query-pagination/editor.scss b/packages/block-library/src/query-pagination/editor.scss index 040ad0ed36b695..169f2b5ca72afb 100644 --- a/packages/block-library/src/query-pagination/editor.scss +++ b/packages/block-library/src/query-pagination/editor.scss @@ -14,10 +14,6 @@ $pagination-margin: 0.5em; } } -.block-library-query-pagination-toolbar__popover .components-popover__content { - min-width: 230px; -} - .wp-block-query-pagination { > .wp-block-query-pagination-next, > .wp-block-query-pagination-previous, diff --git a/packages/block-library/src/separator/separator-settings.js b/packages/block-library/src/separator/separator-settings.js index 8ca5da44de113b..e1d772ca96ce0e 100644 --- a/packages/block-library/src/separator/separator-settings.js +++ b/packages/block-library/src/separator/separator-settings.js @@ -8,6 +8,7 @@ const SeparatorSettings = ( { color, setColor } ) => ( <InspectorControls> <PanelColorSettings __experimentalHasMultipleOrigins + __experimentalIsRenderedInSidebar title={ __( 'Color' ) } colorSettings={ [ { diff --git a/packages/block-library/src/social-links/edit.js b/packages/block-library/src/social-links/edit.js index eebb1218b79b02..41dce99b39b80a 100644 --- a/packages/block-library/src/social-links/edit.js +++ b/packages/block-library/src/social-links/edit.js @@ -167,6 +167,7 @@ export function SocialLinksEdit( props ) { </PanelBody> <PanelColorSettings __experimentalHasMultipleOrigins + __experimentalIsRenderedInSidebar title={ __( 'Color' ) } colorSettings={ [ { diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index a5cb5bf1ec7781..9b02dfe344aa9c 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -4,7 +4,10 @@ ### Bug Fix +- Fixed error thrown in `ColorPicker` when used in controlled state in color gradients ([#36941](https://github.com/WordPress/gutenberg/pull/36941)). +- Updated readme to include default value introduced in fix for unexpected movements in the `ColorPicker` ([#35670](https://github.com/WordPress/gutenberg/pull/35670)). - Replaced hardcoded blue in `ColorPicker` with UI theme color ([#36153](https://github.com/WordPress/gutenberg/pull/36153)). +- Fixed empty `ToolsPanel` height by correcting menu button line-height ([#36895](https://github.com/WordPress/gutenberg/pull/36895)). ### Experimental @@ -15,6 +18,7 @@ - Fixed race conditions causing conditionally displayed `ToolsPanelItem` components to be erroneously deregistered ([#36588](https://github.com/WordPress/gutenberg/pull/36588)). - Added `__experimentalHideHeader` prop to `Modal` component ([#36831](https://github.com/WordPress/gutenberg/pull/36831)). - Added experimental `ConfirmDialog` component ([#34153](https://github.com/WordPress/gutenberg/pull/34153)). +- Divider: improve support for vertical orientation and RTL styles, use start/end logical props instead of top/bottom, change border-color to `currentColor` ([#36579](https://github.com/WordPress/gutenberg/pull/36579)). ### Bug Fix diff --git a/packages/components/src/card/test/__snapshots__/index.js.snap b/packages/components/src/card/test/__snapshots__/index.js.snap index adf11cff8056a3..ca20d69a5c18dc 100644 --- a/packages/components/src/card/test/__snapshots__/index.js.snap +++ b/packages/components/src/card/test/__snapshots__/index.js.snap @@ -269,10 +269,10 @@ Object { } .emotion-10 { - border-color: rgba(0, 0, 0, 0.1); - border-width: 0 0 1px 0; - height: 0; + border: 0; margin: 0; + border-bottom: 1px solid currentColor; + height: 0; width: auto; box-sizing: border-box; display: block; @@ -525,10 +525,10 @@ Object { } .emotion-10 { - border-color: rgba(0, 0, 0, 0.1); - border-width: 0 0 1px 0; - height: 0; + border: 0; margin: 0; + border-bottom: 1px solid currentColor; + height: 0; width: auto; box-sizing: border-box; display: block; diff --git a/packages/components/src/circular-option-picker/style.scss b/packages/components/src/circular-option-picker/style.scss index 8b764cccfb8ec7..0ae50ec6fada95 100644 --- a/packages/components/src/circular-option-picker/style.scss +++ b/packages/components/src/circular-option-picker/style.scss @@ -9,6 +9,7 @@ $color-palette-circle-spacing: 12px; .components-circular-option-picker__custom-clear-wrapper { display: flex; justify-content: flex-end; + margin-top: $grid-unit-15; } .components-circular-option-picker__swatches { diff --git a/packages/components/src/color-palette/index.js b/packages/components/src/color-palette/index.js index c203991fd4617d..7052098d115c7a 100644 --- a/packages/components/src/color-palette/index.js +++ b/packages/components/src/color-palette/index.js @@ -5,6 +5,7 @@ import { map } from 'lodash'; import { colord, extend } from 'colord'; import namesPlugin from 'colord/plugins/names'; import a11yPlugin from 'colord/plugins/a11y'; +import classnames from 'classnames'; /** * WordPress dependencies @@ -117,6 +118,7 @@ export default function ColorPalette( { onChange, value, __experimentalHasMultipleOrigins = false, + __experimentalIsRenderedInSidebar = false, } ) { const clearColor = useCallback( () => onChange( undefined ), [ onChange ] ); const Component = __experimentalHasMultipleOrigins @@ -135,7 +137,12 @@ export default function ColorPalette( { <VStack spacing={ 3 } className={ className }> { ! disableCustomColors && ( <Dropdown - contentClassName="components-color-palette__custom-color-dropdown-content" + contentClassName={ classnames( + 'components-color-palette__custom-color-dropdown-content', + { + 'is-rendered-in-sidebar': __experimentalIsRenderedInSidebar, + } + ) } renderContent={ renderCustomColorPicker } renderToggle={ ( { isOpen, onToggle } ) => ( <button diff --git a/packages/components/src/color-palette/style.scss b/packages/components/src/color-palette/style.scss index 6002b50cb3a0f2..3345a8103eea0d 100644 --- a/packages/components/src/color-palette/style.scss +++ b/packages/components/src/color-palette/style.scss @@ -21,7 +21,19 @@ overflow: visible; box-shadow: 0 4px 4px rgba(0, 0, 0, 0.05); border: none; + border-radius: $radius-block-ui; & > div { padding: 0; } + .react-colorful__saturation { + border-top-right-radius: $radius-block-ui; + border-top-left-radius: $radius-block-ui; + } +} + +@include break-medium() { + .components-dropdown__content.components-color-palette__custom-color-dropdown-content.is-rendered-in-sidebar.is-from-top .components-popover__content { + margin-right: #{ math.div($sidebar-width, 2) + $grid-unit-20 }; + margin-top: #{ -($grid-unit-60 + $grid-unit-15) }; + } } diff --git a/packages/components/src/color-picker/README.md b/packages/components/src/color-picker/README.md index efe8728d22bd69..1b065203196a7a 100644 --- a/packages/components/src/color-picker/README.md +++ b/packages/components/src/color-picker/README.md @@ -22,32 +22,34 @@ function Example() { ## Props -### `color` - -**Type**: `string` +### `color`: `string` The current color value to display in the picker. Must be a hex or hex8 string. -### `onChange` +- Required: No -**Type**: `(hex8Color: string) => void` +### `onChange`: `(hex8Color: string) => void` Fired when the color changes. Always passes a hex8 color string. -### `enableAlpha` +- Required: No -**Type**: `boolean` +### `enableAlpha`: `boolean` Defaults to `false`. When `true` the color picker will display the alpha channel both in the bottom inputs as well as in the color picker itself. -### `defaultValue` +- Required: No +- Default: `false` -**Type**: `string | undefined` +### `defaultValue`: `string | undefined` An optional default value to use for the color picker. -### `copyFormat` +- Required: No +- Default: `'#fff'` -**Type**: `'hex' | 'hsl' | 'rgb' | undefined` +### `copyFormat`: `'hex' | 'hsl' | 'rgb' | undefined` The format to copy when clicking the displayed color format. + +- Required: No diff --git a/packages/components/src/color-picker/component.tsx b/packages/components/src/color-picker/component.tsx index bd9ee1fd49465c..4f9f0c7da59e78 100644 --- a/packages/components/src/color-picker/component.tsx +++ b/packages/components/src/color-picker/component.tsx @@ -11,6 +11,7 @@ import namesPlugin from 'colord/plugins/names'; */ import { useState, useMemo } from '@wordpress/element'; import { settings } from '@wordpress/icons'; +import { useDebounce } from '@wordpress/compose'; import { __ } from '@wordpress/i18n'; /** @@ -32,6 +33,7 @@ import { import { ColorDisplay } from './color-display'; import { ColorInput } from './color-input'; import { Picker } from './picker'; +import { useControlledValue } from '../utils/hooks'; import type { ColorType } from './types'; @@ -57,7 +59,7 @@ const ColorPicker = ( ) => { const { enableAlpha = false, - color, + color: colorProp, onChange, defaultValue = '#fff', copyFormat, @@ -65,15 +67,23 @@ const ColorPicker = ( } = useContextSystem( props, 'ColorPicker' ); // Use a safe default value for the color and remove the possibility of `undefined`. + const [ color, setColor ] = useControlledValue( { + onChange, + value: colorProp, + defaultValue, + } ); + const safeColordColor = useMemo( () => { - return color ? colord( color ) : colord( defaultValue ); - }, [ color, defaultValue ] ); + return colord( color ); + }, [ color ] ); + + const debouncedSetColor = useDebounce( setColor ); const handleChange = useCallback( ( nextValue: Colord ) => { - onChange( nextValue.toHex() ); + debouncedSetColor( nextValue.toHex() ); }, - [ onChange ] + [ debouncedSetColor ] ); const [ showInputs, setShowInputs ] = useState< boolean >( false ); diff --git a/packages/components/src/color-picker/test/index.js b/packages/components/src/color-picker/test/index.js index 34a5198c236072..19f8f2130f005e 100644 --- a/packages/components/src/color-picker/test/index.js +++ b/packages/components/src/color-picker/test/index.js @@ -41,6 +41,12 @@ function moveReactColorfulSlider( sliderElement, from, to ) { fireEvent( sliderElement, new FakeMouseEvent( 'mousemove', to ) ); } +const sleep = ( ms ) => { + const promise = new Promise( ( resolve ) => setTimeout( resolve, ms ) ); + jest.advanceTimersByTime( ms + 1 ); + return promise; +}; + const hslaMatcher = expect.objectContaining( { h: expect.any( Number ), s: expect.any( Number ), @@ -87,6 +93,9 @@ describe( 'ColorPicker', () => { { pageX: 10, pageY: 10 } ); + // `onChange` is debounced so we need to sleep for at least 1ms before checking that onChange was called + await sleep( 1 ); + expect( onChangeComplete ).toHaveBeenCalledWith( legacyColorMatcher ); @@ -108,6 +117,9 @@ describe( 'ColorPicker', () => { { pageX: 10, pageY: 10 } ); + // `onChange` is debounced so we need to sleep for at least 1ms before checking that onChange was called + await sleep( 1 ); + expect( onChange ).toHaveBeenCalledWith( expect.stringMatching( /^#([a-fA-F0-9]{8})$/ ) ); @@ -138,6 +150,9 @@ describe( 'ColorPicker', () => { { pageX: 10, pageY: 10 } ); + // `onChange` is debounced so we need to sleep for at least 1ms before checking that onChange was called + await sleep( 1 ); + expect( onChange ).toHaveBeenCalledWith( expect.stringMatching( /^#([a-fA-F0-9]{6})$/ ) ); diff --git a/packages/components/src/divider/README.md b/packages/components/src/divider/README.md index ae9b961dad5e54..977f969d40ff51 100644 --- a/packages/components/src/divider/README.md +++ b/packages/components/src/divider/README.md @@ -9,15 +9,43 @@ This feature is still experimental. “Experimental” means this is an early im ## Usage ```jsx -import { Divider, FormGroup, ListGroup } from '@wordpress/components/ui'; +import { + __experimentalDivider as Divider, + __experimentalText as Text, + __experimentalVStack as VStack, +} from `@wordpress/components`; function Example() { return ( - <ListGroup> - <FormGroup>...</FormGroup> + <VStack spacing={4}> + <Text>Some text here</Text> <Divider /> - <FormGroup>...</FormGroup> - </ListGroup> + <Text>Some more text here</Text> + </VStack> ); } ``` + +## Props + +### `margin`: `number` + +Adjusts all margins on the inline dimension. + +- Required: No + +### `marginStart`: `number` + +Adjusts the inline-start margin. + +- Required: No + +### `marginEnd`: `number` + +Adjusts the inline-end margin. + +- Required: No + +### Inherited props + +`Divider` also inherits all of the [`Separator` props](https://reakit.io/docs/separator/). diff --git a/packages/components/src/divider/component.tsx b/packages/components/src/divider/component.tsx index 085d2f5f012b71..15a61adab5c2ac 100644 --- a/packages/components/src/divider/component.tsx +++ b/packages/components/src/divider/component.tsx @@ -38,17 +38,18 @@ function Divider( * @example * ```js * import { - * __experimentalDivider as Divider, - * __experimentalText as Text } - * from `@wordpress/components`; + * __experimentalDivider as Divider, + * __experimentalText as Text, + * __experimentalVStack as VStack, + * } from `@wordpress/components`; * * function Example() { * return ( - * <ListGroup> - * <FormGroup>...</FormGroup> + * <VStack spacing={4}> + * <Text>Some text here</Text> * <Divider /> - * <FormGroup>...</FormGroup> - * </ListGroup> + * <Text>Some more text here</Text> + * </VStack> * ); * } * ``` diff --git a/packages/components/src/divider/stories/index.js b/packages/components/src/divider/stories/index.js index a3a7b595db3bf9..a721007068aaa6 100644 --- a/packages/components/src/divider/stories/index.js +++ b/packages/components/src/divider/stories/index.js @@ -1,38 +1,64 @@ /** * External dependencies */ -import { number } from '@storybook/addon-knobs'; +import { css } from '@emotion/react'; /** * Internal dependencies */ +import { useCx } from '../../utils'; +import { Text } from '../../text'; import { Divider } from '..'; export default { component: Divider, title: 'Components (Experimental)/Divider', - parameters: { - knobs: { disabled: false }, + argTypes: { + margin: { + control: { type: 'number' }, + }, + marginStart: { + control: { type: 'number' }, + }, + marginEnd: { + control: { type: 'number' }, + }, }, }; -const BlackDivider = ( props ) => ( - <Divider { ...props } style={ { borderColor: 'black' } } /> +const HorizontalTemplate = ( args ) => ( + <div> + <Text>Some text before the divider</Text> + <Divider { ...args } /> + <Text>Some text after the divider</Text> + </div> ); -export const _default = () => { - const props = { - margin: number( 'margin', 0 ), - }; - // make the border color black to give higher contrast and help it appear in storybook better - return <BlackDivider { ...props } />; +const VerticalTemplate = ( args ) => { + const cx = useCx(); + const wrapperClassName = cx( css` + display: flex; + align-items: stretch; + justify-content: start; + ` ); + + return ( + <div className={ wrapperClassName }> + <Text>Some text before the divider</Text> + <Divider orientation="vertical" { ...args } /> + <Text>Some text after the divider</Text> + </div> + ); }; -export const splitMargins = () => { - const props = { - marginTop: number( 'marginTop', 0 ), - marginBottom: number( 'marginBottom', 0 ), - }; +export const Horizontal = HorizontalTemplate.bind( {} ); +Horizontal.args = { + margin: 2, + marginStart: undefined, + marginEnd: undefined, +}; - return <BlackDivider { ...props } />; +export const Vertical = VerticalTemplate.bind( {} ); +Vertical.args = { + ...Horizontal.args, }; diff --git a/packages/components/src/divider/styles.ts b/packages/components/src/divider/styles.ts index 270cc27cd80a0d..50b49342118027 100644 --- a/packages/components/src/divider/styles.ts +++ b/packages/components/src/divider/styles.ts @@ -8,29 +8,66 @@ import { css } from '@emotion/react'; * Internal dependencies */ import { space } from '../ui/utils/space'; -import CONFIG from '../utils/config-values'; -import type { OwnProps } from './types'; +import { rtl } from '../utils'; +import type { Props } from './types'; -const renderMargin = ( { margin, marginTop, marginBottom }: OwnProps ) => { - if ( typeof margin !== 'undefined' ) { - return css( { - marginBottom: space( margin ), - marginTop: space( margin ), - } ); - } +const MARGIN_DIRECTIONS: Record< + NonNullable< Props[ 'orientation' ] >, + Record< 'start' | 'end', string > +> = { + vertical: { + start: 'marginLeft', + end: 'marginRight', + }, + horizontal: { + start: 'marginTop', + end: 'marginBottom', + }, +}; + +// Renders the correct margins given the Divider's `orientation` and the writing direction. +// When both the generic `margin` and the specific `marginStart|marginEnd` props are defined, +// the latter will take priority. +const renderMargin = ( { + 'aria-orientation': orientation = 'horizontal', + margin, + marginStart, + marginEnd, +}: Props ) => + css( + rtl( { + [ MARGIN_DIRECTIONS[ orientation ].start ]: space( + marginStart ?? margin + ), + [ MARGIN_DIRECTIONS[ orientation ].end ]: space( + marginEnd ?? margin + ), + } )() + ); +const renderBorder = ( { + 'aria-orientation': orientation = 'horizontal', +}: Props ) => { return css( { - marginTop: space( marginTop ), - marginBottom: space( marginBottom ), + [ orientation === 'vertical' + ? 'borderRight' + : 'borderBottom' ]: '1px solid currentColor', } ); }; -export const DividerView = styled.hr< OwnProps >` - border-color: ${ CONFIG.colorDivider }; - border-width: 0 0 1px 0; - height: 0; +const renderSize = ( { + 'aria-orientation': orientation = 'horizontal', +}: Props ) => + css( { + height: orientation === 'vertical' ? 'auto' : 0, + width: orientation === 'vertical' ? 0 : 'auto', + } ); + +export const DividerView = styled.hr< Props >` + border: 0; margin: 0; - width: auto; + ${ renderBorder } + ${ renderSize } ${ renderMargin } `; diff --git a/packages/components/src/divider/test/__snapshots__/index.js.snap b/packages/components/src/divider/test/__snapshots__/index.js.snap index d19ce16daf39c5..5a330d602a5608 100644 --- a/packages/components/src/divider/test/__snapshots__/index.js.snap +++ b/packages/components/src/divider/test/__snapshots__/index.js.snap @@ -2,10 +2,10 @@ exports[`props should render correctly 1`] = ` .emotion-0 { - border-color: rgba(0, 0, 0, 0.1); - border-width: 0 0 1px 0; - height: 0; + border: 0; margin: 0; + border-bottom: 1px solid currentColor; + height: 0; width: auto; } @@ -25,8 +25,8 @@ Snapshot Diff: @@ -2,10 +2,8 @@ Object { - "border-color": "rgba(0, 0, 0, 0.1)", - "border-width": "0 0 1px 0", + "border": "0", + "border-bottom": "1px solid currentColor", "height": "0", "margin": "0", - "margin-bottom": "calc(4px * 7)", @@ -36,15 +36,15 @@ Snapshot Diff: ] `; -exports[`props should render marginBottom 1`] = ` +exports[`props should render marginEnd 1`] = ` Snapshot Diff: - Received styles + Base styles @@ -2,9 +2,8 @@ Object { - "border-color": "rgba(0, 0, 0, 0.1)", - "border-width": "0 0 1px 0", + "border": "0", + "border-bottom": "1px solid currentColor", "height": "0", "margin": "0", - "margin-bottom": "calc(4px * 5)", @@ -53,15 +53,15 @@ Snapshot Diff: ] `; -exports[`props should render marginTop 1`] = ` +exports[`props should render marginStart 1`] = ` Snapshot Diff: - Received styles + Base styles @@ -2,9 +2,8 @@ Object { - "border-color": "rgba(0, 0, 0, 0.1)", - "border-width": "0 0 1px 0", + "border": "0", + "border-bottom": "1px solid currentColor", "height": "0", "margin": "0", - "margin-top": "calc(4px * 5)", diff --git a/packages/components/src/divider/test/index.js b/packages/components/src/divider/test/index.js index 239206a5f54422..424fa33ce368b3 100644 --- a/packages/components/src/divider/test/index.js +++ b/packages/components/src/divider/test/index.js @@ -18,15 +18,15 @@ describe( 'props', () => { expect( base.container.firstChild ).toMatchSnapshot(); } ); - test( 'should render marginTop', () => { - const { container } = render( <Divider marginTop={ 5 } /> ); + test( 'should render marginStart', () => { + const { container } = render( <Divider marginStart={ 5 } /> ); expect( container.firstChild ).toMatchStyleDiffSnapshot( base.container.firstChild ); } ); - test( 'should render marginBottom', () => { - const { container } = render( <Divider marginBottom={ 5 } /> ); + test( 'should render marginEnd', () => { + const { container } = render( <Divider marginEnd={ 5 } /> ); expect( container.firstChild ).toMatchStyleDiffSnapshot( base.container.firstChild ); diff --git a/packages/components/src/divider/types.ts b/packages/components/src/divider/types.ts index 70a17881cc0e6a..e531aa0561afdb 100644 --- a/packages/components/src/divider/types.ts +++ b/packages/components/src/divider/types.ts @@ -11,17 +11,17 @@ import type { SpaceInput } from '../ui/utils/space'; export interface OwnProps { /** - * Adjusts all margins. + * Adjusts all margins on the inline dimension. */ margin?: SpaceInput; /** - * Adjusts top margins. + * Adjusts the inline-start margin. */ - marginTop?: SpaceInput; + marginStart?: SpaceInput; /** - * Adjusts bottom margins. + * Adjusts the inline-end margin. */ - marginBottom?: SpaceInput; + marginEnd?: SpaceInput; } export interface Props extends Omit< SeparatorProps, 'children' >, OwnProps {} diff --git a/packages/components/src/navigation/item/index.js b/packages/components/src/navigation/item/index.js index a2ac076ea2ee10..69a8cc41aae001 100644 --- a/packages/components/src/navigation/item/index.js +++ b/packages/components/src/navigation/item/index.js @@ -52,8 +52,10 @@ export default function NavigationItem( props ) { return null; } + const isActive = item && activeItem === item; + const classes = classnames( className, { - 'is-active': item && activeItem === item, + 'is-active': isActive, } ); const onItemClick = ( event ) => { @@ -67,7 +69,13 @@ export default function NavigationItem( props ) { const baseProps = children ? props : { ...props, onClick: undefined }; const itemProps = isText ? restProps - : { as: Button, href, onClick: onItemClick, ...restProps }; + : { + as: Button, + href, + onClick: onItemClick, + 'aria-current': isActive ? 'page' : undefined, + ...restProps, + }; return ( <NavigationItemBase { ...baseProps } className={ classes }> diff --git a/packages/components/src/palette-edit/index.js b/packages/components/src/palette-edit/index.js index 8687c4f9ffb191..ddd8903b7a6b90 100644 --- a/packages/components/src/palette-edit/index.js +++ b/packages/components/src/palette-edit/index.js @@ -7,7 +7,7 @@ import { kebabCase } from 'lodash'; * WordPress dependencies */ import { useState, useRef, useEffect } from '@wordpress/element'; -import { __ } from '@wordpress/i18n'; +import { __, sprintf } from '@wordpress/i18n'; import { lineSolid, moreVertical, plus } from '@wordpress/icons'; import { __experimentalUseFocusOutside as useFocusOutside } from '@wordpress/compose'; @@ -64,6 +64,7 @@ function Option( { } ) { const focusOutsideProps = useFocusOutside( onStopEditing ); const value = isGradient ? element.gradient : element.color; + return ( <PaletteItem as="div" @@ -240,8 +241,8 @@ export default function PaletteEdit( { editingElement && elements[ editingElement ] && ! elements[ editingElement ].slug; - - const hasElements = elements.length > 0; + const elementsLength = elements.length; + const hasElements = elementsLength > 0; return ( <PaletteEditStyles> @@ -270,13 +271,18 @@ export default function PaletteEdit( { : __( 'Add color' ) } onClick={ () => { + const tempOptionName = sprintf( + /* translators: %s: is a temporary id for a custom color */ + __( 'Color %s ' ), + elementsLength + 1 + ); onChange( [ ...elements, { ...( isGradient ? { gradient: DEFAULT_GRADIENT } : { color: '#000' } ), - name: '', + name: tempOptionName, slug: '', }, ] ); diff --git a/packages/components/src/tools-panel/styles.ts b/packages/components/src/tools-panel/styles.ts index 373847efa5fc40..15a08912225fed 100644 --- a/packages/components/src/tools-panel/styles.ts +++ b/packages/components/src/tools-panel/styles.ts @@ -70,6 +70,7 @@ export const ToolsPanelHeader = css` */ .components-dropdown-menu { margin: ${ space( -1 ) } 0; + line-height: 0; } &&&& .components-dropdown-menu__toggle { padding: 0; diff --git a/packages/e2e-test-utils/src/create-user.js b/packages/e2e-test-utils/src/create-user.js index 63fdcee42ca578..5b6b2a52ae7b0d 100644 --- a/packages/e2e-test-utils/src/create-user.js +++ b/packages/e2e-test-utils/src/create-user.js @@ -27,7 +27,7 @@ export async function createUser( ) { await switchUserToAdmin(); await visitAdminPage( 'user-new.php' ); - + await page.waitForSelector( '#user_login', { visible: true } ); await page.type( '#user_login', username ); await page.type( '#email', snakeCase( username ) + '@example.com' ); if ( firstName ) { diff --git a/packages/e2e-tests/specs/editor/blocks/image.test.js b/packages/e2e-tests/specs/editor/blocks/image.test.js index 575f07a251544a..7695ae8e34b7ab 100644 --- a/packages/e2e-tests/specs/editor/blocks/image.test.js +++ b/packages/e2e-tests/specs/editor/blocks/image.test.js @@ -74,7 +74,7 @@ describe( 'Image', () => { expect( await getEditedPostContent() ).toMatch( regex ); } ); - it.skip( 'should replace, reset size, and keep selection', async () => { + it( 'should replace, reset size, and keep selection', async () => { await insertBlock( 'Image' ); const filename1 = await upload( '.wp-block-image input[type="file"]' ); await waitForImage( filename1 ); @@ -104,7 +104,7 @@ describe( 'Image', () => { ); expect( await getEditedPostContent() ).toMatch( regex3 ); - await page.click( '.wp-block-image img' ); + await page.click( '.wp-block-image' ); await page.keyboard.press( 'Backspace' ); expect( await getEditedPostContent() ).toBe( '' ); @@ -314,9 +314,13 @@ describe( 'Image', () => { // Upload an initial image. const filename = await upload( '.wp-block-image input[type="file"]' ); - + await waitForImage( filename ); // Resize the Uploaded Image. await openDocumentSettingsSidebar(); + await page.waitForSelector( + '[aria-label="Image size presets"] button:first-child', + { visible: true } + ); await page.click( '[aria-label="Image size presets"] button:first-child' ); @@ -337,15 +341,15 @@ describe( 'Image', () => { await editButton.click(); await page.waitForSelector( '.block-editor-url-input__input' ); - await page.evaluate( - () => - ( document.querySelector( - '.block-editor-url-input__input' - ).value = '' ) - ); + // Clear the input field. Delay added to account for typing delays. + const inputField = await page.$( '.block-editor-url-input__input' ); + await inputField.click( { clickCount: 3, delay: 100 } ); + await page.keyboard.press( 'Backspace', { delay: 100 } ); + + // Replace the url. Delay added to account for typing delays. await page.focus( '.block-editor-url-input__input' ); - await page.keyboard.type( imageUrl ); + await page.keyboard.type( imageUrl, { delay: 100 } ); await page.click( '.block-editor-link-control__search-submit' ); const regexAfter = new RegExp( diff --git a/packages/edit-post/src/components/block-manager/category.js b/packages/edit-post/src/components/block-manager/category.js index 217a42e610f16c..b6d75552491f12 100644 --- a/packages/edit-post/src/components/block-manager/category.js +++ b/packages/edit-post/src/components/block-manager/category.js @@ -6,36 +6,59 @@ import { includes, map, without } from 'lodash'; /** * WordPress dependencies */ -import { useContext, useMemo } from '@wordpress/element'; -import { withSelect, withDispatch } from '@wordpress/data'; -import { compose, withInstanceId } from '@wordpress/compose'; +import { useMemo, useCallback } from '@wordpress/element'; +import { useDispatch, useSelect } from '@wordpress/data'; +import { useInstanceId } from '@wordpress/compose'; import { CheckboxControl } from '@wordpress/components'; +import { store as editorStore } from '@wordpress/editor'; /** * Internal dependencies */ import BlockTypesChecklist from './checklist'; -import EditPostSettings from '../edit-post-settings'; import { store as editPostStore } from '../../store'; -function BlockManagerCategory( { - instanceId, - title, - blockTypes, - hiddenBlockTypes, - toggleVisible, - toggleAllVisible, -} ) { - const settings = useContext( EditPostSettings ); - const { allowedBlockTypes } = settings; +function BlockManagerCategory( { title, blockTypes } ) { + const instanceId = useInstanceId( BlockManagerCategory ); + const { defaultAllowedBlockTypes, hiddenBlockTypes } = useSelect( + ( select ) => { + const { getEditorSettings } = select( editorStore ); + const { getPreference } = select( editPostStore ); + return { + defaultAllowedBlockTypes: getEditorSettings() + .defaultAllowedBlockTypes, + hiddenBlockTypes: getPreference( 'hiddenBlockTypes' ), + }; + }, + [] + ); const filteredBlockTypes = useMemo( () => { - if ( allowedBlockTypes === true ) { + if ( defaultAllowedBlockTypes === true ) { return blockTypes; } return blockTypes.filter( ( { name } ) => { - return includes( allowedBlockTypes || [], name ); + return includes( defaultAllowedBlockTypes || [], name ); } ); - }, [ allowedBlockTypes, blockTypes ] ); + }, [ defaultAllowedBlockTypes, blockTypes ] ); + const { showBlockTypes, hideBlockTypes } = useDispatch( editPostStore ); + const toggleVisible = useCallback( ( blockName, nextIsChecked ) => { + if ( nextIsChecked ) { + showBlockTypes( blockName ); + } else { + hideBlockTypes( blockName ); + } + }, [] ); + const toggleAllVisible = useCallback( + ( nextIsChecked ) => { + const blockNames = map( blockTypes, 'name' ); + if ( nextIsChecked ) { + showBlockTypes( blockNames ); + } else { + hideBlockTypes( blockNames ); + } + }, + [ blockTypes ] + ); if ( ! filteredBlockTypes.length ) { return null; @@ -81,34 +104,4 @@ function BlockManagerCategory( { ); } -export default compose( [ - withInstanceId, - withSelect( ( select ) => { - const { getPreference } = select( editPostStore ); - - return { - hiddenBlockTypes: getPreference( 'hiddenBlockTypes' ), - }; - } ), - withDispatch( ( dispatch, ownProps ) => { - const { showBlockTypes, hideBlockTypes } = dispatch( editPostStore ); - - return { - toggleVisible( blockName, nextIsChecked ) { - if ( nextIsChecked ) { - showBlockTypes( blockName ); - } else { - hideBlockTypes( blockName ); - } - }, - toggleAllVisible( nextIsChecked ) { - const blockNames = map( ownProps.blockTypes, 'name' ); - if ( nextIsChecked ) { - showBlockTypes( blockNames ); - } else { - hideBlockTypes( blockNames ); - } - }, - }; - } ), -] )( BlockManagerCategory ); +export default BlockManagerCategory; diff --git a/packages/edit-post/src/components/edit-post-settings/index.js b/packages/edit-post/src/components/edit-post-settings/index.js deleted file mode 100644 index db6c9f0454edfe..00000000000000 --- a/packages/edit-post/src/components/edit-post-settings/index.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * WordPress dependencies - */ -import { createContext } from '@wordpress/element'; - -const EditPostSettings = createContext( {} ); -export default EditPostSettings; diff --git a/packages/edit-post/src/editor.js b/packages/edit-post/src/editor.js index ed280e35867fee..d6a8cf760ba5f1 100644 --- a/packages/edit-post/src/editor.js +++ b/packages/edit-post/src/editor.js @@ -25,7 +25,6 @@ import { ShortcutProvider } from '@wordpress/keyboard-shortcuts'; import preventEventDiscovery from './prevent-event-discovery'; import Layout from './components/layout'; import EditorInitialization from './components/editor-initialization'; -import EditPostSettings from './components/edit-post-settings'; import { store as editPostStore } from './store'; function Editor( { @@ -127,6 +126,9 @@ function Editor( { // This is marked as experimental to give time for the quick inserter to mature. __experimentalSetIsInserterOpened: setIsInserterOpened, keepCaretInsideBlock, + // Keep a reference of the `allowedBlockTypes` from the server to handle use cases + // where we need to differentiate if a block is disabled by the user or some plugin. + defaultAllowedBlockTypes: settings.allowedBlockTypes, }; // Omit hidden block types if exists and non-empty. @@ -186,29 +188,27 @@ function Editor( { return ( <StrictMode> <ShortcutProvider> - <EditPostSettings.Provider value={ settings }> - <SlotFillProvider> - <EditorProvider - settings={ editorSettings } - post={ post } - initialEdits={ initialEdits } - useSubRegistry={ false } - __unstableTemplate={ - isTemplateMode ? template : undefined - } - { ...props } - > - <ErrorBoundary onError={ onError }> - <EditorInitialization postId={ postId } /> - <Layout styles={ styles } /> - <KeyboardShortcuts - shortcuts={ preventEventDiscovery } - /> - </ErrorBoundary> - <PostLockedModal /> - </EditorProvider> - </SlotFillProvider> - </EditPostSettings.Provider> + <SlotFillProvider> + <EditorProvider + settings={ editorSettings } + post={ post } + initialEdits={ initialEdits } + useSubRegistry={ false } + __unstableTemplate={ + isTemplateMode ? template : undefined + } + { ...props } + > + <ErrorBoundary onError={ onError }> + <EditorInitialization postId={ postId } /> + <Layout styles={ styles } /> + <KeyboardShortcuts + shortcuts={ preventEventDiscovery } + /> + </ErrorBoundary> + <PostLockedModal /> + </EditorProvider> + </SlotFillProvider> </ShortcutProvider> </StrictMode> ); diff --git a/packages/edit-post/src/editor.native.js b/packages/edit-post/src/editor.native.js index ea9dbf9eeaab0e..7f71d7f68ad278 100644 --- a/packages/edit-post/src/editor.native.js +++ b/packages/edit-post/src/editor.native.js @@ -30,6 +30,11 @@ class Editor extends Component { constructor( props ) { super( ...arguments ); + // need to set this globally to avoid race with deprecations + // defaulting to true to avoid issues with a not-yet-cached value + const { galleryWithImageBlocks = true } = props; + window.wp.galleryBlockV2Enabled = galleryWithImageBlocks; + if ( props.initialHtmlModeEnabled && props.mode === 'visual' ) { // enable html mode if the initial mode the parent wants it but we're not already in it this.props.switchEditorMode( 'text' ); diff --git a/packages/edit-site/src/components/block-editor/style.scss b/packages/edit-site/src/components/block-editor/style.scss index 60736f7cf39e4b..08ee936012ef70 100644 --- a/packages/edit-site/src/components/block-editor/style.scss +++ b/packages/edit-site/src/components/block-editor/style.scss @@ -19,18 +19,14 @@ align-items: center; &.is-focus-mode { - padding: 48px; + padding: $grid-unit-60; .edit-site-visual-editor__editor-canvas { - border-radius: 2px; + border-radius: $radius-block-ui; } } } -.edit-site-visual-editor__editor-canvas { - border-radius: 2px 2px 0 0; -} - .edit-site-visual-editor__back-button { position: absolute; top: $grid-unit-10; diff --git a/packages/edit-site/src/components/global-styles/screen-background-color.js b/packages/edit-site/src/components/global-styles/screen-background-color.js index 21c551c49155f0..3cbd0cacb3ed37 100644 --- a/packages/edit-site/src/components/global-styles/screen-background-color.js +++ b/packages/edit-site/src/components/global-styles/screen-background-color.js @@ -105,6 +105,7 @@ function ScreenBackgroundColor( { name } ) { __experimentalHasMultipleOrigins showTitle={ false } enableAlpha + __experimentalIsRenderedInSidebar /> </> ); diff --git a/packages/edit-site/src/components/global-styles/screen-link-color.js b/packages/edit-site/src/components/global-styles/screen-link-color.js index e69b92eb056750..c18580ed118796 100644 --- a/packages/edit-site/src/components/global-styles/screen-link-color.js +++ b/packages/edit-site/src/components/global-styles/screen-link-color.js @@ -71,6 +71,7 @@ function ScreenLinkColor( { name } ) { __experimentalHasMultipleOrigins showTitle={ false } enableAlpha + __experimentalIsRenderedInSidebar /> </> ); diff --git a/packages/edit-site/src/components/global-styles/screen-text-color.js b/packages/edit-site/src/components/global-styles/screen-text-color.js index 4b309ed09a2e6f..599293265ae6d2 100644 --- a/packages/edit-site/src/components/global-styles/screen-text-color.js +++ b/packages/edit-site/src/components/global-styles/screen-text-color.js @@ -63,6 +63,7 @@ function ScreenTextColor( { name } ) { __experimentalHasMultipleOrigins showTitle={ false } enableAlpha + __experimentalIsRenderedInSidebar /> </> ); diff --git a/packages/editor/src/components/provider/index.native.js b/packages/editor/src/components/provider/index.native.js index 059b98eb459374..ace8b1f01da136 100644 --- a/packages/editor/src/components/provider/index.native.js +++ b/packages/editor/src/components/provider/index.native.js @@ -75,6 +75,7 @@ class NativeEditorProvider extends Component { this.post.type, this.post ); + this.getEditorSettings = memize( ( settings, capabilities ) => ( { ...settings, @@ -90,16 +91,10 @@ class NativeEditorProvider extends Component { } componentDidMount() { - const { - capabilities, - locale, - updateSettings, - galleryWithImageBlocks, - } = this.props; + const { capabilities, locale, updateSettings } = this.props; updateSettings( { ...capabilities, - ...{ __unstableGalleryWithImageBlocks: galleryWithImageBlocks }, ...this.getThemeColors( this.props ), locale, } ); @@ -149,14 +144,11 @@ class NativeEditorProvider extends Component { ); this.subscriptionParentUpdateEditorSettings = subscribeUpdateEditorSettings( - ( editorSettings ) => { - updateSettings( { - ...{ - __unstableGalleryWithImageBlocks: - editorSettings.galleryWithImageBlocks, - }, - ...this.getThemeColors( editorSettings ), - } ); + ( { galleryWithImageBlocks, ...editorSettings } ) => { + if ( typeof galleryWithImageBlocks === 'boolean' ) { + window.wp.galleryBlockV2Enabled = galleryWithImageBlocks; + } + updateSettings( this.getThemeColors( editorSettings ) ); } ); diff --git a/packages/react-native-bridge/android/react-native-bridge/src/main/java/org/wordpress/mobile/ReactNativeGutenbergBridge/RNReactNativeGutenbergBridgeModule.java b/packages/react-native-bridge/android/react-native-bridge/src/main/java/org/wordpress/mobile/ReactNativeGutenbergBridge/RNReactNativeGutenbergBridgeModule.java index bdbe2402671987..860a68419dcb3a 100644 --- a/packages/react-native-bridge/android/react-native-bridge/src/main/java/org/wordpress/mobile/ReactNativeGutenbergBridge/RNReactNativeGutenbergBridgeModule.java +++ b/packages/react-native-bridge/android/react-native-bridge/src/main/java/org/wordpress/mobile/ReactNativeGutenbergBridge/RNReactNativeGutenbergBridgeModule.java @@ -60,6 +60,7 @@ public class RNReactNativeGutenbergBridgeModule extends ReactContextBaseJavaModu private static final String MAP_KEY_THEME_UPDATE_COLORS = "colors"; private static final String MAP_KEY_THEME_UPDATE_GRADIENTS = "gradients"; private static final String MAP_KEY_THEME_UPDATE_RAW_STYLES = "rawStyles"; + private static final String MAP_KEY_GALLERY_WITH_IMAGE_BLOCKS = "galleryWithImageBlocks"; public static final String MAP_KEY_MEDIA_FINAL_SAVE_RESULT_SUCCESS_VALUE = "success"; private static final String MAP_KEY_IS_PREFERRED_COLOR_SCHEME_DARK = "isPreferredColorSchemeDark"; @@ -149,6 +150,13 @@ public void updateTheme(@Nullable Bundle editorTheme) { Serializable gradients = editorTheme.getSerializable(MAP_KEY_THEME_UPDATE_GRADIENTS); Serializable rawStyles = editorTheme.getSerializable(MAP_KEY_THEME_UPDATE_RAW_STYLES); + // We must assign null here to distinguish between a missing value and false + Boolean galleryWithImageBlocks = null; + if (editorTheme.containsKey(MAP_KEY_GALLERY_WITH_IMAGE_BLOCKS)) { + galleryWithImageBlocks = editorTheme.getBoolean(MAP_KEY_GALLERY_WITH_IMAGE_BLOCKS); + } + + if (colors != null) { writableMap.putArray(MAP_KEY_THEME_UPDATE_COLORS, Arguments.fromList((ArrayList)colors)); } @@ -161,6 +169,10 @@ public void updateTheme(@Nullable Bundle editorTheme) { writableMap.putString(MAP_KEY_THEME_UPDATE_RAW_STYLES, rawStyles.toString()); } + if (galleryWithImageBlocks != null) { + writableMap.putBoolean(MAP_KEY_GALLERY_WITH_IMAGE_BLOCKS, galleryWithImageBlocks); + } + emitToJS(EVENT_NAME_UPDATE_EDITOR_SETTINGS, writableMap); } diff --git a/packages/react-native-bridge/ios/Gutenberg.swift b/packages/react-native-bridge/ios/Gutenberg.swift index b926c36cb3bf30..318a9796a2e9b0 100644 --- a/packages/react-native-bridge/ios/Gutenberg.swift +++ b/packages/react-native-bridge/ios/Gutenberg.swift @@ -199,7 +199,10 @@ public class Gutenberg: NSObject { private func properties(from editorSettings: GutenbergEditorSettings?) -> [String : Any] { var settingsUpdates = [String : Any]() settingsUpdates["isFSETheme"] = editorSettings?.isFSETheme ?? false - settingsUpdates["galleryWithImageBlocks"] = editorSettings?.galleryWithImageBlocks ?? false + + if let galleryWithImageBlocks = editorSettings?.galleryWithImageBlocks { + settingsUpdates["galleryWithImageBlocks"] = galleryWithImageBlocks + } if let rawStyles = editorSettings?.rawStyles { settingsUpdates["rawStyles"] = rawStyles diff --git a/readme.txt b/readme.txt index 5ae8a0fe33e3f1..e307a64799edb4 100644 --- a/readme.txt +++ b/readme.txt @@ -56,4 +56,4 @@ The four phases of the project are Editing, Customization, Collaboration, and Mu == Changelog == -To read the changelog for Gutenberg 12.0.1, please navigate to the <a href="https://github.com/WordPress/gutenberg/releases/tag/v12.0.1">release page</a>. +To read the changelog for Gutenberg 12.1.0-rc.1, please navigate to the <a href="https://github.com/WordPress/gutenberg/releases/tag/v12.1.0-rc.1">release page</a>. diff --git a/test/integration/__snapshots__/blocks-raw-handling.test.js.snap b/test/integration/__snapshots__/blocks-raw-handling.test.js.snap index 2a4ddbf8f5efac..6e3a6b8a84795f 100644 --- a/test/integration/__snapshots__/blocks-raw-handling.test.js.snap +++ b/test/integration/__snapshots__/blocks-raw-handling.test.js.snap @@ -57,8 +57,8 @@ exports[`rawHandler should convert HTML post to blocks with minimal content chan <h3>Shortcode</h3> <!-- /wp:heading --> -<!-- wp:gallery {\\"ids\\":[1],\\"columns\\":3,\\"linkTo\\":\\"post\\"} --> -<figure class=\\"wp-block-gallery columns-3 is-cropped\\"><ul class=\\"blocks-gallery-grid\\"><li class=\\"blocks-gallery-item\\"><figure><img data-id=\\"1\\" class=\\"wp-image-1\\"/></figure></li></ul></figure> +<!-- wp:gallery {\\"shortCodeTransforms\\":[{\\"id\\":1}],\\"columns\\":3,\\"linkTo\\":\\"none\\"} --> +<figure class=\\"wp-block-gallery has-nested-images columns-3 is-cropped\\"></figure> <!-- /wp:gallery --> <!-- wp:html --> diff --git a/test/integration/fixtures/blocks/core__comments-pagination.html b/test/integration/fixtures/blocks/core__comments-pagination.html new file mode 100644 index 00000000000000..4449fac58ae2e2 --- /dev/null +++ b/test/integration/fixtures/blocks/core__comments-pagination.html @@ -0,0 +1 @@ +<!-- wp:comments-pagination {"paginationArrow":"chevron","textColor":"black","style":{"color":{"gradient":"linear-gradient(135deg,rgb(74,234,220) 0%,rgb(151,120,209) 20%,rgb(207,42,186) 40%,rgb(238,44,130) 60%,rgb(251,105,98) 80%,rgb(254,248,76) 100%)"},"elements":{"link":{"color":{"text":"#ffffff"}}}},"layout":{"type":"flex","orientation":"horizontal","justifyContent":"center"}} --> diff --git a/test/integration/fixtures/blocks/core__comments-pagination.json b/test/integration/fixtures/blocks/core__comments-pagination.json new file mode 100644 index 00000000000000..45976c56f30e39 --- /dev/null +++ b/test/integration/fixtures/blocks/core__comments-pagination.json @@ -0,0 +1,30 @@ +[ + { + "clientId": "_clientId_0", + "name": "core/comments-pagination", + "isValid": true, + "attributes": { + "paginationArrow": "chevron", + "textColor": "black", + "style": { + "color": { + "gradient": "linear-gradient(135deg,rgb(74,234,220) 0%,rgb(151,120,209) 20%,rgb(207,42,186) 40%,rgb(238,44,130) 60%,rgb(251,105,98) 80%,rgb(254,248,76) 100%)" + }, + "elements": { + "link": { + "color": { + "text": "#ffffff" + } + } + } + }, + "layout": { + "type": "flex", + "orientation": "horizontal", + "justifyContent": "center" + } + }, + "innerBlocks": [], + "originalContent": "" + } +] diff --git a/test/integration/fixtures/blocks/core__comments-pagination.parsed.json b/test/integration/fixtures/blocks/core__comments-pagination.parsed.json new file mode 100644 index 00000000000000..6bfe990aa7120c --- /dev/null +++ b/test/integration/fixtures/blocks/core__comments-pagination.parsed.json @@ -0,0 +1,29 @@ +[ + { + "blockName": "core/comments-pagination", + "attrs": { + "paginationArrow": "chevron", + "textColor": "black", + "style": { + "color": { + "gradient": "linear-gradient(135deg,rgb(74,234,220) 0%,rgb(151,120,209) 20%,rgb(207,42,186) 40%,rgb(238,44,130) 60%,rgb(251,105,98) 80%,rgb(254,248,76) 100%)" + }, + "elements": { + "link": { + "color": { + "text": "#ffffff" + } + } + } + }, + "layout": { + "type": "flex", + "orientation": "horizontal", + "justifyContent": "center" + } + }, + "innerBlocks": [], + "innerHTML": "", + "innerContent": [] + } +] diff --git a/test/integration/fixtures/blocks/core__comments-pagination.serialized.html b/test/integration/fixtures/blocks/core__comments-pagination.serialized.html new file mode 100644 index 00000000000000..133344e717eece --- /dev/null +++ b/test/integration/fixtures/blocks/core__comments-pagination.serialized.html @@ -0,0 +1 @@ +<!-- wp:comments-pagination {"paginationArrow":"chevron","textColor":"black","style":{"color":{"gradient":"linear-gradient(135deg,rgb(74,234,220) 0%,rgb(151,120,209) 20%,rgb(207,42,186) 40%,rgb(238,44,130) 60%,rgb(251,105,98) 80%,rgb(254,248,76) 100%)"},"elements":{"link":{"color":{"text":"#ffffff"}}}},"layout":{"type":"flex","orientation":"horizontal","justifyContent":"center"}} /--> diff --git a/test/integration/fixtures/blocks/core__gallery-with-caption.html b/test/integration/fixtures/blocks/core__gallery-with-caption.html index ca644b223d7254..0ec3003092d8b9 100644 --- a/test/integration/fixtures/blocks/core__gallery-with-caption.html +++ b/test/integration/fixtures/blocks/core__gallery-with-caption.html @@ -1,17 +1,26 @@ -<!-- wp:core/gallery {"ids":[null,null]} --> -<figure class="wp-block-gallery columns-2 is-cropped"> - <ul class="blocks-gallery-grid"> - <li class="blocks-gallery-item"> - <figure> - <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==" alt="title" /> - </figure> - </li> - <li class="blocks-gallery-item"> - <figure> - <img src="data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=" alt="title" /> - </figure> - </li> - </ul> - <figcaption class="blocks-gallery-caption">Gallery caption.</figcaption> +<!-- wp:gallery {"linkTo":"none"} --> +<figure + class="wp-block-gallery has-nested-images columns-default is-cropped columns-2" +> + <!-- wp:image {"id":1421,"sizeSlug":"large","linkDestination":"none","inheritedAttributes":{"linkDestination":true,"linkTarget":true,"sizeSlug":true}} --> + <figure class="wp-block-image size-large"> + <img + src="https://sergioestevaofolio.files.wordpress.com/2016/09/cropped-img_9054-1.jpg?w=190" + alt="Image gallery image" + class="wp-image-1421" + /> + </figure> + <!-- /wp:image --> + + <!-- wp:image {"id":1440,"sizeSlug":"large","linkDestination":"none","inheritedAttributes":{"linkDestination":true,"linkTarget":true,"sizeSlug":true}} --> + <figure class="wp-block-image size-large"> + <img + src="https://sergioestevaofolio.files.wordpress.com/2017/09/cropped-l1001498-1.jpg?w=580" + alt="Image gallery image" + class="wp-image-1440" + /> + </figure> + <!-- /wp:image --> + <figcaption class="blocks-gallery-caption">Gallery Caption</figcaption> </figure> <!-- /wp:core/gallery --> diff --git a/test/integration/fixtures/blocks/core__gallery-with-caption.json b/test/integration/fixtures/blocks/core__gallery-with-caption.json index 9780feb5bce791..4c6f79c7c0ea59 100644 --- a/test/integration/fixtures/blocks/core__gallery-with-caption.json +++ b/test/integration/fixtures/blocks/core__gallery-with-caption.json @@ -4,25 +4,49 @@ "name": "core/gallery", "isValid": true, "attributes": { - "images": [ - { - "url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==", - "alt": "title", - "caption": "" - }, - { - "url": "data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=", - "alt": "title", - "caption": "" - } - ], - "ids": [ null, null ], - "caption": "Gallery caption.", + "images": [], + "ids": [], + "shortCodeTransforms": [], + "caption": "Gallery Caption", "imageCrop": true, + "fixedHeight": true, "linkTo": "none", - "sizeSlug": "large" + "sizeSlug": "large", + "allowResize": false, + "className": "columns-2" }, - "innerBlocks": [], - "originalContent": "<figure class=\"wp-block-gallery columns-2 is-cropped\">\n\t<ul class=\"blocks-gallery-grid\">\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==\" alt=\"title\" />\n\t\t\t</figure>\n\t\t</li>\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<img src=\"data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=\" alt=\"title\" />\n\t\t\t</figure>\n\t\t</li>\n\t</ul>\n\t<figcaption class=\"blocks-gallery-caption\">Gallery caption.</figcaption>\n</figure>" + "innerBlocks": [ + { + "clientId": "_clientId_0", + "name": "core/image", + "isValid": true, + "attributes": { + "url": "https://sergioestevaofolio.files.wordpress.com/2016/09/cropped-img_9054-1.jpg?w=190", + "alt": "Image gallery image", + "caption": "", + "id": 1421, + "sizeSlug": "large", + "linkDestination": "none" + }, + "innerBlocks": [], + "originalContent": "<figure class=\"wp-block-image size-large\">\n\t\t<img\n\t\t\tsrc=\"https://sergioestevaofolio.files.wordpress.com/2016/09/cropped-img_9054-1.jpg?w=190\"\n\t\t\talt=\"Image gallery image\"\n\t\t\tclass=\"wp-image-1421\"\n\t\t/>\n\t</figure>" + }, + { + "clientId": "_clientId_1", + "name": "core/image", + "isValid": true, + "attributes": { + "url": "https://sergioestevaofolio.files.wordpress.com/2017/09/cropped-l1001498-1.jpg?w=580", + "alt": "Image gallery image", + "caption": "", + "id": 1440, + "sizeSlug": "large", + "linkDestination": "none" + }, + "innerBlocks": [], + "originalContent": "<figure class=\"wp-block-image size-large\">\n\t\t<img\n\t\t\tsrc=\"https://sergioestevaofolio.files.wordpress.com/2017/09/cropped-l1001498-1.jpg?w=580\"\n\t\t\talt=\"Image gallery image\"\n\t\t\tclass=\"wp-image-1440\"\n\t\t/>\n\t</figure>" + } + ], + "originalContent": "<figure\n\tclass=\"wp-block-gallery has-nested-images columns-default is-cropped columns-2\"\n>\n\t\n\n\t\n\t<figcaption class=\"blocks-gallery-caption\">Gallery Caption</figcaption>\n</figure>" } ] diff --git a/test/integration/fixtures/blocks/core__gallery-with-caption.parsed.json b/test/integration/fixtures/blocks/core__gallery-with-caption.parsed.json index 8060435a4fdc6f..bb43e7abcd7f82 100644 --- a/test/integration/fixtures/blocks/core__gallery-with-caption.parsed.json +++ b/test/integration/fixtures/blocks/core__gallery-with-caption.parsed.json @@ -2,12 +2,53 @@ { "blockName": "core/gallery", "attrs": { - "ids": [ null, null ] + "linkTo": "none" }, - "innerBlocks": [], - "innerHTML": "\n<figure class=\"wp-block-gallery columns-2 is-cropped\">\n\t<ul class=\"blocks-gallery-grid\">\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==\" alt=\"title\" />\n\t\t\t</figure>\n\t\t</li>\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<img src=\"data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=\" alt=\"title\" />\n\t\t\t</figure>\n\t\t</li>\n\t</ul>\n\t<figcaption class=\"blocks-gallery-caption\">Gallery caption.</figcaption>\n</figure>\n", + "innerBlocks": [ + { + "blockName": "core/image", + "attrs": { + "id": 1421, + "sizeSlug": "large", + "linkDestination": "none", + "inheritedAttributes": { + "linkDestination": true, + "linkTarget": true, + "sizeSlug": true + } + }, + "innerBlocks": [], + "innerHTML": "\n\t<figure class=\"wp-block-image size-large\">\n\t\t<img\n\t\t\tsrc=\"https://sergioestevaofolio.files.wordpress.com/2016/09/cropped-img_9054-1.jpg?w=190\"\n\t\t\talt=\"Image gallery image\"\n\t\t\tclass=\"wp-image-1421\"\n\t\t/>\n\t</figure>\n\t", + "innerContent": [ + "\n\t<figure class=\"wp-block-image size-large\">\n\t\t<img\n\t\t\tsrc=\"https://sergioestevaofolio.files.wordpress.com/2016/09/cropped-img_9054-1.jpg?w=190\"\n\t\t\talt=\"Image gallery image\"\n\t\t\tclass=\"wp-image-1421\"\n\t\t/>\n\t</figure>\n\t" + ] + }, + { + "blockName": "core/image", + "attrs": { + "id": 1440, + "sizeSlug": "large", + "linkDestination": "none", + "inheritedAttributes": { + "linkDestination": true, + "linkTarget": true, + "sizeSlug": true + } + }, + "innerBlocks": [], + "innerHTML": "\n\t<figure class=\"wp-block-image size-large\">\n\t\t<img\n\t\t\tsrc=\"https://sergioestevaofolio.files.wordpress.com/2017/09/cropped-l1001498-1.jpg?w=580\"\n\t\t\talt=\"Image gallery image\"\n\t\t\tclass=\"wp-image-1440\"\n\t\t/>\n\t</figure>\n\t", + "innerContent": [ + "\n\t<figure class=\"wp-block-image size-large\">\n\t\t<img\n\t\t\tsrc=\"https://sergioestevaofolio.files.wordpress.com/2017/09/cropped-l1001498-1.jpg?w=580\"\n\t\t\talt=\"Image gallery image\"\n\t\t\tclass=\"wp-image-1440\"\n\t\t/>\n\t</figure>\n\t" + ] + } + ], + "innerHTML": "\n<figure\n\tclass=\"wp-block-gallery has-nested-images columns-default is-cropped columns-2\"\n>\n\t\n\n\t\n\t<figcaption class=\"blocks-gallery-caption\">Gallery Caption</figcaption>\n</figure>\n", "innerContent": [ - "\n<figure class=\"wp-block-gallery columns-2 is-cropped\">\n\t<ul class=\"blocks-gallery-grid\">\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==\" alt=\"title\" />\n\t\t\t</figure>\n\t\t</li>\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<img src=\"data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=\" alt=\"title\" />\n\t\t\t</figure>\n\t\t</li>\n\t</ul>\n\t<figcaption class=\"blocks-gallery-caption\">Gallery caption.</figcaption>\n</figure>\n" + "\n<figure\n\tclass=\"wp-block-gallery has-nested-images columns-default is-cropped columns-2\"\n>\n\t", + null, + "\n\n\t", + null, + "\n\t<figcaption class=\"blocks-gallery-caption\">Gallery Caption</figcaption>\n</figure>\n" ] } ] diff --git a/test/integration/fixtures/blocks/core__gallery-with-caption.serialized.html b/test/integration/fixtures/blocks/core__gallery-with-caption.serialized.html index 39a9da57a48fa8..f67c8682af23ea 100644 --- a/test/integration/fixtures/blocks/core__gallery-with-caption.serialized.html +++ b/test/integration/fixtures/blocks/core__gallery-with-caption.serialized.html @@ -1,3 +1,9 @@ -<!-- wp:gallery {"ids":[null,null],"linkTo":"none"} --> -<figure class="wp-block-gallery columns-2 is-cropped"><ul class="blocks-gallery-grid"><li class="blocks-gallery-item"><figure><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==" alt="title"/></figure></li><li class="blocks-gallery-item"><figure><img src="data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=" alt="title"/></figure></li></ul><figcaption class="blocks-gallery-caption">Gallery caption.</figcaption></figure> +<!-- wp:gallery {"linkTo":"none","className":"columns-2"} --> +<figure class="wp-block-gallery has-nested-images columns-default is-cropped columns-2"><!-- wp:image {"id":1421,"sizeSlug":"large","linkDestination":"none"} --> +<figure class="wp-block-image size-large"><img src="https://sergioestevaofolio.files.wordpress.com/2016/09/cropped-img_9054-1.jpg?w=190" alt="Image gallery image" class="wp-image-1421"/></figure> +<!-- /wp:image --> + +<!-- wp:image {"id":1440,"sizeSlug":"large","linkDestination":"none"} --> +<figure class="wp-block-image size-large"><img src="https://sergioestevaofolio.files.wordpress.com/2017/09/cropped-l1001498-1.jpg?w=580" alt="Image gallery image" class="wp-image-1440"/></figure> +<!-- /wp:image --><figcaption class="blocks-gallery-caption">Gallery Caption</figcaption></figure> <!-- /wp:gallery --> diff --git a/test/integration/fixtures/blocks/core__gallery.html b/test/integration/fixtures/blocks/core__gallery.html index a0f62e68fc5273..3db587c8d72d58 100644 --- a/test/integration/fixtures/blocks/core__gallery.html +++ b/test/integration/fixtures/blocks/core__gallery.html @@ -1,16 +1,25 @@ -<!-- wp:core/gallery {"ids":[null,null]} --> -<figure class="wp-block-gallery columns-2 is-cropped"> - <ul class="blocks-gallery-grid"> - <li class="blocks-gallery-item"> - <figure> - <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==" alt="title" /> - </figure> - </li> - <li class="blocks-gallery-item"> - <figure> - <img src="data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=" alt="title" /> - </figure> - </li> - </ul> +<!-- wp:gallery {"linkTo":"none","className":"columns-2"} --> +<figure + class="wp-block-gallery has-nested-images columns-default is-cropped columns-2" +> + <!-- wp:image {"id":1421,"sizeSlug":"large","linkDestination":"none"} --> + <figure class="wp-block-image size-large"> + <img + src="https://sergioestevaofolio.files.wordpress.com/2016/09/cropped-img_9054-1.jpg?w=190" + alt="Image gallery image" + class="wp-image-1421" + /> + </figure> + <!-- /wp:image --> + + <!-- wp:image {"id":1440,"sizeSlug":"large","linkDestination":"none"} --> + <figure class="wp-block-image size-large"> + <img + src="https://sergioestevaofolio.files.wordpress.com/2017/09/cropped-l1001498-1.jpg?w=580" + alt="Image gallery image" + class="wp-image-1440" + /> + </figure> + <!-- /wp:image --> </figure> -<!-- /wp:core/gallery --> +<!-- /wp:gallery --> diff --git a/test/integration/fixtures/blocks/core__gallery.json b/test/integration/fixtures/blocks/core__gallery.json index 35cade362ceb90..4935952c27d15b 100644 --- a/test/integration/fixtures/blocks/core__gallery.json +++ b/test/integration/fixtures/blocks/core__gallery.json @@ -4,25 +4,49 @@ "name": "core/gallery", "isValid": true, "attributes": { - "images": [ - { - "url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==", - "alt": "title", - "caption": "" - }, - { - "url": "data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=", - "alt": "title", - "caption": "" - } - ], - "ids": [ null, null ], + "images": [], + "ids": [], + "shortCodeTransforms": [], "caption": "", "imageCrop": true, + "fixedHeight": true, "linkTo": "none", - "sizeSlug": "large" + "sizeSlug": "large", + "allowResize": false, + "className": "columns-2" }, - "innerBlocks": [], - "originalContent": "<figure class=\"wp-block-gallery columns-2 is-cropped\">\n\t<ul class=\"blocks-gallery-grid\">\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==\" alt=\"title\" />\n\t\t\t</figure>\n\t\t</li>\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<img src=\"data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=\" alt=\"title\" />\n\t\t\t</figure>\n\t\t</li>\n\t</ul>\n</figure>" + "innerBlocks": [ + { + "clientId": "_clientId_0", + "name": "core/image", + "isValid": true, + "attributes": { + "url": "https://sergioestevaofolio.files.wordpress.com/2016/09/cropped-img_9054-1.jpg?w=190", + "alt": "Image gallery image", + "caption": "", + "id": 1421, + "sizeSlug": "large", + "linkDestination": "none" + }, + "innerBlocks": [], + "originalContent": "<figure class=\"wp-block-image size-large\">\n\t\t<img\n\t\t\tsrc=\"https://sergioestevaofolio.files.wordpress.com/2016/09/cropped-img_9054-1.jpg?w=190\"\n\t\t\talt=\"Image gallery image\"\n\t\t\tclass=\"wp-image-1421\"\n\t\t/>\n\t</figure>" + }, + { + "clientId": "_clientId_1", + "name": "core/image", + "isValid": true, + "attributes": { + "url": "https://sergioestevaofolio.files.wordpress.com/2017/09/cropped-l1001498-1.jpg?w=580", + "alt": "Image gallery image", + "caption": "", + "id": 1440, + "sizeSlug": "large", + "linkDestination": "none" + }, + "innerBlocks": [], + "originalContent": "<figure class=\"wp-block-image size-large\">\n\t\t<img\n\t\t\tsrc=\"https://sergioestevaofolio.files.wordpress.com/2017/09/cropped-l1001498-1.jpg?w=580\"\n\t\t\talt=\"Image gallery image\"\n\t\t\tclass=\"wp-image-1440\"\n\t\t/>\n\t</figure>" + } + ], + "originalContent": "<figure\n\tclass=\"wp-block-gallery has-nested-images columns-default is-cropped columns-2\"\n>\n\t\n\n\t\n</figure>" } ] diff --git a/test/integration/fixtures/blocks/core__gallery.parsed.json b/test/integration/fixtures/blocks/core__gallery.parsed.json index c75387eef15d54..6ab1b02f4ba332 100644 --- a/test/integration/fixtures/blocks/core__gallery.parsed.json +++ b/test/integration/fixtures/blocks/core__gallery.parsed.json @@ -2,12 +2,44 @@ { "blockName": "core/gallery", "attrs": { - "ids": [ null, null ] + "linkTo": "none", + "className": "columns-2" }, - "innerBlocks": [], - "innerHTML": "\n<figure class=\"wp-block-gallery columns-2 is-cropped\">\n\t<ul class=\"blocks-gallery-grid\">\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==\" alt=\"title\" />\n\t\t\t</figure>\n\t\t</li>\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<img src=\"data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=\" alt=\"title\" />\n\t\t\t</figure>\n\t\t</li>\n\t</ul>\n</figure>\n", + "innerBlocks": [ + { + "blockName": "core/image", + "attrs": { + "id": 1421, + "sizeSlug": "large", + "linkDestination": "none" + }, + "innerBlocks": [], + "innerHTML": "\n\t<figure class=\"wp-block-image size-large\">\n\t\t<img\n\t\t\tsrc=\"https://sergioestevaofolio.files.wordpress.com/2016/09/cropped-img_9054-1.jpg?w=190\"\n\t\t\talt=\"Image gallery image\"\n\t\t\tclass=\"wp-image-1421\"\n\t\t/>\n\t</figure>\n\t", + "innerContent": [ + "\n\t<figure class=\"wp-block-image size-large\">\n\t\t<img\n\t\t\tsrc=\"https://sergioestevaofolio.files.wordpress.com/2016/09/cropped-img_9054-1.jpg?w=190\"\n\t\t\talt=\"Image gallery image\"\n\t\t\tclass=\"wp-image-1421\"\n\t\t/>\n\t</figure>\n\t" + ] + }, + { + "blockName": "core/image", + "attrs": { + "id": 1440, + "sizeSlug": "large", + "linkDestination": "none" + }, + "innerBlocks": [], + "innerHTML": "\n\t<figure class=\"wp-block-image size-large\">\n\t\t<img\n\t\t\tsrc=\"https://sergioestevaofolio.files.wordpress.com/2017/09/cropped-l1001498-1.jpg?w=580\"\n\t\t\talt=\"Image gallery image\"\n\t\t\tclass=\"wp-image-1440\"\n\t\t/>\n\t</figure>\n\t", + "innerContent": [ + "\n\t<figure class=\"wp-block-image size-large\">\n\t\t<img\n\t\t\tsrc=\"https://sergioestevaofolio.files.wordpress.com/2017/09/cropped-l1001498-1.jpg?w=580\"\n\t\t\talt=\"Image gallery image\"\n\t\t\tclass=\"wp-image-1440\"\n\t\t/>\n\t</figure>\n\t" + ] + } + ], + "innerHTML": "\n<figure\n\tclass=\"wp-block-gallery has-nested-images columns-default is-cropped columns-2\"\n>\n\t\n\n\t\n</figure>\n", "innerContent": [ - "\n<figure class=\"wp-block-gallery columns-2 is-cropped\">\n\t<ul class=\"blocks-gallery-grid\">\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==\" alt=\"title\" />\n\t\t\t</figure>\n\t\t</li>\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<img src=\"data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=\" alt=\"title\" />\n\t\t\t</figure>\n\t\t</li>\n\t</ul>\n</figure>\n" + "\n<figure\n\tclass=\"wp-block-gallery has-nested-images columns-default is-cropped columns-2\"\n>\n\t", + null, + "\n\n\t", + null, + "\n</figure>\n" ] } ] diff --git a/test/integration/fixtures/blocks/core__gallery.serialized.html b/test/integration/fixtures/blocks/core__gallery.serialized.html index 62c72702eb57f6..6ab87b7c6031d8 100644 --- a/test/integration/fixtures/blocks/core__gallery.serialized.html +++ b/test/integration/fixtures/blocks/core__gallery.serialized.html @@ -1,3 +1,9 @@ -<!-- wp:gallery {"ids":[null,null],"linkTo":"none"} --> -<figure class="wp-block-gallery columns-2 is-cropped"><ul class="blocks-gallery-grid"><li class="blocks-gallery-item"><figure><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==" alt="title"/></figure></li><li class="blocks-gallery-item"><figure><img src="data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=" alt="title"/></figure></li></ul></figure> +<!-- wp:gallery {"linkTo":"none","className":"columns-2"} --> +<figure class="wp-block-gallery has-nested-images columns-default is-cropped columns-2"><!-- wp:image {"id":1421,"sizeSlug":"large","linkDestination":"none"} --> +<figure class="wp-block-image size-large"><img src="https://sergioestevaofolio.files.wordpress.com/2016/09/cropped-img_9054-1.jpg?w=190" alt="Image gallery image" class="wp-image-1421"/></figure> +<!-- /wp:image --> + +<!-- wp:image {"id":1440,"sizeSlug":"large","linkDestination":"none"} --> +<figure class="wp-block-image size-large"><img src="https://sergioestevaofolio.files.wordpress.com/2017/09/cropped-l1001498-1.jpg?w=580" alt="Image gallery image" class="wp-image-1440"/></figure> +<!-- /wp:image --></figure> <!-- /wp:gallery --> diff --git a/test/integration/fixtures/blocks/core__gallery__columns.html b/test/integration/fixtures/blocks/core__gallery__columns.html index 6ab9083784937c..b70ac2b6f06a85 100644 --- a/test/integration/fixtures/blocks/core__gallery__columns.html +++ b/test/integration/fixtures/blocks/core__gallery__columns.html @@ -1,16 +1,23 @@ -<!-- wp:core/gallery {"ids":[null,null],"columns":1} --> -<figure class="wp-block-gallery columns-1 is-cropped"> - <ul class="blocks-gallery-grid"> - <li class="blocks-gallery-item"> - <figure> - <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==" alt="title" /> - </figure> - </li> - <li class="blocks-gallery-item"> - <figure> - <img src="data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=" alt="title" /> - </figure> - </li> - </ul> +<!-- wp:gallery {"columns":1,"linkTo":"none"} --> +<figure class="wp-block-gallery has-nested-images columns-1 is-cropped"> + <!-- wp:image {"id":1421,"sizeSlug":"large","linkDestination":"none","inheritedAttributes":{"linkDestination":true,"linkTarget":true,"sizeSlug":true}} --> + <figure class="wp-block-image size-large"> + <img + src="https://sergioestevaofolio.files.wordpress.com/2016/09/cropped-img_9054-1.jpg?w=190" + alt="Image gallery image" + class="wp-image-1421" + /> + </figure> + <!-- /wp:image --> + + <!-- wp:image {"id":1440,"sizeSlug":"large","linkDestination":"none","inheritedAttributes":{"linkDestination":true,"linkTarget":true,"sizeSlug":true}} --> + <figure class="wp-block-image size-large"> + <img + src="https://sergioestevaofolio.files.wordpress.com/2017/09/cropped-l1001498-1.jpg?w=580" + alt="Image gallery image" + class="wp-image-1440" + /> + </figure> + <!-- /wp:image --> </figure> -<!-- /wp:core/gallery --> +<!-- /wp:gallery --> diff --git a/test/integration/fixtures/blocks/core__gallery__columns.json b/test/integration/fixtures/blocks/core__gallery__columns.json index f1c3a654adf9df..67d2a6e553ef62 100644 --- a/test/integration/fixtures/blocks/core__gallery__columns.json +++ b/test/integration/fixtures/blocks/core__gallery__columns.json @@ -4,26 +4,49 @@ "name": "core/gallery", "isValid": true, "attributes": { - "images": [ - { - "url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==", - "alt": "title", - "caption": "" - }, - { - "url": "data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=", - "alt": "title", - "caption": "" - } - ], - "ids": [ null, null ], + "images": [], + "ids": [], + "shortCodeTransforms": [], "columns": 1, "caption": "", "imageCrop": true, + "fixedHeight": true, "linkTo": "none", - "sizeSlug": "large" + "sizeSlug": "large", + "allowResize": false }, - "innerBlocks": [], - "originalContent": "<figure class=\"wp-block-gallery columns-1 is-cropped\">\n\t<ul class=\"blocks-gallery-grid\">\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==\" alt=\"title\" />\n\t\t\t</figure>\n\t\t</li>\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<img src=\"data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=\" alt=\"title\" />\n\t\t\t</figure>\n\t\t</li>\n\t</ul>\n</figure>" + "innerBlocks": [ + { + "clientId": "_clientId_0", + "name": "core/image", + "isValid": true, + "attributes": { + "url": "https://sergioestevaofolio.files.wordpress.com/2016/09/cropped-img_9054-1.jpg?w=190", + "alt": "Image gallery image", + "caption": "", + "id": 1421, + "sizeSlug": "large", + "linkDestination": "none" + }, + "innerBlocks": [], + "originalContent": "<figure class=\"wp-block-image size-large\">\n\t\t<img\n\t\t\tsrc=\"https://sergioestevaofolio.files.wordpress.com/2016/09/cropped-img_9054-1.jpg?w=190\"\n\t\t\talt=\"Image gallery image\"\n\t\t\tclass=\"wp-image-1421\"\n\t\t/>\n\t</figure>" + }, + { + "clientId": "_clientId_1", + "name": "core/image", + "isValid": true, + "attributes": { + "url": "https://sergioestevaofolio.files.wordpress.com/2017/09/cropped-l1001498-1.jpg?w=580", + "alt": "Image gallery image", + "caption": "", + "id": 1440, + "sizeSlug": "large", + "linkDestination": "none" + }, + "innerBlocks": [], + "originalContent": "<figure class=\"wp-block-image size-large\">\n\t\t<img\n\t\t\tsrc=\"https://sergioestevaofolio.files.wordpress.com/2017/09/cropped-l1001498-1.jpg?w=580\"\n\t\t\talt=\"Image gallery image\"\n\t\t\tclass=\"wp-image-1440\"\n\t\t/>\n\t</figure>" + } + ], + "originalContent": "<figure class=\"wp-block-gallery has-nested-images columns-1 is-cropped\">\n\t\n\n\t\n</figure>" } ] diff --git a/test/integration/fixtures/blocks/core__gallery__columns.parsed.json b/test/integration/fixtures/blocks/core__gallery__columns.parsed.json index 933c6f6f11275c..f2b53946598baf 100644 --- a/test/integration/fixtures/blocks/core__gallery__columns.parsed.json +++ b/test/integration/fixtures/blocks/core__gallery__columns.parsed.json @@ -2,13 +2,54 @@ { "blockName": "core/gallery", "attrs": { - "ids": [ null, null ], - "columns": 1 + "columns": 1, + "linkTo": "none" }, - "innerBlocks": [], - "innerHTML": "\n<figure class=\"wp-block-gallery columns-1 is-cropped\">\n\t<ul class=\"blocks-gallery-grid\">\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==\" alt=\"title\" />\n\t\t\t</figure>\n\t\t</li>\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<img src=\"data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=\" alt=\"title\" />\n\t\t\t</figure>\n\t\t</li>\n\t</ul>\n</figure>\n", + "innerBlocks": [ + { + "blockName": "core/image", + "attrs": { + "id": 1421, + "sizeSlug": "large", + "linkDestination": "none", + "inheritedAttributes": { + "linkDestination": true, + "linkTarget": true, + "sizeSlug": true + } + }, + "innerBlocks": [], + "innerHTML": "\n\t<figure class=\"wp-block-image size-large\">\n\t\t<img\n\t\t\tsrc=\"https://sergioestevaofolio.files.wordpress.com/2016/09/cropped-img_9054-1.jpg?w=190\"\n\t\t\talt=\"Image gallery image\"\n\t\t\tclass=\"wp-image-1421\"\n\t\t/>\n\t</figure>\n\t", + "innerContent": [ + "\n\t<figure class=\"wp-block-image size-large\">\n\t\t<img\n\t\t\tsrc=\"https://sergioestevaofolio.files.wordpress.com/2016/09/cropped-img_9054-1.jpg?w=190\"\n\t\t\talt=\"Image gallery image\"\n\t\t\tclass=\"wp-image-1421\"\n\t\t/>\n\t</figure>\n\t" + ] + }, + { + "blockName": "core/image", + "attrs": { + "id": 1440, + "sizeSlug": "large", + "linkDestination": "none", + "inheritedAttributes": { + "linkDestination": true, + "linkTarget": true, + "sizeSlug": true + } + }, + "innerBlocks": [], + "innerHTML": "\n\t<figure class=\"wp-block-image size-large\">\n\t\t<img\n\t\t\tsrc=\"https://sergioestevaofolio.files.wordpress.com/2017/09/cropped-l1001498-1.jpg?w=580\"\n\t\t\talt=\"Image gallery image\"\n\t\t\tclass=\"wp-image-1440\"\n\t\t/>\n\t</figure>\n\t", + "innerContent": [ + "\n\t<figure class=\"wp-block-image size-large\">\n\t\t<img\n\t\t\tsrc=\"https://sergioestevaofolio.files.wordpress.com/2017/09/cropped-l1001498-1.jpg?w=580\"\n\t\t\talt=\"Image gallery image\"\n\t\t\tclass=\"wp-image-1440\"\n\t\t/>\n\t</figure>\n\t" + ] + } + ], + "innerHTML": "\n<figure class=\"wp-block-gallery has-nested-images columns-1 is-cropped\">\n\t\n\n\t\n</figure>\n", "innerContent": [ - "\n<figure class=\"wp-block-gallery columns-1 is-cropped\">\n\t<ul class=\"blocks-gallery-grid\">\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==\" alt=\"title\" />\n\t\t\t</figure>\n\t\t</li>\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<img src=\"data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=\" alt=\"title\" />\n\t\t\t</figure>\n\t\t</li>\n\t</ul>\n</figure>\n" + "\n<figure class=\"wp-block-gallery has-nested-images columns-1 is-cropped\">\n\t", + null, + "\n\n\t", + null, + "\n</figure>\n" ] } ] diff --git a/test/integration/fixtures/blocks/core__gallery__columns.serialized.html b/test/integration/fixtures/blocks/core__gallery__columns.serialized.html index 022a6a9cb73967..a1398677951cf7 100644 --- a/test/integration/fixtures/blocks/core__gallery__columns.serialized.html +++ b/test/integration/fixtures/blocks/core__gallery__columns.serialized.html @@ -1,3 +1,9 @@ -<!-- wp:gallery {"ids":[null,null],"columns":1,"linkTo":"none"} --> -<figure class="wp-block-gallery columns-1 is-cropped"><ul class="blocks-gallery-grid"><li class="blocks-gallery-item"><figure><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==" alt="title"/></figure></li><li class="blocks-gallery-item"><figure><img src="data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=" alt="title"/></figure></li></ul></figure> +<!-- wp:gallery {"columns":1,"linkTo":"none"} --> +<figure class="wp-block-gallery has-nested-images columns-1 is-cropped"><!-- wp:image {"id":1421,"sizeSlug":"large","linkDestination":"none"} --> +<figure class="wp-block-image size-large"><img src="https://sergioestevaofolio.files.wordpress.com/2016/09/cropped-img_9054-1.jpg?w=190" alt="Image gallery image" class="wp-image-1421"/></figure> +<!-- /wp:image --> + +<!-- wp:image {"id":1440,"sizeSlug":"large","linkDestination":"none"} --> +<figure class="wp-block-image size-large"><img src="https://sergioestevaofolio.files.wordpress.com/2017/09/cropped-l1001498-1.jpg?w=580" alt="Image gallery image" class="wp-image-1440"/></figure> +<!-- /wp:image --></figure> <!-- /wp:gallery --> diff --git a/test/integration/fixtures/blocks/core__gallery__deprecated-1.json b/test/integration/fixtures/blocks/core__gallery__deprecated-1.json index 3bb14e3d991c07..d274a72a649ef4 100644 --- a/test/integration/fixtures/blocks/core__gallery__deprecated-1.json +++ b/test/integration/fixtures/blocks/core__gallery__deprecated-1.json @@ -4,22 +4,35 @@ "name": "core/gallery", "isValid": true, "attributes": { - "images": [ - { - "url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==", - "alt": "title" - }, - { - "url": "data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=", - "alt": "title" - } - ], "columns": 2, "imageCrop": true, "linkTo": "none", - "align": "wide" + "allowResize": false }, - "innerBlocks": [], + "innerBlocks": [ + { + "clientId": "_clientId_0", + "name": "core/image", + "isValid": true, + "attributes": { + "url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==", + "alt": "title", + "linkDestination": "none" + }, + "innerBlocks": [] + }, + { + "clientId": "_clientId_1", + "name": "core/image", + "isValid": true, + "attributes": { + "url": "data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=", + "alt": "title", + "linkDestination": "none" + }, + "innerBlocks": [] + } + ], "originalContent": "<div class=\"wp-block-gallery columns-2 is-cropped alignwide\">\n\t<figure class=\"blocks-gallery-image\">\n\t\t<img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==\" alt=\"title\" />\n\t</figure>\n\t<figure class=\"blocks-gallery-image\">\n\t\t<img src=\"data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=\" alt=\"title\" />\n\t</figure>\n</div>" } ] diff --git a/test/integration/fixtures/blocks/core__gallery__deprecated-1.serialized.html b/test/integration/fixtures/blocks/core__gallery__deprecated-1.serialized.html index dd51c3ac37cac0..45a1ef9a673716 100644 --- a/test/integration/fixtures/blocks/core__gallery__deprecated-1.serialized.html +++ b/test/integration/fixtures/blocks/core__gallery__deprecated-1.serialized.html @@ -1,3 +1,9 @@ -<!-- wp:gallery {"columns":2,"linkTo":"none","align":"wide"} --> -<figure class="wp-block-gallery alignwide columns-2 is-cropped"><ul class="blocks-gallery-grid"><li class="blocks-gallery-item"><figure><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==" alt="title"/></figure></li><li class="blocks-gallery-item"><figure><img src="data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=" alt="title"/></figure></li></ul></figure> +<!-- wp:gallery {"columns":2,"linkTo":"none"} --> +<figure class="wp-block-gallery has-nested-images columns-2 is-cropped"><!-- wp:image {"linkDestination":"none"} --> +<figure class="wp-block-image"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==" alt="title"/></figure> +<!-- /wp:image --> + +<!-- wp:image {"linkDestination":"none"} --> +<figure class="wp-block-image"><img src="data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=" alt="title"/></figure> +<!-- /wp:image --></figure> <!-- /wp:gallery --> diff --git a/test/integration/fixtures/blocks/core__gallery__deprecated-2.json b/test/integration/fixtures/blocks/core__gallery__deprecated-2.json index 264c25f18ce1df..7dfc535aeee197 100644 --- a/test/integration/fixtures/blocks/core__gallery__deprecated-2.json +++ b/test/integration/fixtures/blocks/core__gallery__deprecated-2.json @@ -4,27 +4,39 @@ "name": "core/gallery", "isValid": true, "attributes": { - "images": [ - { + "columns": 2, + "imageCrop": true, + "linkTo": "none", + "allowResize": false + }, + "innerBlocks": [ + { + "clientId": "_clientId_0", + "name": "core/image", + "isValid": true, + "attributes": { "url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==", "alt": "title", - "id": "1", - "caption": [] + "caption": [], + "id": 1, + "linkDestination": "none" }, - { + "innerBlocks": [] + }, + { + "clientId": "_clientId_1", + "name": "core/image", + "isValid": true, + "attributes": { "url": "data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=", "alt": "title", - "id": "2", - "caption": [] - } - ], - "ids": [], - "columns": 2, - "imageCrop": true, - "linkTo": "none", - "align": "wide" - }, - "innerBlocks": [], + "caption": [], + "id": 2, + "linkDestination": "none" + }, + "innerBlocks": [] + } + ], "originalContent": "<ul class=\"wp-block-gallery columns-2 is-cropped alignwide\">\n\t<li class=\"blocks-gallery-item\">\n\t\t<figure>\n\t\t\t<img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==\" data-id=\"1\" alt=\"title\" class=\"wp-image-1\" />\n\t\t</figure>\n\t</li>\n\t<li class=\"blocks-gallery-item\">\n\t\t<figure>\n\t\t\t<img src=\"data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=\" data-id=\"2\" alt=\"title\" class=\"wp-image-2\" />\n\t\t</figure>\n\t</li>\n</ul>" } ] diff --git a/test/integration/fixtures/blocks/core__gallery__deprecated-2.serialized.html b/test/integration/fixtures/blocks/core__gallery__deprecated-2.serialized.html index bd177026c8c5bf..71cbb585361403 100644 --- a/test/integration/fixtures/blocks/core__gallery__deprecated-2.serialized.html +++ b/test/integration/fixtures/blocks/core__gallery__deprecated-2.serialized.html @@ -1,3 +1,9 @@ -<!-- wp:gallery {"ids":[],"columns":2,"linkTo":"none","align":"wide"} --> -<figure class="wp-block-gallery alignwide columns-2 is-cropped"><ul class="blocks-gallery-grid"><li class="blocks-gallery-item"><figure><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==" alt="title" data-id="1" class="wp-image-1"/></figure></li><li class="blocks-gallery-item"><figure><img src="data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=" alt="title" data-id="2" class="wp-image-2"/></figure></li></ul></figure> +<!-- wp:gallery {"columns":2,"linkTo":"none"} --> +<figure class="wp-block-gallery has-nested-images columns-2 is-cropped"><!-- wp:image {"id":1,"linkDestination":"none"} --> +<figure class="wp-block-image"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==" alt="title" class="wp-image-1"/></figure> +<!-- /wp:image --> + +<!-- wp:image {"id":2,"linkDestination":"none"} --> +<figure class="wp-block-image"><img src="data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=" alt="title" class="wp-image-2"/></figure> +<!-- /wp:image --></figure> <!-- /wp:gallery --> diff --git a/test/integration/fixtures/blocks/core__gallery__deprecated-3.json b/test/integration/fixtures/blocks/core__gallery__deprecated-3.json index 81357c8b33aa01..ffca81e1f45e3f 100644 --- a/test/integration/fixtures/blocks/core__gallery__deprecated-3.json +++ b/test/integration/fixtures/blocks/core__gallery__deprecated-3.json @@ -4,24 +4,36 @@ "name": "core/gallery", "isValid": true, "attributes": { - "images": [ - { + "imageCrop": true, + "linkTo": "none", + "allowResize": false + }, + "innerBlocks": [ + { + "clientId": "_clientId_0", + "name": "core/image", + "isValid": true, + "attributes": { "url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==", "alt": "title", - "caption": [] + "caption": [], + "linkDestination": "none" }, - { + "innerBlocks": [] + }, + { + "clientId": "_clientId_1", + "name": "core/image", + "isValid": true, + "attributes": { "url": "data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=", "alt": "title", - "caption": [] - } - ], - "ids": [ null, null ], - "imageCrop": true, - "linkTo": "none", - "align": "wide" - }, - "innerBlocks": [], + "caption": [], + "linkDestination": "none" + }, + "innerBlocks": [] + } + ], "originalContent": "<ul class=\"wp-block-gallery columns-2 is-cropped alignwide\">\n\t<li class=\"blocks-gallery-item\">\n\t\t<figure>\n\t\t\t<img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==\" alt=\"title\" />\n\t\t</figure>\n\t</li>\n\t<li class=\"blocks-gallery-item\">\n\t\t<figure>\n\t\t\t<img src=\"data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=\" alt=\"title\" />\n\t\t</figure>\n\t</li>\n</ul>" } ] diff --git a/test/integration/fixtures/blocks/core__gallery__deprecated-3.serialized.html b/test/integration/fixtures/blocks/core__gallery__deprecated-3.serialized.html index 0fc203739e6dbd..3be73e557dbda5 100644 --- a/test/integration/fixtures/blocks/core__gallery__deprecated-3.serialized.html +++ b/test/integration/fixtures/blocks/core__gallery__deprecated-3.serialized.html @@ -1,3 +1,9 @@ -<!-- wp:gallery {"ids":[null,null],"linkTo":"none","align":"wide"} --> -<figure class="wp-block-gallery alignwide columns-2 is-cropped"><ul class="blocks-gallery-grid"><li class="blocks-gallery-item"><figure><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==" alt="title"/></figure></li><li class="blocks-gallery-item"><figure><img src="data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=" alt="title"/></figure></li></ul></figure> +<!-- wp:gallery {"linkTo":"none"} --> +<figure class="wp-block-gallery has-nested-images columns-default is-cropped"><!-- wp:image {"linkDestination":"none"} --> +<figure class="wp-block-image"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==" alt="title"/></figure> +<!-- /wp:image --> + +<!-- wp:image {"linkDestination":"none"} --> +<figure class="wp-block-image"><img src="data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=" alt="title"/></figure> +<!-- /wp:image --></figure> <!-- /wp:gallery --> diff --git a/test/integration/fixtures/blocks/core__gallery__deprecated-4.json b/test/integration/fixtures/blocks/core__gallery__deprecated-4.json index d62d125dc2ea6a..bb566f74f6e005 100644 --- a/test/integration/fixtures/blocks/core__gallery__deprecated-4.json +++ b/test/integration/fixtures/blocks/core__gallery__deprecated-4.json @@ -4,33 +4,52 @@ "name": "core/gallery", "isValid": true, "attributes": { - "images": [ - { + "caption": "", + "imageCrop": true, + "linkTo": "none", + "allowResize": false + }, + "innerBlocks": [ + { + "clientId": "_clientId_0", + "name": "core/image", + "isValid": true, + "attributes": { "url": "https://sergioestevaofolio.files.wordpress.com/2016/09/cropped-img_9054-1.jpg?w=190", "alt": "", - "id": "1421", - "caption": "" + "caption": "", + "id": 1421, + "linkDestination": "none" }, - { + "innerBlocks": [] + }, + { + "clientId": "_clientId_1", + "name": "core/image", + "isValid": true, + "attributes": { "url": "https://sergioestevaofolio.files.wordpress.com/2017/09/cropped-l1001498-1.jpg?w=580", "alt": "", - "id": "1440", - "caption": "" + "caption": "", + "id": 1440, + "linkDestination": "none" }, - { + "innerBlocks": [] + }, + { + "clientId": "_clientId_2", + "name": "core/image", + "isValid": true, + "attributes": { "url": "https://sergioestevaofolio.files.wordpress.com/2017/05/cropped-l1005945-2-2.jpg?w=580", "alt": "", - "id": "1362", - "caption": "" - } - ], - "ids": [ 1421, 1440, 1362 ], - "caption": "", - "imageCrop": true, - "linkTo": "none", - "align": "wide" - }, - "innerBlocks": [], + "caption": "", + "id": 1362, + "linkDestination": "none" + }, + "innerBlocks": [] + } + ], "originalContent": "<figure class=\"wp-block-gallery columns-3 is-cropped alignwide\">\n\t<ul class=\"blocks-gallery-grid\">\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<img src=\"https://sergioestevaofolio.files.wordpress.com/2016/09/cropped-img_9054-1.jpg?w=190\" alt=\"\" data-id=\"1421\" class=\"wp-image-1421\"/>\n\t\t\t</figure>\n\t\t</li>\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<img src=\"https://sergioestevaofolio.files.wordpress.com/2017/09/cropped-l1001498-1.jpg?w=580\" alt=\"\" data-id=\"1440\" class=\"wp-image-1440\"/>\n\t\t\t</figure>\n\t\t</li>\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<img src=\"https://sergioestevaofolio.files.wordpress.com/2017/05/cropped-l1005945-2-2.jpg?w=580\" alt=\"\" data-id=\"1362\" class=\"wp-image-1362\"/>\n\t\t\t</figure>\n\t\t</li>\n\t</ul>\n</figure>" } ] diff --git a/test/integration/fixtures/blocks/core__gallery__deprecated-4.serialized.html b/test/integration/fixtures/blocks/core__gallery__deprecated-4.serialized.html index e9bf8294c2f7e0..5357a43951dd4d 100644 --- a/test/integration/fixtures/blocks/core__gallery__deprecated-4.serialized.html +++ b/test/integration/fixtures/blocks/core__gallery__deprecated-4.serialized.html @@ -1,3 +1,13 @@ -<!-- wp:gallery {"ids":[1421,1440,1362],"linkTo":"none","align":"wide"} --> -<figure class="wp-block-gallery alignwide columns-3 is-cropped"><ul class="blocks-gallery-grid"><li class="blocks-gallery-item"><figure><img src="https://sergioestevaofolio.files.wordpress.com/2016/09/cropped-img_9054-1.jpg?w=190" alt="" data-id="1421" class="wp-image-1421"/></figure></li><li class="blocks-gallery-item"><figure><img src="https://sergioestevaofolio.files.wordpress.com/2017/09/cropped-l1001498-1.jpg?w=580" alt="" data-id="1440" class="wp-image-1440"/></figure></li><li class="blocks-gallery-item"><figure><img src="https://sergioestevaofolio.files.wordpress.com/2017/05/cropped-l1005945-2-2.jpg?w=580" alt="" data-id="1362" class="wp-image-1362"/></figure></li></ul></figure> +<!-- wp:gallery {"linkTo":"none"} --> +<figure class="wp-block-gallery has-nested-images columns-default is-cropped"><!-- wp:image {"id":1421,"linkDestination":"none"} --> +<figure class="wp-block-image"><img src="https://sergioestevaofolio.files.wordpress.com/2016/09/cropped-img_9054-1.jpg?w=190" alt="" class="wp-image-1421"/></figure> +<!-- /wp:image --> + +<!-- wp:image {"id":1440,"linkDestination":"none"} --> +<figure class="wp-block-image"><img src="https://sergioestevaofolio.files.wordpress.com/2017/09/cropped-l1001498-1.jpg?w=580" alt="" class="wp-image-1440"/></figure> +<!-- /wp:image --> + +<!-- wp:image {"id":1362,"linkDestination":"none"} --> +<figure class="wp-block-image"><img src="https://sergioestevaofolio.files.wordpress.com/2017/05/cropped-l1005945-2-2.jpg?w=580" alt="" class="wp-image-1362"/></figure> +<!-- /wp:image --></figure> <!-- /wp:gallery --> diff --git a/test/integration/fixtures/blocks/core__gallery__deprecated-5.json b/test/integration/fixtures/blocks/core__gallery__deprecated-5.json index 66d6c1d8ac0216..7a1021f6c8f59e 100644 --- a/test/integration/fixtures/blocks/core__gallery__deprecated-5.json +++ b/test/integration/fixtures/blocks/core__gallery__deprecated-5.json @@ -4,39 +4,59 @@ "name": "core/gallery", "isValid": true, "attributes": { - "images": [ - { + "caption": "", + "imageCrop": true, + "linkTo": "media", + "sizeSlug": "large", + "allowResize": false + }, + "innerBlocks": [ + { + "clientId": "_clientId_0", + "name": "core/image", + "isValid": true, + "attributes": { "url": "http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-682x1024.jpg", - "fullUrl": "http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-scaled.jpg", - "link": "http://wptest.local/classic/test-image-3/", "alt": "", - "id": "705", - "caption": "" + "caption": "", + "href": "http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-682x1024.jpg", + "id": 705, + "sizeSlug": "large", + "linkDestination": "media" }, - { + "innerBlocks": [] + }, + { + "clientId": "_clientId_1", + "name": "core/image", + "isValid": true, + "attributes": { "url": "http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1024x682.jpg", - "fullUrl": "http://wptest.local/wp-content/uploads/2020/09/test-image-edited-scaled.jpg", - "link": "http://wptest.local/test-image-2/", "alt": "", - "id": "704", - "caption": "" + "caption": "", + "href": "http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1024x682.jpg", + "id": 704, + "sizeSlug": "large", + "linkDestination": "media" }, - { + "innerBlocks": [] + }, + { + "clientId": "_clientId_2", + "name": "core/image", + "isValid": true, + "attributes": { "url": "http://wptest.local/wp-content/uploads/2020/04/test-image-1024x683.jpg", - "fullUrl": "http://wptest.local/wp-content/uploads/2020/04/test-image-scaled.jpg", - "link": "http://wptest.local/test-image/", "alt": "", - "id": "703", - "caption": "" - } - ], - "ids": [ 705, 704, 703 ], - "caption": "", - "imageCrop": true, - "linkTo": "file", - "sizeSlug": "large" - }, - "innerBlocks": [], + "caption": "", + "href": "http://wptest.local/wp-content/uploads/2020/04/test-image-1024x683.jpg", + "id": 703, + "sizeSlug": "large", + "linkDestination": "media" + }, + "innerBlocks": [] + } + ], "originalContent": "<figure class=\"wp-block-gallery columns-3 is-cropped\">\n\t<ul class=\"blocks-gallery-grid\">\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<a href=\"http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-scaled.jpg\" >\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc=\"http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-682x1024.jpg\"\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\tdata-id=\"705\"\n\t\t\t\t\t\tdata-full-url=\"http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-scaled.jpg\"\n\t\t\t\t\t\tdata-link=\"http://wptest.local/classic/test-image-3/\"\n\t\t\t\t\t\tclass=\"wp-image-705\"\n\t\t\t\t\t/>\n\t\t\t\t</a>\n\t\t\t</figure>\n\t\t</li>\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<a href=\"http://wptest.local/wp-content/uploads/2020/09/test-image-edited-scaled.jpg\" >\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc=\"http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1024x682.jpg\"\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\tdata-id=\"704\"\n\t\t\t\t\t\tdata-full-url=\"http://wptest.local/wp-content/uploads/2020/09/test-image-edited-scaled.jpg\"\n\t\t\t\t\t\tdata-link=\"http://wptest.local/test-image-2/\"\n\t\t\t\t\t\tclass=\"wp-image-704\"\n\t\t\t\t\t/>\n\t\t\t\t</a>\n\t\t\t</figure>\n\t\t</li>\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<a href=\"http://wptest.local/wp-content/uploads/2020/04/test-image-scaled.jpg\" >\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc=\"http://wptest.local/wp-content/uploads/2020/04/test-image-1024x683.jpg\"\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\tdata-id=\"703\"\n\t\t\t\t\t\tdata-full-url=\"http://wptest.local/wp-content/uploads/2020/04/test-image-scaled.jpg\"\n\t\t\t\t\t\tdata-link=\"http://wptest.local/test-image/\"\n\t\t\t\t\t\tclass=\"wp-image-703\"\n\t\t\t\t\t/>\n\t\t\t\t</a>\n\t\t\t</figure>\n\t\t</li>\n\t</ul>\n</figure>" } ] diff --git a/test/integration/fixtures/blocks/core__gallery__deprecated-5.serialized.html b/test/integration/fixtures/blocks/core__gallery__deprecated-5.serialized.html index f3afe00b34a31c..74fb0a124f8d7a 100644 --- a/test/integration/fixtures/blocks/core__gallery__deprecated-5.serialized.html +++ b/test/integration/fixtures/blocks/core__gallery__deprecated-5.serialized.html @@ -1,3 +1,13 @@ -<!-- wp:gallery {"ids":[705,704,703],"linkTo":"file"} --> -<figure class="wp-block-gallery columns-3 is-cropped"><ul class="blocks-gallery-grid"><li class="blocks-gallery-item"><figure><a href="http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-scaled.jpg"><img src="http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-682x1024.jpg" alt="" data-id="705" data-full-url="http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-scaled.jpg" data-link="http://wptest.local/classic/test-image-3/" class="wp-image-705"/></a></figure></li><li class="blocks-gallery-item"><figure><a href="http://wptest.local/wp-content/uploads/2020/09/test-image-edited-scaled.jpg"><img src="http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1024x682.jpg" alt="" data-id="704" data-full-url="http://wptest.local/wp-content/uploads/2020/09/test-image-edited-scaled.jpg" data-link="http://wptest.local/test-image-2/" class="wp-image-704"/></a></figure></li><li class="blocks-gallery-item"><figure><a href="http://wptest.local/wp-content/uploads/2020/04/test-image-scaled.jpg"><img src="http://wptest.local/wp-content/uploads/2020/04/test-image-1024x683.jpg" alt="" data-id="703" data-full-url="http://wptest.local/wp-content/uploads/2020/04/test-image-scaled.jpg" data-link="http://wptest.local/test-image/" class="wp-image-703"/></a></figure></li></ul></figure> +<!-- wp:gallery {"linkTo":"media"} --> +<figure class="wp-block-gallery has-nested-images columns-default is-cropped"><!-- wp:image {"id":705,"sizeSlug":"large","linkDestination":"media"} --> +<figure class="wp-block-image size-large"><a href="http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-682x1024.jpg"><img src="http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-682x1024.jpg" alt="" class="wp-image-705"/></a></figure> +<!-- /wp:image --> + +<!-- wp:image {"id":704,"sizeSlug":"large","linkDestination":"media"} --> +<figure class="wp-block-image size-large"><a href="http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1024x682.jpg"><img src="http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1024x682.jpg" alt="" class="wp-image-704"/></a></figure> +<!-- /wp:image --> + +<!-- wp:image {"id":703,"sizeSlug":"large","linkDestination":"media"} --> +<figure class="wp-block-image size-large"><a href="http://wptest.local/wp-content/uploads/2020/04/test-image-1024x683.jpg"><img src="http://wptest.local/wp-content/uploads/2020/04/test-image-1024x683.jpg" alt="" class="wp-image-703"/></a></figure> +<!-- /wp:image --></figure> <!-- /wp:gallery --> diff --git a/test/integration/fixtures/blocks/core__gallery__deprecated-6.html b/test/integration/fixtures/blocks/core__gallery__deprecated-6.html new file mode 100644 index 00000000000000..0dcf6042334353 --- /dev/null +++ b/test/integration/fixtures/blocks/core__gallery__deprecated-6.html @@ -0,0 +1,54 @@ +<!-- wp:gallery {"ids":[705,704,703],"linkTo":"media"} --> +<figure class="wp-block-gallery columns-3 is-cropped"> + <ul class="blocks-gallery-grid"> + <li class="blocks-gallery-item"> + <figure> + <a + href="http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-scaled.jpg" + > + <img + src="http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-682x1024.jpg" + alt="" + data-id="705" + data-full-url="http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-scaled.jpg" + data-link="http://wptest.local/classic/test-image-3/" + class="wp-image-705" + /> + </a> + </figure> + </li> + <li class="blocks-gallery-item"> + <figure> + <a + href="http://wptest.local/wp-content/uploads/2020/09/test-image-edited-scaled.jpg" + > + <img + src="http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1024x682.jpg" + alt="" + data-id="704" + data-full-url="http://wptest.local/wp-content/uploads/2020/09/test-image-edited-scaled.jpg" + data-link="http://wptest.local/test-image-2/" + class="wp-image-704" + /> + </a> + </figure> + </li> + <li class="blocks-gallery-item"> + <figure> + <a + href="http://wptest.local/wp-content/uploads/2020/04/test-image-scaled.jpg" + > + <img + src="http://wptest.local/wp-content/uploads/2020/04/test-image-1024x683.jpg" + alt="" + data-id="703" + data-full-url="http://wptest.local/wp-content/uploads/2020/04/test-image-scaled.jpg" + data-link="http://wptest.local/test-image/" + class="wp-image-703" + /> + </a> + </figure> + </li> + </ul> +</figure> +<!-- /wp:gallery --> diff --git a/test/integration/fixtures/blocks/core__gallery__deprecated-6.json b/test/integration/fixtures/blocks/core__gallery__deprecated-6.json new file mode 100644 index 00000000000000..a9d2a3d393a969 --- /dev/null +++ b/test/integration/fixtures/blocks/core__gallery__deprecated-6.json @@ -0,0 +1,62 @@ +[ + { + "clientId": "_clientId_0", + "name": "core/gallery", + "isValid": true, + "attributes": { + "caption": "", + "imageCrop": true, + "linkTo": "media", + "sizeSlug": "large", + "allowResize": false + }, + "innerBlocks": [ + { + "clientId": "_clientId_0", + "name": "core/image", + "isValid": true, + "attributes": { + "url": "http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-682x1024.jpg", + "alt": "", + "caption": "", + "href": "http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-682x1024.jpg", + "id": 705, + "sizeSlug": "large", + "linkDestination": "media" + }, + "innerBlocks": [] + }, + { + "clientId": "_clientId_1", + "name": "core/image", + "isValid": true, + "attributes": { + "url": "http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1024x682.jpg", + "alt": "", + "caption": "", + "href": "http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1024x682.jpg", + "id": 704, + "sizeSlug": "large", + "linkDestination": "media" + }, + "innerBlocks": [] + }, + { + "clientId": "_clientId_2", + "name": "core/image", + "isValid": true, + "attributes": { + "url": "http://wptest.local/wp-content/uploads/2020/04/test-image-1024x683.jpg", + "alt": "", + "caption": "", + "href": "http://wptest.local/wp-content/uploads/2020/04/test-image-1024x683.jpg", + "id": 703, + "sizeSlug": "large", + "linkDestination": "media" + }, + "innerBlocks": [] + } + ], + "originalContent": "<figure class=\"wp-block-gallery columns-3 is-cropped\">\n\t<ul class=\"blocks-gallery-grid\">\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<a\n\t\t\t\t\thref=\"http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-scaled.jpg\"\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc=\"http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-682x1024.jpg\"\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\tdata-id=\"705\"\n\t\t\t\t\t\tdata-full-url=\"http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-scaled.jpg\"\n\t\t\t\t\t\tdata-link=\"http://wptest.local/classic/test-image-3/\"\n\t\t\t\t\t\tclass=\"wp-image-705\"\n\t\t\t\t\t/>\n\t\t\t\t</a>\n\t\t\t</figure>\n\t\t</li>\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<a\n\t\t\t\t\thref=\"http://wptest.local/wp-content/uploads/2020/09/test-image-edited-scaled.jpg\"\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc=\"http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1024x682.jpg\"\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\tdata-id=\"704\"\n\t\t\t\t\t\tdata-full-url=\"http://wptest.local/wp-content/uploads/2020/09/test-image-edited-scaled.jpg\"\n\t\t\t\t\t\tdata-link=\"http://wptest.local/test-image-2/\"\n\t\t\t\t\t\tclass=\"wp-image-704\"\n\t\t\t\t\t/>\n\t\t\t\t</a>\n\t\t\t</figure>\n\t\t</li>\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<a\n\t\t\t\t\thref=\"http://wptest.local/wp-content/uploads/2020/04/test-image-scaled.jpg\"\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc=\"http://wptest.local/wp-content/uploads/2020/04/test-image-1024x683.jpg\"\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\tdata-id=\"703\"\n\t\t\t\t\t\tdata-full-url=\"http://wptest.local/wp-content/uploads/2020/04/test-image-scaled.jpg\"\n\t\t\t\t\t\tdata-link=\"http://wptest.local/test-image/\"\n\t\t\t\t\t\tclass=\"wp-image-703\"\n\t\t\t\t\t/>\n\t\t\t\t</a>\n\t\t\t</figure>\n\t\t</li>\n\t</ul>\n</figure>" + } +] diff --git a/test/integration/fixtures/blocks/core__gallery__deprecated-6.parsed.json b/test/integration/fixtures/blocks/core__gallery__deprecated-6.parsed.json new file mode 100644 index 00000000000000..72b400f283adfd --- /dev/null +++ b/test/integration/fixtures/blocks/core__gallery__deprecated-6.parsed.json @@ -0,0 +1,14 @@ +[ + { + "blockName": "core/gallery", + "attrs": { + "ids": [ 705, 704, 703 ], + "linkTo": "media" + }, + "innerBlocks": [], + "innerHTML": "\n<figure class=\"wp-block-gallery columns-3 is-cropped\">\n\t<ul class=\"blocks-gallery-grid\">\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<a\n\t\t\t\t\thref=\"http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-scaled.jpg\"\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc=\"http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-682x1024.jpg\"\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\tdata-id=\"705\"\n\t\t\t\t\t\tdata-full-url=\"http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-scaled.jpg\"\n\t\t\t\t\t\tdata-link=\"http://wptest.local/classic/test-image-3/\"\n\t\t\t\t\t\tclass=\"wp-image-705\"\n\t\t\t\t\t/>\n\t\t\t\t</a>\n\t\t\t</figure>\n\t\t</li>\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<a\n\t\t\t\t\thref=\"http://wptest.local/wp-content/uploads/2020/09/test-image-edited-scaled.jpg\"\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc=\"http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1024x682.jpg\"\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\tdata-id=\"704\"\n\t\t\t\t\t\tdata-full-url=\"http://wptest.local/wp-content/uploads/2020/09/test-image-edited-scaled.jpg\"\n\t\t\t\t\t\tdata-link=\"http://wptest.local/test-image-2/\"\n\t\t\t\t\t\tclass=\"wp-image-704\"\n\t\t\t\t\t/>\n\t\t\t\t</a>\n\t\t\t</figure>\n\t\t</li>\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<a\n\t\t\t\t\thref=\"http://wptest.local/wp-content/uploads/2020/04/test-image-scaled.jpg\"\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc=\"http://wptest.local/wp-content/uploads/2020/04/test-image-1024x683.jpg\"\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\tdata-id=\"703\"\n\t\t\t\t\t\tdata-full-url=\"http://wptest.local/wp-content/uploads/2020/04/test-image-scaled.jpg\"\n\t\t\t\t\t\tdata-link=\"http://wptest.local/test-image/\"\n\t\t\t\t\t\tclass=\"wp-image-703\"\n\t\t\t\t\t/>\n\t\t\t\t</a>\n\t\t\t</figure>\n\t\t</li>\n\t</ul>\n</figure>\n", + "innerContent": [ + "\n<figure class=\"wp-block-gallery columns-3 is-cropped\">\n\t<ul class=\"blocks-gallery-grid\">\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<a\n\t\t\t\t\thref=\"http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-scaled.jpg\"\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc=\"http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-682x1024.jpg\"\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\tdata-id=\"705\"\n\t\t\t\t\t\tdata-full-url=\"http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-scaled.jpg\"\n\t\t\t\t\t\tdata-link=\"http://wptest.local/classic/test-image-3/\"\n\t\t\t\t\t\tclass=\"wp-image-705\"\n\t\t\t\t\t/>\n\t\t\t\t</a>\n\t\t\t</figure>\n\t\t</li>\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<a\n\t\t\t\t\thref=\"http://wptest.local/wp-content/uploads/2020/09/test-image-edited-scaled.jpg\"\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc=\"http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1024x682.jpg\"\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\tdata-id=\"704\"\n\t\t\t\t\t\tdata-full-url=\"http://wptest.local/wp-content/uploads/2020/09/test-image-edited-scaled.jpg\"\n\t\t\t\t\t\tdata-link=\"http://wptest.local/test-image-2/\"\n\t\t\t\t\t\tclass=\"wp-image-704\"\n\t\t\t\t\t/>\n\t\t\t\t</a>\n\t\t\t</figure>\n\t\t</li>\n\t\t<li class=\"blocks-gallery-item\">\n\t\t\t<figure>\n\t\t\t\t<a\n\t\t\t\t\thref=\"http://wptest.local/wp-content/uploads/2020/04/test-image-scaled.jpg\"\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc=\"http://wptest.local/wp-content/uploads/2020/04/test-image-1024x683.jpg\"\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\tdata-id=\"703\"\n\t\t\t\t\t\tdata-full-url=\"http://wptest.local/wp-content/uploads/2020/04/test-image-scaled.jpg\"\n\t\t\t\t\t\tdata-link=\"http://wptest.local/test-image/\"\n\t\t\t\t\t\tclass=\"wp-image-703\"\n\t\t\t\t\t/>\n\t\t\t\t</a>\n\t\t\t</figure>\n\t\t</li>\n\t</ul>\n</figure>\n" + ] + } +] diff --git a/test/integration/fixtures/blocks/core__gallery__deprecated-6.serialized.html b/test/integration/fixtures/blocks/core__gallery__deprecated-6.serialized.html new file mode 100644 index 00000000000000..74fb0a124f8d7a --- /dev/null +++ b/test/integration/fixtures/blocks/core__gallery__deprecated-6.serialized.html @@ -0,0 +1,13 @@ +<!-- wp:gallery {"linkTo":"media"} --> +<figure class="wp-block-gallery has-nested-images columns-default is-cropped"><!-- wp:image {"id":705,"sizeSlug":"large","linkDestination":"media"} --> +<figure class="wp-block-image size-large"><a href="http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-682x1024.jpg"><img src="http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1-682x1024.jpg" alt="" class="wp-image-705"/></a></figure> +<!-- /wp:image --> + +<!-- wp:image {"id":704,"sizeSlug":"large","linkDestination":"media"} --> +<figure class="wp-block-image size-large"><a href="http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1024x682.jpg"><img src="http://wptest.local/wp-content/uploads/2020/09/test-image-edited-1024x682.jpg" alt="" class="wp-image-704"/></a></figure> +<!-- /wp:image --> + +<!-- wp:image {"id":703,"sizeSlug":"large","linkDestination":"media"} --> +<figure class="wp-block-image size-large"><a href="http://wptest.local/wp-content/uploads/2020/04/test-image-1024x683.jpg"><img src="http://wptest.local/wp-content/uploads/2020/04/test-image-1024x683.jpg" alt="" class="wp-image-703"/></a></figure> +<!-- /wp:image --></figure> +<!-- /wp:gallery --> diff --git a/test/integration/fixtures/documents/shortcode-matching-out.html b/test/integration/fixtures/documents/shortcode-matching-out.html index 30a0e0679656be..3930f3ff885fef 100644 --- a/test/integration/fixtures/documents/shortcode-matching-out.html +++ b/test/integration/fixtures/documents/shortcode-matching-out.html @@ -1,7 +1,7 @@ <!-- wp:test/gallery {"ids":[40,41,42]} /--> -<!-- wp:gallery {"ids":[1000],"columns":3,"linkTo":"post"} --> -<figure class="wp-block-gallery columns-3 is-cropped"><ul class="blocks-gallery-grid"><li class="blocks-gallery-item"><figure><img data-id="1000" class="wp-image-1000"/></figure></li></ul></figure> +<!-- wp:gallery {"shortCodeTransforms":[{"id":1000}],"columns":3,"linkTo":"none"} --> +<figure class="wp-block-gallery has-nested-images columns-3 is-cropped"></figure> <!-- /wp:gallery --> <!-- wp:test/gallery {"ids":[42]} /--> diff --git a/test/integration/fixtures/documents/wordpress-out.html b/test/integration/fixtures/documents/wordpress-out.html index 159244b27659dd..42087da595b2a6 100644 --- a/test/integration/fixtures/documents/wordpress-out.html +++ b/test/integration/fixtures/documents/wordpress-out.html @@ -18,8 +18,8 @@ <h3>More tag</h3> <h3>Shortcode</h3> <!-- /wp:heading --> -<!-- wp:gallery {"ids":[1],"columns":3,"linkTo":"post"} --> -<figure class="wp-block-gallery columns-3 is-cropped"><ul class="blocks-gallery-grid"><li class="blocks-gallery-item"><figure><img data-id="1" class="wp-image-1"/></figure></li></ul></figure> +<!-- wp:gallery {"shortCodeTransforms":[{"id":1}],"columns":3,"linkTo":"none"} --> +<figure class="wp-block-gallery has-nested-images columns-3 is-cropped"></figure> <!-- /wp:gallery --> <!-- wp:image {"id":5114} --> diff --git a/test/unit/config/global-mocks.js b/test/unit/config/global-mocks.js index 0398af83c3a0b3..29ca4ce94d4a6a 100644 --- a/test/unit/config/global-mocks.js +++ b/test/unit/config/global-mocks.js @@ -9,3 +9,16 @@ jest.mock( '@wordpress/compose', () => { ] ), }; } ); + +/** + * The new gallery block format is not compatible with the use_BalanceTags option + * so a flag is set in lib/compat.php to allow disabling the new block in this instance. + * This flag needs to be mocked here to ensure tests and fixtures run with the v2 + * version of the Gallery block enabled. + * + * Note: This should be removed when the minimum required WP version is >= 5.9. + * + */ +if ( ! window.wp?.galleryBlockV2Enabled ) { + window.wp = { ...window.wp, galleryBlockV2Enabled: true }; +}