mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-23 19:19:03 +08:00
Allow class attribute through setLink()
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.
This commit is contained in:
parent
43611ea2e7
commit
a9e8f48b34
@ -61,6 +61,7 @@ export const Link = Mark.create<LinkOptions>({
|
||||
HTMLAttributes: {
|
||||
target: '_blank',
|
||||
rel: 'noopener noreferrer nofollow',
|
||||
class: null,
|
||||
},
|
||||
}
|
||||
},
|
||||
@ -73,6 +74,9 @@ export const Link = Mark.create<LinkOptions>({
|
||||
target: {
|
||||
default: this.options.HTMLAttributes.target,
|
||||
},
|
||||
class: {
|
||||
default: this.options.HTMLAttributes.class,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user