-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Edit Post]: Remove EditPostSettings context provider #36949
Conversation
@@ -127,6 +126,9 @@ function Editor( { | |||
// This is marked as experimental to give time for the quick inserter to mature. | |||
__experimentalSetIsInserterOpened: setIsInserterOpened, | |||
keepCaretInsideBlock, | |||
// Keep a reference of the `allowedBlockTypes` from the server to handle use cases | |||
// where we need to differentiate if a block is disabled by the user or some plugin. | |||
defaultAllowedBlockTypes: settings.allowedBlockTypes, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed right? Or am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be needed because below we override the allowedBlockTypes
in the editor settings taking into account the hiddenBlockTypes
. This results in not being able to show a full list of blocks that are allowed in terms of editor settings but were disabled by the user (BlockManager case).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this a bug in trunk, I fail to see how this related to the removal of the context provider.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a bug, but when BlockManager
was introduced the allowedBlockTypes
was used in combination with the new hiddenBlockTypes
setting. The alternative would be to leave allowedBlockTypes
intact, and take into account hiddenBlockTypes
in every place we would need - mainly in Inserter
logic. This initial decision still makes sense to me as the BlockManager
is more of an 'edge' case in my mind and the inserter logic runs very often.
Makes sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, sorry I got confused :)
Size Change: -26 B (0%) Total Size: 1.1 MB
ℹ️ View Unchanged
|
By working on post-editor for another issue, I noticed that we had a context provider that was used only to differentiate if a block is disabled by the user or some plugin.
This PR removes this provider by adding the original value in editor settings and also refactors a bit the
BlockManagerCategory
to stop using `withSelect, withDispatch, etc...