@wordpress/editor 14.33.9 → 14.33.10

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.
@@ -56,17 +56,14 @@ function TemplatePartNavigationEditButton({ clientId }) {
56
56
  if (!hasNavigationBlocks || !isNavigationEditable) {
57
57
  return null;
58
58
  }
59
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockControls, { group: "other", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.ToolbarGroup, { children: [
60
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalDivider, { orientation: "vertical", marginEnd: 3 }),
61
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
62
- import_components.ToolbarButton,
63
- {
64
- label: (0, import_i18n.__)("Edit navigation"),
65
- onClick: onEditNavigation,
66
- children: (0, import_i18n.__)("Edit navigation")
67
- }
68
- )
69
- ] }) });
59
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.__unstableBlockToolbarLastItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
60
+ import_components.ToolbarButton,
61
+ {
62
+ label: (0, import_i18n.__)("Edit navigation"),
63
+ onClick: onEditNavigation,
64
+ children: (0, import_i18n.__)("Edit navigation")
65
+ }
66
+ ) }) });
70
67
  }
71
68
  const withTemplatePartNavigationEditButton = (0, import_compose.createHigherOrderComponent)(
72
69
  (BlockEdit) => (props) => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/hooks/template-part-navigation-edit-button.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tToolbarButton,\n\tToolbarGroup,\n\t__experimentalDivider as Divider,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n// Block name constants\nconst NAVIGATION_BLOCK_NAME = 'core/navigation';\nconst TEMPLATE_PART_BLOCK_NAME = 'core/template-part';\n\n// Complementary area identifier for the block inspector\nconst BLOCK_INSPECTOR_AREA = 'edit-post/block';\n\n/**\n * Component that renders the \"Edit navigation\" button for template parts\n * that contain navigation blocks.\n *\n * @param {Object} props Component props.\n * @param {string} props.clientId The template part block client ID.\n * @return {JSX.Element|null} The Edit navigation button component or null if not applicable.\n */\nfunction TemplatePartNavigationEditButton( { clientId } ) {\n\tconst { selectBlock, flashBlock } = useDispatch( blockEditorStore );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tconst {\n\t\thasNavigationBlocks,\n\t\tfirstNavigationBlockId,\n\t\tisNavigationEditable,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetClientIdsOfDescendants,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst descendants = getClientIdsOfDescendants( clientId );\n\t\t\tconst navigationBlocksInTemplatePart = descendants.filter(\n\t\t\t\t( blockId ) => getBlockName( blockId ) === NAVIGATION_BLOCK_NAME\n\t\t\t);\n\n\t\t\tconst _hasNavigationBlocks =\n\t\t\t\tnavigationBlocksInTemplatePart.length > 0;\n\t\t\tconst _firstNavigationBlockId = _hasNavigationBlocks\n\t\t\t\t? navigationBlocksInTemplatePart[ 0 ]\n\t\t\t\t: null;\n\n\t\t\treturn {\n\t\t\t\thasNavigationBlocks: _hasNavigationBlocks,\n\t\t\t\tfirstNavigationBlockId: _firstNavigationBlockId,\n\t\t\t\t// We can't use the useBlockEditingMode hook here because the current\n\t\t\t\t// context is the template part, not the navigation block.\n\t\t\t\tisNavigationEditable:\n\t\t\t\t\tgetBlockEditingMode( _firstNavigationBlockId ) !==\n\t\t\t\t\t'disabled',\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst onEditNavigation = useCallback( () => {\n\t\tif ( firstNavigationBlockId ) {\n\t\t\t// Select the first Navigation block\n\t\t\tselectBlock( firstNavigationBlockId );\n\n\t\t\t// Flash the block for 500ms to make it obvious\n\t\t\tflashBlock( firstNavigationBlockId, 500 );\n\n\t\t\t// Enable the complementary area (inspector)\n\t\t\tenableComplementaryArea( 'core', BLOCK_INSPECTOR_AREA );\n\t\t}\n\t}, [\n\t\tfirstNavigationBlockId,\n\t\tselectBlock,\n\t\tflashBlock,\n\t\tenableComplementaryArea,\n\t] );\n\n\t// Only show if template part contains navigation blocks and they are editable\n\tif ( ! hasNavigationBlocks || ! isNavigationEditable ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockControls group=\"other\">\n\t\t\t<ToolbarGroup>\n\t\t\t\t{ /*\n\t\t\t\t * Add a vertical divider to visually separate the \"Edit navigation\"\n\t\t\t\t * button from the template part's \"Edit\" button. Both buttons share\n\t\t\t\t * the same toolbar group (\"other\"), so without this divider they\n\t\t\t\t * would appear directly adjacent with no visual separation.\n\t\t\t\t */ }\n\t\t\t\t<Divider orientation=\"vertical\" marginEnd={ 3 } />\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tlabel={ __( 'Edit navigation' ) }\n\t\t\t\t\tonClick={ onEditNavigation }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Edit navigation' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n}\n\n/**\n * Higher-order component that adds the Edit navigation button to template part blocks.\n */\nconst withTemplatePartNavigationEditButton = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst isTemplatePart = props.name === TEMPLATE_PART_BLOCK_NAME;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t\t{ props.isSelected && isTemplatePart && (\n\t\t\t\t\t<TemplatePartNavigationEditButton\n\t\t\t\t\t\tclientId={ props.clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withTemplatePartNavigationEditButton'\n);\n\n// Register the filter.\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/with-template-part-navigation-edit-button',\n\twithTemplatePartNavigationEditButton\n);\n"],
5
- "mappings": ";AAmGG;AAhGH,mBAA0B;AAC1B,qBAA2C;AAC3C,qBAA4B;AAC5B,kBAAmB;AACnB,0BAGO;AACP,wBAIO;AACP,kBAAuC;AACvC,uBAAwC;AAGxC,MAAM,wBAAwB;AAC9B,MAAM,2BAA2B;AAGjC,MAAM,uBAAuB;AAU7B,SAAS,iCAAkC,EAAE,SAAS,GAAI;AACzD,QAAM,EAAE,aAAa,WAAW,QAAI,yBAAa,oBAAAA,KAAiB;AAClE,QAAM,EAAE,wBAAwB,QAAI,yBAAa,iBAAAC,KAAe;AAEhE,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACD,QAAI;AAAA,IACH,CAAE,WAAY;AACb,YAAM;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,MACD,IAAI,OAAQ,oBAAAD,KAAiB;AAE7B,YAAM,cAAc,0BAA2B,QAAS;AACxD,YAAM,iCAAiC,YAAY;AAAA,QAClD,CAAE,YAAa,aAAc,OAAQ,MAAM;AAAA,MAC5C;AAEA,YAAM,uBACL,+BAA+B,SAAS;AACzC,YAAM,0BAA0B,uBAC7B,+BAAgC,CAAE,IAClC;AAEH,aAAO;AAAA,QACN,qBAAqB;AAAA,QACrB,wBAAwB;AAAA;AAAA;AAAA,QAGxB,sBACC,oBAAqB,uBAAwB,MAC7C;AAAA,MACF;AAAA,IACD;AAAA,IACA,CAAE,QAAS;AAAA,EACZ;AAEA,QAAM,uBAAmB,4BAAa,MAAM;AAC3C,QAAK,wBAAyB;AAE7B,kBAAa,sBAAuB;AAGpC,iBAAY,wBAAwB,GAAI;AAGxC,8BAAyB,QAAQ,oBAAqB;AAAA,IACvD;AAAA,EACD,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AAGF,MAAK,CAAE,uBAAuB,CAAE,sBAAuB;AACtD,WAAO;AAAA,EACR;AAEA,SACC,4CAAC,qCAAc,OAAM,SACpB,uDAAC,kCAOA;AAAA,gDAAC,kBAAAE,uBAAA,EAAQ,aAAY,YAAW,WAAY,GAAI;AAAA,IAChD;AAAA,MAAC;AAAA;AAAA,QACA,WAAQ,gBAAI,iBAAkB;AAAA,QAC9B,SAAU;AAAA,QAER,8BAAI,iBAAkB;AAAA;AAAA,IACzB;AAAA,KACD,GACD;AAEF;AAKA,MAAM,2CAAuC;AAAA,EAC5C,CAAE,cAAe,CAAE,UAAW;AAC7B,UAAM,iBAAiB,MAAM,SAAS;AAEtC,WACC,4EACC;AAAA,kDAAC,aAAuB,GAAG,SAAZ,MAAoB;AAAA,MACjC,MAAM,cAAc,kBACrB;AAAA,QAAC;AAAA;AAAA,UACA,UAAW,MAAM;AAAA;AAAA,MAClB;AAAA,OAEF;AAAA,EAEF;AAAA,EACA;AACD;AAAA,IAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;",
6
- "names": ["blockEditorStore", "interfaceStore", "Divider"]
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__unstableBlockToolbarLastItem as BlockToolbarLastItem,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n// Block name constants\nconst NAVIGATION_BLOCK_NAME = 'core/navigation';\nconst TEMPLATE_PART_BLOCK_NAME = 'core/template-part';\n\n// Complementary area identifier for the block inspector\nconst BLOCK_INSPECTOR_AREA = 'edit-post/block';\n\n/**\n * Component that renders the \"Edit navigation\" button for template parts\n * that contain navigation blocks.\n *\n * @param {Object} props Component props.\n * @param {string} props.clientId The template part block client ID.\n * @return {JSX.Element|null} The Edit navigation button component or null if not applicable.\n */\nfunction TemplatePartNavigationEditButton( { clientId } ) {\n\tconst { selectBlock, flashBlock } = useDispatch( blockEditorStore );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tconst {\n\t\thasNavigationBlocks,\n\t\tfirstNavigationBlockId,\n\t\tisNavigationEditable,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetClientIdsOfDescendants,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst descendants = getClientIdsOfDescendants( clientId );\n\t\t\tconst navigationBlocksInTemplatePart = descendants.filter(\n\t\t\t\t( blockId ) => getBlockName( blockId ) === NAVIGATION_BLOCK_NAME\n\t\t\t);\n\n\t\t\tconst _hasNavigationBlocks =\n\t\t\t\tnavigationBlocksInTemplatePart.length > 0;\n\t\t\tconst _firstNavigationBlockId = _hasNavigationBlocks\n\t\t\t\t? navigationBlocksInTemplatePart[ 0 ]\n\t\t\t\t: null;\n\n\t\t\treturn {\n\t\t\t\thasNavigationBlocks: _hasNavigationBlocks,\n\t\t\t\tfirstNavigationBlockId: _firstNavigationBlockId,\n\t\t\t\t// We can't use the useBlockEditingMode hook here because the current\n\t\t\t\t// context is the template part, not the navigation block.\n\t\t\t\tisNavigationEditable:\n\t\t\t\t\tgetBlockEditingMode( _firstNavigationBlockId ) !==\n\t\t\t\t\t'disabled',\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst onEditNavigation = useCallback( () => {\n\t\tif ( firstNavigationBlockId ) {\n\t\t\t// Select the first Navigation block\n\t\t\tselectBlock( firstNavigationBlockId );\n\n\t\t\t// Flash the block for 500ms to make it obvious\n\t\t\tflashBlock( firstNavigationBlockId, 500 );\n\n\t\t\t// Enable the complementary area (inspector)\n\t\t\tenableComplementaryArea( 'core', BLOCK_INSPECTOR_AREA );\n\t\t}\n\t}, [\n\t\tfirstNavigationBlockId,\n\t\tselectBlock,\n\t\tflashBlock,\n\t\tenableComplementaryArea,\n\t] );\n\n\t// Only show if template part contains navigation blocks and they are editable\n\tif ( ! hasNavigationBlocks || ! isNavigationEditable ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockToolbarLastItem>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tlabel={ __( 'Edit navigation' ) }\n\t\t\t\t\tonClick={ onEditNavigation }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Edit navigation' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</ToolbarGroup>\n\t\t</BlockToolbarLastItem>\n\t);\n}\n\n/**\n * Higher-order component that adds the Edit navigation button to template part blocks.\n */\nconst withTemplatePartNavigationEditButton = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst isTemplatePart = props.name === TEMPLATE_PART_BLOCK_NAME;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t\t{ props.isSelected && isTemplatePart && (\n\t\t\t\t\t<TemplatePartNavigationEditButton\n\t\t\t\t\t\tclientId={ props.clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withTemplatePartNavigationEditButton'\n);\n\n// Register the filter.\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/with-template-part-navigation-edit-button',\n\twithTemplatePartNavigationEditButton\n);\n"],
5
+ "mappings": ";AAgGI;AA7FJ,mBAA0B;AAC1B,qBAA2C;AAC3C,qBAA4B;AAC5B,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,MAER,8BAAI,iBAAkB;AAAA;AAAA,EACzB,GACD,GACD;AAEF;AAKA,MAAM,2CAAuC;AAAA,EAC5C,CAAE,cAAe,CAAE,UAAW;AAC7B,UAAM,iBAAiB,MAAM,SAAS;AAEtC,WACC,4EACC;AAAA,kDAAC,aAAuB,GAAG,SAAZ,MAAoB;AAAA,MACjC,MAAM,cAAc,kBACrB;AAAA,QAAC;AAAA;AAAA,UACA,UAAW,MAAM;AAAA;AAAA,MAClB;AAAA,OAEF;AAAA,EAEF;AAAA,EACA;AACD;AAAA,IAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;",
6
+ "names": ["blockEditorStore", "interfaceStore", "BlockToolbarLastItem"]
7
7
  }
@@ -4,14 +4,10 @@ import { createHigherOrderComponent } from "@wordpress/compose";
4
4
  import { useCallback } from "@wordpress/element";
5
5
  import { __ } from "@wordpress/i18n";
6
6
  import {
7
- BlockControls,
7
+ __unstableBlockToolbarLastItem as BlockToolbarLastItem,
8
8
  store as blockEditorStore
9
9
  } from "@wordpress/block-editor";
10
- import {
11
- ToolbarButton,
12
- ToolbarGroup,
13
- __experimentalDivider as Divider
14
- } from "@wordpress/components";
10
+ import { ToolbarButton, ToolbarGroup } from "@wordpress/components";
15
11
  import { useSelect, useDispatch } from "@wordpress/data";
16
12
  import { store as interfaceStore } from "@wordpress/interface";
17
13
  const NAVIGATION_BLOCK_NAME = "core/navigation";
@@ -62,17 +58,14 @@ function TemplatePartNavigationEditButton({ clientId }) {
62
58
  if (!hasNavigationBlocks || !isNavigationEditable) {
63
59
  return null;
64
60
  }
65
- return /* @__PURE__ */ jsx(BlockControls, { group: "other", children: /* @__PURE__ */ jsxs(ToolbarGroup, { children: [
66
- /* @__PURE__ */ jsx(Divider, { orientation: "vertical", marginEnd: 3 }),
67
- /* @__PURE__ */ jsx(
68
- ToolbarButton,
69
- {
70
- label: __("Edit navigation"),
71
- onClick: onEditNavigation,
72
- children: __("Edit navigation")
73
- }
74
- )
75
- ] }) });
61
+ return /* @__PURE__ */ jsx(BlockToolbarLastItem, { children: /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(
62
+ ToolbarButton,
63
+ {
64
+ label: __("Edit navigation"),
65
+ onClick: onEditNavigation,
66
+ children: __("Edit navigation")
67
+ }
68
+ ) }) });
76
69
  }
