Skip to content
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

Add predefined class selection to TipTap link component #2336

Merged
merged 6 commits into from
Jan 24, 2024
Merged

Conversation

zipavlin
Copy link
Contributor

Description

This minor feature adds option for editors to add one or more predefined classes to anchor elements using TipTap editor's link modal. This allows editors to create CTAs or other button-like hyperlinks inside wysiwyg editor, removing the need for developers to add separate fields.

image

Editor can add classes using checkboxes, rather than input field. There are two reasons for this decision: firstly, user/editor can already see source and add specific classes there. Secondly, we want to limit what classes are actually added.

Therefore this feature expects class sets to be defined when creating a Wysiwyg field using new method 'classList' which take associative array of ['class' => 'Label'] for example:

 Wysiwyg::make()
   ->classList([
     'btn' => 'Show as button',
     'btn-big' => 'Show as big button'
   ])

@ifox
Copy link
Member

ifox commented Jan 24, 2024

Thanks @zipavlin, this is a cool feature. I improved the styling a bit:

Untitled

@ifox ifox merged commit 626f22d into area17:3.x Jan 24, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants