英文:
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!
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论