-
Notifications
You must be signed in to change notification settings - Fork 3
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
I can manage container blocks #99
Comments
@MAX-786 of the things that are left this is the thing I'd most like to see What it means is that if we have a block like the grid - https://demo.plone.org/block/grid-block/text.
So the goal of a demo would be just to be able to add a block to a grid block, remove it and DND it in and out. btw. Not really sure what they did in https://demo.plone.org/block/grid-block/text to allow multiline text. but it doesn't seem right to me to have paragraphs be seperate blocks outside a grid but one block inside a block.
|
for the integrator. json looks like "debb8187-e54f-4cad-8301-2343d65e2024": {
"@type": "gridBlock",
"blocks": {
"91cdc344-e34c-4387-b0d2-73962abc2559": {
"@type": "slate",
...
},
"b6d056e8-0f7f-453e-b8bc-ef97a654b48f": {
"@type": "slate",
...
}
},
"blocks_layout": {
"items": [
"b6d056e8-0f7f-453e-b8bc-ef97a654b48f",
"91cdc344-e34c-4387-b0d2-73962abc2559"
]
},
"styles": {}
}
}, The integrator needs to tell hydra what html element to place the blocks inside only I think. Something like this? <table data-block-id="..." data-block-container-horizontal="blocks,blocks_layout">
<tr data-block-id="..."><td data-editable-field="value"><p>my text</p></td></td>
<tr data-block-id="..."><td data-editable-field="value"><p>other slate</p></td></td>
</table> You can see in this case the integrator has decided to change how the blocks are rendered when inside a container. which this should allow them to do. Questions
|
If the default block isn't slate but you have multiple choices of block then filling the empty container with the first one isn't that good. the user then has to create a new block, rearrange them and remove the default one. If the max size is 1 that can't be done. There is a couple of options
|
I've given it some thought and put what I think is the best approach in the main comment above. Using the idea of a virtual ChooserBlock as the placeholder to be able to render the add button on an empty container. |
container block will have multiple instructions and since we using staged approach I will open up a PR and break down these into tasks so that we can tryout containers with each integrations. But first want to discuss few things below. @djay few things I am not clear with:
|
@MAX-786 the first one was a mistake which I've now fixed. The rest I've tried to rewrite it to make it clearer. |
Current volto doesn't handle containers very well.
There isn't a built in way to navigate up and down container heirachies and add sub blocks. This was managed by block specific custom code. Removing block custom inline UI we need to have a generic way to manage this.
e.g.
User stories (As an editor...)
Out of scope
Proposed integrator api
if the a block is rendered inside another block then this will automatically be recognised as a container. There isn't a need to know the bounds of the container. Adding a new block after this block will add it to the
blocks
andblocks_layout
fields of the parent block.Blocks are added into a container using the add button after the currently selected block. However this won't work if the container is empty and in fact the container itself can be hard to select if it's empty. In this case hydra will add in the default block into the json (which in most cases will be a special block called the ChooserBlock), so a container is never empty.
ChooserBlock can be rendered as a kind of skeleton for the various kinds of blocks that might be in this container and should be styled to take up the space it's replacement would
data-chooser
attribute an element within that block to act as the default add/chooser iconhide_chooser_add:true
in the container hints.You can add some hints to control the container using
data-block-container
. This contains json. e.g.defaults are
ChooserBlock
min
then a the default block will be created in it's place.The sidebar UI should provide a way to edit settings and select parent blocks
This syntax allows for the top level page to have more than one container instead of just the single "blocks" main section. volto doesn't let allow it but in the future we could use this to have blocks placed in a sidebar or footer etc so they don't have to be all in the middle of the page.
The text was updated successfully, but these errors were encountered: