Demo:备注里的超链接改为新窗口打开

This commit is contained in:
街角小林
2024-08-14 16:50:53 +08:00
parent 322f7a3e2a
commit 4c5b2e7af2

View File

@@ -71,10 +71,19 @@ export default {
onShowNoteContent(content, left, top, node) {
this.node = node
this.editor.setMarkdown(content)
this.handleALink()
this.updateNoteContentPosition(left, top)
this.show = true
},
// 超链接新窗口打开
handleALink() {
const list = this.$refs.noteContentViewer.querySelectorAll('a')
Array.from(list).forEach(a => {
a.setAttribute('target', '_blank')
})
},
// 更新位置
updateNoteContentPosition(left, top) {
this.left = left