-
Notifications
You must be signed in to change notification settings - Fork 197
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
Apply pattern to the post when selected #5179
Conversation
87539e9
to
a8c0a64
Compare
98af7e0
to
828a1ae
Compare
7cf8547
to
2d73216
Compare
1cbc1ec
to
4ab922d
Compare
|
||
// We can call `onCompletion` to complete the wizard after setting the correct pattern with `setData`. | ||
// We could replace `onCompletion` with the `goToNextStep` callback with a similar effect. | ||
if ( data.courseTitle ) { |
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.
When we implement the final patterns, if we don't have a course title to replace, we can remove this condition.
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.
Looks good!
Just some clarifications:
assets/admin/editor-wizard/wizard.js
Outdated
/> | ||
</div> | ||
) } | ||
</div> | ||
</div> | ||
) ) || | ||
null | ||
) |
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 remember needing to add this || null
because I was getting an error that a render should return something always. Why it is not needed anymore?
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 got it! If steps[ currentStepNumber ]
is undefined
it would fire an error. But if we return null
we also have a weird behavior with the modal open, but only with the overlay.
Thinking a little more, I don't think we need this check since goToNextStep
will only increment if we have steps. I removed it for now in this commit: d64d74e, but let me know if I'm missing anything. 😉
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 also removed the conditional in the other case where steps should always be an array.
946f50d
to
d64d74e
Compare
…sensei into add/pattern-selection
Thank you for your review, @aaronfc !
Definitely! Good catch! I already updated the branch, since that was merged, and added the implementation here: 24207ca
That's correct! Also about the format of the Outline in the patterns, it's something temporary, I think it will depend on how we define them. |
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.
Looks good works well :D
When I test this (on the feature branch), and either close the modal or click "Start with default layout" (rather than selecting a pattern), it seems like the description that I've added to the modal is lost (it's not added to the post at all). Is this intentional? Should we have some way of adding the description to the default template? Or are we ok with just losing the description if the modal is closed? My thought is we should have the description in the default template somewhere. |
Good point! For now, it was intentional, just applying the description to the patterns. And when skipping, it just loads the default template. But I think it makes sense. Maybe we could add a paragraph with the filled description. If we go for that, I have a question if the user doesn't add any information to the description input. In the case of the patterns, we're keeping the original content of the pattern. Maybe should we also have a paragraph with an example text in the default template? |
I was thinking the description could/should also get applied as the Course 'excerpt' if that is possible? But adding a simple text block at the top of the default that includes the description would also be great. We could either just put a blank paragraph block where the description would go or have default text. My concern with default text is translations (though we are adding default text to other patterns...). What do y'all think would be best? |
Yep. It's possible to do it in a similar way to how we update the title currently.
IMO, I think since it's the default template and not a styled pattern, we could just leave an empty paragraph if the user doesn't inform a description. We could have a placeholder there how we have in the current lesson editor "Write lesson content..." I wait for confirmation or a new suggestion to open an issue for that. 😉 |
Fixes #5140
Fixes #5130
Fixes #5133
Changes proposed in this Pull Request
Testing instructions
Screenshot / Video
Screen.Recording.2022-05-26.at.16.21.09.mov