-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[Try] remove template part from the post editor but not the site editor #37109
Conversation
Just a thought. There is already a |
Thanks for the PR, I think we're getting close to the right approach. Here are some of the questions I have:
|
@youknowriad my take is this:
There is no API to target deep descendants. In this case, an MVP here would blanket-target everything inside the PostContent block, and an ideal solution would also make exceptions for any nested contexts, e.g. PostEditor wouldn't allow template parts, but FooEditor inside PostEditor would. I think we could reach an MVP with a callback such as About the ideal approach, I wonder if having sub-editors would be useful here. For example, PostContent block would technically render a post editor with its own set of settings. The editor in |
@youknowriad I played with a minimal workaround in #37157 |
Thanks for the PR Adam!
Actually the setting is I agree with Riad on this:
Maybe the first step should be to define which are the use cases we want to cover and then think of the best possible API to create. In my mind this should be a merge of existing APIs, augmented to handle cases like --edit |
Fully agreed @ntsekouras . I visually mapped different places we want to target at the moment, like immediate children, specific blocks, deep descendants of specific blocks except for descendants of certain nested blocks etc. It's rough, but looks like this: The problems with
|
Solves #30668
This is an alternative to #37065. As @ntsekouras mentioned:
This means that it's not so much about the editor, as it is about the context.
This PR explores having a contextual label I called
env
for now (Let's absolutely find a better name for that). It is provided be specific blocks, overriding any parent setting like this:The PostContent block would also define that label:
Then, the
TemplatePart
block would declare a support for specific env only, e.g. likesupports.inserterEnv = "site"
.Finally, any inserter triggered inside that BlockList will then filter the blocks like:
For now, this PR is just an exploration, a proof of concept. It has the following shortcomings:
inserter: true/false
andinserterEnv: string
settingsTo that last point, @ntsekouras listed the following use cases:
Perhaps adding
supports.inserter = "callback"
with a callback defined inblock/index.js
would be better suited here than a declarativesupports
entry?cc @gziolo @youknowriad @talldan @priethor