reactjslexicaljslexical-editor

How to add target={_blank} to all editor links by default?


I want all my editor links to open in a new tab with target={blank}

From documentation I did not find a way to do it!

Ι have add the LinkEditor implementation, but I don't understand from documentation-api where to add setTarget attribute to LinkNode


Solution

  • Finally I found it, and it is what I want! I leave it here for anyone else with the same worry.

    I replaced editor.dispatchCommand(TOGGLE_LINK_COMMAND, linkUrl) with editor.dispatchCommand(TOGGLE_LINK_COMMAND, { url: linkUrl, target: '_blank' }) at the point which I set the link to editor!