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:
@@ -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>
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user