-
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
Move Reusable Block definition from blocks module to editor module #3967
Conversation
By having the definition in the `editor` module, we are able to easily access the redux store using the selectors and actions defined in `editor/selectors.js` and `editor/actions.js`.
I actually think all the blocks should be defined outside of the "blocks" module which should contain only the "API" and the "reusable pieces" :) What about the stylesheets? should we update the webpack config to extract the block styles properly from this new folder (separate style.scss and editor.scss same as we do in the blocks module). Though I wonder where "editor/library/block/edit-panel/style.scss" would have been loaded, it should be loaded in the editor's stylesheet but I wonder if it works because its name is "style.scss" |
We import that SCSS file into
And our CSS loader will pick up anything with the Lines 124 to 130 in f1fc7b6
|
@noisysocks I guess since we do not have any "frontend" block style in the "editor" module, this would work right now but if ever we introduce some of these styles later, this would break. I'm ok leaving this for later. |
Shouldn't we treat Reusable Block as another edit mode and move the handling to I discovered 3 bugs when working on #4009:
I'm not convinced what it the best solution, but it definitely needs some further thinking how to tackle it to make it easier to maintain together with other moving pieces. |
This is a quite interesting idea. I'm sure they shouldn't be bootstrapped as part of importing |
Reusable blocks should just disable the HTML support IMO |
I think this is worth exploring. I've also noticed some weird behaviour with using the keyboard to move between and edit Reusable Blocks. It might be that our approach of keeping everything compartmentalised within the |
Another issue related to Reusable Blocks I stumbled upon today: The wrapper component gets added to the recent blocks list. It isn't useful without nested block... @youknowriad, @aduth: How do you feel about the idea of refactoring Reusable Blocks as an editor feature build upon hooks API? Let's say each block could opt out of being reusable using: support: {
reusable: false,
}, We would detect if the block is set as reusable using existing |
This bug was filed here: #3793 |
Going to close this PR for now as it's very stale. Let's revisit this later. |
Inspired by this comment by @youknowriad, I though I'd try moving the Reusable Block block definition from the
blocks
module to theeditor
module.The benefit of doing this is:
core/block
is tightly coupled to the redux state that lives inside theeditor
module.editor/selectors.js
andeditor/actions.js
.I chose
editor/library
as the place where these tightly coupled block definitions live so as to closely mirrorblocks/library
. Happy to change this though.To test:
cc. @youknowriad @aduth