-
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
[Block Editor]: Try marking BlockList as non-Root component #35932
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,9 +119,5 @@ | |
} | ||
} | ||
} | ||
|
||
.block-list-appender { | ||
display: none; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,10 @@ import { Disabled } from '@wordpress/components'; | |
*/ | ||
import BlockList from '../block-list'; | ||
|
||
export default function LiveBlockPreview( { onClick } ) { | ||
export default function LiveBlockPreview( { | ||
onClick, | ||
__experimentalIsRootContainer, | ||
} ) { | ||
return ( | ||
<div | ||
tabIndex={ 0 } | ||
|
@@ -17,7 +20,12 @@ export default function LiveBlockPreview( { onClick } ) { | |
onKeyPress={ onClick } | ||
> | ||
<Disabled> | ||
<BlockList /> | ||
<BlockList | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for the late reply. It should be, yes. What's the difference between live and not live? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
renderAppender={ false } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not related to the actual problem, but noticed it here and is connected with the style removal here. |
||
__experimentalIsRootContainer={ | ||
__experimentalIsRootContainer | ||
} | ||
/> | ||
</Disabled> | ||
</div> | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -158,6 +158,7 @@ export default function PostTemplateEdit( { | |
__experimentalOnClick={ () => | ||
setActiveBlockContext( blockContext ) | ||
} | ||
__experimentalIsRootContainer={ false } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about the additional "div" added by "BlockPreview" won't this break alignments as well? For the active post Id, there's no addition div if I'm not wrong. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The parent div just fills all the available space from its parent container. What we want to avoid is the generated style for
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, but the problem is that if there's a block that is full aligned or wide aligned... inside the previewed blocks, they won't get the layout styles properly, so they won't show as expected. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I understand why they shouldn't work. If a block has specific layout, it's styles should be rendered properly. The problem seems to be that they don't work right now as the layout styles are not rendered in PostContent. This PR with the LivePreview PR in readonly state seems to do the trick. I don't know if I missing something here.. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a video with both changes applied( Screen.Recording.2021-10-26.at.11.54.51.AM.movThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just compare the DOM output of an active "post id" with an inactive one, you'll see an extra div for the inactive one that disappears as soon as it becomes active. Right now, in this PR it doesn't break anything because there's an "li" container for both situations that doesn't define any layout but if ever that "li" becomes say a "Post block" where you'd be able to define a "layout", it would break (it's the case in the other PR). I'm fine if land this PR as is but since we need to solve the container-less preview anyway for the other PR, I was wondering if we could use the same technique here which would make the Anyway not important for the Current PR as there's no layout in the container of the "preview" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I get what you mean now.
What technique are you referring to? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I mean if we find a way to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
/> | ||
</li> | ||
) } | ||
|
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 hesitant about this prop, it's very weird to be honest. it's a hack because the issue here is not really the real issue here, the issue is the added div with its own layout. So while I'm ok with this PR, I was wondering if we can borrow the
useBlockPreview
from the other PR?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.
Me too. I was kind of expecting to close it to be honest 😄
I'll try this out.
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.
Thanks for exploring that! I quite like the
useBlockPreview
we came up with in that other PR, so it'd be cool if we can include it here 🙂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.
@andrewserong would you be interested in taking over this or maybe better creating a PR with
useBlockPreview
? I tried this a bit and it seems most of the code needed had been implemented by you in: #35863.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.
@ntsekouras sure, I'm happy either take this over or create another PR. The only thing is I won't be able to start on it until later this week in case there's urgency in getting this in sooner. If not, then I can pick it up 🙂
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.
That sounds great, thanks! 💯 This is a bug, so there is time to fix it and include it in 5.9.
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 wrapping up for the week, but I've started on a fix and pushed a draft PR in #36431 that appears to work okay so far — I haven't had a chance to test it properly or see if it can be streamlined a bit, so I've left it as a draft PR for the moment, and will continue on with it on Monday.
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.
That's great Andrew! Thanks! I'll close this one and we can use your new PR.