77
70
  const withTemplatePartNavigationEditButton = createHigherOrderComponent(
78
71
  (BlockEdit) => (props) => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/hooks/template-part-navigation-edit-button.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tToolbarButton,\n\tToolbarGroup,\n\t__experimentalDivider as Divider,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n// Block name constants\nconst NAVIGATION_BLOCK_NAME = 'core/navigation';\nconst TEMPLATE_PART_BLOCK_NAME = 'core/template-part';\n\n// Complementary area identifier for the block inspector\nconst BLOCK_INSPECTOR_AREA = 'edit-post/block';\n\n/**\n * Component that renders the \"Edit navigation\" button for template parts\n * that contain navigation blocks.\n *\n * @param {Object} props Component props.\n * @param {string} props.clientId The template part block client ID.\n * @return {JSX.Element|null} The Edit navigation button component or null if not applicable.\n */\nfunction TemplatePartNavigationEditButton( { clientId } ) {\n\tconst { selectBlock, flashBlock } = useDispatch( blockEditorStore );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tconst {\n\t\thasNavigationBlocks,\n\t\tfirstNavigationBlockId,\n\t\tisNavigationEditable,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetClientIdsOfDescendants,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst descendants = getClientIdsOfDescendants( clientId );\n\t\t\tconst navigationBlocksInTemplatePart = descendants.filter(\n\t\t\t\t( blockId ) => getBlockName( blockId ) === NAVIGATION_BLOCK_NAME\n\t\t\t);\n\n\t\t\tconst _hasNavigationBlocks =\n\t\t\t\tnavigationBlocksInTemplatePart.length > 0;\n\t\t\tconst _firstNavigationBlockId = _hasNavigationBlocks\n\t\t\t\t? navigationBlocksInTemplatePart[ 0 ]\n\t\t\t\t: null;\n\n\t\t\treturn {\n\t\t\t\thasNavigationBlocks: _hasNavigationBlocks,\n\t\t\t\tfirstNavigationBlockId: _firstNavigationBlockId,\n\t\t\t\t// We can't use the useBlockEditingMode hook here because the current\n\t\t\t\t// context is the template part, not the navigation block.\n\t\t\t\tisNavigationEditable:\n\t\t\t\t\tgetBlockEditingMode( _firstNavigationBlockId ) !==\n\t\t\t\t\t'disabled',\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst onEditNavigation = useCallback( () => {\n\t\tif ( firstNavigationBlockId ) {\n\t\t\t// Select the first Navigation block\n\t\t\tselectBlock( firstNavigationBlockId );\n\n\t\t\t// Flash the block for 500ms to make it obvious\n\t\t\tflashBlock( firstNavigationBlockId, 500 );\n\n\t\t\t// Enable the complementary area (inspector)\n\t\t\tenableComplementaryArea( 'core', BLOCK_INSPECTOR_AREA );\n\t\t}\n\t}, [\n\t\tfirstNavigationBlockId,\n\t\tselectBlock,\n\t\tflashBlock,\n\t\tenableComplementaryArea,\n\t] );\n\n\t// Only show if template part contains navigation blocks and they are editable\n\tif ( ! hasNavigationBlocks || ! isNavigationEditable ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockControls group=\"other\">\n\t\t\t<ToolbarGroup>\n\t\t\t\t{ /*\n\t\t\t\t * Add a vertical divider to visually separate the \"Edit navigation\"\n\t\t\t\t * button from the template part's \"Edit\" button. Both buttons share\n\t\t\t\t * the same toolbar group (\"other\"), so without this divider they\n\t\t\t\t * would appear directly adjacent with no visual separation.\n\t\t\t\t */ }\n\t\t\t\t<Divider orientation=\"vertical\" marginEnd={ 3 } />\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tlabel={ __( 'Edit navigation' ) }\n\t\t\t\t\tonClick={ onEditNavigation }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Edit navigation' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n}\n\n/**\n * Higher-order component that adds the Edit navigation button to template part blocks.\n */\nconst withTemplatePartNavigationEditButton = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst isTemplatePart = props.name === TEMPLATE_PART_BLOCK_NAME;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t\t{ props.isSelected && isTemplatePart && (\n\t\t\t\t\t<TemplatePartNavigationEditButton\n\t\t\t\t\t\tclientId={ props.clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withTemplatePartNavigationEditButton'\n);\n\n// Register the filter.\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/with-template-part-navigation-edit-button',\n\twithTemplatePartNavigationEditButton\n);\n"],
5
- "mappings": "AAmGG,SA2BA,UApBC,KAPD;AAhGH,SAAS,iBAAiB;AAC1B,SAAS,kCAAkC;AAC3C,SAAS,mBAAmB;AAC5B,SAAS,UAAU;AACnB;AAAA,EACC;AAAA,EACA,SAAS;AAAA,OACH;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA,yBAAyB;AAAA,OACnB;AACP,SAAS,WAAW,mBAAmB;AACvC,SAAS,SAAS,sBAAsB;AAGxC,MAAM,wBAAwB;AAC9B,MAAM,2BAA2B;AAGjC,MAAM,uBAAuB;AAU7B,SAAS,iCAAkC,EAAE,SAAS,GAAI;AACz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,SAAS;AAEtC,WACC,iCACC;AAAA,0BAAC,aAAuB,GAAG,SAAZ,MAAoB;AAAA,MACjC,MAAM,cAAc,kBACrB;AAAA,QAAC;AAAA;AAAA,UACA,UAAW,MAAM;AAAA;AAAA,MAClB;AAAA,OAEF;AAAA,EAEF;AAAA,EACA;AACD;AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__unstableBlockToolbarLastItem as BlockToolbarLastItem,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n// Block name constants\nconst NAVIGATION_BLOCK_NAME = 'core/navigation';\nconst TEMPLATE_PART_BLOCK_NAME = 'core/template-part';\n\n// Complementary area identifier for the block inspector\nconst BLOCK_INSPECTOR_AREA = 'edit-post/block';\n\n/**\n * Component that renders the \"Edit navigation\" button for template parts\n * that contain navigation blocks.\n *\n * @param {Object} props Component props.\n * @param {string} props.clientId The template part block client ID.\n * @return {JSX.Element|null} The Edit navigation button component or null if not applicable.\n */\nfunction TemplatePartNavigationEditButton( { clientId } ) {\n\tconst { selectBlock, flashBlock } = useDispatch( blockEditorStore );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tconst {\n\t\thasNavigationBlocks,\n\t\tfirstNavigationBlockId,\n\t\tisNavigationEditable,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetClientIdsOfDescendants,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst descendants = getClientIdsOfDescendants( clientId );\n\t\t\tconst navigationBlocksInTemplatePart = descendants.filter(\n\t\t\t\t( blockId ) => getBlockName( blockId ) === NAVIGATION_BLOCK_NAME\n\t\t\t);\n\n\t\t\tconst _hasNavigationBlocks =\n\t\t\t\tnavigationBlocksInTemplatePart.length > 0;\n\t\t\tconst _firstNavigationBlockId = _hasNavigationBlocks\n\t\t\t\t? navigationBlocksInTemplatePart[ 0 ]\n\t\t\t\t: null;\n\n\t\t\treturn {\n\t\t\t\thasNavigationBlocks: _hasNavigationBlocks,\n\t\t\t\tfirstNavigationBlockId: _firstNavigationBlockId,\n\t\t\t\t// We can't use the useBlockEditingMode hook here because the current\n\t\t\t\t// context is the template part, not the navigation block.\n\t\t\t\tisNavigationEditable:\n\t\t\t\t\tgetBlockEditingMode( _firstNavigationBlockId ) !==\n\t\t\t\t\t'disabled',\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst onEditNavigation = useCallback( () => {\n\t\tif ( firstNavigationBlockId ) {\n\t\t\t// Select the first Navigation block\n\t\t\tselectBlock( firstNavigationBlockId );\n\n\t\t\t// Flash the block for 500ms to make it obvious\n\t\t\tflashBlock( firstNavigationBlockId, 500 );\n\n\t\t\t// Enable the complementary area (inspector)\n\t\t\tenableComplementaryArea( 'core', BLOCK_INSPECTOR_AREA );\n\t\t}\n\t}, [\n\t\tfirstNavigationBlockId,\n\t\tselectBlock,\n\t\tflashBlock,\n\t\tenableComplementaryArea,\n\t] );\n\n\t// Only show if template part contains navigation blocks and they are editable\n\tif ( ! hasNavigationBlocks || ! isNavigationEditable ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockToolbarLastItem>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tlabel={ __( 'Edit navigation' ) }\n\t\t\t\t\tonClick={ onEditNavigation }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Edit navigation' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</ToolbarGroup>\n\t\t</BlockToolbarLastItem>\n\t);\n}\n\n/**\n * Higher-order component that adds the Edit navigation button to template part blocks.\n */\nconst withTemplatePartNavigationEditButton = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst isTemplatePart = props.name === TEMPLATE_PART_BLOCK_NAME;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t\t{ props.isSelected && isTemplatePart && (\n\t\t\t\t\t<TemplatePartNavigationEditButton\n\t\t\t\t\t\tclientId={ props.clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withTemplatePartNavigationEditButton'\n);\n\n// Register the filter.\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/with-template-part-navigation-edit-button',\n\twithTemplatePartNavigationEditButton\n);\n"],
5
+ "mappings": "AAgGI,SAmBD,UAnBC,KAmBD,YAnBC;AA7FJ,SAAS,iBAAiB;AAC1B,SAAS,kCAAkC;AAC3C,SAAS,mBAAmB;AAC5B,SAAS,UAAU;AACnB;AAAA,EACC,kCAAkC;AAAA,EAClC,SAAS;AAAA,OACH;AACP,SAAS,eAAe,oBAAoB;AAC5C,SAAS,WAAW,mBAAmB;AACvC,SAAS,SAAS,sBAAsB;AAGxC,MAAM,wBAAwB;AAC9B,MAAM,2BAA2B;AAGjC,MAAM,uBAAuB;AAU7B,SAAS,iCAAkC,EAAE,SAAS,GAAI;AACzD,QAAM,EAAE,aAAa,WAAW,IAAI,YAAa,gBAAiB;AAClE,QAAM,EAAE,wBAAwB,IAAI,YAAa,cAAe;AAEhE,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI;AAAA,IACH,CAAE,WAAY;AACb,YAAM;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,MACD,IAAI,OAAQ,gBAAiB;AAE7B,YAAM,cAAc,0BAA2B,QAAS;AACxD,YAAM,iCAAiC,YAAY;AAAA,QAClD,CAAE,YAAa,aAAc,OAAQ,MAAM;AAAA,MAC5C;AAEA,YAAM,uBACL,+BAA+B,SAAS;AACzC,YAAM,0BAA0B,uBAC7B,+BAAgC,CAAE,IAClC;AAEH,aAAO;AAAA,QACN,qBAAqB;AAAA,QACrB,wBAAwB;AAAA;AAAA;AAAA,QAGxB,sBACC,oBAAqB,uBAAwB,MAC7C;AAAA,MACF;AAAA,IACD;AAAA,IACA,CAAE,QAAS;AAAA,EACZ;AAEA,QAAM,mBAAmB,YAAa,MAAM;AAC3C,QAAK,wBAAyB;AAE7B,kBAAa,sBAAuB;AAGpC,iBAAY,wBAAwB,GAAI;AAGxC,8BAAyB,QAAQ,oBAAqB;AAAA,IACvD;AAAA,EACD,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AAGF,MAAK,CAAE,uBAAuB,CAAE,sBAAuB;AACtD,WAAO;AAAA,EACR;AAEA,SACC,oBAAC,wBACA,8BAAC,gBACA;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ,GAAI,iBAAkB;AAAA,MAC9B,SAAU;AAAA,MAER,aAAI,iBAAkB;AAAA;AAAA,EACzB,GACD,GACD;AAEF;AAKA,MAAM,uCAAuC;AAAA,EAC5C,CAAE,cAAe,CAAE,UAAW;AAC7B,UAAM,iBAAiB,MAAM,SAAS;AAEtC,WACC,iCACC;AAAA,0BAAC,aAAuB,GAAG,SAAZ,MAAoB;AAAA,MACjC,MAAM,cAAc,kBACrB;AAAA,QAAC;AAAA;AAAA,UACA,UAAW,MAAM;AAAA;AAAA,MAClB;AAAA,OAEF;AAAA,EAEF;AAAA,EACA;AACD;AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/editor",
3
- "version": "14.33.9",
3
+ "version": "14.33.10",
4
4
  "description": "Enhanced block editor for WordPress posts.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -57,19 +57,19 @@
