-
Notifications
You must be signed in to change notification settings - Fork 9
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
Select Block from iframe and its config appear in sidebar #51
Conversation
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. |
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.
Still needs the automatic subscription when blocks are changed or the page is changed. I'll review more closely once that is in place
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.
are you removing enableBlockClickListener() later or now?
Co-authored-by: Dylan Jay <[email protected]>
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 |
packages/volto-hydra/src/customizations/components/manage/Blocks/Block/Edit.jsx
Show resolved
Hide resolved
nothing major. let me point them out |
# Conflicts: # README.md # hydra.js # packages/volto-hydra/src/components/Iframe/View.jsx
@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 |
Yep I'll fix them up right now, u mean the previous ones tho, right? |
@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.