// Replacing with a image node which uses a url
view.dispatch(view.state.tr.replaceSelectionWith(newNode));
let attrs = {
title: node.text, // node.text is the URL
href: node.text,
target: '_blank',
};
let linknode = view.state.config.schema.nodes.paragraph.create(
view.state.config.schema.marks.link.create(attrs),
);
// This is not inserting anything. Requirement is to place a url below the newNode with "_blank" target.
view.dispatch(view.state.tr.replaceSelectionWith(linknode));
view.focus();
How do I insert a link using a text with target _blank immediately after inserting below a node?