sensei
sensei copied to clipboard
Lesson Media metabox doesn't work with Learning Mode
Steps to Reproduce
On Sensei Version 4.6.4, WordPress 6.0.2 running Storefront theme.
- Create a free course and a lesson with a video
- Enable learning mode for the course
- Add media files -- one image file and one csv file -- at the bottom of the editor page:
- View the course and find no media attachments displayed:
I suspect that the Learning mode is causing the issue here. When I turned Learning Mode off, media files were shown:
Current workaround
- Use File block in the body of the lesson editor instead.
Suggested fix
- Disable Lesson Media metabox when Learning Mode is enabled OR
- Display a warning message over lesson media metabox, asking users to use File block instead.
Context / Source
5608990-zd-woothemes p1665081448747859-slack-C02P7FHLVR9
Support References
This comment is automatically generated. Please do not edit it.
- [ ] 5608990-zen
- [ ] 5695437-zen
- [ ] 5722530-zen
- [ ] 5699884-zen
I was trying to reproduce but couldn't find a way to add lesson media

I also didn't find a string in the code suggesting this. Does this maybe need an add on? For reference I was using v4.7.1
@oscarssanchez
Sorry for the confusion here. Yes, you'll need the Sensei Media Attachments plugin to reproduce. I didn't realize I had this plugin installed, as it was installed during the initial setup via the wizard.
I've edited my original post to include this information.
Also reported in 5695437-zen.
5722530-zen
Thanks @jinnypark ,
This seems to be happening here https://github.com/Automattic/sensei/blob/trunk/includes/blocks/class-sensei-lesson-blocks.php#L118
The Sensei Media Attachments plugin is adding a callback to display those hooks here: https://github.com/woocommerce/sensei-media-attachments/blob/master/classes/class-sensei-media-attachments.php#L90
One easy alternative could be to add a "block version" for those hooks here https://github.com/Automattic/sensei/blob/trunk/includes/blocks/course-theme/class-course-content.php#L105 other developers will need to adjust their code to also include their code to those hooks. A minor adjustment, but every plugin that hooks into the other action will need to do it.
I'm really not sure of the implications of just removing remove_block_related_content()
but it seems like it would be a bigger effort.
5699884-zen
I created a feature request for this in the Media Attachments repo. Unfortunately, I wasn't able to do a transfer so the comments weren't carried over.
Hello 👋 @Imran92 ,
I tried to reproduce this. While I don't have a .csv file, I did upload an image, and it shows for me in Learning Mode. I also don't mind the way it looks.
Maybe I did something wrong :D Do let me know.
Coming back to this, here's what I did notice when adding multiple files:
https://user-images.githubusercontent.com/10038976/217317410-3cea2388-38ea-4aa4-9e2d-feee2f60c1ca.mov
I believe the items should always maintain their row, and never align to the absolute sides of the canvas. Otherwise, sometimes not even the Block Toolbar is visible.
I did a quick mock-up for aligning the buttons as well since name files can differ in length. I believe, in this case, button positions should be always fixed. Here's the example I'm talking about:
It would be great if we could either give more spacing in-between multiple uploaded items or at least add horizontal separators. It would make it easier for the user to follow and understand which button belongs to which items.
Let me know if this helps. @Imran92 & @burtrw
Hi @Luchadores ! 👋 Thanks for taking a look and for the design guidance. Did you have the attachment plugin installed? This issue was also moved to that repo