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

Allow class attribute through setLink() #2758

Merged
merged 1 commit into from
May 9, 2022
Merged

Conversation

Ken-vdE
Copy link
Contributor

@Ken-vdE Ken-vdE commented May 5, 2022

While you can set a default value for the Link extensions class attribute using

Link.configure({
  HTMLAttributes: {
    class: 'my-custom-class',
  },
})

It is currently not possible to dynamically set the class attribute when calling setLink() e.g.

this.editor.chain().focus().extendMarkRange('link').setLink({href: url, class: 'this class should be added'}).run();

This change allows for that by default, without needing to extend the Link extension. E.g. #72 (comment)

While you can set a default value for the Link extensions class attribute using 
```javascript
Link.configure({
  HTMLAttributes: {
    class: 'my-custom-class',
  },
})
```
It is currently not possible to dynamically set the class attribute when calling setLink() e.g. 
```javascript
this.editor.chain().focus().extendMarkRange('link').setLink({href: url, class: 'this class should be added'}).run();
```

This change allows for that by default, without needing to extend the Link extension.
@netlify
Copy link

netlify bot commented May 5, 2022

Deploy Preview for tiptap-embed ready!

Name Link
🔨 Latest commit 352a66c
🔍 Latest deploy log https://app.netlify.com/sites/tiptap-embed/deploys/627393d1340bb700099e1641
😎 Deploy Preview https://deploy-preview-2758--tiptap-embed.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@Ken-vdE Ken-vdE mentioned this pull request May 5, 2022
Copy link
Contributor

@bdbch bdbch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me. Thanks!

@bdbch bdbch merged commit a9e8f48 into ueberdosis:main May 9, 2022
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.

None yet

2 participants