Editor: Update block editor packages for WordPress 5.8.1.

The following packages were updated:
- @wordpress/a11y to `3.1.2`
- @wordpress/annotations to `2.1.6`
- @wordpress/api-fetch to `5.1.2`
- @wordpress/autop to `3.1.2`
- @wordpress/babel-preset-default to `6.2.1`
- @wordpress/blob to `3.1.2`
- @wordpress/block-directory to `2.1.21`
- @wordpress/block-editor to `6.1.14`
- @wordpress/block-library to `3.2.19`
- @wordpress/block-serialization-default-parser to `4.1.2`
- @wordpress/blocks to `9.1.8`
- @wordpress/components to `14.1.11`
- @wordpress/compose to `4.1.6`
- @wordpress/core-data to `3.1.12`
- @wordpress/customize-widgets to `1.0.20`
- @wordpress/data-controls to `2.1.6`
- @wordpress/data to `5.1.6`
- @wordpress/date to `4.1.2`
- @wordpress/deprecated to `3.1.2`
- @wordpress/dom-ready to `3.1.2`
- @wordpress/dom to `3.1.5`
- @wordpress/e2e-test-utils to `5.3.1`
- @wordpress/edit-post to `4.1.21`
- @wordpress/edit-widgets to `2.1.21`
- @wordpress/editor to `10.1.17`
- @wordpress/element to `3.1.2`
- @wordpress/escape-html to `2.1.2`
- @wordpress/format-library to `2.1.14`
- @wordpress/html-entities to `3.1.2`
- @wordpress/i18n to `4.1.2`
- @wordpress/icons to `4.0.3`
- @wordpress/interface to `3.1.12`
- @wordpress/keyboard-shortcuts to `2.1.7`
- @wordpress/keycodes to `3.1.2`
- @wordpress/list-reusable-blocks to `2.1.11`
- @wordpress/media-utils to `2.1.2`
- @wordpress/notices to `3.1.6`
- @wordpress/nux to `4.1.11`
- @wordpress/plugins to `3.1.6`
- @wordpress/primitives to `2.1.2`
- @wordpress/priority-queue to `2.1.2`
- @wordpress/react-i18n to `2.1.2`
- @wordpress/redux-routine to `4.1.2`
- @wordpress/reusable-blocks to `2.1.17`
- @wordpress/rich-text to `4.1.6`
- @wordpress/scripts to `16.1.5`
- @wordpress/server-side-render to `2.1.12`
- @wordpress/shortcode to `3.1.2`
- @wordpress/url to `3.1.2`
- @wordpress/viewport to `3.1.6`
- @wordpress/warning to `2.1.2`
- @wordpress/widgets to `1.1.19`
- @wordpress/wordcount to `3.1.2`

Props oandregal, juanmaguitar, gziolo, jblz, talldanwp, ribaricplusplus, peterwisoncc, youknowriad, paaljoachim, kreppar, ellatrix, aristath, walbo, ajlende, kevin940726, mamaduka, ntsekouras, toro_unit, mkaz, joen, noisysocks, zieladam, andraganescu, antonvlasenko, terraling, dariak, vladytimy, circlecube, desrosj.
Fixes #54052, #52818.
Built from https://develop.svn.wordpress.org/trunk@51719


git-svn-id: http://core.svn.wordpress.org/trunk@51325 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj 2021-09-01 19:08:24 +00:00
parent da38a95d77
commit c886de61f9
31 changed files with 1307 additions and 429 deletions

File diff suppressed because one or more lines are too long

View File

