@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","HorizontalRule","
|
|
1
|
+
{"version":3,"names":["clsx","HorizontalRule","useBlockProps","getColorClassName","__experimentalUseColorProps","useColorProps","InspectorControls","privateApis","blockEditorPrivateApis","__","useDeprecatedOpacity","unlock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","HTMLElementControl","SeparatorEdit","attributes","setAttributes","clientId","backgroundColor","opacity","style","tagName","colorProps","currentColor","hasCustomColor","color","background","colorClass","className","styles","Wrapper","children","group","onChange","value","options","label","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: hasCustomCol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AAEA,OAAO,KAAK;EAC1C,CAAC,EACDG,UAAU,CAACM,SACZ,CAAC;EAED,MAAMC,MAAM,GAAG;IACdJ,KAAK,EAAEF,YAAY;IACnBL,eAAe,EAAEK;EAClB,CAAC;EACD,MAAMO,OAAO,GAAGT,OAAO,KAAK,IAAI,GAAGzB,cAAc,GAAGyB,OAAO;EAE3D,oBACCT,KAAA,CAAAF,SAAA;IAAAqB,QAAA,gBACCvB,IAAA,CAACP,iBAAiB;MAAC+B,KAAK,EAAC,UAAU;MAAAD,QAAA,eAClCvB,IAAA,CAACK,kBAAkB;QAClBQ,OAAO,EAAGA,OAAS;QACnBY,QAAQ,EAAKC,KAAK,IACjBlB,aAAa,CAAE;UAAEK,OAAO,EAAEa;QAAM,CAAE,CAClC;QACDjB,QAAQ,EAAGA,QAAU;QACrBkB,OAAO,EAAG,CACT;UAAEC,KAAK,EAAEhC,EAAE,CAAE,gBAAiB,CAAC;UAAE8B,KAAK,EAAE;QAAK,CAAC,EAC9C;UAAEE,KAAK,EAAE,OAAO;UAAEF,KAAK,EAAE;QAAM,CAAC;MAC9B,CACH;IAAC,CACgB,CAAC,eACpB1B,IAAA,CAACsB,OAAO;MAAA,GACFjC,aAAa,CAAE;QACnB+B,SAAS;QACTR,KAAK,EAAEI,cAAc,GAAGK,MAAM,GAAGQ;MAClC,CAAE;IAAC,CACH,CAAC;EAAA,CACD,CAAC;AAEL","ignoreList":[]}
|
|
@@ -5,20 +5,25 @@ import { useEntityProp, store as coreStore } from '@wordpress/core-data';
|
|
|
5
5
|
import { SelectControl, TextControl } from '@wordpress/components';
|
|
6
6
|
import { sprintf, __ } from '@wordpress/i18n';
|
|
7
7
|
import { useSelect } from '@wordpress/data';
|
|
8
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Internal dependencies
|
|
11
12
|
*/
|
|
12
13
|
import { TemplatePartImportControls } from './import-controls';
|
|
13
|
-
import {
|
|
14
|
+
import { unlock } from '../../lock-unlock';
|
|
14
15
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
const {
|
|
17
|
+
HTMLElementControl
|
|
18
|
+
} = unlock(blockEditorPrivateApis);
|
|
15
19
|
export function TemplatePartAdvancedControls({
|
|
16
20
|
tagName,
|
|
17
21
|
setAttributes,
|
|
18
22
|
isEntityAvailable,
|
|
19
23
|
templatePartId,
|
|
20
24
|
defaultWrapper,
|
|
21
|
-
hasInnerBlocks
|
|
25
|
+
hasInnerBlocks,
|
|
26
|
+
clientId
|
|
22
27
|
}) {
|
|
23
28
|
const [area, setArea] = useEntityProp('postType', 'wp_template_part', 'area', templatePartId);
|
|
24
29
|
const [title, setTitle] = useEntityProp('postType', 'wp_template_part', 'title', templatePartId);
|
|
@@ -50,10 +55,12 @@ export function TemplatePartAdvancedControls({
|
|
|
50
55
|
value: area,
|
|
51
56
|
onChange: setArea
|
|
52
57
|
})]
|
|
53
|
-
}), /*#__PURE__*/_jsx(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
}), /*#__PURE__*/_jsx(HTMLElementControl, {
|
|
59
|
+
tagName: tagName || '',
|
|
60
|
+
onChange: value => setAttributes({
|
|
61
|
+
tagName: value
|
|
62
|
+
}),
|
|
63
|
+
clientId: clientId,
|
|
57
64
|
options: [{
|
|
58
65
|
label: sprintf(/* translators: %s: HTML tag based on area. */
|
|
59
66
|
__('Default based on area (%s)'), `<${defaultWrapper}>`),
|
|
@@ -79,12 +86,7 @@ export function TemplatePartAdvancedControls({
|
|
|
79
86
|
}, {
|
|
80
87
|
label: '<div>',
|
|
81
88
|
value: 'div'
|
|
82
|
-
}]
|
|
83
|
-
value: tagName || '',
|
|
84
|
-
onChange: value => setAttributes({
|
|
85
|
-
tagName: value
|
|
86
|
-
}),
|
|
87
|
-
help: htmlElementMessages[tagName]
|
|
89
|
+
}]
|
|
88
90
|
}), !hasInnerBlocks && /*#__PURE__*/_jsx(TemplatePartImportControls, {
|
|
89
91
|
area: area,
|
|
90
92
|
setAttributes: setAttributes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEntityProp","store","coreStore","SelectControl","TextControl","sprintf","__","useSelect","TemplatePartImportControls","
|
|
1
|
+
{"version":3,"names":["useEntityProp","store","coreStore","SelectControl","TextControl","sprintf","__","useSelect","privateApis","blockEditorPrivateApis","TemplatePartImportControls","unlock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","HTMLElementControl","TemplatePartAdvancedControls","tagName","setAttributes","isEntityAvailable","templatePartId","defaultWrapper","hasInnerBlocks","clientId","area","setArea","title","setTitle","defaultTemplatePartAreas","select","getCurrentTheme","default_template_part_areas","areaOptions","map","label","_area","value","children","__next40pxDefaultSize","__nextHasNoMarginBottom","onChange","onFocus","event","target","labelPosition","options"],"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: 'div' },\n\t\t\t\t] }\n\t\t\t/>\n\t\t\t{ ! hasInnerBlocks && (\n\t\t\t\t<TemplatePartImportControls\n\t\t\t\t\tarea={ area }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACxE,SAASC,aAAa,EAAEC,WAAW,QAAQ,uBAAuB;AAClE,SAASC,OAAO,EAAEC,EAAE,QAAQ,iBAAiB;AAC7C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;;AAE/E;AACA;AACA;AACA,SAASC,0BAA0B,QAAQ,mBAAmB;AAC9D,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAE3C,MAAM;EAAEC;AAAmB,CAAC,GAAGP,MAAM,CAAEF,sBAAuB,CAAC;AAE/D,OAAO,SAASU,4BAA4BA,CAAE;EAC7CC,OAAO;EACPC,aAAa;EACbC,iBAAiB;EACjBC,cAAc;EACdC,cAAc;EACdC,cAAc;EACdC;AACD,CAAC,EAAG;EACH,MAAM,CAAEC,IAAI,EAAEC,OAAO,CAAE,GAAG5B,aAAa,CACtC,UAAU,EACV,kBAAkB,EAClB,MAAM,EACNuB,cACD,CAAC;EAED,MAAM,CAAEM,KAAK,EAAEC,QAAQ,CAAE,GAAG9B,aAAa,CACxC,UAAU,EACV,kBAAkB,EAClB,OAAO,EACPuB,cACD,CAAC;EAED,MAAMQ,w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,cAAc,GACpB,CAAC;QACDe,KAAK,EAAE;MACR,CAAC,EACD;QAAEF,KAAK,EAAE,UAAU;QAAEE,KAAK,EAAE;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,CAAEd,cAAc,iBACjBZ,IAAA,CAACH,0BAA0B;MAC1BiB,IAAI,EAAGA,IAAM;MACbN,aAAa,EAAGA;IAAe,CAC/B,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
@@ -181,7 +181,8 @@ export default function TemplatePartEdit({
|
|
|
181
181
|
isEntityAvailable: isEntityAvailable,
|
|
182
182
|
templatePartId: templatePartId,
|
|
183
183
|
defaultWrapper: areaObject.tagName,
|
|
184
|
-
hasInnerBlocks: hasInnerBlocks
|
|
184
|
+
hasInnerBlocks: hasInnerBlocks,
|
|
185
|
+
clientId: clientId
|
|
185
186
|
})
|
|
186
187
|
}), isPlaceholder && /*#__PURE__*/_jsx(TagName, {
|
|
187
188
|
...blockProps,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["serialize","useSelect","useDispatch","BlockSettingsMenuControls","useBlockProps","Warning","store","blockEditorStore","RecursionProvider","useHasRecursion","InspectorControls","__experimentalBlockPatternsList","BlockPatternsList","BlockControls","PanelBody","Spinner","Modal","MenuItem","ToolbarButton","__","sprintf","coreStore","useState","noticesStore","TemplatePartPlaceholder","TemplatePartSelectionModal","TemplatePartAdvancedControls","TemplatePartInnerBlocks","createTemplatePartId","useAlternativeBlockPatterns","useAlternativeTemplateParts","useTemplatePartArea","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","ReplaceButton","isEntityAvailable","area","templatePartId","isTemplatePartSelectionOpen","setIsTemplatePartSelectionOpen","templateParts","hasReplacements","length","canReplace","onClick","children","TemplatesList","clientId","onSelect","blockPatterns","title","label","onClickPattern","showTitlesAsTooltip","TemplatePartEdit","attributes","setAttributes","createSuccessNotice","editEntityRecord","currentTheme","select","getCurrentTheme","stylesheet","slug","theme","tagName","layout","hasAlreadyRendered","isResolved","hasInnerBlocks","isMissing","onNavigateToEntityRecord","canUserEdit","getEditedEntityRecord","hasFinishedResolution","getBlockCount","getSettings","getEntityArgs","entityRecord","_area","hasResolvedEntity","_canUserEdit","canUser","kind","name","id","Object","keys","areaObject","blockProps","isPlaceholder","TagName","onPatternSelect","pattern","blocks","content","type","uniqueId","group","postId","postType","defaultWrapper","onOpenSelectionModal","selectedClientIds","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":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,yBAAyB,EACzBC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,EAAGlC,OAAO;MACd;MACAD,EAAE,CAAE,aAAc,CAAC,EACnByE,UAAU,CAACrC,KAAK,CAACsD,WAAW,CAAC,CAC9B,CAAG;MACHC,cAAc,EAAGA,CAAA,KAChBnE,8BAA8B,CAAE,KAAM,CACtC;MACDoE,YAAY;MAAA9D,QAAA,eAEZhB,IAAA,CAACR,0BAA0B;QAC1BgB,cAAc,EAAGA,cAAgB;QACjCU,QAAQ,EAAGA,QAAU;QACrBX,IAAI,EAAGA,IAAM;QACboB,aAAa,EAAGA,aAAe;QAC/BoD,OAAO,EAAGA,CAAA,KACTrE,8BAA8B,CAAE,KAAM;MACtC,CACD;IAAC,CACI,CACP;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["serialize","useSelect","useDispatch","BlockSettingsMenuControls","useBlockProps","Warning","store","blockEditorStore","RecursionProvider","useHasRecursion","InspectorControls","__experimentalBlockPatternsList","BlockPatternsList","BlockControls","PanelBody","Spinner","Modal","MenuItem","ToolbarButton","__","sprintf","coreStore","useState","noticesStore","TemplatePartPlaceholder","TemplatePartSelectionModal","TemplatePartAdvancedControls","TemplatePartInnerBlocks","createTemplatePartId","useAlternativeBlockPatterns","useAlternativeTemplateParts","useTemplatePartArea","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","ReplaceButton","isEntityAvailable","area","templatePartId","isTemplatePartSelectionOpen","setIsTemplatePartSelectionOpen","templateParts","hasReplacements","length","canReplace","onClick","children","TemplatesList","clientId","onSelect","blockPatterns","title","label","onClickPattern","showTitlesAsTooltip","TemplatePartEdit","attributes","setAttributes","createSuccessNotice","editEntityRecord","currentTheme","select","getCurrentTheme","stylesheet","slug","theme","tagName","layout","hasAlreadyRendered","isResolved","hasInnerBlocks","isMissing","onNavigateToEntityRecord","canUserEdit","getEditedEntityRecord","hasFinishedResolution","getBlockCount","getSettings","getEntityArgs","entityRecord","_area","hasResolvedEntity","_canUserEdit","canUser","kind","name","id","Object","keys","areaObject","blockProps","isPlaceholder","TagName","onPatternSelect","pattern","blocks","content","type","uniqueId","group","postId","postType","defaultWrapper","onOpenSelectionModal","selectedClientIds","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":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,yBAAyB,EACzBC,aAAa,EACbC,OAAO,EACPC,KAAK,IAAIC,gBAAgB,EACzBC,iBAAiB,EACjBC,eAAe,EACfC,iBAAiB,EACjBC,+BAA+B,IAAIC,iBAAiB,EACpDC,aAAa,QACP,yBAAyB;AAChC,SACCC,SAAS,EACTC,OAAO,EACPC,KAAK,EACLC,QAAQ,EACRC,aAAa,QACP,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASd,KAAK,IAAIe,SAAS,QAAQ,sBAAsB;AACzD,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAAShB,KAAK,IAAIiB,YAAY,QAAQ,oBAAoB;;AAE1D;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,eAAe;AACnD,OAAOC,0BAA0B,MAAM,mBAAmB;AAC1D,SAASC,4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+1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.23.0",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -41,39 +41,39 @@
|
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@babel/runtime": "7.25.7",
|
|
44
|
-
"@wordpress/a11y": "^4.
|
|
45
|
-
"@wordpress/api-fetch": "^7.
|
|
46
|
-
"@wordpress/autop": "^4.
|
|
47
|
-
"@wordpress/blob": "^4.
|
|
48
|
-
"@wordpress/block-editor": "^14.
|
|
49
|
-
"@wordpress/blocks": "^14.
|
|
50
|
-
"@wordpress/components": "^29.
|
|
51
|
-
"@wordpress/compose": "^7.
|
|
52
|
-
"@wordpress/core-data": "^7.
|
|
53
|
-
"@wordpress/data": "^10.
|
|
54
|
-
"@wordpress/date": "^5.
|
|
55
|
-
"@wordpress/deprecated": "^4.
|
|
56
|
-
"@wordpress/dom": "^4.
|
|
57
|
-
"@wordpress/element": "^6.
|
|
58
|
-
"@wordpress/escape-html": "^3.
|
|
59
|
-
"@wordpress/hooks": "^4.
|
|
60
|
-
"@wordpress/html-entities": "^4.
|
|
61
|
-
"@wordpress/i18n": "^5.
|
|
62
|
-
"@wordpress/icons": "^10.
|
|
63
|
-
"@wordpress/interactivity": "^6.
|
|
64
|
-
"@wordpress/interactivity-router": "^2.
|
|
65
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
66
|
-
"@wordpress/keycodes": "^4.
|
|
67
|
-
"@wordpress/notices": "^5.
|
|
68
|
-
"@wordpress/patterns": "^2.
|
|
69
|
-
"@wordpress/primitives": "^4.
|
|
70
|
-
"@wordpress/private-apis": "^1.
|
|
71
|
-
"@wordpress/reusable-blocks": "^5.
|
|
72
|
-
"@wordpress/rich-text": "^7.
|
|
73
|
-
"@wordpress/server-side-render": "^5.
|
|
74
|
-
"@wordpress/url": "^4.
|
|
75
|
-
"@wordpress/viewport": "^6.
|
|
76
|
-
"@wordpress/wordcount": "^4.
|
|
44
|
+
"@wordpress/a11y": "^4.23.0",
|
|
45
|
+
"@wordpress/api-fetch": "^7.23.0",
|
|
46
|
+
"@wordpress/autop": "^4.23.0",
|
|
47
|
+
"@wordpress/blob": "^4.23.0",
|
|
48
|
+
"@wordpress/block-editor": "^14.18.0",
|
|
49
|
+
"@wordpress/blocks": "^14.12.0",
|
|
50
|
+
"@wordpress/components": "^29.9.0",
|
|
51
|
+
"@wordpress/compose": "^7.23.0",
|
|
52
|
+
"@wordpress/core-data": "^7.23.0",
|
|
53
|
+
"@wordpress/data": "^10.23.0",
|
|
54
|
+
"@wordpress/date": "^5.23.0",
|
|
55
|
+
"@wordpress/deprecated": "^4.23.0",
|
|
56
|
+
"@wordpress/dom": "^4.23.0",
|
|
57
|
+
"@wordpress/element": "^6.23.0",
|
|
58
|
+
"@wordpress/escape-html": "^3.23.0",
|
|
59
|
+
"@wordpress/hooks": "^4.23.0",
|
|
60
|
+
"@wordpress/html-entities": "^4.23.0",
|
|
61
|
+
"@wordpress/i18n": "^5.23.0",
|
|
62
|
+
"@wordpress/icons": "^10.23.0",
|
|
63
|
+
"@wordpress/interactivity": "^6.23.0",
|
|
64
|
+
"@wordpress/interactivity-router": "^2.23.0",
|
|
65
|
+
"@wordpress/keyboard-shortcuts": "^5.23.0",
|
|
66
|
+
"@wordpress/keycodes": "^4.23.0",
|
|
67
|
+
"@wordpress/notices": "^5.23.0",
|
|
68
|
+
"@wordpress/patterns": "^2.23.0",
|
|
69
|
+
"@wordpress/primitives": "^4.23.0",
|
|
70
|
+
"@wordpress/private-apis": "^1.23.0",
|
|
71
|
+
"@wordpress/reusable-blocks": "^5.23.0",
|
|
72
|
+
"@wordpress/rich-text": "^7.23.0",
|
|
73
|
+
"@wordpress/server-side-render": "^5.23.0",
|
|
74
|
+
"@wordpress/url": "^4.23.0",
|
|
75
|
+
"@wordpress/viewport": "^6.23.0",
|
|
76
|
+
"@wordpress/wordcount": "^4.23.0",
|
|
77
77
|
"change-case": "^4.1.2",
|
|
78
78
|
"clsx": "^2.1.1",
|
|
79
79
|
"colord": "^2.7.0",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"publishConfig": {
|
|
92
92
|
"access": "public"
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "ab5c79cd40adbb68898536c50e035b0a734338ea"
|
|
95
95
|
}
|
package/src/calendar/block.json
CHANGED
|
@@ -1,36 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { SelectControl } from '@wordpress/components';
|
|
5
4
|
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
InspectorControls,
|
|
7
|
+
privateApis as blockEditorPrivateApis,
|
|
8
|
+
} from '@wordpress/block-editor';
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* Internal dependencies
|
|
10
12
|
*/
|
|
11
|
-
import {
|
|
13
|
+
import { unlock } from '../../lock-unlock';
|
|
14
|
+
|
|
15
|
+
const { HTMLElementControl } = unlock( blockEditorPrivateApis );
|
|
12
16
|
|
|
13
17
|
export default function CommentsInspectorControls( {
|
|
14
18
|
attributes: { tagName },
|
|
15
19
|
setAttributes,
|
|
20
|
+
clientId,
|
|
16
21
|
} ) {
|
|
17
22
|
return (
|
|
18
23
|
<InspectorControls>
|
|
19
24
|
<InspectorControls group="advanced">
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
<HTMLElementControl
|
|
26
|
+
tagName={ tagName }
|
|
27
|
+
onChange={ ( value ) =>
|
|
28
|
+
setAttributes( { tagName: value } )
|
|
29
|
+
}
|
|
30
|
+
clientId={ clientId }
|
|
24
31
|
options={ [
|
|
25
32
|
{ label: __( 'Default (<div>)' ), value: 'div' },
|
|
26
33
|
{ label: '<section>', value: 'section' },
|
|
27
34
|
{ label: '<aside>', value: 'aside' },
|
|
28
35
|
] }
|
|
29
|
-
value={ tagName }
|
|
30
|
-
onChange={ ( value ) =>
|
|
31
|
-
setAttributes( { tagName: value } )
|
|
32
|
-
}
|
|
33
|
-
help={ htmlElementMessages[ tagName ] }
|
|
34
36
|
/>
|
|
35
37
|
</InspectorControls>
|
|
36
38
|
</InspectorControls>
|
|
@@ -11,7 +11,7 @@ import CommentsLegacy from './comments-legacy';
|
|
|
11
11
|
import TEMPLATE from './template';
|
|
12
12
|
|
|
13
13
|
export default function CommentsEdit( props ) {
|
|
14
|
-
const { attributes, setAttributes } = props;
|
|
14
|
+
const { attributes, setAttributes, clientId } = props;
|
|
15
15
|
const { tagName: TagName, legacy } = attributes;
|
|
16
16
|
|
|
17
17
|
const blockProps = useBlockProps();
|
|
@@ -28,6 +28,7 @@ export default function CommentsEdit( props ) {
|
|
|
28
28
|
<CommentsInspectorControls
|
|
29
29
|
attributes={ attributes }
|
|
30
30
|
setAttributes={ setAttributes }
|
|
31
|
+
clientId={ clientId }
|
|
31
32
|
/>
|
|
32
33
|
<TagName { ...innerBlocksProps } />
|
|
33
34
|
</>
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
RangeControl,
|
|
9
9
|
TextareaControl,
|
|
10
10
|
ToggleControl,
|
|
11
|
-
SelectControl,
|
|
12
11
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
13
12
|
__experimentalToolsPanel as ToolsPanel,
|
|
14
13
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
@@ -36,9 +35,10 @@ import { COVER_MIN_HEIGHT, mediaPosition } from '../shared';
|
|
|
36
35
|
import { unlock } from '../../lock-unlock';
|
|
37
36
|
import { useToolsPanelDropdownMenuProps } from '../../utils/hooks';
|
|
38
37
|
import { DEFAULT_MEDIA_SIZE_SLUG } from '../constants';
|
|
39
|
-
import { htmlElementMessages } from '../../utils/messages';
|
|
40
38
|
|
|
41
|
-
const { cleanEmptyObject, ResolutionTool } = unlock(
|
|
39
|
+
const { cleanEmptyObject, ResolutionTool, HTMLElementControl } = unlock(
|
|
40
|
+
blockEditorPrivateApis
|
|
41
|
+
);
|
|
42
42
|
|
|
43
43
|
function CoverHeightInput( {
|
|
44
44
|
onChange,
|
|
@@ -421,10 +421,12 @@ export default function CoverInspectorControls( {
|
|
|
421
421
|
</ToolsPanelItem>
|
|
422
422
|
</InspectorControls>
|
|
423
423
|
<InspectorControls group="advanced">
|
|
424
|
-
<
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
424
|
+
<HTMLElementControl
|
|
425
|
+
tagName={ tagName }
|
|
426
|
+
onChange={ ( value ) =>
|
|
427
|
+
setAttributes( { tagName: value } )
|
|
428
|
+
}
|
|
429
|
+
clientId={ clientId }
|
|
428
430
|
options={ [
|
|
429
431
|
{ label: __( 'Default (<div>)' ), value: 'div' },
|
|
430
432
|
{ label: '<header>', value: 'header' },
|
|
@@ -434,11 +436,6 @@ export default function CoverInspectorControls( {
|
|
|
434
436
|
{ label: '<aside>', value: 'aside' },
|
|
435
437
|
{ label: '<footer>', value: 'footer' },
|
|
436
438
|
] }
|
|
437
|
-
value={ tagName }
|
|
438
|
-
onChange={ ( value ) =>
|
|
439
|
-
setAttributes( { tagName: value } )
|
|
440
|
-
}
|
|
441
|
-
help={ htmlElementMessages[ tagName ] }
|
|
442
439
|
/>
|
|
443
440
|
</InspectorControls>
|
|
444
441
|
</>
|
package/src/group/edit.js
CHANGED
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
InspectorControls,
|
|
9
9
|
useInnerBlocksProps,
|
|
10
10
|
store as blockEditorStore,
|
|
11
|
+
privateApis as blockEditorPrivateApis,
|
|
11
12
|
} from '@wordpress/block-editor';
|
|
12
|
-
import { SelectControl } from '@wordpress/components';
|
|
13
13
|
import { useRef } from '@wordpress/element';
|
|
14
14
|
import { __ } from '@wordpress/i18n';
|
|
15
15
|
import { View } from '@wordpress/primitives';
|
|
@@ -18,7 +18,9 @@ import { View } from '@wordpress/primitives';
|
|
|
18
18
|
* Internal dependencies
|
|
19
19
|
*/
|
|
20
20
|
import GroupPlaceHolder, { useShouldShowPlaceHolder } from './placeholder';
|
|
21
|
-
import {
|
|
21
|
+
import { unlock } from '../lock-unlock';
|
|
22
|
+
|
|
23
|
+
const { HTMLElementControl } = unlock( blockEditorPrivateApis );
|
|
22
24
|
|
|
23
25
|
/**
|
|
24
26
|
* Render inspector controls for the Group block.
|
|
@@ -26,16 +28,17 @@ import { htmlElementMessages } from '../utils/messages';
|
|
|
26
28
|
* @param {Object} props Component props.
|
|
27
29
|
* @param {string} props.tagName The HTML tag name.
|
|
28
30
|
* @param {Function} props.onSelectTagName onChange function for the SelectControl.
|
|
31
|
+
* @param {string} props.clientId The client ID of the current block.
|
|
29
32
|
*
|
|
30
33
|
* @return {JSX.Element} The control group.
|
|
31
34
|
*/
|
|
32
|
-
function GroupEditControls( { tagName, onSelectTagName } ) {
|
|
35
|
+
function GroupEditControls( { tagName, onSelectTagName, clientId } ) {
|
|
33
36
|
return (
|
|
34
37
|
<InspectorControls group="advanced">
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
<HTMLElementControl
|
|
39
|
+
tagName={ tagName }
|
|
40
|
+
onChange={ onSelectTagName }
|
|
41
|
+
clientId={ clientId }
|
|
39
42
|
options={ [
|
|
40
43
|
{ label: __( 'Default (<div>)' ), value: 'div' },
|
|
41
44
|
{ label: '<header>', value: 'header' },
|
|
@@ -45,9 +48,6 @@ function GroupEditControls( { tagName, onSelectTagName } ) {
|
|
|
45
48
|
{ label: '<aside>', value: 'aside' },
|
|
46
49
|
{ label: '<footer>', value: 'footer' },
|
|
47
50
|
] }
|
|
48
|
-
value={ tagName }
|
|
49
|
-
onChange={ onSelectTagName }
|
|
50
|
-
help={ htmlElementMessages[ tagName ] }
|
|
51
51
|
/>
|
|
52
52
|
</InspectorControls>
|
|
53
53
|
);
|
|
@@ -129,6 +129,7 @@ function GroupEdit( { attributes, name, setAttributes, clientId } ) {
|
|
|
129
129
|
onSelectTagName={ ( value ) =>
|
|
130
130
|
setAttributes( { tagName: value } )
|
|
131
131
|
}
|
|
132
|
+
clientId={ clientId }
|
|
132
133
|
/>
|
|
133
134
|
{ showPlaceholder && (
|
|
134
135
|
<View>
|
package/src/image/edit.js
CHANGED
|
@@ -262,10 +262,6 @@ export function ImageEdit( {
|
|
|
262
262
|
additionalAttributes = {
|
|
263
263
|
sizeSlug: newSize,
|
|
264
264
|
};
|
|
265
|
-
} else {
|
|
266
|
-
// Keep the same url when selecting the same file, so "Resolution"
|
|
267
|
-
// option is not changed.
|
|
268
|
-
additionalAttributes = { url };
|
|
269
265
|
}
|
|
270
266
|
|
|
271
267
|
// Check if default link setting should be used.
|