Closed MAX-786 closed 3 months ago
I am thinking to use volto's block engine to render these blocks behind the iframe and set the selected prop based on the block clicked in iframe.
AFAIK See This BlocksForm renders the blocks in Volto and Block Edit component handles displaying the selected block's settings in the sidebar. So to update Sidebar, what if we use This Block Edit Component to set this.props.selected to true whenever this.state.selectedBlock.uid matches with this.props.id.
I am thinking to use volto's block engine to render these blocks behind the iframe and set the selected prop based on the block clicked in iframe.
AFAIK See This BlocksForm renders the blocks in Volto and Block Edit component handles displaying the selected block's settings in the sidebar. So to update Sidebar, what if we use This Block Edit Component to set this.props.selected to true whenever this.state.selectedBlock.uid matches with this.props.id.
As discussed in this weeks sprint planning, this works fine as all of the sidebar updating logic is kept in this component. As long as the actual rendering of the block is disabled (and any other potential side-effects the component may have), it should be fine to re-use this component for now. An argument could be made that this logic should be split up and moved to another file in core Volto.
are you removing enableBlockClickListener() later or now?
done
@MAX-786 It's a little difficult to see what's changed in the Edit shadow, but I think it's all good apart from the few comments I left
If you have the time, it would be great if you could make a PR to core Volto with the setSelectedBlock
changes!
@MAX-786 It's a little difficult to see what's changed in the Edit shadow, but I think it's all good apart from the few comments I left
nothing major. let me point them out
@MAX-786 All fine on the changes in the Edit shadow then. I've merged #49 into main and brought the changes into this PR. Can you check this PR over again with your frontend and fix up the comments I'd left please all good? We're good to use the GitHub Squash & Merge then as I resolved the conflicts with the other branches
fix up the comments I'd left please all good? We're good to use the GitHub Squash & Merge then as I resolved the conflicts with the other branches
Yep I'll fix them up right now, u mean the previous ones tho, right?
@MAX-786 Yes, I've merged the changes from #49 into this one (and also into #60 )
@djay @JeffersonBledsoe LGTM!
Fixes #23
I am thinking to use volto's block engine to render these blocks behind the iframe and set the selected prop based on the block clicked in iframe.
I setup a redux state 'selectedBlock', so that whenever a block is clicked which have an attribute 'data-block-uid={}', it will dispatch a action and its uid is stored in selectedBlock.
First, hide the Edit Form by setting it's display to none so that iframe is shown inplace of blocks. So we can still use the Edit component to open block's settings. Then, In Block Edit component, use the redux state 'selectedBlock' which contains 'uid' of a clicked block. We need to find a way to set this.props.seletected to true whenever this.state.selectedBlock.uid matches with this.props.id.