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

Gutenberg: Use Fullscreen mode in Calypsoify #10368

Merged
merged 7 commits into from
Oct 30, 2018
Merged

Conversation

mmtr
Copy link
Member

@mmtr mmtr commented Oct 22, 2018

Changes proposed in this Pull Request:

Calypsoify uses now the Gutenberg Fullscreen Mode instead of injecting the close button and including custom CSS.

We realized that the Gutenberg Fullscreen Mode is providing a UI very similar to Calypso, so by using it we can simplify the code and make it more maintainable.

This PR also includes a small fix for an 500 error raised when Jetpack is checking if Gutenberg is enabled. Fixed on #10389.

Fixes Automattic/wp-calypso#27937

Testing instructions:

  • Edit a post in Gutenberg
  • Append &calypsoify=1 to the URL and reload the post editor.
  • Make sure that the editor is displayed in Fullscreen Mode.
  • Check that there are no options for disabling the Fullscreen Mode when clicking on the "More" button.
  • Confirm that the back button uses now an icon and it redirects to the posts list in Calypso when clicking on it.

Screenshots:

Before
screen shot 2018-10-22 at 14 12 45

After
screen shot 2018-10-22 at 15 17 53

Proposed changelog entry for your changes:

I don't think this is needed given Calypsoify is mainly used internally. Anyway, if needed, this is my proposed changelog:

Calypsoify uses now the Gutenberg Fullscreen Mode instead of injecting the close button and including custom CSS.

