Commit e9daf2a
Add Navigation Add Page Button (#71192)
* Add Add page button to Navigation block toolbar
- Creates a new hook that adds an Add page button to Navigation blocks
- Button appears in the block toolbar when Navigation block is selected
- Clicking the button inserts a new navigation-link block at the end
- Hook follows the same pattern as navigation-link-view-button.js
- Button works in all editing modes (not just contentOnly)
* Fix Navigation Link Block to use contentOnly mode
- Added useBlockEditingMode hook import
- Used useBlockEditingMode() to get current block editing mode
- Fixed undefined blockEditingMode variable error
- Navigation Link Block now properly respects contentOnly mode
* Move Navigation Add Page Button from hook to Navigation block
- Moved NavigationAddPageButton component directly into Navigation block edit/index.js
- Added required imports: ToolbarButton, ToolbarGroup, page icon, createBlock, __unstableBlockToolbarLastItem
- Removed old navigation-add-page-button.js hook file
- Removed import from hooks/index.js
- Component now renders directly in Navigation block when isEntityAvailable is true
- Maintains same functionality: only shows in contentOnly mode
* Use DEFAULT_BLOCK constant from constants.js for createBlock
- Import DEFAULT_BLOCK from ../constants
- Replace hardcoded 'core/navigation-link' with DEFAULT_BLOCK.name
- Makes the code more maintainable and consistent with constants usage
* Use DEFAULT_BLOCK attributes when creating navigation link block
- Pass kind and type attributes from DEFAULT_BLOCK constant to createBlock
- Ensures new navigation link blocks are created with consistent default attributes
- Makes the block creation more robust and aligned with constants
* Pull in correct attributes for new block
Co-authored-by: getdave <get_dave@git.wordpress.org>
Co-authored-by: scruffian <scruffian@git.wordpress.org>1 parent c3f4b72 commit e9daf2a
File tree
1 file changed
+50
-1
lines changed1 file changed
+50
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| 44 | + | |
| 45 | + | |
43 | 46 | | |
44 | 47 | | |
45 | 48 | | |
46 | | - | |
| 49 | + | |
| 50 | + | |
47 | 51 | | |
48 | 52 | | |
49 | 53 | | |
| |||
75 | 79 | | |
76 | 80 | | |
77 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
78 | 124 | | |
79 | 125 | | |
80 | 126 | | |
| |||
937 | 983 | | |
938 | 984 | | |
939 | 985 | | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
940 | 989 | | |
941 | 990 | | |
942 | 991 | | |
| |||
0 commit comments