Editor: Update packages for 6.7 RC 3

Syncs @wordpress/* packages to the wp-6.7 npm tag.

Props kevin940726, get_dave, youknowriad

Close #62321.
Built from https://develop.svn.wordpress.org/trunk@59347


git-svn-id: http://core.svn.wordpress.org/trunk@58733 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
get_dave 2024-11-05 12:59:25 +00:00
parent 310a481b66
commit 364a6c50a0
7 changed files with 37 additions and 29 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -32227,44 +32227,48 @@ function isScrollable(element) {
const style = window.getComputedStyle(element);
return style.overflowX === 'auto' || style.overflowX === 'scroll' || style.overflowY === 'auto' || style.overflowY === 'scroll';
}
const WITH_OVERFLOW_ELEMENT_BLOCKS = ['core/navigation'];
/**
* Returns the rect of the element including all visible nested elements.
*
* Visible nested elements, including elements that overflow the parent, are
* taken into account.
*
* This function is useful for calculating the visible area of a block that
* contains nested elements that overflow the block, e.g. the Navigation block,
* which can contain overflowing Submenu blocks.
* Returns the bounding rectangle of an element, with special handling for blocks
* that have visible overflowing children (defined in WITH_OVERFLOW_ELEMENT_BLOCKS).
*
* For blocks like Navigation that can have overflowing elements (e.g. submenus),
* this function calculates the combined bounds of both the parent and its visible
* children. The returned rect may extend beyond the viewport.
* The returned rect represents the full extent of the element and its visible
* children, which may extend beyond the viewport.
*
* @param {Element} element Element.
* @return {DOMRect} Bounding client rect of the element and its visible children.
*/
function getVisibleElementBounds(element) {
function getElementBounds(element) {
const viewport = element.ownerDocument.defaultView;
if (!viewport) {
return new window.DOMRectReadOnly();
}
let bounds = element.getBoundingClientRect();
const dataType = element.getAttribute('data-type');
/*
* For blocks with overflowing elements (like Navigation), include the bounds
* of visible children that extend beyond the parent container.
*/
if (dataType && WITH_OVERFLOW_ELEMENT_BLOCKS.includes(dataType)) {
const stack = [element];
let currentElement;
while (currentElement = stack.pop()) {
// Children wont affect bounds unless the element is not scrollable.
if (!isScrollable(currentElement)) {
for (const child of currentElement.children) {
if (isElementVisible(child)) {
let childBounds = child.getBoundingClientRect();
// If the parent is scrollable, use parent's scrollable bounds.
if (isScrollable(currentElement)) {
childBounds = currentElement.getBoundingClientRect();
}
const childBounds = child.getBoundingClientRect();
bounds = rectUnion(bounds, childBounds);
stack.push(child);
}
}
}
}
}
/*
* Take into account the outer horizontal limits of the container in which
@ -32346,7 +32350,7 @@ function BlockPopover({
}
return {
getBoundingClientRect() {
return lastSelectedElement ? rectUnion(getVisibleElementBounds(selectedElement), getVisibleElementBounds(lastSelectedElement)) : getVisibleElementBounds(selectedElement);
return lastSelectedElement ? rectUnion(getElementBounds(selectedElement), getElementBounds(lastSelectedElement)) : getElementBounds(selectedElement);
},
contextElement: selectedElement
};
@ -52949,7 +52953,7 @@ function getProps(contentElement, selectedBlockElement, scrollContainer, toolbar
// Get how far the content area has been scrolled.
const scrollTop = scrollContainer?.scrollTop || 0;
const blockRect = getVisibleElementBounds(selectedBlockElement);
const blockRect = getElementBounds(selectedBlockElement);
const contentRect = contentElement.getBoundingClientRect();
// Get the vertical position of top of the visible content area.

File diff suppressed because one or more lines are too long

View File

@ -3158,12 +3158,16 @@ function Layout({
canUser,
getPostType
} = select(external_wp_coreData_namespaceObject.store);
const {
__unstableGetEditorMode
} = unlock(select(external_wp_blockEditor_namespaceObject.store));
const supportsTemplateMode = settings.supportsTemplateMode;
const isViewable = (_getPostType$viewable = getPostType(currentPostType)?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
const canViewTemplate = canUser('read', {
kind: 'postType',
name: 'wp_template'
});
const isZoomOut = __unstableGetEditorMode() === 'zoom-out';
return {
mode: select(external_wp_editor_namespaceObject.store).getEditorMode(),
isFullscreenActive: select(store).isFeatureActive('fullscreenMode'),
@ -3171,7 +3175,7 @@ function Layout({
hasBlockSelected: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(),
showIconLabels: get('core', 'showIconLabels'),
isDistractionFree: get('core', 'distractionFree'),
showMetaBoxes: !DESIGN_POST_TYPES.includes(currentPostType) && select(external_wp_editor_namespaceObject.store).getRenderingMode() === 'post-only',
showMetaBoxes: !DESIGN_POST_TYPES.includes(currentPostType) && select(external_wp_editor_namespaceObject.store).getRenderingMode() === 'post-only' && !isZoomOut,
isWelcomeGuideVisible: isFeatureActive('welcomeGuide'),
templateId: supportsTemplateMode && isViewable && canViewTemplate && !isEditingTemplate ? getEditedPostTemplateId() : null
};

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.8-alpha-59346';
$wp_version = '6.8-alpha-59347';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.