From 9c4264328fedda8d0e3b93d90aa7ae0d690343b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raimund=20Schl=C3=BC=C3=9Fler?= Date: Sun, 5 Mar 2023 11:46:28 +0100 Subject: [PATCH] Make NcLink non-functional MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raimund Schlüßler --- src/components/NcRichText/autolink.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/NcRichText/autolink.js b/src/components/NcRichText/autolink.js index badf54c441..4db8e14acb 100644 --- a/src/components/NcRichText/autolink.js +++ b/src/components/NcRichText/autolink.js @@ -3,24 +3,23 @@ import { URL_PATTERN_AUTOLINK } from './helpers.js' import { visit, SKIP } from 'unist-util-visit' import { u } from 'unist-builder' -const Link = { - name: 'Link', - functional: true, +const NcLink = { + name: 'NcLink', props: { href: { type: String, required: true, }, }, - render(h, { data, props }) { + render(h) { return h('a', { attrs: { - href: props.href, + href: this.href, rel: 'noopener noreferrer', target: '_blank', class: 'rich-text--external-link', }, - }, [props.href.trim()]) + }, [this.href.trim()]) }, } @@ -67,7 +66,7 @@ export const parseUrl = (text) => { textAfter = lastChar } list.push(textBefore) - list.push({ component: Link, props: { href } }) + list.push({ component: NcLink, props: { href } }) if (textAfter) { list.push(textAfter) }