From 2cdea62ba83a49d02a7ee73a8b28f85be89b609b Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 10 Feb 2020 03:48:45 +0900 Subject: [PATCH] Improve mfm link --- src/client/components/link.vue | 94 ++++++++++++++++++++++++++++++++++ src/client/components/mfm.ts | 13 +++-- 2 files changed, 100 insertions(+), 7 deletions(-) create mode 100644 src/client/components/link.vue diff --git a/src/client/components/link.vue b/src/client/components/link.vue new file mode 100644 index 000000000..0775140c4 --- /dev/null +++ b/src/client/components/link.vue @@ -0,0 +1,94 @@ + + + + + diff --git a/src/client/components/mfm.ts b/src/client/components/mfm.ts index f31642789..719e9fe94 100644 --- a/src/client/components/mfm.ts +++ b/src/client/components/mfm.ts @@ -2,6 +2,7 @@ import Vue, { VNode } from 'vue'; import { MfmForest } from '../../mfm/types'; import { parse, parsePlain } from '../../mfm/parse'; import MkUrl from './url.vue'; +import MkLink from './link.vue'; import MkMention from './mention.vue'; import { concat } from '../../prelude/array'; import MkFormula from './formula.vue'; @@ -158,14 +159,12 @@ export default Vue.component('misskey-flavored-markdown', { } case 'link': { - return [createElement('a', { - attrs: { - class: 'link _link', - href: token.node.props.url, + return [createElement(MkLink, { + key: Math.random(), + props: { + url: token.node.props.url, rel: 'nofollow noopener', - target: '_blank', - title: token.node.props.url, - } + }, }, genEl(token.children))]; }