57
57
  "@wordpress/api-fetch": "^7.33.1",
58
58
  "@wordpress/base-styles": "^6.9.1",
59
59
  "@wordpress/blob": "^4.33.1",
60
- "@wordpress/block-editor": "^15.6.7",
60
+ "@wordpress/block-editor": "^15.6.8",
61
61
  "@wordpress/blocks": "^15.6.2",
62
62
  "@wordpress/commands": "^1.33.4",
63
63
  "@wordpress/components": "^30.6.4",
64
64
  "@wordpress/compose": "^7.33.1",
65
- "@wordpress/core-data": "^7.33.7",
65
+ "@wordpress/core-data": "^7.33.8",
66
66
  "@wordpress/data": "^10.33.1",
67
67
  "@wordpress/dataviews": "^10.1.6",
68
68
  "@wordpress/date": "^5.33.1",
69
69
  "@wordpress/deprecated": "^4.33.1",
70
70
  "@wordpress/dom": "^4.33.1",
71
71
  "@wordpress/element": "^6.33.1",
72
- "@wordpress/fields": "^0.25.9",
72
+ "@wordpress/fields": "^0.25.10",
73
73
  "@wordpress/hooks": "^4.33.1",
74
74
  "@wordpress/html-entities": "^4.33.1",
75
75
  "@wordpress/i18n": "^6.6.1",
@@ -79,11 +79,11 @@
79
79
  "@wordpress/keycodes": "^4.33.1",
80
80
  "@wordpress/media-utils": "^5.33.1",
81
81
  "@wordpress/notices": "^5.33.1",
82
- "@wordpress/patterns": "^2.33.7",
82
+ "@wordpress/patterns": "^2.33.8",
83
83
  "@wordpress/plugins": "^7.33.4",
84
84
  "@wordpress/preferences": "^4.33.4",
85
85
  "@wordpress/private-apis": "^1.33.1",
86
- "@wordpress/reusable-blocks": "^5.33.7",
86
+ "@wordpress/reusable-blocks": "^5.33.8",
87
87
  "@wordpress/rich-text": "^7.33.2",
88
88
  "@wordpress/server-side-render": "^6.9.4",
89
89
  "@wordpress/url": "^4.33.1",
@@ -108,5 +108,5 @@
108
108
  "publishConfig": {
109
109
  "access": "public"
110
110
  },
111
- "gitHead": "1c473d047a0b8f529f07cc1e23324a6be723bbc9"
111
+ "gitHead": "52db1c3ee45bd12b1e3dc65490edc6db5b9ab78f"
112
112
  }
@@ -6,14 +6,10 @@ import { createHigherOrderComponent } from '@wordpress/compose';
6
6
  import { useCallback } from '@wordpress/element';
