Skip to content

Commit

Permalink
fix(links): adjust the anchor link only in Link.js
Browse files Browse the repository at this point in the history
Signed-off-by: Max <[email protected]>

[skip ci]
  • Loading branch information
max-nextcloud authored and backportbot[bot] committed Oct 2, 2024
1 parent 2c4a1e3 commit 38f8106
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/marks/Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,13 @@ const Link = TipTapLink.extend({

renderHTML(options) {
const { mark } = options
const url = new URL(mark.attrs.href, window.location)
const href = PROTOCOLS_TO_LINK_TO.includes(url.protocol)
? domHref(mark, this.options.relativePath)
: '#'
return ['a', {
...mark.attrs,
href: domHref(mark, this.options.relativePath),
href,
'data-md-href': mark.attrs.href,
rel: 'noopener noreferrer nofollow',
}, 0]
Expand Down

0 comments on commit 38f8106

Please sign in to comment.