Unify when copy file control is disabled

What does this MR do and why?

I've noticed that the mechanism for defining the viewer type in new blob controls is not reactive and does not disables Copy contents control, when on rich viewer. I'm aligning new controls with what we already have in app/assets/javascripts/repository/components/blob_content_viewer.vue

Note: Copy contents control is in the blob overflow menu dropdown only in the mobile layout. Above sm breakpoints, it is in the file viewer's header where it used to be.

References

Screenshots or screen recordings

Before After
Screenshot_2025-04-16_at_15.10.36 Screenshot_2025-04-15_at_21.09.17
Screenshot_2025-04-16_at_15.10.45 Screenshot_2025-04-15_at_21.08.32

How to set up and validate locally

  1. In rails console enable the feature flag

    Feature.enable(:blob_overflow_menu)
  2. Open Project / Code /Repository and choose a markdown file.

  3. When switching the file to Preview mode, the Copy contents button should be disabled.

  4. Make sure your viewport is around 500px wide or less. Verify that Copy contents in the blob overflow menu is also disabled.

  5. Switch to Code mode of the viewer and check if both controls are enabled.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Paulina Sedlak-Jakubowska

Merge request reports

Loading