-
Notifications
You must be signed in to change notification settings - Fork 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
wpcom block editor: hide new Gutenberg preview button #40388
Conversation
This PR does not affect the size of JS and CSS bundles shipped to the user's browser. Generated by performance advisor bot at iscalypsofastyet.com. |
It doesn't seem to be loading that SCSS file at all as is. I was able to test it locally and added a console.log('HERE') to |
For me the CSS for I threw the CSS in
|
I've tested enqueuing the files using a change in D40729-code The patch below moves the CSS changes in this PR to See the README file for confirmation Patch file: |
I think |
That's correct @simison. Features in |
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've confirmed that this gets loaded only when iframing Gutenberg via Calypso.
Tested FSE and non-FSE sites with Gutenberg 7.7.1:
As well non-FSE site with Gutenberg 7.3 — no affect on previous preview button:
All these now open on both mobile and desktop widths this preview modal in Calypso, which happens to also have the mobile preview:
I'd like to keep this fix just for Calypso-iframed Gutenberg can call that enough for Gutenberg 7.7. I'll do another PR to address wp-admin, but since it needs some PHP and Jetpack handling in addition to D40729-code, I'd like to look into that separately. Jetpack release is on April 7th. We should really just move whatever is in Jetpack to FSE plugin for ease. :-) |
🤦♂ |
To be clear, I'd like us to figure a solution before the next Gutenberg release. Hiding UI elements like this isn't very sustainable. 😁 |
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 just testing this on a site with dotcom FSE enabled (but not running due to theme selection).
It did change the preview from the dropdown button back to this:
Which opens the previewer default in 'desktop' mode. There dont seem to be any issues with this, but I noticed you mentioned it should default to 'mobile' view?
Anyways, the overall change seems to be working.
Thanks for testing @Addison-Stavlo 🙌
Desktop view is expected. 👍 I mean to say that mobile preview is available in that popup in Calypso, which is great because we're hiding the equavelent core feature. |
Great! That was definitely present and working then. 😄 |
Nice work everyone! I'll retire D40729-code for (maybe) future use. |
Changes proposed in this Pull Request
This PR forces the mobile preview button to be the default in the block editor.
We have to do this because the device preview functionality in Gutenberg 7.7 works by overwriting stylesheets.
However overwriting stylesheets can only occur on the same domain due to cross-site security. See: p7DVsv-8gl-p2#comment-27501
Further issue tracking in #40401
Testing instructions
Check out this branch and build it:
npx lerna run build --scope='@automattic/wpcom-block-editor' -- -- --watch
Upload the files in
apps/wpcom-block-editor/dist
to your sandbox.YOUR_TEST_SITE_URL
should be running Gutenberg EdgeYOUR_TEST_SITE_URL
should be sandboxedTry creating a post:
https://[YOUR_TEST_SITE_URL]/wp-admin/post-new.php(this PR doesn't address this, needs a follow up as described in #40388 (comment))https://wordpress.com/block-editor/post/[YOUR_TEST_SITE_URL]
Check that the preview button in the editor always defaults always to the mobile version: