Skip to content

Commit

Permalink
Merge branch 'trunk' of github.com:WordPress/gutenberg into fix/issue…
Browse files Browse the repository at this point in the history
…-62544
  • Loading branch information
amitraj2203 committed Jun 19, 2024
2 parents aae8bdc + 17ecaa6 commit a6e2ba6
Show file tree
Hide file tree
Showing 17 changed files with 169 additions and 18 deletions.
2 changes: 1 addition & 1 deletion docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ Summarize your post with a list of headings. Add HTML anchors to Heading blocks

- **Name:** core/table-of-contents
- **Experimental:** true
- **Category:** layout
- **Category:** design
- **Supports:** color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~
- **Attributes:** headings, onlyIncludeCurrentPage

Expand Down
11 changes: 7 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@
"patch-package": "8.0.0",
"postcss": "8.4.16",
"postcss-loader": "6.2.1",
"postcss-local-keyframes": "^0.0.2",
"prettier": "npm:wp-prettier@3.0.3",
"progress": "2.0.3",
"react": "18.3.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ In this example, we're instantiating a block editor. A block editor is composed

Inside `BlockEditorProvider`, you can nest any of the available `@wordpress/block-editor` UI components to build the UI of your editor.

In the example above we're rendering the `BlockList` to show and edit the block list. For instance we could add a custom sidebar and use the `BlockInspector` component to be able to edit the advanced settings for the currently selected block. (See the [API](#API) for the list of all the available components).
In the example above we're rendering the `BlockList` to show and edit the block list. For instance we could add a custom sidebar and use the `BlockInspector` component to be able to edit the advanced settings for the currently selected block. (See the [API](#api) for the list of all the available components).

The `BlockTools` component is used to render the toolbar for a selected block.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ export default function Shuffle( { clientId, as = Container } ) {
pattern.blocks.length === 1 &&
pattern.categories?.some( ( category ) => {
return categories.includes( category );
} )
} ) &&
// Check if the pattern is not a synced pattern.
( pattern.syncStatus === 'unsynced' || ! pattern.id )
);
} );
}, [ categories, patterns ] );
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/table-of-contents/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"__experimental": true,
"name": "core/table-of-contents",
"title": "Table of Contents",
"category": "layout",
"category": "design",
"description": "Summarize your post with a list of headings. Add HTML anchors to Heading blocks to link them here.",
"keywords": [ "document outline", "summary" ],
"textdomain": "default",
Expand Down
17 changes: 16 additions & 1 deletion packages/dataviews/src/dataviews.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ interface DataViewsProps< Item extends AnyItem > {
totalPages: number;
};
supportedLayouts: string[];
selection?: string[];
setSelection?: ( selection: string[] ) => void;
onSelectionChange?: ( items: Item[] ) => void;
}

