@wordpress/block-library 8.17.0 → 8.17.1
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/README.md +19 -0
- package/build/footnotes/init.js +13 -0
- package/build/footnotes/init.js.map +1 -0
- package/build/list/edit.js +2 -1
- package/build/list/edit.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +2 -1
- package/build/navigation/edit/inner-blocks.js.map +1 -1
- package/build/quote/edit.js +2 -1
- package/build/quote/edit.js.map +1 -1
- package/build/template-part/edit/index.js +22 -15
- package/build/template-part/edit/index.js.map +1 -1
- package/build-module/footnotes/init.js +6 -0
- package/build-module/footnotes/init.js.map +1 -0
- package/build-module/list/edit.js +2 -1
- package/build-module/list/edit.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +2 -1
- package/build-module/navigation/edit/inner-blocks.js.map +1 -1
- package/build-module/quote/edit.js +2 -1
- package/build-module/quote/edit.js.map +1 -1
- package/build-module/template-part/edit/index.js +22 -15
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-style/editor-rtl.css +2 -1
- package/build-style/editor.css +2 -1
- package/build-style/social-links/editor-rtl.css +2 -1
- package/build-style/social-links/editor.css +2 -1
- package/package.json +32 -32
- package/src/footnotes/init.js +6 -0
- package/src/list/edit.js +1 -0
- package/src/navigation/edit/inner-blocks.js +1 -0
- package/src/post-navigation-link/index.php +2 -2
- package/src/quote/edit.js +1 -0
- package/src/social-links/editor.scss +2 -1
- package/src/template-part/edit/index.js +35 -22
- package/tsconfig.tsbuildinfo +1 -1
package/README.md
CHANGED
|
@@ -119,4 +119,23 @@ To find out more about contributing to this package or Gutenberg as a whole, ple
|
|
|
119
119
|
}
|
|
120
120
|
```
|
|
121
121
|
|
|
122
|
+
### Naming convention for PHP functions
|
|
123
|
+
|
|
124
|
+
All PHP function names declared within the subdirectories of the `packages/block-library/src/` directory should start with one of the following prefixes:
|
|
125
|
+
|
|
126
|
+
- `block_core_<directory_name>`
|
|
127
|
+
- `render_block_core_<directory_name>`
|
|
128
|
+
- `register_block_core_<directory_name>`
|
|
129
|
+
|
|
130
|
+
In this context, `<directory_name>` represents the name of the directory where the corresponding `.php` file is located.
|
|
131
|
+
The directory name is converted to lowercase, and any characters except for letters and digits are replaced with underscores.
|
|
132
|
+
|
|
133
|
+
#### Example:
|
|
134
|
+
|
|
135
|
+
For the PHP functions declared in the `packages/block-library/src/my-block/index.php` file, the correct prefixes would be:
|
|
136
|
+
|
|
137
|
+
- `block_core_my_block`
|
|
138
|
+
- `render_block_core_my_block`
|
|
139
|
+
- `register_block_core_my_block`
|
|
140
|
+
|
|
122
141
|
<br /><br /><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _ = require("./");
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
var _default = (0, _.init)();
|
|
12
|
+
exports.default = _default;
|
|
13
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_","require","_default","init","exports","default"],"sources":["@wordpress/block-library/src/footnotes/init.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { init } from './';\n\nexport default init();\n"],"mappings":";;;;;;AAGA,IAAAA,CAAA,GAAAC,OAAA;AAHA;AACA;AACA;AAFA,IAAAC,QAAA,GAKe,IAAAC,MAAI,EAAC,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
|
package/build/list/edit.js
CHANGED
package/build/list/edit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_blockEditor","_components","_data","_i18n","_icons","_blocks","_deprecated","_interopRequireDefault","_orderedListSettings","_utils","_tagName","TEMPLATE","NATIVE_MARGIN_SPACING","useMigrateOnLoad","attributes","clientId","registry","useRegistry","updateBlockAttributes","replaceInnerBlocks","useDispatch","blockEditorStore","useEffect","values","newAttributes","newInnerBlocks","migrateToListV2","deprecated","since","version","alternative","batch","useOutdentList","canOutdent","useSelect","innerSelect","getBlockRootClientId","getBlock","parentId","name","replaceBlocks","selectionChange","getBlockAttributes","useCallback","parentBlockId","parentBlockAttributes","newParentBlock","createBlock","innerBlocks","length","IndentUI","outdentList","createElement","Fragment","ToolbarButton","icon","isRTL","formatOutdentRTL","formatOutdent","title","__","describedBy","disabled","onClick","Edit","setAttributes","style","blockProps","useBlockProps","Platform","isNative","innerBlocksProps","useInnerBlocksProps","allowedBlocks","template","templateLock","templateInsertUpdatesSelection","marginVertical","marginHorizontal","renderAppender","ordered","type","reversed","start","controls","BlockControls","group","formatListBulletsRTL","formatListBullets","isActive","formatListNumberedRTL","formatListNumbered","default"],"sources":["@wordpress/block-library/src/list/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { ToolbarButton } from '@wordpress/components';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport {\n\tformatListBullets,\n\tformatListBulletsRTL,\n\tformatListNumbered,\n\tformatListNumberedRTL,\n\tformatOutdent,\n\tformatOutdentRTL,\n} from '@wordpress/icons';\nimport { createBlock } from '@wordpress/blocks';\nimport { useCallback, useEffect, Platform } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport OrderedListSettings from './ordered-list-settings';\nimport { migrateToListV2 } from './utils';\nimport TagName from './tag-name';\n\nconst TEMPLATE = [ [ 'core/list-item' ] ];\nconst NATIVE_MARGIN_SPACING = 8;\n\n/**\n * At the moment, deprecations don't handle create blocks from attributes\n * (like when using CPT templates). For this reason, this hook is necessary\n * to avoid breaking templates using the old list block format.\n *\n * @param {Object} attributes Block attributes.\n * @param {string} clientId Block client ID.\n */\nfunction useMigrateOnLoad( attributes, clientId ) {\n\tconst registry = useRegistry();\n\tconst { updateBlockAttributes, replaceInnerBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\t// As soon as the block is loaded, migrate it to the new version.\n\n\t\tif ( ! attributes.values ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst [ newAttributes, newInnerBlocks ] = migrateToListV2( attributes );\n\n\t\tdeprecated( 'Value attribute on the list block', {\n\t\t\tsince: '6.0',\n\t\t\tversion: '6.5',\n\t\t\talternative: 'inner blocks',\n\t\t} );\n\n\t\tregistry.batch( () => {\n\t\t\tupdateBlockAttributes( clientId, newAttributes );\n\t\t\treplaceInnerBlocks( clientId, newInnerBlocks );\n\t\t} );\n\t}, [ attributes.values ] );\n}\n\nfunction useOutdentList( clientId ) {\n\tconst { canOutdent } = useSelect(\n\t\t( innerSelect ) => {\n\t\t\tconst { getBlockRootClientId, getBlock } =\n\t\t\t\tinnerSelect( blockEditorStore );\n\t\t\tconst parentId = getBlockRootClientId( clientId );\n\t\t\treturn {\n\t\t\t\tcanOutdent:\n\t\t\t\t\t!! parentId &&\n\t\t\t\t\tgetBlock( parentId ).name === 'core/list-item',\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { replaceBlocks, selectionChange } = useDispatch( blockEditorStore );\n\tconst { getBlockRootClientId, getBlockAttributes, getBlock } =\n\t\tuseSelect( blockEditorStore );\n\n\treturn [\n\t\tcanOutdent,\n\t\tuseCallback( () => {\n\t\t\tconst parentBlockId = getBlockRootClientId( clientId );\n\t\t\tconst parentBlockAttributes = getBlockAttributes( parentBlockId );\n\t\t\t// Create a new parent block without the inner blocks.\n\t\t\tconst newParentBlock = createBlock(\n\t\t\t\t'core/list-item',\n\t\t\t\tparentBlockAttributes\n\t\t\t);\n\t\t\tconst { innerBlocks } = getBlock( clientId );\n\t\t\t// Replace the parent block with a new parent block without inner blocks,\n\t\t\t// and make the inner blocks siblings of the parent.\n\t\t\treplaceBlocks(\n\t\t\t\t[ parentBlockId ],\n\t\t\t\t[ newParentBlock, ...innerBlocks ]\n\t\t\t);\n\t\t\t// Select the last child of the list being outdent.\n\t\t\tselectionChange( innerBlocks[ innerBlocks.length - 1 ].clientId );\n\t\t}, [ clientId ] ),\n\t];\n}\n\nfunction IndentUI( { clientId } ) {\n\tconst [ canOutdent, outdentList ] = useOutdentList( clientId );\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatOutdentRTL : formatOutdent }\n\t\t\t\ttitle={ __( 'Outdent' ) }\n\t\t\t\tdescribedBy={ __( 'Outdent list item' ) }\n\t\t\t\tdisabled={ ! canOutdent }\n\t\t\t\tonClick={ outdentList }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default function Edit( { attributes, setAttributes, clientId, style } ) {\n\tconst blockProps = useBlockProps( {\n\t\t...( Platform.isNative && { style } ),\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: [ 'core/list-item' ],\n\t\ttemplate: TEMPLATE,\n\t\ttemplateLock: false,\n\t\ttemplateInsertUpdatesSelection: true,\n\t\t...( Platform.isNative && {\n\t\t\tmarginVertical: NATIVE_MARGIN_SPACING,\n\t\t\tmarginHorizontal: NATIVE_MARGIN_SPACING,\n\t\t\trenderAppender: false,\n\t\t} ),\n\t} );\n\tuseMigrateOnLoad( attributes, clientId );\n\tconst { ordered, type, reversed, start } = attributes;\n\n\tconst controls = (\n\t\t<BlockControls group=\"block\">\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatListBulletsRTL : formatListBullets }\n\t\t\t\ttitle={ __( 'Unordered' ) }\n\t\t\t\tdescribedBy={ __( 'Convert to unordered list' ) }\n\t\t\t\tisActive={ ordered === false }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetAttributes( { ordered: false } );\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatListNumberedRTL : formatListNumbered }\n\t\t\t\ttitle={ __( 'Ordered' ) }\n\t\t\t\tdescribedBy={ __( 'Convert to ordered list' ) }\n\t\t\t\tisActive={ ordered === true }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetAttributes( { ordered: true } );\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<IndentUI clientId={ clientId } />\n\t\t</BlockControls>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<TagName\n\t\t\t\tordered={ ordered }\n\t\t\t\treversed={ reversed }\n\t\t\t\tstart={ start }\n\t\t\t\ttype={ type }\n\t\t\t\t{ ...innerBlocksProps }\n\t\t\t/>\n\t\t\t{ controls }\n\t\t\t{ ordered && (\n\t\t\t\t<OrderedListSettings\n\t\t\t\t\t{ ...{\n\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\treversed,\n\t\t\t\t\t\tstart,\n\t\t\t\t\t\ttype,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAqBA,IAAAA,QAAA,GAAAC,OAAA;AAlBA,IAAAC,YAAA,GAAAD,OAAA;AAMA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAQA,IAAAM,OAAA,GAAAN,OAAA;AAEA,IAAAO,WAAA,GAAAC,sBAAA,CAAAR,OAAA;AAKA,IAAAS,oBAAA,GAAAD,sBAAA,CAAAR,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,QAAA,GAAAH,sBAAA,CAAAR,OAAA;AA7BA;AACA;AACA;;AAsBA;AACA;AACA;;AAKA,MAAMY,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AAM,CAAE,CAAC;IACpC;EAAG,CACH,CAAC,EACF,IAAAlF,QAAA,CAAAsD,aAAA,EAACnD,WAAA,CAAAqD,aAAa;IACbC,IAAI,EAAG,IAAAC,WAAK,EAAC,CAAC,GAAGkC,4BAAqB,GAAGC,yBAAoB;IAC7DhC,KAAK,EAAG,IAAAC,QAAE,EAAE,SAAU,CAAG;IACzBC,WAAW,EAAG,IAAAD,QAAE,EAAE,yBAA0B,CAAG;IAC/C6B,QAAQ,EAAGT,OAAO,KAAK,IAAM;IAC7BjB,OAAO,EAAGA,CAAA,KAAM;MACfE,aAAa,CAAE;QAAEe,OAAO,EAAE;MAAK,CAAE,CAAC;IACnC;EAAG,CACH,CAAC,EACF,IAAAlF,QAAA,CAAAsD,aAAA,EAACF,QAAQ;IAACnC,QAAQ,EAAGA;EAAU,CAAE,CACnB,CACf;EAED,OACC,IAAAjB,QAAA,CAAAsD,aAAA,EAAAtD,QAAA,CAAAuD,QAAA,QACC,IAAAvD,QAAA,CAAAsD,aAAA,EAAC1C,QAAA,CAAAkF,OAAO;IACPZ,OAAO,EAAGA,OAAS;IACnBE,QAAQ,EAAGA,QAAU;IACrBC,KAAK,EAAGA,KAAO;IACfF,IAAI,EAAGA,IAAM;IAAA,GACRV;EAAgB,CACrB,CAAC,EACAa,QAAQ,EACRJ,OAAO,IACR,IAAAlF,QAAA,CAAAsD,aAAA,EAAC5C,oBAAA,CAAAoF,OAAmB;IAElB3B,aAAa;IACbiB,QAAQ;IACRC,KAAK;IACLF;EAAI,CAEL,CAED,CAAC;AAEL"}
|
|
1
|
+
{"version":3,"names":["_element","require","_blockEditor","_components","_data","_i18n","_icons","_blocks","_deprecated","_interopRequireDefault","_orderedListSettings","_utils","_tagName","TEMPLATE","NATIVE_MARGIN_SPACING","useMigrateOnLoad","attributes","clientId","registry","useRegistry","updateBlockAttributes","replaceInnerBlocks","useDispatch","blockEditorStore","useEffect","values","newAttributes","newInnerBlocks","migrateToListV2","deprecated","since","version","alternative","batch","useOutdentList","canOutdent","useSelect","innerSelect","getBlockRootClientId","getBlock","parentId","name","replaceBlocks","selectionChange","getBlockAttributes","useCallback","parentBlockId","parentBlockAttributes","newParentBlock","createBlock","innerBlocks","length","IndentUI","outdentList","createElement","Fragment","ToolbarButton","icon","isRTL","formatOutdentRTL","formatOutdent","title","__","describedBy","disabled","onClick","Edit","setAttributes","style","blockProps","useBlockProps","Platform","isNative","innerBlocksProps","useInnerBlocksProps","allowedBlocks","template","templateLock","templateInsertUpdatesSelection","marginVertical","marginHorizontal","renderAppender","__experimentalCaptureToolbars","ordered","type","reversed","start","controls","BlockControls","group","formatListBulletsRTL","formatListBullets","isActive","formatListNumberedRTL","formatListNumbered","default"],"sources":["@wordpress/block-library/src/list/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { ToolbarButton } from '@wordpress/components';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport {\n\tformatListBullets,\n\tformatListBulletsRTL,\n\tformatListNumbered,\n\tformatListNumberedRTL,\n\tformatOutdent,\n\tformatOutdentRTL,\n} from '@wordpress/icons';\nimport { createBlock } from '@wordpress/blocks';\nimport { useCallback, useEffect, Platform } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport OrderedListSettings from './ordered-list-settings';\nimport { migrateToListV2 } from './utils';\nimport TagName from './tag-name';\n\nconst TEMPLATE = [ [ 'core/list-item' ] ];\nconst NATIVE_MARGIN_SPACING = 8;\n\n/**\n * At the moment, deprecations don't handle create blocks from attributes\n * (like when using CPT templates). For this reason, this hook is necessary\n * to avoid breaking templates using the old list block format.\n *\n * @param {Object} attributes Block attributes.\n * @param {string} clientId Block client ID.\n */\nfunction useMigrateOnLoad( attributes, clientId ) {\n\tconst registry = useRegistry();\n\tconst { updateBlockAttributes, replaceInnerBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\t// As soon as the block is loaded, migrate it to the new version.\n\n\t\tif ( ! attributes.values ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst [ newAttributes, newInnerBlocks ] = migrateToListV2( attributes );\n\n\t\tdeprecated( 'Value attribute on the list block', {\n\t\t\tsince: '6.0',\n\t\t\tversion: '6.5',\n\t\t\talternative: 'inner blocks',\n\t\t} );\n\n\t\tregistry.batch( () => {\n\t\t\tupdateBlockAttributes( clientId, newAttributes );\n\t\t\treplaceInnerBlocks( clientId, newInnerBlocks );\n\t\t} );\n\t}, [ attributes.values ] );\n}\n\nfunction useOutdentList( clientId ) {\n\tconst { canOutdent } = useSelect(\n\t\t( innerSelect ) => {\n\t\t\tconst { getBlockRootClientId, getBlock } =\n\t\t\t\tinnerSelect( blockEditorStore );\n\t\t\tconst parentId = getBlockRootClientId( clientId );\n\t\t\treturn {\n\t\t\t\tcanOutdent:\n\t\t\t\t\t!! parentId &&\n\t\t\t\t\tgetBlock( parentId ).name === 'core/list-item',\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { replaceBlocks, selectionChange } = useDispatch( blockEditorStore );\n\tconst { getBlockRootClientId, getBlockAttributes, getBlock } =\n\t\tuseSelect( blockEditorStore );\n\n\treturn [\n\t\tcanOutdent,\n\t\tuseCallback( () => {\n\t\t\tconst parentBlockId = getBlockRootClientId( clientId );\n\t\t\tconst parentBlockAttributes = getBlockAttributes( parentBlockId );\n\t\t\t// Create a new parent block without the inner blocks.\n\t\t\tconst newParentBlock = createBlock(\n\t\t\t\t'core/list-item',\n\t\t\t\tparentBlockAttributes\n\t\t\t);\n\t\t\tconst { innerBlocks } = getBlock( clientId );\n\t\t\t// Replace the parent block with a new parent block without inner blocks,\n\t\t\t// and make the inner blocks siblings of the parent.\n\t\t\treplaceBlocks(\n\t\t\t\t[ parentBlockId ],\n\t\t\t\t[ newParentBlock, ...innerBlocks ]\n\t\t\t);\n\t\t\t// Select the last child of the list being outdent.\n\t\t\tselectionChange( innerBlocks[ innerBlocks.length - 1 ].clientId );\n\t\t}, [ clientId ] ),\n\t];\n}\n\nfunction IndentUI( { clientId } ) {\n\tconst [ canOutdent, outdentList ] = useOutdentList( clientId );\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatOutdentRTL : formatOutdent }\n\t\t\t\ttitle={ __( 'Outdent' ) }\n\t\t\t\tdescribedBy={ __( 'Outdent list item' ) }\n\t\t\t\tdisabled={ ! canOutdent }\n\t\t\t\tonClick={ outdentList }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default function Edit( { attributes, setAttributes, clientId, style } ) {\n\tconst blockProps = useBlockProps( {\n\t\t...( Platform.isNative && { style } ),\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: [ 'core/list-item' ],\n\t\ttemplate: TEMPLATE,\n\t\ttemplateLock: false,\n\t\ttemplateInsertUpdatesSelection: true,\n\t\t...( Platform.isNative && {\n\t\t\tmarginVertical: NATIVE_MARGIN_SPACING,\n\t\t\tmarginHorizontal: NATIVE_MARGIN_SPACING,\n\t\t\trenderAppender: false,\n\t\t} ),\n\t\t__experimentalCaptureToolbars: true,\n\t} );\n\tuseMigrateOnLoad( attributes, clientId );\n\tconst { ordered, type, reversed, start } = attributes;\n\n\tconst controls = (\n\t\t<BlockControls group=\"block\">\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatListBulletsRTL : formatListBullets }\n\t\t\t\ttitle={ __( 'Unordered' ) }\n\t\t\t\tdescribedBy={ __( 'Convert to unordered list' ) }\n\t\t\t\tisActive={ ordered === false }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetAttributes( { ordered: false } );\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatListNumberedRTL : formatListNumbered }\n\t\t\t\ttitle={ __( 'Ordered' ) }\n\t\t\t\tdescribedBy={ __( 'Convert to ordered list' ) }\n\t\t\t\tisActive={ ordered === true }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetAttributes( { ordered: true } );\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<IndentUI clientId={ clientId } />\n\t\t</BlockControls>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<TagName\n\t\t\t\tordered={ ordered }\n\t\t\t\treversed={ reversed }\n\t\t\t\tstart={ start }\n\t\t\t\ttype={ type }\n\t\t\t\t{ ...innerBlocksProps }\n\t\t\t/>\n\t\t\t{ controls }\n\t\t\t{ ordered && (\n\t\t\t\t<OrderedListSettings\n\t\t\t\t\t{ ...{\n\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\treversed,\n\t\t\t\t\t\tstart,\n\t\t\t\t\t\ttype,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAqBA,IAAAA,QAAA,GAAAC,OAAA;AAlBA,IAAAC,YAAA,GAAAD,OAAA;AAMA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAQA,IAAAM,OAAA,GAAAN,OAAA;AAEA,IAAAO,WAAA,GAAAC,sBAAA,CAAAR,OAAA;AAKA,IAAAS,oBAAA,GAAAD,sBAAA,CAAAR,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,QAAA,GAAAH,sBAAA,CAAAR,OAAA;AA7BA;AACA;AACA;;AAsBA;AACA;AACA;;AAKA,MAAMY,QAAQ,GAAG,CAAE,CAAE,gBAAgB,CAAE,CAAE;AACzC,MAAMC,qBAAqB,GAAG,CAAC;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,gBAAgBA,C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AAG,IAAAC,WAAK,EAAC,CAAC,GAAGmC,4BAAqB,GAAGC,yBAAoB;IAC7DjC,KAAK,EAAG,IAAAC,QAAE,EAAE,SAAU,CAAG;IACzBC,WAAW,EAAG,IAAAD,QAAE,EAAE,yBAA0B,CAAG;IAC/C8B,QAAQ,EAAGT,OAAO,KAAK,IAAM;IAC7BlB,OAAO,EAAGA,CAAA,KAAM;MACfE,aAAa,CAAE;QAAEgB,OAAO,EAAE;MAAK,CAAE,CAAC;IACnC;EAAG,CACH,CAAC,EACF,IAAAnF,QAAA,CAAAsD,aAAA,EAACF,QAAQ;IAACnC,QAAQ,EAAGA;EAAU,CAAE,CACnB,CACf;EAED,OACC,IAAAjB,QAAA,CAAAsD,aAAA,EAAAtD,QAAA,CAAAuD,QAAA,QACC,IAAAvD,QAAA,CAAAsD,aAAA,EAAC1C,QAAA,CAAAmF,OAAO;IACPZ,OAAO,EAAGA,OAAS;IACnBE,QAAQ,EAAGA,QAAU;IACrBC,KAAK,EAAGA,KAAO;IACfF,IAAI,EAAGA,IAAM;IAAA,GACRX;EAAgB,CACrB,CAAC,EACAc,QAAQ,EACRJ,OAAO,IACR,IAAAnF,QAAA,CAAAsD,aAAA,EAAC5C,oBAAA,CAAAqF,OAAmB;IAElB5B,aAAa;IACbkB,QAAQ;IACRC,KAAK;IACLF;EAAI,CAEL,CAED,CAAC;AAEL"}
|
|
@@ -81,7 +81,8 @@ function NavigationInnerBlocks({
|
|
|
81
81
|
renderAppender: isSelected || isImmediateParentOfSelectedBlock && !selectedBlockHasChildren ||
|
|
82
82
|
// Show the appender while dragging to allow inserting element between item and the appender.
|
|
83
83
|
parentOrChildHasSelection ? _blockEditor.InnerBlocks.ButtonBlockAppender : false,
|
|
84
|
-
placeholder: showPlaceholder ? placeholder : undefined
|
|
84
|
+
placeholder: showPlaceholder ? placeholder : undefined,
|
|
85
|
+
__experimentalCaptureToolbars: true
|
|
85
86
|
});
|
|
86
87
|
return (0, _element.createElement)("div", {
|
|
87
88
|
...innerBlocksProps
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_coreData","_blockEditor","_data","_placeholderPreview","_interopRequireDefault","_constants","NavigationInnerBlocks","clientId","hasCustomPlaceholder","orientation","templateLock","isImmediateParentOfSelectedBlock","selectedBlockHasChildren","isSelected","useSelect","select","getBlockCount","hasSelectedInnerBlock","getSelectedBlockClientId","blockEditorStore","selectedBlockId","blocks","onInput","onChange","useEntityBlockEditor","shouldDirectInsert","useMemo","every","name","parentOrChildHasSelection","placeholder","createElement","default","hasMenuItems","length","showPlaceholder","innerBlocksProps","useInnerBlocksProps","className","value","allowedBlocks","ALLOWED_BLOCKS","prioritizedInserterBlocks","PRIORITIZED_INSERTER_BLOCKS","defaultBlock","DEFAULT_BLOCK","directInsert","renderAppender","InnerBlocks","ButtonBlockAppender","undefined"],"sources":["@wordpress/block-library/src/navigation/edit/inner-blocks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityBlockEditor } from '@wordpress/core-data';\nimport {\n\tuseInnerBlocksProps,\n\tInnerBlocks,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport PlaceholderPreview from './placeholder/placeholder-preview';\nimport {\n\tDEFAULT_BLOCK,\n\tALLOWED_BLOCKS,\n\tPRIORITIZED_INSERTER_BLOCKS,\n} from '../constants';\n\nexport default function NavigationInnerBlocks( {\n\tclientId,\n\thasCustomPlaceholder,\n\torientation,\n\ttemplateLock,\n} ) {\n\tconst {\n\t\tisImmediateParentOfSelectedBlock,\n\t\tselectedBlockHasChildren,\n\t\tisSelected,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst selectedBlockId = getSelectedBlockClientId();\n\n\t\t\treturn {\n\t\t\t\tisImmediateParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\tselectedBlockHasChildren: !! getBlockCount( selectedBlockId ),\n\n\t\t\t\t// This prop is already available but computing it here ensures it's\n\t\t\t\t// fresh compared to isImmediateParentOfSelectedBlock.\n\t\t\t\tisSelected: selectedBlockId === clientId,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\t'wp_navigation'\n\t);\n\n\tconst shouldDirectInsert = useMemo(\n\t\t() =>\n\t\t\tblocks.every(\n\t\t\t\t( { name } ) =>\n\t\t\t\t\tname === 'core/navigation-link' ||\n\t\t\t\t\tname === 'core/navigation-submenu' ||\n\t\t\t\t\tname === 'core/page-list'\n\t\t\t),\n\t\t[ blocks ]\n\t);\n\n\t// When the block is selected itself or has a top level item selected that\n\t// doesn't itself have children, show the standard appender. Else show no\n\t// appender.\n\tconst parentOrChildHasSelection =\n\t\tisSelected ||\n\t\t( isImmediateParentOfSelectedBlock && ! selectedBlockHasChildren );\n\n\tconst placeholder = useMemo( () => <PlaceholderPreview />, [] );\n\n\tconst hasMenuItems = !! blocks?.length;\n\n\t// If there is a `ref` attribute pointing to a `wp_navigation` but\n\t// that menu has no **items** (i.e. empty) then show a placeholder.\n\t// The block must also be selected else the placeholder will display\n\t// alongside the appender.\n\tconst showPlaceholder =\n\t\t! hasCustomPlaceholder && ! hasMenuItems && ! isSelected;\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tclassName: 'wp-block-navigation__container',\n\t\t},\n\t\t{\n\t\t\tvalue: blocks,\n\t\t\tonInput,\n\t\t\tonChange,\n\t\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\t\tprioritizedInserterBlocks: PRIORITIZED_INSERTER_BLOCKS,\n\t\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\t\tdirectInsert: shouldDirectInsert,\n\t\t\torientation,\n\t\t\ttemplateLock,\n\n\t\t\t// As an exception to other blocks which feature nesting, show\n\t\t\t// the block appender even when a child block is selected.\n\t\t\t// This should be a temporary fix, to be replaced by improvements to\n\t\t\t// the sibling inserter.\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/37572.\n\t\t\trenderAppender:\n\t\t\t\tisSelected ||\n\t\t\t\t( isImmediateParentOfSelectedBlock &&\n\t\t\t\t\t! selectedBlockHasChildren ) ||\n\t\t\t\t// Show the appender while dragging to allow inserting element between item and the appender.\n\t\t\t\tparentOrChildHasSelection\n\t\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t\t: false,\n\t\t\tplaceholder: showPlaceholder ? placeholder : undefined,\n\t\t}\n\t);\n\n\treturn <div { ...innerBlocksProps } />;\n}\n"],"mappings":";;;;;;;AAUA,IAAAA,QAAA,GAAAC,OAAA;AAPA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AAMA,IAAAI,mBAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAhBA;AACA;AACA;;AAUA;AACA;AACA;;AAQe,SAASO,qBAAqBA,CAAE;EAC9CC,QAAQ;EACRC,oBAAoB;EACpBC,WAAW;EACXC;AACD,CAAC,EAAG;EACH,MAAM;IACLC,gCAAgC;IAChCC,wBAAwB;IACxBC;EACD,CAAC,GAAG,IAAAC,eAAS,EACVC,MAAM,IAAM;IACb,MAAM;MACLC,aAAa;MACbC,qBAAqB;MACrBC;IACD,CAAC,GAAGH,MAAM,CAAEI,kBAAiB,CAAC;IAC9B,MAAMC,eAAe,GAAGF,wBAAwB,CAAC,CAAC;IAElD,OAAO;MACNP,gCAAgC,EAAEM,qBAAqB,CACtDV,QAAQ,EACR,KACD,CAAC;MACDK,wBAAwB,EAAE,CAAC,CA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iB,yBAAyB,GACtBmB,wBAAW,CAACC,mBAAmB,GAC/B,KAAK;IACTnB,WAAW,EAAEK,eAAe,GAAGL,WAAW,GAAGoB;
|
|
1
|
+
{"version":3,"names":["_element","require","_coreData","_blockEditor","_data","_placeholderPreview","_interopRequireDefault","_constants","NavigationInnerBlocks","clientId","hasCustomPlaceholder","orientation","templateLock","isImmediateParentOfSelectedBlock","selectedBlockHasChildren","isSelected","useSelect","select","getBlockCount","hasSelectedInnerBlock","getSelectedBlockClientId","blockEditorStore","selectedBlockId","blocks","onInput","onChange","useEntityBlockEditor","shouldDirectInsert","useMemo","every","name","parentOrChildHasSelection","placeholder","createElement","default","hasMenuItems","length","showPlaceholder","innerBlocksProps","useInnerBlocksProps","className","value","allowedBlocks","ALLOWED_BLOCKS","prioritizedInserterBlocks","PRIORITIZED_INSERTER_BLOCKS","defaultBlock","DEFAULT_BLOCK","directInsert","renderAppender","InnerBlocks","ButtonBlockAppender","undefined","__experimentalCaptureToolbars"],"sources":["@wordpress/block-library/src/navigation/edit/inner-blocks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityBlockEditor } from '@wordpress/core-data';\nimport {\n\tuseInnerBlocksProps,\n\tInnerBlocks,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport PlaceholderPreview from './placeholder/placeholder-preview';\nimport {\n\tDEFAULT_BLOCK,\n\tALLOWED_BLOCKS,\n\tPRIORITIZED_INSERTER_BLOCKS,\n} from '../constants';\n\nexport default function NavigationInnerBlocks( {\n\tclientId,\n\thasCustomPlaceholder,\n\torientation,\n\ttemplateLock,\n} ) {\n\tconst {\n\t\tisImmediateParentOfSelectedBlock,\n\t\tselectedBlockHasChildren,\n\t\tisSelected,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst selectedBlockId = getSelectedBlockClientId();\n\n\t\t\treturn {\n\t\t\t\tisImmediateParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\tselectedBlockHasChildren: !! getBlockCount( selectedBlockId ),\n\n\t\t\t\t// This prop is already available but computing it here ensures it's\n\t\t\t\t// fresh compared to isImmediateParentOfSelectedBlock.\n\t\t\t\tisSelected: selectedBlockId === clientId,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\t'wp_navigation'\n\t);\n\n\tconst shouldDirectInsert = useMemo(\n\t\t() =>\n\t\t\tblocks.every(\n\t\t\t\t( { name } ) =>\n\t\t\t\t\tname === 'core/navigation-link' ||\n\t\t\t\t\tname === 'core/navigation-submenu' ||\n\t\t\t\t\tname === 'core/page-list'\n\t\t\t),\n\t\t[ blocks ]\n\t);\n\n\t// When the block is selected itself or has a top level item selected that\n\t// doesn't itself have children, show the standard appender. Else show no\n\t// appender.\n\tconst parentOrChildHasSelection =\n\t\tisSelected ||\n\t\t( isImmediateParentOfSelectedBlock && ! selectedBlockHasChildren );\n\n\tconst placeholder = useMemo( () => <PlaceholderPreview />, [] );\n\n\tconst hasMenuItems = !! blocks?.length;\n\n\t// If there is a `ref` attribute pointing to a `wp_navigation` but\n\t// that menu has no **items** (i.e. empty) then show a placeholder.\n\t// The block must also be selected else the placeholder will display\n\t// alongside the appender.\n\tconst showPlaceholder =\n\t\t! hasCustomPlaceholder && ! hasMenuItems && ! isSelected;\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tclassName: 'wp-block-navigation__container',\n\t\t},\n\t\t{\n\t\t\tvalue: blocks,\n\t\t\tonInput,\n\t\t\tonChange,\n\t\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\t\tprioritizedInserterBlocks: PRIORITIZED_INSERTER_BLOCKS,\n\t\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\t\tdirectInsert: shouldDirectInsert,\n\t\t\torientation,\n\t\t\ttemplateLock,\n\n\t\t\t// As an exception to other blocks which feature nesting, show\n\t\t\t// the block appender even when a child block is selected.\n\t\t\t// This should be a temporary fix, to be replaced by improvements to\n\t\t\t// the sibling inserter.\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/37572.\n\t\t\trenderAppender:\n\t\t\t\tisSelected ||\n\t\t\t\t( isImmediateParentOfSelectedBlock &&\n\t\t\t\t\t! selectedBlockHasChildren ) ||\n\t\t\t\t// Show the appender while dragging to allow inserting element between item and the appender.\n\t\t\t\tparentOrChildHasSelection\n\t\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t\t: false,\n\t\t\tplaceholder: showPlaceholder ? placeholder : undefined,\n\t\t\t__experimentalCaptureToolbars: true,\n\t\t}\n\t);\n\n\treturn <div { ...innerBlocksProps } />;\n}\n"],"mappings":";;;;;;;AAUA,IAAAA,QAAA,GAAAC,OAAA;AAPA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AAMA,IAAAI,mBAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAhBA;AACA;AACA;;AAUA;AACA;AACA;;AAQe,SAASO,qBAAqBA,CAAE;EAC9CC,QAAQ;EACRC,oBAAoB;EACpBC,WAAW;EACXC;AACD,CAAC,EAAG;EACH,MAAM;IACLC,gCAAgC;IAChCC,wBAAwB;IACxBC;EACD,CAAC,GAAG,IAAAC,eAAS,EACVC,MAAM,IAAM;IACb,MAAM;MACLC,aAAa;MACbC,qBAAqB;MACrBC;IACD,CAAC,GAAGH,MAAM,CAAEI,kBAAiB,CAAC;IAC9B,MAAMC,eAAe,GAAGF,wBAAwB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AW;IACXC,YAAY;IAEZ;IACA;IACA;IACA;IACA;IACAqC,cAAc,EACblC,UAAU,IACRF,gCAAgC,IACjC,CAAEC,wBAA0B;IAC7B;IACAiB,yBAAyB,GACtBmB,wBAAW,CAACC,mBAAmB,GAC/B,KAAK;IACTnB,WAAW,EAAEK,eAAe,GAAGL,WAAW,GAAGoB,SAAS;IACtDC,6BAA6B,EAAE;EAChC,CACD,CAAC;EAED,OAAO,IAAArD,QAAA,CAAAiC,aAAA;IAAA,GAAUK;EAAgB,CAAI,CAAC;AACvC"}
|
package/build/quote/edit.js
CHANGED
|
@@ -92,7 +92,8 @@ function QuoteEdit({
|
|
|
92
92
|
});
|
|
93
93
|
const innerBlocksProps = (0, _blockEditor.useInnerBlocksProps)(blockProps, {
|
|
94
94
|
template: TEMPLATE,
|
|
95
|
-
templateInsertUpdatesSelection: true
|
|
95
|
+
templateInsertUpdatesSelection: true,
|
|
96
|
+
__experimentalCaptureToolbars: true
|
|
96
97
|
});
|
|
97
98
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_blockEditor.BlockControls, {
|
|
98
99
|
group: "block"
|
package/build/quote/edit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_i18n","_blockEditor","_components","_data","_blocks","_deprecated","_deprecated2","isWebPlatform","Platform","OS","TEMPLATE","useMigrateOnLoad","attributes","clientId","registry","useRegistry","updateBlockAttributes","replaceInnerBlocks","useDispatch","blockEditorStore","useEffect","value","newAttributes","newInnerBlocks","migrateToQuoteV2","deprecated","since","version","alternative","batch","QuoteEdit","setAttributes","insertBlocksAfter","className","style","align","citation","hasSelection","useSelect","select","isBlockSelected","hasSelectedInnerBlock","blockProps","useBlockProps","classNames","innerBlocksProps","useInnerBlocksProps","template","templateInsertUpdatesSelection","createElement","Fragment","BlockControls","group","AlignmentControl","onChange","nextAlign","BlockQuotation","children","RichText","isEmpty","identifier","tagName","undefined","display","nextCitation","__unstableMobileNoFocusOnMount","__","placeholder","__unstableOnSplitAtEnd","createBlock","getDefaultBlockName","textAlign"],"sources":["@wordpress/block-library/src/quote/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tRichText,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { BlockQuotation } from '@wordpress/components';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\nimport { Platform, useEffect } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { migrateToQuoteV2 } from './deprecated';\n\nconst isWebPlatform = Platform.OS === 'web';\n\nconst TEMPLATE = [ [ 'core/paragraph', {} ] ];\n\n/**\n * At the moment, deprecations don't handle create blocks from attributes\n * (like when using CPT templates). For this reason, this hook is necessary\n * to avoid breaking templates using the old quote block format.\n *\n * @param {Object} attributes Block attributes.\n * @param {string} clientId Block client ID.\n */\nconst useMigrateOnLoad = ( attributes, clientId ) => {\n\tconst registry = useRegistry();\n\tconst { updateBlockAttributes, replaceInnerBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\tuseEffect( () => {\n\t\t// As soon as the block is loaded, migrate it to the new version.\n\n\t\tif ( ! attributes.value ) {\n\t\t\t// No need to migrate if it doesn't have the value attribute.\n\t\t\treturn;\n\t\t}\n\n\t\tconst [ newAttributes, newInnerBlocks ] =\n\t\t\tmigrateToQuoteV2( attributes );\n\n\t\tdeprecated( 'Value attribute on the quote block', {\n\t\t\tsince: '6.0',\n\t\t\tversion: '6.5',\n\t\t\talternative: 'inner blocks',\n\t\t} );\n\n\t\tregistry.batch( () => {\n\t\t\tupdateBlockAttributes( clientId, newAttributes );\n\t\t\treplaceInnerBlocks( clientId, newInnerBlocks );\n\t\t} );\n\t}, [ attributes.value ] );\n};\n\nexport default function QuoteEdit( {\n\tattributes,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tclientId,\n\tclassName,\n\tstyle,\n} ) {\n\tconst { align, citation } = attributes;\n\n\tuseMigrateOnLoad( attributes, clientId );\n\n\tconst hasSelection = useSelect( ( select ) => {\n\t\tconst { isBlockSelected, hasSelectedInnerBlock } =\n\t\t\tselect( blockEditorStore );\n\t\treturn hasSelectedInnerBlock( clientId ) || isBlockSelected( clientId );\n\t}, [] );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classNames( className, {\n\t\t\t[ `has-text-align-${ align }` ]: align,\n\t\t} ),\n\t\t...( ! isWebPlatform && { style } ),\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t\ttemplateInsertUpdatesSelection: true,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ align }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { align: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<BlockQuotation { ...innerBlocksProps }>\n\t\t\t\t{ innerBlocksProps.children }\n\t\t\t\t{ ( ! RichText.isEmpty( citation ) || hasSelection ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"citation\"\n\t\t\t\t\t\ttagName={ isWebPlatform ? 'cite' : undefined }\n\t\t\t\t\t\tstyle={ { display: 'block' } }\n\t\t\t\t\t\tvalue={ citation }\n\t\t\t\t\t\tonChange={ ( nextCitation ) => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tcitation: nextCitation,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t__unstableMobileNoFocusOnMount\n\t\t\t\t\t\taria-label={ __( 'Quote citation' ) }\n\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t// translators: placeholder text used for the\n\t\t\t\t\t\t\t// citation\n\t\t\t\t\t\t\t__( 'Add citation' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclassName=\"wp-block-quote__citation\"\n\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{ ...( ! isWebPlatform ? { textAlign: align } : {} ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockQuotation>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAoBA,IAAAA,QAAA,GAAAC,OAAA;AAjBA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAQA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAEA,IAAAQ,WAAA,GAAAN,sBAAA,CAAAF,OAAA;AAKA,IAAAS,YAAA,GAAAT,OAAA;AA1BA;AACA;AACA;;AAGA;AACA;AACA;;AAgBA;AACA;AACA;;AAGA,MAAMU,aAAa,GAAGC,iBAAQ,CAACC,EAAE,KAAK,KAAK;AAE3C,MAAMC,QAAQ,GAAG,CAAE,CAAE,gBAAgB,EAAE,CAAC,CAAC,CAAE,CAAE;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAGA,CAAEC,UAAU,EAAEC,QAAQ,KAAM;EACpD,MAAMC,QAAQ,GAAG,IAAAC,iBAAW,EAAC,CAAC;EAC9B,MAAM;IAAEC,qBAAqB;IAAEC;EAAmB,CAAC,GAClD,IAAAC,iBAAW,EAAEC,kBAAiB,C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,CAAE,CAAC;EACH,MAAMW,gBAAgB,GAAG,IAAAC,gCAAmB,EAAEJ,UAAU,EAAE;IACzDK,QAAQ,EAAErC,QAAQ;IAClBsC,8BAA8B,EAAE;
|
|
1
|
+
{"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_i18n","_blockEditor","_components","_data","_blocks","_deprecated","_deprecated2","isWebPlatform","Platform","OS","TEMPLATE","useMigrateOnLoad","attributes","clientId","registry","useRegistry","updateBlockAttributes","replaceInnerBlocks","useDispatch","blockEditorStore","useEffect","value","newAttributes","newInnerBlocks","migrateToQuoteV2","deprecated","since","version","alternative","batch","QuoteEdit","setAttributes","insertBlocksAfter","className","style","align","citation","hasSelection","useSelect","select","isBlockSelected","hasSelectedInnerBlock","blockProps","useBlockProps","classNames","innerBlocksProps","useInnerBlocksProps","template","templateInsertUpdatesSelection","__experimentalCaptureToolbars","createElement","Fragment","BlockControls","group","AlignmentControl","onChange","nextAlign","BlockQuotation","children","RichText","isEmpty","identifier","tagName","undefined","display","nextCitation","__unstableMobileNoFocusOnMount","__","placeholder","__unstableOnSplitAtEnd","createBlock","getDefaultBlockName","textAlign"],"sources":["@wordpress/block-library/src/quote/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tRichText,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { BlockQuotation } from '@wordpress/components';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\nimport { Platform, useEffect } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { migrateToQuoteV2 } from './deprecated';\n\nconst isWebPlatform = Platform.OS === 'web';\n\nconst TEMPLATE = [ [ 'core/paragraph', {} ] ];\n\n/**\n * At the moment, deprecations don't handle create blocks from attributes\n * (like when using CPT templates). For this reason, this hook is necessary\n * to avoid breaking templates using the old quote block format.\n *\n * @param {Object} attributes Block attributes.\n * @param {string} clientId Block client ID.\n */\nconst useMigrateOnLoad = ( attributes, clientId ) => {\n\tconst registry = useRegistry();\n\tconst { updateBlockAttributes, replaceInnerBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\tuseEffect( () => {\n\t\t// As soon as the block is loaded, migrate it to the new version.\n\n\t\tif ( ! attributes.value ) {\n\t\t\t// No need to migrate if it doesn't have the value attribute.\n\t\t\treturn;\n\t\t}\n\n\t\tconst [ newAttributes, newInnerBlocks ] =\n\t\t\tmigrateToQuoteV2( attributes );\n\n\t\tdeprecated( 'Value attribute on the quote block', {\n\t\t\tsince: '6.0',\n\t\t\tversion: '6.5',\n\t\t\talternative: 'inner blocks',\n\t\t} );\n\n\t\tregistry.batch( () => {\n\t\t\tupdateBlockAttributes( clientId, newAttributes );\n\t\t\treplaceInnerBlocks( clientId, newInnerBlocks );\n\t\t} );\n\t}, [ attributes.value ] );\n};\n\nexport default function QuoteEdit( {\n\tattributes,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tclientId,\n\tclassName,\n\tstyle,\n} ) {\n\tconst { align, citation } = attributes;\n\n\tuseMigrateOnLoad( attributes, clientId );\n\n\tconst hasSelection = useSelect( ( select ) => {\n\t\tconst { isBlockSelected, hasSelectedInnerBlock } =\n\t\t\tselect( blockEditorStore );\n\t\treturn hasSelectedInnerBlock( clientId ) || isBlockSelected( clientId );\n\t}, [] );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classNames( className, {\n\t\t\t[ `has-text-align-${ align }` ]: align,\n\t\t} ),\n\t\t...( ! isWebPlatform && { style } ),\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t\ttemplateInsertUpdatesSelection: true,\n\t\t__experimentalCaptureToolbars: true,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ align }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { align: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<BlockQuotation { ...innerBlocksProps }>\n\t\t\t\t{ innerBlocksProps.children }\n\t\t\t\t{ ( ! RichText.isEmpty( citation ) || hasSelection ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"citation\"\n\t\t\t\t\t\ttagName={ isWebPlatform ? 'cite' : undefined }\n\t\t\t\t\t\tstyle={ { display: 'block' } }\n\t\t\t\t\t\tvalue={ citation }\n\t\t\t\t\t\tonChange={ ( nextCitation ) => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tcitation: nextCitation,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t__unstableMobileNoFocusOnMount\n\t\t\t\t\t\taria-label={ __( 'Quote citation' ) }\n\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t// translators: placeholder text used for the\n\t\t\t\t\t\t\t// citation\n\t\t\t\t\t\t\t__( 'Add citation' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclassName=\"wp-block-quote__citation\"\n\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{ ...( ! isWebPlatform ? { textAlign: align } : {} ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockQuotation>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAoBA,IAAAA,QAAA,GAAAC,OAAA;AAjBA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,K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AAA,EAAChD,WAAA,CAAAuD,cAAc;IAAA,GAAMZ;EAAgB,GAClCA,gBAAgB,CAACa,QAAQ,EACzB,CAAE,CAAEC,qBAAQ,CAACC,OAAO,CAAExB,QAAS,CAAC,IAAIC,YAAY,KACjD,IAAAzC,QAAA,CAAAsD,aAAA,EAACjD,YAAA,CAAA0D,QAAQ;IACRE,UAAU,EAAC,UAAU;IACrBC,OAAO,EAAGvD,aAAa,GAAG,MAAM,GAAGwD,SAAW;IAC9C7B,KAAK,EAAG;MAAE8B,OAAO,EAAE;IAAQ,CAAG;IAC9B3C,KAAK,EAAGe,QAAU;IAClBmB,QAAQ,EAAKU,YAAY,IAAM;MAC9BlC,aAAa,CAAE;QACdK,QAAQ,EAAE6B;MACX,CAAE,CAAC;IACJ,CAAG;IACHC,8BAA8B;IAC9B,cAAa,IAAAC,QAAE,EAAE,gBAAiB,CAAG;IACrCC,WAAW;IACV;IACA;IACA,IAAAD,QAAE,EAAE,cAAe,CACnB;IACDlC,SAAS,EAAC,0BAA0B;IACpCoC,sBAAsB,EAAGA,CAAA,KACxBrC,iBAAiB,CAChB,IAAAsC,mBAAW,EAAE,IAAAC,2BAAmB,EAAC,CAAE,CACpC,CACA;IAAA,IACM,CAAEhE,aAAa,GAAG;MAAEiE,SAAS,EAAErC;IAAM,CAAC,GAAG,CAAC,CAAC;EAAA,CAClD,CAEa,CACf,CAAC;AAEL"}
|
|
@@ -28,8 +28,7 @@ var _hooks = require("./utils/hooks");
|
|
|
28
28
|
function TemplatePartEdit({
|
|
29
29
|
attributes,
|
|
30
30
|
setAttributes,
|
|
31
|
-
clientId
|
|
32
|
-
isSelected
|
|
31
|
+
clientId
|
|
33
32
|
}) {
|
|
34
33
|
const {
|
|
35
34
|
slug,
|
|
@@ -78,10 +77,7 @@ function TemplatePartEdit({
|
|
|
78
77
|
const isPlaceholder = !slug;
|
|
79
78
|
const isEntityAvailable = !isPlaceholder && !isMissing && isResolved;
|
|
80
79
|
const TagName = tagName || areaObject.tagName;
|
|
81
|
-
|
|
82
|
-
// The `isSelected` check ensures the `BlockSettingsMenuControls` fill
|
|
83
|
-
// doesn't render multiple times. The block controls has similar internal check.
|
|
84
|
-
const canReplace = isSelected && isEntityAvailable && hasReplacements && (area === 'header' || area === 'footer');
|
|
80
|
+
const canReplace = isEntityAvailable && hasReplacements && (area === 'header' || area === 'footer');
|
|
85
81
|
|
|
86
82
|
// We don't want to render a missing state if we have any inner blocks.
|
|
87
83
|
// A new template part is automatically created if we have any inner blocks but no entity.
|
|
@@ -113,16 +109,27 @@ function TemplatePartEdit({
|
|
|
113
109
|
clientId: clientId,
|
|
114
110
|
setAttributes: setAttributes,
|
|
115
111
|
onOpenSelectionModal: () => setIsTemplatePartSelectionOpen(true)
|
|
116
|
-
})), canReplace && (0, _element.createElement)(_blockEditor.BlockSettingsMenuControls, null, (
|
|
117
|
-
|
|
118
|
-
|
|
112
|
+
})), canReplace && (0, _element.createElement)(_blockEditor.BlockSettingsMenuControls, null, ({
|
|
113
|
+
selectedClientIds
|
|
114
|
+
}) => {
|
|
115
|
+
// Only enable for single selection that matches the current block.
|
|
116
|
+
// Ensures menu item doesn't render multiple times.
|
|
117
|
+
if (!(selectedClientIds.length === 1 && clientId === selectedClientIds[0])) {
|
|
118
|
+
return null;
|
|
119
119
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
return (0, _element.createElement)(_components.MenuItem, {
|
|
121
|
+
onClick: () => {
|
|
122
|
+
setIsTemplatePartSelectionOpen(true);
|
|
123
|
+
},
|
|
124
|
+
"aria-expanded": isTemplatePartSelectionOpen,
|
|
125
|
+
"aria-haspopup": "dialog"
|
|
126
|
+
}, (0, _element.createInterpolateElement)((0, _i18n.__)('Replace <BlockTitle />'), {
|
|
127
|
+
BlockTitle: (0, _element.createElement)(_blockEditor.BlockTitle, {
|
|
128
|
+
clientId: clientId,
|
|
129
|
+
maximumLength: 25
|
|
130
|
+
})
|
|
131
|
+
}));
|
|
132
|
+
}), isEntityAvailable && (0, _element.createElement)(_innerBlocks.default, {
|
|
126
133
|
tagName: TagName,
|
|
127
134
|
blockProps: blockProps,
|
|
128
135
|
postId: templatePartId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_data","_blockEditor","_components","_i18n","_coreData","_placeholder","_interopRequireDefault","_selectionModal","_advancedControls","_innerBlocks","_createTemplatePartId","_hooks","TemplatePartEdit","attributes","setAttributes","clientId","isSelected","slug","theme","tagName","layout","templatePartId","createTemplatePartId","hasAlreadyRendered","useHasRecursion","isTemplatePartSelectionOpen","setIsTemplatePartSelectionOpen","useState","isResolved","innerBlocks","isMissing","area","useSelect","select","getEditedEntityRecord","hasFinishedResolution","coreStore","getBlocks","blockEditorStore","getEntityArgs","entityRecord","_area","hasResolvedEntity","Object","keys","length","templateParts","useAlternativeTemplateParts","blockPatterns","useAlternativeBlockPatterns","hasReplacements","areaObject","useTemplatePartArea","blockProps","useBlockProps","isPlaceholder","isEntityAvailable","TagName","canReplace","createElement","Warning","sprintf","__","Fragment","__experimentalRecursionProvider","uniqueId","TemplatePartAdvancedControls","defaultWrapper","hasInnerBlocks","default","onOpenSelectionModal","BlockSettingsMenuControls","MenuItem","onClick","createInterpolateElement","BlockTitle","maximumLength","postId","Spinner","Modal","overlayClassName","title","label","toLowerCase","onRequestClose","isFullScreen","onClose"],"sources":["@wordpress/block-library/src/template-part/edit/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tBlockTitle,\n\tuseBlockProps,\n\tWarning,\n\tstore as blockEditorStore,\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentalUseHasRecursion as useHasRecursion,\n} from '@wordpress/block-editor';\nimport { Spinner, Modal, MenuItem } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, createInterpolateElement } from '@wordpress/element';\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\nexport default function TemplatePartEdit( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tisSelected,\n} ) {\n\tconst { slug, theme, tagName, layout = {} } = attributes;\n\tconst templatePartId = createTemplatePartId( theme, slug );\n\tconst hasAlreadyRendered = useHasRecursion( templatePartId );\n\tconst [ isTemplatePartSelectionOpen, setIsTemplatePartSelectionOpen ] =\n\t\tuseState( false );\n\n\t// Set the postId block attribute if it did not exist,\n\t// but wait until the inner blocks have loaded to allow\n\t// new edits to trigger this.\n\tconst { isResolved, innerBlocks, isMissing, area } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getBlocks } = 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\treturn {\n\t\t\t\tinnerBlocks: getBlocks( clientId ),\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};\n\t\t},\n\t\t[ templatePartId, attributes.area, clientId ]\n\t);\n\tconst { templateParts } = useAlternativeTemplateParts(\n\t\tarea,\n\t\ttemplatePartId\n\t);\n\tconst blockPatterns = useAlternativeBlockPatterns( area, clientId );\n\tconst hasReplacements = !! templateParts.length || !! blockPatterns.length;\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\t// The `isSelected` check ensures the `BlockSettingsMenuControls` fill\n\t// doesn't render multiple times. The block controls has similar internal check.\n\tconst canReplace =\n\t\tisSelected &&\n\t\tisEntityAvailable &&\n\t\thasReplacements &&\n\t\t( area === 'header' || area === 'footer' );\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\tinnerBlocks.length === 0 &&\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<TemplatePartAdvancedControls\n\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\tdefaultWrapper={ areaObject.tagName }\n\t\t\t\t\thasInnerBlocks={ innerBlocks.length > 0 }\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{ canReplace && (\n\t\t\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t\t\t{ () => (\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( true );\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{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t__( 'Replace <BlockTitle />' ),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tBlockTitle: (\n\t\t\t\t\t\t\t\t\t\t\t<BlockTitle\n\t\t\t\t\t\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\t\t\t\t\t\tmaximumLength={ 25 }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t),\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</MenuItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</BlockSettingsMenuControls>\n\t\t\t\t) }\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={ innerBlocks.length > 0 }\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={ true }\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":";;;;;;;AAgBA,IAAAA,QAAA,GAAAC,OAAA;AAbA,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E,aAAc,CAAC,EACnBX,UAAU,CAAC+B,KAAK,CAACC,WAAW,CAAC,CAC9B,CAAG;IACHC,cAAc,EAAGA,CAAA,KAChB1D,8BAA8B,CAAE,KAAM,CACtC;IACD2D,YAAY,EAAG;EAAM,GAErB,IAAAvF,QAAA,CAAA6D,aAAA,EAACpD,eAAA,CAAA8D,OAA0B;IAC1BhD,cAAc,EAAGA,cAAgB;IACjCN,QAAQ,EAAGA,QAAU;IACrBgB,IAAI,EAAGA,IAAM;IACbjB,aAAa,EAAGA,aAAe;IAC/BwE,OAAO,EAAGA,CAAA,KACT5D,8BAA8B,CAAE,KAAM;EACtC,CACD,CACK,CAEP,CAAC;AAEL"}
|
|
1
|
+
{"version":3,"names":["_element","require","_data","_blockEditor","_components","_i18n","_coreData","_placeholder","_interopRequireDefault","_selectionModal","_advancedControls","_innerBlocks","_createTemplatePartId","_hooks","TemplatePartEdit","attributes","setAttributes","clientId","slug","theme","tagName","layout","templatePartId","createTemplatePartId","hasAlreadyRendered","useHasRecursion","isTemplatePartSelectionOpen","setIsTemplatePartSelectionOpen","useState","isResolved","innerBlocks","isMissing","area","useSelect","select","getEditedEntityRecord","hasFinishedResolution","coreStore","getBlocks","blockEditorStore","getEntityArgs","entityRecord","_area","hasResolvedEntity","Object","keys","length","templateParts","useAlternativeTemplateParts","blockPatterns","useAlternativeBlockPatterns","hasReplacements","areaObject","useTemplatePartArea","blockProps","useBlockProps","isPlaceholder","isEntityAvailable","TagName","canReplace","createElement","Warning","sprintf","__","Fragment","__experimentalRecursionProvider","uniqueId","TemplatePartAdvancedControls","defaultWrapper","hasInnerBlocks","default","onOpenSelectionModal","BlockSettingsMenuControls","selectedClientIds","MenuItem","onClick","createInterpolateElement","BlockTitle","maximumLength","postId","Spinner","Modal","overlayClassName","title","label","toLowerCase","onRequestClose","isFullScreen","onClose"],"sources":["@wordpress/block-library/src/template-part/edit/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tBlockTitle,\n\tuseBlockProps,\n\tWarning,\n\tstore as blockEditorStore,\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentalUseHasRecursion as useHasRecursion,\n} from '@wordpress/block-editor';\nimport { Spinner, Modal, MenuItem } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, createInterpolateElement } from '@wordpress/element';\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\nexport default function TemplatePartEdit( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n} ) {\n\tconst { slug, theme, tagName, layout = {} } = attributes;\n\tconst templatePartId = createTemplatePartId( theme, slug );\n\tconst hasAlreadyRendered = useHasRecursion( templatePartId );\n\tconst [ isTemplatePartSelectionOpen, setIsTemplatePartSelectionOpen ] =\n\t\tuseState( false );\n\n\t// Set the postId block attribute if it did not exist,\n\t// but wait until the inner blocks have loaded to allow\n\t// new edits to trigger this.\n\tconst { isResolved, innerBlocks, isMissing, area } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getBlocks } = 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\treturn {\n\t\t\t\tinnerBlocks: getBlocks( clientId ),\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};\n\t\t},\n\t\t[ templatePartId, attributes.area, clientId ]\n\t);\n\tconst { templateParts } = useAlternativeTemplateParts(\n\t\tarea,\n\t\ttemplatePartId\n\t);\n\tconst blockPatterns = useAlternativeBlockPatterns( area, clientId );\n\tconst hasReplacements = !! templateParts.length || !! blockPatterns.length;\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 canReplace =\n\t\tisEntityAvailable &&\n\t\thasReplacements &&\n\t\t( area === 'header' || area === 'footer' );\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\tinnerBlocks.length === 0 &&\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<TemplatePartAdvancedControls\n\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\tdefaultWrapper={ areaObject.tagName }\n\t\t\t\t\thasInnerBlocks={ innerBlocks.length > 0 }\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{ canReplace && (\n\t\t\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t\t\t{ ( { selectedClientIds } ) => {\n\t\t\t\t\t\t\t// Only enable for single selection that matches the current block.\n\t\t\t\t\t\t\t// Ensures menu item doesn't render multiple times.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t! (\n\t\t\t\t\t\t\t\t\tselectedClientIds.length === 1 &&\n\t\t\t\t\t\t\t\t\tclientId === selectedClientIds[ 0 ]\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\treturn null;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( true );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\taria-expanded={\n\t\t\t\t\t\t\t\t\t\tisTemplatePartSelectionOpen\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t\t__( 'Replace <BlockTitle />' ),\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tBlockTitle: (\n\t\t\t\t\t\t\t\t\t\t\t\t<BlockTitle\n\t\t\t\t\t\t\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\t\t\t\t\t\t\tmaximumLength={ 25 }\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t</BlockSettingsMenuControls>\n\t\t\t\t) }\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={ innerBlocks.length > 0 }\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={ true }\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":";;;;;;;AAgBA,IAAAA,QAAA,GAAAC,OAAA;AAbA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AASA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAMA,IAAAM,YAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,eAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,iBAAA,GAAAT,OAAA;AACA,IAAAU,YAAA,GAAAH,sBAAA,CAAAP,OAAA;AACA,IAAAW,qBAAA,GAAAX,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AA1BA;AACA;AACA;;AAgBA;AACA;AACA;;AAYe,SAASa,gBAAgBA,CAAE;EACzCC,UAAU;EACVC,aAAa;EACbC;AACD,CAAC,EAAG;EACH,MAAM;IAAEC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Ae;IAC/BwE,OAAO,EAAGA,CAAA,KACT7D,8BAA8B,CAAE,KAAM;EACtC,CACD,CACK,CAEP,CAAC;AAEL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["init"],"sources":["@wordpress/block-library/src/footnotes/init.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { init } from './';\n\nexport default init();\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAI,QAAQ,IAAI;AAEzB,eAAeA,IAAI,CAAC,CAAC"}
|
|
@@ -121,7 +121,8 @@ export default function Edit({
|
|
|
121
121
|
marginVertical: NATIVE_MARGIN_SPACING,
|
|
122
122
|
marginHorizontal: NATIVE_MARGIN_SPACING,
|
|
123
123
|
renderAppender: false
|
|
124
|
-
})
|
|
124
|
+
}),
|
|
125
|
+
__experimentalCaptureToolbars: true
|
|
125
126
|
});
|
|
126
127
|
useMigrateOnLoad(attributes, clientId);
|
|
127
128
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BlockControls","useBlockProps","useInnerBlocksProps","store","blockEditorStore","ToolbarButton","useDispatch","useSelect","useRegistry","isRTL","__","formatListBullets","formatListBulletsRTL","formatListNumbered","formatListNumberedRTL","formatOutdent","formatOutdentRTL","createBlock","useCallback","useEffect","Platform","deprecated","OrderedListSettings","migrateToListV2","TagName","TEMPLATE","NATIVE_MARGIN_SPACING","useMigrateOnLoad","attributes","clientId","registry","updateBlockAttributes","replaceInnerBlocks","values","newAttributes","newInnerBlocks","since","version","alternative","batch","useOutdentList","canOutdent","innerSelect","getBlockRootClientId","getBlock","parentId","name","replaceBlocks","selectionChange","getBlockAttributes","parentBlockId","parentBlockAttributes","newParentBlock","innerBlocks","length","IndentUI","outdentList","createElement","Fragment","icon","title","describedBy","disabled","onClick","Edit","setAttributes","style","blockProps","isNative","innerBlocksProps","allowedBlocks","template","templateLock","templateInsertUpdatesSelection","marginVertical","marginHorizontal","renderAppender","ordered","type","reversed","start","controls","group","isActive"],"sources":["@wordpress/block-library/src/list/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { ToolbarButton } from '@wordpress/components';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport {\n\tformatListBullets,\n\tformatListBulletsRTL,\n\tformatListNumbered,\n\tformatListNumberedRTL,\n\tformatOutdent,\n\tformatOutdentRTL,\n} from '@wordpress/icons';\nimport { createBlock } from '@wordpress/blocks';\nimport { useCallback, useEffect, Platform } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport OrderedListSettings from './ordered-list-settings';\nimport { migrateToListV2 } from './utils';\nimport TagName from './tag-name';\n\nconst TEMPLATE = [ [ 'core/list-item' ] ];\nconst NATIVE_MARGIN_SPACING = 8;\n\n/**\n * At the moment, deprecations don't handle create blocks from attributes\n * (like when using CPT templates). For this reason, this hook is necessary\n * to avoid breaking templates using the old list block format.\n *\n * @param {Object} attributes Block attributes.\n * @param {string} clientId Block client ID.\n */\nfunction useMigrateOnLoad( attributes, clientId ) {\n\tconst registry = useRegistry();\n\tconst { updateBlockAttributes, replaceInnerBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\t// As soon as the block is loaded, migrate it to the new version.\n\n\t\tif ( ! attributes.values ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst [ newAttributes, newInnerBlocks ] = migrateToListV2( attributes );\n\n\t\tdeprecated( 'Value attribute on the list block', {\n\t\t\tsince: '6.0',\n\t\t\tversion: '6.5',\n\t\t\talternative: 'inner blocks',\n\t\t} );\n\n\t\tregistry.batch( () => {\n\t\t\tupdateBlockAttributes( clientId, newAttributes );\n\t\t\treplaceInnerBlocks( clientId, newInnerBlocks );\n\t\t} );\n\t}, [ attributes.values ] );\n}\n\nfunction useOutdentList( clientId ) {\n\tconst { canOutdent } = useSelect(\n\t\t( innerSelect ) => {\n\t\t\tconst { getBlockRootClientId, getBlock } =\n\t\t\t\tinnerSelect( blockEditorStore );\n\t\t\tconst parentId = getBlockRootClientId( clientId );\n\t\t\treturn {\n\t\t\t\tcanOutdent:\n\t\t\t\t\t!! parentId &&\n\t\t\t\t\tgetBlock( parentId ).name === 'core/list-item',\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { replaceBlocks, selectionChange } = useDispatch( blockEditorStore );\n\tconst { getBlockRootClientId, getBlockAttributes, getBlock } =\n\t\tuseSelect( blockEditorStore );\n\n\treturn [\n\t\tcanOutdent,\n\t\tuseCallback( () => {\n\t\t\tconst parentBlockId = getBlockRootClientId( clientId );\n\t\t\tconst parentBlockAttributes = getBlockAttributes( parentBlockId );\n\t\t\t// Create a new parent block without the inner blocks.\n\t\t\tconst newParentBlock = createBlock(\n\t\t\t\t'core/list-item',\n\t\t\t\tparentBlockAttributes\n\t\t\t);\n\t\t\tconst { innerBlocks } = getBlock( clientId );\n\t\t\t// Replace the parent block with a new parent block without inner blocks,\n\t\t\t// and make the inner blocks siblings of the parent.\n\t\t\treplaceBlocks(\n\t\t\t\t[ parentBlockId ],\n\t\t\t\t[ newParentBlock, ...innerBlocks ]\n\t\t\t);\n\t\t\t// Select the last child of the list being outdent.\n\t\t\tselectionChange( innerBlocks[ innerBlocks.length - 1 ].clientId );\n\t\t}, [ clientId ] ),\n\t];\n}\n\nfunction IndentUI( { clientId } ) {\n\tconst [ canOutdent, outdentList ] = useOutdentList( clientId );\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatOutdentRTL : formatOutdent }\n\t\t\t\ttitle={ __( 'Outdent' ) }\n\t\t\t\tdescribedBy={ __( 'Outdent list item' ) }\n\t\t\t\tdisabled={ ! canOutdent }\n\t\t\t\tonClick={ outdentList }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default function Edit( { attributes, setAttributes, clientId, style } ) {\n\tconst blockProps = useBlockProps( {\n\t\t...( Platform.isNative && { style } ),\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: [ 'core/list-item' ],\n\t\ttemplate: TEMPLATE,\n\t\ttemplateLock: false,\n\t\ttemplateInsertUpdatesSelection: true,\n\t\t...( Platform.isNative && {\n\t\t\tmarginVertical: NATIVE_MARGIN_SPACING,\n\t\t\tmarginHorizontal: NATIVE_MARGIN_SPACING,\n\t\t\trenderAppender: false,\n\t\t} ),\n\t} );\n\tuseMigrateOnLoad( attributes, clientId );\n\tconst { ordered, type, reversed, start } = attributes;\n\n\tconst controls = (\n\t\t<BlockControls group=\"block\">\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatListBulletsRTL : formatListBullets }\n\t\t\t\ttitle={ __( 'Unordered' ) }\n\t\t\t\tdescribedBy={ __( 'Convert to unordered list' ) }\n\t\t\t\tisActive={ ordered === false }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetAttributes( { ordered: false } );\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatListNumberedRTL : formatListNumbered }\n\t\t\t\ttitle={ __( 'Ordered' ) }\n\t\t\t\tdescribedBy={ __( 'Convert to ordered list' ) }\n\t\t\t\tisActive={ ordered === true }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetAttributes( { ordered: true } );\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<IndentUI clientId={ clientId } />\n\t\t</BlockControls>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<TagName\n\t\t\t\tordered={ ordered }\n\t\t\t\treversed={ reversed }\n\t\t\t\tstart={ start }\n\t\t\t\ttype={ type }\n\t\t\t\t{ ...innerBlocksProps }\n\t\t\t/>\n\t\t\t{ controls }\n\t\t\t{ ordered && (\n\t\t\t\t<OrderedListSettings\n\t\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,EACRJ,OAAO,IACRpB,aAAA,CAACnC,mBAAmB;IAElB2C,aAAa;IACbc,QAAQ;IACRC,KAAK;IACLF;EAAI,CAEL,CAED,CAAC;AAEL"}
|
|
1
|
+
{"version":3,"names":["BlockControls","useBlockProps","useInnerBlocksProps","store","blockEditorStore","ToolbarButton","useDispatch","useSelect","useRegistry","isRTL","__","formatListBullets","formatListBulletsRTL","formatListNumbered","formatListNumberedRTL","formatOutdent","formatOutdentRTL","createBlock","useCallback","useEffect","Platform","deprecated","OrderedListSettings","migrateToListV2","TagName","TEMPLATE","NATIVE_MARGIN_SPACING","useMigrateOnLoad","attributes","clientId","registry","updateBlockAttributes","replaceInnerBlocks","values","newAttributes","newInnerBlocks","since","version","alternative","batch","useOutdentList","canOutdent","innerSelect","getBlockRootClientId","getBlock","parentId","name","replaceBlocks","selectionChange","getBlockAttributes","parentBlockId","parentBlockAttributes","newParentBlock","innerBlocks","length","IndentUI","outdentList","createElement","Fragment","icon","title","describedBy","disabled","onClick","Edit","setAttributes","style","blockProps","isNative","innerBlocksProps","allowedBlocks","template","templateLock","templateInsertUpdatesSelection","marginVertical","marginHorizontal","renderAppender","__experimentalCaptureToolbars","ordered","type","reversed","start","controls","group","isActive"],"sources":["@wordpress/block-library/src/list/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { ToolbarButton } from '@wordpress/components';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport {\n\tformatListBullets,\n\tformatListBulletsRTL,\n\tformatListNumbered,\n\tformatListNumberedRTL,\n\tformatOutdent,\n\tformatOutdentRTL,\n} from '@wordpress/icons';\nimport { createBlock } from '@wordpress/blocks';\nimport { useCallback, useEffect, Platform } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport OrderedListSettings from './ordered-list-settings';\nimport { migrateToListV2 } from './utils';\nimport TagName from './tag-name';\n\nconst TEMPLATE = [ [ 'core/list-item' ] ];\nconst NATIVE_MARGIN_SPACING = 8;\n\n/**\n * At the moment, deprecations don't handle create blocks from attributes\n * (like when using CPT templates). For this reason, this hook is necessary\n * to avoid breaking templates using the old list block format.\n *\n * @param {Object} attributes Block attributes.\n * @param {string} clientId Block client ID.\n */\nfunction useMigrateOnLoad( attributes, clientId ) {\n\tconst registry = useRegistry();\n\tconst { updateBlockAttributes, replaceInnerBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\t// As soon as the block is loaded, migrate it to the new version.\n\n\t\tif ( ! attributes.values ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst [ newAttributes, newInnerBlocks ] = migrateToListV2( attributes );\n\n\t\tdeprecated( 'Value attribute on the list block', {\n\t\t\tsince: '6.0',\n\t\t\tversion: '6.5',\n\t\t\talternative: 'inner blocks',\n\t\t} );\n\n\t\tregistry.batch( () => {\n\t\t\tupdateBlockAttributes( clientId, newAttributes );\n\t\t\treplaceInnerBlocks( clientId, newInnerBlocks );\n\t\t} );\n\t}, [ attributes.values ] );\n}\n\nfunction useOutdentList( clientId ) {\n\tconst { canOutdent } = useSelect(\n\t\t( innerSelect ) => {\n\t\t\tconst { getBlockRootClientId, getBlock } =\n\t\t\t\tinnerSelect( blockEditorStore );\n\t\t\tconst parentId = getBlockRootClientId( clientId );\n\t\t\treturn {\n\t\t\t\tcanOutdent:\n\t\t\t\t\t!! parentId &&\n\t\t\t\t\tgetBlock( parentId ).name === 'core/list-item',\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { replaceBlocks, selectionChange } = useDispatch( blockEditorStore );\n\tconst { getBlockRootClientId, getBlockAttributes, getBlock } =\n\t\tuseSelect( blockEditorStore );\n\n\treturn [\n\t\tcanOutdent,\n\t\tuseCallback( () => {\n\t\t\tconst parentBlockId = getBlockRootClientId( clientId );\n\t\t\tconst parentBlockAttributes = getBlockAttributes( parentBlockId );\n\t\t\t// Create a new parent block without the inner blocks.\n\t\t\tconst newParentBlock = createBlock(\n\t\t\t\t'core/list-item',\n\t\t\t\tparentBlockAttributes\n\t\t\t);\n\t\t\tconst { innerBlocks } = getBlock( clientId );\n\t\t\t// Replace the parent block with a new parent block without inner blocks,\n\t\t\t// and make the inner blocks siblings of the parent.\n\t\t\treplaceBlocks(\n\t\t\t\t[ parentBlockId ],\n\t\t\t\t[ newParentBlock, ...innerBlocks ]\n\t\t\t);\n\t\t\t// Select the last child of the list being outdent.\n\t\t\tselectionChange( innerBlocks[ innerBlocks.length - 1 ].clientId );\n\t\t}, [ clientId ] ),\n\t];\n}\n\nfunction IndentUI( { clientId } ) {\n\tconst [ canOutdent, outdentList ] = useOutdentList( clientId );\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatOutdentRTL : formatOutdent }\n\t\t\t\ttitle={ __( 'Outdent' ) }\n\t\t\t\tdescribedBy={ __( 'Outdent list item' ) }\n\t\t\t\tdisabled={ ! canOutdent }\n\t\t\t\tonClick={ outdentList }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default function Edit( { attributes, setAttributes, clientId, style } ) {\n\tconst blockProps = useBlockProps( {\n\t\t...( Platform.isNative && { style } ),\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: [ 'core/list-item' ],\n\t\ttemplate: TEMPLATE,\n\t\ttemplateLock: false,\n\t\ttemplateInsertUpdatesSelection: true,\n\t\t...( Platform.isNative && {\n\t\t\tmarginVertical: NATIVE_MARGIN_SPACING,\n\t\t\tmarginHorizontal: NATIVE_MARGIN_SPACING,\n\t\t\trenderAppender: false,\n\t\t} ),\n\t\t__experimentalCaptureToolbars: true,\n\t} );\n\tuseMigrateOnLoad( attributes, clientId );\n\tconst { ordered, type, reversed, start } = attributes;\n\n\tconst controls = (\n\t\t<BlockControls group=\"block\">\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatListBulletsRTL : formatListBullets }\n\t\t\t\ttitle={ __( 'Unordered' ) }\n\t\t\t\tdescribedBy={ __( 'Convert to unordered list' ) }\n\t\t\t\tisActive={ ordered === false }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetAttributes( { ordered: false } );\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatListNumberedRTL : formatListNumbered }\n\t\t\t\ttitle={ __( 'Ordered' ) }\n\t\t\t\tdescribedBy={ __( 'Convert to ordered list' ) }\n\t\t\t\tisActive={ ordered === true }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetAttributes( { ordered: true } );\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<IndentUI clientId={ clientId } />\n\t\t</BlockControls>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<TagName\n\t\t\t\tordered={ ordered }\n\t\t\t\treversed={ reversed }\n\t\t\t\tstart={ start }\n\t\t\t\ttype={ type }\n\t\t\t\t{ ...innerBlocksProps }\n\t\t\t/>\n\t\t\t{ controls }\n\t\t\t{ ordered && (\n\t\t\t\t<OrderedListSettings\n\t\t\t\t\t{ ...{\n\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\treversed,\n\t\t\t\t\t\tstart,\n\t\t\t\t\t\ttype,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,aAAa,EACbC,aAAa,EACbC,mBAAmB,EACnBC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,WAAW,EAAEC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACrE,SAASC,KAAK,EAAEC,EAAE,QAAQ,iBAAiB;AAC3C,SACCC,iBAAiB,EACjBC,oBAA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AAE,CAAE,2BAA4B,CAAG;IACjD0E,QAAQ,EAAGN,OAAO,KAAK,KAAO;IAC9Bf,OAAO,EAAGA,CAAA,KAAM;MACfE,aAAa,CAAE;QAAEa,OAAO,EAAE;MAAM,CAAE,CAAC;IACpC;EAAG,CACH,CAAC,EACFrB,aAAA,CAACpD,aAAa;IACbsD,IAAI,EAAGlD,KAAK,CAAC,CAAC,GAAGK,qBAAqB,GAAGD,kBAAoB;IAC7D+C,KAAK,EAAGlD,EAAE,CAAE,SAAU,CAAG;IACzBmD,WAAW,EAAGnD,EAAE,CAAE,yBAA0B,CAAG;IAC/C0E,QAAQ,EAAGN,OAAO,KAAK,IAAM;IAC7Bf,OAAO,EAAGA,CAAA,KAAM;MACfE,aAAa,CAAE;QAAEa,OAAO,EAAE;MAAK,CAAE,CAAC;IACnC;EAAG,CACH,CAAC,EACFrB,aAAA,CAACF,QAAQ;IAAC1B,QAAQ,EAAGA;EAAU,CAAE,CACnB,CACf;EAED,OACC4B,aAAA,CAAAC,QAAA,QACCD,aAAA,CAACjC,OAAO;IACPsD,OAAO,EAAGA,OAAS;IACnBE,QAAQ,EAAGA,QAAU;IACrBC,KAAK,EAAGA,KAAO;IACfF,IAAI,EAAGA,IAAM;IAAA,GACRV;EAAgB,CACrB,CAAC,EACAa,QAAQ,EACRJ,OAAO,IACRrB,aAAA,CAACnC,mBAAmB;IAElB2C,aAAa;IACbe,QAAQ;IACRC,KAAK;IACLF;EAAI,CAEL,CAED,CAAC;AAEL"}
|
|
@@ -74,7 +74,8 @@ export default function NavigationInnerBlocks({
|
|
|
74
74
|
renderAppender: isSelected || isImmediateParentOfSelectedBlock && !selectedBlockHasChildren ||
|
|
75
75
|
// Show the appender while dragging to allow inserting element between item and the appender.
|
|
76
76
|
parentOrChildHasSelection ? InnerBlocks.ButtonBlockAppender : false,
|
|
77
|
-
placeholder: showPlaceholder ? placeholder : undefined
|
|
77
|
+
placeholder: showPlaceholder ? placeholder : undefined,
|
|
78
|
+
__experimentalCaptureToolbars: true
|
|
78
79
|
});
|
|
79
80
|
return createElement("div", {
|
|
80
81
|
...innerBlocksProps
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEntityBlockEditor","useInnerBlocksProps","InnerBlocks","store","blockEditorStore","useSelect","useMemo","PlaceholderPreview","DEFAULT_BLOCK","ALLOWED_BLOCKS","PRIORITIZED_INSERTER_BLOCKS","NavigationInnerBlocks","clientId","hasCustomPlaceholder","orientation","templateLock","isImmediateParentOfSelectedBlock","selectedBlockHasChildren","isSelected","select","getBlockCount","hasSelectedInnerBlock","getSelectedBlockClientId","selectedBlockId","blocks","onInput","onChange","shouldDirectInsert","every","name","parentOrChildHasSelection","placeholder","createElement","hasMenuItems","length","showPlaceholder","innerBlocksProps","className","value","allowedBlocks","prioritizedInserterBlocks","defaultBlock","directInsert","renderAppender","ButtonBlockAppender","undefined"],"sources":["@wordpress/block-library/src/navigation/edit/inner-blocks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityBlockEditor } from '@wordpress/core-data';\nimport {\n\tuseInnerBlocksProps,\n\tInnerBlocks,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport PlaceholderPreview from './placeholder/placeholder-preview';\nimport {\n\tDEFAULT_BLOCK,\n\tALLOWED_BLOCKS,\n\tPRIORITIZED_INSERTER_BLOCKS,\n} from '../constants';\n\nexport default function NavigationInnerBlocks( {\n\tclientId,\n\thasCustomPlaceholder,\n\torientation,\n\ttemplateLock,\n} ) {\n\tconst {\n\t\tisImmediateParentOfSelectedBlock,\n\t\tselectedBlockHasChildren,\n\t\tisSelected,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst selectedBlockId = getSelectedBlockClientId();\n\n\t\t\treturn {\n\t\t\t\tisImmediateParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\tselectedBlockHasChildren: !! getBlockCount( selectedBlockId ),\n\n\t\t\t\t// This prop is already available but computing it here ensures it's\n\t\t\t\t// fresh compared to isImmediateParentOfSelectedBlock.\n\t\t\t\tisSelected: selectedBlockId === clientId,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\t'wp_navigation'\n\t);\n\n\tconst shouldDirectInsert = useMemo(\n\t\t() =>\n\t\t\tblocks.every(\n\t\t\t\t( { name } ) =>\n\t\t\t\t\tname === 'core/navigation-link' ||\n\t\t\t\t\tname === 'core/navigation-submenu' ||\n\t\t\t\t\tname === 'core/page-list'\n\t\t\t),\n\t\t[ blocks ]\n\t);\n\n\t// When the block is selected itself or has a top level item selected that\n\t// doesn't itself have children, show the standard appender. Else show no\n\t// appender.\n\tconst parentOrChildHasSelection =\n\t\tisSelected ||\n\t\t( isImmediateParentOfSelectedBlock && ! selectedBlockHasChildren );\n\n\tconst placeholder = useMemo( () => <PlaceholderPreview />, [] );\n\n\tconst hasMenuItems = !! blocks?.length;\n\n\t// If there is a `ref` attribute pointing to a `wp_navigation` but\n\t// that menu has no **items** (i.e. empty) then show a placeholder.\n\t// The block must also be selected else the placeholder will display\n\t// alongside the appender.\n\tconst showPlaceholder =\n\t\t! hasCustomPlaceholder && ! hasMenuItems && ! isSelected;\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tclassName: 'wp-block-navigation__container',\n\t\t},\n\t\t{\n\t\t\tvalue: blocks,\n\t\t\tonInput,\n\t\t\tonChange,\n\t\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\t\tprioritizedInserterBlocks: PRIORITIZED_INSERTER_BLOCKS,\n\t\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\t\tdirectInsert: shouldDirectInsert,\n\t\t\torientation,\n\t\t\ttemplateLock,\n\n\t\t\t// As an exception to other blocks which feature nesting, show\n\t\t\t// the block appender even when a child block is selected.\n\t\t\t// This should be a temporary fix, to be replaced by improvements to\n\t\t\t// the sibling inserter.\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/37572.\n\t\t\trenderAppender:\n\t\t\t\tisSelected ||\n\t\t\t\t( isImmediateParentOfSelectedBlock &&\n\t\t\t\t\t! selectedBlockHasChildren ) ||\n\t\t\t\t// Show the appender while dragging to allow inserting element between item and the appender.\n\t\t\t\tparentOrChildHasSelection\n\t\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t\t: false,\n\t\t\tplaceholder: showPlaceholder ? placeholder : undefined,\n\t\t}\n\t);\n\n\treturn <div { ...innerBlocksProps } />;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,oBAAoB,QAAQ,sBAAsB;AAC3D,SACCC,mBAAmB,EACnBC,WAAW,EACXC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;AACA,OAAOC,kBAAkB,MAAM,mCAAmC;AAClE,SACCC,aAAa,EACbC,cAAc,EACdC,2BAA2B,QACrB,cAAc;AAErB,eAAe,SAASC,qBAAqBA,CAAE;EAC9CC,QAAQ;EACRC,oBAAoB;EACpBC,WAAW;EACXC;AACD,CAAC,EAAG;EACH,MAAM;IACLC,gCAAgC;IAChCC,wBAAwB;IACxBC;EACD,CAAC,GAAGb,SAAS,CACVc,MAAM,IAAM;IACb,MAAM;MACLC,aAAa;MACbC,qBAAqB;MACrBC;IACD,CAAC,GAAGH,MAAM,CAAEf,gBAAiB,CAAC;IAC9B,MAAMmB,eAAe,GAAGD,wBAAwB,CAAC,CAAC;IAElD,OAAO;MACNN,gCAAg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C,wBAA0B;IAC7B;IACAa,yBAAyB,GACtB5B,WAAW,CAAC0C,mBAAmB,GAC/B,KAAK;IACTb,WAAW,EAAEI,eAAe,GAAGJ,WAAW,GAAGc;
|
|
1
|
+
{"version":3,"names":["useEntityBlockEditor","useInnerBlocksProps","InnerBlocks","store","blockEditorStore","useSelect","useMemo","PlaceholderPreview","DEFAULT_BLOCK","ALLOWED_BLOCKS","PRIORITIZED_INSERTER_BLOCKS","NavigationInnerBlocks","clientId","hasCustomPlaceholder","orientation","templateLock","isImmediateParentOfSelectedBlock","selectedBlockHasChildren","isSelected","select","getBlockCount","hasSelectedInnerBlock","getSelectedBlockClientId","selectedBlockId","blocks","onInput","onChange","shouldDirectInsert","every","name","parentOrChildHasSelection","placeholder","createElement","hasMenuItems","length","showPlaceholder","innerBlocksProps","className","value","allowedBlocks","prioritizedInserterBlocks","defaultBlock","directInsert","renderAppender","ButtonBlockAppender","undefined","__experimentalCaptureToolbars"],"sources":["@wordpress/block-library/src/navigation/edit/inner-blocks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityBlockEditor } from '@wordpress/core-data';\nimport {\n\tuseInnerBlocksProps,\n\tInnerBlocks,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport PlaceholderPreview from './placeholder/placeholder-preview';\nimport {\n\tDEFAULT_BLOCK,\n\tALLOWED_BLOCKS,\n\tPRIORITIZED_INSERTER_BLOCKS,\n} from '../constants';\n\nexport default function NavigationInnerBlocks( {\n\tclientId,\n\thasCustomPlaceholder,\n\torientation,\n\ttemplateLock,\n} ) {\n\tconst {\n\t\tisImmediateParentOfSelectedBlock,\n\t\tselectedBlockHasChildren,\n\t\tisSelected,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst selectedBlockId = getSelectedBlockClientId();\n\n\t\t\treturn {\n\t\t\t\tisImmediateParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\tselectedBlockHasChildren: !! getBlockCount( selectedBlockId ),\n\n\t\t\t\t// This prop is already available but computing it here ensures it's\n\t\t\t\t// fresh compared to isImmediateParentOfSelectedBlock.\n\t\t\t\tisSelected: selectedBlockId === clientId,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\t'wp_navigation'\n\t);\n\n\tconst shouldDirectInsert = useMemo(\n\t\t() =>\n\t\t\tblocks.every(\n\t\t\t\t( { name } ) =>\n\t\t\t\t\tname === 'core/navigation-link' ||\n\t\t\t\t\tname === 'core/navigation-submenu' ||\n\t\t\t\t\tname === 'core/page-list'\n\t\t\t),\n\t\t[ blocks ]\n\t);\n\n\t// When the block is selected itself or has a top level item selected that\n\t// doesn't itself have children, show the standard appender. Else show no\n\t// appender.\n\tconst parentOrChildHasSelection =\n\t\tisSelected ||\n\t\t( isImmediateParentOfSelectedBlock && ! selectedBlockHasChildren );\n\n\tconst placeholder = useMemo( () => <PlaceholderPreview />, [] );\n\n\tconst hasMenuItems = !! blocks?.length;\n\n\t// If there is a `ref` attribute pointing to a `wp_navigation` but\n\t// that menu has no **items** (i.e. empty) then show a placeholder.\n\t// The block must also be selected else the placeholder will display\n\t// alongside the appender.\n\tconst showPlaceholder =\n\t\t! hasCustomPlaceholder && ! hasMenuItems && ! isSelected;\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tclassName: 'wp-block-navigation__container',\n\t\t},\n\t\t{\n\t\t\tvalue: blocks,\n\t\t\tonInput,\n\t\t\tonChange,\n\t\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\t\tprioritizedInserterBlocks: PRIORITIZED_INSERTER_BLOCKS,\n\t\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\t\tdirectInsert: shouldDirectInsert,\n\t\t\torientation,\n\t\t\ttemplateLock,\n\n\t\t\t// As an exception to other blocks which feature nesting, show\n\t\t\t// the block appender even when a child block is selected.\n\t\t\t// This should be a temporary fix, to be replaced by improvements to\n\t\t\t// the sibling inserter.\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/37572.\n\t\t\trenderAppender:\n\t\t\t\tisSelected ||\n\t\t\t\t( isImmediateParentOfSelectedBlock &&\n\t\t\t\t\t! selectedBlockHasChildren ) ||\n\t\t\t\t// Show the appender while dragging to allow inserting element between item and the appender.\n\t\t\t\tparentOrChildHasSelection\n\t\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t\t: false,\n\t\t\tplaceholder: showPlaceholder ? placeholder : undefined,\n\t\t\t__experimentalCaptureToolbars: true,\n\t\t}\n\t);\n\n\treturn <div { ...innerBlocksProps } />;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,oBAAoB,QAAQ,sBAAsB;AAC3D,SACCC,mBAAmB,EACnBC,WAAW,EACXC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;AACA,OAAOC,kBAAkB,MAAM,mCAAmC;AAClE,SACCC,aAAa,EACbC,cAAc,EACdC,2BAA2B,QACrB,cAAc;AAErB,eAAe,SAASC,qBAAqBA,CAAE;EAC9CC,QAAQ;EACRC,oBAAoB;EACpBC,WAAW;EACXC;AACD,CAAC,EAAG;EACH,MAAM;IACLC,gCAAgC;IAChCC,wBAAwB;IACxBC;EACD,CAAC,GAAGb,SAAS,CACVc,MAAM,IAAM;IACb,MAAM;MACLC,aAAa;MACbC,qBAAqB;MACrBC;IACD,CAAC,GAAGH,MAAM,CAAEf,gBAAiB,CAAC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Z;IACA;IACA;IACA;IACA;IACA4B,cAAc,EACbzB,UAAU,IACRF,gCAAgC,IACjC,CAAEC,wBAA0B;IAC7B;IACAa,yBAAyB,GACtB5B,WAAW,CAAC0C,mBAAmB,GAC/B,KAAK;IACTb,WAAW,EAAEI,eAAe,GAAGJ,WAAW,GAAGc,SAAS;IACtDC,6BAA6B,EAAE;EAChC,CACD,CAAC;EAED,OAAOd,aAAA;IAAA,GAAUI;EAAgB,CAAI,CAAC;AACvC"}
|
|
@@ -85,7 +85,8 @@ export default function QuoteEdit({
|
|
|
85
85
|
});
|
|
86
86
|
const innerBlocksProps = useInnerBlocksProps(blockProps, {
|
|
87
87
|
template: TEMPLATE,
|
|
88
|
-
templateInsertUpdatesSelection: true
|
|
88
|
+
templateInsertUpdatesSelection: true,
|
|
89
|
+
__experimentalCaptureToolbars: true
|
|
89
90
|
});
|
|
90
91
|
return createElement(Fragment, null, createElement(BlockControls, {
|
|
91
92
|
group: "block"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classNames","__","AlignmentControl","BlockControls","RichText","useBlockProps","useInnerBlocksProps","store","blockEditorStore","BlockQuotation","useDispatch","useSelect","useRegistry","createBlock","getDefaultBlockName","Platform","useEffect","deprecated","migrateToQuoteV2","isWebPlatform","OS","TEMPLATE","useMigrateOnLoad","attributes","clientId","registry","updateBlockAttributes","replaceInnerBlocks","value","newAttributes","newInnerBlocks","since","version","alternative","batch","QuoteEdit","setAttributes","insertBlocksAfter","className","style","align","citation","hasSelection","select","isBlockSelected","hasSelectedInnerBlock","blockProps","innerBlocksProps","template","templateInsertUpdatesSelection","createElement","Fragment","group","onChange","nextAlign","children","isEmpty","identifier","tagName","undefined","display","nextCitation","__unstableMobileNoFocusOnMount","placeholder","__unstableOnSplitAtEnd","textAlign"],"sources":["@wordpress/block-library/src/quote/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tRichText,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { BlockQuotation } from '@wordpress/components';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\nimport { Platform, useEffect } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { migrateToQuoteV2 } from './deprecated';\n\nconst isWebPlatform = Platform.OS === 'web';\n\nconst TEMPLATE = [ [ 'core/paragraph', {} ] ];\n\n/**\n * At the moment, deprecations don't handle create blocks from attributes\n * (like when using CPT templates). For this reason, this hook is necessary\n * to avoid breaking templates using the old quote block format.\n *\n * @param {Object} attributes Block attributes.\n * @param {string} clientId Block client ID.\n */\nconst useMigrateOnLoad = ( attributes, clientId ) => {\n\tconst registry = useRegistry();\n\tconst { updateBlockAttributes, replaceInnerBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\tuseEffect( () => {\n\t\t// As soon as the block is loaded, migrate it to the new version.\n\n\t\tif ( ! attributes.value ) {\n\t\t\t// No need to migrate if it doesn't have the value attribute.\n\t\t\treturn;\n\t\t}\n\n\t\tconst [ newAttributes, newInnerBlocks ] =\n\t\t\tmigrateToQuoteV2( attributes );\n\n\t\tdeprecated( 'Value attribute on the quote block', {\n\t\t\tsince: '6.0',\n\t\t\tversion: '6.5',\n\t\t\talternative: 'inner blocks',\n\t\t} );\n\n\t\tregistry.batch( () => {\n\t\t\tupdateBlockAttributes( clientId, newAttributes );\n\t\t\treplaceInnerBlocks( clientId, newInnerBlocks );\n\t\t} );\n\t}, [ attributes.value ] );\n};\n\nexport default function QuoteEdit( {\n\tattributes,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tclientId,\n\tclassName,\n\tstyle,\n} ) {\n\tconst { align, citation } = attributes;\n\n\tuseMigrateOnLoad( attributes, clientId );\n\n\tconst hasSelection = useSelect( ( select ) => {\n\t\tconst { isBlockSelected, hasSelectedInnerBlock } =\n\t\t\tselect( blockEditorStore );\n\t\treturn hasSelectedInnerBlock( clientId ) || isBlockSelected( clientId );\n\t}, [] );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classNames( className, {\n\t\t\t[ `has-text-align-${ align }` ]: align,\n\t\t} ),\n\t\t...( ! isWebPlatform && { style } ),\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t\ttemplateInsertUpdatesSelection: true,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ align }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { align: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<BlockQuotation { ...innerBlocksProps }>\n\t\t\t\t{ innerBlocksProps.children }\n\t\t\t\t{ ( ! RichText.isEmpty( citation ) || hasSelection ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"citation\"\n\t\t\t\t\t\ttagName={ isWebPlatform ? 'cite' : undefined }\n\t\t\t\t\t\tstyle={ { display: 'block' } }\n\t\t\t\t\t\tvalue={ citation }\n\t\t\t\t\t\tonChange={ ( nextCitation ) => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tcitation: nextCitation,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t__unstableMobileNoFocusOnMount\n\t\t\t\t\t\taria-label={ __( 'Quote citation' ) }\n\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t// translators: placeholder text used for the\n\t\t\t\t\t\t\t// citation\n\t\t\t\t\t\t\t__( 'Add citation' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclassName=\"wp-block-quote__citation\"\n\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{ ...( ! isWebPlatform ? { textAlign: align } : {} ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockQuotation>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,gBAAgB,EAChBC,aAAa,EACbC,QAAQ,EACRC,aAAa,EACbC,mBAAmB,EACnBC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SAASC,WAAW,EAAEC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACrE,SAASC,WAAW,EAAEC,mBAAmB,QAAQ,mBAAmB;AACpE,SAASC,QAAQ,EAAEC,SAAS,QAAQ,oBAAoB;AACxD,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,SAASC,gBAAgB,QAAQ,cAAc;AAE/C,MAAMC,aAAa,GAAGJ,QAAQ,CAACK,EAAE,KAAK,KAAK;AAE3C,MAAMC,QAAQ,GAAG,CAAE,CAAE,gBAAgB,EAAE,CAAC,CAAC,CAAE,CAAE;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAGA,CAAEC,UAAU,EAAEC,QAAQ,KAAM;EACpD,MAAMC,QAAQ,GAAGb,WAAW,CAAC,CAAC;EAC9B,MAAM;IAAEc,qBAAqB;IAAEC;EAAmB,CAAC,GAClDjB,WAAW,CAAEF,gBAAiB,CAAC;EAChCQ,SAAS,CAAE,MAAM;IAChB;;IAEA,IAAK,CAAEO,UAAU,CAACK,KAAK,EAAG;MACzB;MACA;IACD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
|
1
|
+
{"version":3,"names":["classNames","__","AlignmentControl","BlockControls","RichText","useBlockProps","useInnerBlocksProps","store","blockEditorStore","BlockQuotation","useDispatch","useSelect","useRegistry","createBlock","getDefaultBlockName","Platform","useEffect","deprecated","migrateToQuoteV2","isWebPlatform","OS","TEMPLATE","useMigrateOnLoad","attributes","clientId","registry","updateBlockAttributes","replaceInnerBlocks","value","newAttributes","newInnerBlocks","since","version","alternative","batch","QuoteEdit","setAttributes","insertBlocksAfter","className","style","align","citation","hasSelection","select","isBlockSelected","hasSelectedInnerBlock","blockProps","innerBlocksProps","template","templateInsertUpdatesSelection","__experimentalCaptureToolbars","createElement","Fragment","group","onChange","nextAlign","children","isEmpty","identifier","tagName","undefined","display","nextCitation","__unstableMobileNoFocusOnMount","placeholder","__unstableOnSplitAtEnd","textAlign"],"sources":["@wordpress/block-library/src/quote/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tRichText,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { BlockQuotation } from '@wordpress/components';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\nimport { Platform, useEffect } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { migrateToQuoteV2 } from './deprecated';\n\nconst isWebPlatform = Platform.OS === 'web';\n\nconst TEMPLATE = [ [ 'core/paragraph', {} ] ];\n\n/**\n * At the moment, deprecations don't handle create blocks from attributes\n * (like when using CPT templates). For this reason, this hook is necessary\n * to avoid breaking templates using the old quote block format.\n *\n * @param {Object} attributes Block attributes.\n * @param {string} clientId Block client ID.\n */\nconst useMigrateOnLoad = ( attributes, clientId ) => {\n\tconst registry = useRegistry();\n\tconst { updateBlockAttributes, replaceInnerBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\tuseEffect( () => {\n\t\t// As soon as the block is loaded, migrate it to the new version.\n\n\t\tif ( ! attributes.value ) {\n\t\t\t// No need to migrate if it doesn't have the value attribute.\n\t\t\treturn;\n\t\t}\n\n\t\tconst [ newAttributes, newInnerBlocks ] =\n\t\t\tmigrateToQuoteV2( attributes );\n\n\t\tdeprecated( 'Value attribute on the quote block', {\n\t\t\tsince: '6.0',\n\t\t\tversion: '6.5',\n\t\t\talternative: 'inner blocks',\n\t\t} );\n\n\t\tregistry.batch( () => {\n\t\t\tupdateBlockAttributes( clientId, newAttributes );\n\t\t\treplaceInnerBlocks( clientId, newInnerBlocks );\n\t\t} );\n\t}, [ attributes.value ] );\n};\n\nexport default function QuoteEdit( {\n\tattributes,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tclientId,\n\tclassName,\n\tstyle,\n} ) {\n\tconst { align, citation } = attributes;\n\n\tuseMigrateOnLoad( attributes, clientId );\n\n\tconst hasSelection = useSelect( ( select ) => {\n\t\tconst { isBlockSelected, hasSelectedInnerBlock } =\n\t\t\tselect( blockEditorStore );\n\t\treturn hasSelectedInnerBlock( clientId ) || isBlockSelected( clientId );\n\t}, [] );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classNames( className, {\n\t\t\t[ `has-text-align-${ align }` ]: align,\n\t\t} ),\n\t\t...( ! isWebPlatform && { style } ),\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t\ttemplateInsertUpdatesSelection: true,\n\t\t__experimentalCaptureToolbars: true,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ align }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { align: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<BlockQuotation { ...innerBlocksProps }>\n\t\t\t\t{ innerBlocksProps.children }\n\t\t\t\t{ ( ! RichText.isEmpty( citation ) || hasSelection ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"citation\"\n\t\t\t\t\t\ttagName={ isWebPlatform ? 'cite' : undefined }\n\t\t\t\t\t\tstyle={ { display: 'block' } }\n\t\t\t\t\t\tvalue={ citation }\n\t\t\t\t\t\tonChange={ ( nextCitation ) => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tcitation: nextCitation,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t__unstableMobileNoFocusOnMount\n\t\t\t\t\t\taria-label={ __( 'Quote citation' ) }\n\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t// translators: placeholder text used for the\n\t\t\t\t\t\t\t// citation\n\t\t\t\t\t\t\t__( 'Add citation' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclassName=\"wp-block-quote__citation\"\n\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{ ...( ! isWebPlatform ? { textAlign: align } : {} ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockQuotation>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,gBAAgB,EAChBC,aAAa,EACbC,QAAQ,EACRC,aAAa,EACbC,mBAAmB,EACnBC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SAASC,WAAW,EAAEC,SAAS,EAAEC,WAAW,QAAQ,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AK,EAAG;MAAEsB,OAAO,EAAE;IAAQ,CAAG;IAC9BjC,KAAK,EAAGa,QAAU;IAClBa,QAAQ,EAAKQ,YAAY,IAAM;MAC9B1B,aAAa,CAAE;QACdK,QAAQ,EAAEqB;MACX,CAAE,CAAC;IACJ,CAAG;IACHC,8BAA8B;IAC9B,cAAa9D,EAAE,CAAE,gBAAiB,CAAG;IACrC+D,WAAW;IACV;IACA;IACA/D,EAAE,CAAE,cAAe,CACnB;IACDqC,SAAS,EAAC,0BAA0B;IACpC2B,sBAAsB,EAAGA,CAAA,KACxB5B,iBAAiB,CAChBxB,WAAW,CAAEC,mBAAmB,CAAC,CAAE,CACpC,CACA;IAAA,IACM,CAAEK,aAAa,GAAG;MAAE+C,SAAS,EAAE1B;IAAM,CAAC,GAAG,CAAC,CAAC;EAAA,CAClD,CAEa,CACf,CAAC;AAEL"}
|
|
@@ -21,8 +21,7 @@ import { useAlternativeBlockPatterns, useAlternativeTemplateParts, useTemplatePa
|
|
|
21
21
|
export default function TemplatePartEdit({
|
|
22
22
|
attributes,
|
|
23
23
|
setAttributes,
|
|
24
|
-
clientId
|
|
25
|
-
isSelected
|
|
24
|
+
clientId
|
|
26
25
|
}) {
|
|
27
26
|
const {
|
|
28
27
|
slug,
|
|
@@ -71,10 +70,7 @@ export default function TemplatePartEdit({
|
|
|
71
70
|
const isPlaceholder = !slug;
|
|
72
71
|
const isEntityAvailable = !isPlaceholder && !isMissing && isResolved;
|
|
73
72
|
const TagName = tagName || areaObject.tagName;
|
|
74
|
-
|
|
75
|
-
// The `isSelected` check ensures the `BlockSettingsMenuControls` fill
|
|
76
|
-
// doesn't render multiple times. The block controls has similar internal check.
|
|
77
|
-
const canReplace = isSelected && isEntityAvailable && hasReplacements && (area === 'header' || area === 'footer');
|
|
73
|
+
const canReplace = isEntityAvailable && hasReplacements && (area === 'header' || area === 'footer');
|
|
78
74
|
|
|
79
75
|
// We don't want to render a missing state if we have any inner blocks.
|
|
80
76
|
// A new template part is automatically created if we have any inner blocks but no entity.
|
|
@@ -106,16 +102,27 @@ export default function TemplatePartEdit({
|
|
|
106
102
|
clientId: clientId,
|
|
107
103
|
setAttributes: setAttributes,
|
|
108
104
|
onOpenSelectionModal: () => setIsTemplatePartSelectionOpen(true)
|
|
109
|
-
})), canReplace && createElement(BlockSettingsMenuControls, null, (
|
|
110
|
-
|
|
111
|
-
|
|
105
|
+
})), canReplace && createElement(BlockSettingsMenuControls, null, ({
|
|
106
|
+
selectedClientIds
|
|
107
|
+
}) => {
|
|
108
|
+
// Only enable for single selection that matches the current block.
|
|
109
|
+
// Ensures menu item doesn't render multiple times.
|
|
110
|
+
if (!(selectedClientIds.length === 1 && clientId === selectedClientIds[0])) {
|
|
111
|
+
return null;
|
|
112
112
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
113
|
+
return createElement(MenuItem, {
|
|
114
|
+
onClick: () => {
|
|
115
|
+
setIsTemplatePartSelectionOpen(true);
|
|
116
|
+
},
|
|
117
|
+
"aria-expanded": isTemplatePartSelectionOpen,
|
|
118
|
+
"aria-haspopup": "dialog"
|
|
119
|
+
}, createInterpolateElement(__('Replace <BlockTitle />'), {
|
|
120
|
+
BlockTitle: createElement(BlockTitle, {
|
|
121
|
+
clientId: clientId,
|
|
122
|
+
maximumLength: 25
|
|
123
|
+
})
|
|
124
|
+
}));
|
|
125
|
+
}), isEntityAvailable && createElement(TemplatePartInnerBlocks, {
|
|
119
126
|
tagName: TagName,
|
|
120
127
|
blockProps: blockProps,
|
|
121
128
|
postId: templatePartId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","BlockSettingsMenuControls","BlockTitle","useBlockProps","Warning","store","blockEditorStore","__experimentalRecursionProvider","RecursionProvider","__experimentalUseHasRecursion","useHasRecursion","Spinner","Modal","MenuItem","__","sprintf","coreStore","useState","createInterpolateElement","TemplatePartPlaceholder","TemplatePartSelectionModal","TemplatePartAdvancedControls","TemplatePartInnerBlocks","createTemplatePartId","useAlternativeBlockPatterns","useAlternativeTemplateParts","useTemplatePartArea","TemplatePartEdit","attributes","setAttributes","clientId","isSelected","slug","theme","tagName","layout","templatePartId","hasAlreadyRendered","isTemplatePartSelectionOpen","setIsTemplatePartSelectionOpen","isResolved","innerBlocks","isMissing","area","select","getEditedEntityRecord","hasFinishedResolution","getBlocks","getEntityArgs","entityRecord","_area","hasResolvedEntity","Object","keys","length","templateParts","blockPatterns","hasReplacements","areaObject","blockProps","isPlaceholder","isEntityAvailable","TagName","canReplace","createElement","Fragment","uniqueId","defaultWrapper","hasInnerBlocks","onOpenSelectionModal","onClick","maximumLength","postId","overlayClassName","title","label","toLowerCase","onRequestClose","isFullScreen","onClose"],"sources":["@wordpress/block-library/src/template-part/edit/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tBlockTitle,\n\tuseBlockProps,\n\tWarning,\n\tstore as blockEditorStore,\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentalUseHasRecursion as useHasRecursion,\n} from '@wordpress/block-editor';\nimport { Spinner, Modal, MenuItem } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, createInterpolateElement } from '@wordpress/element';\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\nexport default function TemplatePartEdit( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tisSelected,\n} ) {\n\tconst { slug, theme, tagName, layout = {} } = attributes;\n\tconst templatePartId = createTemplatePartId( theme, slug );\n\tconst hasAlreadyRendered = useHasRecursion( templatePartId );\n\tconst [ isTemplatePartSelectionOpen, setIsTemplatePartSelectionOpen ] =\n\t\tuseState( false );\n\n\t// Set the postId block attribute if it did not exist,\n\t// but wait until the inner blocks have loaded to allow\n\t// new edits to trigger this.\n\tconst { isResolved, innerBlocks, isMissing, area } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getBlocks } = 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\treturn {\n\t\t\t\tinnerBlocks: getBlocks( clientId ),\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};\n\t\t},\n\t\t[ templatePartId, attributes.area, clientId ]\n\t);\n\tconst { templateParts } = useAlternativeTemplateParts(\n\t\tarea,\n\t\ttemplatePartId\n\t);\n\tconst blockPatterns = useAlternativeBlockPatterns( area, clientId );\n\tconst hasReplacements = !! templateParts.length || !! blockPatterns.length;\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\t// The `isSelected` check ensures the `BlockSettingsMenuControls` fill\n\t// doesn't render multiple times. The block controls has similar internal check.\n\tconst canReplace =\n\t\tisSelected &&\n\t\tisEntityAvailable &&\n\t\thasReplacements &&\n\t\t( area === 'header' || area === 'footer' );\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\tinnerBlocks.length === 0 &&\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<TemplatePartAdvancedControls\n\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\tdefaultWrapper={ areaObject.tagName }\n\t\t\t\t\thasInnerBlocks={ innerBlocks.length > 0 }\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{ canReplace && (\n\t\t\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t\t\t{ () => (\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( true );\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{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t__( 'Replace <BlockTitle />' ),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tBlockTitle: (\n\t\t\t\t\t\t\t\t\t\t\t<BlockTitle\n\t\t\t\t\t\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\t\t\t\t\t\tmaximumLength={ 25 }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t),\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</MenuItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</BlockSettingsMenuControls>\n\t\t\t\t) }\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={ innerBlocks.length > 0 }\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={ true }\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,iBAAiB;AAC3C,SACCC,yBAAyB,EACzBC,UAAU,EACVC,aAAa,EACbC,OAAO,EACPC,KAAK,IAAIC,gBAAgB,EACzBC,+BAA+B,IAAIC,iBAAiB,EACpDC,6BAA6B,IAAIC,eAAe,QAC1C,yBAAyB;AAChC,SAASC,OAAO,EAAEC,KAAK,EAAEC,QAAQ,QAAQ,uBAAuB;AAChE,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASV,KAAK,IAAIW,SAAS,QAAQ,sBAAsB;AACzD,SAASC,QAAQ,EAAEC,wBAAwB,QAAQ,oBAAoB;;AAEvE;AACA;AACA;AACA,OAAOC,uBAAu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,OAAO,EAAG4B,OAAS;IACnBH,UAAU,EAAGA,UAAY;IACzBa,MAAM,EAAGpC,cAAgB;IACzBgC,cAAc,EAAG3B,WAAW,CAACa,MAAM,GAAG,CAAG;IACzCnB,MAAM,EAAGA;EAAQ,CACjB,CACD,EACC,CAAEyB,aAAa,IAAI,CAAEpB,UAAU,IAChCwB,aAAA,CAACF,OAAO;IAAA,GAAMH;EAAU,GACvBK,aAAA,CAACrD,OAAO,MAAE,CACF,CAEQ,CAAC,EAClB2B,2BAA2B,IAC5B0B,aAAA,CAACpD,KAAK;IACL6D,gBAAgB,EAAC,6CAA6C;IAC9DC,KAAK,EAAG3D,OAAO;IACd;IACAD,EAAE,CAAE,aAAc,CAAC,EACnB4C,UAAU,CAACiB,KAAK,CAACC,WAAW,CAAC,CAC9B,CAAG;IACHC,cAAc,EAAGA,CAAA,KAChBtC,8BAA8B,CAAE,KAAM,CACtC;IACDuC,YAAY,EAAG;EAAM,GAErBd,aAAA,CAAC5C,0BAA0B;IAC1BgB,cAAc,EAAGA,cAAgB;IACjCN,QAAQ,EAAGA,QAAU;IACrBa,IAAI,EAAGA,IAAM;IACbd,aAAa,EAAGA,aAAe;IAC/BkD,OAAO,EAAGA,CAAA,KACTxC,8BAA8B,CAAE,KAAM;EACtC,CACD,CACK,CAEP,CAAC;AAEL"}
|
|
1
|
+
{"version":3,"names":["useSelect","BlockSettingsMenuControls","BlockTitle","useBlockProps","Warning","store","blockEditorStore","__experimentalRecursionProvider","RecursionProvider","__experimentalUseHasRecursion","useHasRecursion","Spinner","Modal","MenuItem","__","sprintf","coreStore","useState","createInterpolateElement","TemplatePartPlaceholder","TemplatePartSelectionModal","TemplatePartAdvancedControls","TemplatePartInnerBlocks","createTemplatePartId","useAlternativeBlockPatterns","useAlternativeTemplateParts","useTemplatePartArea","TemplatePartEdit","attributes","setAttributes","clientId","slug","theme","tagName","layout","templatePartId","hasAlreadyRendered","isTemplatePartSelectionOpen","setIsTemplatePartSelectionOpen","isResolved","innerBlocks","isMissing","area","select","getEditedEntityRecord","hasFinishedResolution","getBlocks","getEntityArgs","entityRecord","_area","hasResolvedEntity","Object","keys","length","templateParts","blockPatterns","hasReplacements","areaObject","blockProps","isPlaceholder","isEntityAvailable","TagName","canReplace","createElement","Fragment","uniqueId","defaultWrapper","hasInnerBlocks","onOpenSelectionModal","selectedClientIds","onClick","maximumLength","postId","overlayClassName","title","label","toLowerCase","onRequestClose","isFullScreen","onClose"],"sources":["@wordpress/block-library/src/template-part/edit/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tBlockTitle,\n\tuseBlockProps,\n\tWarning,\n\tstore as blockEditorStore,\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentalUseHasRecursion as useHasRecursion,\n} from '@wordpress/block-editor';\nimport { Spinner, Modal, MenuItem } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, createInterpolateElement } from '@wordpress/element';\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\nexport default function TemplatePartEdit( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n} ) {\n\tconst { slug, theme, tagName, layout = {} } = attributes;\n\tconst templatePartId = createTemplatePartId( theme, slug );\n\tconst hasAlreadyRendered = useHasRecursion( templatePartId );\n\tconst [ isTemplatePartSelectionOpen, setIsTemplatePartSelectionOpen ] =\n\t\tuseState( false );\n\n\t// Set the postId block attribute if it did not exist,\n\t// but wait until the inner blocks have loaded to allow\n\t// new edits to trigger this.\n\tconst { isResolved, innerBlocks, isMissing, area } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getBlocks } = 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\treturn {\n\t\t\t\tinnerBlocks: getBlocks( clientId ),\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};\n\t\t},\n\t\t[ templatePartId, attributes.area, clientId ]\n\t);\n\tconst { templateParts } = useAlternativeTemplateParts(\n\t\tarea,\n\t\ttemplatePartId\n\t);\n\tconst blockPatterns = useAlternativeBlockPatterns( area, clientId );\n\tconst hasReplacements = !! templateParts.length || !! blockPatterns.length;\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 canReplace =\n\t\tisEntityAvailable &&\n\t\thasReplacements &&\n\t\t( area === 'header' || area === 'footer' );\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\tinnerBlocks.length === 0 &&\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<TemplatePartAdvancedControls\n\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\tdefaultWrapper={ areaObject.tagName }\n\t\t\t\t\thasInnerBlocks={ innerBlocks.length > 0 }\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{ canReplace && (\n\t\t\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t\t\t{ ( { selectedClientIds } ) => {\n\t\t\t\t\t\t\t// Only enable for single selection that matches the current block.\n\t\t\t\t\t\t\t// Ensures menu item doesn't render multiple times.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t! (\n\t\t\t\t\t\t\t\t\tselectedClientIds.length === 1 &&\n\t\t\t\t\t\t\t\t\tclientId === selectedClientIds[ 0 ]\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\treturn null;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( true );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\taria-expanded={\n\t\t\t\t\t\t\t\t\t\tisTemplatePartSelectionOpen\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t\t__( 'Replace <BlockTitle />' ),\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tBlockTitle: (\n\t\t\t\t\t\t\t\t\t\t\t\t<BlockTitle\n\t\t\t\t\t\t\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\t\t\t\t\t\t\tmaximumLength={ 25 }\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t</BlockSettingsMenuControls>\n\t\t\t\t) }\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={ innerBlocks.length > 0 }\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={ true }\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,iBAAiB;AAC3C,SACCC,yBAAyB,EACzBC,UAAU,EACVC,aAAa,EACbC,OAAO,EACPC,KAAK,IAAIC,gBAAgB,EACzBC,+BAA+B,IAAIC,iBAAiB,EACpDC,6BAA6B,IAAIC,eAAe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,KAAM;EACtC,CACD,CACK,CAEP,CAAC;AAEL"}
|
|
@@ -2589,7 +2589,8 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
|
|
|
2589
2589
|
padding-left: 8px;
|
|
2590
2590
|
}
|
|
2591
2591
|
|
|
2592
|
-
.wp-block[data-align=center] > .wp-block-social-links
|
|
2592
|
+
.wp-block[data-align=center] > .wp-block-social-links,
|
|
2593
|
+
.wp-block.wp-block-social-links.aligncenter {
|
|
2593
2594
|
justify-content: center;
|
|
2594
2595
|
}
|
|
2595
2596
|
|
package/build-style/editor.css
CHANGED
|
@@ -2597,7 +2597,8 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
|
|
|
2597
2597
|
padding-right: 8px;
|
|
2598
2598
|
}
|
|
2599
2599
|
|
|
2600
|
-
.wp-block[data-align=center] > .wp-block-social-links
|
|
2600
|
+
.wp-block[data-align=center] > .wp-block-social-links,
|
|
2601
|
+
.wp-block.wp-block-social-links.aligncenter {
|
|
2601
2602
|
justify-content: center;
|
|
2602
2603
|
}
|
|
2603
2604
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "8.17.
|
|
3
|
+
"version": "8.17.1",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -31,36 +31,36 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.16.0",
|
|
34
|
-
"@wordpress/a11y": "^3.40.
|
|
35
|
-
"@wordpress/api-fetch": "^6.37.
|
|
36
|
-
"@wordpress/autop": "^3.40.
|
|
37
|
-
"@wordpress/blob": "^3.40.
|
|
38
|
-
"@wordpress/block-editor": "^12.8.
|
|
39
|
-
"@wordpress/blocks": "^12.17.
|
|
40
|
-
"@wordpress/components": "^25.6.
|
|
41
|
-
"@wordpress/compose": "^6.17.
|
|
42
|
-
"@wordpress/core-data": "^6.17.
|
|
43
|
-
"@wordpress/data": "^9.10.
|
|
44
|
-
"@wordpress/date": "^4.40.
|
|
45
|
-
"@wordpress/deprecated": "^3.40.
|
|
46
|
-
"@wordpress/dom": "^3.40.
|
|
47
|
-
"@wordpress/element": "^5.17.
|
|
48
|
-
"@wordpress/escape-html": "^2.40.
|
|
49
|
-
"@wordpress/hooks": "^3.40.
|
|
50
|
-
"@wordpress/html-entities": "^3.40.
|
|
51
|
-
"@wordpress/i18n": "^4.40.
|
|
52
|
-
"@wordpress/icons": "^9.31.
|
|
53
|
-
"@wordpress/interactivity": "^2.1.
|
|
54
|
-
"@wordpress/keycodes": "^3.40.
|
|
55
|
-
"@wordpress/notices": "^4.8.
|
|
56
|
-
"@wordpress/primitives": "^3.38.
|
|
57
|
-
"@wordpress/private-apis": "^0.22.
|
|
58
|
-
"@wordpress/reusable-blocks": "^4.17.
|
|
59
|
-
"@wordpress/rich-text": "^6.17.
|
|
60
|
-
"@wordpress/server-side-render": "^4.17.
|
|
61
|
-
"@wordpress/url": "^3.41.
|
|
62
|
-
"@wordpress/viewport": "^5.17.
|
|
63
|
-
"@wordpress/wordcount": "^3.40.
|
|
34
|
+
"@wordpress/a11y": "^3.40.1",
|
|
35
|
+
"@wordpress/api-fetch": "^6.37.1",
|
|
36
|
+
"@wordpress/autop": "^3.40.1",
|
|
37
|
+
"@wordpress/blob": "^3.40.1",
|
|
38
|
+
"@wordpress/block-editor": "^12.8.1",
|
|
39
|
+
"@wordpress/blocks": "^12.17.1",
|
|
40
|
+
"@wordpress/components": "^25.6.1",
|
|
41
|
+
"@wordpress/compose": "^6.17.1",
|
|
42
|
+
"@wordpress/core-data": "^6.17.1",
|
|
43
|
+
"@wordpress/data": "^9.10.1",
|
|
44
|
+
"@wordpress/date": "^4.40.1",
|
|
45
|
+
"@wordpress/deprecated": "^3.40.1",
|
|
46
|
+
"@wordpress/dom": "^3.40.1",
|
|
47
|
+
"@wordpress/element": "^5.17.1",
|
|
48
|
+
"@wordpress/escape-html": "^2.40.1",
|
|
49
|
+
"@wordpress/hooks": "^3.40.1",
|
|
50
|
+
"@wordpress/html-entities": "^3.40.1",
|
|
51
|
+
"@wordpress/i18n": "^4.40.1",
|
|
52
|
+
"@wordpress/icons": "^9.31.1",
|
|
53
|
+
"@wordpress/interactivity": "^2.1.1",
|
|
54
|
+
"@wordpress/keycodes": "^3.40.1",
|
|
55
|
+
"@wordpress/notices": "^4.8.1",
|
|
56
|
+
"@wordpress/primitives": "^3.38.1",
|
|
57
|
+
"@wordpress/private-apis": "^0.22.1",
|
|
58
|
+
"@wordpress/reusable-blocks": "^4.17.1",
|
|
59
|
+
"@wordpress/rich-text": "^6.17.1",
|
|
60
|
+
"@wordpress/server-side-render": "^4.17.1",
|
|
61
|
+
"@wordpress/url": "^3.41.1",
|
|
62
|
+
"@wordpress/viewport": "^5.17.1",
|
|
63
|
+
"@wordpress/wordcount": "^3.40.1",
|
|
64
64
|
"change-case": "^4.1.2",
|
|
65
65
|
"classnames": "^2.3.1",
|
|
66
66
|
"colord": "^2.7.0",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"publishConfig": {
|
|
80
80
|
"access": "public"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "bb1fbf87bb0f451744530fc6a85de2dff1263bed"
|
|
83
83
|
}
|
package/src/list/edit.js
CHANGED
|
@@ -137,6 +137,7 @@ export default function Edit( { attributes, setAttributes, clientId, style } ) {
|
|
|
137
137
|
marginHorizontal: NATIVE_MARGIN_SPACING,
|
|
138
138
|
renderAppender: false,
|
|
139
139
|
} ),
|
|
140
|
+
__experimentalCaptureToolbars: true,
|
|
140
141
|
} );
|
|
141
142
|
useMigrateOnLoad( attributes, clientId );
|
|
142
143
|
const { ordered, type, reversed, start } = attributes;
|
|
@@ -88,9 +88,9 @@ function render_block_core_post_navigation_link( $attributes, $content ) {
|
|
|
88
88
|
$arrow = $arrow_map[ $attributes['arrow'] ][ $navigation_type ];
|
|
89
89
|
|
|
90
90
|
if ( 'next' === $navigation_type ) {
|
|
91
|
-
$format = '%link
|
|
91
|
+
$format = '%link<span class="wp-block-post-navigation-link__arrow-next is-arrow-' . $attributes['arrow'] . '" aria-hidden="true">' . $arrow . '</span>';
|
|
92
92
|
} else {
|
|
93
|
-
$format = '<span class="wp-block-post-navigation-link__arrow-previous is-arrow-' . $attributes['arrow'] . '" aria-hidden="true">' . $arrow . '</span
|
|
93
|
+
$format = '<span class="wp-block-post-navigation-link__arrow-previous is-arrow-' . $attributes['arrow'] . '" aria-hidden="true">' . $arrow . '</span>%link';
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
package/src/quote/edit.js
CHANGED
|
@@ -87,7 +87,8 @@
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
// Center flex items. This has an equivalent in style.scss.
|
|
90
|
-
.wp-block[data-align="center"] > .wp-block-social-links
|
|
90
|
+
.wp-block[data-align="center"] > .wp-block-social-links,
|
|
91
|
+
.wp-block.wp-block-social-links.aligncenter {
|
|
91
92
|
justify-content: center;
|
|
92
93
|
}
|
|
93
94
|
|
|
@@ -34,7 +34,6 @@ export default function TemplatePartEdit( {
|
|
|
34
34
|
attributes,
|
|
35
35
|
setAttributes,
|
|
36
36
|
clientId,
|
|
37
|
-
isSelected,
|
|
38
37
|
} ) {
|
|
39
38
|
const { slug, theme, tagName, layout = {} } = attributes;
|
|
40
39
|
const templatePartId = createTemplatePartId( theme, slug );
|
|
@@ -91,10 +90,7 @@ export default function TemplatePartEdit( {
|
|
|
91
90
|
const isEntityAvailable = ! isPlaceholder && ! isMissing && isResolved;
|
|
92
91
|
const TagName = tagName || areaObject.tagName;
|
|
93
92
|
|
|
94
|
-
// The `isSelected` check ensures the `BlockSettingsMenuControls` fill
|
|
95
|
-
// doesn't render multiple times. The block controls has similar internal check.
|
|
96
93
|
const canReplace =
|
|
97
|
-
isSelected &&
|
|
98
94
|
isEntityAvailable &&
|
|
99
95
|
hasReplacements &&
|
|
100
96
|
( area === 'header' || area === 'footer' );
|
|
@@ -156,25 +152,42 @@ export default function TemplatePartEdit( {
|
|
|
156
152
|
) }
|
|
157
153
|
{ canReplace && (
|
|
158
154
|
<BlockSettingsMenuControls>
|
|
159
|
-
{ () =>
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
155
|
+
{ ( { selectedClientIds } ) => {
|
|
156
|
+
// Only enable for single selection that matches the current block.
|
|
157
|
+
// Ensures menu item doesn't render multiple times.
|
|
158
|
+
if (
|
|
159
|
+
! (
|
|
160
|
+
selectedClientIds.length === 1 &&
|
|
161
|
+
clientId === selectedClientIds[ 0 ]
|
|
162
|
+
)
|
|
163
|
+
) {
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return (
|
|
168
|
+
<MenuItem
|
|
169
|
+
onClick={ () => {
|
|
170
|
+
setIsTemplatePartSelectionOpen( true );
|
|
171
|
+
} }
|
|
172
|
+
aria-expanded={
|
|
173
|
+
isTemplatePartSelectionOpen
|
|
174
174
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
175
|
+
aria-haspopup="dialog"
|
|
176
|
+
>
|
|
177
|
+
{ createInterpolateElement(
|
|
178
|
+
__( 'Replace <BlockTitle />' ),
|
|
179
|
+
{
|
|
180
|
+
BlockTitle: (
|
|
181
|
+
<BlockTitle
|
|
182
|
+
clientId={ clientId }
|
|
183
|
+
maximumLength={ 25 }
|
|
184
|
+
/>
|
|
185
|
+
),
|
|
186
|
+
}
|
|
187
|
+
) }
|
|
188
|
+
</MenuItem>
|
|
189
|
+
);
|
|
190
|
+
} }
|
|
178
191
|
</BlockSettingsMenuControls>
|
|
179
192
|
) }
|
|
180
193
|
{ isEntityAvailable && (
|
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.es2022.d.ts","../../node_modules/typescript/lib/lib.es2023.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../node_modules/typescript/lib/lib.es2023.array.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","./src/table-of-contents/utils.ts","../../node_modules/@types/react/global.d.ts","../../node_modules/csstype/index.d.ts","../../node_modules/@types/prop-types/index.d.ts","../../node_modules/@types/scheduler/tracing.d.ts","../../node_modules/@types/react/index.d.ts","../element/build-types/react.d.ts","../element/build-types/create-interpolate-element.d.ts","../../node_modules/@types/react-dom/index.d.ts","../../node_modules/@types/react-dom/client.d.ts","../element/build-types/react-platform.d.ts","../element/build-types/utils.d.ts","../element/build-types/platform.d.ts","../element/build-types/serialize.d.ts","../element/build-types/raw-html.d.ts","../element/build-types/index.d.ts","./src/table-of-contents/list.tsx","../../typings/gutenberg-env/index.d.ts"],"fileInfos":[{"version":"f59215c5f1d886b05395ee7aca73e0ac69ddfad2843aa88530e797879d511bad","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","dc48272d7c333ccf58034c0026162576b7d50ea0e69c3b9292f803fc20720fd5","27147504487dc1159369da4f4da8a26406364624fa9bc3db632f7d94a5bae2c3","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","5514e54f17d6d74ecefedc73c504eadffdeda79c7ea205cf9febead32d45c4bc","f4e736d6c8d69ae5b3ab0ddfcaa3dc365c3e76909d6660af5b4e979b3934ac20","eeeb3aca31fbadef8b82502484499dfd1757204799a6f5b33116201c810676ec",{"version":"3dda5344576193a4ae48b8d03f105c86f20b2f2aff0a1d1fd7935f5d68649654","affectsGlobalScope":true},{"version":"9d9885c728913c1d16e0d2831b40341d6ad9a0ceecaabc55209b306ad9c736a5","affectsGlobalScope":true},{"version":"17bea081b9c0541f39dd1ae9bc8c78bdd561879a682e60e2f25f688c0ecab248","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"ab22100fdd0d24cfc2cc59d0a00fc8cf449830d9c4030dc54390a46bd562e929","affectsGlobalScope":true},{"version":"f7bd636ae3a4623c503359ada74510c4005df5b36de7f23e1db8a5c543fd176b","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"0c20f4d2358eb679e4ae8a4432bdd96c857a2960fd6800b21ec4008ec59d60ea","affectsGlobalScope":true},{"version":"36ae84ccc0633f7c0787bc6108386c8b773e95d3b052d9464a99cd9b8795fbec","affectsGlobalScope":true},{"version":"82d0d8e269b9eeac02c3bd1c9e884e85d483fcb2cd168bccd6bc54df663da031","affectsGlobalScope":true},{"version":"b8deab98702588840be73d67f02412a2d45a417a3c097b2e96f7f3a42ac483d1","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"376d554d042fb409cb55b5cbaf0b2b4b7e669619493c5d18d5fa8bd67273f82a","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"c4138a3dd7cd6cf1f363ca0f905554e8d81b45844feea17786cdf1626cb8ea06","affectsGlobalScope":true},{"version":"6ff3e2452b055d8f0ec026511c6582b55d935675af67cdb67dd1dc671e8065df","affectsGlobalScope":true},{"version":"03de17b810f426a2f47396b0b99b53a82c1b60e9cba7a7edda47f9bb077882f4","affectsGlobalScope":true},{"version":"8184c6ddf48f0c98429326b428478ecc6143c27f79b79e85740f17e6feb090f1","affectsGlobalScope":true},{"version":"261c4d2cf86ac5a89ad3fb3fafed74cbb6f2f7c1d139b0540933df567d64a6ca","affectsGlobalScope":true},{"version":"6af1425e9973f4924fca986636ac19a0cf9909a7e0d9d3009c349e6244e957b6","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"15a630d6817718a2ddd7088c4f83e4673fde19fa992d2eae2cf51132a302a5d3","affectsGlobalScope":true},{"version":"f06948deb2a51aae25184561c9640fb66afeddb34531a9212d011792b1d19e0a","affectsGlobalScope":true},{"version":"01e0ee7e1f661acedb08b51f8a9b7d7f959e9cdb6441360f06522cc3aea1bf2e","affectsGlobalScope":true},{"version":"ac17a97f816d53d9dd79b0d235e1c0ed54a8cc6a0677e9a3d61efb480b2a3e4e","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"ec0104fee478075cb5171e5f4e3f23add8e02d845ae0165bfa3f1099241fa2aa","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"9cc66b0513ad41cb5f5372cca86ef83a0d37d1c1017580b7dace3ea5661836df","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"709efdae0cb5df5f49376cde61daacc95cdd44ae4671da13a540da5088bf3f30","affectsGlobalScope":true},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true},{"version":"61ed9b6d07af959e745fb11f9593ecd743b279418cc8a99448ea3cd5f3b3eb22","affectsGlobalScope":true},{"version":"038a2f66a34ee7a9c2fbc3584c8ab43dff2995f8c68e3f566f4c300d2175e31e","affectsGlobalScope":true},{"version":"4fa6ed14e98aa80b91f61b9805c653ee82af3502dc21c9da5268d3857772ca05","affectsGlobalScope":true},{"version":"f5c92f2c27b06c1a41b88f6db8299205aee52c2a2943f7ed29bd585977f254e8","affectsGlobalScope":true},{"version":"930b0e15811f84e203d3c23508674d5ded88266df4b10abee7b31b2ac77632d2","affectsGlobalScope":true},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true},{"version":"b9ea5778ff8b50d7c04c9890170db34c26a5358cccba36844fe319f50a43a61a","affectsGlobalScope":true},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true},{"version":"50d53ccd31f6667aff66e3d62adf948879a3a16f05d89882d1188084ee415bbc","affectsGlobalScope":true},{"version":"25de46552b782d43cb7284df22fe2a265de387cf0248b747a7a1b647d81861f6","affectsGlobalScope":true},{"version":"307c8b7ebbd7f23a92b73a4c6c0a697beca05b06b036c23a34553e5fe65e4fdc","affectsGlobalScope":true},{"version":"189c0703923150aa30673fa3de411346d727cc44a11c75d05d7cf9ef095daa22","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},{"version":"c19a5ece4a6877a6afa5e1a9608c3051f9da73e73bcc164386812ef6d5e5f227","signature":"e7b4b5c0a59ac1a764508530d412e75eb0c2867b35a7bc40aac5553b66db508c"},{"version":"bbdf156fea2fabed31a569445835aeedcc33643d404fcbaa54541f06c109df3f","affectsGlobalScope":true},"4c68749a564a6facdf675416d75789ee5a557afda8960e0803cf6711fa569288","f7b46d22a307739c145e5fddf537818038fdfffd580d79ed717f4d4d37249380","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"5917af4ff931b050dba49a1dedd9c00f15f7b3dc4345ad8491bfacd2ec68ed32","affectsGlobalScope":true},"dafd74bcff368ce1a07ee99d42fe2f8868743ae46fd47208eebd7c8ba8bbff86","9448cecc866cbdbe522f6152b6645e3e36aaee8f276d04e6c8bed83193b12c73","e4dd91dd4789a109aab51d8a0569a282369fcda9ba6f2b2297bc61bacfb1a042","83e27bbd7304ea67f9afa1535f1d4fdb15866089f0d893c784cbb5b1c6fb3386","472c14cdec534a465e866b6e1feee2d4e0d89c15fdc33ba80ff034fa0e80f3c1","4d807d55c784b72f71c092c34c84d09b95c29500c30252538fd5cf9a0a788c0e","df43a3968118d4b16618d7a0ac8ba89337fcce3c39e39984087ac34bf0cf250c","69ae15cf7f64219db1d1585f0ec791ee14b48d07e4fb453e80137b84e0a8c3a0","582f001c48a6204fd6bb5c6c71b36adc5256078c0ac3686b99db59cbb724ca73","af88a0b0f808a6721401550621bfe67c46c6fd55000305058e7c73600d119a9b",{"version":"6a32e965fda149787817aefc75730a8d028cac8c8f15af547214e009c2c55172","signature":"d83c7f4886a9400a0f94be86990a33283bcb4ae54d7289f548c40a6842623dc7"},{"version":"084d8b571b1e8b984824263889aabc2c37d29b49f7cbab3e4ebd05e4c02891eb","affectsGlobalScope":true}],"root":[61,77],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"rootDir":"./src","strict":true,"strictNullChecks":true,"target":99},"fileIdsList":[[66],[62,63,64,65],[61,76],[67],[67,68,71,72,73,74,75],[69,70],[66,67]],"referencedMap":[[70,1],[69,1],[66,2],[77,3],[68,4],[76,5],[75,1],[71,6],[67,1],[74,7]],"exportedModulesMap":[[70,1],[69,1],[66,2],[77,3],[68,4],[76,5],[75,1],[71,6],[67,1],[74,7]],"semanticDiagnosticsPerFile":[64,70,69,62,66,65,63,59,60,12,14,13,2,15,16,17,18,19,20,21,22,3,4,26,23,24,25,27,28,29,5,30,31,32,33,6,37,34,35,36,38,7,39,44,45,40,41,42,43,8,49,46,47,48,50,9,51,52,53,56,54,55,57,10,1,11,58,77,61,68,76,73,75,71,67,74,72,78],"latestChangedDtsFile":"./build-types/table-of-contents/list.d.ts"},"version":"5.1.6"}
|
|
1
|
+
{"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.es2022.d.ts","../../node_modules/typescript/lib/lib.es2023.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../node_modules/typescript/lib/lib.es2023.array.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","./src/table-of-contents/utils.ts","../../node_modules/@types/react/global.d.ts","../../node_modules/csstype/index.d.ts","../../node_modules/@types/prop-types/index.d.ts","../../node_modules/@types/scheduler/tracing.d.ts","../../node_modules/@types/react/index.d.ts","../element/build-types/react.d.ts","../element/build-types/create-interpolate-element.d.ts","../../node_modules/@types/react-dom/index.d.ts","../../node_modules/@types/react-dom/client.d.ts","../element/build-types/react-platform.d.ts","../element/build-types/utils.d.ts","../element/build-types/platform.d.ts","../element/build-types/serialize.d.ts","../element/build-types/raw-html.d.ts","../element/build-types/index.d.ts","./src/table-of-contents/list.tsx","../../typings/gutenberg-env/index.d.ts"],"fileInfos":[{"version":"f59215c5f1d886b05395ee7aca73e0ac69ddfad2843aa88530e797879d511bad","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","dc48272d7c333ccf58034c0026162576b7d50ea0e69c3b9292f803fc20720fd5","27147504487dc1159369da4f4da8a26406364624fa9bc3db632f7d94a5bae2c3","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","5514e54f17d6d74ecefedc73c504eadffdeda79c7ea205cf9febead32d45c4bc","f4e736d6c8d69ae5b3ab0ddfcaa3dc365c3e76909d6660af5b4e979b3934ac20","eeeb3aca31fbadef8b82502484499dfd1757204799a6f5b33116201c810676ec",{"version":"3dda5344576193a4ae48b8d03f105c86f20b2f2aff0a1d1fd7935f5d68649654","affectsGlobalScope":true},{"version":"9d9885c728913c1d16e0d2831b40341d6ad9a0ceecaabc55209b306ad9c736a5","affectsGlobalScope":true},{"version":"17bea081b9c0541f39dd1ae9bc8c78bdd561879a682e60e2f25f688c0ecab248","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"ab22100fdd0d24cfc2cc59d0a00fc8cf449830d9c4030dc54390a46bd562e929","affectsGlobalScope":true},{"version":"f7bd636ae3a4623c503359ada74510c4005df5b36de7f23e1db8a5c543fd176b","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"0c20f4d2358eb679e4ae8a4432bdd96c857a2960fd6800b21ec4008ec59d60ea","affectsGlobalScope":true},{"version":"36ae84ccc0633f7c0787bc6108386c8b773e95d3b052d9464a99cd9b8795fbec","affectsGlobalScope":true},{"version":"82d0d8e269b9eeac02c3bd1c9e884e85d483fcb2cd168bccd6bc54df663da031","affectsGlobalScope":true},{"version":"b8deab98702588840be73d67f02412a2d45a417a3c097b2e96f7f3a42ac483d1","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"376d554d042fb409cb55b5cbaf0b2b4b7e669619493c5d18d5fa8bd67273f82a","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"c4138a3dd7cd6cf1f363ca0f905554e8d81b45844feea17786cdf1626cb8ea06","affectsGlobalScope":true},{"version":"6ff3e2452b055d8f0ec026511c6582b55d935675af67cdb67dd1dc671e8065df","affectsGlobalScope":true},{"version":"03de17b810f426a2f47396b0b99b53a82c1b60e9cba7a7edda47f9bb077882f4","affectsGlobalScope":true},{"version":"8184c6ddf48f0c98429326b428478ecc6143c27f79b79e85740f17e6feb090f1","affectsGlobalScope":true},{"version":"261c4d2cf86ac5a89ad3fb3fafed74cbb6f2f7c1d139b0540933df567d64a6ca","affectsGlobalScope":true},{"version":"6af1425e9973f4924fca986636ac19a0cf9909a7e0d9d3009c349e6244e957b6","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"15a630d6817718a2ddd7088c4f83e4673fde19fa992d2eae2cf51132a302a5d3","affectsGlobalScope":true},{"version":"f06948deb2a51aae25184561c9640fb66afeddb34531a9212d011792b1d19e0a","affectsGlobalScope":true},{"version":"01e0ee7e1f661acedb08b51f8a9b7d7f959e9cdb6441360f06522cc3aea1bf2e","affectsGlobalScope":true},{"version":"ac17a97f816d53d9dd79b0d235e1c0ed54a8cc6a0677e9a3d61efb480b2a3e4e","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"ec0104fee478075cb5171e5f4e3f23add8e02d845ae0165bfa3f1099241fa2aa","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"9cc66b0513ad41cb5f5372cca86ef83a0d37d1c1017580b7dace3ea5661836df","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"709efdae0cb5df5f49376cde61daacc95cdd44ae4671da13a540da5088bf3f30","affectsGlobalScope":true},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true},{"version":"61ed9b6d07af959e745fb11f9593ecd743b279418cc8a99448ea3cd5f3b3eb22","affectsGlobalScope":true},{"version":"038a2f66a34ee7a9c2fbc3584c8ab43dff2995f8c68e3f566f4c300d2175e31e","affectsGlobalScope":true},{"version":"4fa6ed14e98aa80b91f61b9805c653ee82af3502dc21c9da5268d3857772ca05","affectsGlobalScope":true},{"version":"f5c92f2c27b06c1a41b88f6db8299205aee52c2a2943f7ed29bd585977f254e8","affectsGlobalScope":true},{"version":"930b0e15811f84e203d3c23508674d5ded88266df4b10abee7b31b2ac77632d2","affectsGlobalScope":true},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true},{"version":"b9ea5778ff8b50d7c04c9890170db34c26a5358cccba36844fe319f50a43a61a","affectsGlobalScope":true},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true},{"version":"50d53ccd31f6667aff66e3d62adf948879a3a16f05d89882d1188084ee415bbc","affectsGlobalScope":true},{"version":"25de46552b782d43cb7284df22fe2a265de387cf0248b747a7a1b647d81861f6","affectsGlobalScope":true},{"version":"307c8b7ebbd7f23a92b73a4c6c0a697beca05b06b036c23a34553e5fe65e4fdc","affectsGlobalScope":true},{"version":"189c0703923150aa30673fa3de411346d727cc44a11c75d05d7cf9ef095daa22","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},{"version":"c19a5ece4a6877a6afa5e1a9608c3051f9da73e73bcc164386812ef6d5e5f227","signature":"e7b4b5c0a59ac1a764508530d412e75eb0c2867b35a7bc40aac5553b66db508c"},{"version":"bbdf156fea2fabed31a569445835aeedcc33643d404fcbaa54541f06c109df3f","affectsGlobalScope":true},"4c68749a564a6facdf675416d75789ee5a557afda8960e0803cf6711fa569288","f7b46d22a307739c145e5fddf537818038fdfffd580d79ed717f4d4d37249380","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"5917af4ff931b050dba49a1dedd9c00f15f7b3dc4345ad8491bfacd2ec68ed32","affectsGlobalScope":true},"dafd74bcff368ce1a07ee99d42fe2f8868743ae46fd47208eebd7c8ba8bbff86","9448cecc866cbdbe522f6152b6645e3e36aaee8f276d04e6c8bed83193b12c73","e4dd91dd4789a109aab51d8a0569a282369fcda9ba6f2b2297bc61bacfb1a042","83e27bbd7304ea67f9afa1535f1d4fdb15866089f0d893c784cbb5b1c6fb3386","472c14cdec534a465e866b6e1feee2d4e0d89c15fdc33ba80ff034fa0e80f3c1","4d807d55c784b72f71c092c34c84d09b95c29500c30252538fd5cf9a0a788c0e","df43a3968118d4b16618d7a0ac8ba89337fcce3c39e39984087ac34bf0cf250c","69ae15cf7f64219db1d1585f0ec791ee14b48d07e4fb453e80137b84e0a8c3a0","582f001c48a6204fd6bb5c6c71b36adc5256078c0ac3686b99db59cbb724ca73","af88a0b0f808a6721401550621bfe67c46c6fd55000305058e7c73600d119a9b",{"version":"6a32e965fda149787817aefc75730a8d028cac8c8f15af547214e009c2c55172","signature":"d83c7f4886a9400a0f94be86990a33283bcb4ae54d7289f548c40a6842623dc7"},{"version":"94ec7f91d2d32a624e5b59ecb9ab5b7e9e8d848507888f067e14b9dcd6f19a76","affectsGlobalScope":true}],"root":[61,77],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"rootDir":"./src","strict":true,"strictNullChecks":true,"target":99},"fileIdsList":[[66],[62,63,64,65],[61,76],[67],[67,68,71,72,73,74,75],[69,70],[66,67]],"referencedMap":[[70,1],[69,1],[66,2],[77,3],[68,4],[76,5],[75,1],[71,6],[67,1],[74,7]],"exportedModulesMap":[[70,1],[69,1],[66,2],[77,3],[68,4],[76,5],[75,1],[71,6],[67,1],[74,7]],"semanticDiagnosticsPerFile":[64,70,69,62,66,65,63,59,60,12,14,13,2,15,16,17,18,19,20,21,22,3,4,26,23,24,25,27,28,29,5,30,31,32,33,6,37,34,35,36,38,7,39,44,45,40,41,42,43,8,49,46,47,48,50,9,51,52,53,56,54,55,57,10,1,11,58,77,61,68,76,73,75,71,67,74,72,78],"latestChangedDtsFile":"./build-types/table-of-contents/list.d.ts"},"version":"5.1.6"}
|