@ -737,7 +737,7 @@
align-self: center; align-self: center;
padding: 0; padding: 0;
list-style: none; list-style: none;
margin: 0 0 0 auto; margin: 8px;
} }
.block-editor-block-list__block .block-list-appender.wp-block { .block-editor-block-list__block .block-list-appender.wp-block {
max-width: none; max-width: none;

File diff suppressed because one or more lines are too long

View File

@ -737,7 +737,7 @@
align-self: center; align-self: center;
padding: 0; padding: 0;
list-style: none; list-style: none;
margin: 0 auto 0 0; margin: 8px;
} }
.block-editor-block-list__block .block-list-appender.wp-block { .block-editor-block-list__block .block-list-appender.wp-block {
max-width: none; max-width: none;

File diff suppressed because one or more lines are too long

View File

@ -439,6 +439,14 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
pointer-events: none; pointer-events: none;
} }
.edit-widgets-error-boundary {
margin: auto;
max-width: 780px;
padding: 20px;
margin-top: 60px;
box-shadow: 0 10px 10px rgba(0, 0, 0, 0.25);
}
.edit-widgets-header { .edit-widgets-header {
display: flex; display: flex;
align-items: center; align-items: center;

File diff suppressed because one or more lines are too long

View File

@ -439,6 +439,14 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
pointer-events: none; pointer-events: none;
} }
.edit-widgets-error-boundary {
margin: auto;
max-width: 780px;
padding: 20px;
margin-top: 60px;
box-shadow: 0 10px 10px rgba(0, 0, 0, 0.25);
}
.edit-widgets-header { .edit-widgets-header {
display: flex; display: flex;
align-items: center; align-items: center;

File diff suppressed because one or more lines are too long

View File

@ -145,6 +145,8 @@
line-height: 1; line-height: 1;
min-height: 30px; min-height: 30px;
padding-right: 8px; padding-right: 8px;
padding-top: 8px;
padding-bottom: 8px;
} }
.wp-block-legacy-widget__edit-form .widget-inside.widget-inside select { .wp-block-legacy-widget__edit-form .widget-inside.widget-inside select {
padding-right: 4px; padding-right: 4px;

File diff suppressed because one or more lines are too long

View File

@ -145,6 +145,8 @@
line-height: 1; line-height: 1;
min-height: 30px; min-height: 30px;
padding-left: 8px; padding-left: 8px;
padding-top: 8px;
padding-bottom: 8px;
} }
.wp-block-legacy-widget__edit-form .widget-inside.widget-inside select { .wp-block-legacy-widget__edit-form .widget-inside.widget-inside select {
padding-left: 4px; padding-left: 4px;

File diff suppressed because one or more lines are too long

View File

@ -17122,6 +17122,26 @@ function DuotoneControl({
/* harmony default export */ var duotone_control = (DuotoneControl); /* harmony default export */ var duotone_control = (DuotoneControl);
// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/head.js
/**
* WordPress dependencies
*/
const head_context = Object(external_wp_element_["createContext"])();
function Head({
children
}) {
const [element, setElement] = Object(external_wp_element_["useState"])();
return Object(external_wp_element_["createElement"])(head_context.Provider, {
value: element
}, Object(external_wp_element_["createElement"])("div", {
ref: setElement
}), children);
}
Head.context = head_context;
// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/duotone.js // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/duotone.js
@ -17139,11 +17159,13 @@ function DuotoneControl({
/** /**
* Internal dependencies * Internal dependencies
*/ */
const duotone_EMPTY_ARRAY = []; const duotone_EMPTY_ARRAY = [];
/** /**
* Convert a list of colors to an object of R, G, and B values. * Convert a list of colors to an object of R, G, and B values.
@ -17334,11 +17356,12 @@ const withDuotoneStyles = Object(external_wp_compose_["createHigherOrderComponen
const selectorsScoped = selectors.map(selector => `.${id} ${selector.trim()}`); const selectorsScoped = selectors.map(selector => `.${id} ${selector.trim()}`);
const selectorsGroup = selectorsScoped.join(', '); const selectorsGroup = selectorsScoped.join(', ');
const className = classnames_default()(props === null || props === void 0 ? void 0 : props.className, id); const className = classnames_default()(props === null || props === void 0 ? void 0 : props.className, id);
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(DuotoneFilter, { const element = Object(external_wp_element_["useContext"])(Head.context);
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, element && Object(external_wp_element_["createPortal"])(Object(external_wp_element_["createElement"])(DuotoneFilter, {
selector: selectorsGroup, selector: selectorsGroup,
id: id, id: id,
values: getValuesFromColors(values) values: getValuesFromColors(values)
}), Object(external_wp_element_["createElement"])(BlockListBlock, Object(esm_extends["a" /* default */])({}, props, { }), element), Object(external_wp_element_["createElement"])(BlockListBlock, Object(esm_extends["a" /* default */])({}, props, {
className: className className: className
}))); })));
}, 'withDuotoneStyles'); }, 'withDuotoneStyles');
@ -17369,6 +17392,7 @@ var build_module_icon = __webpack_require__("iClF");
/** /**
* Internal dependencies * Internal dependencies
*/ */
@ -17378,6 +17402,7 @@ var build_module_icon = __webpack_require__("iClF");
function LayoutPanel({ function LayoutPanel({
setAttributes, setAttributes,
attributes attributes
@ -17536,10 +17561,11 @@ const withLayoutStyles = Object(external_wp_compose_["createHigherOrderComponent
} = attributes; } = attributes;
const usedLayout = !!layout && layout.inherit ? defaultLayout : layout; const usedLayout = !!layout && layout.inherit ? defaultLayout : layout;
const className = classnames_default()(props === null || props === void 0 ? void 0 : props.className, `wp-container-${id}`); const className = classnames_default()(props === null || props === void 0 ? void 0 : props.className, `wp-container-${id}`);
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(LayoutStyle, { const element = Object(external_wp_element_["useContext"])(Head.context);
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, element && Object(external_wp_element_["createPortal"])(Object(external_wp_element_["createElement"])(LayoutStyle, {
selector: `.wp-container-${id}`, selector: `.wp-container-${id}`,
layout: usedLayout layout: usedLayout
}), Object(external_wp_element_["createElement"])(BlockListBlock, Object(esm_extends["a" /* default */])({}, props, { }), element), Object(external_wp_element_["createElement"])(BlockListBlock, Object(esm_extends["a" /* default */])({}, props, {
className: className className: className
}))); })));
}); });
@ -28264,6 +28290,7 @@ function BlockSelectionClearer(props) {
const IntersectionObserver = Object(external_wp_element_["createContext"])(); const IntersectionObserver = Object(external_wp_element_["createContext"])();
function Root({ function Root({
@ -28290,14 +28317,14 @@ function Root({
isNavigationMode: _isNavigationMode() isNavigationMode: _isNavigationMode()
}; };
}, []); }, []);
return Object(external_wp_element_["createElement"])("div", { return Object(external_wp_element_["createElement"])(Head, null, Object(external_wp_element_["createElement"])("div", {
ref: Object(external_wp_compose_["useMergeRefs"])([useBlockSelectionClearer(), useBlockDropZone(), useInBetweenInserter()]), ref: Object(external_wp_compose_["useMergeRefs"])([useBlockSelectionClearer(), useBlockDropZone(), useInBetweenInserter()]),
className: classnames_default()('block-editor-block-list__layout is-root-container', className, { className: classnames_default()('block-editor-block-list__layout is-root-container', className, {
'is-outline-mode': isOutlineMode, 'is-outline-mode': isOutlineMode,
'is-focus-mode': isFocusMode && isLargeViewport, 'is-focus-mode': isFocusMode && isLargeViewport,
'is-navigate-mode': isNavigationMode 'is-navigate-mode': isNavigationMode
}) })
}, children); }, children));
} }
function BlockList({ function BlockList({
@ -39156,12 +39183,11 @@ function useSelectAll() {
return; return;
} }
const selectedClientIds = getSelectedBlockClientIds(); if (!Object(external_wp_dom_["isEntirelySelected"])(event.target)) {
if (selectedClientIds.length === 1 && !Object(external_wp_dom_["isEntirelySelected"])(event.target)) {
return; return;
} }
const selectedClientIds = getSelectedBlockClientIds();
const [firstSelectedClientId] = selectedClientIds; const [firstSelectedClientId] = selectedClientIds;
const rootClientId = getBlockRootClientId(firstSelectedClientId); const rootClientId = getBlockRootClientId(firstSelectedClientId);
let blockClientIds = getBlockOrder(rootClientId); // If we have selected all sibling nested blocks, try selecting up a let blockClientIds = getBlockOrder(rootClientId); // If we have selected all sibling nested blocks, try selecting up a

File diff suppressed because one or more lines are too long

View File

@ -10439,30 +10439,42 @@ function URLPicker({
setAttributes, setAttributes,
opensInNewTab, opensInNewTab,
onToggleOpenInNewTab, onToggleOpenInNewTab,
anchorRef anchorRef,
richTextRef
}) { }) {
const [isURLPickerOpen, setIsURLPickerOpen] = Object(external_wp_element_["useState"])(false); const [isEditingURL, setIsEditingURL] = Object(external_wp_element_["useState"])(false);
const urlIsSet = !!url; const isURLSet = !!url;
const urlIsSetandSelected = urlIsSet && isSelected;
const openLinkControl = () => { const startEditing = event => {
setIsURLPickerOpen(true); event.preventDefault();
return false; // prevents default behaviour for event setIsEditingURL(true);
}; };
const unlinkButton = () => { const unlink = () => {
setAttributes({ setAttributes({
url: undefined, url: undefined,
linkTarget: undefined, linkTarget: undefined,
rel: undefined rel: undefined
}); });
setIsURLPickerOpen(false); setIsEditingURL(false);
}; };
const linkControl = (isURLPickerOpen || urlIsSetandSelected) && Object(external_wp_element_["createElement"])(external_wp_components_["Popover"], { Object(external_wp_element_["useEffect"])(() => {
if (!isSelected) {
setIsEditingURL(false);
}
}, [isSelected]);
const isLinkControlVisible = isSelected && (isEditingURL || isURLSet);
const linkControl = isLinkControlVisible && Object(external_wp_element_["createElement"])(external_wp_components_["Popover"], {
position: "bottom center", position: "bottom center",
onClose: () => setIsURLPickerOpen(false), onClose: () => {
anchorRef: anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current var _richTextRef$current;
setIsEditingURL(false);
(_richTextRef$current = richTextRef.current) === null || _richTextRef$current === void 0 ? void 0 : _richTextRef$current.focus();
},
anchorRef: anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current,
focusOnMount: isEditingURL ? 'firstElement' : false
}, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__experimentalLinkControl"], { }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__experimentalLinkControl"], {
className: "wp-block-navigation-link__inline-link-input", className: "wp-block-navigation-link__inline-link-input",
value: { value: {
@ -10480,28 +10492,40 @@ function URLPicker({
if (opensInNewTab !== newOpensInNewTab) { if (opensInNewTab !== newOpensInNewTab) {
onToggleOpenInNewTab(newOpensInNewTab); onToggleOpenInNewTab(newOpensInNewTab);
} }
} },
onRemove: () => {
var _richTextRef$current2;
unlink();
(_richTextRef$current2 = richTextRef.current) === null || _richTextRef$current2 === void 0 ? void 0 : _richTextRef$current2.focus();
},
forceIsEditingLink: isEditingURL
})); }));
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], { return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], {
group: "block" group: "block"
}, !urlIsSet && Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { }, !isURLSet && Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], {
name: "link", name: "link",
icon: library_link["a" /* default */], icon: library_link["a" /* default */],
title: Object(external_wp_i18n_["__"])('Link'), title: Object(external_wp_i18n_["__"])('Link'),
shortcut: external_wp_keycodes_["displayShortcut"].primary('k'), shortcut: external_wp_keycodes_["displayShortcut"].primary('k'),
onClick: openLinkControl onClick: startEditing
}), urlIsSetandSelected && Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { }), isURLSet && Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], {
name: "link", name: "link",
icon: link_off["a" /* default */], icon: link_off["a" /* default */],
title: Object(external_wp_i18n_["__"])('Unlink'), title: Object(external_wp_i18n_["__"])('Unlink'),
shortcut: external_wp_keycodes_["displayShortcut"].primaryShift('k'), shortcut: external_wp_keycodes_["displayShortcut"].primaryShift('k'),
onClick: unlinkButton, onClick: unlink,
isActive: true isActive: true
})), isSelected && Object(external_wp_element_["createElement"])(external_wp_components_["KeyboardShortcuts"], { })), isSelected && Object(external_wp_element_["createElement"])(external_wp_components_["KeyboardShortcuts"], {
bindGlobal: true, bindGlobal: true,
shortcuts: { shortcuts: {
[external_wp_keycodes_["rawShortcut"].primary('k')]: openLinkControl, [external_wp_keycodes_["rawShortcut"].primary('k')]: startEditing,
[external_wp_keycodes_["rawShortcut"].primaryShift('k')]: unlinkButton [external_wp_keycodes_["rawShortcut"].primaryShift('k')]: () => {
var _richTextRef$current3;
unlink();
(_richTextRef$current3 = richTextRef.current) === null || _richTextRef$current3 === void 0 ? void 0 : _richTextRef$current3.focus();
}
} }
}), linkControl); }), linkControl);
} }
@ -10557,6 +10581,7 @@ function ButtonEdit(props) {
const borderRadius = style === null || style === void 0 ? void 0 : (_style$border = style.border) === null || _style$border === void 0 ? void 0 : _style$border.radius; const borderRadius = style === null || style === void 0 ? void 0 : (_style$border = style.border) === null || _style$border === void 0 ? void 0 : _style$border.radius;
const colorProps = Object(external_wp_blockEditor_["__experimentalUseColorProps"])(attributes); const colorProps = Object(external_wp_blockEditor_["__experimentalUseColorProps"])(attributes);
const ref = Object(external_wp_element_["useRef"])(); const ref = Object(external_wp_element_["useRef"])();
const richTextRef = Object(external_wp_element_["useRef"])();
const blockProps = Object(external_wp_blockEditor_["useBlockProps"])({ const blockProps = Object(external_wp_blockEditor_["useBlockProps"])({
ref ref
}); });
@ -10566,6 +10591,7 @@ function ButtonEdit(props) {
[`has-custom-font-size`]: blockProps.style.fontSize [`has-custom-font-size`]: blockProps.style.fontSize
}) })
}), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"], { }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"], {
ref: richTextRef,
"aria-label": Object(external_wp_i18n_["__"])('Button text'), "aria-label": Object(external_wp_i18n_["__"])('Button text'),
placeholder: placeholder || Object(external_wp_i18n_["__"])('Add text…'), placeholder: placeholder || Object(external_wp_i18n_["__"])('Add text…'),
value: text, value: text,
@ -10590,7 +10616,8 @@ function ButtonEdit(props) {
isSelected: isSelected, isSelected: isSelected,
opensInNewTab: linkTarget === '_blank', opensInNewTab: linkTarget === '_blank',
onToggleOpenInNewTab: onToggleOpenInNewTab, onToggleOpenInNewTab: onToggleOpenInNewTab,
anchorRef: ref anchorRef: ref,
richTextRef: richTextRef
}), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorControls"], null, Object(external_wp_element_["createElement"])(WidthPanel, { }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorControls"], null, Object(external_wp_element_["createElement"])(WidthPanel, {
selectedWidth: width, selectedWidth: width,
setAttributes: setAttributes setAttributes: setAttributes

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -927,11 +927,24 @@ var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_w
// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/batch/default-processor.js // CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/batch/default-processor.js
/** /**
* WordPress dependencies * External dependencies
*/ */
/** /**
* Default batch processor. Sends its input requests to /v1/batch. * WordPress dependencies
*/
/**
* Maximum number of requests to place in a single batch request. Obtained by
* sending a preflight OPTIONS request to /batch/v1/.
*
* @type {number?}
*/
let maxItems = null;
/**
* Default batch processor. Sends its input requests to /batch/v1.
* *
* @param {Array} requests List of API requests to perform at once. * @param {Array} requests List of API requests to perform at once.
* *
@ -941,38 +954,55 @@ var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_w
*/ */
async function defaultProcessor(requests) { async function defaultProcessor(requests) {
const batchResponse = await external_wp_apiFetch_default()({ if (maxItems === null) {
path: '/batch/v1', const preflightResponse = await external_wp_apiFetch_default()({
method: 'POST', path: '/batch/v1',
data: { method: 'OPTIONS'
validation: 'require-all-validate', });
requests: requests.map(request => ({ maxItems = preflightResponse.endpoints[0].args.requests.maxItems;
path: request.path,
body: request.data,
// Rename 'data' to 'body'.
method: request.method,
headers: request.headers
}))
}
});
if (batchResponse.failed) {
return batchResponse.responses.map(response => ({
error: response === null || response === void 0 ? void 0 : response.body
}));
} }
return batchResponse.responses.map(response => { const results = [];
const result = {};
if (response.status >= 200 && response.status < 300) { for (const batchRequests of Object(external_lodash_["chunk"])(requests, maxItems)) {
result.output = response.body; const batchResponse = await external_wp_apiFetch_default()({
path: '/batch/v1',
method: 'POST',
data: {
validation: 'require-all-validate',
requests: batchRequests.map(request => ({
path: request.path,
body: request.data,
// Rename 'data' to 'body'.
method: request.method,
headers: request.headers
}))
}
});
let batchResults;
if (batchResponse.failed) {
batchResults = batchResponse.responses.map(response => ({
error: response === null || response === void 0 ? void 0 : response.body
}));
} else { } else {
result.error = response.body; batchResults = batchResponse.responses.map(response => {
const result = {};
if (response.status >= 200 && response.status < 300) {
result.output = response.body;
} else {
result.error = response.body;
}
return result;
});
} }
return result; results.push(...batchResults);
}); }
return results;
} }
// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/batch/create-batch.js // CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/batch/create-batch.js

File diff suppressed because one or more lines are too long

View File

@ -122,11 +122,14 @@ __webpack_require__.d(__webpack_exports__, "initialize", function() { return /*
var selectors_namespaceObject = {}; var selectors_namespaceObject = {};
__webpack_require__.r(selectors_namespaceObject); __webpack_require__.r(selectors_namespaceObject);
__webpack_require__.d(selectors_namespaceObject, "__unstableIsFeatureActive", function() { return __unstableIsFeatureActive; }); __webpack_require__.d(selectors_namespaceObject, "__unstableIsFeatureActive", function() { return __unstableIsFeatureActive; });
__webpack_require__.d(selectors_namespaceObject, "isInserterOpened", function() { return selectors_isInserterOpened; });
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetInsertionPoint", function() { return __experimentalGetInsertionPoint; });
// NAMESPACE OBJECT: ./node_modules/@wordpress/customize-widgets/build-module/store/actions.js // NAMESPACE OBJECT: ./node_modules/@wordpress/customize-widgets/build-module/store/actions.js
var actions_namespaceObject = {}; var actions_namespaceObject = {};
__webpack_require__.r(actions_namespaceObject); __webpack_require__.r(actions_namespaceObject);
__webpack_require__.d(actions_namespaceObject, "__unstableToggleFeature", function() { return __unstableToggleFeature; }); __webpack_require__.d(actions_namespaceObject, "__unstableToggleFeature", function() { return __unstableToggleFeature; });
__webpack_require__.d(actions_namespaceObject, "setIsInserterOpened", function() { return actions_setIsInserterOpened; });
// EXTERNAL MODULE: external ["wp","element"] // EXTERNAL MODULE: external ["wp","element"]
var external_wp_element_ = __webpack_require__("GRId"); var external_wp_element_ = __webpack_require__("GRId");
@ -143,6 +146,72 @@ var external_wp_blocks_ = __webpack_require__("HSyU");
// EXTERNAL MODULE: external ["wp","components"] // EXTERNAL MODULE: external ["wp","components"]
var external_wp_components_ = __webpack_require__("tI+e"); var external_wp_components_ = __webpack_require__("tI+e");
// EXTERNAL MODULE: external ["wp","i18n"]
var external_wp_i18n_ = __webpack_require__("l3Sj");
// EXTERNAL MODULE: external ["wp","blockEditor"]
var external_wp_blockEditor_ = __webpack_require__("axFQ");
// EXTERNAL MODULE: external ["wp","compose"]
var external_wp_compose_ = __webpack_require__("K9lf");
// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/error-boundary/index.js
/**
* WordPress dependencies
*/
function CopyButton({
text,
children
}) {
const ref = Object(external_wp_compose_["useCopyToClipboard"])(text);
return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
variant: "secondary",
ref: ref
}, children);
}
class error_boundary_ErrorBoundary extends external_wp_element_["Component"] {
constructor() {
super(...arguments);
this.state = {
error: null
};
}
componentDidCatch(error) {
this.setState({
error
});
}
render() {
const {
error
} = this.state;
if (!error) {
return this.props.children;
}
return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["Warning"], {
className: "customize-widgets-error-boundary",
actions: [Object(external_wp_element_["createElement"])(CopyButton, {
key: "copy-error",
text: error.stack
}, Object(external_wp_i18n_["__"])('Copy Error'))]
}, Object(external_wp_i18n_["__"])('The editor has encountered an unexpected error.'));
}
}
// EXTERNAL MODULE: external "lodash" // EXTERNAL MODULE: external "lodash"
var external_lodash_ = __webpack_require__("YLtl"); var external_lodash_ = __webpack_require__("YLtl");
@ -152,18 +221,12 @@ var external_wp_coreData_ = __webpack_require__("jZUy");
// EXTERNAL MODULE: external ["wp","data"] // EXTERNAL MODULE: external ["wp","data"]
var external_wp_data_ = __webpack_require__("1ZqX"); var external_wp_data_ = __webpack_require__("1ZqX");
// EXTERNAL MODULE: external ["wp","blockEditor"]
var external_wp_blockEditor_ = __webpack_require__("axFQ");
// EXTERNAL MODULE: external ["wp","mediaUtils"] // EXTERNAL MODULE: external ["wp","mediaUtils"]
var external_wp_mediaUtils_ = __webpack_require__("6aBm"); var external_wp_mediaUtils_ = __webpack_require__("6aBm");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
var esm_extends = __webpack_require__("wx14"); var esm_extends = __webpack_require__("wx14");
// EXTERNAL MODULE: external ["wp","i18n"]
var external_wp_i18n_ = __webpack_require__("l3Sj");
// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/block-inspector-button/index.js // CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/block-inspector-button/index.js
@ -214,66 +277,9 @@ var library_redo = __webpack_require__("K2cm");
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js
var plus = __webpack_require__("Q4Sy"); var plus = __webpack_require__("Q4Sy");
// EXTERNAL MODULE: external ["wp","compose"]
var external_wp_compose_ = __webpack_require__("K9lf");
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js
var close_small = __webpack_require__("bWcr"); var close_small = __webpack_require__("bWcr");
// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/inserter/index.js
/**
* WordPress dependencies
*/
function Inserter({
setIsOpened
}) {
const inserterTitleId = Object(external_wp_compose_["useInstanceId"])(Inserter, 'customize-widget-layout__inserter-panel-title');
return Object(external_wp_element_["createElement"])("div", {
className: "customize-widgets-layout__inserter-panel",
"aria-labelledby": inserterTitleId
}, Object(external_wp_element_["createElement"])("div", {
className: "customize-widgets-layout__inserter-panel-header"
}, Object(external_wp_element_["createElement"])("h2", {
id: inserterTitleId,
className: "customize-widgets-layout__inserter-panel-header-title"
}, Object(external_wp_i18n_["__"])('Add a block')), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
className: "customize-widgets-layout__inserter-panel-header-close-button",
icon: close_small["a" /* default */],
onClick: () => setIsOpened(false),
"aria-label": Object(external_wp_i18n_["__"])('Close inserter')
})), Object(external_wp_element_["createElement"])("div", {
className: "customize-widgets-layout__inserter-panel-content"
}, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__experimentalLibrary"], {
showInserterHelpPanel: true,
onSelect: () => setIsOpened(false)
})));
}
/* harmony default export */ var components_inserter = (Inserter);
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js
var more_vertical = __webpack_require__("VKE3");
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js
var external = __webpack_require__("K+tz");
// EXTERNAL MODULE: external ["wp","keyboardShortcuts"]
var external_wp_keyboardShortcuts_ = __webpack_require__("hF7m");
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
var check = __webpack_require__("RMJe");
// EXTERNAL MODULE: external ["wp","a11y"]
var external_wp_a11y_ = __webpack_require__("gdqT");
// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/store/defaults.js // CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/store/defaults.js
const PREFERENCES_DEFAULTS = { const PREFERENCES_DEFAULTS = {
features: { features: {
@ -309,6 +315,22 @@ const PREFERENCES_DEFAULTS = {
const createWithInitialState = initialState => reducer => { const createWithInitialState = initialState => reducer => {
return (state = initialState, action) => reducer(state, action); return (state = initialState, action) => reducer(state, action);
}; };
/**
* Reducer tracking whether the inserter is open.
*
* @param {boolean|Object} state
* @param {Object} action
*/
function blockInserterPanel(state = false, action) {
switch (action.type) {
case 'SET_IS_INSERTER_OPENED':
return action.value;
}
return state;
}
/** /**
* Reducer returning the user preferences. * Reducer returning the user preferences.
* *
@ -332,6 +354,7 @@ const preferences = Object(external_lodash_["flow"])([external_wp_data_["combine
}); });
/* harmony default export */ var reducer = (Object(external_wp_data_["combineReducers"])({ /* harmony default export */ var reducer = (Object(external_wp_data_["combineReducers"])({
blockInserterPanel,
preferences preferences
})); }));
@ -356,6 +379,35 @@ const preferences = Object(external_lodash_["flow"])([external_wp_data_["combine
function __unstableIsFeatureActive(state, feature) { function __unstableIsFeatureActive(state, feature) {
return Object(external_lodash_["get"])(state.preferences.features, [feature], false); return Object(external_lodash_["get"])(state.preferences.features, [feature], false);
} }
/**
* Returns true if the inserter is opened.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether the inserter is opened.
*/
function selectors_isInserterOpened(state) {
return !!state.blockInserterPanel;
}
/**
* Get the insertion point for the inserter.
*
* @param {Object} state Global application state.
*
* @return {Object} The root client ID and index to insert at.
*/
function __experimentalGetInsertionPoint(state) {
const {
rootClientId,
insertionIndex
} = state.blockInserterPanel;
return {
rootClientId,
insertionIndex
};
}
// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/store/actions.js // CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/store/actions.js
/** /**
@ -375,6 +427,25 @@ function __unstableToggleFeature(feature) {
feature feature
}; };
} }
/**
* Returns an action object used to open/close the inserter.
*
* @param {boolean|Object} value Whether the inserter should be
* opened (true) or closed (false).
* To specify an insertion point,
* use an object.
* @param {string} value.rootClientId The root client ID to insert at.
* @param {number} value.insertionIndex The index to insert at.
*
* @return {Object} Action object.
*/
function actions_setIsInserterOpened(value) {
return {
type: 'SET_IS_INSERTER_OPENED',
value
};
}
// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/store/constants.js // CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/store/constants.js
/** /**
@ -422,6 +493,69 @@ const store = Object(external_wp_data_["createReduxStore"])(STORE_NAME, storeCon
Object(external_wp_data_["registerStore"])(STORE_NAME, storeConfig); Object(external_wp_data_["registerStore"])(STORE_NAME, storeConfig);
// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/inserter/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function Inserter({
setIsOpened
}) {
const inserterTitleId = Object(external_wp_compose_["useInstanceId"])(Inserter, 'customize-widget-layout__inserter-panel-title');
const insertionPoint = Object(external_wp_data_["useSelect"])(select => select(store).__experimentalGetInsertionPoint());
return Object(external_wp_element_["createElement"])("div", {
className: "customize-widgets-layout__inserter-panel",
"aria-labelledby": inserterTitleId
}, Object(external_wp_element_["createElement"])("div", {
className: "customize-widgets-layout__inserter-panel-header"
}, Object(external_wp_element_["createElement"])("h2", {
id: inserterTitleId,
className: "customize-widgets-layout__inserter-panel-header-title"
}, Object(external_wp_i18n_["__"])('Add a block')), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
className: "customize-widgets-layout__inserter-panel-header-close-button",
icon: close_small["a" /* default */],
onClick: () => setIsOpened(false),
"aria-label": Object(external_wp_i18n_["__"])('Close inserter')
})), Object(external_wp_element_["createElement"])("div", {
className: "customize-widgets-layout__inserter-panel-content"
}, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__experimentalLibrary"], {
rootClientId: insertionPoint.rootClientId,
__experimentalInsertionIndex: insertionPoint.insertionIndex,
showInserterHelpPanel: true,
onSelect: () => setIsOpened(false)
})));
}
/* harmony default export */ var components_inserter = (Inserter);
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js
var more_vertical = __webpack_require__("VKE3");
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js
var external = __webpack_require__("K+tz");
// EXTERNAL MODULE: external ["wp","keyboardShortcuts"]
var external_wp_keyboardShortcuts_ = __webpack_require__("hF7m");
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
var check = __webpack_require__("RMJe");
// EXTERNAL MODULE: external ["wp","a11y"]
var external_wp_a11y_ = __webpack_require__("gdqT");
// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/more-menu/feature-toggle.js // CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/components/more-menu/feature-toggle.js
@ -804,7 +938,7 @@ function MoreMenu() {
}), Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { }), Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], {
role: "menuitem", role: "menuitem",
icon: external["a" /* default */], icon: external["a" /* default */],
href: Object(external_wp_i18n_["__"])('https://wordpress.org/support/article/wordpress-editor/'), href: Object(external_wp_i18n_["__"])('https://wordpress.org/support/article/block-based-widgets-editor/'),
target: "_blank", target: "_blank",
rel: "noopener noreferrer" rel: "noopener noreferrer"
}, Object(external_wp_i18n_["__"])('Help'), Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { }, Object(external_wp_i18n_["__"])('Help'), Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], {
@ -914,24 +1048,33 @@ function Header({
* WordPress dependencies * WordPress dependencies
*/ */
/**
* Internal dependencies
*/
function useInserter(inserter) { function useInserter(inserter) {
const [isInserterOpened, setIsInserterOpened] = Object(external_wp_element_["useState"])(() => inserter.isOpen); const isInserterOpened = Object(external_wp_data_["useSelect"])(select => select(store).isInserterOpened());
const {
setIsInserterOpened
} = Object(external_wp_data_["useDispatch"])(store);
Object(external_wp_element_["useEffect"])(() => { Object(external_wp_element_["useEffect"])(() => {
return inserter.subscribe(setIsInserterOpened); if (isInserterOpened) {
}, [inserter]);
return [isInserterOpened, Object(external_wp_element_["useCallback"])(updater => {
let isOpen = updater;
if (typeof updater === 'function') {
isOpen = updater(inserter.isOpen);
}
if (isOpen) {
inserter.open(); inserter.open();
} else { } else {
inserter.close(); inserter.close();
} }
}, [inserter])]; }, [inserter, isInserterOpened]);
return [isInserterOpened, Object(external_wp_element_["useCallback"])(updater => {
let isOpen = updater;
if (typeof updater === 'function') {
isOpen = updater(Object(external_wp_data_["select"])(store).isInserterOpened());
}
setIsInserterOpened(isOpen);
}, [setIsInserterOpened])];
} }
// EXTERNAL MODULE: external ["wp","isShallowEqual"] // EXTERNAL MODULE: external ["wp","isShallowEqual"]
@ -1542,7 +1685,7 @@ function SidebarBlockEditor({
keepCaretInsideBlock, keepCaretInsideBlock,
__unstableHasCustomAppender: true __unstableHasCustomAppender: true
}; };
}, [hasUploadPermissions, blockEditorSettings, isFixedToolbarActive, keepCaretInsideBlock]); }, [hasUploadPermissions, blockEditorSettings, isFixedToolbarActive, keepCaretInsideBlock, setIsInserterOpened]);
if (isWelcomeGuideActive) { if (isWelcomeGuideActive) {
return Object(external_wp_element_["createElement"])(WelcomeGuide, { return Object(external_wp_element_["createElement"])(WelcomeGuide, {
@ -1696,6 +1839,7 @@ function useClearSelectedBlock(sidebarControl, popoverRef) {
function CustomizeWidgets({ function CustomizeWidgets({
api, api,
sidebarControls, sidebarControls,
@ -1715,13 +1859,13 @@ function CustomizeWidgets({
unsubscribers.forEach(unsubscriber => unsubscriber()); unsubscribers.forEach(unsubscriber => unsubscriber());
}; };
}, [sidebarControls]); }, [sidebarControls]);
const activeSidebar = activeSidebarControl && Object(external_wp_element_["createPortal"])(Object(external_wp_element_["createElement"])(SidebarBlockEditor, { const activeSidebar = activeSidebarControl && Object(external_wp_element_["createPortal"])(Object(external_wp_element_["createElement"])(error_boundary_ErrorBoundary, null, Object(external_wp_element_["createElement"])(SidebarBlockEditor, {
key: activeSidebarControl.id, key: activeSidebarControl.id,
blockEditorSettings: blockEditorSettings, blockEditorSettings: blockEditorSettings,
sidebar: activeSidebarControl.sidebarAdapter, sidebar: activeSidebarControl.sidebarAdapter,
inserter: activeSidebarControl.inserter, inserter: activeSidebarControl.inserter,
inspector: activeSidebarControl.inspector inspector: activeSidebarControl.inspector
}), activeSidebarControl.container[0]); // We have to portal this to the parent of both the editor and the inspector, })), activeSidebarControl.container[0]); // We have to portal this to the parent of both the editor and the inspector,
// so that the popovers will appear above both of them. // so that the popovers will appear above both of them.
const popover = parentContainer && Object(external_wp_element_["createPortal"])(Object(external_wp_element_["createElement"])("div", { const popover = parentContainer && Object(external_wp_element_["createPortal"])(Object(external_wp_element_["createElement"])("div", {
@ -1838,7 +1982,9 @@ function getSidebarSection() {
var _args$completeCallbac; var _args$completeCallbac;
controls.forEach(control => { controls.forEach(control => {
control.onChangeSectionExpanded(expanded, args); var _control$onChangeSect;
(_control$onChangeSect = control.onChangeSectionExpanded) === null || _control$onChangeSect === void 0 ? void 0 : _control$onChangeSect.call(control, expanded, args);
}); });
(_args$completeCallbac = _args.completeCallback) === null || _args$completeCallbac === void 0 ? void 0 : _args$completeCallbac.call(_args); (_args$completeCallbac = _args.completeCallback) === null || _args$completeCallbac === void 0 ? void 0 : _args$completeCallbac.call(_args);
} }
@ -2204,6 +2350,12 @@ var external_wp_dom_ = __webpack_require__("1CF3");
*/ */
/**
* Internal dependencies
*/
function getInserterOuterSection() { function getInserterOuterSection() {
const { const {
wp: { wp: {
@ -2242,28 +2394,31 @@ function getInserterOuterSection() {
const ownerWindow = this.contentContainer[0].ownerDocument.defaultView; // Handle closing the inserter when pressing the Escape key. const ownerWindow = this.contentContainer[0].ownerDocument.defaultView; // Handle closing the inserter when pressing the Escape key.
ownerWindow.addEventListener('keydown', event => { ownerWindow.addEventListener('keydown', event => {
if (this.isOpen && (event.keyCode === external_wp_keycodes_["ESCAPE"] || event.code === 'Escape')) { if (this.expanded() && (event.keyCode === external_wp_keycodes_["ESCAPE"] || event.code === 'Escape')) {
event.stopPropagation(); event.stopPropagation();
this.close(); Object(external_wp_data_["dispatch"])(store).setIsInserterOpened(false);
} }
}, // Use capture mode to make this run before other event listeners. }, // Use capture mode to make this run before other event listeners.
true); true);
this.contentContainer.addClass('widgets-inserter'); this.contentContainer.addClass('widgets-inserter'); // Set a flag if the state is being changed from open() or close().
} // Don't propagate the event if it's an internal action to prevent infinite loop.
get isOpen() { this.isFromInternalAction = false;
return this.expanded(); this.expanded.bind(() => {
} if (!this.isFromInternalAction) {
// Propagate the event to React to sync the state.
Object(external_wp_data_["dispatch"])(store).setIsInserterOpened(this.expanded());
}
subscribe(handler) { this.isFromInternalAction = false;
this.expanded.bind(handler); });
return () => this.expanded.unbind(handler);
} }
open() { open() {
if (!this.isOpen) { if (!this.expanded()) {
const contentContainer = this.contentContainer[0]; const contentContainer = this.contentContainer[0];
this.activeElementBeforeExpanded = contentContainer.ownerDocument.activeElement; this.activeElementBeforeExpanded = contentContainer.ownerDocument.activeElement;
this.isFromInternalAction = true;
this.expand({ this.expand({
completeCallback() { completeCallback() {
// We have to do this in a "completeCallback" or else the elements will not yet be visible/tabbable. // We have to do this in a "completeCallback" or else the elements will not yet be visible/tabbable.
@ -2281,9 +2436,10 @@ function getInserterOuterSection() {
} }
close() { close() {
if (this.isOpen) { if (this.expanded()) {
const contentContainer = this.contentContainer[0]; const contentContainer = this.contentContainer[0];
const activeElement = contentContainer.ownerDocument.activeElement; const activeElement = contentContainer.ownerDocument.activeElement;
this.isFromInternalAction = true;
this.collapse({ this.collapse({
completeCallback() { completeCallback() {
// Return back the focus when closing the inserter. // Return back the focus when closing the inserter.
@ -2307,12 +2463,18 @@ function getInserterOuterSection() {
} }
// CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/controls/sidebar-control.js // CONCATENATED MODULE: ./node_modules/@wordpress/customize-widgets/build-module/controls/sidebar-control.js
/**
* WordPress dependencies
*/
/** /**
* Internal dependencies * Internal dependencies
*/ */
const getInserterId = controlId => `widgets-inserter-${controlId}`; const getInserterId = controlId => `widgets-inserter-${controlId}`;
function getSidebarControl() { function getSidebarControl() {
@ -2347,7 +2509,7 @@ function getSidebarControl() {
if (!args.unchanged) { if (!args.unchanged) {
// Close the inserter when the section collapses. // Close the inserter when the section collapses.
if (!expanded) { if (!expanded) {
this.inserter.close(); Object(external_wp_data_["dispatch"])(store).setIsInserterOpened(false);
} }
this.subscribers.forEach(subscriber => subscriber(expanded, args)); this.subscribers.forEach(subscriber => subscriber(expanded, args));

File diff suppressed because one or more lines are too long

View File

@ -755,6 +755,55 @@ function isPlainObject(obj) {
return Object.getPrototypeOf(obj) === proto; return Object.getPrototypeOf(obj) === proto;
} }
// Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of
function miniKindOf(val) {
if (val === void 0) return 'undefined';
if (val === null) return 'null';
var type = typeof val;
switch (type) {
case 'boolean':
case 'string':
case 'number':
case 'symbol':
case 'function':
{
return type;
}
}
if (Array.isArray(val)) return 'array';
if (isDate(val)) return 'date';
if (isError(val)) return 'error';
var constructorName = ctorName(val);
switch (constructorName) {
case 'Symbol':
case 'Promise':
case 'WeakMap':
case 'WeakSet':
case 'Map':
case 'Set':
return constructorName;
} // other
return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
}
function ctorName(val) {
return typeof val.constructor === 'function' ? val.constructor.name : null;
}
function isError(val) {
return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number';
}
function isDate(val) {
if (val instanceof Date) return true;
return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function';
}
function kindOf(val) { function kindOf(val) {
var typeOfVal = typeof val; var typeOfVal = typeof val;

View File

@ -634,6 +634,7 @@ __webpack_require__.d(actions_namespaceObject, "setIsInserterOpened", function()
__webpack_require__.d(actions_namespaceObject, "setIsListViewOpened", function() { return setIsListViewOpened; }); __webpack_require__.d(actions_namespaceObject, "setIsListViewOpened", function() { return setIsListViewOpened; });
__webpack_require__.d(actions_namespaceObject, "setIsEditingTemplate", function() { return setIsEditingTemplate; }); __webpack_require__.d(actions_namespaceObject, "setIsEditingTemplate", function() { return setIsEditingTemplate; });
__webpack_require__.d(actions_namespaceObject, "__unstableSwitchToTemplateMode", function() { return __unstableSwitchToTemplateMode; }); __webpack_require__.d(actions_namespaceObject, "__unstableSwitchToTemplateMode", function() { return __unstableSwitchToTemplateMode; });
__webpack_require__.d(actions_namespaceObject, "initializeMetaBoxes", function() { return initializeMetaBoxes; });
// NAMESPACE OBJECT: ./node_modules/@wordpress/edit-post/build-module/store/selectors.js // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-post/build-module/store/selectors.js
var selectors_namespaceObject = {}; var selectors_namespaceObject = {};
@ -656,13 +657,14 @@ __webpack_require__.d(selectors_namespaceObject, "isMetaBoxLocationVisible", fun
__webpack_require__.d(selectors_namespaceObject, "isMetaBoxLocationActive", function() { return isMetaBoxLocationActive; }); __webpack_require__.d(selectors_namespaceObject, "isMetaBoxLocationActive", function() { return isMetaBoxLocationActive; });
__webpack_require__.d(selectors_namespaceObject, "getMetaBoxesPerLocation", function() { return getMetaBoxesPerLocation; }); __webpack_require__.d(selectors_namespaceObject, "getMetaBoxesPerLocation", function() { return getMetaBoxesPerLocation; });
__webpack_require__.d(selectors_namespaceObject, "getAllMetaBoxes", function() { return getAllMetaBoxes; }); __webpack_require__.d(selectors_namespaceObject, "getAllMetaBoxes", function() { return getAllMetaBoxes; });
__webpack_require__.d(selectors_namespaceObject, "hasMetaBoxes", function() { return hasMetaBoxes; }); __webpack_require__.d(selectors_namespaceObject, "hasMetaBoxes", function() { return selectors_hasMetaBoxes; });
__webpack_require__.d(selectors_namespaceObject, "isSavingMetaBoxes", function() { return selectors_isSavingMetaBoxes; }); __webpack_require__.d(selectors_namespaceObject, "isSavingMetaBoxes", function() { return selectors_isSavingMetaBoxes; });
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetPreviewDeviceType", function() { return __experimentalGetPreviewDeviceType; }); __webpack_require__.d(selectors_namespaceObject, "__experimentalGetPreviewDeviceType", function() { return __experimentalGetPreviewDeviceType; });
__webpack_require__.d(selectors_namespaceObject, "isInserterOpened", function() { return isInserterOpened; }); __webpack_require__.d(selectors_namespaceObject, "isInserterOpened", function() { return isInserterOpened; });
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetInsertionPoint", function() { return __experimentalGetInsertionPoint; }); __webpack_require__.d(selectors_namespaceObject, "__experimentalGetInsertionPoint", function() { return __experimentalGetInsertionPoint; });
__webpack_require__.d(selectors_namespaceObject, "isListViewOpened", function() { return isListViewOpened; }); __webpack_require__.d(selectors_namespaceObject, "isListViewOpened", function() { return isListViewOpened; });
__webpack_require__.d(selectors_namespaceObject, "isEditingTemplate", function() { return selectors_isEditingTemplate; }); __webpack_require__.d(selectors_namespaceObject, "isEditingTemplate", function() { return selectors_isEditingTemplate; });
__webpack_require__.d(selectors_namespaceObject, "areMetaBoxesInitialized", function() { return areMetaBoxesInitialized; });
__webpack_require__.d(selectors_namespaceObject, "getEditedPostTemplate", function() { return getEditedPostTemplate; }); __webpack_require__.d(selectors_namespaceObject, "getEditedPostTemplate", function() { return getEditedPostTemplate; });
// EXTERNAL MODULE: external ["wp","data"] // EXTERNAL MODULE: external ["wp","data"]
@ -1005,10 +1007,29 @@ function isEditingTemplate(state = false, action) {
return state; return state;
} }
/**
* Reducer tracking whether meta boxes are initialized.
*
* @param {boolean} state
* @param {Object} action
*
* @return {boolean} Updated state.
*/
function metaBoxesInitialized(state = false, action) {
switch (action.type) {
case 'META_BOXES_INITIALIZED':
return true;
}
return state;
}
const metaBoxes = Object(external_wp_data_["combineReducers"])({ const metaBoxes = Object(external_wp_data_["combineReducers"])({
isSaving: isSavingMetaBoxes, isSaving: isSavingMetaBoxes,
locations: metaBoxLocations locations: metaBoxLocations,
initialized: metaBoxesInitialized
}); });
/* harmony default export */ var reducer = (Object(external_wp_data_["combineReducers"])({ /* harmony default export */ var reducer = (Object(external_wp_data_["combineReducers"])({
activeModal, activeModal,
@ -1301,7 +1322,6 @@ function showBlockTypes(blockNames) {
blockNames: Object(external_lodash_["castArray"])(blockNames) blockNames: Object(external_lodash_["castArray"])(blockNames)
}; };
} }
let saveMetaboxUnsubscribe;
/** /**
* Returns an action object used in signaling * Returns an action object used in signaling
* what Meta boxes are available in which location. * what Meta boxes are available in which location.
@ -1316,38 +1336,6 @@ function* setAvailableMetaBoxesPerLocation(metaBoxesPerLocation) {
type: 'SET_META_BOXES_PER_LOCATIONS', type: 'SET_META_BOXES_PER_LOCATIONS',
metaBoxesPerLocation metaBoxesPerLocation
}; };
const postType = yield external_wp_data_["controls"].select('core/editor', 'getCurrentPostType');
if (window.postboxes.page !== postType) {
window.postboxes.add_postbox_toggles(postType);
}
let wasSavingPost = yield external_wp_data_["controls"].select('core/editor', 'isSavingPost');
let wasAutosavingPost = yield external_wp_data_["controls"].select('core/editor', 'isAutosavingPost'); // Meta boxes are initialized once at page load. It is not necessary to
// account for updates on each state change.
//
// See: https://github.com/WordPress/WordPress/blob/5.1.1/wp-admin/includes/post.php#L2307-L2309
const hasActiveMetaBoxes = yield external_wp_data_["controls"].select(store.name, 'hasMetaBoxes'); // First remove any existing subscription in order to prevent multiple saves
if (!!saveMetaboxUnsubscribe) {
saveMetaboxUnsubscribe();
} // Save metaboxes when performing a full save on the post.
saveMetaboxUnsubscribe = Object(external_wp_data_["subscribe"])(() => {
const isSavingPost = Object(external_wp_data_["select"])('core/editor').isSavingPost();
const isAutosavingPost = Object(external_wp_data_["select"])('core/editor').isAutosavingPost(); // Save metaboxes on save completion, except for autosaves that are not a post preview.
const shouldTriggerMetaboxesSave = hasActiveMetaBoxes && wasSavingPost && !isSavingPost && !wasAutosavingPost; // Save current state for next inspection.
wasSavingPost = isSavingPost;
wasAutosavingPost = isAutosavingPost;
if (shouldTriggerMetaboxesSave) {
Object(external_wp_data_["dispatch"])(store.name).requestMetaBoxUpdates();
}
});
} }
/** /**
* Returns an action object used to request meta box update. * Returns an action object used to request meta box update.
@ -1485,6 +1473,55 @@ function* __unstableSwitchToTemplateMode(template) {
}); });
} }
} }
let actions_metaBoxesInitialized = false;
/**
* Initializes WordPress `postboxes` script and the logic for saving meta boxes.
*/
function* initializeMetaBoxes() {
const isEditorReady = yield external_wp_data_["controls"].select('core/editor', '__unstableIsEditorReady');
if (!isEditorReady) {
return;
}
const postType = yield external_wp_data_["controls"].select('core/editor', 'getCurrentPostType'); // Only initialize once.
if (actions_metaBoxesInitialized) {
return;
}
if (window.postboxes.page !== postType) {
window.postboxes.add_postbox_toggles(postType);
}
actions_metaBoxesInitialized = true;
let wasSavingPost = yield external_wp_data_["controls"].select('core/editor', 'isSavingPost');
let wasAutosavingPost = yield external_wp_data_["controls"].select('core/editor', 'isAutosavingPost');
const hasMetaBoxes = yield external_wp_data_["controls"].select(store, 'hasMetaBoxes'); // Save metaboxes when performing a full save on the post.
Object(external_wp_data_["subscribe"])(() => {
const isSavingPost = Object(external_wp_data_["select"])('core/editor').isSavingPost();
const isAutosavingPost = Object(external_wp_data_["select"])('core/editor').isAutosavingPost(); // Save metaboxes on save completion, except for autosaves that are not a post preview.
//
// Meta boxes are initialized once at page load. It is not necessary to
// account for updates on each state change.
//
// See: https://github.com/WordPress/WordPress/blob/5.1.1/wp-admin/includes/post.php#L2307-L2309
const shouldTriggerMetaboxesSave = hasMetaBoxes && wasSavingPost && !isSavingPost && !wasAutosavingPost; // Save current state for next inspection.
wasSavingPost = isSavingPost;
wasAutosavingPost = isAutosavingPost;
if (shouldTriggerMetaboxesSave) {
Object(external_wp_data_["dispatch"])(store).requestMetaBoxUpdates();
}
});
return {
type: 'META_BOXES_INITIALIZED'
};
}
// EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js // EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js
var rememo = __webpack_require__("pPDe"); var rememo = __webpack_require__("pPDe");
@ -1744,7 +1781,7 @@ const getAllMetaBoxes = Object(rememo["a" /* default */])(state => {
* @return {boolean} Whether there are metaboxes or not. * @return {boolean} Whether there are metaboxes or not.
*/ */
function hasMetaBoxes(state) { function selectors_hasMetaBoxes(state) {
return getActiveMetaBoxLocations(state).length > 0; return getActiveMetaBoxLocations(state).length > 0;
} }
/** /**
@ -1820,6 +1857,17 @@ function isListViewOpened(state) {
function selectors_isEditingTemplate(state) { function selectors_isEditingTemplate(state) {
return state.isEditingTemplate; return state.isEditingTemplate;
} }
/**
* Returns true if meta boxes are initialized.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether meta boxes are initialized.
*/
function areMetaBoxesInitialized(state) {
return state.metaBoxes.initialized;
}
/** /**
* Retrieves the template of the currently edited post. * Retrieves the template of the currently edited post.
* *
@ -3348,7 +3396,6 @@ const arrowLeft = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["create
__webpack_require__.r(__webpack_exports__); __webpack_require__.r(__webpack_exports__);
// EXPORTS // EXPORTS
__webpack_require__.d(__webpack_exports__, "store", function() { return /* reexport */ store["a" /* store */]; });
__webpack_require__.d(__webpack_exports__, "reinitializeEditor", function() { return /* binding */ reinitializeEditor; }); __webpack_require__.d(__webpack_exports__, "reinitializeEditor", function() { return /* binding */ reinitializeEditor; });
__webpack_require__.d(__webpack_exports__, "initializeEditor", function() { return /* binding */ initializeEditor; }); __webpack_require__.d(__webpack_exports__, "initializeEditor", function() { return /* binding */ initializeEditor; });
__webpack_require__.d(__webpack_exports__, "PluginBlockSettingsMenuItem", function() { return /* reexport */ plugin_block_settings_menu_item; }); __webpack_require__.d(__webpack_exports__, "PluginBlockSettingsMenuItem", function() { return /* reexport */ plugin_block_settings_menu_item; });
@ -3361,6 +3408,7 @@ __webpack_require__.d(__webpack_exports__, "PluginSidebar", function() { return
__webpack_require__.d(__webpack_exports__, "PluginSidebarMoreMenuItem", function() { return /* reexport */ PluginSidebarMoreMenuItem; }); __webpack_require__.d(__webpack_exports__, "PluginSidebarMoreMenuItem", function() { return /* reexport */ PluginSidebarMoreMenuItem; });
__webpack_require__.d(__webpack_exports__, "__experimentalFullscreenModeClose", function() { return /* reexport */ fullscreen_mode_close; }); __webpack_require__.d(__webpack_exports__, "__experimentalFullscreenModeClose", function() { return /* reexport */ fullscreen_mode_close; });
__webpack_require__.d(__webpack_exports__, "__experimentalMainDashboardButton", function() { return /* reexport */ main_dashboard_button; }); __webpack_require__.d(__webpack_exports__, "__experimentalMainDashboardButton", function() { return /* reexport */ main_dashboard_button; });
__webpack_require__.d(__webpack_exports__, "store", function() { return /* reexport */ store["a" /* store */]; });
// EXTERNAL MODULE: external ["wp","element"] // EXTERNAL MODULE: external ["wp","element"]
var external_wp_element_ = __webpack_require__("GRId"); var external_wp_element_ = __webpack_require__("GRId");
@ -4000,7 +4048,7 @@ function __spreadArray(to, from, pack) {
ar[i] = from[i]; ar[i] = from[i];
} }
} }
return to.concat(ar || from); return to.concat(ar || Array.prototype.slice.call(from));
} }
function __await(v) { function __await(v) {
@ -5053,7 +5101,7 @@ function tslib_es6_spreadArray(to, from, pack) {
ar[i] = from[i]; ar[i] = from[i];
} }
} }
return to.concat(ar || from); return to.concat(ar || Array.prototype.slice.call(from));
} }
function tslib_es6_await(v) { function tslib_es6_await(v) {
@ -6601,7 +6649,7 @@ function tslib_tslib_es6_spreadArray(to, from, pack) {
ar[i] = from[i]; ar[i] = from[i];
} }
} }
return to.concat(ar || from); return to.concat(ar || Array.prototype.slice.call(from));
} }
function tslib_tslib_es6_await(v) { function tslib_tslib_es6_await(v) {
@ -16626,6 +16674,8 @@ class meta_box_visibility_MetaBoxVisibility extends external_wp_element_["Compon
*/ */
/** /**
* Internal dependencies * Internal dependencies
*/ */
@ -16633,12 +16683,44 @@ class meta_box_visibility_MetaBoxVisibility extends external_wp_element_["Compon
function MetaBoxes({ function MetaBoxes({
location, location
isVisible,
metaBoxes
}) { }) {
const registry = Object(external_wp_data_["useRegistry"])();
const {
metaBoxes,
isVisible,
areMetaBoxesInitialized,
isEditorReady
} = Object(external_wp_data_["useSelect"])(select => {
const {
__unstableIsEditorReady
} = select(external_wp_editor_["store"]);
const {
isMetaBoxLocationVisible,
getMetaBoxesPerLocation,
areMetaBoxesInitialized: _areMetaBoxesInitialized
} = select(store["a" /* store */]);
return {
metaBoxes: getMetaBoxesPerLocation(location),
isVisible: isMetaBoxLocationVisible(location),
areMetaBoxesInitialized: _areMetaBoxesInitialized(),
isEditorReady: __unstableIsEditorReady()
};
}, [location]); // When editor is ready, initialize postboxes (wp core script) and metabox
// saving. This initializes all meta box locations, not just this specific
// one.
Object(external_wp_element_["useEffect"])(() => {
if (isEditorReady && !areMetaBoxesInitialized) {
registry.dispatch(store["a" /* store */]).initializeMetaBoxes();
}
}, [isEditorReady, areMetaBoxesInitialized]);
if (!areMetaBoxesInitialized) {
return null;
}
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_lodash_["map"])(metaBoxes, ({ return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_lodash_["map"])(metaBoxes, ({
id id
}) => Object(external_wp_element_["createElement"])(meta_box_visibility, { }) => Object(external_wp_element_["createElement"])(meta_box_visibility, {
@ -16649,19 +16731,6 @@ function MetaBoxes({
})); }));
} }
/* harmony default export */ var meta_boxes = (Object(external_wp_data_["withSelect"])((select, {
location
}) => {
const {
isMetaBoxLocationVisible,
getMetaBoxesPerLocation
} = select(store["a" /* store */]);
return {
metaBoxes: getMetaBoxesPerLocation(location),
isVisible: isMetaBoxLocationVisible(location)
};
})(MetaBoxes));
// EXTERNAL MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-document-setting-panel/index.js // EXTERNAL MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-document-setting-panel/index.js
var plugin_document_setting_panel = __webpack_require__("xrib"); var plugin_document_setting_panel = __webpack_require__("xrib");
@ -17158,7 +17227,7 @@ const SettingsSidebar = () => {
toggleShortcut: keyboardShortcut, toggleShortcut: keyboardShortcut,
icon: cog["a" /* default */], icon: cog["a" /* default */],
isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT
}, !isTemplateMode && sidebarName === 'edit-post/document' && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(post_status, null), Object(external_wp_element_["createElement"])(sidebar_template, null), Object(external_wp_element_["createElement"])(plugin_document_setting_panel["a" /* default */].Slot, null), Object(external_wp_element_["createElement"])(last_revision, null), Object(external_wp_element_["createElement"])(post_link, null), Object(external_wp_element_["createElement"])(post_taxonomies, null), Object(external_wp_element_["createElement"])(featured_image, null), Object(external_wp_element_["createElement"])(post_excerpt, null), Object(external_wp_element_["createElement"])(discussion_panel, null), Object(external_wp_element_["createElement"])(page_attributes, null), Object(external_wp_element_["createElement"])(meta_boxes, { }, !isTemplateMode && sidebarName === 'edit-post/document' && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(post_status, null), Object(external_wp_element_["createElement"])(sidebar_template, null), Object(external_wp_element_["createElement"])(plugin_document_setting_panel["a" /* default */].Slot, null), Object(external_wp_element_["createElement"])(last_revision, null), Object(external_wp_element_["createElement"])(post_link, null), Object(external_wp_element_["createElement"])(post_taxonomies, null), Object(external_wp_element_["createElement"])(featured_image, null), Object(external_wp_element_["createElement"])(post_excerpt, null), Object(external_wp_element_["createElement"])(discussion_panel, null), Object(external_wp_element_["createElement"])(page_attributes, null), Object(external_wp_element_["createElement"])(MetaBoxes, {
location: "side" location: "side"
})), isTemplateMode && sidebarName === 'edit-post/document' && Object(external_wp_element_["createElement"])(template_summary, null), sidebarName === 'edit-post/block' && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockInspector"], null)); })), isTemplateMode && sidebarName === 'edit-post/document' && Object(external_wp_element_["createElement"])(template_summary, null), sidebarName === 'edit-post/block' && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockInspector"], null));
}; };
@ -17769,9 +17838,9 @@ function Layout({
styles: styles styles: styles
}), !isTemplateMode && Object(external_wp_element_["createElement"])("div", { }), !isTemplateMode && Object(external_wp_element_["createElement"])("div", {
className: "edit-post-layout__metaboxes" className: "edit-post-layout__metaboxes"
}, Object(external_wp_element_["createElement"])(meta_boxes, { }, Object(external_wp_element_["createElement"])(MetaBoxes, {
location: "normal" location: "normal"
}), Object(external_wp_element_["createElement"])(meta_boxes, { }), Object(external_wp_element_["createElement"])(MetaBoxes, {
location: "advanced" location: "advanced"
})), isMobileViewport && sidebarIsOpened && Object(external_wp_element_["createElement"])(external_wp_components_["ScrollLock"], null)), })), isMobileViewport && sidebarIsOpened && Object(external_wp_element_["createElement"])(external_wp_components_["ScrollLock"], null)),
footer: !hasReducedUI && showBlockBreadcrumbs && !isMobileViewport && isRichEditingEnabled && mode === 'visual' && Object(external_wp_element_["createElement"])("div", { footer: !hasReducedUI && showBlockBreadcrumbs && !isMobileViewport && isRichEditingEnabled && mode === 'visual' && Object(external_wp_element_["createElement"])("div", {
@ -18306,7 +18375,6 @@ function PluginSidebarMoreMenuItem(props) {
/** /**
* Reinitializes the editor after the user chooses to reboot the editor after * Reinitializes the editor after the user chooses to reboot the editor after
* an unhandled error occurs, replacing previously mounted editor element using * an unhandled error occurs, replacing previously mounted editor element using
@ -18336,11 +18404,8 @@ function reinitializeEditor(postType, postId, target, settings, initialEdits) {
/** /**
* Initializes and returns an instance of Editor. * Initializes and returns an instance of Editor.
* *
* The return value of this function is not necessary if we change where we
* call initializeEditor(). This is due to metaBox timing.
*
* @param {string} id Unique identifier for editor instance. * @param {string} id Unique identifier for editor instance.
* @param {Object} postType Post type of the post to edit. * @param {string} postType Post type of the post to edit.
* @param {Object} postId ID of the post to edit. * @param {Object} postId ID of the post to edit.
* @param {?Object} settings Editor settings object. * @param {?Object} settings Editor settings object.
* @param {Object} initialEdits Programmatic edits to apply initially, to be * @param {Object} initialEdits Programmatic edits to apply initially, to be
@ -18410,6 +18475,7 @@ function initializeEditor(id, postType, postId, settings, initialEdits) {
/***/ }), /***/ }),
/***/ "g56x": /***/ "g56x":

File diff suppressed because one or more lines are too long

View File

@ -110,6 +110,13 @@ const blockDefault = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["cre
/* harmony default export */ __webpack_exports__["a"] = (blockDefault); /* harmony default export */ __webpack_exports__["a"] = (blockDefault);
/***/ }),
/***/ "1CF3":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["dom"]; }());
/***/ }), /***/ }),
/***/ "1ZqX": /***/ "1ZqX":
@ -161,6 +168,7 @@ const cog = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElemen
__webpack_require__.r(__webpack_exports__); __webpack_require__.r(__webpack_exports__);
// EXPORTS // EXPORTS
__webpack_require__.d(__webpack_exports__, "reinitializeEditor", function() { return /* binding */ reinitializeEditor; });
__webpack_require__.d(__webpack_exports__, "initialize", function() { return /* binding */ initialize; }); __webpack_require__.d(__webpack_exports__, "initialize", function() { return /* binding */ initialize; });
// NAMESPACE OBJECT: ./node_modules/@wordpress/edit-widgets/build-module/store/actions.js // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-widgets/build-module/store/actions.js
@ -197,6 +205,7 @@ __webpack_require__.d(selectors_namespaceObject, "getReferenceWidgetBlocks", fun
__webpack_require__.d(selectors_namespaceObject, "isSavingWidgetAreas", function() { return selectors_isSavingWidgetAreas; }); __webpack_require__.d(selectors_namespaceObject, "isSavingWidgetAreas", function() { return selectors_isSavingWidgetAreas; });
__webpack_require__.d(selectors_namespaceObject, "getIsWidgetAreaOpen", function() { return getIsWidgetAreaOpen; }); __webpack_require__.d(selectors_namespaceObject, "getIsWidgetAreaOpen", function() { return getIsWidgetAreaOpen; });
__webpack_require__.d(selectors_namespaceObject, "isInserterOpened", function() { return selectors_isInserterOpened; }); __webpack_require__.d(selectors_namespaceObject, "isInserterOpened", function() { return selectors_isInserterOpened; });
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetInsertionPoint", function() { return __experimentalGetInsertionPoint; });
__webpack_require__.d(selectors_namespaceObject, "canInsertBlockInWidgetArea", function() { return selectors_canInsertBlockInWidgetArea; }); __webpack_require__.d(selectors_namespaceObject, "canInsertBlockInWidgetArea", function() { return selectors_canInsertBlockInWidgetArea; });
__webpack_require__.d(selectors_namespaceObject, "__unstableIsFeatureActive", function() { return __unstableIsFeatureActive; }); __webpack_require__.d(selectors_namespaceObject, "__unstableIsFeatureActive", function() { return __unstableIsFeatureActive; });
@ -1247,6 +1256,24 @@ const getIsWidgetAreaOpen = (state, clientId) => {
function selectors_isInserterOpened(state) { function selectors_isInserterOpened(state) {
return !!state.blockInserterPanel; return !!state.blockInserterPanel;
} }
/**
* Get the insertion point for the inserter.
*
* @param {Object} state Global application state.
*
* @return {Object} The root client ID and index to insert at.
*/
function __experimentalGetInsertionPoint(state) {
const {
rootClientId,
insertionIndex
} = state.blockInserterPanel;
return {
rootClientId,
insertionIndex
};
}
/** /**
* Returns true if a block can be inserted into a widget area. * Returns true if a block can be inserted into a widget area.
* *
@ -1691,6 +1718,72 @@ const widget_area_settings = {
// EXTERNAL MODULE: external ["wp","plugins"] // EXTERNAL MODULE: external ["wp","plugins"]
var external_wp_plugins_ = __webpack_require__("TvNi"); var external_wp_plugins_ = __webpack_require__("TvNi");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/error-boundary/index.js
/**
* WordPress dependencies
*/
function CopyButton({
text,
children
}) {
const ref = Object(external_wp_compose_["useCopyToClipboard"])(text);
return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
variant: "secondary",
ref: ref
}, children);
}
class error_boundary_ErrorBoundary extends external_wp_element_["Component"] {
constructor() {
super(...arguments);
this.reboot = this.reboot.bind(this);
this.state = {
error: null
};
}
componentDidCatch(error) {
this.setState({
error
});
}
reboot() {
this.props.onError();
}
render() {
const {
error
} = this.state;
if (!error) {
return this.props.children;
}
return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["Warning"], {
className: "edit-widgets-error-boundary",
actions: [Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
key: "recovery",
onClick: this.reboot,
variant: "secondary"
}, Object(external_wp_i18n_["__"])('Attempt Recovery')), Object(external_wp_element_["createElement"])(CopyButton, {
key: "copy-error",
text: error.stack
}, Object(external_wp_i18n_["__"])('Copy Error'))]
}, Object(external_wp_i18n_["__"])('The editor has encountered an unexpected error.'));
}
}
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
var esm_extends = __webpack_require__("wx14"); var esm_extends = __webpack_require__("wx14");
@ -1974,6 +2067,9 @@ var block_default = __webpack_require__("//Lo");
// EXTERNAL MODULE: external ["wp","url"] // EXTERNAL MODULE: external ["wp","url"]
var external_wp_url_ = __webpack_require__("Mmq9"); var external_wp_url_ = __webpack_require__("Mmq9");
// EXTERNAL MODULE: external ["wp","dom"]
var external_wp_dom_ = __webpack_require__("1CF3");
// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/sidebar/widget-areas.js // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/sidebar/widget-areas.js
@ -1987,6 +2083,7 @@ var external_wp_url_ = __webpack_require__("Mmq9");
/** /**
* Internal dependencies * Internal dependencies
*/ */
@ -2013,7 +2110,15 @@ function WidgetAreas({
className: "edit-widgets-widget-areas__top-container" className: "edit-widgets-widget-areas__top-container"
}, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockIcon"], { }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockIcon"], {
icon: block_default["a" /* default */] icon: block_default["a" /* default */]
}), Object(external_wp_element_["createElement"])("div", null, Object(external_wp_element_["createElement"])("p", null, description), (widgetAreas === null || widgetAreas === void 0 ? void 0 : widgetAreas.length) === 0 && Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('Your theme does not contain any Widget Areas.')), !selectedWidgetArea && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { }), Object(external_wp_element_["createElement"])("div", null, Object(external_wp_element_["createElement"])("p", {
// Use `dangerouslySetInnerHTML` to keep backwards
// compatibility. Basic markup in the description is an
// established feature of WordPress.
// @see https://github.com/WordPress/gutenberg/issues/33106
dangerouslySetInnerHTML: {
__html: Object(external_wp_dom_["safeHTML"])(description)
}
}), (widgetAreas === null || widgetAreas === void 0 ? void 0 : widgetAreas.length) === 0 && Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('Your theme does not contain any Widget Areas.')), !selectedWidgetArea && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
href: Object(external_wp_url_["addQueryArgs"])('customize.php', { href: Object(external_wp_url_["addQueryArgs"])('customize.php', {
'autofocus[panel]': 'widgets', 'autofocus[panel]': 'widgets',
return: window.location.pathname return: window.location.pathname
@ -2663,7 +2768,7 @@ function MoreMenu() {
}), Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { }), Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], {
role: "menuitem", role: "menuitem",
icon: external["a" /* default */], icon: external["a" /* default */],
href: Object(external_wp_i18n_["__"])('https://wordpress.org/support/article/wordpress-editor/'), href: Object(external_wp_i18n_["__"])('https://wordpress.org/support/article/block-based-widgets-editor/'),
target: "_blank", target: "_blank",
rel: "noopener noreferrer" rel: "noopener noreferrer"
}, Object(external_wp_i18n_["__"])('Help'), Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { }, Object(external_wp_i18n_["__"])('Help'), Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], {
@ -2893,6 +2998,7 @@ function WidgetAreasBlockEditorContent({
const useWidgetLibraryInsertionPoint = () => { const useWidgetLibraryInsertionPoint = () => {
const firstRootId = Object(external_wp_data_["useSelect"])(select => { const firstRootId = Object(external_wp_data_["useSelect"])(select => {
var _widgetAreasPost$bloc; var _widgetAreasPost$bloc;
@ -2911,6 +3017,15 @@ const useWidgetLibraryInsertionPoint = () => {
getBlockOrder, getBlockOrder,
getBlockIndex getBlockIndex
} = select(external_wp_blockEditor_["store"]); } = select(external_wp_blockEditor_["store"]);
const insertionPoint = select(store).__experimentalGetInsertionPoint(); // "Browse all" in the quick inserter will set the rootClientId to the current block.
// Otherwise, it will just be undefined, and we'll have to handle it differently below.
if (insertionPoint.rootClientId) {
return insertionPoint;
}
const clientId = getBlockSelectionEnd() || firstRootId; const clientId = getBlockSelectionEnd() || firstRootId;
const rootClientId = getBlockRootClientId(clientId); // If the selected block is at the root level, it's a widget area and const rootClientId = getBlockRootClientId(clientId); // If the selected block is at the root level, it's a widget area and
// blocks can't be inserted here. Return this block as the root and the // blocks can't be inserted here. Return this block as the root and the
@ -3233,14 +3348,18 @@ function WelcomeGuideImage({
function Layout({ function Layout({
blockEditorSettings blockEditorSettings,
onError
}) { }) {
return Object(external_wp_element_["createElement"])(WidgetAreasBlockEditorProvider, { return Object(external_wp_element_["createElement"])(error_boundary_ErrorBoundary, {
onError: onError
}, Object(external_wp_element_["createElement"])(WidgetAreasBlockEditorProvider, {
blockEditorSettings: blockEditorSettings blockEditorSettings: blockEditorSettings
}, Object(external_wp_element_["createElement"])(layout_interface, { }, Object(external_wp_element_["createElement"])(layout_interface, {
blockEditorSettings: blockEditorSettings blockEditorSettings: blockEditorSettings
}), Object(external_wp_element_["createElement"])(Sidebar, null), Object(external_wp_element_["createElement"])(external_wp_components_["Popover"].Slot, null), Object(external_wp_element_["createElement"])(external_wp_plugins_["PluginArea"], null), Object(external_wp_element_["createElement"])(UnsavedChangesWarning, null), Object(external_wp_element_["createElement"])(WelcomeGuide, null)); }), Object(external_wp_element_["createElement"])(Sidebar, null), Object(external_wp_element_["createElement"])(external_wp_components_["Popover"].Slot, null), Object(external_wp_element_["createElement"])(external_wp_plugins_["PluginArea"], null), Object(external_wp_element_["createElement"])(UnsavedChangesWarning, null), Object(external_wp_element_["createElement"])(WelcomeGuide, null)));
} }
/* harmony default export */ var layout = (Layout); /* harmony default export */ var layout = (Layout);
@ -3266,6 +3385,23 @@ function Layout({
const disabledBlocks = ['core/more', 'core/freeform', ...(!ALLOW_REUSABLE_BLOCKS && ['core/block'])]; const disabledBlocks = ['core/more', 'core/freeform', ...(!ALLOW_REUSABLE_BLOCKS && ['core/block'])];
/**
* Reinitializes the editor after the user chooses to reboot the editor after
* an unhandled error occurs, replacing previously mounted editor element using
* an initial state from prior to the crash.
*
* @param {Element} target DOM node in which editor is rendered.
* @param {?Object} settings Editor settings object.
*/
function reinitializeEditor(target, settings) {
Object(external_wp_element_["unmountComponentAtNode"])(target);
const reboot = reinitializeEditor.bind(null, target, settings);
Object(external_wp_element_["render"])(Object(external_wp_element_["createElement"])(layout, {
blockEditorSettings: settings,
onError: reboot
}), target);
}
/** /**
* Initializes the block editor in the widgets screen. * Initializes the block editor in the widgets screen.
* *
@ -3274,6 +3410,9 @@ const disabledBlocks = ['core/more', 'core/freeform', ...(!ALLOW_REUSABLE_BLOCKS
*/ */
function initialize(id, settings) { function initialize(id, settings) {
const target = document.getElementById(id);
const reboot = reinitializeEditor.bind(null, target, settings);
const coreBlocks = Object(external_wp_blockLibrary_["__experimentalGetCoreBlocks"])().filter(block => { const coreBlocks = Object(external_wp_blockLibrary_["__experimentalGetCoreBlocks"])().filter(block => {
return !(disabledBlocks.includes(block.name) || block.name.startsWith('core/post') || block.name.startsWith('core/query') || block.name.startsWith('core/site')); return !(disabledBlocks.includes(block.name) || block.name.startsWith('core/post') || block.name.startsWith('core/query') || block.name.startsWith('core/site'));
}); });
@ -3294,8 +3433,9 @@ function initialize(id, settings) {
Object(external_wp_blocks_["setFreeformContentHandlerName"])('core/html'); Object(external_wp_blocks_["setFreeformContentHandlerName"])('core/html');
Object(external_wp_element_["render"])(Object(external_wp_element_["createElement"])(layout, { Object(external_wp_element_["render"])(Object(external_wp_element_["createElement"])(layout, {
blockEditorSettings: settings blockEditorSettings: settings,
}), document.getElementById(id)); onError: reboot
}), target);
} }
/** /**
* Function to register an individual block. * Function to register an individual block.

File diff suppressed because one or more lines are too long

View File

@ -8074,6 +8074,7 @@ const DEFAULT_QUERY = {
per_page: MAX_MOST_USED_TERMS, per_page: MAX_MOST_USED_TERMS,
orderby: 'count', orderby: 'count',
order: 'desc', order: 'desc',
hide_empty: true,
_fields: 'id,name,count' _fields: 'id,name,count'
}; };
function MostUsedTerms({ function MostUsedTerms({

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.9-alpha-51717'; $wp_version = '5.9-alpha-51719';
/** /**
* 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.