Insert a text with a link

I would like to insert a text with a link. I tried this:

const link = linkType.create({ href });
const node = state.schema.text(href).mark([link]);
dispatch(, true));

but it only inserts the text. I don’t understand what I am doing wrong.

Double-check the docs for the second argument to replaceSelectionWith.

Thank you for your answer!

I checked the doc and tried, true) and, but thought the default was false (my fault).

So, indeed, it works with, false).