Editor: Update Packages with the latest bug fixes for 6.5 beta 2 (Round 2).
It includes all the backports from this Gutenberg PR https://github.com/WordPress/gutenberg/pull/59208 See #60315. Built from https://develop.svn.wordpress.org/trunk@57669 git-svn-id: http://core.svn.wordpress.org/trunk@57170 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
52170ea9d8
commit
e34c2c3a94
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1427,16 +1427,6 @@ iframe[name=editor-canvas].has-editor-padding{
|
||||||
font-family:Menlo,Consolas,monaco,monospace;
|
font-family:Menlo,Consolas,monaco,monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
.block-editor-global-styles-advanced-panel__custom-css-validation-wrapper{
|
|
||||||
bottom:16px;
|
|
||||||
left:24px;
|
|
||||||
position:absolute;
|
|
||||||
}
|
|
||||||
|
|
||||||
.block-editor-global-styles-advanced-panel__custom-css-validation-icon{
|
|
||||||
fill:#cc1818;
|
|
||||||
}
|
|
||||||
|
|
||||||
.block-editor-height-control{
|
.block-editor-height-control{
|
||||||
border:0;
|
border:0;
|
||||||
margin:0;
|
margin:0;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1427,16 +1427,6 @@ iframe[name=editor-canvas].has-editor-padding{
|
||||||
font-family:Menlo,Consolas,monaco,monospace;
|
font-family:Menlo,Consolas,monaco,monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
.block-editor-global-styles-advanced-panel__custom-css-validation-wrapper{
|
|
||||||
bottom:16px;
|
|
||||||
position:absolute;
|
|
||||||
right:24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.block-editor-global-styles-advanced-panel__custom-css-validation-icon{
|
|
||||||
fill:#cc1818;
|
|
||||||
}
|
|
||||||
|
|
||||||
.block-editor-height-control{
|
.block-editor-height-control{
|
||||||
border:0;
|
border:0;
|
||||||
margin:0;
|
margin:0;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -2388,6 +2388,14 @@ body.is-fullscreen-mode .edit-site-list-header{
|
||||||
.edit-site-patterns__pagination .components-button.is-tertiary:hover:not(:disabled){
|
.edit-site-patterns__pagination .components-button.is-tertiary:hover:not(:disabled){
|
||||||
background-color:#757575;
|
background-color:#757575;
|
||||||
}
|
}
|
||||||
|
.edit-site-page-patterns-dataviews{
|
||||||
|
margin-top:60px;
|
||||||
|
}
|
||||||
|
@media (min-width:782px){
|
||||||
|
.edit-site-page-patterns-dataviews{
|
||||||
|
margin-top:0;
|
||||||
|
}
|
||||||
|
}
|
||||||
.edit-site-page-patterns-dataviews .page-patterns-preview-field{
|
.edit-site-page-patterns-dataviews .page-patterns-preview-field{
|
||||||
border-radius:3px 3px 0 0;
|
border-radius:3px 3px 0 0;
|
||||||
display:flex;
|
display:flex;
|
||||||
|
@ -2436,6 +2444,9 @@ body.is-fullscreen-mode .edit-site-list-header{
|
||||||
white-space:nowrap;
|
white-space:nowrap;
|
||||||
width:100%;
|
width:100%;
|
||||||
}
|
}
|
||||||
|
.edit-site-page-patterns-dataviews .dataviews-pagination{
|
||||||
|
z-index:2;
|
||||||
|
}
|
||||||
|
|
||||||
.dataviews-action-modal__duplicate-pattern [role=dialog]>[role=document]{
|
.dataviews-action-modal__duplicate-pattern [role=dialog]>[role=document]{
|
||||||
width:350px;
|
width:350px;
|
||||||
|
@ -2513,6 +2524,10 @@ body.is-fullscreen-mode .edit-site-list-header{
|
||||||
white-space:normal;
|
white-space:normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.edit-site-page-template-template-parts-dataviews .dataviews-pagination{
|
||||||
|
z-index:2;
|
||||||
|
}
|
||||||
|
|
||||||
.edit-site-table-wrapper{
|
.edit-site-table-wrapper{
|
||||||
padding:32px;
|
padding:32px;
|
||||||
width:100%;
|
width:100%;
|
||||||
|
@ -3090,6 +3105,12 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar{
|
||||||
overflow:hidden;
|
overflow:hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.edit-site-layout__mobile{
|
||||||
|
position:relative;
|
||||||
|
width:100%;
|
||||||
|
z-index:2;
|
||||||
|
}
|
||||||
|
|
||||||
.edit-site-layout__canvas-container{
|
.edit-site-layout__canvas-container{
|
||||||
flex-grow:1;
|
flex-grow:1;
|
||||||
position:relative;
|
position:relative;
|
||||||
|
@ -3140,7 +3161,7 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar{
|
||||||
border-radius:0;
|
border-radius:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.edit-site-layout__canvas .interface-interface-skeleton,.edit-site-template-pages-preview .interface-interface-skeleton{
|
.edit-site-layout__canvas .interface-interface-skeleton,.edit-site-layout__mobile .interface-interface-skeleton,.edit-site-template-pages-preview .interface-interface-skeleton{
|
||||||
min-height:100% !important;
|
min-height:100% !important;
|
||||||
position:relative !important;
|
position:relative !important;
|
||||||
}
|
}
|
||||||
|
@ -4040,9 +4061,8 @@ body:has(.edit-site-resizable-frame__inner.is-resizing){
|
||||||
width:100%;
|
width:100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.font-library-modal__fonts-grid .font-library-modal__fonts-grid__main{
|
.font-library-modal__tabpanel-layout .components-base-control__field{
|
||||||
display:flex;
|
margin-bottom:0;
|
||||||
flex-direction:column;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.font-library-modal__font-card{
|
.font-library-modal__font-card{
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -2388,6 +2388,14 @@ body.is-fullscreen-mode .edit-site-list-header{
|
||||||
.edit-site-patterns__pagination .components-button.is-tertiary:hover:not(:disabled){
|
.edit-site-patterns__pagination .components-button.is-tertiary:hover:not(:disabled){
|
||||||
background-color:#757575;
|
background-color:#757575;
|
||||||
}
|
}
|
||||||
|
.edit-site-page-patterns-dataviews{
|
||||||
|
margin-top:60px;
|
||||||
|
}
|
||||||
|
@media (min-width:782px){
|
||||||
|
.edit-site-page-patterns-dataviews{
|
||||||
|
margin-top:0;
|
||||||
|
}
|
||||||
|
}
|
||||||
.edit-site-page-patterns-dataviews .page-patterns-preview-field{
|
.edit-site-page-patterns-dataviews .page-patterns-preview-field{
|
||||||
border-radius:3px 3px 0 0;
|
border-radius:3px 3px 0 0;
|
||||||
display:flex;
|
display:flex;
|
||||||
|
@ -2436,6 +2444,9 @@ body.is-fullscreen-mode .edit-site-list-header{
|
||||||
white-space:nowrap;
|
white-space:nowrap;
|
||||||
width:100%;
|
width:100%;
|
||||||
}
|
}
|
||||||
|
.edit-site-page-patterns-dataviews .dataviews-pagination{
|
||||||
|
z-index:2;
|
||||||
|
}
|
||||||
|
|
||||||
.dataviews-action-modal__duplicate-pattern [role=dialog]>[role=document]{
|
.dataviews-action-modal__duplicate-pattern [role=dialog]>[role=document]{
|
||||||
width:350px;
|
width:350px;
|
||||||
|
@ -2513,6 +2524,10 @@ body.is-fullscreen-mode .edit-site-list-header{
|
||||||
white-space:normal;
|
white-space:normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.edit-site-page-template-template-parts-dataviews .dataviews-pagination{
|
||||||
|
z-index:2;
|
||||||
|
}
|
||||||
|
|
||||||
.edit-site-table-wrapper{
|
.edit-site-table-wrapper{
|
||||||
padding:32px;
|
padding:32px;
|
||||||
width:100%;
|
width:100%;
|
||||||
|
@ -3090,6 +3105,12 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar{
|
||||||
overflow:hidden;
|
overflow:hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.edit-site-layout__mobile{
|
||||||
|
position:relative;
|
||||||
|
width:100%;
|
||||||
|
z-index:2;
|
||||||
|
}
|
||||||
|
|
||||||
.edit-site-layout__canvas-container{
|
.edit-site-layout__canvas-container{
|
||||||
flex-grow:1;
|
flex-grow:1;
|
||||||
position:relative;
|
position:relative;
|
||||||
|
@ -3140,7 +3161,7 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar{
|
||||||
border-radius:0;
|
border-radius:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.edit-site-layout__canvas .interface-interface-skeleton,.edit-site-template-pages-preview .interface-interface-skeleton{
|
.edit-site-layout__canvas .interface-interface-skeleton,.edit-site-layout__mobile .interface-interface-skeleton,.edit-site-template-pages-preview .interface-interface-skeleton{
|
||||||
min-height:100% !important;
|
min-height:100% !important;
|
||||||
position:relative !important;
|
position:relative !important;
|
||||||
}
|
}
|
||||||
|
@ -4040,9 +4061,8 @@ body:has(.edit-site-resizable-frame__inner.is-resizing){
|
||||||
width:100%;
|
width:100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.font-library-modal__fonts-grid .font-library-modal__fonts-grid__main{
|
.font-library-modal__tabpanel-layout .components-base-control__field{
|
||||||
display:flex;
|
margin-bottom:0;
|
||||||
flex-direction:column;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.font-library-modal__font-card{
|
.font-library-modal__font-card{
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -8705,7 +8705,6 @@ __webpack_require__.d(private_selectors_namespaceObject, {
|
||||||
getBlockWithoutAttributes: () => (getBlockWithoutAttributes),
|
getBlockWithoutAttributes: () => (getBlockWithoutAttributes),
|
||||||
getEnabledBlockParents: () => (getEnabledBlockParents),
|
getEnabledBlockParents: () => (getEnabledBlockParents),
|
||||||
getEnabledClientIdsTree: () => (getEnabledClientIdsTree),
|
getEnabledClientIdsTree: () => (getEnabledClientIdsTree),
|
||||||
getFetchedPatterns: () => (getFetchedPatterns),
|
|
||||||
getInserterMediaCategories: () => (getInserterMediaCategories),
|
getInserterMediaCategories: () => (getInserterMediaCategories),
|
||||||
getLastFocus: () => (getLastFocus),
|
getLastFocus: () => (getLastFocus),
|
||||||
getLastInsertedBlocksClientIds: () => (getLastInsertedBlocksClientIds),
|
getLastInsertedBlocksClientIds: () => (getLastInsertedBlocksClientIds),
|
||||||
|
@ -8719,13 +8718,6 @@ __webpack_require__.d(private_selectors_namespaceObject, {
|
||||||
isDragging: () => (private_selectors_isDragging)
|
isDragging: () => (private_selectors_isDragging)
|
||||||
});
|
});
|
||||||
|
|
||||||
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/resolvers.js
|
|
||||||
var resolvers_namespaceObject = {};
|
|
||||||
__webpack_require__.r(resolvers_namespaceObject);
|
|
||||||
__webpack_require__.d(resolvers_namespaceObject, {
|
|
||||||
getFetchedPatterns: () => (resolvers_getFetchedPatterns)
|
|
||||||
});
|
|
||||||
|
|
||||||
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/actions.js
|
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/actions.js
|
||||||
var actions_namespaceObject = {};
|
var actions_namespaceObject = {};
|
||||||
__webpack_require__.r(actions_namespaceObject);
|
__webpack_require__.r(actions_namespaceObject);
|
||||||
|
@ -10974,13 +10966,6 @@ function blockBindingsSources(state = {}, action) {
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
function blockPatterns(state = [], action) {
|
|
||||||
switch (action.type) {
|
|
||||||
case 'RECEIVE_BLOCK_PATTERNS':
|
|
||||||
return action.patterns;
|
|
||||||
}
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
const combinedReducers = (0,external_wp_data_namespaceObject.combineReducers)({
|
const combinedReducers = (0,external_wp_data_namespaceObject.combineReducers)({
|
||||||
blocks,
|
blocks,
|
||||||
isDragging,
|
isDragging,
|
||||||
|
@ -11012,8 +10997,7 @@ const combinedReducers = (0,external_wp_data_namespaceObject.combineReducers)({
|
||||||
blockRemovalRules,
|
blockRemovalRules,
|
||||||
openedBlockSettingsMenu,
|
openedBlockSettingsMenu,
|
||||||
registeredInserterMediaCategories,
|
registeredInserterMediaCategories,
|
||||||
blockBindingsSources,
|
blockBindingsSources
|
||||||
blockPatterns
|
|
||||||
});
|
});
|
||||||
function withAutomaticChangeReset(reducer) {
|
function withAutomaticChangeReset(reducer) {
|
||||||
return (state, action) => {
|
return (state, action) => {
|
||||||
|
@ -11373,7 +11357,14 @@ const symbol = (0,external_React_.createElement)(external_wp_primitives_namespac
|
||||||
|
|
||||||
;// CONCATENATED MODULE: external ["wp","richText"]
|
;// CONCATENATED MODULE: external ["wp","richText"]
|
||||||
const external_wp_richText_namespaceObject = window["wp"]["richText"];
|
const external_wp_richText_namespaceObject = window["wp"]["richText"];
|
||||||
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/private-keys.js
|
||||||
|
const selectBlockPatternsKey = Symbol('selectBlockPatternsKey');
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/utils.js
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/utils.js
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
const checkAllowList = (list, item, defaultResult = null) => {
|
const checkAllowList = (list, item, defaultResult = null) => {
|
||||||
if (typeof list === 'boolean') {
|
if (typeof list === 'boolean') {
|
||||||
return list;
|
return list;
|
||||||
|
@ -11406,8 +11397,8 @@ const checkAllowListRecursive = (blocks, allowedBlockTypes) => {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
const getAllPatternsDependants = state => {
|
const getAllPatternsDependants = select => state => {
|
||||||
return [state.settings.__experimentalBlockPatterns, state.settings.__experimentalUserPatternCategories, state.settings.__experimentalReusableBlocks, state.settings.__experimentalFetchBlockPatterns, state.blockPatterns];
|
return [state.settings.__experimentalBlockPatterns, state.settings.__experimentalUserPatternCategories, state.settings.__experimentalReusableBlocks, state.settings[selectBlockPatternsKey]?.(select), state.blockPatterns];
|
||||||
};
|
};
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/sorting.js
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/sorting.js
|
||||||
|
@ -13160,14 +13151,9 @@ const buildBlockTypeItem = (state, {
|
||||||
};
|
};
|
||||||
if (buildScope === 'transform') return blockItemBase;
|
if (buildScope === 'transform') return blockItemBase;
|
||||||
const inserterVariations = (0,external_wp_blocks_namespaceObject.getBlockVariations)(blockType.name, 'inserter');
|
const inserterVariations = (0,external_wp_blocks_namespaceObject.getBlockVariations)(blockType.name, 'inserter');
|
||||||
const ignoredHookedBlocks = [...new Set(Object.values((0,external_wp_blocks_namespaceObject.getHookedBlocks)(id)).flat())];
|
|
||||||
return {
|
return {
|
||||||
...blockItemBase,
|
...blockItemBase,
|
||||||
initialAttributes: ignoredHookedBlocks.length ? {
|
initialAttributes: {},
|
||||||
metadata: {
|
|
||||||
ignoredHookedBlocks
|
|
||||||
}
|
|
||||||
} : {},
|
|
||||||
description: blockType.description,
|
description: blockType.description,
|
||||||
category: blockType.category,
|
category: blockType.category,
|
||||||
keywords: blockType.keywords,
|
keywords: blockType.keywords,
|
||||||
|
@ -13422,9 +13408,9 @@ const __experimentalGetParsedPattern = (0,external_wp_data_namespaceObject.creat
|
||||||
__unstableSkipMigrationLogs: true
|
__unstableSkipMigrationLogs: true
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
}, getAllPatternsDependants));
|
}, getAllPatternsDependants(select)));
|
||||||
const getAllowedPatternsDependants = (state, rootClientId) => {
|
const getAllowedPatternsDependants = select => (state, rootClientId) => {
|
||||||
return [...getAllPatternsDependants(state), state.settings.allowedBlockTypes, state.settings.templateLock, state.blockListSettings[rootClientId], state.blocks.byClientId.get(rootClientId)];
|
return [...getAllPatternsDependants(select)(state), state.settings.allowedBlockTypes, state.settings.templateLock, state.blockListSettings[rootClientId], state.blocks.byClientId.get(rootClientId)];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13459,7 +13445,7 @@ const __experimentalGetAllowedPatterns = (0,external_wp_data_namespaceObject.cre
|
||||||
name
|
name
|
||||||
}) => canInsertBlockType(state, name, rootClientId)));
|
}) => canInsertBlockType(state, name, rootClientId)));
|
||||||
return patternsAllowed;
|
return patternsAllowed;
|
||||||
}, getAllowedPatternsDependants);
|
}, getAllowedPatternsDependants(select));
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13484,7 +13470,7 @@ const getPatternsByBlockTypes = (0,external_wp_data_namespaceObject.createRegist
|
||||||
return EMPTY_ARRAY;
|
return EMPTY_ARRAY;
|
||||||
}
|
}
|
||||||
return filteredPatterns;
|
return filteredPatterns;
|
||||||
}, (state, blockNames, rootClientId) => getAllowedPatternsDependants(state, rootClientId)));
|
}, (state, blockNames, rootClientId) => getAllowedPatternsDependants(select)(state, rootClientId)));
|
||||||
const __experimentalGetPatternsByBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => {
|
const __experimentalGetPatternsByBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => {
|
||||||
external_wp_deprecated_default()('wp.data.select( "core/block-editor" ).__experimentalGetPatternsByBlockTypes', {
|
external_wp_deprecated_default()('wp.data.select( "core/block-editor" ).__experimentalGetPatternsByBlockTypes', {
|
||||||
alternative: 'wp.data.select( "core/block-editor" ).getPatternsByBlockTypes',
|
alternative: 'wp.data.select( "core/block-editor" ).getPatternsByBlockTypes',
|
||||||
|
@ -13538,7 +13524,7 @@ const __experimentalGetPatternTransformItems = (0,external_wp_data_namespaceObje
|
||||||
* Now this happens in the consumer to avoid heavy operations in the selector.
|
* Now this happens in the consumer to avoid heavy operations in the selector.
|
||||||
*/
|
*/
|
||||||
return select(STORE_NAME).getPatternsByBlockTypes(selectedBlockNames, rootClientId);
|
return select(STORE_NAME).getPatternsByBlockTypes(selectedBlockNames, rootClientId);
|
||||||
}, (state, blocks, rootClientId) => getAllowedPatternsDependants(state, rootClientId)));
|
}, (state, blocks, rootClientId) => getAllowedPatternsDependants(select)(state, rootClientId)));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Block List settings of a block, if any exist.
|
* Returns the Block List settings of a block, if any exist.
|
||||||
|
@ -14691,6 +14677,7 @@ function getBlockSettings(state, clientId, ...paths) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the block interface is hidden, or false otherwise.
|
* Returns true if the block interface is hidden, or false otherwise.
|
||||||
*
|
*
|
||||||
|
@ -14868,9 +14855,6 @@ const getInserterMediaCategories = rememo(state => {
|
||||||
return Object.values(allowedMimeTypes).some(mimeType => mimeType.startsWith(`${category.mediaType}/`));
|
return Object.values(allowedMimeTypes).some(mimeType => mimeType.startsWith(`${category.mediaType}/`));
|
||||||
});
|
});
|
||||||
}, state => [state.settings.inserterMediaCategories, state.settings.allowedMimeTypes, state.settings.enableOpenverseMediaCategory, state.registeredInserterMediaCategories]);
|
}, state => [state.settings.inserterMediaCategories, state.settings.allowedMimeTypes, state.settings.enableOpenverseMediaCategory, state.registeredInserterMediaCategories]);
|
||||||
function getFetchedPatterns(state) {
|
|
||||||
return state.blockPatterns;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether there is at least one allowed pattern for inner blocks children.
|
* Returns whether there is at least one allowed pattern for inner blocks children.
|
||||||
|
@ -14904,8 +14888,9 @@ const hasAllowedPatterns = (0,external_wp_data_namespaceObject.createRegistrySel
|
||||||
name: blockName
|
name: blockName
|
||||||
}) => canInsertBlockType(state, blockName, rootClientId));
|
}) => canInsertBlockType(state, blockName, rootClientId));
|
||||||
});
|
});
|
||||||
}, (state, rootClientId) => [getAllPatternsDependants(state), state.settings.allowedBlockTypes, state.settings.templateLock, state.blockListSettings[rootClientId], state.blocks.byClientId.get(rootClientId)]));
|
}, (state, rootClientId) => [getAllPatternsDependants(select)(state), state.settings.allowedBlockTypes, state.settings.templateLock, state.blockListSettings[rootClientId], state.blocks.byClientId.get(rootClientId)]));
|
||||||
const getAllPatterns = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => rememo(state => {
|
const getAllPatterns = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => rememo(state => {
|
||||||
|
var _state$settings$selec;
|
||||||
// This setting is left for back compat.
|
// This setting is left for back compat.
|
||||||
const {
|
const {
|
||||||
__experimentalBlockPatterns = [],
|
__experimentalBlockPatterns = [],
|
||||||
|
@ -14928,8 +14913,8 @@ const getAllPatterns = (0,external_wp_data_namespaceObject.createRegistrySelecto
|
||||||
syncStatus: userPattern.wp_pattern_sync_status
|
syncStatus: userPattern.wp_pattern_sync_status
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
return [...userPatterns, ...__experimentalBlockPatterns, ...unlock(select(STORE_NAME)).getFetchedPatterns()].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name));
|
return [...userPatterns, ...__experimentalBlockPatterns, ...((_state$settings$selec = state.settings[selectBlockPatternsKey]?.(select)) !== null && _state$settings$selec !== void 0 ? _state$settings$selec : [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name));
|
||||||
}, getAllPatternsDependants));
|
}, getAllPatternsDependants(select)));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the element of the last element that had focus when focus left the editor canvas.
|
* Returns the element of the last element that had focus when focus left the editor canvas.
|
||||||
|
@ -14961,27 +14946,6 @@ function private_selectors_isDragging(state) {
|
||||||
return state.isDragging;
|
return state.isDragging;
|
||||||
}
|
}
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/resolvers.js
|
|
||||||
const resolvers_getFetchedPatterns = () => async ({
|
|
||||||
dispatch,
|
|
||||||
select
|
|
||||||
}) => {
|
|
||||||
const {
|
|
||||||
__experimentalFetchBlockPatterns
|
|
||||||
} = select.getSettings();
|
|
||||||
if (!__experimentalFetchBlockPatterns) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
const patterns = await __experimentalFetchBlockPatterns();
|
|
||||||
dispatch({
|
|
||||||
type: 'RECEIVE_BLOCK_PATTERNS',
|
|
||||||
patterns
|
|
||||||
});
|
|
||||||
};
|
|
||||||
resolvers_getFetchedPatterns.shouldInvalidate = action => {
|
|
||||||
return action.type === 'UPDATE_SETTINGS' && !!action.settings.__experimentalFetchBlockPatterns;
|
|
||||||
};
|
|
||||||
|
|
||||||
;// CONCATENATED MODULE: external ["wp","a11y"]
|
;// CONCATENATED MODULE: external ["wp","a11y"]
|
||||||
const external_wp_a11y_namespaceObject = window["wp"]["a11y"];
|
const external_wp_a11y_namespaceObject = window["wp"]["a11y"];
|
||||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/selection.js
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/selection.js
|
||||||
|
@ -16692,7 +16656,6 @@ function unsetBlockEditingMode(clientId = '') {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Block editor data store configuration.
|
* Block editor data store configuration.
|
||||||
*
|
*
|
||||||
|
@ -16701,7 +16664,6 @@ function unsetBlockEditingMode(clientId = '') {
|
||||||
const storeConfig = {
|
const storeConfig = {
|
||||||
reducer: reducer,
|
reducer: reducer,
|
||||||
selectors: selectors_namespaceObject,
|
selectors: selectors_namespaceObject,
|
||||||
resolvers: resolvers_namespaceObject,
|
|
||||||
actions: actions_namespaceObject
|
actions: actions_namespaceObject
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -24427,10 +24389,12 @@ function backgroundSizeHelpText(value) {
|
||||||
return (0,external_wp_i18n_namespaceObject.__)('Specify a fixed width.');
|
return (0,external_wp_i18n_namespaceObject.__)('Specify a fixed width.');
|
||||||
}
|
}
|
||||||
const coordsToBackgroundPosition = value => {
|
const coordsToBackgroundPosition = value => {
|
||||||
if (!value || isNaN(value.x) || isNaN(value.y)) {
|
if (!value || isNaN(value.x) && isNaN(value.y)) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return `${value.x * 100}% ${value.y * 100}%`;
|
const x = isNaN(value.x) ? 0.5 : value.x;
|
||||||
|
const y = isNaN(value.y) ? 0.5 : value.y;
|
||||||
|
return `${x * 100}% ${y * 100}%`;
|
||||||
};
|
};
|
||||||
const backgroundPositionToCoords = value => {
|
const backgroundPositionToCoords = value => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
|
@ -25188,10 +25152,10 @@ function ShadowPopoverContainer({
|
||||||
onShadowChange,
|
onShadowChange,
|
||||||
settings
|
settings
|
||||||
}) {
|
}) {
|
||||||
const defaultShadows = settings?.shadow?.presets?.default;
|
const defaultShadows = settings?.shadow?.presets?.default || [];
|
||||||
const themeShadows = settings?.shadow?.presets?.theme;
|
const themeShadows = settings?.shadow?.presets?.theme || [];
|
||||||
const defaultPresetsEnabled = settings?.shadow?.defaultPresets;
|
const defaultPresetsEnabled = settings?.shadow?.defaultPresets;
|
||||||
const shadows = [...(defaultPresetsEnabled ? defaultShadows : []), ...(themeShadows || [])];
|
const shadows = [...(defaultPresetsEnabled ? defaultShadows : []), ...themeShadows];
|
||||||
return (0,external_React_.createElement)("div", {
|
return (0,external_React_.createElement)("div", {
|
||||||
className: "block-editor-global-styles__shadow-popover-container"
|
className: "block-editor-global-styles__shadow-popover-container"
|
||||||
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
|
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
|
||||||
|
@ -43100,7 +43064,7 @@ function MediaPreview({
|
||||||
setIsInserting(false);
|
setIsInserting(false);
|
||||||
});
|
});
|
||||||
}, [isInserting, onClick, mediaUpload, createErrorNotice, createSuccessNotice]);
|
}, [isInserting, onClick, mediaUpload, createErrorNotice, createSuccessNotice]);
|
||||||
const title = media.title?.rendered || media.title;
|
const title = typeof media.title === 'string' ? media.title : media.title?.rendered || (0,external_wp_i18n_namespaceObject.__)('no title');
|
||||||
let truncatedTitle;
|
let truncatedTitle;
|
||||||
if (title.length > MAXIMUM_TITLE_LENGTH) {
|
if (title.length > MAXIMUM_TITLE_LENGTH) {
|
||||||
const omission = '...';
|
const omission = '...';
|
||||||
|
@ -44882,9 +44846,12 @@ function InbetweenInsertionPointPopover({
|
||||||
isInserterShown: insertionPoint?.__unstableWithInserter
|
isInserterShown: insertionPoint?.__unstableWithInserter
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
const {
|
||||||
|
getBlockEditingMode
|
||||||
|
} = (0,external_wp_data_namespaceObject.useSelect)(store);
|
||||||
const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
|
const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
|
||||||
function onClick(event) {
|
function onClick(event) {
|
||||||
if (event.target === ref.current && nextClientId) {
|
if (event.target === ref.current && nextClientId && getBlockEditingMode(nextClientId) !== 'disabled') {
|
||||||
selectBlock(nextClientId, -1);
|
selectBlock(nextClientId, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58484,16 +58451,35 @@ function usePasteHandler(props) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const isInternal = event.clipboardData.getData('rich-text') === 'true';
|
const isInternal = event.clipboardData.getData('rich-text') === 'true';
|
||||||
|
function pasteInline(content) {
|
||||||
|
const transformed = formatTypes.reduce((accumulator, {
|
||||||
|
__unstablePasteRule
|
||||||
|
}) => {
|
||||||
|
// Only allow one transform.
|
||||||
|
if (__unstablePasteRule && accumulator === value) {
|
||||||
|
accumulator = __unstablePasteRule(value, {
|
||||||
|
html,
|
||||||
|
plainText
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return accumulator;
|
||||||
|
}, value);
|
||||||
|
if (transformed !== value) {
|
||||||
|
onChange(transformed);
|
||||||
|
} else {
|
||||||
|
const valueToInsert = (0,external_wp_richText_namespaceObject.create)({
|
||||||
|
html: content
|
||||||
|
});
|
||||||
|
addActiveFormats(valueToInsert, value.activeFormats);
|
||||||
|
onChange((0,external_wp_richText_namespaceObject.insert)(value, valueToInsert));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If the data comes from a rich text instance, we can directly use it
|
// If the data comes from a rich text instance, we can directly use it
|
||||||
// without filtering the data. The filters are only meant for externally
|
// without filtering the data. The filters are only meant for externally
|
||||||
// pasted content and remove inline styles.
|
// pasted content and remove inline styles.
|
||||||
if (isInternal) {
|
if (isInternal) {
|
||||||
const pastedValue = (0,external_wp_richText_namespaceObject.create)({
|
pasteInline(html);
|
||||||
html
|
|
||||||
});
|
|
||||||
addActiveFormats(pastedValue, value.activeFormats);
|
|
||||||
onChange((0,external_wp_richText_namespaceObject.insert)(value, pastedValue));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (pastePlainText) {
|
if (pastePlainText) {
|
||||||
|
@ -58543,27 +58529,7 @@ function usePasteHandler(props) {
|
||||||
tagName
|
tagName
|
||||||
});
|
});
|
||||||
if (typeof content === 'string') {
|
if (typeof content === 'string') {
|
||||||
const transformed = formatTypes.reduce((accumlator, {
|
pasteInline(content);
|
||||||
__unstablePasteRule
|
|
||||||
}) => {
|
|
||||||
// Only allow one transform.
|
|
||||||
if (__unstablePasteRule && accumlator === value) {
|
|
||||||
accumlator = __unstablePasteRule(value, {
|
|
||||||
html,
|
|
||||||
plainText
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return accumlator;
|
|
||||||
}, value);
|
|
||||||
if (transformed !== value) {
|
|
||||||
onChange(transformed);
|
|
||||||
} else {
|
|
||||||
const valueToInsert = (0,external_wp_richText_namespaceObject.create)({
|
|
||||||
html: content
|
|
||||||
});
|
|
||||||
addActiveFormats(valueToInsert, value.activeFormats);
|
|
||||||
onChange((0,external_wp_richText_namespaceObject.insert)(value, valueToInsert));
|
|
||||||
}
|
|
||||||
} else if (content.length > 0) {
|
} else if (content.length > 0) {
|
||||||
if (onReplace && (0,external_wp_richText_namespaceObject.isEmpty)(value)) {
|
if (onReplace && (0,external_wp_richText_namespaceObject.isEmpty)(value)) {
|
||||||
onReplace(content, content.length - 1, -1);
|
onReplace(content, content.length - 1, -1);
|
||||||
|
@ -59634,9 +59600,13 @@ function RichTextWrapper({
|
||||||
getBlockBindingsSource
|
getBlockBindingsSource
|
||||||
} = unlock(select(store));
|
} = unlock(select(store));
|
||||||
for (const [attribute, args] of Object.entries(blockBindings)) {
|
for (const [attribute, args] of Object.entries(blockBindings)) {
|
||||||
// If any of the attributes with source "rich-text" is part of the bindings,
|
if (blockTypeAttributes?.[attribute]?.source !== 'rich-text') {
|
||||||
// has a source with `lockAttributesEditing`, disable it.
|
break;
|
||||||
if (blockTypeAttributes?.[attribute]?.source === 'rich-text' && getBlockBindingsSource(args.source)?.lockAttributesEditing) {
|
}
|
||||||
|
|
||||||
|
// If the source is not defined, or if its value of `lockAttributesEditing` is `true`, disable it.
|
||||||
|
const blockBindingsSource = getBlockBindingsSource(args.source);
|
||||||
|
if (!blockBindingsSource || blockBindingsSource.lockAttributesEditing) {
|
||||||
shouldDisableEditing = true;
|
shouldDisableEditing = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -63721,7 +63691,6 @@ function ImageSettingsPanel({
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
*/
|
*/
|
||||||
|
@ -63760,7 +63729,10 @@ function AdvancedPanel({
|
||||||
}
|
}
|
||||||
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
|
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
|
||||||
spacing: 3
|
spacing: 3
|
||||||
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.TextareaControl, {
|
}, cssError && (0,external_React_.createElement)(external_wp_components_namespaceObject.Notice, {
|
||||||
|
status: "error",
|
||||||
|
onRemove: () => setCSSError(null)
|
||||||
|
}, cssError), (0,external_React_.createElement)(external_wp_components_namespaceObject.TextareaControl, {
|
||||||
label: (0,external_wp_i18n_namespaceObject.__)('Additional CSS'),
|
label: (0,external_wp_i18n_namespaceObject.__)('Additional CSS'),
|
||||||
__nextHasNoMarginBottom: true,
|
__nextHasNoMarginBottom: true,
|
||||||
value: customCSS,
|
value: customCSS,
|
||||||
|
@ -63768,14 +63740,7 @@ function AdvancedPanel({
|
||||||
onBlur: handleOnBlur,
|
onBlur: handleOnBlur,
|
||||||
className: "block-editor-global-styles-advanced-panel__custom-css-input",
|
className: "block-editor-global-styles-advanced-panel__custom-css-input",
|
||||||
spellCheck: false
|
spellCheck: false
|
||||||
}), cssError && (0,external_React_.createElement)(external_wp_components_namespaceObject.Tooltip, {
|
}));
|
||||||
text: cssError
|
|
||||||
}, (0,external_React_.createElement)("div", {
|
|
||||||
className: "block-editor-global-styles-advanced-panel__custom-css-validation-wrapper"
|
|
||||||
}, (0,external_React_.createElement)(build_module_icon, {
|
|
||||||
icon: library_info,
|
|
||||||
className: "block-editor-global-styles-advanced-panel__custom-css-validation-icon"
|
|
||||||
}))));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./node_modules/memize/dist/index.js
|
;// CONCATENATED MODULE: ./node_modules/memize/dist/index.js
|
||||||
|
@ -67153,6 +67118,7 @@ function ResolutionTool({
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67183,7 +67149,8 @@ lock(privateApis, {
|
||||||
ReusableBlocksRenameHint: ReusableBlocksRenameHint,
|
ReusableBlocksRenameHint: ReusableBlocksRenameHint,
|
||||||
useReusableBlocksRenameHint: useReusableBlocksRenameHint,
|
useReusableBlocksRenameHint: useReusableBlocksRenameHint,
|
||||||
usesContextKey: usesContextKey,
|
usesContextKey: usesContextKey,
|
||||||
useFlashEditableBlocks: useFlashEditableBlocks
|
useFlashEditableBlocks: useFlashEditableBlocks,
|
||||||
|
selectBlockPatternsKey: selectBlockPatternsKey
|
||||||
});
|
});
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/index.js
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/index.js
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -5077,11 +5077,9 @@ function ButtonEdit(props) {
|
||||||
if (!isSelected) {
|
if (!isSelected) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
const {
|
const blockBindingsSource = unlock(select(external_wp_blockEditor_namespaceObject.store)).getBlockBindingsSource(metadata?.bindings?.url?.source);
|
||||||
getBlockBindingsSource
|
|
||||||
} = unlock(select(external_wp_blockEditor_namespaceObject.store));
|
|
||||||
return {
|
return {
|
||||||
lockUrlControls: !!metadata?.bindings?.url && getBlockBindingsSource(metadata?.bindings?.url?.source)?.lockAttributesEditing
|
lockUrlControls: !!metadata?.bindings?.url && (!blockBindingsSource || blockBindingsSource?.lockAttributesEditing)
|
||||||
};
|
};
|
||||||
}, [isSelected]);
|
}, [isSelected]);
|
||||||
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("div", {
|
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("div", {
|
||||||
|
@ -25987,14 +25985,17 @@ function image_Image({
|
||||||
title: titleBinding
|
title: titleBinding
|
||||||
} = metadata?.bindings || {};
|
} = metadata?.bindings || {};
|
||||||
const hasParentPattern = getBlockParentsByBlockName(clientId, 'core/block').length > 0;
|
const hasParentPattern = getBlockParentsByBlockName(clientId, 'core/block').length > 0;
|
||||||
|
const urlBindingSource = getBlockBindingsSource(urlBinding?.source);
|
||||||
|
const altBindingSource = getBlockBindingsSource(altBinding?.source);
|
||||||
|
const titleBindingSource = getBlockBindingsSource(titleBinding?.source);
|
||||||
return {
|
return {
|
||||||
lockUrlControls: !!urlBinding && getBlockBindingsSource(urlBinding?.source)?.lockAttributesEditing,
|
lockUrlControls: !!urlBinding && (!urlBindingSource || urlBindingSource?.lockAttributesEditing),
|
||||||
lockHrefControls:
|
lockHrefControls:
|
||||||
// Disable editing the link of the URL if the image is inside a pattern instance.
|
// Disable editing the link of the URL if the image is inside a pattern instance.
|
||||||
// This is a temporary solution until we support overriding the link on the frontend.
|
// This is a temporary solution until we support overriding the link on the frontend.
|
||||||
hasParentPattern,
|
hasParentPattern,
|
||||||
lockAltControls: !!altBinding && getBlockBindingsSource(altBinding?.source)?.lockAttributesEditing,
|
lockAltControls: !!altBinding && (!altBindingSource || altBindingSource?.lockAttributesEditing),
|
||||||
lockTitleControls: !!titleBinding && getBlockBindingsSource(titleBinding?.source)?.lockAttributesEditing
|
lockTitleControls: !!titleBinding && (!titleBindingSource || titleBindingSource?.lockAttributesEditing)
|
||||||
};
|
};
|
||||||
}, [clientId, isSingleSelected, metadata?.bindings]);
|
}, [clientId, isSingleSelected, metadata?.bindings]);
|
||||||
const controls = (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
|
const controls = (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
|
||||||
|
@ -26608,11 +26609,9 @@ function ImageEdit({
|
||||||
if (!isSingleSelected) {
|
if (!isSingleSelected) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
const {
|
const blockBindingsSource = unlock(select(external_wp_blockEditor_namespaceObject.store)).getBlockBindingsSource(metadata?.bindings?.url?.source);
|
||||||
getBlockBindingsSource
|
|
||||||
} = unlock(select(external_wp_blockEditor_namespaceObject.store));
|
|
||||||
return {
|
return {
|
||||||
lockUrlControls: !!metadata?.bindings?.url && getBlockBindingsSource(metadata?.bindings?.url?.source)?.lockAttributesEditing
|
lockUrlControls: !!metadata?.bindings?.url && (!blockBindingsSource || blockBindingsSource?.lockAttributesEditing)
|
||||||
};
|
};
|
||||||
}, [isSingleSelected]);
|
}, [isSingleSelected]);
|
||||||
const placeholder = content => {
|
const placeholder = content => {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -5859,7 +5859,6 @@ __webpack_require__.d(__webpack_exports__, {
|
||||||
getDefaultBlockName: () => (/* reexport */ getDefaultBlockName),
|
getDefaultBlockName: () => (/* reexport */ getDefaultBlockName),
|
||||||
getFreeformContentHandlerName: () => (/* reexport */ getFreeformContentHandlerName),
|
getFreeformContentHandlerName: () => (/* reexport */ getFreeformContentHandlerName),
|
||||||
getGroupingBlockName: () => (/* reexport */ getGroupingBlockName),
|
getGroupingBlockName: () => (/* reexport */ getGroupingBlockName),
|
||||||
getHookedBlocks: () => (/* reexport */ getHookedBlocks),
|
|
||||||
getPhrasingContentSchema: () => (/* reexport */ deprecatedGetPhrasingContentSchema),
|
getPhrasingContentSchema: () => (/* reexport */ deprecatedGetPhrasingContentSchema),
|
||||||
getPossibleBlockTransformations: () => (/* reexport */ getPossibleBlockTransformations),
|
getPossibleBlockTransformations: () => (/* reexport */ getPossibleBlockTransformations),
|
||||||
getSaveContent: () => (/* reexport */ getSaveContent),
|
getSaveContent: () => (/* reexport */ getSaveContent),
|
||||||
|
@ -5921,7 +5920,6 @@ __webpack_require__.d(selectors_namespaceObject, {
|
||||||
getDefaultBlockVariation: () => (getDefaultBlockVariation),
|
getDefaultBlockVariation: () => (getDefaultBlockVariation),
|
||||||
getFreeformFallbackBlockName: () => (getFreeformFallbackBlockName),
|
getFreeformFallbackBlockName: () => (getFreeformFallbackBlockName),
|
||||||
getGroupingBlockName: () => (selectors_getGroupingBlockName),
|
getGroupingBlockName: () => (selectors_getGroupingBlockName),
|
||||||
getHookedBlocks: () => (selectors_getHookedBlocks),
|
|
||||||
getUnregisteredFallbackBlockName: () => (getUnregisteredFallbackBlockName),
|
getUnregisteredFallbackBlockName: () => (getUnregisteredFallbackBlockName),
|
||||||
hasBlockSupport: () => (selectors_hasBlockSupport),
|
hasBlockSupport: () => (selectors_hasBlockSupport),
|
||||||
hasChildBlocks: () => (selectors_hasChildBlocks),
|
hasChildBlocks: () => (selectors_hasChildBlocks),
|
||||||
|
@ -7268,21 +7266,6 @@ function hasBlockSupport(nameOrType, feature, defaultSupports) {
|
||||||
return (0,external_wp_data_namespaceObject.select)(store).hasBlockSupport(nameOrType, feature, defaultSupports);
|
return (0,external_wp_data_namespaceObject.select)(store).hasBlockSupport(nameOrType, feature, defaultSupports);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the hooked blocks for a given anchor block.
|
|
||||||
*
|
|
||||||
* Given an anchor block name, returns an object whose keys are relative positions,
|
|
||||||
* and whose values are arrays of block names that are hooked to the anchor block
|
|
||||||
* at that relative position.
|
|
||||||
*
|
|
||||||
* @param {string} name Anchor block name.
|
|
||||||
*
|
|
||||||
* @return {Object} Lists of hooked block names for each relative position.
|
|
||||||
*/
|
|
||||||
function getHookedBlocks(name) {
|
|
||||||
return (0,external_wp_data_namespaceObject.select)(store).getHookedBlocks(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether or not the given block is a reusable block. This is a
|
* Determines whether or not the given block is a reusable block. This is a
|
||||||
* special block type that is used to point to a global block stored via the
|
* special block type that is used to point to a global block stored via the
|
||||||
|
@ -8544,62 +8527,6 @@ function selectors_getBlockType(state, name) {
|
||||||
return state.blockTypes[name];
|
return state.blockTypes[name];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the hooked blocks for a given anchor block.
|
|
||||||
*
|
|
||||||
* Given an anchor block name, returns an object whose keys are relative positions,
|
|
||||||
* and whose values are arrays of block names that are hooked to the anchor block
|
|
||||||
* at that relative position.
|
|
||||||
*
|
|
||||||
* @param {Object} state Data state.
|
|
||||||
* @param {string} blockName Anchor block type name.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* ```js
|
|
||||||
* import { store as blocksStore } from '@wordpress/blocks';
|
|
||||||
* import { useSelect } from '@wordpress/data';
|
|
||||||
*
|
|
||||||
* const ExampleComponent = () => {
|
|
||||||
* const hookedBlockNames = useSelect( ( select ) =>
|
|
||||||
* select( blocksStore ).getHookedBlocks( 'core/navigation' ),
|
|
||||||
* []
|
|
||||||
* );
|
|
||||||
*
|
|
||||||
* return (
|
|
||||||
* <ul>
|
|
||||||
* { Object.keys( hookedBlockNames ).length &&
|
|
||||||
* Object.keys( hookedBlockNames ).map( ( relativePosition ) => (
|
|
||||||
* <li key={ relativePosition }>{ relativePosition }>
|
|
||||||
* <ul>
|
|
||||||
* { hookedBlockNames[ relativePosition ].map( ( hookedBlock ) => (
|
|
||||||
* <li key={ hookedBlock }>{ hookedBlock }</li>
|
|
||||||
* ) ) }
|
|
||||||
* </ul>
|
|
||||||
* </li>
|
|
||||||
* ) ) }
|
|
||||||
* </ul>
|
|
||||||
* );
|
|
||||||
* };
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @return {Object} Lists of hooked block names for each relative position.
|
|
||||||
*/
|
|
||||||
const selectors_getHookedBlocks = rememo((state, blockName) => {
|
|
||||||
const hookedBlockTypes = selectors_getBlockTypes(state).filter(({
|
|
||||||
blockHooks
|
|
||||||
}) => blockHooks && blockName in blockHooks);
|
|
||||||
let hookedBlocks = {};
|
|
||||||
for (const blockType of hookedBlockTypes) {
|
|
||||||
var _hookedBlocks$relativ;
|
|
||||||
const relativePosition = blockType.blockHooks[blockName];
|
|
||||||
hookedBlocks = {
|
|
||||||
...hookedBlocks,
|
|
||||||
[relativePosition]: [...((_hookedBlocks$relativ = hookedBlocks[relativePosition]) !== null && _hookedBlocks$relativ !== void 0 ? _hookedBlocks$relativ : []), blockType.name]
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return hookedBlocks;
|
|
||||||
}, state => [state.blockTypes]);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns block styles by block name.
|
* Returns block styles by block name.
|
||||||
*
|
*
|
||||||
|
@ -15584,25 +15511,6 @@ function synchronizeBlocksWithTemplate(blocks = [], template) {
|
||||||
};
|
};
|
||||||
const normalizedAttributes = normalizeAttributes((_blockType$attributes = blockType?.attributes) !== null && _blockType$attributes !== void 0 ? _blockType$attributes : {}, attributes);
|
const normalizedAttributes = normalizeAttributes((_blockType$attributes = blockType?.attributes) !== null && _blockType$attributes !== void 0 ? _blockType$attributes : {}, attributes);
|
||||||
let [blockName, blockAttributes] = convertLegacyBlockNameAndAttributes(name, normalizedAttributes);
|
let [blockName, blockAttributes] = convertLegacyBlockNameAndAttributes(name, normalizedAttributes);
|
||||||
const ignoredHookedBlocks = [...new Set(Object.values(getHookedBlocks(blockName)).flat())];
|
|
||||||
if (ignoredHookedBlocks.length) {
|
|
||||||
const {
|
|
||||||
metadata = {},
|
|
||||||
...otherAttributes
|
|
||||||
} = blockAttributes;
|
|
||||||
const {
|
|
||||||
ignoredHookedBlocks: ignoredHookedBlocksFromTemplate = [],
|
|
||||||
...otherMetadata
|
|
||||||
} = metadata;
|
|
||||||
const newIgnoredHookedBlocks = [...new Set([...ignoredHookedBlocks, ...ignoredHookedBlocksFromTemplate])];
|
|
||||||
blockAttributes = {
|
|
||||||
metadata: {
|
|
||||||
ignoredHookedBlocks: newIgnoredHookedBlocks,
|
|
||||||
...otherMetadata
|
|
||||||
},
|
|
||||||
...otherAttributes
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// If a Block is undefined at this point, use the core/missing block as
|
// If a Block is undefined at this point, use the core/missing block as
|
||||||
// a placeholder for a better user experience.
|
// a placeholder for a better user experience.
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -769,6 +769,7 @@ __webpack_require__.d(build_module_selectors_namespaceObject, {
|
||||||
var private_selectors_namespaceObject = {};
|
var private_selectors_namespaceObject = {};
|
||||||
__webpack_require__.r(private_selectors_namespaceObject);
|
__webpack_require__.r(private_selectors_namespaceObject);
|
||||||
__webpack_require__.d(private_selectors_namespaceObject, {
|
__webpack_require__.d(private_selectors_namespaceObject, {
|
||||||
|
getBlockPatternsForPostType: () => (getBlockPatternsForPostType),
|
||||||
getNavigationFallbackId: () => (getNavigationFallbackId),
|
getNavigationFallbackId: () => (getNavigationFallbackId),
|
||||||
getUndoManager: () => (getUndoManager)
|
getUndoManager: () => (getUndoManager)
|
||||||
});
|
});
|
||||||
|
@ -5621,10 +5622,21 @@ const getRevision = rememo((state, kind, name, recordKey, revisionKey, query) =>
|
||||||
});
|
});
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/private-selectors.js
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/private-selectors.js
|
||||||
|
/**
|
||||||
|
* External dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WordPress dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the previous edit from the current undo offset
|
* Returns the previous edit from the current undo offset
|
||||||
* for the entity records edits history, if any.
|
* for the entity records edits history, if any.
|
||||||
|
@ -5646,6 +5658,9 @@ function getUndoManager(state) {
|
||||||
function getNavigationFallbackId(state) {
|
function getNavigationFallbackId(state) {
|
||||||
return state.navigationFallbackId;
|
return state.navigationFallbackId;
|
||||||
}
|
}
|
||||||
|
const getBlockPatternsForPostType = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => rememo((state, postType) => select(STORE_NAME).getBlockPatterns().filter(({
|
||||||
|
postTypes
|
||||||
|
}) => !postTypes || Array.isArray(postTypes) && postTypes.includes(postType)), () => [select(STORE_NAME).getBlockPatterns()]));
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./node_modules/camel-case/dist.es2015/index.js
|
;// CONCATENATED MODULE: ./node_modules/camel-case/dist.es2015/index.js
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -7059,7 +7059,7 @@ function Layout({
|
||||||
}
|
}
|
||||||
}), (0,external_React_namespaceObject.createElement)(EditPostPreferencesModal, null), (0,external_React_namespaceObject.createElement)(keyboard_shortcut_help_modal, null), (0,external_React_namespaceObject.createElement)(WelcomeGuide, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSyncStatusModal, null), (0,external_React_namespaceObject.createElement)(StartPageOptions, null), (0,external_React_namespaceObject.createElement)(external_wp_plugins_namespaceObject.PluginArea, {
|
}), (0,external_React_namespaceObject.createElement)(EditPostPreferencesModal, null), (0,external_React_namespaceObject.createElement)(keyboard_shortcut_help_modal, null), (0,external_React_namespaceObject.createElement)(WelcomeGuide, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSyncStatusModal, null), (0,external_React_namespaceObject.createElement)(StartPageOptions, null), (0,external_React_namespaceObject.createElement)(external_wp_plugins_namespaceObject.PluginArea, {
|
||||||
onError: onPluginAreaError
|
onError: onPluginAreaError
|
||||||
}), (0,external_React_namespaceObject.createElement)(settings_sidebar, null));
|
}), !isDistractionFree && (0,external_React_namespaceObject.createElement)(settings_sidebar, null));
|
||||||
}
|
}
|
||||||
/* harmony default export */ const components_layout = (Layout);
|
/* harmony default export */ const components_layout = (Layout);
|
||||||
|
|
||||||
|
@ -7072,6 +7072,7 @@ function Layout({
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
*/
|
*/
|
||||||
|
@ -7086,16 +7087,23 @@ function Layout({
|
||||||
const useBlockSelectionListener = postId => {
|
const useBlockSelectionListener = postId => {
|
||||||
const {
|
const {
|
||||||
hasBlockSelection,
|
hasBlockSelection,
|
||||||
isEditorSidebarOpened
|
isEditorSidebarOpened,
|
||||||
} = (0,external_wp_data_namespaceObject.useSelect)(select => ({
|
isDistractionFree
|
||||||
hasBlockSelection: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(),
|
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
||||||
isEditorSidebarOpened: select(constants_STORE_NAME).isEditorSidebarOpened()
|
const {
|
||||||
}), [postId]);
|
get
|
||||||
|
} = select(external_wp_preferences_namespaceObject.store);
|
||||||
|
return {
|
||||||
|
hasBlockSelection: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(),
|
||||||
|
isEditorSidebarOpened: select(constants_STORE_NAME).isEditorSidebarOpened(),
|
||||||
|
isDistractionFree: get('core', 'distractionFree')
|
||||||
|
};
|
||||||
|
}, [postId]);
|
||||||
const {
|
const {
|
||||||
openGeneralSidebar
|
openGeneralSidebar
|
||||||
} = (0,external_wp_data_namespaceObject.useDispatch)(constants_STORE_NAME);
|
} = (0,external_wp_data_namespaceObject.useDispatch)(constants_STORE_NAME);
|
||||||
(0,external_wp_element_namespaceObject.useEffect)(() => {
|
(0,external_wp_element_namespaceObject.useEffect)(() => {
|
||||||
if (!isEditorSidebarOpened) {
|
if (!isEditorSidebarOpened || isDistractionFree) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (hasBlockSelection) {
|
if (hasBlockSelection) {
|
||||||
|
@ -7609,6 +7617,7 @@ const {
|
||||||
* unsaved changes prompt).
|
* unsaved changes prompt).
|
||||||
*/
|
*/
|
||||||
function initializeEditor(id, postType, postId, settings, initialEdits) {
|
function initializeEditor(id, postType, postId, settings, initialEdits) {
|
||||||
|
const isMediumOrBigger = window.matchMedia('(min-width: 782px)').matches;
|
||||||
const target = document.getElementById(id);
|
const target = document.getElementById(id);
|
||||||
const root = (0,external_wp_element_namespaceObject.createRoot)(target);
|
const root = (0,external_wp_element_namespaceObject.createRoot)(target);
|
||||||
(0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/edit-post', {
|
(0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/edit-post', {
|
||||||
|
@ -7634,7 +7643,8 @@ function initializeEditor(id, postType, postId, settings, initialEdits) {
|
||||||
|
|
||||||
// Check if the block list view should be open by default.
|
// Check if the block list view should be open by default.
|
||||||
// If `distractionFree` mode is enabled, the block list view should not be open.
|
// If `distractionFree` mode is enabled, the block list view should not be open.
|
||||||
if ((0,external_wp_data_namespaceObject.select)(external_wp_preferences_namespaceObject.store).get('core', 'showListViewByDefault') && !(0,external_wp_data_namespaceObject.select)(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree')) {
|
// This behavior is disabled for small viewports.
|
||||||
|
if (isMediumOrBigger && (0,external_wp_data_namespaceObject.select)(external_wp_preferences_namespaceObject.store).get('core', 'showListViewByDefault') && !(0,external_wp_data_namespaceObject.select)(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree')) {
|
||||||
(0,external_wp_data_namespaceObject.dispatch)(external_wp_editor_namespaceObject.store).setIsListViewOpened(true);
|
(0,external_wp_data_namespaceObject.dispatch)(external_wp_editor_namespaceObject.store).setIsListViewOpened(true);
|
||||||
}
|
}
|
||||||
(0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)();
|
(0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)();
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -10474,6 +10474,7 @@ const setCanvasMode = mode => ({
|
||||||
registry,
|
registry,
|
||||||
dispatch
|
dispatch
|
||||||
}) => {
|
}) => {
|
||||||
|
const isMediumOrBigger = window.matchMedia('(min-width: 782px)').matches;
|
||||||
registry.dispatch(external_wp_blockEditor_namespaceObject.store).__unstableSetEditorMode('edit');
|
registry.dispatch(external_wp_blockEditor_namespaceObject.store).__unstableSetEditorMode('edit');
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'SET_CANVAS_MODE',
|
type: 'SET_CANVAS_MODE',
|
||||||
|
@ -10481,7 +10482,8 @@ const setCanvasMode = mode => ({
|
||||||
});
|
});
|
||||||
// Check if the block list view should be open by default.
|
// Check if the block list view should be open by default.
|
||||||
// If `distractionFree` mode is enabled, the block list view should not be open.
|
// If `distractionFree` mode is enabled, the block list view should not be open.
|
||||||
if (mode === 'edit' && registry.select(external_wp_preferences_namespaceObject.store).get('core', 'showListViewByDefault') && !registry.select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree')) {
|
// This behavior is disabled for small viewports.
|
||||||
|
if (isMediumOrBigger && mode === 'edit' && registry.select(external_wp_preferences_namespaceObject.store).get('core', 'showListViewByDefault') && !registry.select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree')) {
|
||||||
registry.dispatch(external_wp_editor_namespaceObject.store).setIsListViewOpened(true);
|
registry.dispatch(external_wp_editor_namespaceObject.store).setIsListViewOpened(true);
|
||||||
} else {
|
} else {
|
||||||
registry.dispatch(external_wp_editor_namespaceObject.store).setIsListViewOpened(false);
|
registry.dispatch(external_wp_editor_namespaceObject.store).setIsListViewOpened(false);
|
||||||
|
@ -16693,6 +16695,199 @@ function CreateTemplatePartModalContents({
|
||||||
}, confirmLabel))));
|
}, confirmLabel))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-pattern/index.js
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WordPress dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const {
|
||||||
|
useHistory: add_new_pattern_useHistory,
|
||||||
|
useLocation: add_new_pattern_useLocation
|
||||||
|
} = unlock(external_wp_router_namespaceObject.privateApis);
|
||||||
|
const {
|
||||||
|
CreatePatternModal,
|
||||||
|
useAddPatternCategory
|
||||||
|
} = unlock(external_wp_patterns_namespaceObject.privateApis);
|
||||||
|
function AddNewPattern() {
|
||||||
|
const history = add_new_pattern_useHistory();
|
||||||
|
const {
|
||||||
|
params
|
||||||
|
} = add_new_pattern_useLocation();
|
||||||
|
const [showPatternModal, setShowPatternModal] = (0,external_wp_element_namespaceObject.useState)(false);
|
||||||
|
const [showTemplatePartModal, setShowTemplatePartModal] = (0,external_wp_element_namespaceObject.useState)(false);
|
||||||
|
const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
||||||
|
return select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme;
|
||||||
|
}, []);
|
||||||
|
const {
|
||||||
|
createPatternFromFile
|
||||||
|
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_patterns_namespaceObject.store));
|
||||||
|
const {
|
||||||
|
createSuccessNotice,
|
||||||
|
createErrorNotice
|
||||||
|
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
|
||||||
|
const patternUploadInputRef = (0,external_wp_element_namespaceObject.useRef)();
|
||||||
|
function handleCreatePattern({
|
||||||
|
pattern,
|
||||||
|
categoryId
|
||||||
|
}) {
|
||||||
|
setShowPatternModal(false);
|
||||||
|
history.push({
|
||||||
|
postId: pattern.id,
|
||||||
|
postType: PATTERN_TYPES.user,
|
||||||
|
categoryType: PATTERN_TYPES.theme,
|
||||||
|
categoryId,
|
||||||
|
canvas: 'edit'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function handleCreateTemplatePart(templatePart) {
|
||||||
|
setShowTemplatePartModal(false);
|
||||||
|
|
||||||
|
// Navigate to the created template part editor.
|
||||||
|
history.push({
|
||||||
|
postId: templatePart.id,
|
||||||
|
postType: TEMPLATE_PART_POST_TYPE,
|
||||||
|
canvas: 'edit'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function handleError() {
|
||||||
|
setShowPatternModal(false);
|
||||||
|
setShowTemplatePartModal(false);
|
||||||
|
}
|
||||||
|
const controls = [{
|
||||||
|
icon: library_symbol,
|
||||||
|
onClick: () => setShowPatternModal(true),
|
||||||
|
title: (0,external_wp_i18n_namespaceObject.__)('Create pattern')
|
||||||
|
}];
|
||||||
|
if (isBlockBasedTheme) {
|
||||||
|
controls.push({
|
||||||
|
icon: symbol_filled,
|
||||||
|
onClick: () => setShowTemplatePartModal(true),
|
||||||
|
title: (0,external_wp_i18n_namespaceObject.__)('Create template part')
|
||||||
|
});
|
||||||
|
}
|
||||||
|
controls.push({
|
||||||
|
icon: library_upload,
|
||||||
|
onClick: () => {
|
||||||
|
patternUploadInputRef.current.click();
|
||||||
|
},
|
||||||
|
title: (0,external_wp_i18n_namespaceObject.__)('Import pattern from JSON')
|
||||||
|
});
|
||||||
|
const {
|
||||||
|
categoryMap,
|
||||||
|
findOrCreateTerm
|
||||||
|
} = useAddPatternCategory();
|
||||||
|
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
|
||||||
|
controls: controls,
|
||||||
|
toggleProps: {
|
||||||
|
as: SidebarButton
|
||||||
|
},
|
||||||
|
icon: library_plus,
|
||||||
|
label: (0,external_wp_i18n_namespaceObject.__)('Create pattern')
|
||||||
|
}), showPatternModal && (0,external_React_.createElement)(CreatePatternModal, {
|
||||||
|
onClose: () => setShowPatternModal(false),
|
||||||
|
onSuccess: handleCreatePattern,
|
||||||
|
onError: handleError
|
||||||
|
}), showTemplatePartModal && (0,external_React_.createElement)(CreateTemplatePartModal, {
|
||||||
|
closeModal: () => setShowTemplatePartModal(false),
|
||||||
|
blocks: [],
|
||||||
|
onCreate: handleCreateTemplatePart,
|
||||||
|
onError: handleError
|
||||||
|
}), (0,external_React_.createElement)("input", {
|
||||||
|
type: "file",
|
||||||
|
accept: ".json",
|
||||||
|
hidden: true,
|
||||||
|
ref: patternUploadInputRef,
|
||||||
|
onChange: async event => {
|
||||||
|
const file = event.target.files?.[0];
|
||||||
|
if (!file) return;
|
||||||
|
try {
|
||||||
|
let currentCategoryId;
|
||||||
|
// When we're not handling template parts, we should
|
||||||
|
// add or create the proper pattern category.
|
||||||
|
if (params.categoryType !== TEMPLATE_PART_POST_TYPE) {
|
||||||
|
const currentCategory = categoryMap.values().find(term => term.name === params.categoryId);
|
||||||
|
if (!!currentCategory) {
|
||||||
|
currentCategoryId = currentCategory.id || (await findOrCreateTerm(currentCategory.label));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const pattern = await createPatternFromFile(file, currentCategoryId ? [currentCategoryId] : undefined);
|
||||||
|
|
||||||
|
// Navigate to the All patterns category for the newly created pattern
|
||||||
|
// if we're not on that page already and if we're not in the `my-patterns`
|
||||||
|
// category.
|
||||||
|
if (!currentCategoryId && params.categoryId !== 'my-patterns') {
|
||||||
|
history.push({
|
||||||
|
path: `/patterns`,
|
||||||
|
categoryType: PATTERN_TYPES.theme,
|
||||||
|
categoryId: PATTERN_DEFAULT_CATEGORY
|
||||||
|
});
|
||||||
|
}
|
||||||
|
createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)(
|
||||||
|
// translators: %s: The imported pattern's title.
|
||||||
|
(0,external_wp_i18n_namespaceObject.__)('Imported "%s" from JSON.'), pattern.title.raw), {
|
||||||
|
type: 'snackbar',
|
||||||
|
id: 'import-pattern-success'
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
createErrorNotice(err.message, {
|
||||||
|
type: 'snackbar',
|
||||||
|
id: 'import-pattern-error'
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
event.target.value = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/category-item.js
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function CategoryItem({
|
||||||
|
count,
|
||||||
|
icon,
|
||||||
|
id,
|
||||||
|
isActive,
|
||||||
|
label,
|
||||||
|
type
|
||||||
|
}) {
|
||||||
|
const linkInfo = useLink({
|
||||||
|
path: '/patterns',
|
||||||
|
categoryType: type,
|
||||||
|
categoryId: id
|
||||||
|
});
|
||||||
|
if (!count) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return (0,external_React_.createElement)(SidebarNavigationItem, {
|
||||||
|
...linkInfo,
|
||||||
|
icon: icon,
|
||||||
|
suffix: (0,external_React_.createElement)("span", null, count),
|
||||||
|
"aria-current": isActive ? 'true' : undefined
|
||||||
|
}, label);
|
||||||
|
}
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js
|
||||||
/**
|
/**
|
||||||
* WordPress dependencies
|
* WordPress dependencies
|
||||||
|
@ -17292,6 +17487,9 @@ const selectThemePatterns = rememo(select => {
|
||||||
const {
|
const {
|
||||||
getSettings
|
getSettings
|
||||||
} = unlock(select(store_store));
|
} = unlock(select(store_store));
|
||||||
|
const {
|
||||||
|
getIsResolving
|
||||||
|
} = select(external_wp_coreData_namespaceObject.store);
|
||||||
const settings = getSettings();
|
const settings = getSettings();
|
||||||
const blockPatterns = (_settings$__experimen = settings.__experimentalAdditionalBlockPatterns) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : settings.__experimentalBlockPatterns;
|
const blockPatterns = (_settings$__experimen = settings.__experimentalAdditionalBlockPatterns) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : settings.__experimentalBlockPatterns;
|
||||||
const restBlockPatterns = select(external_wp_coreData_namespaceObject.store).getBlockPatterns();
|
const restBlockPatterns = select(external_wp_coreData_namespaceObject.store).getBlockPatterns();
|
||||||
|
@ -17305,15 +17503,17 @@ const selectThemePatterns = rememo(select => {
|
||||||
}));
|
}));
|
||||||
return {
|
return {
|
||||||
patterns,
|
patterns,
|
||||||
isResolving: false
|
isResolving: getIsResolving('getBlockPatterns')
|
||||||
};
|
};
|
||||||
}, select => [select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), unlock(select(store_store)).getSettings()]);
|
}, select => [select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), select(external_wp_coreData_namespaceObject.store).getIsResolving('getBlockPatterns'), unlock(select(store_store)).getSettings()]);
|
||||||
const selectPatterns = rememo((select, categoryId, syncStatus, search = '') => {
|
const selectPatterns = rememo((select, categoryId, syncStatus, search = '') => {
|
||||||
const {
|
const {
|
||||||
patterns: themePatterns
|
patterns: themePatterns,
|
||||||
|
isResolving: isResolvingThemePatterns
|
||||||
} = selectThemePatterns(select);
|
} = selectThemePatterns(select);
|
||||||
const {
|
const {
|
||||||
patterns: userPatterns
|
patterns: userPatterns,
|
||||||
|
isResolving: isResolvingUserPatterns
|
||||||
} = selectUserPatterns(select);
|
} = selectUserPatterns(select);
|
||||||
let patterns = [...(themePatterns || []), ...(userPatterns || [])];
|
let patterns = [...(themePatterns || []), ...(userPatterns || [])];
|
||||||
if (syncStatus) {
|
if (syncStatus) {
|
||||||
|
@ -17335,7 +17535,7 @@ const selectPatterns = rememo((select, categoryId, syncStatus, search = '') => {
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
patterns,
|
patterns,
|
||||||
isResolving: false
|
isResolving: isResolvingThemePatterns || isResolvingUserPatterns
|
||||||
};
|
};
|
||||||
}, select => [selectThemePatterns(select), selectUserPatterns(select)]);
|
}, select => [selectThemePatterns(select), selectUserPatterns(select)]);
|
||||||
|
|
||||||
|
@ -17516,189 +17716,6 @@ function usePatternCategories() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-pattern/index.js
|
|
||||||
|
|
||||||
/**
|
|
||||||
* WordPress dependencies
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Internal dependencies
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const {
|
|
||||||
useHistory: add_new_pattern_useHistory,
|
|
||||||
useLocation: add_new_pattern_useLocation
|
|
||||||
} = unlock(external_wp_router_namespaceObject.privateApis);
|
|
||||||
const {
|
|
||||||
CreatePatternModal
|
|
||||||
} = unlock(external_wp_patterns_namespaceObject.privateApis);
|
|
||||||
function AddNewPattern() {
|
|
||||||
const history = add_new_pattern_useHistory();
|
|
||||||
const {
|
|
||||||
params
|
|
||||||
} = add_new_pattern_useLocation();
|
|
||||||
const [showPatternModal, setShowPatternModal] = (0,external_wp_element_namespaceObject.useState)(false);
|
|
||||||
const [showTemplatePartModal, setShowTemplatePartModal] = (0,external_wp_element_namespaceObject.useState)(false);
|
|
||||||
const isBlockBasedTheme = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
|
||||||
return select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme;
|
|
||||||
}, []);
|
|
||||||
const {
|
|
||||||
createPatternFromFile
|
|
||||||
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_patterns_namespaceObject.store));
|
|
||||||
const {
|
|
||||||
createSuccessNotice,
|
|
||||||
createErrorNotice
|
|
||||||
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
|
|
||||||
const patternUploadInputRef = (0,external_wp_element_namespaceObject.useRef)();
|
|
||||||
const {
|
|
||||||
patternCategories
|
|
||||||
} = usePatternCategories();
|
|
||||||
function handleCreatePattern({
|
|
||||||
pattern,
|
|
||||||
categoryId
|
|
||||||
}) {
|
|
||||||
setShowPatternModal(false);
|
|
||||||
history.push({
|
|
||||||
postId: pattern.id,
|
|
||||||
postType: PATTERN_TYPES.user,
|
|
||||||
categoryType: PATTERN_TYPES.theme,
|
|
||||||
categoryId,
|
|
||||||
canvas: 'edit'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function handleCreateTemplatePart(templatePart) {
|
|
||||||
setShowTemplatePartModal(false);
|
|
||||||
|
|
||||||
// Navigate to the created template part editor.
|
|
||||||
history.push({
|
|
||||||
postId: templatePart.id,
|
|
||||||
postType: TEMPLATE_PART_POST_TYPE,
|
|
||||||
canvas: 'edit'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function handleError() {
|
|
||||||
setShowPatternModal(false);
|
|
||||||
setShowTemplatePartModal(false);
|
|
||||||
}
|
|
||||||
const controls = [{
|
|
||||||
icon: library_symbol,
|
|
||||||
onClick: () => setShowPatternModal(true),
|
|
||||||
title: (0,external_wp_i18n_namespaceObject.__)('Create pattern')
|
|
||||||
}];
|
|
||||||
if (isBlockBasedTheme) {
|
|
||||||
controls.push({
|
|
||||||
icon: symbol_filled,
|
|
||||||
onClick: () => setShowTemplatePartModal(true),
|
|
||||||
title: (0,external_wp_i18n_namespaceObject.__)('Create template part')
|
|
||||||
});
|
|
||||||
}
|
|
||||||
controls.push({
|
|
||||||
icon: library_upload,
|
|
||||||
onClick: () => {
|
|
||||||
patternUploadInputRef.current.click();
|
|
||||||
},
|
|
||||||
title: (0,external_wp_i18n_namespaceObject.__)('Import pattern from JSON')
|
|
||||||
});
|
|
||||||
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
|
|
||||||
controls: controls,
|
|
||||||
toggleProps: {
|
|
||||||
as: SidebarButton
|
|
||||||
},
|
|
||||||
icon: library_plus,
|
|
||||||
label: (0,external_wp_i18n_namespaceObject.__)('Create pattern')
|
|
||||||
}), showPatternModal && (0,external_React_.createElement)(CreatePatternModal, {
|
|
||||||
onClose: () => setShowPatternModal(false),
|
|
||||||
onSuccess: handleCreatePattern,
|
|
||||||
onError: handleError
|
|
||||||
}), showTemplatePartModal && (0,external_React_.createElement)(CreateTemplatePartModal, {
|
|
||||||
closeModal: () => setShowTemplatePartModal(false),
|
|
||||||
blocks: [],
|
|
||||||
onCreate: handleCreateTemplatePart,
|
|
||||||
onError: handleError
|
|
||||||
}), (0,external_React_.createElement)("input", {
|
|
||||||
type: "file",
|
|
||||||
accept: ".json",
|
|
||||||
hidden: true,
|
|
||||||
ref: patternUploadInputRef,
|
|
||||||
onChange: async event => {
|
|
||||||
const file = event.target.files?.[0];
|
|
||||||
if (!file) return;
|
|
||||||
try {
|
|
||||||
const currentCategoryId = params.categoryType !== TEMPLATE_PART_POST_TYPE && patternCategories.find(category => category.name === params.categoryId)?.id;
|
|
||||||
const pattern = await createPatternFromFile(file, currentCategoryId ? [currentCategoryId] : undefined);
|
|
||||||
|
|
||||||
// Navigate to the All patterns category for the newly created pattern
|
|
||||||
// if we're not on that page already.
|
|
||||||
if (!currentCategoryId) {
|
|
||||||
history.push({
|
|
||||||
path: `/patterns`,
|
|
||||||
categoryType: PATTERN_TYPES.theme,
|
|
||||||
categoryId: PATTERN_DEFAULT_CATEGORY
|
|
||||||
});
|
|
||||||
}
|
|
||||||
createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)(
|
|
||||||
// translators: %s: The imported pattern's title.
|
|
||||||
(0,external_wp_i18n_namespaceObject.__)('Imported "%s" from JSON.'), pattern.title.raw), {
|
|
||||||
type: 'snackbar',
|
|
||||||
id: 'import-pattern-success'
|
|
||||||
});
|
|
||||||
} catch (err) {
|
|
||||||
createErrorNotice(err.message, {
|
|
||||||
type: 'snackbar',
|
|
||||||
id: 'import-pattern-error'
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
event.target.value = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/category-item.js
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Internal dependencies
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
function CategoryItem({
|
|
||||||
count,
|
|
||||||
icon,
|
|
||||||
id,
|
|
||||||
isActive,
|
|
||||||
label,
|
|
||||||
type
|
|
||||||
}) {
|
|
||||||
const linkInfo = useLink({
|
|
||||||
path: '/patterns',
|
|
||||||
categoryType: type,
|
|
||||||
categoryId: id
|
|
||||||
});
|
|
||||||
if (!count) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return (0,external_React_.createElement)(SidebarNavigationItem, {
|
|
||||||
...linkInfo,
|
|
||||||
icon: icon,
|
|
||||||
suffix: (0,external_React_.createElement)("span", null, count),
|
|
||||||
"aria-current": isActive ? 'true' : undefined
|
|
||||||
}, label);
|
|
||||||
}
|
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js
|
||||||
/**
|
/**
|
||||||
* WordPress dependencies
|
* WordPress dependencies
|
||||||
|
@ -20245,6 +20262,7 @@ function ViewTable({
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
*/
|
*/
|
||||||
|
@ -20342,6 +20360,7 @@ function ViewGrid({
|
||||||
fields,
|
fields,
|
||||||
view,
|
view,
|
||||||
actions,
|
actions,
|
||||||
|
isLoading,
|
||||||
getItemId,
|
getItemId,
|
||||||
deferredRendering,
|
deferredRendering,
|
||||||
selection,
|
selection,
|
||||||
|
@ -20354,11 +20373,13 @@ function ViewGrid({
|
||||||
step: 3
|
step: 3
|
||||||
});
|
});
|
||||||
const usedData = deferredRendering ? shownData : data;
|
const usedData = deferredRendering ? shownData : data;
|
||||||
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalGrid, {
|
const hasData = !!usedData?.length;
|
||||||
|
return (0,external_React_.createElement)(external_React_.Fragment, null, hasData && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalGrid, {
|
||||||
gap: 6,
|
gap: 6,
|
||||||
columns: 2,
|
columns: 2,
|
||||||
alignment: "top",
|
alignment: "top",
|
||||||
className: "dataviews-view-grid"
|
className: "dataviews-view-grid",
|
||||||
|
"aria-busy": isLoading
|
||||||
}, usedData.map(item => {
|
}, usedData.map(item => {
|
||||||
return (0,external_React_.createElement)(GridItem, {
|
return (0,external_React_.createElement)(GridItem, {
|
||||||
key: getItemId(item),
|
key: getItemId(item),
|
||||||
|
@ -20372,7 +20393,12 @@ function ViewGrid({
|
||||||
primaryField: primaryField,
|
primaryField: primaryField,
|
||||||
visibleFields: visibleFields
|
visibleFields: visibleFields
|
||||||
});
|
});
|
||||||
}));
|
})), !hasData && (0,external_React_.createElement)("div", {
|
||||||
|
className: classnames_default()({
|
||||||
|
'dataviews-loading': isLoading,
|
||||||
|
'dataviews-no-results': !isLoading
|
||||||
|
})
|
||||||
|
}, (0,external_React_.createElement)("p", null, isLoading ? (0,external_wp_i18n_namespaceObject.__)('Loading…') : (0,external_wp_i18n_namespaceObject.__)('No results'))));
|
||||||
}
|
}
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/info.js
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/info.js
|
||||||
|
@ -21090,6 +21116,7 @@ function AddNewPageModal({
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
*/
|
*/
|
||||||
|
@ -21120,6 +21147,7 @@ const PageItem = ({
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
function SidebarNavigationScreenPages() {
|
function SidebarNavigationScreenPages() {
|
||||||
|
const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
|
||||||
const {
|
const {
|
||||||
records: pages,
|
records: pages,
|
||||||
isResolving: isLoadingPages
|
isResolving: isLoadingPages
|
||||||
|
@ -21235,7 +21263,7 @@ function SidebarNavigationScreenPages() {
|
||||||
withChevron: true
|
withChevron: true
|
||||||
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, {
|
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, {
|
||||||
numberOfLines: 1
|
numberOfLines: 1
|
||||||
}, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title?.rendered || (0,external_wp_i18n_namespaceObject.__)('(no title)'))))), (0,external_React_.createElement)(SidebarNavigationItem, {
|
}, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title?.rendered || (0,external_wp_i18n_namespaceObject.__)('(no title)'))))), !isMobileViewport && (0,external_React_.createElement)(SidebarNavigationItem, {
|
||||||
className: "edit-site-sidebar-navigation-screen-pages__see-all",
|
className: "edit-site-sidebar-navigation-screen-pages__see-all",
|
||||||
...pagesLink
|
...pagesLink
|
||||||
}, (0,external_wp_i18n_namespaceObject.__)('Manage all pages')))
|
}, (0,external_wp_i18n_namespaceObject.__)('Manage all pages')))
|
||||||
|
@ -22071,6 +22099,7 @@ function SidebarNavigationScreenPage({
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
*/
|
*/
|
||||||
|
@ -22104,6 +22133,7 @@ function SidebarScreenWrapper({
|
||||||
}
|
}
|
||||||
function SidebarScreens() {
|
function SidebarScreens() {
|
||||||
useSyncPathWithURL();
|
useSyncPathWithURL();
|
||||||
|
const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
|
||||||
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(SidebarScreenWrapper, {
|
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(SidebarScreenWrapper, {
|
||||||
path: "/"
|
path: "/"
|
||||||
}, (0,external_React_.createElement)(SidebarNavigationScreenMain, null)), (0,external_React_.createElement)(SidebarScreenWrapper, {
|
}, (0,external_React_.createElement)(SidebarNavigationScreenMain, null)), (0,external_React_.createElement)(SidebarScreenWrapper, {
|
||||||
|
@ -22123,7 +22153,7 @@ function SidebarScreens() {
|
||||||
path: "/page/:postId"
|
path: "/page/:postId"
|
||||||
}, (0,external_React_.createElement)(SidebarNavigationScreenPage, null)), (0,external_React_.createElement)(SidebarScreenWrapper, {
|
}, (0,external_React_.createElement)(SidebarNavigationScreenPage, null)), (0,external_React_.createElement)(SidebarScreenWrapper, {
|
||||||
path: "/:postType(wp_template)"
|
path: "/:postType(wp_template)"
|
||||||
}, (0,external_React_.createElement)(SidebarNavigationScreenTemplates, null)), (0,external_React_.createElement)(SidebarScreenWrapper, {
|
}, (0,external_React_.createElement)(SidebarNavigationScreenTemplates, null)), !isMobileViewport && (0,external_React_.createElement)(SidebarScreenWrapper, {
|
||||||
path: "/patterns"
|
path: "/patterns"
|
||||||
}, (0,external_React_.createElement)(SidebarNavigationScreenPatterns, null)), (0,external_React_.createElement)(SidebarScreenWrapper, {
|
}, (0,external_React_.createElement)(SidebarNavigationScreenPatterns, null)), (0,external_React_.createElement)(SidebarScreenWrapper, {
|
||||||
path: "/:postType(wp_template|wp_template_part)/all"
|
path: "/:postType(wp_template|wp_template_part)/all"
|
||||||
|
@ -25643,7 +25673,7 @@ const BlockPreviewPanel = ({
|
||||||
return (0,external_wp_blocks_namespaceObject.getBlockFromExample)(name, example);
|
return (0,external_wp_blocks_namespaceObject.getBlockFromExample)(name, example);
|
||||||
}, [name, blockExample, variation]);
|
}, [name, blockExample, variation]);
|
||||||
const viewportWidth = (_blockExample$viewpor = blockExample?.viewportWidth) !== null && _blockExample$viewpor !== void 0 ? _blockExample$viewpor : null;
|
const viewportWidth = (_blockExample$viewpor = blockExample?.viewportWidth) !== null && _blockExample$viewpor !== void 0 ? _blockExample$viewpor : null;
|
||||||
const previewHeight = '150px';
|
const previewHeight = 150;
|
||||||
if (!blockExample) {
|
if (!blockExample) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -25663,7 +25693,7 @@ const BlockPreviewPanel = ({
|
||||||
additionalStyles: [{
|
additionalStyles: [{
|
||||||
css: `
|
css: `
|
||||||
body{
|
body{
|
||||||
min-height:${previewHeight};
|
min-height:${previewHeight}px;
|
||||||
display:flex;align-items:center;justify-content:center;
|
display:flex;align-items:center;justify-content:center;
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
@ -27019,57 +27049,6 @@ function TabPanelLayout({
|
||||||
}
|
}
|
||||||
/* harmony default export */ const tab_panel_layout = (TabPanelLayout);
|
/* harmony default export */ const tab_panel_layout = (TabPanelLayout);
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/fonts-grid.js
|
|
||||||
|
|
||||||
/**
|
|
||||||
* WordPress dependencies
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
function FontsGrid({
|
|
||||||
title,
|
|
||||||
children,
|
|
||||||
pageSize = 32
|
|
||||||
}) {
|
|
||||||
const [lastItem, setLastItem] = (0,external_wp_element_namespaceObject.useState)(null);
|
|
||||||
const [page, setPage] = (0,external_wp_element_namespaceObject.useState)(1);
|
|
||||||
const itemsLimit = page * pageSize;
|
|
||||||
const items = children.slice(0, itemsLimit);
|
|
||||||
(0,external_wp_element_namespaceObject.useEffect)(() => {
|
|
||||||
if (lastItem) {
|
|
||||||
const observer = new window.IntersectionObserver(([entry]) => {
|
|
||||||
if (entry.isIntersecting) {
|
|
||||||
setPage(prevPage => prevPage + 1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
observer.observe(lastItem);
|
|
||||||
return () => observer.disconnect();
|
|
||||||
}
|
|
||||||
}, [lastItem]);
|
|
||||||
return (0,external_React_.createElement)("div", {
|
|
||||||
className: "font-library-modal__fonts-grid"
|
|
||||||
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
|
|
||||||
spacing: 0
|
|
||||||
}, title && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
|
|
||||||
className: "font-library-modal__subtitle"
|
|
||||||
}, title), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
|
|
||||||
margin: 2
|
|
||||||
})), (0,external_React_.createElement)("div", {
|
|
||||||
className: "font-library-modal__fonts-grid__main"
|
|
||||||
}, items.map((child, i) => {
|
|
||||||
if (i === itemsLimit - 1) {
|
|
||||||
return (0,external_React_.createElement)("div", {
|
|
||||||
key: child.key,
|
|
||||||
ref: setLastItem
|
|
||||||
}, child);
|
|
||||||
}
|
|
||||||
return (0,external_React_.createElement)("div", {
|
|
||||||
key: child.key
|
|
||||||
}, child);
|
|
||||||
}))));
|
|
||||||
}
|
|
||||||
/* harmony default export */ const fonts_grid = (FontsGrid);
|
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-demo.js
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/font-library-modal/font-demo.js
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27397,7 +27376,6 @@ function ConfirmDeleteDialog({
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
ProgressBar
|
ProgressBar
|
||||||
} = unlock(external_wp_components_namespaceObject.privateApis);
|
} = unlock(external_wp_components_namespaceObject.privateApis);
|
||||||
|
@ -27470,23 +27448,27 @@ function InstalledFonts() {
|
||||||
margin: 2
|
margin: 2
|
||||||
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.Spinner, null), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
|
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.Spinner, null), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
|
||||||
margin: 2
|
margin: 2
|
||||||
})), baseCustomFonts.length > 0 && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(fonts_grid, null, baseCustomFonts.map(font => (0,external_React_.createElement)(library_font_card, {
|
})), baseCustomFonts.length > 0 && (0,external_React_.createElement)(external_React_.Fragment, null, baseCustomFonts.map(font => (0,external_React_.createElement)(library_font_card, {
|
||||||
|
font: font,
|
||||||
|
key: font.slug,
|
||||||
|
onClick: () => {
|
||||||
|
handleSelectFont(font);
|
||||||
|
}
|
||||||
|
})), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
|
||||||
|
margin: 8
|
||||||
|
})), baseThemeFonts.length > 0 && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
|
||||||
|
className: "font-library-modal__subtitle"
|
||||||
|
}, (0,external_wp_i18n_namespaceObject.__)('Theme Fonts')), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
|
||||||
|
margin: 2
|
||||||
|
}), baseThemeFonts.map(font => (0,external_React_.createElement)(library_font_card, {
|
||||||
font: font,
|
font: font,
|
||||||
key: font.slug,
|
key: font.slug,
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
handleSelectFont(font);
|
handleSelectFont(font);
|
||||||
}
|
}
|
||||||
}))), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
|
}))), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
|
||||||
margin: 8
|
margin: 16
|
||||||
})), baseThemeFonts.length > 0 && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(fonts_grid, {
|
})), libraryFontSelected && (0,external_React_.createElement)(library_font_details, {
|
||||||
title: (0,external_wp_i18n_namespaceObject.__)('Theme Fonts')
|
|
||||||
}, baseThemeFonts.map(font => (0,external_React_.createElement)(library_font_card, {
|
|
||||||
font: font,
|
|
||||||
key: font.slug,
|
|
||||||
onClick: () => {
|
|
||||||
handleSelectFont(font);
|
|
||||||
}
|
|
||||||
}))))), libraryFontSelected && (0,external_React_.createElement)(library_font_details, {
|
|
||||||
font: libraryFontSelected,
|
font: libraryFontSelected,
|
||||||
isConfirmDeleteOpen: isConfirmDeleteOpen,
|
isConfirmDeleteOpen: isConfirmDeleteOpen,
|
||||||
handleConfirmUninstall: handleConfirmUninstall,
|
handleConfirmUninstall: handleConfirmUninstall,
|
||||||
|
@ -27655,7 +27637,7 @@ function CollectionFontDetails({
|
||||||
// If the font has no fontFace, we want to check if the font is in the outline
|
// If the font has no fontFace, we want to check if the font is in the outline
|
||||||
fontToInstallOutline)
|
fontToInstallOutline)
|
||||||
}))), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
|
}))), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
|
||||||
margin: 8
|
margin: 16
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
/* harmony default export */ const collection_font_details = (CollectionFontDetails);
|
/* harmony default export */ const collection_font_details = (CollectionFontDetails);
|
||||||
|
@ -27677,7 +27659,7 @@ function GoogleFontsConfirmDialog() {
|
||||||
className: "font-library__google-fonts-confirm"
|
className: "font-library__google-fonts-confirm"
|
||||||
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Card, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
|
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Card, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
|
||||||
as: "h3"
|
as: "h3"
|
||||||
}, "Connect to Google Fonts"), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
|
}, (0,external_wp_i18n_namespaceObject.__)('Connect to Google Fonts')), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
|
||||||
margin: 6
|
margin: 6
|
||||||
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
|
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
|
||||||
as: "p"
|
as: "p"
|
||||||
|
@ -27717,7 +27699,6 @@ function GoogleFontsConfirmDialog() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const DEFAULT_CATEGORY = {
|
const DEFAULT_CATEGORY = {
|
||||||
slug: 'all',
|
slug: 'all',
|
||||||
name: (0,external_wp_i18n_namespaceObject._x)('All', 'font categories')
|
name: (0,external_wp_i18n_namespaceObject._x)('All', 'font categories')
|
||||||
|
@ -27732,6 +27713,7 @@ function FontCollection({
|
||||||
};
|
};
|
||||||
const [selectedFont, setSelectedFont] = (0,external_wp_element_namespaceObject.useState)(null);
|
const [selectedFont, setSelectedFont] = (0,external_wp_element_namespaceObject.useState)(null);
|
||||||
const [fontsToInstall, setFontsToInstall] = (0,external_wp_element_namespaceObject.useState)([]);
|
const [fontsToInstall, setFontsToInstall] = (0,external_wp_element_namespaceObject.useState)([]);
|
||||||
|
const [page, setPage] = (0,external_wp_element_namespaceObject.useState)(1);
|
||||||
const [filters, setFilters] = (0,external_wp_element_namespaceObject.useState)({});
|
const [filters, setFilters] = (0,external_wp_element_namespaceObject.useState)({});
|
||||||
const [renderConfirmDialog, setRenderConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(requiresPermission && !getGoogleFontsPermissionFromStorage());
|
const [renderConfirmDialog, setRenderConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(requiresPermission && !getGoogleFontsPermissionFromStorage());
|
||||||
const {
|
const {
|
||||||
|
@ -27781,27 +27763,39 @@ function FontCollection({
|
||||||
const collectionCategories = (_selectedCollection$c = selectedCollection?.categories) !== null && _selectedCollection$c !== void 0 ? _selectedCollection$c : [];
|
const collectionCategories = (_selectedCollection$c = selectedCollection?.categories) !== null && _selectedCollection$c !== void 0 ? _selectedCollection$c : [];
|
||||||
const categories = [DEFAULT_CATEGORY, ...collectionCategories];
|
const categories = [DEFAULT_CATEGORY, ...collectionCategories];
|
||||||
const fonts = (0,external_wp_element_namespaceObject.useMemo)(() => filterFonts(collectionFonts, filters), [collectionFonts, filters]);
|
const fonts = (0,external_wp_element_namespaceObject.useMemo)(() => filterFonts(collectionFonts, filters), [collectionFonts, filters]);
|
||||||
|
|
||||||
|
// NOTE: The height of the font library modal unavailable to use for rendering font family items is roughly 417px
|
||||||
|
// The height of each font family item is 61px.
|
||||||
|
const pageSize = Math.floor((window.innerHeight - 417) / 61);
|
||||||
|
const totalPages = Math.ceil(fonts.length / pageSize);
|
||||||
|
const itemsStart = (page - 1) * pageSize;
|
||||||
|
const itemsLimit = page * pageSize;
|
||||||
|
const items = fonts.slice(itemsStart, itemsLimit);
|
||||||
const handleCategoryFilter = category => {
|
const handleCategoryFilter = category => {
|
||||||
setFilters({
|
setFilters({
|
||||||
...filters,
|
...filters,
|
||||||
category
|
category
|
||||||
});
|
});
|
||||||
|
setPage(1);
|
||||||
};
|
};
|
||||||
const handleUpdateSearchInput = value => {
|
const handleUpdateSearchInput = value => {
|
||||||
setFilters({
|
setFilters({
|
||||||
...filters,
|
...filters,
|
||||||
search: value
|
search: value
|
||||||
});
|
});
|
||||||
|
setPage(1);
|
||||||
};
|
};
|
||||||
const debouncedUpdateSearchInput = (0,external_wp_compose_namespaceObject.debounce)(handleUpdateSearchInput, 300);
|
const debouncedUpdateSearchInput = (0,external_wp_compose_namespaceObject.debounce)(handleUpdateSearchInput, 300);
|
||||||
const resetFilters = () => {
|
const resetFilters = () => {
|
||||||
setFilters({});
|
setFilters({});
|
||||||
|
setPage(1);
|
||||||
};
|
};
|
||||||
const resetSearch = () => {
|
const resetSearch = () => {
|
||||||
setFilters({
|
setFilters({
|
||||||
...filters,
|
...filters,
|
||||||
search: ''
|
search: ''
|
||||||
});
|
});
|
||||||
|
setPage(1);
|
||||||
};
|
};
|
||||||
const handleUnselectFont = () => {
|
const handleUnselectFont = () => {
|
||||||
setSelectedFont(null);
|
setSelectedFont(null);
|
||||||
|
@ -27848,15 +27842,25 @@ function FontCollection({
|
||||||
}
|
}
|
||||||
resetFontsToInstall();
|
resetFontsToInstall();
|
||||||
};
|
};
|
||||||
|
let footerComponent = null;
|
||||||
|
if (selectedFont) {
|
||||||
|
footerComponent = (0,external_React_.createElement)(InstallFooter, {
|
||||||
|
handleInstall: handleInstall,
|
||||||
|
isDisabled: fontsToInstall.length === 0
|
||||||
|
});
|
||||||
|
} else if (!renderConfirmDialog && totalPages > 1) {
|
||||||
|
footerComponent = (0,external_React_.createElement)(PaginationFooter, {
|
||||||
|
page: page,
|
||||||
|
totalPages: totalPages,
|
||||||
|
setPage: setPage
|
||||||
|
});
|
||||||
|
}
|
||||||
return (0,external_React_.createElement)(tab_panel_layout, {
|
return (0,external_React_.createElement)(tab_panel_layout, {
|
||||||
title: !selectedFont ? selectedCollection.name : selectedFont.name,
|
title: !selectedFont ? selectedCollection.name : selectedFont.name,
|
||||||
description: !selectedFont ? selectedCollection.description : (0,external_wp_i18n_namespaceObject.__)('Select font variants to install.'),
|
description: !selectedFont ? selectedCollection.description : (0,external_wp_i18n_namespaceObject.__)('Select font variants to install.'),
|
||||||
notice: notice,
|
notice: notice,
|
||||||
handleBack: !!selectedFont && handleUnselectFont,
|
handleBack: !!selectedFont && handleUnselectFont,
|
||||||
footer: (0,external_React_.createElement)(font_collection_Footer, {
|
footer: footerComponent
|
||||||
handleInstall: handleInstall,
|
|
||||||
isDisabled: fontsToInstall.length === 0
|
|
||||||
})
|
|
||||||
}, renderConfirmDialog && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
|
}, renderConfirmDialog && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
|
||||||
margin: 8
|
margin: 8
|
||||||
}), (0,external_React_.createElement)(google_fonts_confirm_dialog, null)), !renderConfirmDialog && !selectedFont && (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalInputControl, {
|
}), (0,external_React_.createElement)(google_fonts_confirm_dialog, null)), !renderConfirmDialog && !selectedFont && (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalInputControl, {
|
||||||
|
@ -27884,7 +27888,9 @@ function FontCollection({
|
||||||
font: selectedFont,
|
font: selectedFont,
|
||||||
handleToggleVariant: handleToggleVariant,
|
handleToggleVariant: handleToggleVariant,
|
||||||
fontToInstallOutline: fontToInstallOutline
|
fontToInstallOutline: fontToInstallOutline
|
||||||
}), !renderConfirmDialog && !selectedFont && (0,external_React_.createElement)(fonts_grid, null, fonts.map(font => (0,external_React_.createElement)(font_card, {
|
}), !renderConfirmDialog && !selectedFont && (0,external_React_.createElement)("div", {
|
||||||
|
className: "font-library-modal__fonts-grid__main"
|
||||||
|
}, items.map(font => (0,external_React_.createElement)(font_card, {
|
||||||
key: font.font_family_settings.slug,
|
key: font.font_family_settings.slug,
|
||||||
font: font.font_family_settings,
|
font: font.font_family_settings,
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
|
@ -27892,7 +27898,60 @@ function FontCollection({
|
||||||
}
|
}
|
||||||
}))));
|
}))));
|
||||||
}
|
}
|
||||||
function font_collection_Footer({
|
function PaginationFooter({
|
||||||
|
page,
|
||||||
|
totalPages,
|
||||||
|
setPage
|
||||||
|
}) {
|
||||||
|
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
|
||||||
|
justify: "center"
|
||||||
|
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
|
||||||
|
label: (0,external_wp_i18n_namespaceObject.__)('First page'),
|
||||||
|
size: "compact",
|
||||||
|
onClick: () => setPage(1),
|
||||||
|
disabled: page === 1,
|
||||||
|
__experimentalIsFocusable: true
|
||||||
|
}, (0,external_React_.createElement)("span", null, "\xAB")), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
|
||||||
|
label: (0,external_wp_i18n_namespaceObject.__)('Previous page'),
|
||||||
|
size: "compact",
|
||||||
|
onClick: () => setPage(page - 1),
|
||||||
|
disabled: page === 1,
|
||||||
|
__experimentalIsFocusable: true
|
||||||
|
}, (0,external_React_.createElement)("span", null, "\u2039")), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
|
||||||
|
justify: "flex-start",
|
||||||
|
expanded: false,
|
||||||
|
spacing: 2
|
||||||
|
}, (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(
|
||||||
|
// translators: %s: Total number of pages.
|
||||||
|
(0,external_wp_i18n_namespaceObject._x)('Page <CurrenPageControl /> of %s', 'paging'), totalPages), {
|
||||||
|
CurrenPageControl: (0,external_React_.createElement)(external_wp_components_namespaceObject.SelectControl, {
|
||||||
|
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Current page'),
|
||||||
|
value: page,
|
||||||
|
options: [...Array(totalPages)].map((e, i) => {
|
||||||
|
return {
|
||||||
|
label: i + 1,
|
||||||
|
value: i + 1
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
onChange: newPage => setPage(parseInt(newPage)),
|
||||||
|
size: 'compact',
|
||||||
|
__nextHasNoMarginBottom: true
|
||||||
|
})
|
||||||
|
})), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
|
||||||
|
label: (0,external_wp_i18n_namespaceObject.__)('Next page'),
|
||||||
|
size: "compact",
|
||||||
|
onClick: () => setPage(page + 1),
|
||||||
|
disabled: page === totalPages,
|
||||||
|
__experimentalIsFocusable: true
|
||||||
|
}, (0,external_React_.createElement)("span", null, "\u203A")), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
|
||||||
|
label: (0,external_wp_i18n_namespaceObject.__)('Last page'),
|
||||||
|
size: "compact",
|
||||||
|
onClick: () => setPage(totalPages),
|
||||||
|
disabled: page === totalPages,
|
||||||
|
__experimentalIsFocusable: true
|
||||||
|
}, (0,external_React_.createElement)("span", null, "\xBB")));
|
||||||
|
}
|
||||||
|
function InstallFooter({
|
||||||
handleInstall,
|
handleInstall,
|
||||||
isDisabled
|
isDisabled
|
||||||
}) {
|
}) {
|
||||||
|
@ -36205,7 +36264,7 @@ function Editor({
|
||||||
rules: blockRemovalRules
|
rules: blockRemovalRules
|
||||||
}), (0,external_React_.createElement)(PatternModal, null)), editorMode === 'text' && isEditMode && (0,external_React_.createElement)(CodeEditor, null), isEditMode && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(edit_mode, null), (0,external_React_.createElement)(external_wp_editor_namespaceObject.EditorKeyboardShortcutsRegister, null), (0,external_React_.createElement)(external_wp_editor_namespaceObject.EditorKeyboardShortcuts, null))),
|
}), (0,external_React_.createElement)(PatternModal, null)), editorMode === 'text' && isEditMode && (0,external_React_.createElement)(CodeEditor, null), isEditMode && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(edit_mode, null), (0,external_React_.createElement)(external_wp_editor_namespaceObject.EditorKeyboardShortcutsRegister, null), (0,external_React_.createElement)(external_wp_editor_namespaceObject.EditorKeyboardShortcuts, null))),
|
||||||
secondarySidebar: isEditMode && (shouldShowInserter && (0,external_React_.createElement)(InserterSidebar, null) || shouldShowListView && (0,external_React_.createElement)(ListViewSidebar, null)),
|
secondarySidebar: isEditMode && (shouldShowInserter && (0,external_React_.createElement)(InserterSidebar, null) || shouldShowListView && (0,external_React_.createElement)(ListViewSidebar, null)),
|
||||||
sidebar: isEditMode && isRightSidebarOpen && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(complementary_area.Slot, {
|
sidebar: !isDistractionFree && isEditMode && isRightSidebarOpen && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(complementary_area.Slot, {
|
||||||
scope: "core/edit-site"
|
scope: "core/edit-site"
|
||||||
})),
|
})),
|
||||||
footer: shouldShowBlockBreadcrumbs && (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, {
|
footer: shouldShowBlockBreadcrumbs && (0,external_React_.createElement)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, {
|
||||||
|
@ -44607,6 +44666,7 @@ function PageTemplatesTemplateParts({
|
||||||
setView(newView);
|
setView(newView);
|
||||||
}, [view.type, setView, history, params]);
|
}, [view.type, setView, history, params]);
|
||||||
return (0,external_React_.createElement)(Page, {
|
return (0,external_React_.createElement)(Page, {
|
||||||
|
className: "edit-site-page-template-template-parts-dataviews",
|
||||||
title: postType === constants_TEMPLATE_POST_TYPE ? (0,external_wp_i18n_namespaceObject.__)('Templates') : (0,external_wp_i18n_namespaceObject.__)('Template Parts'),
|
title: postType === constants_TEMPLATE_POST_TYPE ? (0,external_wp_i18n_namespaceObject.__)('Templates') : (0,external_wp_i18n_namespaceObject.__)('Template Parts'),
|
||||||
actions: postType === constants_TEMPLATE_POST_TYPE ? (0,external_React_.createElement)(AddNewTemplate, {
|
actions: postType === constants_TEMPLATE_POST_TYPE ? (0,external_React_.createElement)(AddNewTemplate, {
|
||||||
templateType: postType,
|
templateType: postType,
|
||||||
|
@ -44659,8 +44719,13 @@ function useLayoutAreas() {
|
||||||
postId,
|
postId,
|
||||||
path,
|
path,
|
||||||
layout,
|
layout,
|
||||||
isCustom
|
isCustom,
|
||||||
|
canvas
|
||||||
} = params !== null && params !== void 0 ? params : {};
|
} = params !== null && params !== void 0 ? params : {};
|
||||||
|
|
||||||
|
// Note: Since "sidebar" is not yet supported here,
|
||||||
|
// returning undefined from "mobile" means show the sidebar.
|
||||||
|
|
||||||
// Regular page
|
// Regular page
|
||||||
if (path === '/page') {
|
if (path === '/page') {
|
||||||
return {
|
return {
|
||||||
|
@ -44668,7 +44733,10 @@ function useLayoutAreas() {
|
||||||
content: undefined,
|
content: undefined,
|
||||||
preview: (0,external_React_.createElement)(Editor, {
|
preview: (0,external_React_.createElement)(Editor, {
|
||||||
isLoading: isSiteEditorLoading
|
isLoading: isSiteEditorLoading
|
||||||
})
|
}),
|
||||||
|
mobile: canvas === 'edit' ? (0,external_React_.createElement)(Editor, {
|
||||||
|
isLoading: isSiteEditorLoading
|
||||||
|
}) : undefined
|
||||||
},
|
},
|
||||||
widths: {
|
widths: {
|
||||||
content: undefined
|
content: undefined
|
||||||
|
@ -44699,7 +44767,10 @@ function useLayoutAreas() {
|
||||||
areas: {
|
areas: {
|
||||||
preview: (0,external_React_.createElement)(Editor, {
|
preview: (0,external_React_.createElement)(Editor, {
|
||||||
isLoading: isSiteEditorLoading
|
isLoading: isSiteEditorLoading
|
||||||
})
|
}),
|
||||||
|
mobile: canvas === 'edit' ? (0,external_React_.createElement)(Editor, {
|
||||||
|
isLoading: isSiteEditorLoading
|
||||||
|
}) : undefined
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -44713,6 +44784,9 @@ function useLayoutAreas() {
|
||||||
}),
|
}),
|
||||||
preview: isListLayout && (0,external_React_.createElement)(Editor, {
|
preview: isListLayout && (0,external_React_.createElement)(Editor, {
|
||||||
isLoading: isSiteEditorLoading
|
isLoading: isSiteEditorLoading
|
||||||
|
}),
|
||||||
|
mobile: (0,external_React_.createElement)(PageTemplatesTemplateParts, {
|
||||||
|
postType: constants_TEMPLATE_POST_TYPE
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
widths: {
|
widths: {
|
||||||
|
@ -44730,6 +44804,9 @@ function useLayoutAreas() {
|
||||||
}),
|
}),
|
||||||
preview: isListLayout && (0,external_React_.createElement)(Editor, {
|
preview: isListLayout && (0,external_React_.createElement)(Editor, {
|
||||||
isLoading: isSiteEditorLoading
|
isLoading: isSiteEditorLoading
|
||||||
|
}),
|
||||||
|
mobile: (0,external_React_.createElement)(PageTemplatesTemplateParts, {
|
||||||
|
postType: TEMPLATE_PART_POST_TYPE
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
widths: {
|
widths: {
|
||||||
|
@ -44742,7 +44819,8 @@ function useLayoutAreas() {
|
||||||
if (path === '/patterns') {
|
if (path === '/patterns') {
|
||||||
return {
|
return {
|
||||||
areas: {
|
areas: {
|
||||||
content: (0,external_React_.createElement)(DataviewsPatterns, null)
|
content: (0,external_React_.createElement)(DataviewsPatterns, null),
|
||||||
|
mobile: (0,external_React_.createElement)(DataviewsPatterns, null)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -44752,7 +44830,10 @@ function useLayoutAreas() {
|
||||||
areas: {
|
areas: {
|
||||||
preview: (0,external_React_.createElement)(Editor, {
|
preview: (0,external_React_.createElement)(Editor, {
|
||||||
isLoading: isSiteEditorLoading
|
isLoading: isSiteEditorLoading
|
||||||
})
|
}),
|
||||||
|
mobile: canvas === 'edit' ? (0,external_React_.createElement)(Editor, {
|
||||||
|
isLoading: isSiteEditorLoading
|
||||||
|
}) : undefined
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -44971,7 +45052,7 @@ function Layout() {
|
||||||
}
|
}
|
||||||
}, (0,external_React_.createElement)(HeaderEditMode, null)))), (0,external_React_.createElement)("div", {
|
}, (0,external_React_.createElement)(HeaderEditMode, null)))), (0,external_React_.createElement)("div", {
|
||||||
className: "edit-site-layout__content"
|
className: "edit-site-layout__content"
|
||||||
}, (0,external_React_.createElement)(NavigableRegion, {
|
}, (!isMobileViewport || isMobileViewport && !areas.mobile) && (0,external_React_.createElement)(NavigableRegion, {
|
||||||
ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Navigation'),
|
ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Navigation'),
|
||||||
className: "edit-site-layout__sidebar-region"
|
className: "edit-site-layout__sidebar-region"
|
||||||
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableAnimatePresence, null, canvasMode === 'view' && (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
|
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableAnimatePresence, null, canvasMode === 'view' && (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
|
||||||
|
@ -44992,12 +45073,17 @@ function Layout() {
|
||||||
ease: 'easeOut'
|
ease: 'easeOut'
|
||||||
},
|
},
|
||||||
className: "edit-site-layout__sidebar"
|
className: "edit-site-layout__sidebar"
|
||||||
}, (0,external_React_.createElement)(sidebar, null)))), (0,external_React_.createElement)(SavePanel, null), areas.content && canvasMode !== 'edit' && (0,external_React_.createElement)("div", {
|
}, (0,external_React_.createElement)(sidebar, null)))), (0,external_React_.createElement)(SavePanel, null), isMobileViewport && areas.mobile && (0,external_React_.createElement)("div", {
|
||||||
|
className: "edit-site-layout__mobile",
|
||||||
|
style: {
|
||||||
|
maxWidth: widths?.content
|
||||||
|
}
|
||||||
|
}, areas.mobile), !isMobileViewport && areas.content && canvasMode !== 'edit' && (0,external_React_.createElement)("div", {
|
||||||
className: "edit-site-layout__area",
|
className: "edit-site-layout__area",
|
||||||
style: {
|
style: {
|
||||||
maxWidth: widths?.content
|
maxWidth: widths?.content
|
||||||
}
|
}
|
||||||
}, areas.content), areas.preview && (0,external_React_.createElement)("div", {
|
}, areas.content), !isMobileViewport && areas.preview && (0,external_React_.createElement)("div", {
|
||||||
className: "edit-site-layout__canvas-container"
|
className: "edit-site-layout__canvas-container"
|
||||||
}, canvasResizer, !!canvasSize.width && (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
|
}, canvasResizer, !!canvasSize.width && (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
|
||||||
whileHover: canvasMode === 'view' ? {
|
whileHover: canvasMode === 'view' ? {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -14687,12 +14687,14 @@ function mediaUpload({
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const EMPTY_BLOCKS_LIST = [];
|
const EMPTY_BLOCKS_LIST = [];
|
||||||
const BLOCK_EDITOR_SETTINGS = ['__experimentalBlockDirectory', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', '__experimentalPreferredStyleVariations', '__unstableGalleryWithImageBlocks', 'alignWide', 'blockInspectorTabs', 'allowedMimeTypes', 'bodyPlaceholder', 'canLockBlocks', 'capabilities', 'clearBlockSelection', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'enableOpenverseMediaCategory', 'fontSizes', 'gradients', 'generateAnchors', 'onNavigateToEntityRecord', 'hasInlineToolbar', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'locale', 'maxWidth', 'onUpdateDefaultBlockStyles', 'postContentAttributes', 'postsPerPage', 'readOnly', 'styles', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableHasCustomAppender', '__unstableIsPreviewMode', '__unstableResolvedAssets', '__unstableIsBlockBasedTheme', '__experimentalArchiveTitleTypeLabel', '__experimentalArchiveTitleNameLabel'];
|
const BLOCK_EDITOR_SETTINGS = ['__experimentalBlockDirectory', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', '__experimentalPreferredStyleVariations', '__unstableGalleryWithImageBlocks', 'alignWide', 'blockInspectorTabs', 'allowedMimeTypes', 'bodyPlaceholder', 'canLockBlocks', 'capabilities', 'clearBlockSelection', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'enableOpenverseMediaCategory', 'fontSizes', 'gradients', 'generateAnchors', 'onNavigateToEntityRecord', 'hasInlineToolbar', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'locale', 'maxWidth', 'onUpdateDefaultBlockStyles', 'postContentAttributes', 'postsPerPage', 'readOnly', 'styles', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableHasCustomAppender', '__unstableIsPreviewMode', '__unstableResolvedAssets', '__unstableIsBlockBasedTheme', '__experimentalArchiveTitleTypeLabel', '__experimentalArchiveTitleNameLabel'];
|
||||||
|
|
||||||
|
@ -14823,13 +14825,7 @@ function useBlockEditorSettings(settings, postType, postId) {
|
||||||
keepCaretInsideBlock,
|
keepCaretInsideBlock,
|
||||||
mediaUpload: hasUploadPermissions ? mediaUpload : undefined,
|
mediaUpload: hasUploadPermissions ? mediaUpload : undefined,
|
||||||
__experimentalBlockPatterns: blockPatterns,
|
__experimentalBlockPatterns: blockPatterns,
|
||||||
__experimentalFetchBlockPatterns: async () => {
|
[unlock(external_wp_blockEditor_namespaceObject.privateApis).selectBlockPatternsKey]: select => unlock(select(external_wp_coreData_namespaceObject.store)).getBlockPatternsForPostType(postType),
|
||||||
return (await (0,external_wp_coreData_namespaceObject.fetchBlockPatterns)()).filter(({
|
|
||||||
postTypes
|
|
||||||
}) => {
|
|
||||||
return !postTypes || Array.isArray(postTypes) && postTypes.includes(postType);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
__experimentalReusableBlocks: reusableBlocks,
|
__experimentalReusableBlocks: reusableBlocks,
|
||||||
__experimentalBlockPatternCategories: blockPatternCategories,
|
__experimentalBlockPatternCategories: blockPatternCategories,
|
||||||
__experimentalUserPatternCategories: userPatternCategories,
|
__experimentalUserPatternCategories: userPatternCategories,
|
||||||
|
@ -15941,6 +15937,7 @@ function DocumentTools({
|
||||||
setIsListViewOpened
|
setIsListViewOpened
|
||||||
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
|
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
|
||||||
const {
|
const {
|
||||||
|
isDistractionFree,
|
||||||
isInserterOpened,
|
isInserterOpened,
|
||||||
isListViewOpen,
|
isListViewOpen,
|
||||||
listViewShortcut,
|
listViewShortcut,
|
||||||
|
@ -15967,7 +15964,8 @@ function DocumentTools({
|
||||||
listViewShortcut: getShortcutRepresentation('core/editor/toggle-list-view'),
|
listViewShortcut: getShortcutRepresentation('core/editor/toggle-list-view'),
|
||||||
listViewToggleRef: getListViewToggleRef(),
|
listViewToggleRef: getListViewToggleRef(),
|
||||||
hasFixedToolbar: getSettings().hasFixedToolbar,
|
hasFixedToolbar: getSettings().hasFixedToolbar,
|
||||||
showIconLabels: get('core', 'showIconLabels')
|
showIconLabels: get('core', 'showIconLabels'),
|
||||||
|
isDistractionFree: get('core', 'distractionFree')
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
|
const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
|
||||||
|
@ -16033,7 +16031,7 @@ function DocumentTools({
|
||||||
showTooltip: !showIconLabels,
|
showTooltip: !showIconLabels,
|
||||||
variant: showIconLabels ? 'tertiary' : undefined,
|
variant: showIconLabels ? 'tertiary' : undefined,
|
||||||
size: "compact"
|
size: "compact"
|
||||||
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
|
}), !isDistractionFree && (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
|
||||||
as: external_wp_components_namespaceObject.Button,
|
as: external_wp_components_namespaceObject.Button,
|
||||||
className: "editor-document-tools__document-overview-toggle",
|
className: "editor-document-tools__document-overview-toggle",
|
||||||
icon: list_view,
|
icon: list_view,
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -365,6 +365,101 @@ function CategorySelector({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/private-hooks.js
|
||||||
|
/**
|
||||||
|
* WordPress dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper hook that creates a Map with the core and user patterns categories
|
||||||
|
* and removes any duplicates. It's used when we need to create new user
|
||||||
|
* categories when creating or importing patterns.
|
||||||
|
* This hook also provides a function to find or create a pattern category.
|
||||||
|
*
|
||||||
|
* @return {Object} The merged categories map and the callback function to find or create a category.
|
||||||
|
*/
|
||||||
|
function useAddPatternCategory() {
|
||||||
|
const {
|
||||||
|
saveEntityRecord,
|
||||||
|
invalidateResolution
|
||||||
|
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
|
||||||
|
const {
|
||||||
|
corePatternCategories,
|
||||||
|
userPatternCategories
|
||||||
|
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
||||||
|
const {
|
||||||
|
getUserPatternCategories,
|
||||||
|
getBlockPatternCategories
|
||||||
|
} = select(external_wp_coreData_namespaceObject.store);
|
||||||
|
return {
|
||||||
|
corePatternCategories: getBlockPatternCategories(),
|
||||||
|
userPatternCategories: getUserPatternCategories()
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
const categoryMap = (0,external_wp_element_namespaceObject.useMemo)(() => {
|
||||||
|
// Merge the user and core pattern categories and remove any duplicates.
|
||||||
|
const uniqueCategories = new Map();
|
||||||
|
userPatternCategories.forEach(category => {
|
||||||
|
uniqueCategories.set(category.label.toLowerCase(), {
|
||||||
|
label: category.label,
|
||||||
|
name: category.name,
|
||||||
|
id: category.id
|
||||||
|
});
|
||||||
|
});
|
||||||
|
corePatternCategories.forEach(category => {
|
||||||
|
if (!uniqueCategories.has(category.label.toLowerCase()) &&
|
||||||
|
// There are two core categories with `Post` label so explicitly remove the one with
|
||||||
|
// the `query` slug to avoid any confusion.
|
||||||
|
category.name !== 'query') {
|
||||||
|
uniqueCategories.set(category.label.toLowerCase(), {
|
||||||
|
label: category.label,
|
||||||
|
name: category.name
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return uniqueCategories;
|
||||||
|
}, [userPatternCategories, corePatternCategories]);
|
||||||
|
async function findOrCreateTerm(term) {
|
||||||
|
try {
|
||||||
|
const existingTerm = categoryMap.get(term.toLowerCase());
|
||||||
|
if (existingTerm?.id) {
|
||||||
|
return existingTerm.id;
|
||||||
|
}
|
||||||
|
// If we have an existing core category we need to match the new user category to the
|
||||||
|
// correct slug rather than autogenerating it to prevent duplicates, eg. the core `Headers`
|
||||||
|
// category uses the singular `header` as the slug.
|
||||||
|
const termData = existingTerm ? {
|
||||||
|
name: existingTerm.label,
|
||||||
|
slug: existingTerm.name
|
||||||
|
} : {
|
||||||
|
name: term
|
||||||
|
};
|
||||||
|
const newTerm = await saveEntityRecord('taxonomy', CATEGORY_SLUG, termData, {
|
||||||
|
throwOnError: true
|
||||||
|
});
|
||||||
|
invalidateResolution('getUserPatternCategories');
|
||||||
|
return newTerm.id;
|
||||||
|
} catch (error) {
|
||||||
|
if (error.code !== 'term_exists') {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
return error.data.term_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
categoryMap,
|
||||||
|
findOrCreateTerm
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/components/create-pattern-modal.js
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/patterns/build-module/components/create-pattern-modal.js
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -376,15 +471,11 @@ function CategorySelector({
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Internal dependencies
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -418,49 +509,13 @@ function CreatePatternModalContents({
|
||||||
const {
|
const {
|
||||||
createPattern
|
createPattern
|
||||||
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
|
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
|
||||||
const {
|
|
||||||
saveEntityRecord,
|
|
||||||
invalidateResolution
|
|
||||||
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
|
|
||||||
const {
|
const {
|
||||||
createErrorNotice
|
createErrorNotice
|
||||||
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
|
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
|
||||||
const {
|
const {
|
||||||
corePatternCategories,
|
categoryMap,
|
||||||
userPatternCategories
|
findOrCreateTerm
|
||||||
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
|
} = useAddPatternCategory();
|
||||||
const {
|
|
||||||
getUserPatternCategories,
|
|
||||||
getBlockPatternCategories
|
|
||||||
} = select(external_wp_coreData_namespaceObject.store);
|
|
||||||
return {
|
|
||||||
corePatternCategories: getBlockPatternCategories(),
|
|
||||||
userPatternCategories: getUserPatternCategories()
|
|
||||||
};
|
|
||||||
});
|
|
||||||
const categoryMap = (0,external_wp_element_namespaceObject.useMemo)(() => {
|
|
||||||
// Merge the user and core pattern categories and remove any duplicates.
|
|
||||||
const uniqueCategories = new Map();
|
|
||||||
userPatternCategories.forEach(category => {
|
|
||||||
uniqueCategories.set(category.label.toLowerCase(), {
|
|
||||||
label: category.label,
|
|
||||||
name: category.name,
|
|
||||||
id: category.id
|
|
||||||
});
|
|
||||||
});
|
|
||||||
corePatternCategories.forEach(category => {
|
|
||||||
if (!uniqueCategories.has(category.label.toLowerCase()) &&
|
|
||||||
// There are two core categories with `Post` label so explicitly remove the one with
|
|
||||||
// the `query` slug to avoid any confusion.
|
|
||||||
category.name !== 'query') {
|
|
||||||
uniqueCategories.set(category.label.toLowerCase(), {
|
|
||||||
label: category.label,
|
|
||||||
name: category.name
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return uniqueCategories;
|
|
||||||
}, [userPatternCategories, corePatternCategories]);
|
|
||||||
async function onCreate(patternTitle, sync) {
|
async function onCreate(patternTitle, sync) {
|
||||||
if (!title || isSaving) {
|
if (!title || isSaving) {
|
||||||
return;
|
return;
|
||||||
|
@ -485,38 +540,6 @@ function CreatePatternModalContents({
|
||||||
setTitle('');
|
setTitle('');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} term
|
|
||||||
* @return {Promise<number>} The pattern category id.
|
|
||||||
*/
|
|
||||||
async function findOrCreateTerm(term) {
|
|
||||||
try {
|
|
||||||
const existingTerm = categoryMap.get(term.toLowerCase());
|
|
||||||
if (existingTerm && existingTerm.id) {
|
|
||||||
return existingTerm.id;
|
|
||||||
}
|
|
||||||
// If we have an existing core category we need to match the new user category to the
|
|
||||||
// correct slug rather than autogenerating it to prevent duplicates, eg. the core `Headers`
|
|
||||||
// category uses the singular `header` as the slug.
|
|
||||||
const termData = existingTerm ? {
|
|
||||||
name: existingTerm.label,
|
|
||||||
slug: existingTerm.name
|
|
||||||
} : {
|
|
||||||
name: term
|
|
||||||
};
|
|
||||||
const newTerm = await saveEntityRecord('taxonomy', CATEGORY_SLUG, termData, {
|
|
||||||
throwOnError: true
|
|
||||||
});
|
|
||||||
invalidateResolution('getUserPatternCategories');
|
|
||||||
return newTerm.id;
|
|
||||||
} catch (error) {
|
|
||||||
if (error.code !== 'term_exists') {
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
return error.data.term_id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (0,external_React_namespaceObject.createElement)("form", {
|
return (0,external_React_namespaceObject.createElement)("form", {
|
||||||
onSubmit: event => {
|
onSubmit: event => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
@ -1316,6 +1339,7 @@ function ResetOverridesControl(props) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const privateApis = {};
|
const privateApis = {};
|
||||||
lock(privateApis, {
|
lock(privateApis, {
|
||||||
CreatePatternModal: CreatePatternModal,
|
CreatePatternModal: CreatePatternModal,
|
||||||
|
@ -1327,6 +1351,7 @@ lock(privateApis, {
|
||||||
RenamePatternCategoryModal: RenamePatternCategoryModal,
|
RenamePatternCategoryModal: RenamePatternCategoryModal,
|
||||||
PartialSyncingControls: partial_syncing_controls,
|
PartialSyncingControls: partial_syncing_controls,
|
||||||
ResetOverridesControl: ResetOverridesControl,
|
ResetOverridesControl: ResetOverridesControl,
|
||||||
|
useAddPatternCategory: useAddPatternCategory,
|
||||||
PATTERN_TYPES: PATTERN_TYPES,
|
PATTERN_TYPES: PATTERN_TYPES,
|
||||||
PATTERN_DEFAULT_CATEGORY: PATTERN_DEFAULT_CATEGORY,
|
PATTERN_DEFAULT_CATEGORY: PATTERN_DEFAULT_CATEGORY,
|
||||||
PATTERN_USER_CATEGORY: PATTERN_USER_CATEGORY,
|
PATTERN_USER_CATEGORY: PATTERN_USER_CATEGORY,
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.5-beta1-57668';
|
$wp_version = '6.5-beta1-57669';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue