-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Limit of Next Page (Page Break) block to root level only (#18260)
* WIP - playing around with options to allow limiting of nextpage block to root level only * Changes from code review * Update todo comment * Add unit test * Update packages/block-editor/src/store/selectors.js Co-Authored-By: Enrique Piqueras <epiqueras@users.noreply.github.com> * Fix linting issue Co-Authored-By: Enrique Piqueras <epiqueras@users.noreply.github.com> * Fix linting issue Co-Authored-By: Enrique Piqueras <epiqueras@users.noreply.github.com> * Fix linting issue Co-Authored-By: Enrique Piqueras <epiqueras@users.noreply.github.com> * Changes from review
- Loading branch information
1 parent
383248a
commit 2ebfb64
Showing
3 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1048,6 +1048,12 @@ const canInsertBlockTypeUnmemoized = ( state, blockName, rootClientId = null ) = | |
return list; | ||
} | ||
if ( isArray( list ) ) { | ||
// TODO: when there is a canonical way to detect that we are editing a post | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
epiqueras
Contributor
|
||
// the following check should be changed to something like: | ||
// if ( includes( list, 'core/post-content' ) && getEditorMode() === 'post-content' && item === null ) | ||
if ( includes( list, 'core/post-content' ) && item === null ) { | ||
return true; | ||
} | ||
return includes( list, item ); | ||
} | ||
return defaultResult; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I guess it will be possible to enforce the parent through the block definition at that point.