@mmtr mmtr added [Type] Bug When a feature is broken and / or not performing as intended [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] In Progress [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack labels Oct 22, 2018
@mmtr mmtr self-assigned this Oct 22, 2018
@mmtr mmtr requested review from a team October 22, 2018 11:26
@jeherve jeherve added this to the 6.7 milestone Oct 22, 2018
@mmtr mmtr added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Oct 22, 2018
#adminmenumain,
#wp-admin-bar-menu-toggle {
/* Hides the menu items for switching the view mode */
.edit-post-more-menu__content .components-menu-group:first-child {
Copy link
Contributor

Choose a reason for hiding this comment

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

This PR is more oriented at making Calypsoified Gutenberg and Gutenberg in Calypso as identical as possible, but in this particular case, I'd say let's keep the group visible even if it's not there in Calypso, and only hide the "Fullscreen Mode" item.

Also, notice that now it's the last child, but that could change.
Off the top of my head there is no simple selector there, but I might be very wrong. 🙂

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for that! I've just committed a change handling this 🙂

I thought this view mode selector was like a radio button (you can only select one of them), but I realize that you can activate all of them at the same time, so it makes sense to only hide the "Fullscreen Mode" option.

Regarding the CSS selector using :last-child. I don't like it either, but the HTML rendered by Gutenberg doesn't provide any other class we can use for identifying this element:

screen shot 2018-10-22 at 19 10 43

@Copons
Copy link
Contributor

Copons commented Oct 22, 2018

Let me add a bit of history behind this PR.

When I wrote the code for Calypsoify Gutenberg, there was no fullscreen mode yet (or maybe there was but I didn't notice it), and the whole idea was to make Gutenberg look as much as possible as Calypso.
I've spent time styiling the main UI components (buttons, notices, etc.) to make them look as native Calypso components.

Meanwhile, Calypso-side, it had been decided that Gutenberg would have kept its style for now.
This caused the weirdness that Calypsoified Gutenberg looked more like Calypso than Gutenberg in Calypso. (I know, not simple to follow 😅)

When we learned that Gutenberg had a new fullscreen mode with a nice "Back" icon, we went to replace the Calypsoified Gutenberg's "Close" button with that icon.
Only then we realized that the fullscreen mode looked very much like Gutenberg in Calypso itself. Like, a lot.

All the overrides needed to hide the masterbar, the sidebar, etc. were there, a mere Redux action away.

So this PR simply dispatches that action, and removes (most) of the overrides as they are not needed anymore.

cc @Automattic/lannister this also means that by dispatching that action in Calypso, we might be able to drop a lot of CSS there as well.

@jetpackbot
Copy link
Collaborator

jetpackbot commented Oct 22, 2018

Thank you for the great PR description!

When this PR is ready for review, please apply the [Status] Needs Review label. If you are an a11n, please have someone from your team review the code if possible. The Jetpack team will also review this PR and merge it to be included in the next Jetpack release.

Scheduled Jetpack release: November 6, 2018.
Scheduled code freeze: October 30, 2018

Generated by 🚫 dangerJS

Copons
Copons previously approved these changes Oct 23, 2018
Copy link
Contributor

@Copons Copons left a comment

Choose a reason for hiding this comment

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

This LGTM!
We should be well in time for the 6.7 release! ✨

@jeherve
Copy link
Member

jeherve commented Oct 24, 2018

c'ing @georgestephanis for a review on this since he's currently working on other Calypsoify improvements in #10371

@Copons
Copy link
Contributor

Copons commented Oct 24, 2018

Oh very cool!
I think that if we get to merge this, and rebase #10371, it will become considerably smaller.
On the other hand, it could be easier to just close this and reopen it after #10371 merges.
Either way sounds good to me, @georgestephanis

mmtr added 4 commits October 26, 2018 12:30
…issing components.

Also, Jetpack renamed to Jetpack_Gutenberg when checking if Gutenberg is enabled.
Removed menu options for switching the view mode.
@mmtr mmtr force-pushed the fix/close-icon-calypsoify branch from 6ebbc47 to 1887082 Compare October 26, 2018 10:33
@jeherve jeherve modified the milestones: 6.7, 6.8 Oct 26, 2018
@gwwar
Copy link
Contributor

gwwar commented Oct 26, 2018

@jeherve Can we still target this for the 6.7 release? @Copons any blockers here? I can give this a spin as well.

@jeherve jeherve modified the milestones: 6.8, 6.7 Oct 26, 2018
@brbrr brbrr added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review This PR is ready for review. labels Oct 29, 2018
@Copons
Copy link
Contributor

Copons commented Oct 29, 2018

Sorry folks, this accidentally breaks the Revisions view. I'll push a hotfix in a bit, but meanwhile do not merge please! 🙇

@jeherve jeherve added [Status] In Progress DO NOT MERGE don't merge it! and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Oct 29, 2018
@Copons Copons dismissed stale reviews from brbrr, jeherve, and gwwar via 7360cde October 29, 2018 16:54
@Copons
Copy link
Contributor

Copons commented Oct 29, 2018

Again, sorry about this.
I was too hasty in deleting all that CSS, and forgot that part of it was applied to the Revisions page, which doesn't load Gutenberg, and so of course doesn't have wp.data.select.

7360cde restore the CSS overrides of the Revisions page, and guard against undefined wp.data.select which killed it.

Testing instructions:

  • Load a Gutenberg post, with ?calypsoify=1
  • In order to get some revisions of the post: do some changes, save; do some other changes; update.
  • Click on the new Revisions link in the Gutenberg's Document sidebar.
  • Make sure the Revisions page is calypsoified as well (doesn't have any wp-admin sidebar and masterbar), and that clicking on the "back to editor" links redirects to a still calypsoified version of Gutenberg (no need to have the ?calypsoify=1 anymore; one way to check if Calypsoify is active is to check the Close URL, it should point to Calypso).

@Copons Copons added [Status] Needs Review This PR is ready for review. and removed DO NOT MERGE don't merge it! [Status] In Progress labels Oct 29, 2018
jeherve
jeherve previously approved these changes Oct 29, 2018
Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

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

Nice catch! 👍

@Copons
Copy link
Contributor

Copons commented Oct 30, 2018

I feel so bad, but I've had to sneak in one last change. 😭

ae88b29 adds back the CSS needed to hide the "Manage Reusable Blocks" links from the editor.
More context in 9-gh-calypsoify

Testing instructions:

  • Create a reusable block (block toolbar -> dots menu -> "Add to reusable blocks").
  • Open the Blocks inserter, and expand the "Reusable" section (should be the last one).
  • Make sure the "Manage All Reusable Blocks" link is hidden.

@kraftbj kraftbj added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review This PR is ready for review. labels Oct 30, 2018
Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

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

This seems to work for me. Merging.

@jeherve jeherve merged commit 303a55c into master Oct 30, 2018
@ghost ghost removed the [Status] Ready to Merge Go ahead, you can push that green button! label Oct 30, 2018
@jeherve jeherve deleted the fix/close-icon-calypsoify branch October 30, 2018 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Calypsoify [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack [Type] Bug When a feature is broken and / or not performing as intended [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gutenberg: Consider using the new close icon with tooltip
8 participants