Skip to content

Commit

Permalink
fix(richtext-lexical): Link: add open-in-new-tab to html converter
Browse files Browse the repository at this point in the history
  • Loading branch information
UBaggeler authored Mar 7, 2024
1 parent 8919b86 commit 23df60d
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const LinkHTMLConverter: HTMLConverter<any> = {
})

const rel: string = node.fields.newTab ? ' rel="noopener noreferrer"' : ''
const target: string = node.fields.newTab ? ' target="_blank"' : ''

let href: string =
node.fields.linkType === 'custom' ? node.fields.url : node.fields.doc?.value?.id
Expand All @@ -24,7 +25,7 @@ export const LinkHTMLConverter: HTMLConverter<any> = {
href = replaceDoubleCurlys(href, submissionData)
}

return `<a href="${href}"${rel}>${childrenText}</a>`
return `<a href="${href}"${target}${rel}>${childrenText}</a>`
},
nodeTypes: ['link'],
}

0 comments on commit 23df60d

Please sign in to comment.