sensei icon indicating copy to clipboard operation
sensei copied to clipboard

Lesson Media metabox doesn't work with Learning Mode

Open jinnypark opened this issue 2 years ago • 1 comments

Steps to Reproduce

On Sensei Version 4.6.4, WordPress 6.0.2 running Storefront theme.

  1. Create a free course and a lesson with a video
  2. Enable learning mode for the course
  3. Add media files -- one image file and one csv file -- at the bottom of the editor page: z79kNZ.png
  4. View the course and find no media attachments displayed: wKCtnw.png

I suspect that the Learning mode is causing the issue here. When I turned Learning Mode off, media files were shown:

7-qD4lGg_h.png

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

jinnypark avatar Oct 06 '22 18:10 jinnypark

Support References

This comment is automatically generated. Please do not edit it.

  • [ ] 5608990-zen
  • [ ] 5695437-zen
  • [ ] 5722530-zen
  • [ ] 5699884-zen

github-actions[bot] avatar Oct 06 '22 18:10 github-actions[bot]

I was trying to reproduce but couldn't find a way to add lesson media

Screen Shot 2022-10-22 at 11 31 54

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 avatar Oct 22 '22 16:10 oscarssanchez

@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.

jinnypark avatar Nov 13 '22 16:11 jinnypark

Also reported in 5695437-zen.

gaurav1984 avatar Nov 17 '22 14:11 gaurav1984

5722530-zen

gaurav1984 avatar Nov 18 '22 11:11 gaurav1984

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.

oscarssanchez avatar Nov 21 '22 01:11 oscarssanchez

5699884-zen

gaurav1984 avatar Nov 24 '22 07:11 gaurav1984

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.

donnapep avatar Nov 24 '22 20:11 donnapep

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. image

Luchadores avatar Feb 07 '23 14:02 Luchadores

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:

image

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.

image

Let me know if this helps. @Imran92 & @burtrw

Luchadores avatar Feb 07 '23 17:02 Luchadores

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

Imran92 avatar Feb 08 '23 01:02 Imran92