RichText: honor a link's newTab field

The link/autolink converters never read node.fields.newTab, so setting
"open in new tab" on a link in the Payload editor had no effect.
Needed now that the Die Sieben post's template-download link opens a
PNG in-place instead of navigating away from the article.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Eg6h91yngXmSnM51wxXM8
This commit is contained in:
Marco
2026-08-29 22:35:32 +00:00
parent 6f6a6119f5
commit 43bffaa5c1
+5 -1
View File
@@ -176,7 +176,11 @@ function buildConverters(quoteLabel: string): JSXConvertersFunction {
},
listitem: ({ node, nodesToJSX }) => <li>{nodesToJSX({ nodes: node.children })}</li>,
link: ({ node, nodesToJSX }) => (
<a href={node.fields?.url ?? "#"} className="text-brand hover:underline">
<a
href={node.fields?.url ?? "#"}
className="text-brand hover:underline"
{...(node.fields?.newTab ? { target: "_blank", rel: "noopener noreferrer" } : {})}
>
{nodesToJSX({ nodes: node.children })}
</a>
),