Block Editor: Update the WordPress packages for 5.6 beta 2

It contains:

- Fix drop zone indicators for non blocks.
- Fix archives block render function.
- Code block: preserve indentation on paste.
- Turn off autocomplete for token input. 
- Fix parent post selector: ensure initial value available, search performed, all results shown. 
- Fix gallery block undo issue.

Props isabel_brison.
Fixes #51640.

Built from https://develop.svn.wordpress.org/trunk@49324


git-svn-id: http://core.svn.wordpress.org/trunk@49085 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
youknowriad 2020-10-27 09:34:46 +00:00
parent 18ee84c5c2
commit 3c554f366d
13 changed files with 74 additions and 38 deletions

File diff suppressed because one or more lines are too long

View File

@ -88,17 +88,16 @@ function render_block_core_archives( $attributes ) {
$classnames = esc_attr( $class );
if ( empty( $archives ) ) {
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classnames ) );
if ( empty( $archives ) ) {
return sprintf(
'<div class="%1$s">%2$s</div>',
$classnames,
'<div %1$s>%2$s</div>',
$wrapper_attributes,
__( 'No archives to show.' )
);
}
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classnames ) );
return sprintf(
'<ul %1$s>%2$s</ul>',
$wrapper_attributes,

View File

@ -13928,7 +13928,7 @@ __webpack_require__.d(selectors_namespaceObject, "isMultiSelecting", function()
__webpack_require__.d(selectors_namespaceObject, "isSelectionEnabled", function() { return selectors_isSelectionEnabled; });
__webpack_require__.d(selectors_namespaceObject, "getBlockMode", function() { return selectors_getBlockMode; });
__webpack_require__.d(selectors_namespaceObject, "isTyping", function() { return selectors_isTyping; });
__webpack_require__.d(selectors_namespaceObject, "isDraggingBlocks", function() { return selectors_isDraggingBlocks; });
__webpack_require__.d(selectors_namespaceObject, "isDraggingBlocks", function() { return isDraggingBlocks; });
__webpack_require__.d(selectors_namespaceObject, "getDraggedBlockClientIds", function() { return selectors_getDraggedBlockClientIds; });
__webpack_require__.d(selectors_namespaceObject, "isBlockBeingDragged", function() { return isBlockBeingDragged; });
__webpack_require__.d(selectors_namespaceObject, "isAncestorBeingDragged", function() { return isAncestorBeingDragged; });
@ -23190,7 +23190,7 @@ function __unstableSaveReusableBlock(id, updatedId) {
};
}
/**
* Returns an action object used in signalling that the last block change should be marked explicitely as persistent.
* Returns an action object used in signalling that the last block change should be marked explicitly as persistent.
*
* @return {Object} Action object.
*/
@ -24592,7 +24592,7 @@ function selectors_isTyping(state) {
* @return {boolean} Whether user is dragging blocks.
*/
function selectors_isDraggingBlocks(state) {
function isDraggingBlocks(state) {
return !!state.draggedBlocks.length;
}
/**
@ -24636,7 +24636,7 @@ function isBlockBeingDragged(state, clientId) {
function isAncestorBeingDragged(state, clientId) {
// Return early if no blocks are being dragged rather than
// the more expensive check for parents.
if (!selectors_isDraggingBlocks(state)) {
if (!isDraggingBlocks(state)) {
return false;
}
@ -26696,7 +26696,6 @@ function Items(_ref2) {
hasMultiSelection = _select.hasMultiSelection,
getGlobalBlockCount = _select.getGlobalBlockCount,
isTyping = _select.isTyping,
isDraggingBlocks = _select.isDraggingBlocks,
__experimentalGetActiveBlockIdByBlockNames = _select.__experimentalGetActiveBlockIdByBlockNames; // Determine if there is an active entity area to spotlight.
@ -26709,7 +26708,6 @@ function Items(_ref2) {
orientation: (_getBlockListSettings = getBlockListSettings(rootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation,
hasMultiSelection: hasMultiSelection(),
enableAnimation: !isTyping() && getGlobalBlockCount() <= BLOCK_ANIMATION_THRESHOLD,
isDraggingBlocks: isDraggingBlocks(),
activeEntityBlockId: activeEntityBlockId
};
}
@ -26721,17 +26719,16 @@ function Items(_ref2) {
orientation = _useSelect.orientation,
hasMultiSelection = _useSelect.hasMultiSelection,
enableAnimation = _useSelect.enableAnimation,
isDraggingBlocks = _useSelect.isDraggingBlocks,
activeEntityBlockId = _useSelect.activeEntityBlockId;
var dropTargetIndex = useBlockDropZone({
element: wrapperRef,
rootClientId: rootClientId
});
var isAppenderDropTarget = dropTargetIndex === blockClientIds.length && isDraggingBlocks;
var isAppenderDropTarget = dropTargetIndex === blockClientIds.length;
return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, blockClientIds.map(function (clientId, index) {
var isBlockInSelection = hasMultiSelection ? multiSelectedBlockClientIds.includes(clientId) : selectedBlockClientId === clientId;
var isDropTarget = dropTargetIndex === index && isDraggingBlocks;
var isDropTarget = dropTargetIndex === index;
return Object(external_this_wp_element_["createElement"])(external_this_wp_data_["AsyncModeProvider"], {
key: clientId,
value: !isBlockInSelection
@ -34782,7 +34779,8 @@ function RichTextWrapper(_ref2, forwardedRef) {
var _content = Object(external_this_wp_blocks_["pasteHandler"])({
HTML: filePasteHandler(files),
mode: 'BLOCKS',
tagName: tagName
tagName: tagName,
preserveWhiteSpace: preserveWhiteSpace
}); // Allows us to ask for this information when we get a report.
// eslint-disable-next-line no-console
@ -34815,7 +34813,8 @@ function RichTextWrapper(_ref2, forwardedRef) {
HTML: html,
plainText: plainText,
mode: mode,
tagName: tagName
tagName: tagName,
preserveWhiteSpace: preserveWhiteSpace
});
if (typeof content === 'string') {
@ -34845,7 +34844,7 @@ function RichTextWrapper(_ref2, forwardedRef) {
splitValue(value, content);
}
}
}, [tagName, onReplace, onSplit, splitValue, __unstableEmbedURLOnPaste, multiline]);
}, [tagName, onReplace, onSplit, splitValue, __unstableEmbedURLOnPaste, multiline, preserveWhiteSpace]);
var inputRule = Object(external_this_wp_element_["useCallback"])(function (value, valueToFormat) {
if (!onReplace) {
return;

File diff suppressed because one or more lines are too long

View File

@ -8332,6 +8332,9 @@ function GalleryEdit(props) {
attachmentCaptions = _useState4[0],
setAttachmentCaptions = _useState4[1];
var _useDispatch = Object(external_this_wp_data_["useDispatch"])('core/block-editor'),
__unstableMarkNextChangeAsNotPersistent = _useDispatch.__unstableMarkNextChangeAsNotPersistent;
function setAttributes(newAttrs) {
if (newAttrs.ids) {
throw new Error('The "ids" attribute should not be changed directly. It is managed automatically when "images" attribute changes');
@ -8561,6 +8564,8 @@ function GalleryEdit(props) {
if (!linkTo) {
var _window, _window$wp, _window$wp$media, _window$wp$media$view, _window$wp$media$view2, _window$wp$media$view3;
__unstableMarkNextChangeAsNotPersistent();
setAttributes({
linkTo: ((_window = window) === null || _window === void 0 ? void 0 : (_window$wp = _window.wp) === null || _window$wp === void 0 ? void 0 : (_window$wp$media = _window$wp.media) === null || _window$wp$media === void 0 ? void 0 : (_window$wp$media$view = _window$wp$media.view) === null || _window$wp$media$view === void 0 ? void 0 : (_window$wp$media$view2 = _window$wp$media$view.settings) === null || _window$wp$media$view2 === void 0 ? void 0 : (_window$wp$media$view3 = _window$wp$media$view2.defaultProps) === null || _window$wp$media$view3 === void 0 ? void 0 : _window$wp$media$view3.link) || constants_LINK_DESTINATION_NONE
});
@ -11168,7 +11173,8 @@ function CodeEdit(_ref) {
});
},
placeholder: Object(external_this_wp_i18n_["__"])('Write code…'),
"aria-label": Object(external_this_wp_i18n_["__"])('Code')
"aria-label": Object(external_this_wp_i18n_["__"])('Code'),
preserveWhiteSpace: true
}));
}

File diff suppressed because one or more lines are too long

View File

@ -12065,17 +12065,22 @@ var paste_handler_window = window,
/**
* Filters HTML to only contain phrasing content.
*
* @param {string} HTML The HTML to filter.
* @param {string} HTML The HTML to filter.
* @param {boolean} preserveWhiteSpace Whether or not to preserve consequent white space.
*
* @return {string} HTML only containing phrasing content.
*/
function filterInlineHTML(HTML) {
function filterInlineHTML(HTML, preserveWhiteSpace) {
HTML = deepFilterHTML(HTML, [googleDocsUIdRemover, phrasingContentReducer, commentRemover]);
HTML = Object(external_this_wp_dom_["removeInvalidHTML"])(HTML, Object(external_this_wp_dom_["getPhrasingContentSchema"])('paste'), {
inline: true
});
HTML = deepFilterHTML(HTML, [htmlFormattingRemover, brRemover]); // Allows us to ask for this information when we get a report.
if (!preserveWhiteSpace) {
HTML = deepFilterHTML(HTML, [htmlFormattingRemover, brRemover]);
} // Allows us to ask for this information when we get a report.
paste_handler_console.log('Processed inline HTML:\n\n', HTML);
return HTML;
@ -12142,6 +12147,7 @@ function htmlToBlocks(_ref) {
* * 'INLINE': Always handle as inline content, and return string.
* * 'BLOCKS': Always handle as blocks, and return array of blocks.
* @param {Array} [options.tagName] The tag into which content will be inserted.
* @param {boolean} [options.preserveWhiteSpace] Whether or not to preserve consequent white space.
*
* @return {Array|string} A list of blocks or a string, depending on `handlerMode`.
*/
@ -12154,7 +12160,8 @@ function pasteHandler(_ref3) {
plainText = _ref3$plainText === void 0 ? '' : _ref3$plainText,
_ref3$mode = _ref3.mode,
mode = _ref3$mode === void 0 ? 'AUTO' : _ref3$mode,
tagName = _ref3.tagName;
tagName = _ref3.tagName,
preserveWhiteSpace = _ref3.preserveWhiteSpace;
// First of all, strip any meta tags.
HTML = HTML.replace(/<meta[^>]+>/g, ''); // Strip Windows markers.
@ -12197,7 +12204,7 @@ function pasteHandler(_ref3) {
}
if (mode === 'INLINE') {
return filterInlineHTML(HTML);
return filterInlineHTML(HTML, preserveWhiteSpace);
} // An array of HTML strings and block objects. The blocks replace matched
// shortcodes.
@ -12209,7 +12216,7 @@ function pasteHandler(_ref3) {
var hasShortcodes = pieces.length > 1;
if (mode === 'AUTO' && !hasShortcodes && isInlineContent(HTML, tagName)) {
return filterInlineHTML(HTML);
return filterInlineHTML(HTML, preserveWhiteSpace);
}
var rawTransforms = getRawTransformations();

File diff suppressed because one or more lines are too long

View File

@ -30138,6 +30138,7 @@ var token_input_TokenInput = /*#__PURE__*/function (_Component) {
onChange: this.onChange,
size: size,
className: classnames_default()(className, 'components-form-token-field__input'),
autoComplete: "off",
role: "combobox",
"aria-expanded": isExpanded,
"aria-autocomplete": "list",
@ -36207,7 +36208,11 @@ var provider_DropZoneProvider = /*#__PURE__*/function (_Component) {
var ownerDocument = this.ref.current.ownerDocument;
var defaultView = ownerDocument.defaultView;
defaultView.addEventListener('dragover', this.onDragOver);
defaultView.addEventListener('mouseup', this.resetDragState);
defaultView.addEventListener('mouseup', this.resetDragState); // Note that `dragend` doesn't fire consistently for file and HTML drag
// events where the drag origin is outside the browser window.
// In Firefox it may also not fire if the originating node is removed.
defaultView.addEventListener('dragend', this.resetDragState);
}
}, {
key: "componentWillUnmount",
@ -36216,6 +36221,7 @@ var provider_DropZoneProvider = /*#__PURE__*/function (_Component) {
var defaultView = ownerDocument.defaultView;
defaultView.removeEventListener('dragover', this.onDragOver);
defaultView.removeEventListener('mouseup', this.resetDragState);
defaultView.removeEventListener('dragend', this.resetDragState);
}
}, {
key: "addDropZone",

File diff suppressed because one or more lines are too long

View File

@ -7186,6 +7186,8 @@ function PageAttributesParent() {
fieldValue = _useState2[0],
setFieldValue = _useState2[1];
var isSearching = fieldValue;
var _useSelect = Object(external_this_wp_data_["useSelect"])(function (select) {
var _select = select('core'),
getPostType = _select.getPostType,
@ -7208,9 +7210,9 @@ function PageAttributesParent() {
orderby: 'menu_order',
order: 'asc',
_fields: 'id,title,parent'
};
}; // Perform a search when the field is changed.
if (parentPost && fieldValue && '' !== fieldValue) {
if (isSearching) {
query.search = fieldValue;
}
@ -7241,14 +7243,31 @@ function PageAttributesParent() {
};
var parentOptions = Object(external_this_wp_element_["useMemo"])(function () {
var tree = buildTermsTree(pageItems.map(function (item) {
var tree = pageItems.map(function (item) {
return {
id: item.id,
parent: item.parent,
name: getTitle(item)
};
}));
var opts = getOptionsFromTree(tree);
}); // Only build a hierarchical tree when not searching.
if (!isSearching) {
tree = buildTermsTree(tree);
}
var opts = getOptionsFromTree(tree); // Ensure the current parent is in the options list.
var optsHasParent = Object(external_this_lodash_["find"])(opts, function (item) {
return item.value === parentPostId;
});
if (parentPost && !optsHasParent) {
opts.unshift({
value: parentPostId,
label: getTitle(parentPost)
});
}
return opts;
}, [pageItems]);

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.6-beta1-49323';
$wp_version = '5.6-beta1-49324';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.