-
Notifications
You must be signed in to change notification settings - Fork 5
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
Remove editor experience when using handheld devices #47
Remove editor experience when using handheld devices #47
Conversation
Right, it's missing all the |
The mobile version might need some slight variations in content. That needn't necessarily be fixed in this PR, but it might be worth opening a new issue after fixing this one to decide what content changes are needed. (Perhaps the "Click around to explore" text) |
4690151
to
22a225b
Compare
'rest_preload_api_request', | ||
array() | ||
); | ||
if ( wp_is_mobile() ) { |
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.
Make this condition inside gutenberg_editor_scripts_and_styles
since
- We're still rendering Gutenberg editor but in mobile version.
- Styles can be shared without duplicating them.
if ( wp_is_mobile() ) { | ||
$block_editor_css = get_block_editor_theme_styles()[0]['css']; | ||
wp_add_inline_style( 'wp-edit-post', $block_editor_css ); | ||
} |
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.
It turns out this worked in the first place, except that it only worked on the sandbox,
locally the newly added styles would somehow be overridden and never show the expected layout.
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.
Does this have to be here? Can it be moved in theif ( wp_is_mobile() )
statement above.
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.
My idea was to put the styles together, but it's also ok to move into the if ( wp_is_mobile() )
statement above.
Done in Fix several issues when loading page.
Updated screencast (Styles fixed)handheld.version.g.mp4TODO
|
yarn.lock
Outdated
@@ -2,524 +2,6114 @@ | |||
# yarn lockfile v1 | |||
|
|||
|
|||
"@kwsites/file-exists@^1.1.1": |
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 don't see any changes to package.json, should this have changed?
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.
It turns out that it has the same content as the one in the workspace. I took a further look and found that if we removed the "workspaces": [ "source/wp-content/themes/wporg-gutenberg" ]
in source/wp-content/themes/wporg-gutenberg/package.json
as well as its corresponding yarn.lock
in the same folder and then yarn
in source/wp-content/themes/wporg-gutenberg
, the yarn.lock
would only be generated in the root folder (the one we're looking at), and I'm thinking that this is the way workspace saves space from duplicating packages (by hoisting packages to workspace root). So perhaps we only need one yarn.lock
here. Didn't have much experience with the workspace, please let me know if I understand it incorrectly.
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.
Hmm the workspace setup confuses me a bit too, @StevenDufresne do we have a workspace setup for the theme in case one day we need a workspace for a plugin too? I've seen that in other repos
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.
Yeah, it needs some cleanup. The workspace declaration should be removed from the theme and the packages added from the root. We should probably open a new ticket.
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.
Ok. I'll reset the commit and open a new ticket for it. Other than that, do you think this PR is good to go?
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.
It doesn't appear like all the styles are loading properly, a few things I see:
- Buttons have different
border-radius
- The footer has a huge space below it.
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.
Buttons have different border-radius
Which one you're referring to? I saw buttons on the sandbox having 2px border-radius
, which is the same as production.
The footer has a huge space below it.
Fixed.
It doesn't appear like all the styles are loading properly
The difference I spot is that the font-weight
of h1
and h2
is 600
but not 400
(prod)
and the font-size
of some p
is smaller than prod.
I've found that the styles have already been imported but were overridden by styles that I can't really tell where they are from. But it can be fixed in a tricky way, I've tested it and it worked, but before really committing it, I'd like to know if there are other ideas for it.
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.
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 think the best we can do is to enqueue a mobile style sheet that fixes the differences.
Additionally, the <body>
tag needs a white background.
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 don't see the grey background or the space between the line and the button. (Not sure what makes the differences between our layouts, but could you try again with new commits and see if they are still there, thanks.)
And for the different border-radius
of the button, I only saw it locally, not on the sandbox.
Here's the fix for it, now the local would also show the same border-radius
as the sandbox and prod.
wp_is_mobile() = true
Sandbox | Local | Prod |
---|---|---|
wp_is_mobile() = false
Sandbox | Local | Prod |
---|---|---|
22a225b
to
6f79569
Compare
Apart from the styles, how do you think we can deal with this copy that appears on the desktop view: "This page was built with blocks — pieces of content that you can move around. Click around to explore them." |
if ( wp_is_mobile() ) { | ||
$block_editor_css = get_block_editor_theme_styles()[0]['css']; | ||
wp_add_inline_style( 'wp-edit-post', $block_editor_css ); | ||
} |
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.
Does this have to be here? Can it be moved in theif ( wp_is_mobile() )
statement above.
resolve( wp.editPost.initializeEditor( 'editor', "%s", %d, %s, %s ) ); | ||
$init_script = <<<JS | ||
( function() { | ||
window._wpLoadBlockEditor = new Promise( function( resolve ) { |
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.
Does this need to be loaded on mobile?.. along with the $script
block below...
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 don't think they are loaded on mobile. (or you're saying that they should be loaded?)
I think it's the format making it hard to read, and the JS part is the one making it unclear (You can see that originally it is aligned to the left side without the indent, and I was thinking that it might be made that way on purpose at first so I didn't add one more indent when including else
into the logic). I'll add one first to make the format clearer, and please let me know if I shouldn't do so.
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.
Ah I see, yeah my code collapse function got confused. Thanks. No changes needed.
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.
Would the extra indent affect anything? da207bb If not, I'm tempted to keep it as is as the format looks more readable.
- Shaking - fixed. - Jump to the bottom directly - fixed. - Long loading time - fixed.
8ff9f50
to
1c6f594
Compare
'wp-edit-post', | ||
$block_editor_css . 'body,p{font-size:inherit;} h1,h2,h3,h4,h5,h6{font-weight:inherit;} .wp-block-button__link{border-radius: var(--wp--custom--button--border--radius);}' | ||
); | ||
} else { |
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.
Nothing changed to logic starting from here to the end of the else block.
I'm thinking of only changing |
I think just removing |
23f9881
to
e9da89f
Compare
845ab46
to
3ddcb55
Compare
The styles added in this commit primarily make the layout in the local env consistent with the sandbox and the prod. (i.e., the styles on the sandbox and the prod are already aligned)
3ddcb55
to
37fb88c
Compare
@@ -24,7 +24,18 @@ h3 { | |||
|
|||
.wp-block-button__link { | |||
border-radius: var(--wp--custom--button--border--radius); | |||
background-color: #32373c; | |||
background-color: var(--wp--custom--button--color--background); |
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.
The styles added here (L27 - L38) are just for making the layout in the local env consistent with the sandbox and the prod. (i.e., the styles on the sandbox and the prod are already aligned)
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 think this is close enough for now. I'm not certain how well wp_is_mobile
will work in production, but it should be false more than true
so its fine.
- Body background-color is set to white. - Link color is set to --wp--custom--color--primary.
Fixes #46
The logic can also be placed in the following block to avoid running unnecessary logic, but we have to enqueue the required styles.wporg-gutenberg/source/wp-content/themes/wporg-gutenberg/functions.php
Lines 478 to 487 in 4690151
Screencast
remove.editor.exp.on.mobile.mov
The font-weight of the heading and the border styles of the button are still off,
that's probably because they're no longer in the editor, so the class name
editor-styles-wrapper
doesn't exist anymore.And the button style in the sandbox is different from the one in local env (sandbox has squared black border)
Do we want the styles to be exactly the same as the original ones?