How to modify Mark Attributes - change the href on a link

Let’s say I have. The following html where {{$cusor}} denotes the position of the cursor.

Vivamus augue
<span class="text-red">
<a href="">Google{{$cursor}}</a>
Morbi eu vestibulum augue, at dignissim met

I would like to modify the href attribute of this link mark. What is the current way of doing this ?

An other example would be is to modify the class on the span.

Thank you !

You should be able to call addMark with the extent of the old mark and the new attributes. Since you can’t have two link marks on the same content, that’ll automatically replace the previous link mark.

1 Like