如何默认为所有编辑器链接添加 target={_blank}?

huangapple go评论81阅读模式
英文:

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

问题

我希望所有我的编辑器链接在新标签页中打开,使用target={blank}

从文档中我没有找到方法来实现这一点!

我已经添加了LinkEditor的实现,但我不明白从documentation-api中在哪里添加setTarget属性到LinkNode

英文:

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

答案1

得分: 0

终于找到了,而且正是我想要的!
我把它留在这里,供其他有同样担忧的人使用。

我替换了 editor.dispatchCommand(TOGGLE_LINK_COMMAND, linkUrl)

editor.dispatchCommand(TOGGLE_LINK_COMMAND, { url: linkUrl, target: '_blank' }) 在我设置链接到编辑器的地方!

英文:

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!

huangapple
  • 本文由 发表于 2023年6月12日 18:53:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/76455939.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定