Expand Down Expand Up @@ -72,9 +74,22 @@ export default function DataViews< Item extends AnyItem >( {
isLoading = false,
paginationInfo,
supportedLayouts,
selection: selectionProperty,
setSelection: setSelectionProperty,
onSelectionChange = defaultOnSelectionChange,
}: DataViewsProps< Item > ) {
const [ selection, setSelection ] = useState< string[] >( [] );
const [ selectionState, setSelectionState ] = useState< string[] >( [] );
let selection, setSelection;
if (
selectionProperty !== undefined &&
setSelectionProperty !== undefined
) {
selection = selectionProperty;
setSelection = setSelectionProperty;
} else {
selection = selectionState;
setSelection = setSelectionState;
}
const [ openedFilter, setOpenedFilter ] = useState< string | null >( null );

useEffect( () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/dataviews/src/view-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ export default function ViewList< Item extends AnyItem >(
} = props;
const baseId = useInstanceId( ViewList, 'view-list' );
const selectedItem = data?.findLast( ( item ) =>
selection.includes( item.id )
selection.includes( getItemId( item ) )
);

const mediaField = fields.find(
Expand Down
30 changes: 30 additions & 0 deletions packages/edit-site/lib/inflate.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
/**
* Credits:
*
* lib-font
* https://github.com/Pomax/lib-font
* https://github.com/Pomax/lib-font/blob/master/lib/inflate.js
*
* The MIT License (MIT)
*
* Copyright (c) 2020 pomax@nihongoresources.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

/* eslint eslint-comments/no-unlimited-disable: 0 */
/* eslint-disable */
/* pako 1.0.10 nodeca/pako */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.pako = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
Expand Down
30 changes: 30 additions & 0 deletions packages/edit-site/lib/lib-font.browser.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
/**
* Credits:
*
* lib-font
* https://github.com/Pomax/lib-font
* https://github.com/Pomax/lib-font/blob/master/lib-font.browser.js
*
* The MIT License (MIT)
*
* Copyright (c) 2020 pomax@nihongoresources.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

/* eslint eslint-comments/no-unlimited-disable: 0 */
/* eslint-disable */
// import pako from 'pako';
Expand Down
30 changes: 30 additions & 0 deletions packages/edit-site/lib/unbrotli.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
/**
* Credits:
*
* lib-font
* https://github.com/Pomax/lib-font
* https://github.com/Pomax/lib-font/blob/master/lib/unbrotli.js
*
* The MIT License (MIT)
*
* Copyright (c) 2020 pomax@nihongoresources.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

/* eslint eslint-comments/no-unlimited-disable: 0 */
/* eslint-disable */
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.unbrotli = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
Expand Down
38 changes: 38 additions & 0 deletions packages/edit-site/src/components/page-pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,44 @@ function FeaturedImage( { item, viewType } ) {
);
}

function usePostIdLinkInSelection(
selection,
setSelection,
isLoadingItems,
items
) {
const {
params: { postId },
} = useLocation();
const [ postIdToSelect, setPostIdToSelect ] = useState( postId );
useEffect( () => {
if ( postId ) {
setPostIdToSelect( postId );
}
}, [ postId ] );

useEffect( () => {
if ( ! postIdToSelect ) {
return;
}
// Only try to select an item if the loading is complete and we have items.
if ( ! isLoadingItems && items && items.length ) {
// If the item is not in the current selection, select it.
if ( selection.length !== 1 || selection[ 0 ] !== postIdToSelect ) {
setSelection( [ postIdToSelect ] );
}
setPostIdToSelect( undefined );
}
}, [ postIdToSelect, selection, setSelection, isLoadingItems, items ] );
}

export default function PagePages() {
const postType = 'page';
const [ view, setView ] = useView( postType );
const history = useHistory();

const [ selection, setSelection ] = useState( [] );

const onSelectionChange = useCallback(
( items ) => {
const { params } = history.getLocationWithParams();
Expand Down Expand Up @@ -266,6 +299,8 @@ export default function PagePages() {
totalPages,
} = useEntityRecords( 'postType', postType, queryArgs );

usePostIdLinkInSelection( selection, setSelection, isLoadingPages, pages );

const { records: authors, isResolving: isLoadingAuthors } =
useEntityRecords( 'root', 'user', { per_page: -1 } );

Expand Down Expand Up @@ -531,7 +566,10 @@ export default function PagePages() {
isLoading={ isLoadingPages || isLoadingAuthors }
view={ view }
onChangeView={ onChangeView }
selection={ selection }
setSelection={ setSelection }
onSelectionChange={ onSelectionChange }
getItemId={ ( item ) => item.id.toString() }
/>
</Page>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-aztec/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wordpress/react-native-aztec",
"version": "1.120.0",
"version": "1.120.1",
"description": "Aztec view for react-native.",
"private": true,
"author": "The WordPress Contributors",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-bridge/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wordpress/react-native-bridge",
"version": "1.120.0",
"version": "1.120.1",
"description": "Native bridge library used to integrate the block editor into a native App.",
"private": true,
"author": "The WordPress Contributors",
Expand Down
4 changes: 3 additions & 1 deletion packages/react-native-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ For each user feature we should also add a importance categorization label to i
## Unreleased
- [internal] Fix Inserter items list filtering [#62334]
- [*] Prevent hiding the keyboard when creating new list items [#62446]
- [*] RichText - Fix undefined onDelete callback [#62486]
- [*] Fix issue when pasting HTML content [#62588]

## 1.120.1
- [*] RichText - Fix undefined onDelete callback [#62486]

## 1.120.0
- [*] Prevent deleting content when backspacing in the first Paragraph block [#62069]
- [internal] Adds new bridge functionality for updating content [#61796]
Expand Down
8 changes: 4 additions & 4 deletions packages/react-native-editor/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PODS:
- ReactCommon/turbomodule/core (= 0.73.3)
- fmt (6.2.1)
- glog (0.3.5)
- Gutenberg (1.120.0):
- Gutenberg (1.120.1):
- React-Core (= 0.73.3)
- React-CoreModules (= 0.73.3)
- React-RCTImage (= 0.73.3)
Expand Down Expand Up @@ -1109,7 +1109,7 @@ PODS:
- React-Core
- RNSVG (14.0.0):
- React-Core
- RNTAztecView (1.120.0):
- RNTAztecView (1.120.1):
- React-Core
- WordPress-Aztec-iOS (= 1.19.11)
- SDWebImage (5.11.1):
Expand Down Expand Up @@ -1343,7 +1343,7 @@ SPEC CHECKSUMS:
FBReactNativeSpec: 73b3972e2bd20b3235ff2014f06a3d3af675ed29
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2
Gutenberg: 0d15c3a0b8aace231a954709a536580d7905c867
Gutenberg: 1f3141594d15fc34e121ae5921676a49332e9009
hermes-engine: 5420539d016f368cd27e008f65f777abd6098c56
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
libwebp: 60305b2e989864154bd9be3d772730f08fc6a59c
Expand Down Expand Up @@ -1402,7 +1402,7 @@ SPEC CHECKSUMS:
RNReanimated: 6936b41d8afb97175e7c0ab40425b53103f71046
RNScreens: 2b73f5eb2ac5d94fbd61fa4be0bfebd345716825
RNSVG: 255767813dac22db1ec2062c8b7e7b856d4e5ae6
RNTAztecView: 3a1df2dd827082d22a4dd06b6031e2fefd2885c6
RNTAztecView: e7495baad7608c5e7e9e9a43ee537282dae7ccdc
SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d
SDWebImageWebPCoder: 908b83b6adda48effe7667cd2b7f78c897e5111d
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-editor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wordpress/react-native-editor",
"version": "1.120.0",
"version": "1.120.1",
"description": "Mobile WordPress gutenberg editor.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
Expand Down

0 comments on commit a6e2ba6

Please sign in to comment.