Skip to content
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

EditorRegions: Move to block-editor package, rename to __experimentalEditorSkeleton #20050

Merged
merged 12 commits into from
Feb 7, 2020

Conversation

ockham
Copy link
Contributor

@ockham ockham commented Feb 5, 2020

Description

Move the EditorRegions component from packages/post-editor to packages/block-editor, and rename to __experimentalEditorSkeleton. This component is generic enough that it might come in handy for other consumers -- e.g. packages/edit-site, and 3rd parties. (The specifically intended use case will be a 'custom' build of Gutenberg, with some added UI controls etc.) If this is approved, I hope to continue to extract other reusable components similarly.

How has this been tested?

Rebuild Gutenberg (npm run build), and start it (npx wp-env start). Verify that the editor styling isn't broken (specifically regions like header or sidebar).

Types of changes

Move a component from one package to another. Update style selectors, but retain old class names along new ones for backwards compat.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

@ockham ockham added the [Package] Editor /packages/editor label Feb 5, 2020
@ockham ockham self-assigned this Feb 5, 2020
@gziolo
Copy link
Member

gziolo commented Feb 5, 2020

@youknowriad is your friend, he has a better idea of why this component is in @wordpress/edit-post. I think this component is quite opinionated and I can't tell if it's applicable for edit-site or edit-widgets. However, I understand the point that other projects would like to reuse it to keep the same structure of the content. The only challenge is that kind of components might change the order of items if there is a need to improve flows.

packages/editor/src/components/editor-regions/index.js Outdated Show resolved Hide resolved
{ !! header && (
<div
className="edit-post-editor-regions__header"
className="components-editor-regions__header edit-post-editor-regions__header"
role="region"
/* translators: accessibility text for the top bar landmark region. */
aria-label={ __( 'Editor top bar' ) }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering whether the aria-label are too opinionated and should be made customizable or not. Potentially, they couuld work for any "editor".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, maybe 🤔 I'd go with YAGNI here -- don't make it customizable until needed?

packages/editor/src/components/editor-regions/index.js Outdated Show resolved Hide resolved
@youknowriad youknowriad mentioned this pull request Feb 6, 2020
6 tasks
@ockham ockham requested a review from ellatrix as a code owner February 6, 2020 14:31
@ockham ockham changed the title EditorRegions: Move to editor package EditorRegions: Move to block-editor package, rename to __experimentalEditorSkeleton Feb 6, 2020
@ockham
Copy link
Contributor Author

ockham commented Feb 6, 2020

I moved the component to the block-editor package, and renamed it to __experimentalEditorSkeleton. @youknowriad Care to take another look? 😊

className={ classnames(
className,
'block-editor-editor-skeleton',
'edit-post-editor-regions'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can drop this className tbh. Did you leave it for BC? This seems to be ready to land before beta1 so there shouldn't be any problem to remove the classname.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I left it in for backwards compat. I know of at least one instance in Calypso where we're referring to this class name, and since we were having quite some trouble with class name changes in the past (specifically with the .editor- -> .block-editor- change, see Automattic/wp-calypso#38857, #14420, and #19050), I wanted at least to give a grace period before dropping the old class name.

(Then again, a point can be made that this was never part of a public interface, and that that grace period didn't help in updating the affected Calypso selectors in time before they were dropped in the past either, so 🤷‍♂️ )

@youknowriad
Copy link
Contributor

As part of this PR? 🤔 Or fine to do it in follow-up?

Whatever you think is best, that said, I think it's important to validate that this component is generic enough to be shared properly.

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍

@ockham
Copy link
Contributor Author

ockham commented Feb 6, 2020

As part of this PR? thinking Or fine to do it in follow-up?

Whatever you think is best, that said, I think it's important to validate that this component is generic enough to be shared properly.

I'll file a follow-up; if there are any changes needed to EditorSkeleton, I'll make them there.

@youknowriad
Copy link
Contributor

youknowriad commented Feb 7, 2020

you can merge since it's approved. I figured you might be waiting for me?

@youknowriad youknowriad merged commit de7c442 into master Feb 7, 2020
@youknowriad youknowriad deleted the move/editor-scaffolding-to-editor-package branch February 7, 2020 09:10
@github-actions github-actions bot added this to the Gutenberg 7.5 milestone Feb 7, 2020
@ockham
Copy link
Contributor Author

ockham commented Feb 10, 2020

you can merge since it's approved. I figured you might be waiting for me?

Thanks for merging! I was considering dropping the BC stuff we discussed here as part of this PR but didn't get to that on Friday 😅

sirreal added a commit to Automattic/wp-calypso that referenced this pull request Feb 18, 2020
sirreal added a commit to Automattic/wp-calypso that referenced this pull request Feb 19, 2020
* Update `@wordpress/*` dependencies
* Add externalized dependencies to FSE package.json
* Update z-index classname
  WordPress/gutenberg#20050
* Add webpack alias to deduplicate `@wordpress/data`
* Remove selected block outlines

Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
Co-authored-by: Jon Surrell <jon.surrell@automattic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Editor /packages/editor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants