feat: 点击链接在新窗口打开
This commit is contained in:
parent
093f918dad
commit
861ff4667c
577
package-lock.json
generated
577
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -15,6 +15,7 @@
|
||||
"@tauri-apps/plugin-fs": "^2.2.1",
|
||||
"@tauri-apps/plugin-opener": "^2",
|
||||
"@vavt/v3-extension": "^3.0.0",
|
||||
"markdown-it-link-attributes": "^4.0.1",
|
||||
"md-editor-v3": "^5.5.0",
|
||||
"plantuml-encoder": "^1.4.0",
|
||||
"scriptjs": "^2.5.9",
|
||||
|
||||
@ -53,6 +53,7 @@ import scriptjs from 'scriptjs'
|
||||
import { config, MdEditor, MdCatalog, NormalToolbar, XSSPlugin } from 'md-editor-v3';
|
||||
import { ThemeSwitch, PreviewThemeSwitch, ExportPDF } from '@vavt/v3-extension';
|
||||
import { lineNumbers } from '@codemirror/view';
|
||||
import LinkAttr from 'markdown-it-link-attributes';
|
||||
import { ref, reactive, watch, nextTick, onMounted } from "vue";
|
||||
import { Message } from 'view-ui-plus'
|
||||
import { encode as plantumlEncoder } from 'plantuml-encoder';
|
||||
@ -179,6 +180,20 @@ config({
|
||||
plugin: XSSPlugin,
|
||||
options: {},
|
||||
},
|
||||
{
|
||||
type: 'linkAttr',
|
||||
plugin: LinkAttr,
|
||||
options: {
|
||||
matcher(href) {
|
||||
// 如果使用了 markdown-it-anchor
|
||||
// 应该忽略标题头部的锚点链接
|
||||
return !href.startsWith('#');
|
||||
},
|
||||
attrs: {
|
||||
target: '_blank',
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
},
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user