Block Editor: Backport fixes targeted for WordPress 5.8 RC4.

This includes:

- Suggestion List: Check if a node exists to scroll into view.
- Autocomplete: reset state for empty text.
- Adds auxiliary class names for editor styles in the widgets editor.
- Extract snackbars into a separate component.
- Rich text: run input rules after composition end.
- iframe: load inline styles.
- Multi select: select all: restore ref callback.
- Writing flow: allow select all from empty selection.
- Post Excerpt: Fix excerpt_more filter conflict and remove wordCount attribute.
- Add the percent unit to the default units in Core. 

Props desrosj, youknowriad.
Merges [51443] to the 5.8 branch.
Fixes #53397.
Built from https://develop.svn.wordpress.org/branches/5.8@51445


git-svn-id: http://core.svn.wordpress.org/branches/5.8@51056 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj 2021-07-15 21:14:20 +00:00
parent 3ffa646c8c
commit a01a99951e
21 changed files with 268 additions and 142 deletions

File diff suppressed because one or more lines are too long

View File

@ -14,7 +14,7 @@ return array(
<!-- wp:post-template -->
<!-- wp:group {"style":{"spacing":{"padding":{"top":"30px","right":"30px","bottom":"30px","left":"30px"}}},"layout":{"inherit":false}} -->
<div class="wp-block-group" style="padding-top:30px;padding-right:30px;padding-bottom:30px;padding-left:30px"><!-- wp:post-title {"isLink":true} /-->
<!-- wp:post-excerpt {"wordCount":20} /-->
<!-- wp:post-excerpt /-->
<!-- wp:post-date /--></div>
<!-- /wp:group -->
<!-- /wp:post-template -->

View File

@ -18,34 +18,34 @@ function render_block_core_post_excerpt( $attributes, $content, $block ) {
return '';
}
$more_text = isset( $attributes['moreText'] ) ? '<a class="wp-block-post-excerpt__more-link" href="' . esc_url( get_the_permalink( $block->context['postId'] ) ) . '">' . $attributes['moreText'] . '</a>' : '';
$filter_excerpt_length = function() use ( $attributes ) {
return isset( $attributes['wordCount'] ) ? $attributes['wordCount'] : 55;
$more_text = ! empty( $attributes['moreText'] ) ? '<a class="wp-block-post-excerpt__more-link" href="' . esc_url( get_the_permalink( $block->context['postId'] ) ) . '">' . $attributes['moreText'] . '</a>' : '';
$filter_excerpt_more = function( $more ) use ( $more_text ) {
return empty( $more_text ) ? $more : '';
};
add_filter(
'excerpt_length',
$filter_excerpt_length
);
/**
* Some themes might use `excerpt_more` filter to handle the
* `more` link displayed after a trimmed excerpt. Since the
* block has a `more text` attribute we have to check and
* override if needed the return value from this filter.
* So if the block's attribute is not empty override the
* `excerpt_more` filter and return nothing. This will
* result in showing only one `read more` link at a time.
*/
add_filter( 'excerpt_more', $filter_excerpt_more );
$classes = '';
if ( isset( $attributes['textAlign'] ) ) {
$classes .= 'has-text-align-' . $attributes['textAlign'];
$classes .= "has-text-align-{$attributes['textAlign']}";
}
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
$content = '<p class="wp-block-post-excerpt__excerpt">' . get_the_excerpt( $block->context['postId'] );
if ( ! isset( $attributes['showMoreOnNewLine'] ) || $attributes['showMoreOnNewLine'] ) {
$content = '<p class="wp-block-post-excerpt__excerpt">' . get_the_excerpt( $block->context['postId'] );
$show_more_on_new_line = ! isset( $attributes['showMoreOnNewLine'] ) || $attributes['showMoreOnNewLine'];
if ( $show_more_on_new_line && ! empty( $more_text ) ) {
$content .= '</p><p class="wp-block-post-excerpt__more-text">' . $more_text . '</p>';
} else {
$content .= " $more_text</p>";
}
remove_filter(
'excerpt_length',
$filter_excerpt_length
);
remove_filter( 'excerpt_more', $filter_excerpt_more );
return sprintf( '<div %1$s>%2$s</div>', $wrapper_attributes, $content );
}

View File

@ -9,10 +9,6 @@
"textAlign": {
"type": "string"
},
"wordCount": {
"type": "number",
"default": 55
},
"moreText": {
"type": "string"
},

View File

@ -1178,7 +1178,7 @@ class WP_Theme_JSON {
$theme_settings['settings']['spacing'] = array();
}
$theme_settings['settings']['spacing']['units'] = ( true === $settings['enableCustomUnits'] ) ?
array( 'px', 'em', 'rem', 'vh', 'vw' ) :
array( 'px', 'em', 'rem', 'vh', 'vw', '%' ) :
$settings['enableCustomUnits'];
}

View File

@ -7143,7 +7143,7 @@ __webpack_require__.d(__webpack_exports__, "SkipToSelectedBlock", function() { r
__webpack_require__.d(__webpack_exports__, "Typewriter", function() { return /* reexport */ typewriter; });
__webpack_require__.d(__webpack_exports__, "__unstableUseTypewriter", function() { return /* reexport */ useTypewriter; });
__webpack_require__.d(__webpack_exports__, "Warning", function() { return /* reexport */ warning; });
__webpack_require__.d(__webpack_exports__, "WritingFlow", function() { return /* reexport */ WritingFlow; });
__webpack_require__.d(__webpack_exports__, "WritingFlow", function() { return /* reexport */ writing_flow; });
__webpack_require__.d(__webpack_exports__, "__unstableUseCanvasClickRedirect", function() { return /* reexport */ useCanvasClickRedirect; });
__webpack_require__.d(__webpack_exports__, "useBlockDisplayInformation", function() { return /* reexport */ useBlockDisplayInformation; });
__webpack_require__.d(__webpack_exports__, "__unstableIframe", function() { return /* reexport */ iframe; });
@ -13526,7 +13526,7 @@ const deprecatedFlags = {
}
if (settings.enableCustomUnits === true) {
return ['px', 'em', 'rem', 'vh', 'vw'];
return ['px', 'em', 'rem', 'vh', 'vw', '%'];
}
return settings.enableCustomUnits;
@ -30622,7 +30622,8 @@ function useInputRules(props) {
function onInput(event) {
const {
inputType
inputType,
type
} = event;
const {
value,
@ -30631,7 +30632,7 @@ function useInputRules(props) {
formatTypes
} = propsRef.current; // Only run input rules when inserting text.
if (inputType !== 'insertText') {
if (inputType !== 'insertText' && type !== 'compositionend') {
return;
}
@ -30661,8 +30662,10 @@ function useInputRules(props) {
}
element.addEventListener('input', onInput);
element.addEventListener('compositionend', onInput);
return () => {
element.removeEventListener('input', onInput);
element.removeEventListener('compositionend', onInput);
};
}, []);
}
@ -38740,6 +38743,7 @@ function useTabNav() {
function onKeyDown(event) {
if (event.keyCode === external_wp_keycodes_["ESCAPE"] && !hasMultiSelection()) {
event.stopPropagation();
event.preventDefault();
setNavigationMode(true);
return;
} // In Edit mode, Tab should focus the first tabbable element after
@ -38758,6 +38762,13 @@ function useTabNav() {
const direction = isShift ? 'findPrevious' : 'findNext';
if (!hasMultiSelection() && !getSelectedBlockClientId()) {
// Preserve the behaviour of entering navigation mode when
// tabbing into the content without a block selection.
// `onFocusCapture` already did this previously, but we need to
// do it again here because after clearing block selection,
// focus land on the writing flow container and pressing Tab
// will no longer send focus through the focus capture element.
if (event.target === node) setNavigationMode(true);
return;
} // Allow tabbing between form elements rendered in a block,
// such as inside a placeholder. Form elements are generally
@ -39130,7 +39141,6 @@ function useArrowNav() {
function useSelectAll() {
const ref = Object(external_wp_element_["useRef"])();
const {
getBlockOrder,
getSelectedBlockClientIds,
@ -39139,51 +39149,62 @@ function useSelectAll() {
const {
multiSelect
} = Object(external_wp_data_["useDispatch"])(store);
const callback = Object(external_wp_element_["useCallback"])(event => {
const selectedClientIds = getSelectedBlockClientIds();
const isMatch = Object(external_wp_keyboardShortcuts_["__unstableUseShortcutEventMatch"])();
return Object(external_wp_compose_["useRefEffect"])(node => {
function onKeyDown(event) {
if (!isMatch('core/block-editor/select-all', event)) {
return;
}
if (!selectedClientIds.length) {
return;
const selectedClientIds = getSelectedBlockClientIds();
if (selectedClientIds.length === 1 && !Object(external_wp_dom_["isEntirelySelected"])(event.target)) {
return;
}
const [firstSelectedClientId] = selectedClientIds;
const rootClientId = getBlockRootClientId(firstSelectedClientId);
let blockClientIds = getBlockOrder(rootClientId); // If we have selected all sibling nested blocks, try selecting up a
// level. See: https://github.com/WordPress/gutenberg/pull/31859/
if (selectedClientIds.length === blockClientIds.length) {
blockClientIds = getBlockOrder(getBlockRootClientId(rootClientId));
}
const firstClientId = Object(external_lodash_["first"])(blockClientIds);
const lastClientId = Object(external_lodash_["last"])(blockClientIds);
if (firstClientId === lastClientId) {
return;
}
multiSelect(firstClientId, lastClientId);
event.preventDefault();
}
if (selectedClientIds.length === 1 && !Object(external_wp_dom_["isEntirelySelected"])(event.target)) {
return;
}
const [firstSelectedClientId] = selectedClientIds;
const rootClientId = getBlockRootClientId(firstSelectedClientId);
let blockClientIds = getBlockOrder(rootClientId); // If we have selected all sibling nested blocks, try selecting up a
// level. See: https://github.com/WordPress/gutenberg/pull/31859/
if (selectedClientIds.length === blockClientIds.length) {
blockClientIds = getBlockOrder(getBlockRootClientId(rootClientId));
}
const firstClientId = Object(external_lodash_["first"])(blockClientIds);
const lastClientId = Object(external_lodash_["last"])(blockClientIds);
if (firstClientId === lastClientId) {
return;
}
multiSelect(firstClientId, lastClientId);
event.preventDefault();
}, []);
Object(external_wp_keyboardShortcuts_["useShortcut"])('core/block-editor/select-all', callback, {
target: ref
node.addEventListener('keydown', onKeyDown);
return () => {
node.removeEventListener('keydown', onKeyDown);
};
});
return ref;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
@ -39193,6 +39214,20 @@ function useSelectAll() {
function WritingFlow({
children,
...props
}, forwardedRef) {
const [before, ref, after] = useTabNav();
const hasMultiSelection = Object(external_wp_data_["useSelect"])(select => select(store).hasMultiSelection(), []);
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, before, Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({}, props, {
ref: Object(external_wp_compose_["useMergeRefs"])([forwardedRef, ref, use_multi_selection_useMultiSelection(), useSelectAll(), useArrowNav()]),
className: classnames_default()(props.className, 'block-editor-writing-flow'),
tabIndex: -1,
"aria-label": hasMultiSelection ? Object(external_wp_i18n_["__"])('Multiple selected blocks') : undefined
}), children), after);
}
/**
* Handles selection and navigation across blocks. This component should be
* wrapped around BlockList.
@ -39201,18 +39236,8 @@ function useSelectAll() {
* @param {WPElement} props.children Children to be rendered.
*/
function WritingFlow({
children
}) {
const [before, ref, after] = useTabNav();
const hasMultiSelection = Object(external_wp_data_["useSelect"])(select => select(store).hasMultiSelection(), []);
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, before, Object(external_wp_element_["createElement"])("div", {
ref: Object(external_wp_compose_["useMergeRefs"])([ref, use_multi_selection_useMultiSelection(), useSelectAll(), useArrowNav()]),
className: "block-editor-writing-flow",
tabIndex: hasMultiSelection ? '0' : undefined,
"aria-label": hasMultiSelection ? Object(external_wp_i18n_["__"])('Multiple selected blocks') : undefined
}, children), after);
}
/* harmony default export */ var writing_flow = (Object(external_wp_element_["forwardRef"])(WritingFlow));
// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-canvas-click-redirect/index.js
/**
@ -39316,6 +39341,19 @@ function styleSheetsCompat(doc) {
if (!cssRules) {
return;
} // Generally, ignore inline styles. We add inline styles belonging to a
// stylesheet later, which may or may not match the selectors.
if (ownerNode.tagName !== 'LINK') {
return;
} // 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 (ownerNode.id === 'wp-reset-editor-styles-css') {
return;
}
const isMatch = Array.from(cssRules).find(({
@ -39326,8 +39364,15 @@ function styleSheetsCompat(doc) {
// eslint-disable-next-line no-console
console.error(`Stylesheet ${ownerNode.id} was not properly added.
For blocks, use the block API's style (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#style) or editorStyle (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#editor-style).
For themes, use add_editor_style (https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#editor-styles).`, ownerNode);
doc.head.appendChild(ownerNode.cloneNode(true));
For themes, use add_editor_style (https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#editor-styles).`, ownerNode.outerHTML);
doc.head.appendChild(ownerNode.cloneNode(true)); // Add inline styles belonging to the stylesheet.
const inlineCssId = ownerNode.id.replace('-css', '-inline-css');
const inlineCssElement = document.getElementById(inlineCssId);
if (inlineCssElement) {
doc.head.appendChild(inlineCssElement.cloneNode(true));
}
}
});
}
@ -39508,15 +39553,24 @@ function Iframe({
href,
id,
rel,
media
}, index) => {
media,
textContent
}) => {
const TagName = tagName.toLowerCase();
if (TagName === 'style') {
return Object(external_wp_element_["createElement"])(TagName, {
id,
key: id
}, textContent);
}
return Object(external_wp_element_["createElement"])(TagName, {
href,
id,
rel,
media,
key: index
key: id
});
}), head);
return Object(external_wp_element_["createElement"])("iframe", Object(esm_extends["a" /* default */])({}, props, {

File diff suppressed because one or more lines are too long

View File

@ -31190,27 +31190,9 @@ const post_excerpt_postExcerpt = Object(external_wp_element_["createElement"])(e
*/
function usePostContentExcerpt(wordCount, postId, postType) {
// Don't destrcuture items from content here, it can be undefined.
const [,, content] = Object(external_wp_coreData_["useEntityProp"])('postType', postType, 'content', postId);
const renderedPostContent = content === null || content === void 0 ? void 0 : content.rendered;
return Object(external_wp_element_["useMemo"])(() => {
if (!renderedPostContent) {
return '';
}
const excerptElement = document.createElement('div');
excerptElement.innerHTML = renderedPostContent;
const excerpt = excerptElement.textContent || excerptElement.innerText || '';
return excerpt.trim().split(' ', wordCount).join(' ');
}, [renderedPostContent, wordCount]);
}
function PostExcerptEditor({
attributes: {
textAlign,
wordCount,
moreText,
showMoreOnNewLine
},
@ -31229,12 +31211,22 @@ function PostExcerptEditor({
rendered: renderedExcerpt,
protected: isProtected
} = {}] = Object(external_wp_coreData_["useEntityProp"])('postType', postType, 'excerpt', postId);
const postContentExcerpt = usePostContentExcerpt(wordCount, postId, postType);
const blockProps = Object(external_wp_blockEditor_["useBlockProps"])({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
})
});
/**
* When excerpt is editable, strip the html tags from
* rendered excerpt. This will be used if the entity's
* excerpt has been produced from the content.
*/
const strippedRenderedExcerpt = Object(external_wp_element_["useMemo"])(() => {
if (!renderedExcerpt) return '';
const document = new window.DOMParser().parseFromString(renderedExcerpt, 'text/html');
return document.body.textContent || document.body.innerText || '';
}, [renderedExcerpt]);
if (!postType || !postId) {
return Object(external_wp_element_["createElement"])("div", blockProps, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["Warning"], null, Object(external_wp_i18n_["__"])('Post excerpt block: no post found.')));
@ -31257,11 +31249,11 @@ function PostExcerptEditor({
const excerptContent = isEditable ? Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"], {
className: !showMoreOnNewLine && 'wp-block-post-excerpt__excerpt is-inline',
"aria-label": Object(external_wp_i18n_["__"])('Post excerpt text'),
value: rawExcerpt || postContentExcerpt || (isSelected ? '' : Object(external_wp_i18n_["__"])('No post excerpt found')),
value: rawExcerpt || strippedRenderedExcerpt || (isSelected ? '' : Object(external_wp_i18n_["__"])('No post excerpt found')),
onChange: setExcerpt
}) : renderedExcerpt && Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], {
}) : renderedExcerpt && Object(external_wp_element_["createElement"])(external_wp_components_["Disabled"], null, Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], {
key: "html"
}, renderedExcerpt) || postContentExcerpt || Object(external_wp_i18n_["__"])('No post excerpt found');
}, renderedExcerpt)) || Object(external_wp_i18n_["__"])('No post excerpt found');
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["AlignmentToolbar"], {
value: textAlign,
onChange: newAlign => setAttributes({
@ -31269,15 +31261,7 @@ function PostExcerptEditor({
})
})), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], {
title: Object(external_wp_i18n_["__"])('Post Excerpt Settings')
}, !renderedExcerpt && Object(external_wp_element_["createElement"])(external_wp_components_["RangeControl"], {
label: Object(external_wp_i18n_["__"])('Max words'),
value: wordCount,
onChange: newExcerptLength => setAttributes({
wordCount: newExcerptLength
}),
min: 10,
max: 100
}), Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], {
}, Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], {
label: Object(external_wp_i18n_["__"])('Show link on new line'),
checked: showMoreOnNewLine,
onChange: newShowMoreOnNewLine => setAttributes({
@ -31308,10 +31292,6 @@ const post_excerpt_metadata = {
textAlign: {
type: "string"
},
wordCount: {
type: "number",
"default": 55
},
moreText: {
type: "string"
},

File diff suppressed because one or more lines are too long

View File

@ -20798,6 +20798,7 @@ function useAutocomplete({
Object(external_wp_element_["useEffect"])(() => {
if (!textContent) {
reset();
return;
}
@ -25270,7 +25271,7 @@ class suggestions_list_SuggestionsList extends external_wp_element_["Component"]
componentDidUpdate() {
// only have to worry about scrolling selected suggestion into view
// when already expanded
if (this.props.selectedIndex > -1 && this.props.scrollIntoView) {
if (this.props.selectedIndex > -1 && this.props.scrollIntoView && this.list.children[this.props.selectedIndex]) {
this.scrollingIntoView = true;
lib_default()(this.list.children[this.props.selectedIndex], this.list, {
onlyScrollIfNeeded: true

File diff suppressed because one or more lines are too long

View File

@ -2826,6 +2826,10 @@ var external_wp_compose_ = __webpack_require__("K9lf");
* WordPress dependencies
*/
/**
* WordPress dependencies
*/
@ -2851,6 +2855,7 @@ function InterfaceSkeleton({
header,
sidebar,
secondarySidebar,
notices,
content,
drawer,
actions,
@ -2907,7 +2912,9 @@ function InterfaceSkeleton({
role: "region",
"aria-label": mergedLabels.secondarySidebar,
tabIndex: "-1"
}, secondarySidebar), Object(external_wp_element_["createElement"])("div", {
}, secondarySidebar), !!notices && Object(external_wp_element_["createElement"])("div", {
className: "interface-interface-skeleton__notices"
}, notices), Object(external_wp_element_["createElement"])("div", {
className: "interface-interface-skeleton__content",
role: "region",
"aria-label": mergedLabels.body,
@ -13071,13 +13078,14 @@ function MaybeIframe({
if (!isTemplateMode) {
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__unstableEditorStyles"], {
styles: styles
}), Object(external_wp_element_["createElement"])("div", {
}), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["WritingFlow"], {
ref: contentRef,
className: "editor-styles-wrapper",
style: {
flex: '1',
...style
}
},
tabIndex: -1
}, children));
}
@ -13092,7 +13100,7 @@ function MaybeIframe({
height: '100%',
display: 'block'
}
}, children);
}, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["WritingFlow"], null, children));
}
function VisualEditor({
@ -13231,11 +13239,11 @@ function VisualEditor({
}, themeSupportsLayout && !isTemplateMode && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__experimentalLayoutStyle"], {
selector: ".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container",
layout: defaultLayout
}), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["WritingFlow"], null, !isTemplateMode && Object(external_wp_element_["createElement"])("div", {
}), !isTemplateMode && Object(external_wp_element_["createElement"])("div", {
className: "edit-post-visual-editor__post-title-wrapper"
}, Object(external_wp_element_["createElement"])(external_wp_editor_["PostTitle"], null)), Object(external_wp_element_["createElement"])(RecursionProvider, null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockList"], {
__experimentalLayout: layout
}))))))), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__unstableBlockSettingsMenuFirstItem"], null, ({
})))))), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__unstableBlockSettingsMenuFirstItem"], null, ({
onClose
}) => Object(external_wp_element_["createElement"])(block_inspector_button, {
onClick: onClose
@ -17756,6 +17764,7 @@ function Layout({
}, hasBlockSelected ? Object(external_wp_i18n_["__"])('Open block settings') : Object(external_wp_i18n_["__"])('Open document settings'))), Object(external_wp_element_["createElement"])(build_module["b" /* ComplementaryArea */].Slot, {
scope: "core/edit-post"
})),
notices: Object(external_wp_element_["createElement"])(external_wp_editor_["EditorSnackbars"], null),
content: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_editor_["EditorNotices"], null), (mode === 'text' || !isRichEditingEnabled) && Object(external_wp_element_["createElement"])(text_editor, null), isRichEditingEnabled && mode === 'visual' && Object(external_wp_element_["createElement"])(VisualEditor, {
styles: styles
}), !isTemplateMode && Object(external_wp_element_["createElement"])("div", {

File diff suppressed because one or more lines are too long

View File

@ -1508,7 +1508,9 @@ const useIsDraggingWithin = elementRef => {
*/
function WidgetAreaInnerBlocks() {
function WidgetAreaInnerBlocks({
id
}) {
const [blocks, onInput, onChange] = Object(external_wp_coreData_["useEntityBlockEditor"])('root', 'postType');
const innerBlocksRef = Object(external_wp_element_["useRef"])();
const isDraggingWithinInnerBlocks = use_is_dragging_within(innerBlocksRef);
@ -1525,6 +1527,7 @@ function WidgetAreaInnerBlocks() {
});
return Object(external_wp_element_["createElement"])("div", {
"data-widget-area-id": id,
className: classnames_default()('wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper', {
'wp-block-widget-area__highlight-drop-zone': shouldHighlightDropZone
})
@ -1603,7 +1606,9 @@ function WidgetAreaEdit({
kind: "root",
type: "postType",
id: `widget-area-${id}`
}, Object(external_wp_element_["createElement"])(WidgetAreaInnerBlocks, null)))));
}, Object(external_wp_element_["createElement"])(WidgetAreaInnerBlocks, {
id: id
})))));
}
/**
* A React hook to determine if dragging is active.
@ -4440,6 +4445,10 @@ var external_wp_compose_ = __webpack_require__("K9lf");
* WordPress dependencies
*/
/**
* WordPress dependencies
*/
@ -4465,6 +4474,7 @@ function InterfaceSkeleton({
header,
sidebar,
secondarySidebar,
notices,
content,
drawer,
actions,
@ -4521,7 +4531,9 @@ function InterfaceSkeleton({
role: "region",
"aria-label": mergedLabels.secondarySidebar,
tabIndex: "-1"
}, secondarySidebar), Object(external_wp_element_["createElement"])("div", {
}, secondarySidebar), !!notices && Object(external_wp_element_["createElement"])("div", {
className: "interface-interface-skeleton__notices"
}, notices), Object(external_wp_element_["createElement"])("div", {
className: "interface-interface-skeleton__content",
role: "region",
"aria-label": mergedLabels.body,

File diff suppressed because one or more lines are too long

View File

@ -785,6 +785,7 @@ __webpack_require__.d(__webpack_exports__, "EditorKeyboardShortcutsRegister", fu
__webpack_require__.d(__webpack_exports__, "EditorHistoryRedo", function() { return /* reexport */ editor_history_redo; });
__webpack_require__.d(__webpack_exports__, "EditorHistoryUndo", function() { return /* reexport */ editor_history_undo; });
__webpack_require__.d(__webpack_exports__, "EditorNotices", function() { return /* reexport */ editor_notices; });
__webpack_require__.d(__webpack_exports__, "EditorSnackbars", function() { return /* reexport */ EditorSnackbars; });
__webpack_require__.d(__webpack_exports__, "EntitiesSavedStates", function() { return /* reexport */ EntitiesSavedStates; });
__webpack_require__.d(__webpack_exports__, "ErrorBoundary", function() { return /* reexport */ error_boundary; });
__webpack_require__.d(__webpack_exports__, "LocalAutosaveMonitor", function() { return /* reexport */ local_autosave_monitor; });
@ -4967,9 +4968,6 @@ function EditorNotices({
isDismissible: false,
type: 'default'
});
const snackbarNotices = Object(external_lodash_["filter"])(notices, {
type: 'snackbar'
});
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["NoticeList"], {
notices: nonDismissibleNotices,
className: "components-editor-notices__pinned"
@ -4977,11 +4975,7 @@ function EditorNotices({
notices: dismissibleNotices,
className: "components-editor-notices__dismissible",
onRemove: onRemove
}, Object(external_wp_element_["createElement"])(template_validation_notice, null)), Object(external_wp_element_["createElement"])(external_wp_components_["SnackbarList"], {
notices: snackbarNotices,
className: "components-editor-notices__snackbar",
onRemove: onRemove
}));
}, Object(external_wp_element_["createElement"])(template_validation_notice, null)));
}
/* harmony default export */ var editor_notices = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => ({
notices: select(external_wp_notices_["store"]).getNotices()
@ -4989,6 +4983,35 @@ function EditorNotices({
onRemove: dispatch(external_wp_notices_["store"]).removeNotice
}))])(EditorNotices));
// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-snackbars/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function EditorSnackbars() {
const notices = Object(external_wp_data_["useSelect"])(select => select(external_wp_notices_["store"]).getNotices(), []);
const {
removeNotice
} = Object(external_wp_data_["useDispatch"])(external_wp_notices_["store"]);
const snackbarNotices = Object(external_lodash_["filter"])(notices, {
type: 'snackbar'
});
return Object(external_wp_element_["createElement"])(external_wp_components_["SnackbarList"], {
notices: snackbarNotices,
className: "components-editor-notices__snackbar",
onRemove: removeNotice
});
}
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js
var library_close = __webpack_require__("w95h");
@ -11086,6 +11109,7 @@ const withFontSizes = deprecateFunction('withFontSizes', external_wp_blockEditor
// State Related Components

File diff suppressed because one or more lines are too long

View File

@ -125,6 +125,7 @@ __webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, "store", function() { return /* reexport */ store; });
__webpack_require__.d(__webpack_exports__, "useShortcut", function() { return /* reexport */ use_shortcut; });
__webpack_require__.d(__webpack_exports__, "__unstableUseShortcutEventMatch", function() { return /* reexport */ useShortcutEventMatch; });
// NAMESPACE OBJECT: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/actions.js
var actions_namespaceObject = {};
@ -139,6 +140,7 @@ __webpack_require__.d(selectors_namespaceObject, "getShortcutKeyCombination", fu
__webpack_require__.d(selectors_namespaceObject, "getShortcutRepresentation", function() { return getShortcutRepresentation; });
__webpack_require__.d(selectors_namespaceObject, "getShortcutDescription", function() { return getShortcutDescription; });
__webpack_require__.d(selectors_namespaceObject, "getShortcutAliases", function() { return getShortcutAliases; });
__webpack_require__.d(selectors_namespaceObject, "getAllShortcutKeyCombinations", function() { return selectors_getAllShortcutKeyCombinations; });
__webpack_require__.d(selectors_namespaceObject, "getAllShortcutRawKeyCombinations", function() { return getAllShortcutRawKeyCombinations; });
__webpack_require__.d(selectors_namespaceObject, "getCategoryShortcuts", function() { return getCategoryShortcuts; });
@ -356,6 +358,9 @@ function getShortcutDescription(state, name) {
function getShortcutAliases(state, name) {
return state[name] && state[name].aliases ? state[name].aliases : EMPTY_ARRAY;
}
const selectors_getAllShortcutKeyCombinations = Object(rememo["a" /* default */])((state, name) => {
return Object(external_lodash_["compact"])([getShortcutKeyCombination(state, name), ...getShortcutAliases(state, name)]);
}, (state, name) => [state[name]]);
/**
* Returns the raw representation of all the keyboard combinations of a given shortcut name.
*
@ -366,7 +371,7 @@ function getShortcutAliases(state, name) {
*/
const getAllShortcutRawKeyCombinations = Object(rememo["a" /* default */])((state, name) => {
return Object(external_lodash_["compact"])([getKeyCombinationRepresentation(getShortcutKeyCombination(state, name), 'raw'), ...getShortcutAliases(state, name).map(combination => getKeyCombinationRepresentation(combination, 'raw'))]);
return selectors_getAllShortcutKeyCombinations(state, name).map(combination => getKeyCombinationRepresentation(combination, 'raw'));
}, (state, name) => [state[name]]);
/**
* Returns the shortcut names list for a given category name.
@ -440,11 +445,56 @@ function useShortcut(name, callback, options) {
/* harmony default export */ var use_shortcut = (useShortcut);
// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/hooks/use-shortcut-event-match.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Returns a function to check if a keyboard event matches a shortcut name.
*
* @return {Function} A function to to check if a keyboard event matches a
* predefined shortcut combination.
*/
function useShortcutEventMatch() {
const {
getAllShortcutKeyCombinations
} = Object(external_wp_data_["useSelect"])(store);
/**
* A function to check if a keyboard event matches a predefined shortcut
* combination.
*
* @param {string} name Shortcut name.
* @param {KeyboardEvent} event Event to check.
*
* @return {boolean} True if the event matches any shortcuts, false if not.
*/
function isMatch(name, event) {
return getAllShortcutKeyCombinations(name).some(({
modifier,
character
}) => {
return external_wp_keycodes_["isKeyboardEvent"][modifier](event, character);
});
}
return isMatch;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/index.js
/***/ }),
/***/ "pPDe":

View File

@ -1,2 +1,2 @@
/*! This file is auto-generated */
this.wp=this.wp||{},this.wp.keyboardShortcuts=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="cFS5")}({"1ZqX":function(e,t){e.exports=window.wp.data},K9lf:function(e,t){e.exports=window.wp.compose},RxS6:function(e,t){e.exports=window.wp.keycodes},YLtl:function(e,t){e.exports=window.lodash},cFS5:function(e,t,n){"use strict";n.r(t),n.d(t,"store",(function(){return w})),n.d(t,"useShortcut",(function(){return x}));var r={};n.r(r),n.d(r,"registerShortcut",(function(){return c})),n.d(r,"unregisterShortcut",(function(){return s}));var o={};n.r(o),n.d(o,"getShortcutKeyCombination",(function(){return h})),n.d(o,"getShortcutRepresentation",(function(){return b})),n.d(o,"getShortcutDescription",(function(){return S})),n.d(o,"getShortcutAliases",(function(){return g})),n.d(o,"getAllShortcutRawKeyCombinations",(function(){return v})),n.d(o,"getCategoryShortcuts",(function(){return m}));var a=n("1ZqX"),u=n("YLtl");var i=function(e={},t){switch(t.type){case"REGISTER_SHORTCUT":return{...e,[t.name]:{category:t.category,keyCombination:t.keyCombination,aliases:t.aliases,description:t.description}};case"UNREGISTER_SHORTCUT":return Object(u.omit)(e,t.name)}return e};function c({name:e,category:t,description:n,keyCombination:r,aliases:o}){return{type:"REGISTER_SHORTCUT",name:e,category:t,keyCombination:r,aliases:o,description:n}}function s(e){return{type:"UNREGISTER_SHORTCUT",name:e}}var l=n("pPDe"),f=n("RxS6");const d=[],p={display:f.displayShortcut,raw:f.rawShortcut,ariaLabel:f.shortcutAriaLabel};function y(e,t){return e?e.modifier?p[t][e.modifier](e.character):e.character:null}function h(e,t){return e[t]?e[t].keyCombination:null}function b(e,t,n="display"){return y(h(e,t),n)}function S(e,t){return e[t]?e[t].description:null}function g(e,t){return e[t]&&e[t].aliases?e[t].aliases:d}const v=Object(l.a)((e,t)=>Object(u.compact)([y(h(e,t),"raw"),...g(e,t).map(e=>y(e,"raw"))]),(e,t)=>[e[t]]),m=Object(l.a)((e,t)=>Object.entries(e).filter(([,e])=>e.category===t).map(([e])=>e),e=>[e]),w=Object(a.createReduxStore)("core/keyboard-shortcuts",{reducer:i,actions:r,selectors:o});Object(a.register)(w);var O=n("K9lf");var x=function(e,t,n){const r=Object(a.useSelect)(t=>t(w).getAllShortcutRawKeyCombinations(e),[e]);Object(O.useKeyboardShortcut)(r,t,n)}},pPDe:function(e,t,n){"use strict";var r,o;function a(e){return[e]}function u(){var e={clear:function(){e.head=null}};return e}function i(e,t,n){var r;if(e.length!==t.length)return!1;for(r=n;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}r={},o="undefined"!=typeof WeakMap,t.a=function(e,t){var n,c;function s(){n=o?new WeakMap:u()}function l(){var n,r,o,a,u,s=arguments.length;for(a=new Array(s),o=0;o<s;o++)a[o]=arguments[o];for(u=t.apply(null,a),(n=c(u)).isUniqueByDependants||(n.lastDependants&&!i(u,n.lastDependants,0)&&n.clear(),n.lastDependants=u),r=n.head;r;){if(i(r.args,a,1))return r!==n.head&&(r.prev.next=r.next,r.next&&(r.next.prev=r.prev),r.next=n.head,r.prev=null,n.head.prev=r,n.head=r),r.val;r=r.next}return r={val:e.apply(null,a)},a[0]=null,r.args=a,n.head&&(n.head.prev=r,r.next=n.head),n.head=r,r.val}return t||(t=a),c=o?function(e){var t,o,a,i,c,s=n,l=!0;for(t=0;t<e.length;t++){if(o=e[t],!(c=o)||"object"!=typeof c){l=!1;break}s.has(o)?s=s.get(o):(a=new WeakMap,s.set(o,a),s=a)}return s.has(r)||((i=u()).isUniqueByDependants=l,s.set(r,i)),s.get(r)}:function(){return n},l.getDependants=t,l.clear=s,s(),l}}});
this.wp=this.wp||{},this.wp.keyboardShortcuts=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s="cFS5")}({"1ZqX":function(t,e){t.exports=window.wp.data},K9lf:function(t,e){t.exports=window.wp.compose},RxS6:function(t,e){t.exports=window.wp.keycodes},YLtl:function(t,e){t.exports=window.lodash},cFS5:function(t,e,n){"use strict";n.r(e),n.d(e,"store",(function(){return O})),n.d(e,"useShortcut",(function(){return x})),n.d(e,"__unstableUseShortcutEventMatch",(function(){return R}));var r={};n.r(r),n.d(r,"registerShortcut",(function(){return c})),n.d(r,"unregisterShortcut",(function(){return s}));var o={};n.r(o),n.d(o,"getShortcutKeyCombination",(function(){return y})),n.d(o,"getShortcutRepresentation",(function(){return b})),n.d(o,"getShortcutDescription",(function(){return S})),n.d(o,"getShortcutAliases",(function(){return g})),n.d(o,"getAllShortcutKeyCombinations",(function(){return v})),n.d(o,"getAllShortcutRawKeyCombinations",(function(){return m})),n.d(o,"getCategoryShortcuts",(function(){return w}));var u=n("1ZqX"),a=n("YLtl");var i=function(t={},e){switch(e.type){case"REGISTER_SHORTCUT":return{...t,[e.name]:{category:e.category,keyCombination:e.keyCombination,aliases:e.aliases,description:e.description}};case"UNREGISTER_SHORTCUT":return Object(a.omit)(t,e.name)}return t};function c({name:t,category:e,description:n,keyCombination:r,aliases:o}){return{type:"REGISTER_SHORTCUT",name:t,category:e,keyCombination:r,aliases:o,description:n}}function s(t){return{type:"UNREGISTER_SHORTCUT",name:t}}var l=n("pPDe"),f=n("RxS6");const d=[],p={display:f.displayShortcut,raw:f.rawShortcut,ariaLabel:f.shortcutAriaLabel};function h(t,e){return t?t.modifier?p[e][t.modifier](t.character):t.character:null}function y(t,e){return t[e]?t[e].keyCombination:null}function b(t,e,n="display"){return h(y(t,e),n)}function S(t,e){return t[e]?t[e].description:null}function g(t,e){return t[e]&&t[e].aliases?t[e].aliases:d}const v=Object(l.a)((t,e)=>Object(a.compact)([y(t,e),...g(t,e)]),(t,e)=>[t[e]]),m=Object(l.a)((t,e)=>v(t,e).map(t=>h(t,"raw")),(t,e)=>[t[e]]),w=Object(l.a)((t,e)=>Object.entries(t).filter(([,t])=>t.category===e).map(([t])=>t),t=>[t]),O=Object(u.createReduxStore)("core/keyboard-shortcuts",{reducer:i,actions:r,selectors:o});Object(u.register)(O);var j=n("K9lf");var x=function(t,e,n){const r=Object(u.useSelect)(e=>e(O).getAllShortcutRawKeyCombinations(t),[t]);Object(j.useKeyboardShortcut)(r,e,n)};function R(){const{getAllShortcutKeyCombinations:t}=Object(u.useSelect)(O);return function(e,n){return t(e).some(({modifier:t,character:e})=>f.isKeyboardEvent[t](n,e))}}},pPDe:function(t,e,n){"use strict";var r,o;function u(t){return[t]}function a(){var t={clear:function(){t.head=null}};return t}function i(t,e,n){var r;if(t.length!==e.length)return!1;for(r=n;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}r={},o="undefined"!=typeof WeakMap,e.a=function(t,e){var n,c;function s(){n=o?new WeakMap:a()}function l(){var n,r,o,u,a,s=arguments.length;for(u=new Array(s),o=0;o<s;o++)u[o]=arguments[o];for(a=e.apply(null,u),(n=c(a)).isUniqueByDependants||(n.lastDependants&&!i(a,n.lastDependants,0)&&n.clear(),n.lastDependants=a),r=n.head;r;){if(i(r.args,u,1))return r!==n.head&&(r.prev.next=r.next,r.next&&(r.next.prev=r.prev),r.next=n.head,r.prev=null,n.head.prev=r,n.head=r),r.val;r=r.next}return r={val:t.apply(null,u)},u[0]=null,r.args=u,n.head&&(n.head.prev=r,r.next=n.head),n.head=r,r.val}return e||(e=u),c=o?function(t){var e,o,u,i,c,s=n,l=!0;for(e=0;e<t.length;e++){if(o=t[e],!(c=o)||"object"!=typeof c){l=!1;break}s.has(o)?s=s.get(o):(u=new WeakMap,s.set(o,u),s=u)}return s.has(r)||((i=a()).isUniqueByDependants=l,s.set(r,i)),s.get(r)}:function(){return n},l.getDependants=e,l.clear=s,s(),l}}});

View File

@ -176,7 +176,7 @@
"spacing": {
"customMargin": false,
"customPadding": false,
"units": [ "px", "em", "rem", "vh", "vw" ]
"units": [ "px", "em", "rem", "vh", "vw", "%" ]
},
"typography": {
"customFontSize": true,

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.8-RC3-51444';
$wp_version = '5.8-RC3-51445';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.