Skip to content

Commit

Permalink
prep build 11/01
Browse files Browse the repository at this point in the history
  • Loading branch information
bph committed Nov 1, 2024
2 parents 7dbc3b3 + 77122c5 commit 466d82d
Show file tree
Hide file tree
Showing 48 changed files with 729 additions and 364 deletions.
3 changes: 3 additions & 0 deletions backport-changelog/6.8/7695.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/7695

* https://github.com/WordPress/gutenberg/pull/66631
3 changes: 3 additions & 0 deletions backport-changelog/6.8/7697.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/7697

* https://github.com/WordPress/gutenberg/pull/66656
4 changes: 4 additions & 0 deletions docs/reference-guides/data/data-core-edit-post.md
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,10 @@ _Parameters_

- _feature_ `string`: Feature name.

### toggleFullscreenMode

Action that toggles the Fullscreen Mode view option.

### togglePinnedPluginItem

Triggers an action object used to toggle a plugin name flag.
Expand Down
13 changes: 13 additions & 0 deletions docs/reference-guides/data/data-core-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,11 @@ _Related_
Action that toggles Distraction free mode. Distraction free mode expects there are no sidebars, as due to the z-index values set, you can't close sidebars.
_Parameters_
- _options_ `[Object]`: Optional configuration object
- _options.createNotice_ `[boolean]`: Whether to create a notice
### toggleEditorPanelEnabled
Returns an action object used to enable or disable a panel in the editor.
Expand Down Expand Up @@ -1619,6 +1624,14 @@ _Related_
- toggleSelection in core/block-editor store.
### toggleSpotlightMode
Action that toggles the Spotlight Mode view option.
### toggleTopToolbar
Action that toggles the Top Toolbar view option.
### trashPost
Action for trashing the current post in the editor.
Expand Down
4 changes: 4 additions & 0 deletions lib/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -3297,6 +3297,10 @@ public function merge( $incoming ) {
array(),
array( 'include_node_paths_only' => true )
);

// Add top-level styles.
$style_nodes[] = array( 'path' => array( 'styles' ) );

foreach ( $style_nodes as $style_node ) {
$path = $style_node['path'];
/*
Expand Down
10 changes: 10 additions & 0 deletions lib/compat/wordpress-6.7/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ function gutenberg_add_format_query_vars_to_query_loop_block( $query, $block ) {
return $query;
}

// Return early if the query already contains a post format. This is to avoid duplication if the
// WordPress core filter is already applied.
if ( ! empty( $query['tax_query'] ) ) {
foreach ( $query['tax_query'] as $taxquery ) {
if ( isset( $taxquery['taxonomy'] ) && 'post_format' === $taxquery['taxonomy'] ) {
return $query;
}
}
}

$formats = $block->context['query']['format'];
/*
* Validate that the format is either `standard` or a supported post format.
Expand Down
10 changes: 9 additions & 1 deletion lib/compat/wordpress-6.8/preload.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
*/
function gutenberg_block_editor_preload_paths_6_8( $paths, $context ) {
if ( 'core/edit-site' === $context->name ) {
// Core already preloads both of these for `core/edit-post`.
if ( ! empty( $_GET['postId'] ) ) {
$route_for_post = rest_get_route_for_post( $_GET['postId'] );
if ( $route_for_post ) {
$paths[] = add_query_arg( 'context', 'edit', $route_for_post );
}
}

$paths[] = '/wp/v2/settings';
$paths[] = array( '/wp/v2/settings', 'OPTIONS' );
$paths[] = '/?_fields=' . implode(
Expand All @@ -28,6 +34,8 @@ function gutenberg_block_editor_preload_paths_6_8( $paths, $context ) {
'url',
)
);
$paths[] = '/wp/v2/templates/lookup?slug=front-page';
$paths[] = '/wp/v2/templates/lookup?slug=home';
}

// Preload theme and global styles paths.
Expand Down
13 changes: 13 additions & 0 deletions packages/block-editor/src/components/block-tools/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@
}
}

// The black plus that shows up on the right side of an empty paragraph block,
// or the initial appender that exists only on empty documents.
.block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter {
position: absolute;
top: 0;
right: 0;
line-height: 0;

&:disabled {
display: none;
}
}

// Sibling inserter / "inbetweenserter".
.block-editor-block-list__empty-block-inserter,
.block-editor-block-list__insertion-point-inserter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,12 @@
}
}

// The black plus that shows up on the right side of an empty paragraph block, or the initial appender
// that exists only on empty documents.
.block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter,
.block-editor-default-block-appender .block-editor-inserter {
position: absolute;
top: 0;
right: 0;
line-height: 0;

&:disabled {
display: none;
}
}


/**
* Fixed position appender.
* These styles apply to all in-canvas inserters that exist inside nesting containers.
* Fixed position appender (right bottom corner).
*
* These styles apply to all in-canvas inserters. All in-canvas inserters always
* exist within a block.
*/

.block-editor-block-list__block .block-list-appender {
Expand All @@ -96,6 +84,10 @@
line-height: 0;
}

.block-editor-inserter:disabled {
display: none;
}

.block-editor-default-block-appender {
height: $button-size-small;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,10 @@ export function getCompatibilityStyles() {
return accumulator;
}

// Don't try to add the reset styles, which were removed as a dependency
// from `edit-blocks` for the iframe since we don't need to reset admin
// styles.
if (
[
'wp-reset-editor-styles-css',
'wp-reset-editor-styles-rtl-css',
].includes( ownerNode.id )
) {
// Don't try to add core WP styles. We are responsible for adding
// them. This compatibility layer is only meant to add styles added
// by plugins or themes.
if ( ownerNode.id.startsWith( 'wp-' ) ) {
return accumulator;
}

Expand Down
12 changes: 3 additions & 9 deletions packages/block-library/src/comments/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
}
},
"supports": {
"align": [
"wide",
"full"
],
"align": [ "wide", "full" ],
"html": false,
"color": {
"gradients": true,
Expand Down Expand Up @@ -63,8 +60,5 @@
}
},
"editorStyle": "wp-block-comments-editor",
"usesContext": [
"postId",
"postType"
]
}
"usesContext": [ "postId", "postType" ]
}
3 changes: 2 additions & 1 deletion packages/block-library/src/post-template/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"displayLayout",
"templateSlug",
"previewPostType",
"enhancedPagination"
"enhancedPagination",
"postType"
],
"supports": {
"reusable": false,
Expand Down
6 changes: 5 additions & 1 deletion packages/block-library/src/post-template/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export default function PostTemplateEdit( {
} = {},
templateSlug,
previewPostType,
postType: postTypeFromContext,
},
attributes: { layout },
__unstableLayoutClassNames,
Expand Down Expand Up @@ -186,7 +187,10 @@ export default function PostTemplateEdit( {
}
// When we preview Query Loop blocks we should prefer the current
// block's postType, which is passed through block context.
const usedPostType = previewPostType || postType;
const usedPostType =
postTypeFromContext && postTypeFromContext !== 'page'
? postTypeFromContext
: previewPostType || postType;
return {
posts: getEntityRecords( 'postType', usedPostType, {
...query,
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/query/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"default": false
}
},
"usesContext": [ "postType" ],
"usesContext": [ "postType", "templateSlug" ],
"providesContext": {
"queryId": "queryId",
"query": "query",
Expand Down
22 changes: 19 additions & 3 deletions packages/block-library/src/query/edit/inspector-controls/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,15 @@ import { useToolsPanelDropdownMenuProps } from '../../../utils/hooks';
const { BlockInfo } = unlock( blockEditorPrivateApis );

export default function QueryInspectorControls( props ) {
const { attributes, setQuery, setDisplayLayout, isTemplate } = props;
const { query, displayLayout } = attributes;
const {
attributes,
setQuery,
setDisplayLayout,
postTypeFromContext,
isSingular,
} = props;
const { query, displayLayout } = attributes;
let {
order,
orderBy,
author: authorIds,
Expand All @@ -61,6 +67,16 @@ export default function QueryInspectorControls( props ) {
parents,
format,
} = query;
// If a post type is set in context, update `postType` to match it,
// unless the post type is `page`, as it usually doesn't make sense to loop
// through pages.
if (
postTypeFromContext &&
postTypeFromContext !== 'page' &&
postTypeFromContext !== postType
) {
postType = postTypeFromContext;
}
const allowedControls = useAllowedControls( attributes );
const showSticky = postType === 'post';
const {
Expand Down Expand Up @@ -118,7 +134,7 @@ export default function QueryInspectorControls( props ) {
}, [ querySearch, onChangeDebounced ] );

const showInheritControl =
isTemplate && isControlAllowed( allowedControls, 'inherit' );
! isSingular && isControlAllowed( allowedControls, 'inherit' );
const showPostTypeControl =
! inherit && isControlAllowed( allowedControls, 'postType' );
const postTypeControlLabel = __( 'Post type' );
Expand Down
27 changes: 10 additions & 17 deletions packages/block-library/src/query/edit/query-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import EnhancedPaginationControl from './inspector-controls/enhanced-pagination-
import QueryToolbar from './query-toolbar';
import QueryInspectorControls from './inspector-controls';
import EnhancedPaginationModal from './enhanced-pagination-modal';
import { getQueryContextFromTemplate } from '../utils';

const DEFAULTS_POSTS_PER_PAGE = 3;

Expand All @@ -42,24 +43,15 @@ export default function QueryContent( {
tagName: TagName = 'div',
query: { inherit } = {},
} = attributes;
const { postType } = context;
const { templateSlug, postType } = context;
const { isSingular } = getQueryContextFromTemplate( templateSlug );
const { __unstableMarkNextChangeAsNotPersistent } =
useDispatch( blockEditorStore );
const instanceId = useInstanceId( QueryContent );
const blockProps = useBlockProps();
const innerBlocksProps = useInnerBlocksProps( blockProps, {
template: TEMPLATE,
} );
const isTemplate = useSelect(
( select ) => {
const currentTemplate =
select( coreStore ).__experimentalGetTemplateForLink()?.type;
const isInTemplate = 'wp_template' === currentTemplate;
const isInSingularContent = postType !== undefined;
return isInTemplate && ! isInSingularContent;
},
[ postType ]
);
const { postsPerPage } = useSelect( ( select ) => {
const { getSettings } = select( blockEditorStore );
const { getEntityRecord, getEntityRecordEdits, canUser } =
Expand Down Expand Up @@ -106,9 +98,9 @@ export default function QueryContent( {
} else if ( ! query.perPage && postsPerPage ) {
newQuery.perPage = postsPerPage;
}
// We need to reset the `inherit` value if not in a template, as queries
// are not inherited when outside a template (e.g. when in singular content).
if ( ! isTemplate && query.inherit ) {
// We need to reset the `inherit` value if in a singular template, as queries
// are not inherited when in singular content (e.g. post, page, 404, blank).
if ( isSingular && query.inherit ) {
newQuery.inherit = false;
}
if ( !! Object.keys( newQuery ).length ) {
Expand All @@ -117,10 +109,10 @@ export default function QueryContent( {
}
}, [
query.perPage,
query.inherit,
postsPerPage,
inherit,
isTemplate,
query.inherit,
isSingular,
__unstableMarkNextChangeAsNotPersistent,
updateQuery,
] );
Expand Down Expand Up @@ -167,7 +159,8 @@ export default function QueryContent( {
setDisplayLayout={ updateDisplayLayout }
setAttributes={ setAttributes }
clientId={ clientId }
isTemplate={ isTemplate }
postTypeFromContext={ postType }
isSingular={ isSingular }
/>
</InspectorControls>
<BlockControls>
Expand Down
Loading

0 comments on commit 466d82d

Please sign in to comment.