7
7
  import { __ } from '@wordpress/i18n';
8
8
  import {
9
- BlockControls,
9
+ __unstableBlockToolbarLastItem as BlockToolbarLastItem,
10
10
  store as blockEditorStore,
11
11
  } from '@wordpress/block-editor';
12
- import {
13
- ToolbarButton,
14
- ToolbarGroup,
15
- __experimentalDivider as Divider,
16
- } from '@wordpress/components';
12
+ import { ToolbarButton, ToolbarGroup } from '@wordpress/components';
17
13
  import { useSelect, useDispatch } from '@wordpress/data';
18
14
  import { store as interfaceStore } from '@wordpress/interface';
19
15
 
@@ -96,15 +92,8 @@ function TemplatePartNavigationEditButton( { clientId } ) {
96
92
  }
97
93
 
98
94
  return (
99
- <BlockControls group="other">
95
+ <BlockToolbarLastItem>
100
96
  <ToolbarGroup>
101
- { /*
102
- * Add a vertical divider to visually separate the "Edit navigation"
103
- * button from the template part's "Edit" button. Both buttons share
104
- * the same toolbar group ("other"), so without this divider they
105
- * would appear directly adjacent with no visual separation.
106
- */ }
107
- <Divider orientation="vertical" marginEnd={ 3 } />
108
97
  <ToolbarButton
109
98
  label={ __( 'Edit navigation' ) }
110
99
  onClick={ onEditNavigation }
@@ -112,7 +101,7 @@ function TemplatePartNavigationEditButton( { clientId } ) {
112
101
  { __( 'Edit navigation' ) }
113
102
  </ToolbarButton>
114
103
  </ToolbarGroup>
115
- </BlockControls>
104
+ </BlockToolbarLastItem>
116
105
  );
117
106
  }
118
107