@wordpress/block-library 9.13.0 → 9.13.1-next.cd6172eb0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/block/edit.js +2 -29
- package/build/block/edit.js.map +1 -1
- package/build/cover/edit/index.js +4 -2
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +6 -4
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/list-item/hooks/use-merge.js +2 -2
- package/build/list-item/hooks/use-merge.js.map +1 -1
- package/build/navigation/edit/deleted-navigation-warning.js +9 -2
- package/build/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build/navigation-submenu/edit.js +3 -0
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/pattern/recursion-detector.js +0 -1
- package/build/pattern/recursion-detector.js.map +1 -1
- package/build/query/edit/index.js +2 -2
- package/build/query/edit/index.js.map +1 -1
- package/build/query/edit/inspector-controls/author-control.js +0 -1
- package/build/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build/query/edit/inspector-controls/parent-control.js +0 -1
- package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js +0 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build/query/edit/{pattern-selection-modal.js → pattern-selection.js} +55 -36
- package/build/query/edit/pattern-selection.js.map +1 -0
- package/build/query/edit/query-content.js +5 -8
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query/edit/query-placeholder.js +5 -11
- package/build/query/edit/query-placeholder.js.map +1 -1
- package/build/query/edit/query-toolbar.js +31 -11
- package/build/query/edit/query-toolbar.js.map +1 -1
- package/build/separator/deprecated.js +2 -1
- package/build/separator/deprecated.js.map +1 -1
- package/build/separator/edit.js +29 -4
- package/build/separator/edit.js.map +1 -1
- package/build/separator/index.js +5 -0
- package/build/separator/index.js.map +1 -1
- package/build/separator/save.js +3 -2
- package/build/separator/save.js.map +1 -1
- package/build/template-part/edit/import-controls.js +0 -1
- package/build/template-part/edit/import-controls.js.map +1 -1
- package/build-module/block/edit.js +3 -30
- package/build-module/block/edit.js.map +1 -1
- package/build-module/cover/edit/index.js +4 -2
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +6 -4
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/list-item/hooks/use-merge.js +2 -2
- package/build-module/list-item/hooks/use-merge.js.map +1 -1
- package/build-module/navigation/edit/deleted-navigation-warning.js +10 -3
- package/build-module/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +3 -0
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/pattern/recursion-detector.js +0 -1
- package/build-module/pattern/recursion-detector.js.map +1 -1
- package/build-module/query/edit/index.js +1 -1
- package/build-module/query/edit/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/author-control.js +0 -1
- package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/parent-control.js +0 -1
- package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js +0 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build-module/query/edit/{pattern-selection-modal.js → pattern-selection.js} +53 -36
- package/build-module/query/edit/pattern-selection.js.map +1 -0
- package/build-module/query/edit/query-content.js +5 -8
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query/edit/query-placeholder.js +6 -12
- package/build-module/query/edit/query-placeholder.js.map +1 -1
- package/build-module/query/edit/query-toolbar.js +31 -13
- package/build-module/query/edit/query-toolbar.js.map +1 -1
- package/build-module/separator/deprecated.js +2 -1
- package/build-module/separator/deprecated.js.map +1 -1
- package/build-module/separator/edit.js +32 -7
- package/build-module/separator/edit.js.map +1 -1
- package/build-module/separator/index.js +5 -0
- package/build-module/separator/index.js.map +1 -1
- package/build-module/separator/save.js +3 -2
- package/build-module/separator/save.js.map +1 -1
- package/build-module/template-part/edit/import-controls.js +0 -1
- package/build-module/template-part/edit/import-controls.js.map +1 -1
- package/build-style/comments-pagination/editor-rtl.css +1 -0
- package/build-style/comments-pagination/editor.css +1 -0
- package/build-style/comments-pagination/style-rtl.css +1 -0
- package/build-style/comments-pagination/style.css +1 -0
- package/build-style/editor-rtl.css +31 -0
- package/build-style/editor.css +31 -0
- package/build-style/image/style-rtl.css +3 -2
- package/build-style/image/style.css +3 -2
- package/build-style/pullquote/style-rtl.css +1 -0
- package/build-style/pullquote/style.css +1 -0
- package/build-style/query/editor-rtl.css +30 -0
- package/build-style/query/editor.css +30 -0
- package/build-style/style-rtl.css +5 -2
- package/build-style/style.css +5 -2
- package/build-types/lock-unlock.d.ts +1 -1
- package/build-types/lock-unlock.d.ts.map +1 -1
- package/package.json +34 -34
- package/src/block/edit.js +6 -51
- package/src/comments-pagination/editor.scss +1 -0
- package/src/comments-pagination/style.scss +1 -0
- package/src/cover/edit/index.js +4 -1
- package/src/cover/edit/inspector-controls.js +10 -3
- package/src/cover/index.php +2 -2
- package/src/image/style.scss +4 -3
- package/src/list-item/hooks/use-merge.js +2 -2
- package/src/missing/test/edit.native.js +0 -1
- package/src/navigation/README.md +1 -0
- package/src/navigation/edit/deleted-navigation-warning.js +11 -2
- package/src/navigation/index.php +9 -35
- package/src/navigation-submenu/edit.js +5 -0
- package/src/navigation-submenu/index.php +17 -1
- package/src/pullquote/style.scss +1 -0
- package/src/query/edit/index.js +1 -1
- package/src/query/edit/{pattern-selection-modal.js → pattern-selection.js} +53 -33
- package/src/query/edit/query-content.js +4 -10
- package/src/query/edit/query-placeholder.js +5 -14
- package/src/query/edit/query-toolbar.js +38 -17
- package/src/query/editor.scss +30 -0
- package/src/search/index.php +3 -3
- package/src/separator/block.json +5 -0
- package/src/separator/deprecated.js +1 -0
- package/src/separator/edit.js +28 -3
- package/src/separator/save.js +2 -2
- package/src/separator/test/edit.js +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/query/edit/pattern-selection-modal.js.map +0 -1
- package/build-module/query/edit/pattern-selection-modal.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_blockEditor","_useOutdentListItem","_interopRequireDefault","useMerge","clientId","onMerge","registry","useRegistry","getPreviousBlockClientId","getNextBlockClientId","getBlockOrder","getBlockRootClientId","getBlockName","useSelect","blockEditorStore","mergeBlocks","moveBlocksToPosition","useDispatch","outdentListItem","useOutdentListItem","getTrailingId","id","order","length","getParentListItemId","listId","parentListItemId","_getNextId","next","getNextId","forward","mergeWithNested","clientIdA","clientIdB","batch","nestedListClientId","nextBlockClientId","previousBlockClientId","trailingId"],"sources":["@wordpress/block-library/src/list-item/hooks/use-merge.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry, useDispatch, useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport useOutdentListItem from './use-outdent-list-item';\n\nexport default function useMerge( clientId, onMerge ) {\n\tconst registry = useRegistry();\n\tconst {\n\t\tgetPreviousBlockClientId,\n\t\tgetNextBlockClientId,\n\t\tgetBlockOrder,\n\t\tgetBlockRootClientId,\n\t\tgetBlockName,\n\t} = useSelect( blockEditorStore );\n\tconst { mergeBlocks, moveBlocksToPosition } =\n\t\tuseDispatch( blockEditorStore );\n\tconst outdentListItem = useOutdentListItem();\n\n\tfunction getTrailingId( id ) {\n\t\tconst order = getBlockOrder( id );\n\n\t\tif ( ! order.length ) {\n\t\t\treturn id;\n\t\t}\n\n\t\treturn getTrailingId( order[ order.length - 1 ] );\n\t}\n\n\tfunction getParentListItemId( id ) {\n\t\tconst listId = getBlockRootClientId( id );\n\t\tconst parentListItemId = getBlockRootClientId( listId );\n\t\tif ( ! parentListItemId ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( getBlockName( parentListItemId ) !== 'core/list-item' ) {\n\t\t\treturn;\n\t\t}\n\t\treturn parentListItemId;\n\t}\n\n\t/**\n\t * Return the next list item with respect to the given list item. If none,\n\t * return the next list item of the parent list item if it exists.\n\t *\n\t * @param {string} id A list item client ID.\n\t * @return {string
|
|
1
|
+
{"version":3,"names":["_data","require","_blockEditor","_useOutdentListItem","_interopRequireDefault","useMerge","clientId","onMerge","registry","useRegistry","getPreviousBlockClientId","getNextBlockClientId","getBlockOrder","getBlockRootClientId","getBlockName","useSelect","blockEditorStore","mergeBlocks","moveBlocksToPosition","useDispatch","outdentListItem","useOutdentListItem","getTrailingId","id","order","length","getParentListItemId","listId","parentListItemId","_getNextId","next","getNextId","forward","mergeWithNested","clientIdA","clientIdB","batch","nestedListClientId","nextBlockClientId","previousBlockClientId","trailingId"],"sources":["@wordpress/block-library/src/list-item/hooks/use-merge.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry, useDispatch, useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport useOutdentListItem from './use-outdent-list-item';\n\nexport default function useMerge( clientId, onMerge ) {\n\tconst registry = useRegistry();\n\tconst {\n\t\tgetPreviousBlockClientId,\n\t\tgetNextBlockClientId,\n\t\tgetBlockOrder,\n\t\tgetBlockRootClientId,\n\t\tgetBlockName,\n\t} = useSelect( blockEditorStore );\n\tconst { mergeBlocks, moveBlocksToPosition } =\n\t\tuseDispatch( blockEditorStore );\n\tconst outdentListItem = useOutdentListItem();\n\n\tfunction getTrailingId( id ) {\n\t\tconst order = getBlockOrder( id );\n\n\t\tif ( ! order.length ) {\n\t\t\treturn id;\n\t\t}\n\n\t\treturn getTrailingId( order[ order.length - 1 ] );\n\t}\n\n\tfunction getParentListItemId( id ) {\n\t\tconst listId = getBlockRootClientId( id );\n\t\tconst parentListItemId = getBlockRootClientId( listId );\n\t\tif ( ! parentListItemId ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( getBlockName( parentListItemId ) !== 'core/list-item' ) {\n\t\t\treturn;\n\t\t}\n\t\treturn parentListItemId;\n\t}\n\n\t/**\n\t * Return the next list item with respect to the given list item. If none,\n\t * return the next list item of the parent list item if it exists.\n\t *\n\t * @param {string} id A list item client ID.\n\t * @return {?string} The client ID of the next list item.\n\t */\n\tfunction _getNextId( id ) {\n\t\tconst next = getNextBlockClientId( id );\n\t\tif ( next ) {\n\t\t\treturn next;\n\t\t}\n\t\tconst parentListItemId = getParentListItemId( id );\n\t\tif ( ! parentListItemId ) {\n\t\t\treturn;\n\t\t}\n\t\treturn _getNextId( parentListItemId );\n\t}\n\n\t/**\n\t * Given a client ID, return the client ID of the list item on the next\n\t * line, regardless of indentation level.\n\t *\n\t * @param {string} id The client ID of the current list item.\n\t * @return {?string} The client ID of the next list item.\n\t */\n\tfunction getNextId( id ) {\n\t\tconst order = getBlockOrder( id );\n\n\t\t// If the list item does not have a nested list, return the next list\n\t\t// item.\n\t\tif ( ! order.length ) {\n\t\t\treturn _getNextId( id );\n\t\t}\n\n\t\t// Get the first list item in the nested list.\n\t\treturn getBlockOrder( order[ 0 ] )[ 0 ];\n\t}\n\n\treturn ( forward ) => {\n\t\tfunction mergeWithNested( clientIdA, clientIdB ) {\n\t\t\tregistry.batch( () => {\n\t\t\t\t// When merging a sub list item with a higher next list item, we\n\t\t\t\t// also need to move any nested list items. Check if there's a\n\t\t\t\t// listed list, and append its nested list items to the current\n\t\t\t\t// list.\n\t\t\t\tconst [ nestedListClientId ] = getBlockOrder( clientIdB );\n\t\t\t\tif ( nestedListClientId ) {\n\t\t\t\t\t// If we are merging with the previous list item, and the\n\t\t\t\t\t// previous list item does not have nested list, move the\n\t\t\t\t\t// nested list to the previous list item.\n\t\t\t\t\tif (\n\t\t\t\t\t\tgetPreviousBlockClientId( clientIdB ) === clientIdA &&\n\t\t\t\t\t\t! getBlockOrder( clientIdA ).length\n\t\t\t\t\t) {\n\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t[ nestedListClientId ],\n\t\t\t\t\t\t\tclientIdB,\n\t\t\t\t\t\t\tclientIdA\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\tgetBlockOrder( nestedListClientId ),\n\t\t\t\t\t\t\tnestedListClientId,\n\t\t\t\t\t\t\tgetBlockRootClientId( clientIdA )\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmergeBlocks( clientIdA, clientIdB );\n\t\t\t} );\n\t\t}\n\n\t\tif ( forward ) {\n\t\t\tconst nextBlockClientId = getNextId( clientId );\n\n\t\t\tif ( ! nextBlockClientId ) {\n\t\t\t\tonMerge( forward );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( getParentListItemId( nextBlockClientId ) ) {\n\t\t\t\toutdentListItem( nextBlockClientId );\n\t\t\t} else {\n\t\t\t\tmergeWithNested( clientId, nextBlockClientId );\n\t\t\t}\n\t\t} else {\n\t\t\t// Merging is only done from the top level. For lowel levels, the\n\t\t\t// list item is outdented instead.\n\t\t\tconst previousBlockClientId = getPreviousBlockClientId( clientId );\n\t\t\tif ( getParentListItemId( clientId ) ) {\n\t\t\t\toutdentListItem( clientId );\n\t\t\t} else if ( previousBlockClientId ) {\n\t\t\t\tconst trailingId = getTrailingId( previousBlockClientId );\n\t\t\t\tmergeWithNested( trailingId, clientId );\n\t\t\t} else {\n\t\t\t\tonMerge( forward );\n\t\t\t}\n\t\t}\n\t};\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAKA,IAAAE,mBAAA,GAAAC,sBAAA,CAAAH,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGe,SAASI,QAAQA,CAAEC,QAAQ,EAAEC,OAAO,EAAG;EACrD,MAAMC,QAAQ,GAAG,IAAAC,iBAAW,EAAC,CAAC;EAC9B,MAAM;IACLC,wBAAwB;IACxBC,oBA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AC;MAClE,IAAKoB,mBAAmB,CAAEpB,QAAS,CAAC,EAAG;QACtCc,eAAe,CAAEd,QAAS,CAAC;MAC5B,CAAC,MAAM,IAAKiC,qBAAqB,EAAG;QACnC,MAAMC,UAAU,GAAGlB,aAAa,CAAEiB,qBAAsB,CAAC;QACzDN,eAAe,CAAEO,UAAU,EAAElC,QAAS,CAAC;MACxC,CAAC,MAAM;QACNC,OAAO,CAAEyB,OAAQ,CAAC;MACnB;IACD;EACD,CAAC;AACF","ignoreList":[]}
|
|
@@ -17,11 +17,18 @@ function DeletedNavigationWarning({
|
|
|
17
17
|
onCreateNew,
|
|
18
18
|
isNotice = false
|
|
19
19
|
}) {
|
|
20
|
+
const [isButtonDisabled, setIsButtonDisabled] = (0, _element.useState)(false);
|
|
21
|
+
const handleButtonClick = () => {
|
|
22
|
+
setIsButtonDisabled(true);
|
|
23
|
+
onCreateNew();
|
|
24
|
+
};
|
|
20
25
|
const message = (0, _element.createInterpolateElement)((0, _i18n.__)('Navigation Menu has been deleted or is unavailable. <button>Create a new Menu?</button>'), {
|
|
21
26
|
button: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
22
27
|
__next40pxDefaultSize: true,
|
|
23
|
-
onClick:
|
|
24
|
-
variant: "link"
|
|
28
|
+
onClick: handleButtonClick,
|
|
29
|
+
variant: "link",
|
|
30
|
+
disabled: isButtonDisabled,
|
|
31
|
+
accessibleWhenDisabled: true
|
|
25
32
|
})
|
|
26
33
|
});
|
|
27
34
|
return isNotice ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Notice, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blockEditor","require","_components","_i18n","_element","_jsxRuntime","DeletedNavigationWarning","onCreateNew","isNotice","message","createInterpolateElement","__","button","jsx","Button","__next40pxDefaultSize","onClick","variant","Notice","status","isDismissible","children","Warning","_default","exports","default"],"sources":["@wordpress/block-library/src/navigation/edit/deleted-navigation-warning.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Warning } from '@wordpress/block-editor';\nimport { Button, Notice } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { createInterpolateElement } from '@wordpress/element';\n\nfunction DeletedNavigationWarning( { onCreateNew, isNotice = false } ) {\n\tconst message = createInterpolateElement(\n\t\t__(\n\t\t\t'Navigation Menu has been deleted or is unavailable. <button>Create a new Menu?</button>'\n\t\t),\n\t\t{\n\t\t\tbutton: (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tonClick={
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_components","_i18n","_element","_jsxRuntime","DeletedNavigationWarning","onCreateNew","isNotice","isButtonDisabled","setIsButtonDisabled","useState","handleButtonClick","message","createInterpolateElement","__","button","jsx","Button","__next40pxDefaultSize","onClick","variant","disabled","accessibleWhenDisabled","Notice","status","isDismissible","children","Warning","_default","exports","default"],"sources":["@wordpress/block-library/src/navigation/edit/deleted-navigation-warning.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Warning } from '@wordpress/block-editor';\nimport { Button, Notice } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, createInterpolateElement } from '@wordpress/element';\n\nfunction DeletedNavigationWarning( { onCreateNew, isNotice = false } ) {\n\tconst [ isButtonDisabled, setIsButtonDisabled ] = useState( false );\n\n\tconst handleButtonClick = () => {\n\t\tsetIsButtonDisabled( true );\n\t\tonCreateNew();\n\t};\n\n\tconst message = createInterpolateElement(\n\t\t__(\n\t\t\t'Navigation Menu has been deleted or is unavailable. <button>Create a new Menu?</button>'\n\t\t),\n\t\t{\n\t\t\tbutton: (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tonClick={ handleButtonClick }\n\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\tdisabled={ isButtonDisabled }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t/>\n\t\t\t),\n\t\t}\n\t);\n\n\treturn isNotice ? (\n\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t{ message }\n\t\t</Notice>\n\t) : (\n\t\t<Warning>{ message }</Warning>\n\t);\n}\n\nexport default DeletedNavigationWarning;\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAAwE,IAAAI,WAAA,GAAAJ,OAAA;AANxE;AACA;AACA;;AAMA,SAASK,wBAAwBA,CAAE;EAAEC,WAAW;EAAEC,QAAQ,GAAG;AAAM,CAAC,EAAG;EACtE,MAAM,CAAEC,gBAAgB,EAAEC,mBAAmB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EAEnE,MAAMC,iBAAiB,GAAGA,CAAA,KAAM;IAC/BF,mBAAmB,CAAE,IAAK,CAAC;IAC3BH,WAAW,CAAC,CAAC;EACd,CAAC;EAED,MAAMM,OAAO,GAAG,IAAAC,iCAAwB,EACvC,IAAAC,QAAE,EACD,yFACD,CAAC,EACD;IACCC,MAAM,eACL,IAAAX,WAAA,CAAAY,GAAA,EAACf,WAAA,CAAAgB,MAAM;MACNC,qBAAqB;MACrBC,OAAO,EAAGR,iBAAmB;MAC7BS,OAAO,EAAC,MAAM;MACdC,QAAQ,EAAGb,gBAAkB;MAC7Bc,sBAAsB;IAAA,CACtB;EAEH,CACD,CAAC;EAED,OAAOf,QAAQ,gBACd,IAAAH,WAAA,CAAAY,GAAA,EAACf,WAAA,CAAAsB,MAAM;IAACC,MAAM,EAAC,SAAS;IAACC,aAAa,EAAG,KAAO;IAAAC,QAAA,EAC7Cd;EAAO,CACF,CAAC,gBAET,IAAAR,WAAA,CAAAY,GAAA,EAACjB,YAAA,CAAA4B,OAAO;IAAAD,QAAA,EAAGd;EAAO,CAAW,CAC7B;AACF;AAAC,IAAAgB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEczB,wBAAwB","ignoreList":[]}
|
|
@@ -404,6 +404,9 @@ function NavigationSubmenuEdit({
|
|
|
404
404
|
setOpenedBy(ref.current);
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
|
+
}), description && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
408
|
+
className: "wp-block-navigation-item__description",
|
|
409
|
+
children: description
|
|
407
410
|
}), !openSubmenusOnClick && isLinkOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_linkUi.LinkUI, {
|
|
408
411
|
clientId: clientId,
|
|
409
412
|
link: attributes,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_data","_components","_keycodes","_i18n","_blockEditor","_url","_element","_icons","_a11y","_blocks","_compose","_icons2","_linkUi","_updateAttributes","_utils","_jsxRuntime","ALLOWED_BLOCKS","DEFAULT_BLOCK","name","useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","useState","useEffect","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","NavigationSubmenuEdit","attributes","isSelected","setAttributes","mergeBlocks","onReplace","context","clientId","label","url","description","rel","title","showSubmenuIcon","maxNestingLevel","openSubmenusOnClick","__unstableMarkNextChangeAsNotPersistent","replaceBlock","selectBlock","useDispatch","blockEditorStore","isLinkOpen","setIsLinkOpen","openedBy","setOpenedBy","popoverAnchor","setPopoverAnchor","listItemRef","useRef","itemLabelPlaceholder","__","ref","parentCount","isParentOfSelectedBlock","isImmediateParentOfSelectedBlock","hasChildren","selectedBlockHasChildren","onlyDescendantIsEmptyLink","useSelect","select","hasSelectedInnerBlock","getSelectedBlockClientId","getBlockParentsByBlockName","getBlock","getBlockCount","getBlockOrder","_onlyDescendantIsEmptyLink","selectedBlockId","selectedBlockChildren","length","singleBlock","prevHasChildren","usePrevious","isURL","prependHTTP","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","textColor","customTextColor","backgroundColor","customBackgroundColor","getColors","onKeyDown","isKeyboardEvent","primary","preventDefault","stopPropagation","blockProps","useBlockProps","useMergeRefs","className","clsx","getColorClassName","style","color","innerBlocksColors","allowedBlocks","filter","blockName","navigationChildBlockProps","getNavigationChildBlockProps","innerBlocksProps","useInnerBlocksProps","defaultBlock","directInsert","__experimentalCaptureToolbars","renderAppender","InnerBlocks","ButtonBlockAppender","ParentElement","transformToLink","newLinkBlock","createBlock","canConvertToLink","jsxs","Fragment","children","jsx","BlockControls","ToolbarGroup","ToolbarButton","icon","linkIcon","shortcut","displayShortcut","onClick","currentTarget","removeSubmenu","disabled","InspectorControls","PanelBody","TextControl","__nextHasNoMarginBottom","__next40pxDefaultSize","value","onChange","labelValue","autoComplete","urlValue","TextareaControl","descriptionValue","help","titleValue","relValue","RichText","identifier","onMerge","placeholder","withoutInteractiveFormatting","allowedFormats","LinkUI","link","onClose","anchor","onRemove","speak","updatedValue","updateAttributes","ItemSubmenuIcon"],"sources":["@wordpress/block-library/src/navigation-submenu/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tTextControl,\n\tTextareaControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tInnerBlocks,\n\tuseInnerBlocksProps,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tgetColorClassName,\n} from '@wordpress/block-editor';\nimport { isURL, prependHTTP } from '@wordpress/url';\nimport { useState, useEffect, useRef } from '@wordpress/element';\nimport { link as linkIcon, removeSubmenu } from '@wordpress/icons';\nimport { speak } from '@wordpress/a11y';\nimport { createBlock } from '@wordpress/blocks';\nimport { useMergeRefs, usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { ItemSubmenuIcon } from './icons';\nimport { LinkUI } from '../navigation-link/link-ui';\nimport { updateAttributes } from '../navigation-link/update-attributes';\nimport {\n\tgetColors,\n\tgetNavigationChildBlockProps,\n} from '../navigation/edit/utils';\n\nconst ALLOWED_BLOCKS = [\n\t'core/navigation-link',\n\t'core/navigation-submenu',\n\t'core/page-list',\n];\n\nconst DEFAULT_BLOCK = {\n\tname: 'core/navigation-link',\n};\n\n/**\n * A React hook to determine if it's dragging within the target element.\n *\n * @typedef {import('@wordpress/element').RefObject} RefObject\n *\n * @param {RefObject<HTMLElement>} elementRef The target elementRef object.\n *\n * @return {boolean} Is dragging within the target element.\n */\nconst useIsDraggingWithin = ( elementRef ) => {\n\tconst [ isDraggingWithin, setIsDraggingWithin ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst { ownerDocument } = elementRef.current;\n\n\t\tfunction handleDragStart( event ) {\n\t\t\t// Check the first time when the dragging starts.\n\t\t\thandleDragEnter( event );\n\t\t}\n\n\t\t// Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.\n\t\tfunction handleDragEnd() {\n\t\t\tsetIsDraggingWithin( false );\n\t\t}\n\n\t\tfunction handleDragEnter( event ) {\n\t\t\t// Check if the current target is inside the item element.\n\t\t\tif ( elementRef.current.contains( event.target ) ) {\n\t\t\t\tsetIsDraggingWithin( true );\n\t\t\t} else {\n\t\t\t\tsetIsDraggingWithin( false );\n\t\t\t}\n\t\t}\n\n\t\t// Bind these events to the document to catch all drag events.\n\t\t// Ideally, we can also use `event.relatedTarget`, but sadly that\n\t\t// doesn't work in Safari.\n\t\townerDocument.addEventListener( 'dragstart', handleDragStart );\n\t\townerDocument.addEventListener( 'dragend', handleDragEnd );\n\t\townerDocument.addEventListener( 'dragenter', handleDragEnter );\n\n\t\treturn () => {\n\t\t\townerDocument.removeEventListener( 'dragstart', handleDragStart );\n\t\t\townerDocument.removeEventListener( 'dragend', handleDragEnd );\n\t\t\townerDocument.removeEventListener( 'dragenter', handleDragEnter );\n\t\t};\n\t}, [] );\n\n\treturn isDraggingWithin;\n};\n\n/**\n * @typedef {'post-type'|'custom'|'taxonomy'|'post-type-archive'} WPNavigationLinkKind\n */\n\n/**\n * Navigation Link Block Attributes\n *\n * @typedef {Object} WPNavigationLinkBlockAttributes\n *\n * @property {string} [label] Link text.\n * @property {WPNavigationLinkKind} [kind] Kind is used to differentiate between term and post ids to check post draft status.\n * @property {string} [type] The type such as post, page, tag, category and other custom types.\n * @property {string} [rel] The relationship of the linked URL.\n * @property {number} [id] A post or term id.\n * @property {boolean} [opensInNewTab] Sets link target to _blank when true.\n * @property {string} [url] Link href.\n * @property {string} [title] Link title attribute.\n */\n\nexport default function NavigationSubmenuEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\tmergeBlocks,\n\tonReplace,\n\tcontext,\n\tclientId,\n} ) {\n\tconst { label, url, description, rel, title } = attributes;\n\n\tconst { showSubmenuIcon, maxNestingLevel, openSubmenusOnClick } = context;\n\n\tconst {\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\treplaceBlock,\n\t\tselectBlock,\n\t} = useDispatch( blockEditorStore );\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( false );\n\t// Store what element opened the popover, so we know where to return focus to (toolbar button vs navigation link text)\n\tconst [ openedBy, setOpenedBy ] = useState( null );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst listItemRef = useRef( null );\n\tconst isDraggingWithin = useIsDraggingWithin( listItemRef );\n\tconst itemLabelPlaceholder = __( 'Add text…' );\n\tconst ref = useRef();\n\n\tconst {\n\t\tparentCount,\n\t\tisParentOfSelectedBlock,\n\t\tisImmediateParentOfSelectedBlock,\n\t\thasChildren,\n\t\tselectedBlockHasChildren,\n\t\tonlyDescendantIsEmptyLink,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t\tgetBlock,\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockOrder,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tlet _onlyDescendantIsEmptyLink;\n\n\t\t\tconst selectedBlockId = getSelectedBlockClientId();\n\n\t\t\tconst selectedBlockChildren = getBlockOrder( selectedBlockId );\n\n\t\t\t// Check for a single descendant in the submenu. If that block\n\t\t\t// is a link block in a \"placeholder\" state with no label then\n\t\t\t// we can consider as an \"empty\" link.\n\t\t\tif ( selectedBlockChildren?.length === 1 ) {\n\t\t\t\tconst singleBlock = getBlock( selectedBlockChildren[ 0 ] );\n\n\t\t\t\t_onlyDescendantIsEmptyLink =\n\t\t\t\t\tsingleBlock?.name === 'core/navigation-link' &&\n\t\t\t\t\t! singleBlock?.attributes?.label;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tparentCount: getBlockParentsByBlockName(\n\t\t\t\t\tclientId,\n\t\t\t\t\t'core/navigation-submenu'\n\t\t\t\t).length,\n\t\t\t\tisParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\ttrue\n\t\t\t\t),\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\thasChildren: !! getBlockCount( clientId ),\n\t\t\t\tselectedBlockHasChildren: !! selectedBlockChildren?.length,\n\t\t\t\tonlyDescendantIsEmptyLink: _onlyDescendantIsEmptyLink,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst prevHasChildren = usePrevious( hasChildren );\n\n\t// Show the LinkControl on mount if the URL is empty\n\t// ( When adding a new menu item)\n\t// This can't be done in the useState call because it conflicts\n\t// with the autofocus behavior of the BlockListBlock component.\n\tuseEffect( () => {\n\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}, [] );\n\n\t/**\n\t * The hook shouldn't be necessary but due to a focus loss happening\n\t * when selecting a suggestion in the link popover, we force close on block unselection.\n\t */\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsLinkOpen( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\t// If the LinkControl popover is open and the URL has changed, close the LinkControl and focus the label text.\n\tuseEffect( () => {\n\t\tif ( isLinkOpen && url ) {\n\t\t\t// Does this look like a URL and have something TLD-ish?\n\t\t\tif (\n\t\t\t\tisURL( prependHTTP( label ) ) &&\n\t\t\t\t/^.+\\.[a-z]+/.test( label )\n\t\t\t) {\n\t\t\t\t// Focus and select the label text.\n\t\t\t\tselectLabelText();\n\t\t\t}\n\t\t}\n\t}, [ url ] );\n\n\t/**\n\t * Focus the Link label text and select it.\n\t */\n\tfunction selectLabelText() {\n\t\tref.current.focus();\n\t\tconst { ownerDocument } = ref.current;\n\t\tconst { defaultView } = ownerDocument;\n\t\tconst selection = defaultView.getSelection();\n\t\tconst range = ownerDocument.createRange();\n\t\t// Get the range of the current ref contents so we can add this range to the selection.\n\t\trange.selectNodeContents( ref.current );\n\t\tselection.removeAllRanges();\n\t\tselection.addRange( range );\n\t}\n\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t} = getColors( context, parentCount > 0 );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( isKeyboardEvent.primary( event, 'k' ) ) {\n\t\t\t// Required to prevent the command center from opening,\n\t\t\t// as it shares the CMD+K shortcut.\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/59845.\n\t\t\tevent.preventDefault();\n\t\t\t// If we don't stop propogation, this event bubbles up to the parent submenu item\n\t\t\tevent.stopPropagation();\n\t\t\tsetIsLinkOpen( true );\n\t\t\tsetOpenedBy( ref.current );\n\t\t}\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tref: useMergeRefs( [ setPopoverAnchor, listItemRef ] ),\n\t\tclassName: clsx( 'wp-block-navigation-item', {\n\t\t\t'is-editing': isSelected || isParentOfSelectedBlock,\n\t\t\t'is-dragging-within': isDraggingWithin,\n\t\t\t'has-link': !! url,\n\t\t\t'has-child': hasChildren,\n\t\t\t'has-text-color': !! textColor || !! customTextColor,\n\t\t\t[ getColorClassName( 'color', textColor ) ]: !! textColor,\n\t\t\t'has-background': !! backgroundColor || customBackgroundColor,\n\t\t\t[ getColorClassName( 'background-color', backgroundColor ) ]:\n\t\t\t\t!! backgroundColor,\n\t\t\t'open-on-click': openSubmenusOnClick,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: ! textColor && customTextColor,\n\t\t\tbackgroundColor: ! backgroundColor && customBackgroundColor,\n\t\t},\n\t\tonKeyDown,\n\t} );\n\n\t// Always use overlay colors for submenus.\n\tconst innerBlocksColors = getColors( context, true );\n\n\tconst allowedBlocks =\n\t\tparentCount >= maxNestingLevel\n\t\t\t? ALLOWED_BLOCKS.filter(\n\t\t\t\t\t( blockName ) => blockName !== 'core/navigation-submenu'\n\t\t\t )\n\t\t\t: ALLOWED_BLOCKS;\n\n\tconst navigationChildBlockProps =\n\t\tgetNavigationChildBlockProps( innerBlocksColors );\n\tconst innerBlocksProps = useInnerBlocksProps( navigationChildBlockProps, {\n\t\tallowedBlocks,\n\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\tdirectInsert: true,\n\n\t\t// Ensure block toolbar is not too far removed from item\n\t\t// being edited.\n\t\t// see: https://github.com/WordPress/gutenberg/pull/34615.\n\t\t__experimentalCaptureToolbars: true,\n\n\t\trenderAppender:\n\t\t\tisSelected ||\n\t\t\t( isImmediateParentOfSelectedBlock &&\n\t\t\t\t! selectedBlockHasChildren ) ||\n\t\t\t// Show the appender while dragging to allow inserting element between item and the appender.\n\t\t\thasChildren\n\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t: false,\n\t} );\n\n\tconst ParentElement = openSubmenusOnClick ? 'button' : 'a';\n\n\tfunction transformToLink() {\n\t\tconst newLinkBlock = createBlock( 'core/navigation-link', attributes );\n\t\treplaceBlock( clientId, newLinkBlock );\n\t}\n\n\tuseEffect( () => {\n\t\t// If block becomes empty, transform to Navigation Link.\n\t\tif ( ! hasChildren && prevHasChildren ) {\n\t\t\t// This side-effect should not create an undo level as those should\n\t\t\t// only be created via user interactions.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\ttransformToLink();\n\t\t}\n\t}, [ hasChildren, prevHasChildren ] );\n\n\tconst canConvertToLink =\n\t\t! selectedBlockHasChildren || onlyDescendantIsEmptyLink;\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t{ ! openSubmenusOnClick && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\t\ticon={ linkIcon }\n\t\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\t\tsetIsLinkOpen( true );\n\t\t\t\t\t\t\t\tsetOpenedBy( event.currentTarget );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"revert\"\n\t\t\t\t\t\ticon={ removeSubmenu }\n\t\t\t\t\t\ttitle={ __( 'Convert to Link' ) }\n\t\t\t\t\t\tonClick={ transformToLink }\n\t\t\t\t\t\tclassName=\"wp-block-navigation__submenu__revert\"\n\t\t\t\t\t\tdisabled={ ! canConvertToLink }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t{ /* Warning, this duplicated in packages/block-library/src/navigation-link/edit.js */ }\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvalue={ label || '' }\n\t\t\t\t\t\tonChange={ ( labelValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { label: labelValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvalue={ url || '' }\n\t\t\t\t\t\tonChange={ ( urlValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { url: urlValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tvalue={ description || '' }\n\t\t\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tdescription: descriptionValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'The description will be displayed in the menu if the current theme supports it.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvalue={ title || '' }\n\t\t\t\t\t\tonChange={ ( titleValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { title: titleValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Title attribute' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Additional information to help clarify the purpose of the link.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\t\tonChange={ ( relValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { rel: relValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Rel attribute' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'The relationship of the linked URL as space-separated link types.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ /* eslint-disable jsx-a11y/anchor-is-valid */ }\n\t\t\t\t<ParentElement className=\"wp-block-navigation-item__content\">\n\t\t\t\t\t{ /* eslint-enable */ }\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\tclassName=\"wp-block-navigation-item__label\"\n\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\tonChange={ ( labelValue ) =>\n\t\t\t\t\t\t\tsetAttributes( { label: labelValue } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\t\taria-label={ __( 'Navigation link text' ) }\n\t\t\t\t\t\tplaceholder={ itemLabelPlaceholder }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tallowedFormats={ [\n\t\t\t\t\t\t\t'core/bold',\n\t\t\t\t\t\t\t'core/italic',\n\t\t\t\t\t\t\t'core/image',\n\t\t\t\t\t\t\t'core/strikethrough',\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\t\t\t\t\t\tsetIsLinkOpen( true );\n\t\t\t\t\t\t\t\tsetOpenedBy( ref.current );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! openSubmenusOnClick && isLinkOpen && (\n\t\t\t\t\t\t<LinkUI\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tlink={ attributes }\n\t\t\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\t\t\tsetIsLinkOpen( false );\n\t\t\t\t\t\t\t\tif ( openedBy ) {\n\t\t\t\t\t\t\t\t\topenedBy.focus();\n\t\t\t\t\t\t\t\t\tsetOpenedBy( null );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tselectBlock( clientId );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( { url: '' } );\n\t\t\t\t\t\t\t\tspeak( __( 'Link removed.' ), 'assertive' );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonChange={ ( updatedValue ) => {\n\t\t\t\t\t\t\t\tupdateAttributes(\n\t\t\t\t\t\t\t\t\tupdatedValue,\n\t\t\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\t\t\tattributes\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ParentElement>\n\t\t\t\t{ ( showSubmenuIcon || openSubmenusOnClick ) && (\n\t\t\t\t\t<span className=\"wp-block-navigation__submenu-icon\">\n\t\t\t\t\t\t<ItemSubmenuIcon />\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t<div { ...innerBlocksProps }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AC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_data","_components","_keycodes","_i18n","_blockEditor","_url","_element","_icons","_a11y","_blocks","_compose","_icons2","_linkUi","_updateAttributes","_utils","_jsxRuntime","ALLOWED_BLOCKS","DEFAULT_BLOCK","name","useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","useState","useEffect","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","NavigationSubmenuEdit","attributes","isSelected","setAttributes","mergeBlocks","onReplace","context","clientId","label","url","description","rel","title","showSubmenuIcon","maxNestingLevel","openSubmenusOnClick","__unstableMarkNextChangeAsNotPersistent","replaceBlock","selectBlock","useDispatch","blockEditorStore","isLinkOpen","setIsLinkOpen","openedBy","setOpenedBy","popoverAnchor","setPopoverAnchor","listItemRef","useRef","itemLabelPlaceholder","__","ref","parentCount","isParentOfSelectedBlock","isImmediateParentOfSelectedBlock","hasChildren","selectedBlockHasChildren","onlyDescendantIsEmptyLink","useSelect","select","hasSelectedInnerBlock","getSelectedBlockClientId","getBlockParentsByBlockName","getBlock","getBlockCount","getBlockOrder","_onlyDescendantIsEmptyLink","selectedBlockId","selectedBlockChildren","length","singleBlock","prevHasChildren","usePrevious","isURL","prependHTTP","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","textColor","customTextColor","backgroundColor","customBackgroundColor","getColors","onKeyDown","isKeyboardEvent","primary","preventDefault","stopPropagation","blockProps","useBlockProps","useMergeRefs","className","clsx","getColorClassName","style","color","innerBlocksColors","allowedBlocks","filter","blockName","navigationChildBlockProps","getNavigationChildBlockProps","innerBlocksProps","useInnerBlocksProps","defaultBlock","directInsert","__experimentalCaptureToolbars","renderAppender","InnerBlocks","ButtonBlockAppender","ParentElement","transformToLink","newLinkBlock","createBlock","canConvertToLink","jsxs","Fragment","children","jsx","BlockControls","ToolbarGroup","ToolbarButton","icon","linkIcon","shortcut","displayShortcut","onClick","currentTarget","removeSubmenu","disabled","InspectorControls","PanelBody","TextControl","__nextHasNoMarginBottom","__next40pxDefaultSize","value","onChange","labelValue","autoComplete","urlValue","TextareaControl","descriptionValue","help","titleValue","relValue","RichText","identifier","onMerge","placeholder","withoutInteractiveFormatting","allowedFormats","LinkUI","link","onClose","anchor","onRemove","speak","updatedValue","updateAttributes","ItemSubmenuIcon"],"sources":["@wordpress/block-library/src/navigation-submenu/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tTextControl,\n\tTextareaControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tInnerBlocks,\n\tuseInnerBlocksProps,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tgetColorClassName,\n} from '@wordpress/block-editor';\nimport { isURL, prependHTTP } from '@wordpress/url';\nimport { useState, useEffect, useRef } from '@wordpress/element';\nimport { link as linkIcon, removeSubmenu } from '@wordpress/icons';\nimport { speak } from '@wordpress/a11y';\nimport { createBlock } from '@wordpress/blocks';\nimport { useMergeRefs, usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { ItemSubmenuIcon } from './icons';\nimport { LinkUI } from '../navigation-link/link-ui';\nimport { updateAttributes } from '../navigation-link/update-attributes';\nimport {\n\tgetColors,\n\tgetNavigationChildBlockProps,\n} from '../navigation/edit/utils';\n\nconst ALLOWED_BLOCKS = [\n\t'core/navigation-link',\n\t'core/navigation-submenu',\n\t'core/page-list',\n];\n\nconst DEFAULT_BLOCK = {\n\tname: 'core/navigation-link',\n};\n\n/**\n * A React hook to determine if it's dragging within the target element.\n *\n * @typedef {import('@wordpress/element').RefObject} RefObject\n *\n * @param {RefObject<HTMLElement>} elementRef The target elementRef object.\n *\n * @return {boolean} Is dragging within the target element.\n */\nconst useIsDraggingWithin = ( elementRef ) => {\n\tconst [ isDraggingWithin, setIsDraggingWithin ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst { ownerDocument } = elementRef.current;\n\n\t\tfunction handleDragStart( event ) {\n\t\t\t// Check the first time when the dragging starts.\n\t\t\thandleDragEnter( event );\n\t\t}\n\n\t\t// Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.\n\t\tfunction handleDragEnd() {\n\t\t\tsetIsDraggingWithin( false );\n\t\t}\n\n\t\tfunction handleDragEnter( event ) {\n\t\t\t// Check if the current target is inside the item element.\n\t\t\tif ( elementRef.current.contains( event.target ) ) {\n\t\t\t\tsetIsDraggingWithin( true );\n\t\t\t} else {\n\t\t\t\tsetIsDraggingWithin( false );\n\t\t\t}\n\t\t}\n\n\t\t// Bind these events to the document to catch all drag events.\n\t\t// Ideally, we can also use `event.relatedTarget`, but sadly that\n\t\t// doesn't work in Safari.\n\t\townerDocument.addEventListener( 'dragstart', handleDragStart );\n\t\townerDocument.addEventListener( 'dragend', handleDragEnd );\n\t\townerDocument.addEventListener( 'dragenter', handleDragEnter );\n\n\t\treturn () => {\n\t\t\townerDocument.removeEventListener( 'dragstart', handleDragStart );\n\t\t\townerDocument.removeEventListener( 'dragend', handleDragEnd );\n\t\t\townerDocument.removeEventListener( 'dragenter', handleDragEnter );\n\t\t};\n\t}, [] );\n\n\treturn isDraggingWithin;\n};\n\n/**\n * @typedef {'post-type'|'custom'|'taxonomy'|'post-type-archive'} WPNavigationLinkKind\n */\n\n/**\n * Navigation Link Block Attributes\n *\n * @typedef {Object} WPNavigationLinkBlockAttributes\n *\n * @property {string} [label] Link text.\n * @property {WPNavigationLinkKind} [kind] Kind is used to differentiate between term and post ids to check post draft status.\n * @property {string} [type] The type such as post, page, tag, category and other custom types.\n * @property {string} [rel] The relationship of the linked URL.\n * @property {number} [id] A post or term id.\n * @property {boolean} [opensInNewTab] Sets link target to _blank when true.\n * @property {string} [url] Link href.\n * @property {string} [title] Link title attribute.\n */\n\nexport default function NavigationSubmenuEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\tmergeBlocks,\n\tonReplace,\n\tcontext,\n\tclientId,\n} ) {\n\tconst { label, url, description, rel, title } = attributes;\n\n\tconst { showSubmenuIcon, maxNestingLevel, openSubmenusOnClick } = context;\n\n\tconst {\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\treplaceBlock,\n\t\tselectBlock,\n\t} = useDispatch( blockEditorStore );\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( false );\n\t// Store what element opened the popover, so we know where to return focus to (toolbar button vs navigation link text)\n\tconst [ openedBy, setOpenedBy ] = useState( null );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst listItemRef = useRef( null );\n\tconst isDraggingWithin = useIsDraggingWithin( listItemRef );\n\tconst itemLabelPlaceholder = __( 'Add text…' );\n\tconst ref = useRef();\n\n\tconst {\n\t\tparentCount,\n\t\tisParentOfSelectedBlock,\n\t\tisImmediateParentOfSelectedBlock,\n\t\thasChildren,\n\t\tselectedBlockHasChildren,\n\t\tonlyDescendantIsEmptyLink,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t\tgetBlock,\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockOrder,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tlet _onlyDescendantIsEmptyLink;\n\n\t\t\tconst selectedBlockId = getSelectedBlockClientId();\n\n\t\t\tconst selectedBlockChildren = getBlockOrder( selectedBlockId );\n\n\t\t\t// Check for a single descendant in the submenu. If that block\n\t\t\t// is a link block in a \"placeholder\" state with no label then\n\t\t\t// we can consider as an \"empty\" link.\n\t\t\tif ( selectedBlockChildren?.length === 1 ) {\n\t\t\t\tconst singleBlock = getBlock( selectedBlockChildren[ 0 ] );\n\n\t\t\t\t_onlyDescendantIsEmptyLink =\n\t\t\t\t\tsingleBlock?.name === 'core/navigation-link' &&\n\t\t\t\t\t! singleBlock?.attributes?.label;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tparentCount: getBlockParentsByBlockName(\n\t\t\t\t\tclientId,\n\t\t\t\t\t'core/navigation-submenu'\n\t\t\t\t).length,\n\t\t\t\tisParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\ttrue\n\t\t\t\t),\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\thasChildren: !! getBlockCount( clientId ),\n\t\t\t\tselectedBlockHasChildren: !! selectedBlockChildren?.length,\n\t\t\t\tonlyDescendantIsEmptyLink: _onlyDescendantIsEmptyLink,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst prevHasChildren = usePrevious( hasChildren );\n\n\t// Show the LinkControl on mount if the URL is empty\n\t// ( When adding a new menu item)\n\t// This can't be done in the useState call because it conflicts\n\t// with the autofocus behavior of the BlockListBlock component.\n\tuseEffect( () => {\n\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}, [] );\n\n\t/**\n\t * The hook shouldn't be necessary but due to a focus loss happening\n\t * when selecting a suggestion in the link popover, we force close on block unselection.\n\t */\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsLinkOpen( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\t// If the LinkControl popover is open and the URL has changed, close the LinkControl and focus the label text.\n\tuseEffect( () => {\n\t\tif ( isLinkOpen && url ) {\n\t\t\t// Does this look like a URL and have something TLD-ish?\n\t\t\tif (\n\t\t\t\tisURL( prependHTTP( label ) ) &&\n\t\t\t\t/^.+\\.[a-z]+/.test( label )\n\t\t\t) {\n\t\t\t\t// Focus and select the label text.\n\t\t\t\tselectLabelText();\n\t\t\t}\n\t\t}\n\t}, [ url ] );\n\n\t/**\n\t * Focus the Link label text and select it.\n\t */\n\tfunction selectLabelText() {\n\t\tref.current.focus();\n\t\tconst { ownerDocument } = ref.current;\n\t\tconst { defaultView } = ownerDocument;\n\t\tconst selection = defaultView.getSelection();\n\t\tconst range = ownerDocument.createRange();\n\t\t// Get the range of the current ref contents so we can add this range to the selection.\n\t\trange.selectNodeContents( ref.current );\n\t\tselection.removeAllRanges();\n\t\tselection.addRange( range );\n\t}\n\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t} = getColors( context, parentCount > 0 );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( isKeyboardEvent.primary( event, 'k' ) ) {\n\t\t\t// Required to prevent the command center from opening,\n\t\t\t// as it shares the CMD+K shortcut.\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/59845.\n\t\t\tevent.preventDefault();\n\t\t\t// If we don't stop propogation, this event bubbles up to the parent submenu item\n\t\t\tevent.stopPropagation();\n\t\t\tsetIsLinkOpen( true );\n\t\t\tsetOpenedBy( ref.current );\n\t\t}\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tref: useMergeRefs( [ setPopoverAnchor, listItemRef ] ),\n\t\tclassName: clsx( 'wp-block-navigation-item', {\n\t\t\t'is-editing': isSelected || isParentOfSelectedBlock,\n\t\t\t'is-dragging-within': isDraggingWithin,\n\t\t\t'has-link': !! url,\n\t\t\t'has-child': hasChildren,\n\t\t\t'has-text-color': !! textColor || !! customTextColor,\n\t\t\t[ getColorClassName( 'color', textColor ) ]: !! textColor,\n\t\t\t'has-background': !! backgroundColor || customBackgroundColor,\n\t\t\t[ getColorClassName( 'background-color', backgroundColor ) ]:\n\t\t\t\t!! backgroundColor,\n\t\t\t'open-on-click': openSubmenusOnClick,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: ! textColor && customTextColor,\n\t\t\tbackgroundColor: ! backgroundColor && customBackgroundColor,\n\t\t},\n\t\tonKeyDown,\n\t} );\n\n\t// Always use overlay colors for submenus.\n\tconst innerBlocksColors = getColors( context, true );\n\n\tconst allowedBlocks =\n\t\tparentCount >= maxNestingLevel\n\t\t\t? ALLOWED_BLOCKS.filter(\n\t\t\t\t\t( blockName ) => blockName !== 'core/navigation-submenu'\n\t\t\t )\n\t\t\t: ALLOWED_BLOCKS;\n\n\tconst navigationChildBlockProps =\n\t\tgetNavigationChildBlockProps( innerBlocksColors );\n\tconst innerBlocksProps = useInnerBlocksProps( navigationChildBlockProps, {\n\t\tallowedBlocks,\n\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\tdirectInsert: true,\n\n\t\t// Ensure block toolbar is not too far removed from item\n\t\t// being edited.\n\t\t// see: https://github.com/WordPress/gutenberg/pull/34615.\n\t\t__experimentalCaptureToolbars: true,\n\n\t\trenderAppender:\n\t\t\tisSelected ||\n\t\t\t( isImmediateParentOfSelectedBlock &&\n\t\t\t\t! selectedBlockHasChildren ) ||\n\t\t\t// Show the appender while dragging to allow inserting element between item and the appender.\n\t\t\thasChildren\n\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t: false,\n\t} );\n\n\tconst ParentElement = openSubmenusOnClick ? 'button' : 'a';\n\n\tfunction transformToLink() {\n\t\tconst newLinkBlock = createBlock( 'core/navigation-link', attributes );\n\t\treplaceBlock( clientId, newLinkBlock );\n\t}\n\n\tuseEffect( () => {\n\t\t// If block becomes empty, transform to Navigation Link.\n\t\tif ( ! hasChildren && prevHasChildren ) {\n\t\t\t// This side-effect should not create an undo level as those should\n\t\t\t// only be created via user interactions.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\ttransformToLink();\n\t\t}\n\t}, [ hasChildren, prevHasChildren ] );\n\n\tconst canConvertToLink =\n\t\t! selectedBlockHasChildren || onlyDescendantIsEmptyLink;\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t{ ! openSubmenusOnClick && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\t\ticon={ linkIcon }\n\t\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\t\tsetIsLinkOpen( true );\n\t\t\t\t\t\t\t\tsetOpenedBy( event.currentTarget );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"revert\"\n\t\t\t\t\t\ticon={ removeSubmenu }\n\t\t\t\t\t\ttitle={ __( 'Convert to Link' ) }\n\t\t\t\t\t\tonClick={ transformToLink }\n\t\t\t\t\t\tclassName=\"wp-block-navigation__submenu__revert\"\n\t\t\t\t\t\tdisabled={ ! canConvertToLink }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t{ /* Warning, this duplicated in packages/block-library/src/navigation-link/edit.js */ }\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvalue={ label || '' }\n\t\t\t\t\t\tonChange={ ( labelValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { label: labelValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvalue={ url || '' }\n\t\t\t\t\t\tonChange={ ( urlValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { url: urlValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tvalue={ description || '' }\n\t\t\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tdescription: descriptionValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'The description will be displayed in the menu if the current theme supports it.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvalue={ title || '' }\n\t\t\t\t\t\tonChange={ ( titleValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { title: titleValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Title attribute' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Additional information to help clarify the purpose of the link.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\t\tonChange={ ( relValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { rel: relValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Rel attribute' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'The relationship of the linked URL as space-separated link types.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ /* eslint-disable jsx-a11y/anchor-is-valid */ }\n\t\t\t\t<ParentElement className=\"wp-block-navigation-item__content\">\n\t\t\t\t\t{ /* eslint-enable */ }\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\tclassName=\"wp-block-navigation-item__label\"\n\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\tonChange={ ( labelValue ) =>\n\t\t\t\t\t\t\tsetAttributes( { label: labelValue } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\t\taria-label={ __( 'Navigation link text' ) }\n\t\t\t\t\t\tplaceholder={ itemLabelPlaceholder }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tallowedFormats={ [\n\t\t\t\t\t\t\t'core/bold',\n\t\t\t\t\t\t\t'core/italic',\n\t\t\t\t\t\t\t'core/image',\n\t\t\t\t\t\t\t'core/strikethrough',\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\t\t\t\t\t\tsetIsLinkOpen( true );\n\t\t\t\t\t\t\t\tsetOpenedBy( ref.current );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t{ description && (\n\t\t\t\t\t\t<span className=\"wp-block-navigation-item__description\">\n\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! openSubmenusOnClick && isLinkOpen && (\n\t\t\t\t\t\t<LinkUI\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tlink={ attributes }\n\t\t\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\t\t\tsetIsLinkOpen( false );\n\t\t\t\t\t\t\t\tif ( openedBy ) {\n\t\t\t\t\t\t\t\t\topenedBy.focus();\n\t\t\t\t\t\t\t\t\tsetOpenedBy( null );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tselectBlock( clientId );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( { url: '' } );\n\t\t\t\t\t\t\t\tspeak( __( 'Link removed.' ), 'assertive' );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonChange={ ( updatedValue ) => {\n\t\t\t\t\t\t\t\tupdateAttributes(\n\t\t\t\t\t\t\t\t\tupdatedValue,\n\t\t\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\t\t\tattributes\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ParentElement>\n\t\t\t\t{ ( showSubmenuIcon || openSubmenusOnClick ) && (\n\t\t\t\t\t<span className=\"wp-block-navigation__submenu-icon\">\n\t\t\t\t\t\t<ItemSubmenuIcon />\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAOA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA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AA;UAAM3B,SAAS,EAAC,uCAAuC;UAAA0B,QAAA,EACpD/F;QAAW,CACR,CACN,EACC,CAAEK,mBAAmB,IAAIM,UAAU,iBACpC,IAAAzC,WAAA,CAAA8H,GAAA,EAACjI,OAAA,CAAAkK,MAAM;UACNpI,QAAQ,EAAGA,QAAU;UACrBqI,IAAI,EAAG3I,UAAY;UACnB4I,OAAO,EAAGA,CAAA,KAAM;YACfvH,aAAa,CAAE,KAAM,CAAC;YACtB,IAAKC,QAAQ,EAAG;cACfA,QAAQ,CAACkC,KAAK,CAAC,CAAC;cAChBjC,WAAW,CAAE,IAAK,CAAC;YACpB,CAAC,MAAM;cACNN,WAAW,CAAEX,QAAS,CAAC;YACxB;UACD,CAAG;UACHuI,MAAM,EAAGrH,aAAe;UACxBsH,QAAQ,EAAGA,CAAA,KAAM;YAChB5I,aAAa,CAAE;cAAEM,GAAG,EAAE;YAAG,CAAE,CAAC;YAC5B,IAAAuI,WAAK,EAAE,IAAAlH,QAAE,EAAE,eAAgB,CAAC,EAAE,WAAY,CAAC;UAC5C,CAAG;UACH8F,QAAQ,EAAKqB,YAAY,IAAM;YAC9B,IAAAC,kCAAgB,EACfD,YAAY,EACZ9I,aAAa,EACbF,UACD,CAAC;UACF;QAAG,CACH,CACD;MAAA,CACa,CAAC,EACd,CAAEY,eAAe,IAAIE,mBAAmB,kBACzC,IAAAnC,WAAA,CAAA8H,GAAA;QAAM3B,SAAS,EAAC,mCAAmC;QAAA0B,QAAA,eAClD,IAAA7H,WAAA,CAAA8H,GAAA,EAAClI,OAAA,CAAA2K,eAAe,IAAE;MAAC,CACd,CACN,eACD,IAAAvK,WAAA,CAAA8H,GAAA;QAAA,GAAUhB;MAAgB,CAAI,CAAC;IAAA,CAC3B,CAAC;EAAA,CACL,CAAC;AAEL","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","cachedParsers","WeakMap","useParsePatternDependencies","registry","useRegistry","has","deps","Map","set","parsePatternDependencies","bind","get","name","blocks","queue","length","block","shift","innerBlock","_block$innerBlocks","innerBlocks","unshift","registerDependency","attributes","slug","a","b","Set","add","hasCycle","TypeError","visitedNodes","currentPath","_deps$get","dependencies","dependency","delete"],"sources":["@wordpress/block-library/src/pattern/recursion-detector.js"],"sourcesContent":["/**\n * THIS MODULE IS INTENTIONALLY KEPT WITHIN THE PATTERN BLOCK'S SOURCE.\n *\n * This is because this approach for preventing infinite loops due to\n * recursively rendering blocks is specific to the way that the `core/pattern`\n * block behaves in the editor. Any other block types that deal with recursion\n * SHOULD USE THE STANDARD METHOD for avoiding loops:\n *\n * @see https://github.com/WordPress/gutenberg/pull/31455\n * @see packages/block-editor/src/components/recursion-provider/README.md\n */\n\n/**\n * WordPress dependencies\n */\nimport { useRegistry } from '@wordpress/data';\n\n/**\n * Naming is hard.\n *\n * @see useParsePatternDependencies\n *\n * @type {WeakMap<Object, Function>}\n */\nconst cachedParsers = new WeakMap();\n\n/**\n * Hook used by PatternEdit to parse block patterns. It returns a function that\n * takes a pattern and returns nothing but throws an error if the pattern is\n * recursive.\n *\n * @example\n * ```js\n * const parsePatternDependencies = useParsePatternDependencies();\n * parsePatternDependencies( selectedPattern );\n * ```\n *\n * @see parsePatternDependencies\n *\n * @return {Function} A function to parse block patterns.\n */\nexport function useParsePatternDependencies() {\n\tconst registry = useRegistry();\n\n\t// Instead of caching maps, go straight to the point and cache bound\n\t// functions. Each of those functions is bound to a different Map that will\n\t// keep track of patterns in the context of the given registry.\n\tif ( ! cachedParsers.has( registry ) ) {\n\t\tconst deps = new Map();\n\t\tcachedParsers.set(\n\t\t\tregistry,\n\t\t\tparsePatternDependencies.bind( null, deps )\n\t\t);\n\t}\n\treturn cachedParsers.get( registry );\n}\n\n/**\n * Parse a given pattern and traverse its contents to detect any subsequent\n * patterns on which it may depend. Such occurrences will be added to an\n * internal dependency graph. If a circular dependency is detected, an\n * error will be thrown.\n *\n * EXPORTED FOR TESTING PURPOSES ONLY.\n *\n * @param {Map<string, Set<string>>} deps Map of pattern dependencies.\n * @param {Object} pattern Pattern.\n * @param {string} pattern.name Pattern name.\n * @param {Array} pattern.blocks Pattern's block list.\n *\n * @throws {Error} If a circular dependency is detected.\n */\nexport function parsePatternDependencies( deps, { name, blocks } ) {\n\tconst queue = [ ...blocks ];\n\twhile ( queue.length ) {\n\t\tconst block = queue.shift();\n\t\tfor ( const innerBlock of block.innerBlocks ?? [] ) {\n\t\t\tqueue.unshift( innerBlock );\n\t\t}\n\t\tif ( block.name === 'core/pattern' ) {\n\t\t\tregisterDependency( deps, name, block.attributes.slug );\n\t\t}\n\t}\n}\n\n/**\n * Declare that pattern `a` depends on pattern `b`. If a circular\n * dependency is detected, an error will be thrown.\n *\n * EXPORTED FOR TESTING PURPOSES ONLY.\n *\n * @param {Map<string, Set<string>>} deps Map of pattern dependencies.\n * @param {string} a Slug for pattern A.\n * @param {string} b Slug for pattern B.\n *\n * @throws {Error} If a circular dependency is detected.\n */\nexport function registerDependency( deps, a, b ) {\n\tif ( ! deps.has( a ) ) {\n\t\tdeps.set( a, new Set() );\n\t}\n\tdeps.get( a ).add( b );\n\tif ( hasCycle( deps, a ) ) {\n\t\tthrow new TypeError(\n\t\t\t`Pattern ${ a } has a circular dependency and cannot be rendered.`\n\t\t);\n\t}\n}\n\n/**\n * Determine if a given pattern has circular dependencies on other patterns.\n * This will be determined by running a depth-first search on the current state\n * of the graph represented by `patternDependencies`.\n *\n * @param {Map<string, Set<string>>} deps Map of pattern dependencies.\n * @param {string} slug Pattern slug.\n * @param {Set<string>} [visitedNodes] Set to track visited nodes in the graph.\n * @param {Set<string>} [currentPath] Set to track and backtrack graph paths.\n * @return {boolean} Whether any cycle was found.\n */\nfunction hasCycle(\n\tdeps,\n\tslug,\n\tvisitedNodes = new Set(),\n\tcurrentPath = new Set()\n) {\n\tvisitedNodes.add( slug );\n\tcurrentPath.add( slug );\n\n\tconst dependencies = deps.get( slug ) ?? new Set();\n\n\tfor ( const dependency of dependencies ) {\n\t\tif ( ! visitedNodes.has( dependency ) ) {\n\t\t\tif ( hasCycle( deps, dependency, visitedNodes, currentPath ) ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t} else if ( currentPath.has( dependency ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\t// Remove the current node from the current path when backtracking\n\tcurrentPath.delete( slug );\n\treturn false;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_data","require","cachedParsers","WeakMap","useParsePatternDependencies","registry","useRegistry","has","deps","Map","set","parsePatternDependencies","bind","get","name","blocks","queue","length","block","shift","innerBlock","_block$innerBlocks","innerBlocks","unshift","registerDependency","attributes","slug","a","b","Set","add","hasCycle","TypeError","visitedNodes","currentPath","_deps$get","dependencies","dependency","delete"],"sources":["@wordpress/block-library/src/pattern/recursion-detector.js"],"sourcesContent":["/**\n * THIS MODULE IS INTENTIONALLY KEPT WITHIN THE PATTERN BLOCK'S SOURCE.\n *\n * This is because this approach for preventing infinite loops due to\n * recursively rendering blocks is specific to the way that the `core/pattern`\n * block behaves in the editor. Any other block types that deal with recursion\n * SHOULD USE THE STANDARD METHOD for avoiding loops:\n *\n * @see https://github.com/WordPress/gutenberg/pull/31455\n * @see packages/block-editor/src/components/recursion-provider/README.md\n */\n\n/**\n * WordPress dependencies\n */\nimport { useRegistry } from '@wordpress/data';\n\n/**\n * Naming is hard.\n *\n * @see useParsePatternDependencies\n *\n * @type {WeakMap<Object, Function>}\n */\nconst cachedParsers = new WeakMap();\n\n/**\n * Hook used by PatternEdit to parse block patterns. It returns a function that\n * takes a pattern and returns nothing but throws an error if the pattern is\n * recursive.\n *\n * @example\n * ```js\n * const parsePatternDependencies = useParsePatternDependencies();\n * parsePatternDependencies( selectedPattern );\n * ```\n *\n * @see parsePatternDependencies\n *\n * @return {Function} A function to parse block patterns.\n */\nexport function useParsePatternDependencies() {\n\tconst registry = useRegistry();\n\n\t// Instead of caching maps, go straight to the point and cache bound\n\t// functions. Each of those functions is bound to a different Map that will\n\t// keep track of patterns in the context of the given registry.\n\tif ( ! cachedParsers.has( registry ) ) {\n\t\tconst deps = new Map();\n\t\tcachedParsers.set(\n\t\t\tregistry,\n\t\t\tparsePatternDependencies.bind( null, deps )\n\t\t);\n\t}\n\treturn cachedParsers.get( registry );\n}\n\n/**\n * Parse a given pattern and traverse its contents to detect any subsequent\n * patterns on which it may depend. Such occurrences will be added to an\n * internal dependency graph. If a circular dependency is detected, an\n * error will be thrown.\n *\n * EXPORTED FOR TESTING PURPOSES ONLY.\n *\n * @param {Map<string, Set<string>>} deps Map of pattern dependencies.\n * @param {Object} pattern Pattern.\n * @param {string} pattern.name Pattern name.\n * @param {Array} pattern.blocks Pattern's block list.\n *\n * @throws {Error} If a circular dependency is detected.\n */\nexport function parsePatternDependencies( deps, { name, blocks } ) {\n\tconst queue = [ ...blocks ];\n\twhile ( queue.length ) {\n\t\tconst block = queue.shift();\n\t\tfor ( const innerBlock of block.innerBlocks ?? [] ) {\n\t\t\tqueue.unshift( innerBlock );\n\t\t}\n\t\tif ( block.name === 'core/pattern' ) {\n\t\t\tregisterDependency( deps, name, block.attributes.slug );\n\t\t}\n\t}\n}\n\n/**\n * Declare that pattern `a` depends on pattern `b`. If a circular\n * dependency is detected, an error will be thrown.\n *\n * EXPORTED FOR TESTING PURPOSES ONLY.\n *\n * @param {Map<string, Set<string>>} deps Map of pattern dependencies.\n * @param {string} a Slug for pattern A.\n * @param {string} b Slug for pattern B.\n *\n * @throws {Error} If a circular dependency is detected.\n */\nexport function registerDependency( deps, a, b ) {\n\tif ( ! deps.has( a ) ) {\n\t\tdeps.set( a, new Set() );\n\t}\n\tdeps.get( a ).add( b );\n\tif ( hasCycle( deps, a ) ) {\n\t\tthrow new TypeError(\n\t\t\t`Pattern ${ a } has a circular dependency and cannot be rendered.`\n\t\t);\n\t}\n}\n\n/**\n * Determine if a given pattern has circular dependencies on other patterns.\n * This will be determined by running a depth-first search on the current state\n * of the graph represented by `patternDependencies`.\n *\n * @param {Map<string, Set<string>>} deps Map of pattern dependencies.\n * @param {string} slug Pattern slug.\n * @param {Set<string>} [visitedNodes] Set to track visited nodes in the graph.\n * @param {Set<string>} [currentPath] Set to track and backtrack graph paths.\n * @return {boolean} Whether any cycle was found.\n */\nfunction hasCycle(\n\tdeps,\n\tslug,\n\tvisitedNodes = new Set(),\n\tcurrentPath = new Set()\n) {\n\tvisitedNodes.add( slug );\n\tcurrentPath.add( slug );\n\n\tconst dependencies = deps.get( slug ) ?? new Set();\n\n\tfor ( const dependency of dependencies ) {\n\t\tif ( ! visitedNodes.has( dependency ) ) {\n\t\t\tif ( hasCycle( deps, dependency, visitedNodes, currentPath ) ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t} else if ( currentPath.has( dependency ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\t// Remove the current node from the current path when backtracking\n\tcurrentPath.delete( slug );\n\treturn false;\n}\n"],"mappings":";;;;;;;;AAeA,IAAAA,KAAA,GAAAC,OAAA;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,aAAa,GAAG,IAAIC,OAAO,CAAC,CAAC;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,2BAA2BA,CAAA,EAAG;EAC7C,MAAMC,QAAQ,GAAG,IAAAC,iBAAW,EAAC,CAAC;;EAE9B;EACA;EACA;EACA,IAAK,CAAEJ,aAAa,CAACK,GAAG,CAAEF,QAAS,CAAC,EAAG;IACtC,MAAMG,IAAI,GAAG,IAAIC,GAAG,CAAC,CAAC;IACtBP,aAAa,CAACQ,GAAG,CAChBL,QAAQ,EACRM,wBAAwB,CAACC,IAAI,CAAE,IAAI,EAAEJ,IAAK,CAC3C,CAAC;EACF;EACA,OAAON,aAAa,CAACW,GAAG,CAAER,QAAS,CAAC;AACrC;;AAEA;AACA;AACA;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,CAAC,CAAC,EACxBK,WAAW,GAAG,IAAIL,GAAG,CAAC,CAAC,EACtB;EAAA,IAAAM,SAAA;EACDF,YAAY,CAACH,GAAG,CAAEJ,IAAK,CAAC;EACxBQ,WAAW,CAACJ,GAAG,CAAEJ,IAAK,CAAC;EAEvB,MAAMU,YAAY,IAAAD,SAAA,GAAG3B,IAAI,CAACK,GAAG,CAAEa,IAAK,CAAC,cAAAS,SAAA,cAAAA,SAAA,GAAI,IAAIN,GAAG,CAAC,CAAC;EAElD,KAAM,MAAMQ,UAAU,IAAID,YAAY,EAAG;IACxC,IAAK,CAAEH,YAAY,CAAC1B,GAAG,CAAE8B,UAAW,CAAC,EAAG;MACvC,IAAKN,QAAQ,CAAEvB,IAAI,EAAE6B,UAAU,EAAEJ,YAAY,EAAEC,WAAY,CAAC,EAAG;QAC9D,OAAO,IAAI;MACZ;IACD,CAAC,MAAM,IAAKA,WAAW,CAAC3B,GAAG,CAAE8B,UAAW,CAAC,EAAG;MAC3C,OAAO,IAAI;IACZ;EACD;;EAEA;EACAH,WAAW,CAACI,MAAM,CAAEZ,IAAK,CAAC;EAC1B,OAAO,KAAK;AACb","ignoreList":[]}
|
|
@@ -10,7 +10,7 @@ var _element = require("@wordpress/element");
|
|
|
10
10
|
var _blockEditor = require("@wordpress/block-editor");
|
|
11
11
|
var _queryContent = _interopRequireDefault(require("./query-content"));
|
|
12
12
|
var _queryPlaceholder = _interopRequireDefault(require("./query-placeholder"));
|
|
13
|
-
var
|
|
13
|
+
var _patternSelection = require("./pattern-selection");
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
15
|
/**
|
|
16
16
|
* WordPress dependencies
|
|
@@ -32,7 +32,7 @@ const QueryEdit = props => {
|
|
|
32
32
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
33
33
|
...props,
|
|
34
34
|
openPatternSelectionModal: () => setIsPatternSelectionModalOpen(true)
|
|
35
|
-
}), isPatternSelectionModalOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
35
|
+
}), isPatternSelectionModalOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_patternSelection.PatternSelectionModal, {
|
|
36
36
|
clientId: clientId,
|
|
37
37
|
attributes: attributes,
|
|
38
38
|
setIsPatternSelectionModalOpen: setIsPatternSelectionModalOpen
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_element","_blockEditor","_queryContent","_interopRequireDefault","_queryPlaceholder","
|
|
1
|
+
{"version":3,"names":["_data","require","_element","_blockEditor","_queryContent","_interopRequireDefault","_queryPlaceholder","_patternSelection","_jsxRuntime","QueryEdit","props","clientId","attributes","isPatternSelectionModalOpen","setIsPatternSelectionModalOpen","useState","hasInnerBlocks","useSelect","select","blockEditorStore","getBlocks","length","Component","QueryContent","QueryPlaceholder","jsxs","Fragment","children","jsx","openPatternSelectionModal","PatternSelectionModal","_default","exports","default"],"sources":["@wordpress/block-library/src/query/edit/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport QueryContent from './query-content';\nimport QueryPlaceholder from './query-placeholder';\nimport { PatternSelectionModal } from './pattern-selection';\n\nconst QueryEdit = ( props ) => {\n\tconst { clientId, attributes } = props;\n\tconst [ isPatternSelectionModalOpen, setIsPatternSelectionModalOpen ] =\n\t\tuseState( false );\n\tconst hasInnerBlocks = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( blockEditorStore ).getBlocks( clientId ).length,\n\t\t[ clientId ]\n\t);\n\tconst Component = hasInnerBlocks ? QueryContent : QueryPlaceholder;\n\treturn (\n\t\t<>\n\t\t\t<Component\n\t\t\t\t{ ...props }\n\t\t\t\topenPatternSelectionModal={ () =>\n\t\t\t\t\tsetIsPatternSelectionModalOpen( true )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ isPatternSelectionModalOpen && (\n\t\t\t\t<PatternSelectionModal\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetIsPatternSelectionModalOpen={\n\t\t\t\t\t\tsetIsPatternSelectionModalOpen\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n};\n\nexport default QueryEdit;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAKA,IAAAG,aAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AAA4D,IAAAO,WAAA,GAAAP,OAAA;AAZ5D;AACA;AACA;;AAKA;AACA;AACA;;AAKA,MAAMQ,SAAS,GAAKC,KAAK,IAAM;EAC9B,MAAM;IAAEC,QAAQ;IAAEC;EAAW,CAAC,GAAGF,KAAK;EACtC,MAAM,CAAEG,2BAA2B,EAAEC,8BAA8B,CAAE,GACpE,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EAClB,MAAMC,cAAc,GAAG,IAAAC,eAAS,EAC7BC,MAAM,IACP,CAAC,CAAEA,MAAM,CAAEC,kBAAiB,CAAC,CAACC,SAAS,CAAET,QAAS,CAAC,CAACU,MAAM,EAC3D,CAAEV,QAAQ,CACX,CAAC;EACD,MAAMW,SAAS,GAAGN,cAAc,GAAGO,qBAAY,GAAGC,yBAAgB;EAClE,oBACC,IAAAhB,WAAA,CAAAiB,IAAA,EAAAjB,WAAA,CAAAkB,QAAA;IAAAC,QAAA,gBACC,IAAAnB,WAAA,CAAAoB,GAAA,EAACN,SAAS;MAAA,GACJZ,KAAK;MACVmB,yBAAyB,EAAGA,CAAA,KAC3Bf,8BAA8B,CAAE,IAAK;IACrC,CACD,CAAC,EACAD,2BAA2B,iBAC5B,IAAAL,WAAA,CAAAoB,GAAA,EAACrB,iBAAA,CAAAuB,qBAAqB;MACrBnB,QAAQ,EAAGA,QAAU;MACrBC,UAAU,EAAGA,UAAY;MACzBE,8BAA8B,EAC7BA;IACA,CACD,CACD;EAAA,CACA,CAAC;AAEL,CAAC;AAAC,IAAAiB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaxB,SAAS","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_data","_coreData","_utils","_jsxRuntime","AUTHORS_QUERY","who","per_page","_fields","context","AuthorControl","value","onChange","authorsList","useSelect","select","getUsers","coreStore","authorsInfo","getEntitiesInfo","normalizedValue","toString","split","sanitizedValue","reduce","accumulator","authorId","author","mapById","push","id","name","getIdByValue","entitiesMappedByName","authorValue","onAuthorChange","newValue","ids","Array","from","mapByName","add","Set","join","jsx","FormTokenField","label","__","suggestions","names","__experimentalShowHowTo","__nextHasNoMarginBottom","__next40pxDefaultSize","_default","exports","default"],"sources":["@wordpress/block-library/src/query/edit/inspector-controls/author-control.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { FormTokenField } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { getEntitiesInfo } from '../../utils';\n\nconst AUTHORS_QUERY = {\n\twho: 'authors',\n\tper_page: -1,\n\t_fields: 'id,name',\n\tcontext: 'view',\n};\n\nfunction AuthorControl( { value, onChange } ) {\n\tconst authorsList = useSelect( ( select ) => {\n\t\tconst { getUsers } = select( coreStore );\n\t\treturn getUsers( AUTHORS_QUERY );\n\t}, [] );\n\n\tif ( ! authorsList ) {\n\t\treturn null;\n\t}\n\tconst authorsInfo = getEntitiesInfo( authorsList );\n\t/**\n\t * We need to normalize the value because the block operates on a\n\t * comma(`,`) separated string value and `FormTokenFiels` needs an\n\t * array.\n\t */\n\tconst normalizedValue = ! value ? [] : value.toString().split( ',' );\n\t// Returns only the existing authors ids. This prevents the component\n\t// from crashing in the editor, when non existing ids are provided.\n\tconst sanitizedValue = normalizedValue.reduce(\n\t\t( accumulator, authorId ) => {\n\t\t\tconst author = authorsInfo.mapById[ authorId ];\n\t\t\tif ( author ) {\n\t\t\t\taccumulator.push( {\n\t\t\t\t\tid: authorId,\n\t\t\t\t\tvalue: author.name,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t},\n\t\t[]\n\t);\n\n\tconst getIdByValue = ( entitiesMappedByName, authorValue ) => {\n\t\tconst id = authorValue?.id || entitiesMappedByName[ authorValue ]?.id;\n\t\tif ( id ) {\n\t\t\treturn id;\n\t\t}\n\t};\n\tconst onAuthorChange = ( newValue ) => {\n\t\tconst ids = Array.from(\n\t\t\tnewValue.reduce( ( accumulator, author ) => {\n\t\t\t\t// Verify that new values point to existing entities.\n\t\t\t\tconst id = getIdByValue( authorsInfo.mapByName, author );\n\t\t\t\tif ( id ) {\n\t\t\t\t\taccumulator.add( id );\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, new Set() )\n\t\t);\n\t\tonChange( { author: ids.join( ',' ) } );\n\t};\n\treturn (\n\t\t<FormTokenField\n\t\t\tlabel={ __( 'Authors' ) }\n\t\t\tvalue={ sanitizedValue }\n\t\t\tsuggestions={ authorsInfo.names }\n\t\t\tonChange={ onAuthorChange }\n\t\t\t__experimentalShowHowTo={ false }\n\t\t\t__nextHasNoMarginBottom\n\t\t\t__next40pxDefaultSize\n\t\t/>\n\t);\n}\n\nexport default AuthorControl;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_coreData","_utils","_jsxRuntime","AUTHORS_QUERY","who","per_page","_fields","context","AuthorControl","value","onChange","authorsList","useSelect","select","getUsers","coreStore","authorsInfo","getEntitiesInfo","normalizedValue","toString","split","sanitizedValue","reduce","accumulator","authorId","author","mapById","push","id","name","getIdByValue","entitiesMappedByName","authorValue","onAuthorChange","newValue","ids","Array","from","mapByName","add","Set","join","jsx","FormTokenField","label","__","suggestions","names","__experimentalShowHowTo","__nextHasNoMarginBottom","__next40pxDefaultSize","_default","exports","default"],"sources":["@wordpress/block-library/src/query/edit/inspector-controls/author-control.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { FormTokenField } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { getEntitiesInfo } from '../../utils';\n\nconst AUTHORS_QUERY = {\n\twho: 'authors',\n\tper_page: -1,\n\t_fields: 'id,name',\n\tcontext: 'view',\n};\n\nfunction AuthorControl( { value, onChange } ) {\n\tconst authorsList = useSelect( ( select ) => {\n\t\tconst { getUsers } = select( coreStore );\n\t\treturn getUsers( AUTHORS_QUERY );\n\t}, [] );\n\n\tif ( ! authorsList ) {\n\t\treturn null;\n\t}\n\tconst authorsInfo = getEntitiesInfo( authorsList );\n\t/**\n\t * We need to normalize the value because the block operates on a\n\t * comma(`,`) separated string value and `FormTokenFiels` needs an\n\t * array.\n\t */\n\tconst normalizedValue = ! value ? [] : value.toString().split( ',' );\n\t// Returns only the existing authors ids. This prevents the component\n\t// from crashing in the editor, when non existing ids are provided.\n\tconst sanitizedValue = normalizedValue.reduce(\n\t\t( accumulator, authorId ) => {\n\t\t\tconst author = authorsInfo.mapById[ authorId ];\n\t\t\tif ( author ) {\n\t\t\t\taccumulator.push( {\n\t\t\t\t\tid: authorId,\n\t\t\t\t\tvalue: author.name,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t},\n\t\t[]\n\t);\n\n\tconst getIdByValue = ( entitiesMappedByName, authorValue ) => {\n\t\tconst id = authorValue?.id || entitiesMappedByName[ authorValue ]?.id;\n\t\tif ( id ) {\n\t\t\treturn id;\n\t\t}\n\t};\n\tconst onAuthorChange = ( newValue ) => {\n\t\tconst ids = Array.from(\n\t\t\tnewValue.reduce( ( accumulator, author ) => {\n\t\t\t\t// Verify that new values point to existing entities.\n\t\t\t\tconst id = getIdByValue( authorsInfo.mapByName, author );\n\t\t\t\tif ( id ) {\n\t\t\t\t\taccumulator.add( id );\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, new Set() )\n\t\t);\n\t\tonChange( { author: ids.join( ',' ) } );\n\t};\n\treturn (\n\t\t<FormTokenField\n\t\t\tlabel={ __( 'Authors' ) }\n\t\t\tvalue={ sanitizedValue }\n\t\t\tsuggestions={ authorsInfo.names }\n\t\t\tonChange={ onAuthorChange }\n\t\t\t__experimentalShowHowTo={ false }\n\t\t\t__nextHasNoMarginBottom\n\t\t\t__next40pxDefaultSize\n\t\t/>\n\t);\n}\n\nexport default AuthorControl;\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAA8C,IAAAK,WAAA,GAAAL,OAAA;AAX9C;AACA;AACA;;AAMA;AACA;AACA;;AAGA,MAAMM,aAAa,GAAG;EACrBC,GAAG,EAAE,SAAS;EACdC,QAAQ,EAAE,CAAC,CAAC;EACZC,OAAO,EAAE,SAAS;EAClBC,OAAO,EAAE;AACV,CAAC;AAED,SAASC,aAAaA,CAAE;EAAEC,KAAK;EAAEC;AAAS,CAAC,EAAG;EAC7C,MAAMC,WAAW,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC5C,MAAM;MAAEC;IAAS,CAAC,GAAGD,MAAM,CAAEE,eAAU,CAAC;IACxC,OAAOD,QAAQ,CAAEX,aAAc,CAAC;EACjC,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAEQ,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EACA,MAAMK,WAAW,GAAG,IAAAC,sBAAe,EAAEN,WAA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GAAA,EAAC5C,WAAA,CAAA6C,cAAc;IACdC,KAAK,EAAG,IAAAC,QAAE,EAAE,SAAU,CAAG;IACzBpC,KAAK,EAAGY,cAAgB;IACxByB,WAAW,EAAG9B,WAAW,CAAC+B,KAAO;IACjCrC,QAAQ,EAAGuB,cAAgB;IAC3Be,uBAAuB,EAAG,KAAO;IACjCC,uBAAuB;IACvBC,qBAAqB;EAAA,CACrB,CAAC;AAEJ;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc7C,aAAa","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_data","_coreData","_element","_compose","_utils","_jsxRuntime","EMPTY_ARRAY","BASE_QUERY","order","_fields","context","ParentControl","parents","postType","onChange","search","setSearch","useState","value","setValue","suggestions","setSuggestions","debouncedSearch","useDebounce","searchResults","searchHasResolved","useSelect","select","getEntityRecords","hasFinishedResolution","coreStore","selectorArgs","orderby","exclude","per_page","currentParents","length","include","useEffect","currentParentsInfo","getEntitiesInfo","mapToIHasNameAndId","sanitizedValue","reduce","accumulator","id","entity","mapById","push","name","entitiesInfo","useMemo","names","getIdByValue","entitiesMappedByName","onParentChange","newValue","ids","Array","from","mapByName","add","Set","jsx","FormTokenField","__next40pxDefaultSize","label","__","onInputChange","__experimentalShowHowTo","__nextHasNoMarginBottom","_default","exports","default"],"sources":["@wordpress/block-library/src/query/edit/inspector-controls/parent-control.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { FormTokenField } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, useEffect, useMemo } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { getEntitiesInfo, mapToIHasNameAndId } from '../../utils';\n\nconst EMPTY_ARRAY = [];\nconst BASE_QUERY = {\n\torder: 'asc',\n\t_fields: 'id,title',\n\tcontext: 'view',\n};\n\nfunction ParentControl( { parents, postType, onChange } ) {\n\tconst [ search, setSearch ] = useState( '' );\n\tconst [ value, setValue ] = useState( EMPTY_ARRAY );\n\tconst [ suggestions, setSuggestions ] = useState( EMPTY_ARRAY );\n\tconst debouncedSearch = useDebounce( setSearch, 250 );\n\tconst { searchResults, searchHasResolved } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! search ) {\n\t\t\t\treturn { searchResults: EMPTY_ARRAY, searchHasResolved: true };\n\t\t\t}\n\t\t\tconst { getEntityRecords, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst selectorArgs = [\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\t{\n\t\t\t\t\t...BASE_QUERY,\n\t\t\t\t\tsearch,\n\t\t\t\t\torderby: 'relevance',\n\t\t\t\t\texclude: parents,\n\t\t\t\t\tper_page: 20,\n\t\t\t\t},\n\t\t\t];\n\t\t\treturn {\n\t\t\t\tsearchResults: getEntityRecords( ...selectorArgs ),\n\t\t\t\tsearchHasResolved: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\tselectorArgs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ search, parents ]\n\t);\n\tconst currentParents = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! parents?.length ) {\n\t\t\t\treturn EMPTY_ARRAY;\n\t\t\t}\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\treturn getEntityRecords( 'postType', postType, {\n\t\t\t\t...BASE_QUERY,\n\t\t\t\tinclude: parents,\n\t\t\t\tper_page: parents.length,\n\t\t\t} );\n\t\t},\n\t\t[ parents ]\n\t);\n\t// Update the `value` state only after the selectors are resolved\n\t// to avoid emptying the input when we're changing parents.\n\tuseEffect( () => {\n\t\tif ( ! parents?.length ) {\n\t\t\tsetValue( EMPTY_ARRAY );\n\t\t}\n\t\tif ( ! currentParents?.length ) {\n\t\t\treturn;\n\t\t}\n\t\tconst currentParentsInfo = getEntitiesInfo(\n\t\t\tmapToIHasNameAndId( currentParents, 'title.rendered' )\n\t\t);\n\t\t// Returns only the existing entity ids. This prevents the component\n\t\t// from crashing in the editor, when non existing ids are provided.\n\t\tconst sanitizedValue = parents.reduce( ( accumulator, id ) => {\n\t\t\tconst entity = currentParentsInfo.mapById[ id ];\n\t\t\tif ( entity ) {\n\t\t\t\taccumulator.push( {\n\t\t\t\t\tid,\n\t\t\t\t\tvalue: entity.name,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t}, [] );\n\t\tsetValue( sanitizedValue );\n\t}, [ parents, currentParents ] );\n\n\tconst entitiesInfo = useMemo( () => {\n\t\tif ( ! searchResults?.length ) {\n\t\t\treturn EMPTY_ARRAY;\n\t\t}\n\t\treturn getEntitiesInfo(\n\t\t\tmapToIHasNameAndId( searchResults, 'title.rendered' )\n\t\t);\n\t}, [ searchResults ] );\n\t// Update suggestions only when the query has resolved.\n\tuseEffect( () => {\n\t\tif ( ! searchHasResolved ) {\n\t\t\treturn;\n\t\t}\n\t\tsetSuggestions( entitiesInfo.names );\n\t}, [ entitiesInfo.names, searchHasResolved ] );\n\n\tconst getIdByValue = ( entitiesMappedByName, entity ) => {\n\t\tconst id = entity?.id || entitiesMappedByName?.[ entity ]?.id;\n\t\tif ( id ) {\n\t\t\treturn id;\n\t\t}\n\t};\n\tconst onParentChange = ( newValue ) => {\n\t\tconst ids = Array.from(\n\t\t\tnewValue.reduce( ( accumulator, entity ) => {\n\t\t\t\t// Verify that new values point to existing entities.\n\t\t\t\tconst id = getIdByValue( entitiesInfo.mapByName, entity );\n\t\t\t\tif ( id ) {\n\t\t\t\t\taccumulator.add( id );\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, new Set() )\n\t\t);\n\t\tsetSuggestions( EMPTY_ARRAY );\n\t\tonChange( { parents: ids } );\n\t};\n\treturn (\n\t\t<FormTokenField\n\t\t\t__next40pxDefaultSize\n\t\t\tlabel={ __( 'Parents' ) }\n\t\t\tvalue={ value }\n\t\t\tonInputChange={ debouncedSearch }\n\t\t\tsuggestions={ suggestions }\n\t\t\tonChange={ onParentChange }\n\t\t\t__experimentalShowHowTo={ false }\n\t\t\t__nextHasNoMarginBottom\n\t\t/>\n\t);\n}\n\nexport default ParentControl;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_coreData","_element","_compose","_utils","_jsxRuntime","EMPTY_ARRAY","BASE_QUERY","order","_fields","context","ParentControl","parents","postType","onChange","search","setSearch","useState","value","setValue","suggestions","setSuggestions","debouncedSearch","useDebounce","searchResults","searchHasResolved","useSelect","select","getEntityRecords","hasFinishedResolution","coreStore","selectorArgs","orderby","exclude","per_page","currentParents","length","include","useEffect","currentParentsInfo","getEntitiesInfo","mapToIHasNameAndId","sanitizedValue","reduce","accumulator","id","entity","mapById","push","name","entitiesInfo","useMemo","names","getIdByValue","entitiesMappedByName","onParentChange","newValue","ids","Array","from","mapByName","add","Set","jsx","FormTokenField","__next40pxDefaultSize","label","__","onInputChange","__experimentalShowHowTo","__nextHasNoMarginBottom","_default","exports","default"],"sources":["@wordpress/block-library/src/query/edit/inspector-controls/parent-control.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { FormTokenField } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, useEffect, useMemo } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { getEntitiesInfo, mapToIHasNameAndId } from '../../utils';\n\nconst EMPTY_ARRAY = [];\nconst BASE_QUERY = {\n\torder: 'asc',\n\t_fields: 'id,title',\n\tcontext: 'view',\n};\n\nfunction ParentControl( { parents, postType, onChange } ) {\n\tconst [ search, setSearch ] = useState( '' );\n\tconst [ value, setValue ] = useState( EMPTY_ARRAY );\n\tconst [ suggestions, setSuggestions ] = useState( EMPTY_ARRAY );\n\tconst debouncedSearch = useDebounce( setSearch, 250 );\n\tconst { searchResults, searchHasResolved } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! search ) {\n\t\t\t\treturn { searchResults: EMPTY_ARRAY, searchHasResolved: true };\n\t\t\t}\n\t\t\tconst { getEntityRecords, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst selectorArgs = [\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\t{\n\t\t\t\t\t...BASE_QUERY,\n\t\t\t\t\tsearch,\n\t\t\t\t\torderby: 'relevance',\n\t\t\t\t\texclude: parents,\n\t\t\t\t\tper_page: 20,\n\t\t\t\t},\n\t\t\t];\n\t\t\treturn {\n\t\t\t\tsearchResults: getEntityRecords( ...selectorArgs ),\n\t\t\t\tsearchHasResolved: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\tselectorArgs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ search, parents ]\n\t);\n\tconst currentParents = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! parents?.length ) {\n\t\t\t\treturn EMPTY_ARRAY;\n\t\t\t}\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\treturn getEntityRecords( 'postType', postType, {\n\t\t\t\t...BASE_QUERY,\n\t\t\t\tinclude: parents,\n\t\t\t\tper_page: parents.length,\n\t\t\t} );\n\t\t},\n\t\t[ parents ]\n\t);\n\t// Update the `value` state only after the selectors are resolved\n\t// to avoid emptying the input when we're changing parents.\n\tuseEffect( () => {\n\t\tif ( ! parents?.length ) {\n\t\t\tsetValue( EMPTY_ARRAY );\n\t\t}\n\t\tif ( ! currentParents?.length ) {\n\t\t\treturn;\n\t\t}\n\t\tconst currentParentsInfo = getEntitiesInfo(\n\t\t\tmapToIHasNameAndId( currentParents, 'title.rendered' )\n\t\t);\n\t\t// Returns only the existing entity ids. This prevents the component\n\t\t// from crashing in the editor, when non existing ids are provided.\n\t\tconst sanitizedValue = parents.reduce( ( accumulator, id ) => {\n\t\t\tconst entity = currentParentsInfo.mapById[ id ];\n\t\t\tif ( entity ) {\n\t\t\t\taccumulator.push( {\n\t\t\t\t\tid,\n\t\t\t\t\tvalue: entity.name,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t}, [] );\n\t\tsetValue( sanitizedValue );\n\t}, [ parents, currentParents ] );\n\n\tconst entitiesInfo = useMemo( () => {\n\t\tif ( ! searchResults?.length ) {\n\t\t\treturn EMPTY_ARRAY;\n\t\t}\n\t\treturn getEntitiesInfo(\n\t\t\tmapToIHasNameAndId( searchResults, 'title.rendered' )\n\t\t);\n\t}, [ searchResults ] );\n\t// Update suggestions only when the query has resolved.\n\tuseEffect( () => {\n\t\tif ( ! searchHasResolved ) {\n\t\t\treturn;\n\t\t}\n\t\tsetSuggestions( entitiesInfo.names );\n\t}, [ entitiesInfo.names, searchHasResolved ] );\n\n\tconst getIdByValue = ( entitiesMappedByName, entity ) => {\n\t\tconst id = entity?.id || entitiesMappedByName?.[ entity ]?.id;\n\t\tif ( id ) {\n\t\t\treturn id;\n\t\t}\n\t};\n\tconst onParentChange = ( newValue ) => {\n\t\tconst ids = Array.from(\n\t\t\tnewValue.reduce( ( accumulator, entity ) => {\n\t\t\t\t// Verify that new values point to existing entities.\n\t\t\t\tconst id = getIdByValue( entitiesInfo.mapByName, entity );\n\t\t\t\tif ( id ) {\n\t\t\t\t\taccumulator.add( id );\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, new Set() )\n\t\t);\n\t\tsetSuggestions( EMPTY_ARRAY );\n\t\tonChange( { parents: ids } );\n\t};\n\treturn (\n\t\t<FormTokenField\n\t\t\t__next40pxDefaultSize\n\t\t\tlabel={ __( 'Parents' ) }\n\t\t\tvalue={ value }\n\t\t\tonInputChange={ debouncedSearch }\n\t\t\tsuggestions={ suggestions }\n\t\t\tonChange={ onParentChange }\n\t\t\t__experimentalShowHowTo={ false }\n\t\t\t__nextHas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,CACd,CAAC;IACDzC,cAAc,CAAEf,WAAY,CAAC;IAC7BQ,QAAQ,CAAE;MAAEF,OAAO,EAAE6C;IAAI,CAAE,CAAC;EAC7B,CAAC;EACD,oBACC,IAAApD,WAAA,CAAA0D,GAAA,EAAChE,WAAA,CAAAiE,cAAc;IACdC,qBAAqB;IACrBC,KAAK,EAAG,IAAAC,QAAE,EAAE,SAAU,CAAG;IACzBjD,KAAK,EAAGA,KAAO;IACfkD,aAAa,EAAG9C,eAAiB;IACjCF,WAAW,EAAGA,WAAa;IAC3BN,QAAQ,EAAGyC,cAAgB;IAC3Bc,uBAAuB,EAAG,KAAO;IACjCC,uBAAuB;EAAA,CACvB,CAAC;AAEJ;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc9D,aAAa","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_data","_coreData","_element","_compose","_htmlEntities","_utils","_jsxRuntime","EMPTY_ARRAY","BASE_QUERY","order","_fields","context","getTermIdByTermValue","terms","termValue","termId","id","find","term","name","termValueLower","toLocaleLowerCase","TaxonomyControls","onChange","query","postType","taxQuery","taxonomies","useTaxonomies","length","jsx","__experimentalVStack","spacing","children","map","taxonomy","termIds","slug","handleChange","newTermIds","TaxonomyItem","search","setSearch","useState","value","setValue","suggestions","setSuggestions","debouncedSearch","useDebounce","searchResults","searchHasResolved","useSelect","select","getEntityRecords","hasFinishedResolution","coreStore","selectorArgs","orderby","exclude","per_page","existingTerms","include","useEffect","sanitizedValue","reduce","accumulator","entity","push","result","onTermsChange","newTermValues","Set","add","Array","from","className","FormTokenField","label","onInputChange","displayTransform","decodeEntities","__experimentalShowHowTo","__nextHasNoMarginBottom","__next40pxDefaultSize"],"sources":["@wordpress/block-library/src/query/edit/inspector-controls/taxonomy-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tFormTokenField,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, useEffect } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { useTaxonomies } from '../../utils';\n\nconst EMPTY_ARRAY = [];\nconst BASE_QUERY = {\n\torder: 'asc',\n\t_fields: 'id,name',\n\tcontext: 'view',\n};\n\n// Helper function to get the term id based on user input in terms `FormTokenField`.\nconst getTermIdByTermValue = ( terms, termValue ) => {\n\t// First we check for exact match by `term.id` or case sensitive `term.name` match.\n\tconst termId =\n\t\ttermValue?.id || terms?.find( ( term ) => term.name === termValue )?.id;\n\tif ( termId ) {\n\t\treturn termId;\n\t}\n\n\t/**\n\t * Here we make an extra check for entered terms in a non case sensitive way,\n\t * to match user expectations, due to `FormTokenField` behaviour that shows\n\t * suggestions which are case insensitive.\n\t *\n\t * Although WP tries to discourage users to add terms with the same name (case insensitive),\n\t * it's still possible if you manually change the name, as long as the terms have different slugs.\n\t * In this edge case we always apply the first match from the terms list.\n\t */\n\tconst termValueLower = termValue.toLocaleLowerCase();\n\treturn terms?.find(\n\t\t( term ) => term.name.toLocaleLowerCase() === termValueLower\n\t)?.id;\n};\n\nexport function TaxonomyControls( { onChange, query } ) {\n\tconst { postType, taxQuery } = query;\n\n\tconst taxonomies = useTaxonomies( postType );\n\tif ( ! taxonomies || taxonomies.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<VStack spacing={ 4 }>\n\t\t\t{ taxonomies.map( ( taxonomy ) => {\n\t\t\t\tconst termIds = taxQuery?.[ taxonomy.slug ] || [];\n\t\t\t\tconst handleChange = ( newTermIds ) =>\n\t\t\t\t\tonChange( {\n\t\t\t\t\t\ttaxQuery: {\n\t\t\t\t\t\t\t...taxQuery,\n\t\t\t\t\t\t\t[ taxonomy.slug ]: newTermIds,\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\n\t\t\t\treturn (\n\t\t\t\t\t<TaxonomyItem\n\t\t\t\t\t\tkey={ taxonomy.slug }\n\t\t\t\t\t\ttaxonomy={ taxonomy }\n\t\t\t\t\t\ttermIds={ termIds }\n\t\t\t\t\t\tonChange={ handleChange }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</VStack>\n\t);\n}\n\n/**\n * Renders a `FormTokenField` for a given taxonomy.\n *\n * @param {Object} props The props for the component.\n * @param {Object} props.taxonomy The taxonomy object.\n * @param {number[]} props.termIds An array with the block's term ids for the given taxonomy.\n * @param {Function} props.onChange Callback `onChange` function.\n * @return {JSX.Element} The rendered component.\n */\nfunction TaxonomyItem( { taxonomy, termIds, onChange } ) {\n\tconst [ search, setSearch ] = useState( '' );\n\tconst [ value, setValue ] = useState( EMPTY_ARRAY );\n\tconst [ suggestions, setSuggestions ] = useState( EMPTY_ARRAY );\n\tconst debouncedSearch = useDebounce( setSearch, 250 );\n\tconst { searchResults, searchHasResolved } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! search ) {\n\t\t\t\treturn { searchResults: EMPTY_ARRAY, searchHasResolved: true };\n\t\t\t}\n\t\t\tconst { getEntityRecords, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst selectorArgs = [\n\t\t\t\t'taxonomy',\n\t\t\t\ttaxonomy.slug,\n\t\t\t\t{\n\t\t\t\t\t...BASE_QUERY,\n\t\t\t\t\tsearch,\n\t\t\t\t\torderby: 'name',\n\t\t\t\t\texclude: termIds,\n\t\t\t\t\tper_page: 20,\n\t\t\t\t},\n\t\t\t];\n\t\t\treturn {\n\t\t\t\tsearchResults: getEntityRecords( ...selectorArgs ),\n\t\t\t\tsearchHasResolved: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\tselectorArgs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ search, termIds ]\n\t);\n\t// `existingTerms` are the ones fetched from the API and their type is `{ id: number; name: string }`.\n\t// They are used to extract the terms' names to populate the `FormTokenField` properly\n\t// and to sanitize the provided `termIds`, by setting only the ones that exist.\n\tconst existingTerms = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! termIds?.length ) {\n\t\t\t\treturn EMPTY_ARRAY;\n\t\t\t}\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\treturn getEntityRecords( 'taxonomy', taxonomy.slug, {\n\t\t\t\t...BASE_QUERY,\n\t\t\t\tinclude: termIds,\n\t\t\t\tper_page: termIds.length,\n\t\t\t} );\n\t\t},\n\t\t[ termIds ]\n\t);\n\t// Update the `value` state only after the selectors are resolved\n\t// to avoid emptying the input when we're changing terms.\n\tuseEffect( () => {\n\t\tif ( ! termIds?.length ) {\n\t\t\tsetValue( EMPTY_ARRAY );\n\t\t}\n\t\tif ( ! existingTerms?.length ) {\n\t\t\treturn;\n\t\t}\n\t\t// Returns only the existing entity ids. This prevents the component\n\t\t// from crashing in the editor, when non existing ids are provided.\n\t\tconst sanitizedValue = termIds.reduce( ( accumulator, id ) => {\n\t\t\tconst entity = existingTerms.find( ( term ) => term.id === id );\n\t\t\tif ( entity ) {\n\t\t\t\taccumulator.push( {\n\t\t\t\t\tid,\n\t\t\t\t\tvalue: entity.name,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t}, [] );\n\t\tsetValue( sanitizedValue );\n\t}, [ termIds, existingTerms ] );\n\t// Update suggestions only when the query has resolved.\n\tuseEffect( () => {\n\t\tif ( ! searchHasResolved ) {\n\t\t\treturn;\n\t\t}\n\t\tsetSuggestions( searchResults.map( ( result ) => result.name ) );\n\t}, [ searchResults, searchHasResolved ] );\n\tconst onTermsChange = ( newTermValues ) => {\n\t\tconst newTermIds = new Set();\n\t\tfor ( const termValue of newTermValues ) {\n\t\t\tconst termId = getTermIdByTermValue( searchResults, termValue );\n\t\t\tif ( termId ) {\n\t\t\t\tnewTermIds.add( termId );\n\t\t\t}\n\t\t}\n\t\tsetSuggestions( EMPTY_ARRAY );\n\t\tonChange( Array.from( newTermIds ) );\n\t};\n\treturn (\n\t\t<div className=\"block-library-query-inspector__taxonomy-control\">\n\t\t\t<FormTokenField\n\t\t\t\tlabel={ taxonomy.name }\n\t\t\t\tvalue={ value }\n\t\t\t\tonInputChange={ debouncedSearch }\n\t\t\t\tsuggestions={ suggestions }\n\t\t\t\tdisplayTransform={ decodeEntities }\n\t\t\t\tonChange={ onTermsChange }\n\t\t\t\t__experimentalShowHowTo={ false }\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AAA4C,IAAAO,WAAA,GAAAP,OAAA;AAhB5C;AACA;AACA;;AAWA;AACA;AACA;;AAGA,MAAMQ,WAAW,GAAG,EAAE;AACtB,MAAMC,UAAU,GAAG;EAClBC,KAAK,EAAE,KAAK;EACZC,OAAO,EAAE,SAAS;EAClBC,OAAO,EAAE;AACV,CAAC;;AAED;AACA,MAAMC,oBAAoB,GAAGA,CAAEC,KAAK,EAAEC,SAAS,KAAM;EACpD;EACA,MAAMC,MAAM,GACXD,SAAS,EAAEE,EAAE,IAAIH,KAAK,EAAEI,IAAI,CAAIC,IAAI,IAAMA,IAAI,CAACC,IAAI,KAAKL,SAAU,CAAC,EAAEE,EAAE;EACxE,IAAKD,MAAM,EAAG;IACb,OAAOA,MAAM;EACd;;EAEA;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAMK,cAAc,GAAGN,SAAS,CAACO,iBAAiB,CAAC,CAAC;EACpD,OAAOR,KAAK,EAAEI,IAAI,CACfC,IAAI,IAA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ACAgC,cAAc,CAAExC,WAAY,CAAC;IAC7BgB,QAAQ,CAAEmD,KAAK,CAACC,IAAI,CAAEpC,UAAW,CAAE,CAAC;EACrC,CAAC;EACD,oBACC,IAAAjC,WAAA,CAAAwB,GAAA;IAAK8C,SAAS,EAAC,iDAAiD;IAAA3C,QAAA,eAC/D,IAAA3B,WAAA,CAAAwB,GAAA,EAAChC,WAAA,CAAA+E,cAAc;MACdC,KAAK,EAAG3C,QAAQ,CAAChB,IAAM;MACvByB,KAAK,EAAGA,KAAO;MACfmC,aAAa,EAAG/B,eAAiB;MACjCF,WAAW,EAAGA,WAAa;MAC3BkC,gBAAgB,EAAGC,4BAAgB;MACnC1D,QAAQ,EAAG+C,aAAe;MAC1BY,uBAAuB,EAAG,KAAO;MACjCC,uBAAuB;MACvBC,qBAAqB;IAAA,CACrB;EAAC,CACE,CAAC;AAER","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_components","require","_data","_coreData","_element","_compose","_htmlEntities","_utils","_jsxRuntime","EMPTY_ARRAY","BASE_QUERY","order","_fields","context","getTermIdByTermValue","terms","termValue","termId","id","find","term","name","termValueLower","toLocaleLowerCase","TaxonomyControls","onChange","query","postType","taxQuery","taxonomies","useTaxonomies","length","jsx","__experimentalVStack","spacing","children","map","taxonomy","termIds","slug","handleChange","newTermIds","TaxonomyItem","search","setSearch","useState","value","setValue","suggestions","setSuggestions","debouncedSearch","useDebounce","searchResults","searchHasResolved","useSelect","select","getEntityRecords","hasFinishedResolution","coreStore","selectorArgs","orderby","exclude","per_page","existingTerms","include","useEffect","sanitizedValue","reduce","accumulator","entity","push","result","onTermsChange","newTermValues","Set","add","Array","from","className","FormTokenField","label","onInputChange","displayTransform","decodeEntities","__experimentalShowHowTo","__nextHasNoMarginBottom","__next40pxDefaultSize"],"sources":["@wordpress/block-library/src/query/edit/inspector-controls/taxonomy-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tFormTokenField,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, useEffect } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { useTaxonomies } from '../../utils';\n\nconst EMPTY_ARRAY = [];\nconst BASE_QUERY = {\n\torder: 'asc',\n\t_fields: 'id,name',\n\tcontext: 'view',\n};\n\n// Helper function to get the term id based on user input in terms `FormTokenField`.\nconst getTermIdByTermValue = ( terms, termValue ) => {\n\t// First we check for exact match by `term.id` or case sensitive `term.name` match.\n\tconst termId =\n\t\ttermValue?.id || terms?.find( ( term ) => term.name === termValue )?.id;\n\tif ( termId ) {\n\t\treturn termId;\n\t}\n\n\t/**\n\t * Here we make an extra check for entered terms in a non case sensitive way,\n\t * to match user expectations, due to `FormTokenField` behaviour that shows\n\t * suggestions which are case insensitive.\n\t *\n\t * Although WP tries to discourage users to add terms with the same name (case insensitive),\n\t * it's still possible if you manually change the name, as long as the terms have different slugs.\n\t * In this edge case we always apply the first match from the terms list.\n\t */\n\tconst termValueLower = termValue.toLocaleLowerCase();\n\treturn terms?.find(\n\t\t( term ) => term.name.toLocaleLowerCase() === termValueLower\n\t)?.id;\n};\n\nexport function TaxonomyControls( { onChange, query } ) {\n\tconst { postType, taxQuery } = query;\n\n\tconst taxonomies = useTaxonomies( postType );\n\tif ( ! taxonomies || taxonomies.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<VStack spacing={ 4 }>\n\t\t\t{ taxonomies.map( ( taxonomy ) => {\n\t\t\t\tconst termIds = taxQuery?.[ taxonomy.slug ] || [];\n\t\t\t\tconst handleChange = ( newTermIds ) =>\n\t\t\t\t\tonChange( {\n\t\t\t\t\t\ttaxQuery: {\n\t\t\t\t\t\t\t...taxQuery,\n\t\t\t\t\t\t\t[ taxonomy.slug ]: newTermIds,\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\n\t\t\t\treturn (\n\t\t\t\t\t<TaxonomyItem\n\t\t\t\t\t\tkey={ taxonomy.slug }\n\t\t\t\t\t\ttaxonomy={ taxonomy }\n\t\t\t\t\t\ttermIds={ termIds }\n\t\t\t\t\t\tonChange={ handleChange }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</VStack>\n\t);\n}\n\n/**\n * Renders a `FormTokenField` for a given taxonomy.\n *\n * @param {Object} props The props for the component.\n * @param {Object} props.taxonomy The taxonomy object.\n * @param {number[]} props.termIds An array with the block's term ids for the given taxonomy.\n * @param {Function} props.onChange Callback `onChange` function.\n * @return {JSX.Element} The rendered component.\n */\nfunction TaxonomyItem( { taxonomy, termIds, onChange } ) {\n\tconst [ search, setSearch ] = useState( '' );\n\tconst [ value, setValue ] = useState( EMPTY_ARRAY );\n\tconst [ suggestions, setSuggestions ] = useState( EMPTY_ARRAY );\n\tconst debouncedSearch = useDebounce( setSearch, 250 );\n\tconst { searchResults, searchHasResolved } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! search ) {\n\t\t\t\treturn { searchResults: EMPTY_ARRAY, searchHasResolved: true };\n\t\t\t}\n\t\t\tconst { getEntityRecords, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst selectorArgs = [\n\t\t\t\t'taxonomy',\n\t\t\t\ttaxonomy.slug,\n\t\t\t\t{\n\t\t\t\t\t...BASE_QUERY,\n\t\t\t\t\tsearch,\n\t\t\t\t\torderby: 'name',\n\t\t\t\t\texclude: termIds,\n\t\t\t\t\tper_page: 20,\n\t\t\t\t},\n\t\t\t];\n\t\t\treturn {\n\t\t\t\tsearchResults: getEntityRecords( ...selectorArgs ),\n\t\t\t\tsearchHasResolved: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\tselectorArgs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ search, termIds ]\n\t);\n\t// `existingTerms` are the ones fetched from the API and their type is `{ id: number; name: string }`.\n\t// They are used to extract the terms' names to populate the `FormTokenField` properly\n\t// and to sanitize the provided `termIds`, by setting only the ones that exist.\n\tconst existingTerms = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! termIds?.length ) {\n\t\t\t\treturn EMPTY_ARRAY;\n\t\t\t}\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\treturn getEntityRecords( 'taxonomy', taxonomy.slug, {\n\t\t\t\t...BASE_QUERY,\n\t\t\t\tinclude: termIds,\n\t\t\t\tper_page: termIds.length,\n\t\t\t} );\n\t\t},\n\t\t[ termIds ]\n\t);\n\t// Update the `value` state only after the selectors are resolved\n\t// to avoid emptying the input when we're changing terms.\n\tuseEffect( () => {\n\t\tif ( ! termIds?.length ) {\n\t\t\tsetValue( EMPTY_ARRAY );\n\t\t}\n\t\tif ( ! existingTerms?.length ) {\n\t\t\treturn;\n\t\t}\n\t\t// Returns only the existing entity ids. This prevents the component\n\t\t// from crashing in the editor, when non existing ids are provided.\n\t\tconst sanitizedValue = termIds.reduce( ( accumulator, id ) => {\n\t\t\tconst entity = existingTerms.find( ( term ) => term.id === id );\n\t\t\tif ( entity ) {\n\t\t\t\taccumulator.push( {\n\t\t\t\t\tid,\n\t\t\t\t\tvalue: entity.name,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t}, [] );\n\t\tsetValue( sanitizedValue );\n\t}, [ termIds, existingTerms ] );\n\t// Update suggestions only when the query has resolved.\n\tuseEffect( () => {\n\t\tif ( ! searchHasResolved ) {\n\t\t\treturn;\n\t\t}\n\t\tsetSuggestions( searchResults.map( ( result ) => result.name ) );\n\t}, [ searchResults, searchHasResolved ] );\n\tconst onTermsChange = ( newTermValues ) => {\n\t\tconst newTermIds = new Set();\n\t\tfor ( const termValue of newTermValues ) {\n\t\t\tconst termId = getTermIdByTermValue( searchResults, termValue );\n\t\t\tif ( termId ) {\n\t\t\t\tnewTermIds.add( termId );\n\t\t\t}\n\t\t}\n\t\tsetSuggestions( EMPTY_ARRAY );\n\t\tonChange( Array.from( newTermIds ) );\n\t};\n\treturn (\n\t\t<div className=\"block-library-query-inspector__taxonomy-control\">\n\t\t\t<FormTokenField\n\t\t\t\tlabel={ taxonomy.name }\n\t\t\t\tvalue={ value }\n\t\t\t\tonInputChange={ debouncedSearch }\n\t\t\t\tsuggestions={ suggestions }\n\t\t\t\tdisplayTransform={ decodeEntities }\n\t\t\t\tonChange={ onTermsChange }\n\t\t\t\t__experimentalShowHowTo={ false }\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AAA4C,IAAAO,WAAA,GAAAP,OAAA;AAhB5C;AACA;AACA;;AAWA;AACA;AACA;;AAGA,MAAMQ,WAAW,GAAG,EAAE;AACtB,MAAMC,UAAU,GAAG;EAClBC,KAAK,EAAE,KAAK;EACZC,OAAO,EAAE,SAAS;EAClBC,OAAO,EAAE;AACV,CAAC;;AAED;AACA,MAAMC,oBAAoB,GAAGA,CAAEC,KAAK,EAAEC,SAAS,KAAM;EACpD;EACA,MAAMC,MAAM,GACXD,SAAS,EAAEE,EAAE,IAAIH,KAAK,EAAEI,IAAI,CAAIC,IAAI,IAAMA,IAAI,CAACC,IAAI,KAAKL,SAAU,CAAC,EAAEE,EAAE;EACxE,IAAKD,MAAM,EAAG;IACb,OAAOA,MAAM;EACd;;EAEA;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAMK,cAAc,GAAGN,SAAS,CAACO,iBAAiB,CAAC,CAAC;EACpD,OAAOR,KAAK,EAAEI,I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