Error when applying attributes to link mark

Hi, I’m currently using a custom toggleMark function, and when working with a MarkType of, while passing in attrs like so:

toggleMark(, {href: link}) 

where ‘link’ is a variable containing a string, and in my custom toggleMark, it creates a mark like so:

let mark = attrs ? markType.create() : markType.create(attrs);

I’m met with an error of “Uncaught RangeError: No value supplied for attribute href”. I’m wondering if I passed in the attributes incorrectly or if something else is wrong? Thank you!

The href attribute is required, so just calling markType.create() (when markType is the basic-schema’s link mark), will raise that error.

1 Like

Thank you. Getting rid of that call worked!