@wordpress/block-library 9.22.0 → 9.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/calendar/index.js +1 -0
- package/build/calendar/index.js.map +1 -1
- package/build/comments/edit/comments-inspector-controls.js +13 -13
- package/build/comments/edit/comments-inspector-controls.js.map +1 -1
- package/build/comments/edit/index.js +4 -2
- package/build/comments/edit/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +9 -12
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/group/edit.js +17 -13
- package/build/group/edit.js.map +1 -1
- package/build/image/edit.js +0 -6
- package/build/image/edit.js.map +1 -1
- package/build/latest-posts/edit.js +100 -54
- package/build/latest-posts/edit.js.map +1 -1
- package/build/query/edit/query-content.js +11 -12
- package/build/query/edit/query-content.js.map +1 -1
- package/build/separator/edit.js +13 -12
- package/build/separator/edit.js.map +1 -1
- package/build/template-part/edit/advanced-controls.js +14 -12
- package/build/template-part/edit/advanced-controls.js.map +1 -1
- package/build/template-part/edit/index.js +2 -1
- package/build/template-part/edit/index.js.map +1 -1
- package/build-module/calendar/index.js +1 -0
- package/build-module/calendar/index.js.map +1 -1
- package/build-module/comments/edit/comments-inspector-controls.js +14 -14
- package/build-module/comments/edit/comments-inspector-controls.js.map +1 -1
- package/build-module/comments/edit/index.js +4 -2
- package/build-module/comments/edit/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +10 -13
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/group/edit.js +16 -14
- package/build-module/group/edit.js.map +1 -1
- package/build-module/image/edit.js +0 -6
- package/build-module/image/edit.js.map +1 -1
- package/build-module/latest-posts/edit.js +100 -54
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/query/edit/query-content.js +12 -13
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/separator/edit.js +15 -14
- package/build-module/separator/edit.js.map +1 -1
- package/build-module/template-part/edit/advanced-controls.js +14 -12
- package/build-module/template-part/edit/advanced-controls.js.map +1 -1
- package/build-module/template-part/edit/index.js +2 -1
- package/build-module/template-part/edit/index.js.map +1 -1
- package/package.json +35 -35
- package/src/calendar/block.json +1 -0
- package/src/comments/edit/comments-inspector-controls.js +14 -12
- package/src/comments/edit/index.js +2 -1
- package/src/cover/edit/inspector-controls.js +9 -12
- package/src/group/edit.js +11 -10
- package/src/image/edit.js +0 -4
- package/src/latest-posts/edit.js +113 -81
- package/src/loginout/index.php +5 -1
- package/src/navigation/index.php +0 -1
- package/src/navigation-link/index.php +1 -1
- package/src/navigation-submenu/index.php +1 -1
- package/src/post-author/index.php +1 -1
- package/src/post-author-name/index.php +1 -1
- package/src/query/edit/query-content.js +10 -11
- package/src/separator/edit.js +16 -12
- package/src/template-part/edit/advanced-controls.js +9 -8
- package/src/template-part/edit/index.js +1 -0
- package/build/utils/messages.js +0 -22
- package/build/utils/messages.js.map +0 -1
- package/build-module/utils/messages.js +0 -15
- package/build-module/utils/messages.js.map +0 -1
- package/src/utils/messages.js +0 -31
|
@@ -9,15 +9,14 @@ var _data = require("@wordpress/data");
|
|
|
9
9
|
var _compose = require("@wordpress/compose");
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
var _blockEditor = require("@wordpress/block-editor");
|
|
12
|
-
var _components = require("@wordpress/components");
|
|
13
12
|
var _i18n = require("@wordpress/i18n");
|
|
14
13
|
var _coreData = require("@wordpress/core-data");
|
|
15
14
|
var _enhancedPaginationControl = _interopRequireDefault(require("./inspector-controls/enhanced-pagination-control"));
|
|
15
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
16
16
|
var _inspectorControls = _interopRequireDefault(require("./inspector-controls"));
|
|
17
17
|
var _enhancedPaginationModal = _interopRequireDefault(require("./enhanced-pagination-modal"));
|
|
18
18
|
var _utils = require("../utils");
|
|
19
19
|
var _queryToolbar = _interopRequireDefault(require("./query-toolbar"));
|
|
20
|
-
var _messages = require("../../utils/messages");
|
|
21
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
21
|
/**
|
|
23
22
|
* WordPress dependencies
|
|
@@ -27,6 +26,9 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
27
26
|
* Internal dependencies
|
|
28
27
|
*/
|
|
29
28
|
|
|
29
|
+
const {
|
|
30
|
+
HTMLElementControl
|
|
31
|
+
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
30
32
|
const DEFAULTS_POSTS_PER_PAGE = 3;
|
|
31
33
|
const TEMPLATE = [['core/post-template']];
|
|
32
34
|
function QueryContent({
|
|
@@ -143,10 +145,12 @@ function QueryContent({
|
|
|
143
145
|
})
|
|
144
146
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_blockEditor.InspectorControls, {
|
|
145
147
|
group: "advanced",
|
|
146
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(HTMLElementControl, {
|
|
149
|
+
tagName: TagName,
|
|
150
|
+
onChange: value => setAttributes({
|
|
151
|
+
tagName: value
|
|
152
|
+
}),
|
|
153
|
+
clientId: clientId,
|
|
150
154
|
options: [{
|
|
151
155
|
label: (0, _i18n.__)('Default (<div>)'),
|
|
152
156
|
value: 'div'
|
|
@@ -159,12 +163,7 @@ function QueryContent({
|
|
|
159
163
|
}, {
|
|
160
164
|
label: '<aside>',
|
|
161
165
|
value: 'aside'
|
|
162
|
-
}]
|
|
163
|
-
value: TagName,
|
|
164
|
-
onChange: value => setAttributes({
|
|
165
|
-
tagName: value
|
|
166
|
-
}),
|
|
167
|
-
help: _messages.htmlElementMessages[TagName]
|
|
166
|
+
}]
|
|
168
167
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_enhancedPaginationControl.default, {
|
|
169
168
|
enhancedPagination: enhancedPagination,
|
|
170
169
|
setAttributes: setAttributes,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_compose","_element","_blockEditor","_components","_i18n","_coreData","_enhancedPaginationControl","_interopRequireDefault","_inspectorControls","_enhancedPaginationModal","_utils","_queryToolbar","_messages","_jsxRuntime","DEFAULTS_POSTS_PER_PAGE","TEMPLATE","QueryContent","attributes","setAttributes","clientId","context","name","queryId","query","enhancedPagination","tagName","TagName","inherit","templateSlug","isSingular","getQueryContextFromTemplate","__unstableMarkNextChangeAsNotPersistent","useDispatch","blockEditorStore","instanceId","useInstanceId","blockProps","useBlockProps","innerBlocksProps","useInnerBlocksProps","template","postsPerPage","useSelect","select","getSettings","getEntityRecord","getEntityRecordEdits","canUser","coreStore","settingPerPage","kind","posts_per_page","editedSettingPerPage","updateQuery","useCallback","newQuery","prevAttributes","useEffect","perPage","Object","keys","length","Number","isFinite","jsxs","Fragment","children","jsx","default","InspectorControls","setQuery","BlockControls","group","SelectControl","__nextHasNoMarginBottom","__next40pxDefaultSize","label","__","options","value","onChange","help","htmlElementMessages"],"sources":["@wordpress/block-library/src/query/edit/query-content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect, useCallback } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tuseInnerBlocksProps,\n} from '@wordpress/block-editor';\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport EnhancedPaginationControl from './inspector-controls/enhanced-pagination-control';\nimport QueryInspectorControls from './inspector-controls';\nimport EnhancedPaginationModal from './enhanced-pagination-modal';\nimport { getQueryContextFromTemplate } from '../utils';\nimport QueryToolbar from './query-toolbar';\nimport { htmlElementMessages } from '../../utils/messages';\n\nconst DEFAULTS_POSTS_PER_PAGE = 3;\n\nconst TEMPLATE = [ [ 'core/post-template' ] ];\nexport default function QueryContent( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tcontext,\n\tname,\n} ) {\n\tconst {\n\t\tqueryId,\n\t\tquery,\n\t\tenhancedPagination,\n\t\ttagName: TagName = 'div',\n\t\tquery: { inherit } = {},\n\t} = attributes;\n\tconst { templateSlug } = context;\n\tconst { isSingular } = getQueryContextFromTemplate( templateSlug );\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst instanceId = useInstanceId( QueryContent );\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\tconst { postsPerPage } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { getEntityRecord, getEntityRecordEdits, canUser } =\n\t\t\tselect( coreStore );\n\t\tconst settingPerPage = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? +getEntityRecord( 'root', 'site' )?.posts_per_page\n\t\t\t: +getSettings().postsPerPage;\n\n\t\t// Gets changes made via the template area posts per page setting. These won't be saved\n\t\t// until the page is saved, but we should reflect this setting within the query loops\n\t\t// that inherit it.\n\t\tconst editedSettingPerPage = +getEntityRecordEdits( 'root', 'site' )\n\t\t\t?.posts_per_page;\n\n\t\treturn {\n\t\t\tpostsPerPage:\n\t\t\t\teditedSettingPerPage ||\n\t\t\t\tsettingPerPage ||\n\t\t\t\tDEFAULTS_POSTS_PER_PAGE,\n\t\t};\n\t}, [] );\n\t// There are some effects running where some initialization logic is\n\t// happening and setting some values to some attributes (ex. queryId).\n\t// These updates can cause an `undo trap` where undoing will result in\n\t// resetting again, so we need to mark these changes as not persistent\n\t// with `__unstableMarkNextChangeAsNotPersistent`.\n\n\t// Changes in query property (which is an object) need to be in the same callback,\n\t// because updates are batched after the render and changes in different query properties\n\t// would cause to override previous wanted changes.\n\tconst updateQuery = useCallback(\n\t\t( newQuery ) =>\n\t\t\tsetAttributes( ( prevAttributes ) => ( {\n\t\t\t\tquery: { ...prevAttributes.query, ...newQuery },\n\t\t\t} ) ),\n\t\t[ setAttributes ]\n\t);\n\tuseEffect( () => {\n\t\tconst newQuery = {};\n\t\t// When we inherit from global query always need to set the `perPage`\n\t\t// based on the reading settings.\n\t\tif ( inherit && query.perPage !== postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t} else if ( ! query.perPage && postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t}\n\n\t\tif ( !! Object.keys( newQuery ).length ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateQuery( newQuery );\n\t\t}\n\t}, [\n\t\tquery.perPage,\n\t\tinherit,\n\t\tpostsPerPage,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tupdateQuery,\n\t] );\n\t// We need this for multi-query block pagination.\n\t// Query parameters for each block are scoped to their ID.\n\tuseEffect( () => {\n\t\tif ( ! Number.isFinite( queryId ) ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { queryId: instanceId } );\n\t\t}\n\t}, [\n\t\tqueryId,\n\t\tinstanceId,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tsetAttributes,\n\t] );\n\n\treturn (\n\t\t<>\n\t\t\t<EnhancedPaginationModal\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tclientId={ clientId }\n\t\t\t/>\n\t\t\t<InspectorControls>\n\t\t\t\t<QueryInspectorControls\n\t\t\t\t\tname={ name }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetQuery={ updateQuery }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tisSingular={ isSingular }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls>\n\t\t\t\t<QueryToolbar attributes={ attributes } clientId={ clientId } />\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t] }\n\t\t\t\t\tvalue={ TagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ htmlElementMessages[ TagName ] }\n\t\t\t\t/>\n\t\t\t\t<EnhancedPaginationControl\n\t\t\t\t\tenhancedPagination={ enhancedPagination }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<TagName { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAOA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAKA,IAAAO,0BAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,kBAAA,GAAAD,sBAAA,CAAAR,OAAA;AACA,IAAAU,wBAAA,GAAAF,sBAAA,CAAAR,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,aAAA,GAAAJ,sBAAA,CAAAR,OAAA;AACA,IAAAa,SAAA,GAAAb,OA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AkB,CAAC;UAAEE,KAAK,EAAE;QAAM,CAAC,EAChD;UAAEH,KAAK,EAAE,QAAQ;UAAEG,KAAK,EAAE;QAAO,CAAC,EAClC;UAAEH,KAAK,EAAE,WAAW;UAAEG,KAAK,EAAE;QAAU,CAAC,EACxC;UAAEH,KAAK,EAAE,SAAS;UAAEG,KAAK,EAAE;QAAQ,CAAC,CAClC;QACHA,KAAK,EAAGrD,OAAS;QACjBsD,QAAQ,EAAKD,KAAK,IACjB7D,aAAa,CAAE;UAAEO,OAAO,EAAEsD;QAAM,CAAE,CAClC;QACDE,IAAI,EAAGC,6BAAmB,CAAExD,OAAO;MAAI,CACvC,CAAC,eACF,IAAAb,WAAA,CAAAsD,GAAA,EAAC7D,0BAAA,CAAA8D,OAAyB;QACzB5C,kBAAkB,EAAGA,kBAAoB;QACzCN,aAAa,EAAGA,aAAe;QAC/BC,QAAQ,EAAGA;MAAU,CACrB,CAAC;IAAA,CACgB,CAAC,eACpB,IAAAN,WAAA,CAAAsD,GAAA,EAACzC,OAAO;MAAA,GAAMY;IAAgB,CAAI,CAAC;EAAA,CAClC,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_data","require","_compose","_element","_blockEditor","_i18n","_coreData","_enhancedPaginationControl","_interopRequireDefault","_lockUnlock","_inspectorControls","_enhancedPaginationModal","_utils","_queryToolbar","_jsxRuntime","HTMLElementControl","unlock","blockEditorPrivateApis","DEFAULTS_POSTS_PER_PAGE","TEMPLATE","QueryContent","attributes","setAttributes","clientId","context","name","queryId","query","enhancedPagination","tagName","TagName","inherit","templateSlug","isSingular","getQueryContextFromTemplate","__unstableMarkNextChangeAsNotPersistent","useDispatch","blockEditorStore","instanceId","useInstanceId","blockProps","useBlockProps","innerBlocksProps","useInnerBlocksProps","template","postsPerPage","useSelect","select","getSettings","getEntityRecord","getEntityRecordEdits","canUser","coreStore","settingPerPage","kind","posts_per_page","editedSettingPerPage","updateQuery","useCallback","newQuery","prevAttributes","useEffect","perPage","Object","keys","length","Number","isFinite","jsxs","Fragment","children","jsx","default","InspectorControls","setQuery","BlockControls","group","onChange","value","options","label","__"],"sources":["@wordpress/block-library/src/query/edit/query-content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect, useCallback } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tuseInnerBlocksProps,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport EnhancedPaginationControl from './inspector-controls/enhanced-pagination-control';\nimport { unlock } from '../../lock-unlock';\nimport QueryInspectorControls from './inspector-controls';\nimport EnhancedPaginationModal from './enhanced-pagination-modal';\nimport { getQueryContextFromTemplate } from '../utils';\nimport QueryToolbar from './query-toolbar';\n\nconst { HTMLElementControl } = unlock( blockEditorPrivateApis );\n\nconst DEFAULTS_POSTS_PER_PAGE = 3;\n\nconst TEMPLATE = [ [ 'core/post-template' ] ];\nexport default function QueryContent( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tcontext,\n\tname,\n} ) {\n\tconst {\n\t\tqueryId,\n\t\tquery,\n\t\tenhancedPagination,\n\t\ttagName: TagName = 'div',\n\t\tquery: { inherit } = {},\n\t} = attributes;\n\tconst { templateSlug } = context;\n\tconst { isSingular } = getQueryContextFromTemplate( templateSlug );\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst instanceId = useInstanceId( QueryContent );\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\tconst { postsPerPage } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { getEntityRecord, getEntityRecordEdits, canUser } =\n\t\t\tselect( coreStore );\n\t\tconst settingPerPage = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? +getEntityRecord( 'root', 'site' )?.posts_per_page\n\t\t\t: +getSettings().postsPerPage;\n\n\t\t// Gets changes made via the template area posts per page setting. These won't be saved\n\t\t// until the page is saved, but we should reflect this setting within the query loops\n\t\t// that inherit it.\n\t\tconst editedSettingPerPage = +getEntityRecordEdits( 'root', 'site' )\n\t\t\t?.posts_per_page;\n\n\t\treturn {\n\t\t\tpostsPerPage:\n\t\t\t\teditedSettingPerPage ||\n\t\t\t\tsettingPerPage ||\n\t\t\t\tDEFAULTS_POSTS_PER_PAGE,\n\t\t};\n\t}, [] );\n\t// There are some effects running where some initialization logic is\n\t// happening and setting some values to some attributes (ex. queryId).\n\t// These updates can cause an `undo trap` where undoing will result in\n\t// resetting again, so we need to mark these changes as not persistent\n\t// with `__unstableMarkNextChangeAsNotPersistent`.\n\n\t// Changes in query property (which is an object) need to be in the same callback,\n\t// because updates are batched after the render and changes in different query properties\n\t// would cause to override previous wanted changes.\n\tconst updateQuery = useCallback(\n\t\t( newQuery ) =>\n\t\t\tsetAttributes( ( prevAttributes ) => ( {\n\t\t\t\tquery: { ...prevAttributes.query, ...newQuery },\n\t\t\t} ) ),\n\t\t[ setAttributes ]\n\t);\n\tuseEffect( () => {\n\t\tconst newQuery = {};\n\t\t// When we inherit from global query always need to set the `perPage`\n\t\t// based on the reading settings.\n\t\tif ( inherit && query.perPage !== postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t} else if ( ! query.perPage && postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t}\n\n\t\tif ( !! Object.keys( newQuery ).length ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateQuery( newQuery );\n\t\t}\n\t}, [\n\t\tquery.perPage,\n\t\tinherit,\n\t\tpostsPerPage,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tupdateQuery,\n\t] );\n\t// We need this for multi-query block pagination.\n\t// Query parameters for each block are scoped to their ID.\n\tuseEffect( () => {\n\t\tif ( ! Number.isFinite( queryId ) ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { queryId: instanceId } );\n\t\t}\n\t}, [\n\t\tqueryId,\n\t\tinstanceId,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tsetAttributes,\n\t] );\n\n\treturn (\n\t\t<>\n\t\t\t<EnhancedPaginationModal\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tclientId={ clientId }\n\t\t\t/>\n\t\t\t<InspectorControls>\n\t\t\t\t<QueryInspectorControls\n\t\t\t\t\tname={ name }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetQuery={ updateQuery }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tisSingular={ isSingular }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls>\n\t\t\t\t<QueryToolbar attributes={ attributes } clientId={ clientId } />\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<HTMLElementControl\n\t\t\t\t\ttagName={ TagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t\t<EnhancedPaginationControl\n\t\t\t\t\tenhancedPagination={ enhancedPagination }\n\t\t\t\t\tsetAttributes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AC;AAEL","ignoreList":[]}
|
package/build/separator/edit.js
CHANGED
|
@@ -10,7 +10,7 @@ var _components = require("@wordpress/components");
|
|
|
10
10
|
var _blockEditor = require("@wordpress/block-editor");
|
|
11
11
|
var _i18n = require("@wordpress/i18n");
|
|
12
12
|
var _useDeprecatedOpacity = _interopRequireDefault(require("./use-deprecated-opacity"));
|
|
13
|
-
var
|
|
13
|
+
var _lockUnlock = require("../lock-unlock");
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
15
|
/**
|
|
16
16
|
* External dependencies
|
|
@@ -24,9 +24,13 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
24
24
|
* Internal dependencies
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
+
const {
|
|
28
|
+
HTMLElementControl
|
|
29
|
+
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
27
30
|
function SeparatorEdit({
|
|
28
31
|
attributes,
|
|
29
|
-
setAttributes
|
|
32
|
+
setAttributes,
|
|
33
|
+
clientId
|
|
30
34
|
}) {
|
|
31
35
|
const {
|
|
32
36
|
backgroundColor,
|
|
@@ -56,22 +60,19 @@ function SeparatorEdit({
|
|
|
56
60
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
57
61
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
|
|
58
62
|
group: "advanced",
|
|
59
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(HTMLElementControl, {
|
|
64
|
+
tagName: tagName,
|
|
65
|
+
onChange: value => setAttributes({
|
|
66
|
+
tagName: value
|
|
67
|
+
}),
|
|
68
|
+
clientId: clientId,
|
|
63
69
|
options: [{
|
|
64
70
|
label: (0, _i18n.__)('Default (<hr>)'),
|
|
65
71
|
value: 'hr'
|
|
66
72
|
}, {
|
|
67
73
|
label: '<div>',
|
|
68
74
|
value: 'div'
|
|
69
|
-
}]
|
|
70
|
-
value: tagName,
|
|
71
|
-
onChange: value => setAttributes({
|
|
72
|
-
tagName: value
|
|
73
|
-
}),
|
|
74
|
-
help: _messages.htmlElementMessages[tagName]
|
|
75
|
+
}]
|
|
75
76
|
})
|
|
76
77
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapper, {
|
|
77
78
|
...(0, _blockEditor.useBlockProps)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_blockEditor","_i18n","_useDeprecatedOpacity","
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_blockEditor","_i18n","_useDeprecatedOpacity","_lockUnlock","_jsxRuntime","HTMLElementControl","unlock","blockEditorPrivateApis","SeparatorEdit","attributes","setAttributes","clientId","backgroundColor","opacity","style","tagName","colorProps","useColorProps","currentColor","hasCustomColor","color","background","useDeprecatedOpacity","colorClass","getColorClassName","className","clsx","styles","Wrapper","HorizontalRule","jsxs","Fragment","children","jsx","InspectorControls","group","onChange","value","options","label","__","useBlockProps","undefined"],"sources":["@wordpress/block-library/src/separator/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { HorizontalRule } from '@wordpress/components';\nimport {\n\tuseBlockProps,\n\tgetColorClassName,\n\t__experimentalUseColorProps as useColorProps,\n\tInspectorControls,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useDeprecatedOpacity from './use-deprecated-opacity';\nimport { unlock } from '../lock-unlock';\n\nconst { HTMLElementControl } = unlock( blockEditorPrivateApis );\n\nexport default function SeparatorEdit( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n} ) {\n\tconst { backgroundColor, opacity, style, tagName } = attributes;\n\tconst colorProps = useColorProps( attributes );\n\tconst currentColor = colorProps?.style?.backgroundColor;\n\tconst hasCustomColor = !! style?.color?.background;\n\n\tuseDeprecatedOpacity( opacity, currentColor, setAttributes );\n\n\t// The dots styles uses text for the dots, to change those dots color is\n\t// using color, not backgroundColor.\n\tconst colorClass = getColorClassName( 'color', backgroundColor );\n\n\tconst className = clsx(\n\t\t{\n\t\t\t'has-text-color': backgroundColor || currentColor,\n\t\t\t[ colorClass ]: colorClass,\n\t\t\t'has-css-opacity': opacity === 'css',\n\t\t\t'has-alpha-channel-opacity': opacity === 'alpha-channel',\n\t\t},\n\t\tcolorProps.className\n\t);\n\n\tconst styles = {\n\t\tcolor: currentColor,\n\t\tbackgroundColor: currentColor,\n\t};\n\tconst Wrapper = tagName === 'hr' ? HorizontalRule : tagName;\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<HTMLElementControl\n\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<hr>)' ), value: 'hr' },\n\t\t\t\t\t\t{ label: '<div>', value: 'div' },\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<Wrapper\n\t\t\t\t{ ...useBlockProps( {\n\t\t\t\t\tclassName,\n\t\t\t\t\tstyle: hasCustomColor ? styles : undefined,\n\t\t\t\t} ) }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAOA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,qBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,WAAA,GAA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AAAH,QAAA,eAClC,IAAA5B,WAAA,CAAA6B,GAAA,EAAC5B,kBAAkB;QAClBU,OAAO,EAAGA,OAAS;QACnBqB,QAAQ,EAAKC,KAAK,IACjB3B,aAAa,CAAE;UAAEK,OAAO,EAAEsB;QAAM,CAAE,CAClC;QACD1B,QAAQ,EAAGA,QAAU;QACrB2B,OAAO,EAAG,CACT;UAAEC,KAAK,EAAE,IAAAC,QAAE,EAAE,gBAAiB,CAAC;UAAEH,KAAK,EAAE;QAAK,CAAC,EAC9C;UAAEE,KAAK,EAAE,OAAO;UAAEF,KAAK,EAAE;QAAM,CAAC;MAC9B,CACH;IAAC,CACgB,CAAC,eACpB,IAAAjC,WAAA,CAAA6B,GAAA,EAACL,OAAO;MAAA,GACF,IAAAa,0BAAa,EAAE;QACnBhB,SAAS;QACTX,KAAK,EAAEK,cAAc,GAAGQ,MAAM,GAAGe;MAClC,CAAE;IAAC,CACH,CAAC;EAAA,CACD,CAAC;AAEL","ignoreList":[]}
|
|
@@ -8,8 +8,9 @@ var _coreData = require("@wordpress/core-data");
|
|
|
8
8
|
var _components = require("@wordpress/components");
|
|
9
9
|
var _i18n = require("@wordpress/i18n");
|
|
10
10
|
var _data = require("@wordpress/data");
|
|
11
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
11
12
|
var _importControls = require("./import-controls");
|
|
12
|
-
var
|
|
13
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
13
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
15
|
/**
|
|
15
16
|
* WordPress dependencies
|
|
@@ -19,13 +20,17 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
19
20
|
* Internal dependencies
|
|
20
21
|
*/
|
|
21
22
|
|
|
23
|
+
const {
|
|
24
|
+
HTMLElementControl
|
|
25
|
+
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
22
26
|
function TemplatePartAdvancedControls({
|
|
23
27
|
tagName,
|
|
24
28
|
setAttributes,
|
|
25
29
|
isEntityAvailable,
|
|
26
30
|
templatePartId,
|
|
27
31
|
defaultWrapper,
|
|
28
|
-
hasInnerBlocks
|
|
32
|
+
hasInnerBlocks,
|
|
33
|
+
clientId
|
|
29
34
|
}) {
|
|
30
35
|
const [area, setArea] = (0, _coreData.useEntityProp)('postType', 'wp_template_part', 'area', templatePartId);
|
|
31
36
|
const [title, setTitle] = (0, _coreData.useEntityProp)('postType', 'wp_template_part', 'title', templatePartId);
|
|
@@ -57,10 +62,12 @@ function TemplatePartAdvancedControls({
|
|
|
57
62
|
value: area,
|
|
58
63
|
onChange: setArea
|
|
59
64
|
})]
|
|
60
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(HTMLElementControl, {
|
|
66
|
+
tagName: tagName || '',
|
|
67
|
+
onChange: value => setAttributes({
|
|
68
|
+
tagName: value
|
|
69
|
+
}),
|
|
70
|
+
clientId: clientId,
|
|
64
71
|
options: [{
|
|
65
72
|
label: (0, _i18n.sprintf)(/* translators: %s: HTML tag based on area. */
|
|
66
73
|
(0, _i18n.__)('Default based on area (%s)'), `<${defaultWrapper}>`),
|
|
@@ -86,12 +93,7 @@ function TemplatePartAdvancedControls({
|
|
|
86
93
|
}, {
|
|
87
94
|
label: '<div>',
|
|
88
95
|
value: 'div'
|
|
89
|
-
}]
|
|
90
|
-
value: tagName || '',
|
|
91
|
-
onChange: value => setAttributes({
|
|
92
|
-
tagName: value
|
|
93
|
-
}),
|
|
94
|
-
help: _messages.htmlElementMessages[tagName]
|
|
96
|
+
}]
|
|
95
97
|
}), !hasInnerBlocks && /*#__PURE__*/(0, _jsxRuntime.jsx)(_importControls.TemplatePartImportControls, {
|
|
96
98
|
area: area,
|
|
97
99
|
setAttributes: setAttributes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_coreData","require","_components","_i18n","_data","_importControls","
|
|
1
|
+
{"version":3,"names":["_coreData","require","_components","_i18n","_data","_blockEditor","_importControls","_lockUnlock","_jsxRuntime","HTMLElementControl","unlock","blockEditorPrivateApis","TemplatePartAdvancedControls","tagName","setAttributes","isEntityAvailable","templatePartId","defaultWrapper","hasInnerBlocks","clientId","area","setArea","useEntityProp","title","setTitle","defaultTemplatePartAreas","useSelect","select","coreStore","getCurrentTheme","default_template_part_areas","areaOptions","map","label","_area","value","jsxs","Fragment","children","jsx","TextControl","__next40pxDefaultSize","__nextHasNoMarginBottom","__","onChange","onFocus","event","target","SelectControl","labelPosition","options","sprintf","TemplatePartImportControls"],"sources":["@wordpress/block-library/src/template-part/edit/advanced-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { SelectControl, TextControl } from '@wordpress/components';\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { TemplatePartImportControls } from './import-controls';\nimport { unlock } from '../../lock-unlock';\n\nconst { HTMLElementControl } = unlock( blockEditorPrivateApis );\n\nexport function TemplatePartAdvancedControls( {\n\ttagName,\n\tsetAttributes,\n\tisEntityAvailable,\n\ttemplatePartId,\n\tdefaultWrapper,\n\thasInnerBlocks,\n\tclientId,\n} ) {\n\tconst [ area, setArea ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'area',\n\t\ttemplatePartId\n\t);\n\n\tconst [ title, setTitle ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'title',\n\t\ttemplatePartId\n\t);\n\n\tconst defaultTemplatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getCurrentTheme()\n\t\t\t\t?.default_template_part_areas || [],\n\t\t[]\n\t);\n\n\tconst areaOptions = defaultTemplatePartAreas.map(\n\t\t( { label, area: _area } ) => ( {\n\t\t\tlabel,\n\t\t\tvalue: _area,\n\t\t} )\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ isEntityAvailable && (\n\t\t\t\t<>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetTitle( value );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonFocus={ ( event ) => event.target.select() }\n\t\t\t\t\t/>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\toptions={ areaOptions }\n\t\t\t\t\t\tvalue={ area }\n\t\t\t\t\t\tonChange={ setArea }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<HTMLElementControl\n\t\t\t\ttagName={ tagName || '' }\n\t\t\t\tonChange={ ( value ) => setAttributes( { tagName: value } ) }\n\t\t\t\tclientId={ clientId }\n\t\t\t\toptions={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: HTML tag based on area. */\n\t\t\t\t\t\t\t__( 'Default based on area (%s)' ),\n\t\t\t\t\t\t\t`<${ defaultWrapper }>`\n\t\t\t\t\t\t),\n\t\t\t\t\t\tvalue: '',\n\t\t\t\t\t},\n\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t\t{ label: '<div>', value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AE;MAAS,CAAC,EACtC;QAAEF,KAAK,EAAE,QAAQ;QAAEE,KAAK,EAAE;MAAO,CAAC,EAClC;QAAEF,KAAK,EAAE,WAAW;QAAEE,KAAK,EAAE;MAAU,CAAC,EACxC;QAAEF,KAAK,EAAE,WAAW;QAAEE,KAAK,EAAE;MAAU,CAAC,EACxC;QAAEF,KAAK,EAAE,SAAS;QAAEE,KAAK,EAAE;MAAQ,CAAC,EACpC;QAAEF,KAAK,EAAE,UAAU;QAAEE,KAAK,EAAE;MAAS,CAAC,EACtC;QAAEF,KAAK,EAAE,OAAO;QAAEE,KAAK,EAAE;MAAM,CAAC;IAC9B,CACH,CAAC,EACA,CAAEjB,cAAc,iBACjB,IAAAV,WAAA,CAAA+B,GAAA,EAACjC,eAAA,CAAA8C,0BAA0B;MAC1BhC,IAAI,EAAGA,IAAM;MACbN,aAAa,EAAGA;IAAe,CAC/B,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
@@ -189,7 +189,8 @@ function TemplatePartEdit({
|
|
|
189
189
|
isEntityAvailable: isEntityAvailable,
|
|
190
190
|
templatePartId: templatePartId,
|
|
191
191
|
defaultWrapper: areaObject.tagName,
|
|
192
|
-
hasInnerBlocks: hasInnerBlocks
|
|
192
|
+
hasInnerBlocks: hasInnerBlocks,
|
|
193
|
+
clientId: clientId
|
|
193
194
|
})
|
|
194
195
|
}), isPlaceholder && /*#__PURE__*/(0, _jsxRuntime.jsx)(TagName, {
|
|
195
196
|
...blockProps,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_data","_blockEditor","_components","_i18n","_coreData","_element","_notices","_placeholder","_interopRequireDefault","_selectionModal","_advancedControls","_innerBlocks","_createTemplatePartId","_hooks","_jsxRuntime","ReplaceButton","isEntityAvailable","area","templatePartId","isTemplatePartSelectionOpen","setIsTemplatePartSelectionOpen","templateParts","useAlternativeTemplateParts","hasReplacements","length","canReplace","jsx","MenuItem","onClick","children","__","TemplatesList","clientId","onSelect","blockPatterns","useAlternativeBlockPatterns","PanelBody","title","__experimentalBlockPatternsList","label","onClickPattern","showTitlesAsTooltip","TemplatePartEdit","attributes","setAttributes","createSuccessNotice","useDispatch","noticesStore","editEntityRecord","coreStore","currentTheme","useSelect","select","getCurrentTheme","stylesheet","slug","theme","tagName","layout","createTemplatePartId","hasAlreadyRendered","useHasRecursion","useState","isResolved","hasInnerBlocks","isMissing","onNavigateToEntityRecord","canUserEdit","getEditedEntityRecord","hasFinishedResolution","getBlockCount","getSettings","blockEditorStore","getEntityArgs","entityRecord","_area","hasResolvedEntity","_canUserEdit","canUser","kind","name","id","Object","keys","areaObject","useTemplatePartArea","blockProps","useBlockProps","isPlaceholder","TagName","onPatternSelect","pattern","blocks","content","serialize","sprintf","type","Warning","jsxs","Fragment","RecursionProvider","uniqueId","BlockControls","group","ToolbarButton","postId","postType","InspectorControls","TemplatePartAdvancedControls","defaultWrapper","default","onOpenSelectionModal","BlockSettingsMenuControls","selectedClientIds","Spinner","Modal","overlayClassName","toLowerCase","onRequestClose","isFullScreen","onClose"],"sources":["@wordpress/block-library/src/template-part/edit/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { serialize } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tuseBlockProps,\n\tWarning,\n\tstore as blockEditorStore,\n\tRecursionProvider,\n\tuseHasRecursion,\n\tInspectorControls,\n\t__experimentalBlockPatternsList as BlockPatternsList,\n\tBlockControls,\n} from '@wordpress/block-editor';\nimport {\n\tPanelBody,\n\tSpinner,\n\tModal,\n\tMenuItem,\n\tToolbarButton,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartPlaceholder from './placeholder';\nimport TemplatePartSelectionModal from './selection-modal';\nimport { TemplatePartAdvancedControls } from './advanced-controls';\nimport TemplatePartInnerBlocks from './inner-blocks';\nimport { createTemplatePartId } from './utils/create-template-part-id';\nimport {\n\tuseAlternativeBlockPatterns,\n\tuseAlternativeTemplateParts,\n\tuseTemplatePartArea,\n} from './utils/hooks';\n\nfunction ReplaceButton( {\n\tisEntityAvailable,\n\tarea,\n\ttemplatePartId,\n\tisTemplatePartSelectionOpen,\n\tsetIsTemplatePartSelectionOpen,\n} ) {\n\t// This hook fetches patterns, so don't run it unconditionally in the main\n\t// edit function!\n\tconst { templateParts } = useAlternativeTemplateParts(\n\t\tarea,\n\t\ttemplatePartId\n\t);\n\tconst hasReplacements = !! templateParts.length;\n\tconst canReplace =\n\t\tisEntityAvailable &&\n\t\thasReplacements &&\n\t\t( area === 'header' || area === 'footer' );\n\n\tif ( ! canReplace ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\tsetIsTemplatePartSelectionOpen( true );\n\t\t\t} }\n\t\t\taria-expanded={ isTemplatePartSelectionOpen }\n\t\t\taria-haspopup=\"dialog\"\n\t\t>\n\t\t\t{ __( 'Replace' ) }\n\t\t</MenuItem>\n\t);\n}\n\nfunction TemplatesList( { area, clientId, isEntityAvailable, onSelect } ) {\n\t// This hook fetches patterns, so don't run it unconditionally in the main\n\t// edit function!\n\tconst blockPatterns = useAlternativeBlockPatterns( area, clientId );\n\tconst canReplace =\n\t\tisEntityAvailable &&\n\t\t!! blockPatterns.length &&\n\t\t( area === 'header' || area === 'footer' );\n\n\tif ( ! canReplace ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelBody title={ __( 'Design' ) }>\n\t\t\t<BlockPatternsList\n\t\t\t\tlabel={ __( 'Templates' ) }\n\t\t\t\tblockPatterns={ blockPatterns }\n\t\t\t\tonClickPattern={ onSelect }\n\t\t\t\tshowTitlesAsTooltip\n\t\t\t/>\n\t\t</PanelBody>\n\t);\n}\n\nexport default function TemplatePartEdit( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n} ) {\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst currentTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.stylesheet,\n\t\t[]\n\t);\n\tconst { slug, theme = currentTheme, tagName, layout = {} } = attributes;\n\tconst templatePartId = createTemplatePartId( theme, slug );\n\tconst hasAlreadyRendered = useHasRecursion( templatePartId );\n\tconst [ isTemplatePartSelectionOpen, setIsTemplatePartSelectionOpen ] =\n\t\tuseState( false );\n\n\tconst {\n\t\tisResolved,\n\t\thasInnerBlocks,\n\t\tisMissing,\n\t\tarea,\n\t\tonNavigateToEntityRecord,\n\t\ttitle,\n\t\tcanUserEdit,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getBlockCount, getSettings } = select( blockEditorStore );\n\n\t\t\tconst getEntityArgs = [\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\ttemplatePartId,\n\t\t\t];\n\t\t\tconst entityRecord = templatePartId\n\t\t\t\t? getEditedEntityRecord( ...getEntityArgs )\n\t\t\t\t: null;\n\t\t\tconst _area = entityRecord?.area || attributes.area;\n\t\t\tconst hasResolvedEntity = templatePartId\n\t\t\t\t? hasFinishedResolution(\n\t\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\t\tgetEntityArgs\n\t\t\t\t )\n\t\t\t\t: false;\n\n\t\t\tconst _canUserEdit = hasResolvedEntity\n\t\t\t\t? select( coreStore ).canUser( 'update', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'wp_template_part',\n\t\t\t\t\t\tid: templatePartId,\n\t\t\t\t } )\n\t\t\t\t: false;\n\n\t\t\treturn {\n\t\t\t\thasInnerBlocks: getBlockCount( clientId ) > 0,\n\t\t\t\tisResolved: hasResolvedEntity,\n\t\t\t\tisMissing:\n\t\t\t\t\thasResolvedEntity &&\n\t\t\t\t\t( ! entityRecord ||\n\t\t\t\t\t\tObject.keys( entityRecord ).length === 0 ),\n\t\t\t\tarea: _area,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\tgetSettings().onNavigateToEntityRecord,\n\t\t\t\ttitle: entityRecord?.title,\n\t\t\t\tcanUserEdit: !! _canUserEdit,\n\t\t\t};\n\t\t},\n\t\t[ templatePartId, attributes.area, clientId ]\n\t);\n\n\tconst areaObject = useTemplatePartArea( area );\n\tconst blockProps = useBlockProps();\n\tconst isPlaceholder = ! slug;\n\tconst isEntityAvailable = ! isPlaceholder && ! isMissing && isResolved;\n\tconst TagName = tagName || areaObject.tagName;\n\n\tconst onPatternSelect = async ( pattern ) => {\n\t\tawait editEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\ttemplatePartId,\n\t\t\t{\n\t\t\t\tblocks: pattern.blocks,\n\t\t\t\tcontent: serialize( pattern.blocks ),\n\t\t\t}\n\t\t);\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: template part title. */\n\t\t\t\t__( 'Template Part \"%s\" updated.' ),\n\t\t\t\ttitle || slug\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t}\n\t\t);\n\t};\n\n\t// We don't want to render a missing state if we have any inner blocks.\n\t// A new template part is automatically created if we have any inner blocks but no entity.\n\tif (\n\t\t! hasInnerBlocks &&\n\t\t( ( slug && ! theme ) || ( slug && isMissing ) )\n\t) {\n\t\treturn (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %s: Template part slug. */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Template part has been deleted or is unavailable: %s'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tslug\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\tif ( isEntityAvailable && hasAlreadyRendered ) {\n\t\treturn (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t\t</Warning>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<RecursionProvider uniqueId={ templatePartId }>\n\t\t\t\t{ isEntityAvailable &&\n\t\t\t\t\tonNavigateToEntityRecord &&\n\t\t\t\t\tcanUserEdit && (\n\t\t\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\t\tpostId: templatePartId,\n\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template_part',\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t\t</BlockControls>\n\t\t\t\t\t) }\n\t\t\t\t{ canUserEdit && (\n\t\t\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t\t\t<TemplatePartAdvancedControls\n\t\t\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\t\tdefaultWrapper={ areaObject.tagName }\n\t\t\t\t\t\t\thasInnerBlocks={ hasInnerBlocks }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</InspectorControls>\n\t\t\t\t) }\n\t\t\t\t{ isPlaceholder && (\n\t\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t\t<TemplatePartPlaceholder\n\t\t\t\t\t\t\tarea={ attributes.area }\n\t\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\tonOpenSelectionModal={ () =>\n\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( true )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</TagName>\n\t\t\t\t) }\n\t\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t\t{ ( { selectedClientIds } ) => {\n\t\t\t\t\t\t// Only enable for single selection that matches the current block.\n\t\t\t\t\t\t// Ensures menu item doesn't render multiple times.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t! (\n\t\t\t\t\t\t\t\tselectedClientIds.length === 1 &&\n\t\t\t\t\t\t\t\tclientId === selectedClientIds[ 0 ]\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<ReplaceButton\n\t\t\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t\t\tisEntityAvailable,\n\t\t\t\t\t\t\t\t\tarea,\n\t\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\t\ttemplatePartId,\n\t\t\t\t\t\t\t\t\tisTemplatePartSelectionOpen,\n\t\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t</BlockSettingsMenuControls>\n\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<TemplatesList\n\t\t\t\t\t\tarea={ area }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\t\t\tonSelect={ ( pattern ) => onPatternSelect( pattern ) }\n\t\t\t\t\t/>\n\t\t\t\t</InspectorControls>\n\n\t\t\t\t{ isEntityAvailable && (\n\t\t\t\t\t<TemplatePartInnerBlocks\n\t\t\t\t\t\ttagName={ TagName }\n\t\t\t\t\t\tblockProps={ blockProps }\n\t\t\t\t\t\tpostId={ templatePartId }\n\t\t\t\t\t\thasInnerBlocks={ hasInnerBlocks }\n\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! isPlaceholder && ! isResolved && (\n\t\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</TagName>\n\t\t\t\t) }\n\t\t\t</RecursionProvider>\n\t\t\t{ isTemplatePartSelectionOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\toverlayClassName=\"block-editor-template-part__selection-modal\"\n\t\t\t\t\ttitle={ sprintf(\n\t\t\t\t\t\t// Translators: %s as template part area title (\"Header\", \"Footer\", etc.).\n\t\t\t\t\t\t__( 'Choose a %s' ),\n\t\t\t\t\t\tareaObject.label.toLowerCase()\n\t\t\t\t\t) }\n\t\t\t\t\tonRequestClose={ () =>\n\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( false )\n\t\t\t\t\t}\n\t\t\t\t\tisFullScreen\n\t\t\t\t>\n\t\t\t\t\t<TemplatePartSelectionModal\n\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tarea={ area }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tonClose={ () =>\n\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( false )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAWA,IAAAG,WAAA,GAAAH,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nBH,UAAU,EAAGA,UAAY;QACzBmB,MAAM,EAAGvF,cAAgB;QACzB8C,cAAc,EAAGA,cAAgB;QACjCN,MAAM,EAAGA;MAAQ,CACjB,CACD,EACC,CAAE8B,aAAa,IAAI,CAAEzB,UAAU,iBAChC,IAAAjD,WAAA,CAAAY,GAAA,EAAC+D,OAAO;QAAA,GAAMH,UAAU;QAAAzD,QAAA,eACvB,IAAAf,WAAA,CAAAY,GAAA,EAACxB,WAAA,CAAAgH,OAAO,IAAE;MAAC,CACH,CACT;IAAA,CACiB,CAAC,EAClB/F,2BAA2B,iBAC5B,IAAAL,WAAA,CAAAY,GAAA,EAACxB,WAAA,CAAAiH,KAAK;MACLC,gBAAgB,EAAC,6CAA6C;MAC9D/E,KAAK,EAAG,IAAA0D,aAAO;MACd;MACA,IAAAjE,QAAE,EAAE,aAAc,CAAC,EACnBsD,UAAU,CAAC7C,KAAK,CAAC8E,WAAW,CAAC,CAC9B,CAAG;MACHC,cAAc,EAAGA,CAAA,KAChBlG,8BAA8B,CAAE,KAAM,CACtC;MACDmG,YAAY;MAAA1F,QAAA,eAEZ,IAAAf,WAAA,CAAAY,GAAA,EAACjB,eAAA,CAAAqG,OAA0B;QAC1B5F,cAAc,EAAGA,cAAgB;QACjCc,QAAQ,EAAGA,QAAU;QACrBf,IAAI,EAAGA,IAAM;QACb2B,aAAa,EAAGA,aAAe;QAC/B4E,OAAO,EAAGA,CAAA,KACTpG,8BAA8B,CAAE,KAAM;MACtC,CACD;IAAC,CACI,CACP;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_blocks","require","_data","_blockEditor","_components","_i18n","_coreData","_element","_notices","_placeholder","_interopRequireDefault","_selectionModal","_advancedControls","_innerBlocks","_createTemplatePartId","_hooks","_jsxRuntime","ReplaceButton","isEntityAvailable","area","templatePartId","isTemplatePartSelectionOpen","setIsTemplatePartSelectionOpen","templateParts","useAlternativeTemplateParts","hasReplacements","length","canReplace","jsx","MenuItem","onClick","children","__","TemplatesList","clientId","onSelect","blockPatterns","useAlternativeBlockPatterns","PanelBody","title","__experimentalBlockPatternsList","label","onClickPattern","showTitlesAsTooltip","TemplatePartEdit","attributes","setAttributes","createSuccessNotice","useDispatch","noticesStore","editEntityRecord","coreStore","currentTheme","useSelect","select","getCurrentTheme","stylesheet","slug","theme","tagName","layout","createTemplatePartId","hasAlreadyRendered","useHasRecursion","useState","isResolved","hasInnerBlocks","isMissing","onNavigateToEntityRecord","canUserEdit","getEditedEntityRecord","hasFinishedResolution","getBlockCount","getSettings","blockEditorStore","getEntityArgs","entityRecord","_area","hasResolvedEntity","_canUserEdit","canUser","kind","name","id","Object","keys","areaObject","useTemplatePartArea","blockProps","useBlockProps","isPlaceholder","TagName","onPatternSelect","pattern","blocks","content","serialize","sprintf","type","Warning","jsxs","Fragment","RecursionProvider","uniqueId","BlockControls","group","ToolbarButton","postId","postType","InspectorControls","TemplatePartAdvancedControls","defaultWrapper","default","onOpenSelectionModal","BlockSettingsMenuControls","selectedClientIds","Spinner","Modal","overlayClassName","toLowerCase","onRequestClose","isFullScreen","onClose"],"sources":["@wordpress/block-library/src/template-part/edit/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { serialize } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tuseBlockProps,\n\tWarning,\n\tstore as blockEditorStore,\n\tRecursionProvider,\n\tuseHasRecursion,\n\tInspectorControls,\n\t__experimentalBlockPatternsList as BlockPatternsList,\n\tBlockControls,\n} from '@wordpress/block-editor';\nimport {\n\tPanelBody,\n\tSpinner,\n\tModal,\n\tMenuItem,\n\tToolbarButton,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartPlaceholder from './placeholder';\nimport TemplatePartSelectionModal from './selection-modal';\nimport { TemplatePartAdvancedControls } from './advanced-controls';\nimport TemplatePartInnerBlocks from './inner-blocks';\nimport { createTemplatePartId } from './utils/create-template-part-id';\nimport {\n\tuseAlternativeBlockPatterns,\n\tuseAlternativeTemplateParts,\n\tuseTemplatePartArea,\n} from './utils/hooks';\n\nfunction ReplaceButton( {\n\tisEntityAvailable,\n\tarea,\n\ttemplatePartId,\n\tisTemplatePartSelectionOpen,\n\tsetIsTemplatePartSelectionOpen,\n} ) {\n\t// This hook fetches patterns, so don't run it unconditionally in the main\n\t// edit function!\n\tconst { templateParts } = useAlternativeTemplateParts(\n\t\tarea,\n\t\ttemplatePartId\n\t);\n\tconst hasReplacements = !! templateParts.length;\n\tconst canReplace =\n\t\tisEntityAvailable &&\n\t\thasReplacements &&\n\t\t( area === 'header' || area === 'footer' );\n\n\tif ( ! canReplace ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\tsetIsTemplatePartSelectionOpen( true );\n\t\t\t} }\n\t\t\taria-expanded={ isTemplatePartSelectionOpen }\n\t\t\taria-haspopup=\"dialog\"\n\t\t>\n\t\t\t{ __( 'Replace' ) }\n\t\t</MenuItem>\n\t);\n}\n\nfunction TemplatesList( { area, clientId, isEntityAvailable, onSelect } ) {\n\t// This hook fetches patterns, so don't run it unconditionally in the main\n\t// edit function!\n\tconst blockPatterns = useAlternativeBlockPatterns( area, clientId );\n\tconst canReplace =\n\t\tisEntityAvailable &&\n\t\t!! blockPatterns.length &&\n\t\t( area === 'header' || area === 'footer' );\n\n\tif ( ! canReplace ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelBody title={ __( 'Design' ) }>\n\t\t\t<BlockPatternsList\n\t\t\t\tlabel={ __( 'Templates' ) }\n\t\t\t\tblockPatterns={ blockPatterns }\n\t\t\t\tonClickPattern={ onSelect }\n\t\t\t\tshowTitlesAsTooltip\n\t\t\t/>\n\t\t</PanelBody>\n\t);\n}\n\nexport default function TemplatePartEdit( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n} ) {\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst currentTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.stylesheet,\n\t\t[]\n\t);\n\tconst { slug, theme = currentTheme, tagName, layout = {} } = attributes;\n\tconst templatePartId = createTemplatePartId( theme, slug );\n\tconst hasAlreadyRendered = useHasRecursion( templatePartId );\n\tconst [ isTemplatePartSelectionOpen, setIsTemplatePartSelectionOpen ] =\n\t\tuseState( false );\n\n\tconst {\n\t\tisResolved,\n\t\thasInnerBlocks,\n\t\tisMissing,\n\t\tarea,\n\t\tonNavigateToEntityRecord,\n\t\ttitle,\n\t\tcanUserEdit,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getBlockCount, getSettings } = select( blockEditorStore );\n\n\t\t\tconst getEntityArgs = [\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\ttemplatePartId,\n\t\t\t];\n\t\t\tconst entityRecord = templatePartId\n\t\t\t\t? getEditedEntityRecord( ...getEntityArgs )\n\t\t\t\t: null;\n\t\t\tconst _area = entityRecord?.area || attributes.area;\n\t\t\tconst hasResolvedEntity = templatePartId\n\t\t\t\t? hasFinishedResolution(\n\t\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\t\tgetEntityArgs\n\t\t\t\t )\n\t\t\t\t: false;\n\n\t\t\tconst _canUserEdit = hasResolvedEntity\n\t\t\t\t? select( coreStore ).canUser( 'update', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'wp_template_part',\n\t\t\t\t\t\tid: templatePartId,\n\t\t\t\t } )\n\t\t\t\t: false;\n\n\t\t\treturn {\n\t\t\t\thasInnerBlocks: getBlockCount( clientId ) > 0,\n\t\t\t\tisResolved: hasResolvedEntity,\n\t\t\t\tisMissing:\n\t\t\t\t\thasResolvedEntity &&\n\t\t\t\t\t( ! entityRecord ||\n\t\t\t\t\t\tObject.keys( entityRecord ).length === 0 ),\n\t\t\t\tarea: _area,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\tgetSettings().onNavigateToEntityRecord,\n\t\t\t\ttitle: entityRecord?.title,\n\t\t\t\tcanUserEdit: !! _canUserEdit,\n\t\t\t};\n\t\t},\n\t\t[ templatePartId, attributes.area, clientId ]\n\t);\n\n\tconst areaObject = useTemplatePartArea( area );\n\tconst blockProps = useBlockProps();\n\tconst isPlaceholder = ! slug;\n\tconst isEntityAvailable = ! isPlaceholder && ! isMissing && isResolved;\n\tconst TagName = tagName || areaObject.tagName;\n\n\tconst onPatternSelect = async ( pattern ) => {\n\t\tawait editEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\ttemplatePartId,\n\t\t\t{\n\t\t\t\tblocks: pattern.blocks,\n\t\t\t\tcontent: serialize( pattern.blocks ),\n\t\t\t}\n\t\t);\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: template part title. */\n\t\t\t\t__( 'Template Part \"%s\" updated.' ),\n\t\t\t\ttitle || slug\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t}\n\t\t);\n\t};\n\n\t// We don't want to render a missing state if we have any inner blocks.\n\t// A new template part is automatically created if we have any inner blocks but no entity.\n\tif (\n\t\t! hasInnerBlocks &&\n\t\t( ( slug && ! theme ) || ( slug && isMissing ) )\n\t) {\n\t\treturn (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %s: Template part slug. */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Template part has been deleted or is unavailable: %s'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tslug\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\tif ( isEntityAvailable && hasAlreadyRendered ) {\n\t\treturn (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t\t</Warning>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<RecursionProvider uniqueId={ templatePartId }>\n\t\t\t\t{ isEntityAvailable &&\n\t\t\t\t\tonNavigateToEntityRecord &&\n\t\t\t\t\tcanUserEdit && (\n\t\t\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\t\tpostId: templatePartId,\n\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template_part',\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t\t</BlockControls>\n\t\t\t\t\t) }\n\t\t\t\t{ canUserEdit && (\n\t\t\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t\t\t<TemplatePartAdvancedControls\n\t\t\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\t\tdefaultWrapper={ areaObject.tagName }\n\t\t\t\t\t\t\thasInnerBlocks={ hasInnerBlocks }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</InspectorControls>\n\t\t\t\t) }\n\t\t\t\t{ isPlaceholder && (\n\t\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t\t<TemplatePartPlaceholder\n\t\t\t\t\t\t\tarea={ attributes.area }\n\t\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\tonOpenSelectionModal={ () =>\n\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( true )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</TagName>\n\t\t\t\t) }\n\t\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t\t{ ( { selectedClientIds } ) => {\n\t\t\t\t\t\t// Only enable for single selection that matches the current block.\n\t\t\t\t\t\t// Ensures menu item doesn't render multiple times.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t! (\n\t\t\t\t\t\t\t\tselectedClientIds.length === 1 &&\n\t\t\t\t\t\t\t\tclientId === selectedClientIds[ 0 ]\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<ReplaceButton\n\t\t\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t\t\tisEntityAvailable,\n\t\t\t\t\t\t\t\t\tarea,\n\t\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\t\ttemplatePartId,\n\t\t\t\t\t\t\t\t\tisTemplatePartSelectionOpen,\n\t\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t</BlockSettingsMenuControls>\n\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<TemplatesList\n\t\t\t\t\t\tarea={ area }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\t\t\tonSelect={ ( pattern ) => onPatternSelect( pattern ) }\n\t\t\t\t\t/>\n\t\t\t\t</InspectorControls>\n\n\t\t\t\t{ isEntityAvailable && (\n\t\t\t\t\t<TemplatePartInnerBlocks\n\t\t\t\t\t\ttagName={ TagName }\n\t\t\t\t\t\tblockProps={ blockProps }\n\t\t\t\t\t\tpostId={ templatePartId }\n\t\t\t\t\t\thasInnerBlocks={ hasInnerBlocks }\n\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! isPlaceholder && ! isResolved && (\n\t\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</TagName>\n\t\t\t\t) }\n\t\t\t</RecursionProvider>\n\t\t\t{ isTemplatePartSelectionOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\toverlayClassName=\"block-editor-template-part__selection-modal\"\n\t\t\t\t\ttitle={ sprintf(\n\t\t\t\t\t\t// Translators: %s as template part area title (\"Header\", \"Footer\", etc.).\n\t\t\t\t\t\t__( 'Choose a %s' ),\n\t\t\t\t\t\tareaObject.label.toLowerCase()\n\t\t\t\t\t) }\n\t\t\t\t\tonRequestClose={ () =>\n\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( false )\n\t\t\t\t\t}\n\t\t\t\t\tisFullScreen\n\t\t\t\t>\n\t\t\t\t\t<TemplatePartSelectionModal\n\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tarea={ area }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tonClose={ () =>\n\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( false )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,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F,WAAA,CAAAY,GAAA,EAACf,YAAA,CAAAmG,OAAuB;QACvBrD,OAAO,EAAGgC,OAAS;QACnBH,UAAU,EAAGA,UAAY;QACzBmB,MAAM,EAAGvF,cAAgB;QACzB8C,cAAc,EAAGA,cAAgB;QACjCN,MAAM,EAAGA;MAAQ,CACjB,CACD,EACC,CAAE8B,aAAa,IAAI,CAAEzB,UAAU,iBAChC,IAAAjD,WAAA,CAAAY,GAAA,EAAC+D,OAAO;QAAA,GAAMH,UAAU;QAAAzD,QAAA,eACvB,IAAAf,WAAA,CAAAY,GAAA,EAACxB,WAAA,CAAAgH,OAAO,IAAE;MAAC,CACH,CACT;IAAA,CACiB,CAAC,EAClB/F,2BAA2B,iBAC5B,IAAAL,WAAA,CAAAY,GAAA,EAACxB,WAAA,CAAAiH,KAAK;MACLC,gBAAgB,EAAC,6CAA6C;MAC9D/E,KAAK,EAAG,IAAA0D,aAAO;MACd;MACA,IAAAjE,QAAE,EAAE,aAAc,CAAC,EACnBsD,UAAU,CAAC7C,KAAK,CAAC8E,WAAW,CAAC,CAC9B,CAAG;MACHC,cAAc,EAAGA,CAAA,KAChBlG,8BAA8B,CAAE,KAAM,CACtC;MACDmG,YAAY;MAAA1F,QAAA,eAEZ,IAAAf,WAAA,CAAAY,GAAA,EAACjB,eAAA,CAAAqG,OAA0B;QAC1B5F,cAAc,EAAGA,cAAgB;QACjCc,QAAQ,EAAGA,QAAU;QACrBf,IAAI,EAAGA,IAAM;QACb2B,aAAa,EAAGA,aAAe;QAC/B4E,OAAO,EAAGA,CAAA,KACTpG,8BAA8B,CAAE,KAAM;MACtC,CACD;IAAC,CACI,CACP;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["calendar","icon","initBlock","metadata","$schema","apiVersion","name","title","category","description","keywords","textdomain","attributes","month","type","year","supports","align","color","link","__experimentalSkipSerialization","__experimentalDefaultControls","background","text","__experimentalSelector","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalLetterSpacing","interactivity","clientNavigation","style","edit","transforms","settings","example","init"],"sources":["@wordpress/block-library/src/calendar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { calendar as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\tedit,\n\ttransforms,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,IAAIC,IAAI,QAAQ,kBAAkB;;AAEnD;AACA;AACA;AACA,OAAOC,SAAS,MAAM,qBAAqB;AAAC,MAAAC,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,KAAA;MAAAC,IAAA;IAAA;IAAAC,IAAA;MAAAD,IAAA;IAAA;EAAA;EAAAE,QAAA;IAAAC,KAAA;IAAAC,KAAA;MAAAC,IAAA;MAAAC,+BAAA;MAAAC,6BAAA;QAAAC,UAAA;QAAAC,IAAA;MAAA;MAAAC,sBAAA;IAAA;IAAAC,UAAA;MAAAC,QAAA;MAAAC,UAAA;MAAAC,wBAAA;MAAAC,wBAAA;MAAAC,uBAAA;MAAAC,2BAAA;MAAAC,2BAAA;MAAAX,6BAAA;QAAAK,QAAA;MAAA;IAAA;IAAAO,aAAA;MAAAC,gBAAA;IAAA;EAAA;EAAAC,KAAA;AAAA;AAE5C,OAAOC,IAAI,MAAM,QAAQ;AACzB,OAAOC,UAAU,MAAM,cAAc;AAErC,MAAM;
|
|
1
|
+
{"version":3,"names":["calendar","icon","initBlock","metadata","$schema","apiVersion","name","title","category","description","keywords","textdomain","attributes","month","type","year","supports","align","html","color","link","__experimentalSkipSerialization","__experimentalDefaultControls","background","text","__experimentalSelector","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalLetterSpacing","interactivity","clientNavigation","style","edit","transforms","settings","example","init"],"sources":["@wordpress/block-library/src/calendar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { calendar as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\tedit,\n\ttransforms,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,IAAIC,IAAI,QAAQ,kBAAkB;;AAEnD;AACA;AACA;AACA,OAAOC,SAAS,MAAM,qBAAqB;AAAC,MAAAC,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,KAAA;MAAAC,IAAA;IAAA;IAAAC,IAAA;MAAAD,IAAA;IAAA;EAAA;EAAAE,QAAA;IAAAC,KAAA;IAAAC,IAAA;IAAAC,KAAA;MAAAC,IAAA;MAAAC,+BAAA;MAAAC,6BAAA;QAAAC,UAAA;QAAAC,IAAA;MAAA;MAAAC,sBAAA;IAAA;IAAAC,UAAA;MAAAC,QAAA;MAAAC,UAAA;MAAAC,wBAAA;MAAAC,wBAAA;MAAAC,uBAAA;MAAAC,2BAAA;MAAAC,2BAAA;MAAAX,6BAAA;QAAAK,QAAA;MAAA;IAAA;IAAAO,aAAA;MAAAC,gBAAA;IAAA;EAAA;EAAAC,KAAA;AAAA;AAE5C,OAAOC,IAAI,MAAM,QAAQ;AACzB,OAAOC,UAAU,MAAM,cAAc;AAErC,MAAM;EAAEhC;AAAK,CAAC,GAAGH,QAAQ;AAEzB,SAASA,QAAQ,EAAEG,IAAI;AAEvB,OAAO,MAAMiC,QAAQ,GAAG;EACvBtC,IAAI;EACJuC,OAAO,EAAE,CAAC,CAAC;EACXH,IAAI;EACJC;AACD,CAAC;AAED,OAAO,MAAMG,IAAI,GAAGA,CAAA,KAAMvC,SAAS,CAAE;EAAEI,IAAI;EAAEH,QAAQ;EAAEoC;AAAS,CAAE,CAAC","ignoreList":[]}
|
|
@@ -1,28 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { SelectControl } from '@wordpress/components';
|
|
5
4
|
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { InspectorControls } from '@wordpress/block-editor';
|
|
5
|
+
import { InspectorControls, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Internal dependencies
|
|
10
9
|
*/
|
|
11
|
-
import {
|
|
10
|
+
import { unlock } from '../../lock-unlock';
|
|
12
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
const {
|
|
13
|
+
HTMLElementControl
|
|
14
|
+
} = unlock(blockEditorPrivateApis);
|
|
13
15
|
export default function CommentsInspectorControls({
|
|
14
16
|
attributes: {
|
|
15
17
|
tagName
|
|
16
18
|
},
|
|
17
|
-
setAttributes
|
|
19
|
+
setAttributes,
|
|
20
|
+
clientId
|
|
18
21
|
}) {
|
|
19
22
|
return /*#__PURE__*/_jsx(InspectorControls, {
|
|
20
23
|
children: /*#__PURE__*/_jsx(InspectorControls, {
|
|
21
24
|
group: "advanced",
|
|
22
|
-
children: /*#__PURE__*/_jsx(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
children: /*#__PURE__*/_jsx(HTMLElementControl, {
|
|
26
|
+
tagName: tagName,
|
|
27
|
+
onChange: value => setAttributes({
|
|
28
|
+
tagName: value
|
|
29
|
+
}),
|
|
30
|
+
clientId: clientId,
|
|
26
31
|
options: [{
|
|
27
32
|
label: __('Default (<div>)'),
|
|
28
33
|
value: 'div'
|
|
@@ -32,12 +37,7 @@ export default function CommentsInspectorControls({
|
|
|
32
37
|
}, {
|
|
33
38
|
label: '<aside>',
|
|
34
39
|
value: 'aside'
|
|
35
|
-
}]
|
|
36
|
-
value: tagName,
|
|
37
|
-
onChange: value => setAttributes({
|
|
38
|
-
tagName: value
|
|
39
|
-
}),
|
|
40
|
-
help: htmlElementMessages[tagName]
|
|
40
|
+
}]
|
|
41
41
|
})
|
|
42
42
|
})
|
|
43
43
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["__","InspectorControls","privateApis","blockEditorPrivateApis","unlock","jsx","_jsx","HTMLElementControl","CommentsInspectorControls","attributes","tagName","setAttributes","clientId","children","group","onChange","value","options","label"],"sources":["@wordpress/block-library/src/comments/edit/comments-inspector-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInspectorControls,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { HTMLElementControl } = unlock( blockEditorPrivateApis );\n\nexport default function CommentsInspectorControls( {\n\tattributes: { tagName },\n\tsetAttributes,\n\tclientId,\n} ) {\n\treturn (\n\t\t<InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<HTMLElementControl\n\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</InspectorControls>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SACCC,iBAAiB,EACjBC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;;AAEhC;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE3C,MAAM;EAAEC;AAAmB,CAAC,GAAGH,MAAM,CAAED,sBAAuB,CAAC;AAE/D,eAAe,SAASK,yBAAyBA,CAAE;EAClDC,UAAU,EAAE;IAAEC;EAAQ,CAAC;EACvBC,aAAa;EACbC;AACD,CAAC,EAAG;EACH,oBACCN,IAAA,CAACL,iBAAiB;IAAAY,QAAA,eACjBP,IAAA,CAACL,iBAAiB;MAACa,KAAK,EAAC,UAAU;MAAAD,QAAA,eAClCP,IAAA,CAACC,kBAAkB;QAClBG,OAAO,EAAGA,OAAS;QACnBK,QAAQ,EAAKC,KAAK,IACjBL,aAAa,CAAE;UAAED,OAAO,EAAEM;QAAM,CAAE,CAClC;QACDJ,QAAQ,EAAGA,QAAU;QACrBK,OAAO,EAAG,CACT;UAAEC,KAAK,EAAElB,EAAE,CAAE,iBAAkB,CAAC;UAAEgB,KAAK,EAAE;QAAM,CAAC,EAChD;UAAEE,KAAK,EAAE,WAAW;UAAEF,KAAK,EAAE;QAAU,CAAC,EACxC;UAAEE,KAAK,EAAE,SAAS;UAAEF,KAAK,EAAE;QAAQ,CAAC;MAClC,CACH;IAAC,CACgB;EAAC,CACF,CAAC;AAEtB","ignoreList":[]}
|
|
@@ -13,7 +13,8 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
13
13
|
export default function CommentsEdit(props) {
|
|
14
14
|
const {
|
|
15
15
|
attributes,
|
|
16
|
-
setAttributes
|
|
16
|
+
setAttributes,
|
|
17
|
+
clientId
|
|
17
18
|
} = props;
|
|
18
19
|
const {
|
|
19
20
|
tagName: TagName,
|
|
@@ -31,7 +32,8 @@ export default function CommentsEdit(props) {
|
|
|
31
32
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
32
33
|
children: [/*#__PURE__*/_jsx(CommentsInspectorControls, {
|
|
33
34
|
attributes: attributes,
|
|
34
|
-
setAttributes: setAttributes
|
|
35
|
+
setAttributes: setAttributes,
|
|
36
|
+
clientId: clientId
|
|
35
37
|
}), /*#__PURE__*/_jsx(TagName, {
|
|
36
38
|
...innerBlocksProps
|
|
37
39
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useBlockProps","useInnerBlocksProps","CommentsInspectorControls","CommentsLegacy","TEMPLATE","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","CommentsEdit","props","attributes","setAttributes","tagName","TagName","legacy","blockProps","innerBlocksProps","template","children"],"sources":["@wordpress/block-library/src/comments/edit/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport CommentsInspectorControls from './comments-inspector-controls';\nimport CommentsLegacy from './comments-legacy';\nimport TEMPLATE from './template';\n\nexport default function CommentsEdit( props ) {\n\tconst { attributes, setAttributes } = props;\n\tconst { tagName: TagName, legacy } = attributes;\n\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\n\tif ( legacy ) {\n\t\treturn <CommentsLegacy { ...props } />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<CommentsInspectorControls\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t/>\n\t\t\t<TagName { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,mBAAmB,QAAQ,yBAAyB;;AAE5E;AACA;AACA;AACA,OAAOC,yBAAyB,MAAM,+BAA+B;AACrE,OAAOC,cAAc,MAAM,mBAAmB;AAC9C,OAAOC,QAAQ,MAAM,YAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAElC,eAAe,SAASC,YAAYA,CAAEC,KAAK,EAAG;EAC7C,MAAM;IAAEC,UAAU;IAAEC;
|
|
1
|
+
{"version":3,"names":["useBlockProps","useInnerBlocksProps","CommentsInspectorControls","CommentsLegacy","TEMPLATE","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","CommentsEdit","props","attributes","setAttributes","clientId","tagName","TagName","legacy","blockProps","innerBlocksProps","template","children"],"sources":["@wordpress/block-library/src/comments/edit/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport CommentsInspectorControls from './comments-inspector-controls';\nimport CommentsLegacy from './comments-legacy';\nimport TEMPLATE from './template';\n\nexport default function CommentsEdit( props ) {\n\tconst { attributes, setAttributes, clientId } = props;\n\tconst { tagName: TagName, legacy } = attributes;\n\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\n\tif ( legacy ) {\n\t\treturn <CommentsLegacy { ...props } />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<CommentsInspectorControls\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tclientId={ clientId }\n\t\t\t/>\n\t\t\t<TagName { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,mBAAmB,QAAQ,yBAAyB;;AAE5E;AACA;AACA;AACA,OAAOC,yBAAyB,MAAM,+BAA+B;AACrE,OAAOC,cAAc,MAAM,mBAAmB;AAC9C,OAAOC,QAAQ,MAAM,YAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAElC,eAAe,SAASC,YAAYA,CAAEC,KAAK,EAAG;EAC7C,MAAM;IAAEC,UAAU;IAAEC,aAAa;IAAEC;EAAS,CAAC,GAAGH,KAAK;EACrD,MAAM;IAAEI,OAAO,EAAEC,OAAO;IAAEC;EAAO,CAAC,GAAGL,UAAU;EAE/C,MAAMM,UAAU,GAAGnB,aAAa,CAAC,CAAC;EAClC,MAAMoB,gBAAgB,GAAGnB,mBAAmB,CAAEkB,UAAU,EAAE;IACzDE,QAAQ,EAAEjB;EACX,CAAE,CAAC;EAEH,IAAKc,MAAM,EAAG;IACb,oBAAOZ,IAAA,CAACH,cAAc;MAAA,GAAMS;IAAK,CAAI,CAAC;EACvC;EAEA,oBACCF,KAAA,CAAAF,SAAA;IAAAc,QAAA,gBACChB,IAAA,CAACJ,yBAAyB;MACzBW,UAAU,EAAGA,UAAY;MACzBC,aAAa,EAAGA,aAAe;MAC/BC,QAAQ,EAAGA;IAAU,CACrB,CAAC,eACFT,IAAA,CAACW,OAAO;MAAA,GAAMG;IAAgB,CAAI,CAAC;EAAA,CAClC,CAAC;AAEL","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useMemo } from '@wordpress/element';
|
|
5
|
-
import { ExternalLink, FocalPointPicker, RangeControl, TextareaControl, ToggleControl,
|
|
5
|
+
import { ExternalLink, FocalPointPicker, RangeControl, TextareaControl, ToggleControl, __experimentalUseCustomUnits as useCustomUnits, __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem, __experimentalUnitControl as UnitControl, __experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue } from '@wordpress/components';
|
|
6
6
|
import { useInstanceId } from '@wordpress/compose';
|
|
7
7
|
import { InspectorControls, useSettings, store as blockEditorStore, __experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown, __experimentalUseGradient, __experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
8
8
|
import { __ } from '@wordpress/i18n';
|
|
@@ -16,11 +16,11 @@ import { COVER_MIN_HEIGHT, mediaPosition } from '../shared';
|
|
|
16
16
|
import { unlock } from '../../lock-unlock';
|
|
17
17
|
import { useToolsPanelDropdownMenuProps } from '../../utils/hooks';
|
|
18
18
|
import { DEFAULT_MEDIA_SIZE_SLUG } from '../constants';
|
|
19
|
-
import { htmlElementMessages } from '../../utils/messages';
|
|
20
19
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
20
|
const {
|
|
22
21
|
cleanEmptyObject,
|
|
23
|
-
ResolutionTool
|
|
22
|
+
ResolutionTool,
|
|
23
|
+
HTMLElementControl
|
|
24
24
|
} = unlock(blockEditorPrivateApis);
|
|
25
25
|
function CoverHeightInput({
|
|
26
26
|
onChange,
|
|
@@ -321,10 +321,12 @@ export default function CoverInspectorControls({
|
|
|
321
321
|
})
|
|
322
322
|
}), /*#__PURE__*/_jsx(InspectorControls, {
|
|
323
323
|
group: "advanced",
|
|
324
|
-
children: /*#__PURE__*/_jsx(
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
324
|
+
children: /*#__PURE__*/_jsx(HTMLElementControl, {
|
|
325
|
+
tagName: tagName,
|
|
326
|
+
onChange: value => setAttributes({
|
|
327
|
+
tagName: value
|
|
328
|
+
}),
|
|
329
|
+
clientId: clientId,
|
|
328
330
|
options: [{
|
|
329
331
|
label: __('Default (<div>)'),
|
|
330
332
|
value: 'div'
|
|
@@ -346,12 +348,7 @@ export default function CoverInspectorControls({
|
|
|
346
348
|
}, {
|
|
347
349
|
label: '<footer>',
|
|
348
350
|
value: 'footer'
|
|
349
|
-
}]
|
|
350
|
-
value: tagName,
|
|
351
|
-
onChange: value => setAttributes({
|
|
352
|
-
tagName: value
|
|
353
|
-
}),
|
|
354
|
-
help: htmlElementMessages[tagName]
|
|
351
|
+
}]
|
|
355
352
|
})
|
|
356
353
|
})]
|
|
357
354
|
});
|