-
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
Reorganize folders within editor #408
Conversation
@aduth @youknowriad pushing a rough PR that expands on #399. |
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.
In general one of the things that makes development on this project pretty hard to follow is frequent renaming of files and components. I agree it makes more sense to do this sooner rather than later, but I'm left wondering how much more there is to do and whether we have an overall plan for how we want things to look.
@@ -7,7 +7,7 @@ import classNames from 'classnames'; | |||
* Internal dependencies | |||
*/ | |||
import './style.scss'; | |||
import Dashicon from 'components/dashicon'; | |||
import Dashicon from 'dashicon'; | |||
|
|||
function Toolbar( { controls } ) { |
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.
Here and elsewhere, if we're changing the filename the component name should also change (to BlockToolbar
in this case).
@@ -7,7 +7,7 @@ import { connect } from 'react-redux'; | |||
* Internal dependencies | |||
*/ | |||
import './style.scss'; | |||
import Dashicon from 'components/dashicon'; | |||
import Dashicon from '../../../components/dashicon'; |
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.
I'm pretty sure this should still just be components/dashicon
- see #386.
@@ -2,7 +2,7 @@ | |||
* Internal dependencies | |||
*/ | |||
import './style.scss'; | |||
import Dashicon from '../../components/dashicon'; | |||
import Dashicon from '../../../components/dashicon'; |
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.
Same, we shouldn't need these relative paths any more.
import Dashicon from '../../../components/dashicon'; | ||
import IconButton from '../../../components/icon-button'; | ||
import Inserter from 'inserter'; | ||
import Button from '../../../components/button'; |
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.
Same, we shouldn't need these relative paths any more. If I'm wrong about that, then it seems like we need to reconsider how the import paths work.
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.
I was having issues with the entry points, but I also put this together very roughly to communicate the structure.
@@ -7,7 +7,7 @@ import classnames from 'classnames'; | |||
/** | |||
* Internal dependencies | |||
*/ | |||
import Toolbar from 'components/toolbar'; | |||
import Toolbar from '../../components/block-toolbar'; |
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.
Should be BlockToolbar
here and in other usage as well.
@@ -7,7 +7,7 @@ import classNames from 'classnames'; | |||
* Internal dependencies | |||
*/ | |||
import './style.scss'; | |||
import Dashicon from 'components/dashicon'; | |||
import Dashicon from 'dashicon'; |
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.
Shouldn't dashicon
still be under components
?
I'd like to see some rationalization for these changes. As configured currently, each of the top-level entry points is intentionally isolated from the others. This does lead to awkward consequences such as two separate components directories in |
The root level
I think it should, but we'll see as it grows. What do you imagine would prevent it from scaling? |
Are they exclusive to the editor though? I am very much curious to see specific examples of how these components would be consumed, both within this project (ideally not relative paths) but more importantly from an external plugin.
This might depend on how we classify components as general-purpose. Is the |
Right now I'm thinking of blocks using them for their UI, the editor using it for the chrome, and other areas of the admin using it in place of html-elements-with-classes as they move to be powered by JS more, and hopefully our element abstraction.
The inserter, for now, seems specific to the editor. Though I can see it becoming more generic and placed within |
In my mind I'm thinking of general purpose as providing usefulness outside the Gutenberg project as a whole, since within the project we won't expect anything except those files within |
Based on https://wpcoredesign.mystagingwebsite.com/gutenberg/#blueprints General components:
Block specific:
Editor specific:
|
@aduth One issue we have if we leave the |
@youknowriad It's a good point to raise. Part of this might depend on whether the inline formatting behaves as an inline toolbar (popup) or part of the selected block's bounding toolbar. In the latter case, this seems more the responsibility of the editor to render and instead the |
I think we should move forward with this. I'm thinking more and more that having a single global module is the way to go. The current folder structure has limits. We can not use components like "dashicon" or "inserter" inside a block or the Editable. For #447 we may use the inserter inside the As mentioned above, the And think use-cases like these, we'll have a lot. |
I'm not opposed to this. It's just a little unclear to me still what folders we'll have, which components go where, and how they're exposed in the global scope for plugins.
I think it's reasonable to consider it a single module already. Even if we created a |
I agree with this. I think we should be very selective about which components we make public, defaulting to hiding things until they are needed. Related issues have arisen with the media library JS bundle already in core: https://core.trac.wordpress.org/changeset/31935 |
Let's take some time to revisit this after we wrap the prototype-parity-milestone next week. |
Moving general components out of it, and flattening structure more.