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:
parent
310a481b66
commit
364a6c50a0
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -32227,44 +32227,48 @@ function isScrollable(element) {
|
||||||
const style = window.getComputedStyle(element);
|
const style = window.getComputedStyle(element);
|
||||||
return style.overflowX === 'auto' || style.overflowX === 'scroll' || style.overflowY === 'auto' || style.overflowY === 'scroll';
|
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.
|
* Returns the bounding rectangle of an element, with special handling for blocks
|
||||||
*
|
* that have visible overflowing children (defined in WITH_OVERFLOW_ELEMENT_BLOCKS).
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
|
* 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
|
* The returned rect represents the full extent of the element and its visible
|
||||||
* children, which may extend beyond the viewport.
|
* children, which may extend beyond the viewport.
|
||||||
*
|
*
|
||||||
* @param {Element} element Element.
|
* @param {Element} element Element.
|
||||||
* @return {DOMRect} Bounding client rect of the element and its visible children.
|
* @return {DOMRect} Bounding client rect of the element and its visible children.
|
||||||
*/
|
*/
|
||||||
function getVisibleElementBounds(element) {
|
function getElementBounds(element) {
|
||||||
const viewport = element.ownerDocument.defaultView;
|
const viewport = element.ownerDocument.defaultView;
|
||||||
if (!viewport) {
|
if (!viewport) {
|
||||||
return new window.DOMRectReadOnly();
|
return new window.DOMRectReadOnly();
|
||||||
}
|
}
|
||||||
let bounds = element.getBoundingClientRect();
|
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];
|
const stack = [element];
|
||||||
let currentElement;
|
let currentElement;
|
||||||
while (currentElement = stack.pop()) {
|
while (currentElement = stack.pop()) {
|
||||||
|
// Children won’t affect bounds unless the element is not scrollable.
|
||||||
|
if (!isScrollable(currentElement)) {
|
||||||
for (const child of currentElement.children) {
|
for (const child of currentElement.children) {
|
||||||
if (isElementVisible(child)) {
|
if (isElementVisible(child)) {
|
||||||
let childBounds = child.getBoundingClientRect();
|
const childBounds = child.getBoundingClientRect();
|
||||||
// If the parent is scrollable, use parent's scrollable bounds.
|
|
||||||
if (isScrollable(currentElement)) {
|
|
||||||
childBounds = currentElement.getBoundingClientRect();
|
|
||||||
}
|
|
||||||
bounds = rectUnion(bounds, childBounds);
|
bounds = rectUnion(bounds, childBounds);
|
||||||
stack.push(child);
|
stack.push(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Take into account the outer horizontal limits of the container in which
|
* Take into account the outer horizontal limits of the container in which
|
||||||
|
@ -32346,7 +32350,7 @@ function BlockPopover({
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
getBoundingClientRect() {
|
getBoundingClientRect() {
|
||||||
return lastSelectedElement ? rectUnion(getVisibleElementBounds(selectedElement), getVisibleElementBounds(lastSelectedElement)) : getVisibleElementBounds(selectedElement);
|
return lastSelectedElement ? rectUnion(getElementBounds(selectedElement), getElementBounds(lastSelectedElement)) : getElementBounds(selectedElement);
|
||||||
},
|
},
|
||||||
contextElement: selectedElement
|
contextElement: selectedElement
|
||||||
};
|
};
|
||||||
|
@ -52949,7 +52953,7 @@ function getProps(contentElement, selectedBlockElement, scrollContainer, toolbar
|
||||||
|
|
||||||
// Get how far the content area has been scrolled.
|
// Get how far the content area has been scrolled.
|
||||||
const scrollTop = scrollContainer?.scrollTop || 0;
|
const scrollTop = scrollContainer?.scrollTop || 0;
|
||||||
const blockRect = getVisibleElementBounds(selectedBlockElement);
|
const blockRect = getElementBounds(selectedBlockElement);
|
||||||
const contentRect = contentElement.getBoundingClientRect();
|
const contentRect = contentElement.getBoundingClientRect();
|
||||||
|
|
||||||
// Get the vertical position of top of the visible content area.
|
// Get the vertical position of top of the visible content area.
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -3158,12 +3158,16 @@ function Layout({
|
||||||
canUser,
|
canUser,
|
||||||
getPostType
|
getPostType
|
||||||
} = select(external_wp_coreData_namespaceObject.store);
|
} = select(external_wp_coreData_namespaceObject.store);
|
||||||
|
const {
|
||||||
|
__unstableGetEditorMode
|
||||||
|
} = unlock(select(external_wp_blockEditor_namespaceObject.store));
|
||||||
const supportsTemplateMode = settings.supportsTemplateMode;
|
const supportsTemplateMode = settings.supportsTemplateMode;
|
||||||
const isViewable = (_getPostType$viewable = getPostType(currentPostType)?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
|
const isViewable = (_getPostType$viewable = getPostType(currentPostType)?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
|
||||||
const canViewTemplate = canUser('read', {
|
const canViewTemplate = canUser('read', {
|
||||||
kind: 'postType',
|
kind: 'postType',
|
||||||
name: 'wp_template'
|
name: 'wp_template'
|
||||||
});
|
});
|
||||||
|
const isZoomOut = __unstableGetEditorMode() === 'zoom-out';
|
||||||
return {
|
return {
|
||||||
mode: select(external_wp_editor_namespaceObject.store).getEditorMode(),
|
mode: select(external_wp_editor_namespaceObject.store).getEditorMode(),
|
||||||
isFullscreenActive: select(store).isFeatureActive('fullscreenMode'),
|
isFullscreenActive: select(store).isFeatureActive('fullscreenMode'),
|
||||||
|
@ -3171,7 +3175,7 @@ function Layout({
|
||||||
hasBlockSelected: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(),
|
hasBlockSelected: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(),
|
||||||
showIconLabels: get('core', 'showIconLabels'),
|
showIconLabels: get('core', 'showIconLabels'),
|
||||||
isDistractionFree: get('core', 'distractionFree'),
|
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'),
|
isWelcomeGuideVisible: isFeatureActive('welcomeGuide'),
|
||||||
templateId: supportsTemplateMode && isViewable && canViewTemplate && !isEditingTemplate ? getEditedPostTemplateId() : null
|
templateId: supportsTemplateMode && isViewable && canViewTemplate && !isEditingTemplate ? getEditedPostTemplateId() : null
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue