Accept data-* attributes on Source Editor buttons

What does this MR do and why?

The toolbar and the button(s) below are behind the :source_editor_toolbar feature flag. It is enable on gitlab.com for the limited group of people so it is advised to enable the flag if the branch is needed to be tested visually.

The MR updates the button component on the Source Editor toolbar to accept the data-* attributes. Prior to this change, there was only one button on the toolbar of the Source Editor (live preview for the Markdown files).

Screenshot_2022-12-01_at_15.40.40

In the course of a bigger effort of moving all Markdown files to the toolbar, however, the more buttons we put in the toolbar, buttons should be more flexible and provide more custom hooks for testing and additonal information when clicked.

This is the second preparation step for Migrate actions from Markdown toolbar to Source... (#352662 - closed) (see In the SE toolbar buttons: passsed the click ev... (!105667 - merged) for the previous step in this effort).

The last step in implementing Migrate actions from Markdown toolbar to Source... (#352662 - closed) will be the migration of the Markdown icons using changes introduced both in this MR and In the SE toolbar buttons: passsed the click ev... (!105667 - merged).

Screenshots or screen recordings

No visual changes

How to set up and validate locally

In order to see the toolbar in the local environment, enable the :source_editor_toolbar feature flag in Rails console locally.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #352662 (closed)

Edited by Denys Mishunov

Merge request reports

Loading