Revert "Enable tags inside of quotes (#3041)" (#3075)

This reverts commit f016cdbca9.
zio/stable
Hailey 2024-03-01 17:15:45 -08:00 committed by GitHub
parent 4fc0b566ef
commit b07846f2fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 22 deletions

View File

@ -78,31 +78,40 @@ export function RichText({
const link = segment.link const link = segment.link
const mention = segment.mention const mention = segment.mention
const tag = segment.tag const tag = segment.tag
if (mention && AppBskyRichtextFacet.validateMention(mention).success) { if (
mention &&
AppBskyRichtextFacet.validateMention(mention).success &&
!disableLinks
) {
els.push( els.push(
<InlineLink <InlineLink
selectable={selectable} selectable={selectable}
key={key} key={key}
to={`/profile/${mention.did}`} to={`/profile/${mention.did}`}
style={[...styles, {pointerEvents: disableLinks ? 'none' : 'auto'}]} style={[...styles, {pointerEvents: 'auto'}]}
// @ts-ignore TODO // @ts-ignore TODO
dataSet={WORD_WRAP}> dataSet={WORD_WRAP}>
{segment.text} {segment.text}
</InlineLink>, </InlineLink>,
) )
} else if (link && AppBskyRichtextFacet.validateLink(link).success) { } else if (link && AppBskyRichtextFacet.validateLink(link).success) {
els.push( if (disableLinks) {
<InlineLink els.push(toShortUrl(segment.text))
selectable={selectable} } else {
key={key} els.push(
to={link.uri} <InlineLink
style={[...styles, {pointerEvents: disableLinks ? 'none' : 'auto'}]} selectable={selectable}
// @ts-ignore TODO key={key}
dataSet={WORD_WRAP}> to={link.uri}
{toShortUrl(segment.text)} style={[...styles, {pointerEvents: 'auto'}]}
</InlineLink>, // @ts-ignore TODO
) dataSet={WORD_WRAP}>
{toShortUrl(segment.text)}
</InlineLink>,
)
}
} else if ( } else if (
!disableLinks &&
enableTags && enableTags &&
tag && tag &&
AppBskyRichtextFacet.validateTag(tag).success AppBskyRichtextFacet.validateTag(tag).success
@ -115,7 +124,6 @@ export function RichText({
style={styles} style={styles}
selectable={selectable} selectable={selectable}
authorHandle={authorHandle} authorHandle={authorHandle}
disableLinks={disableLinks}
/>, />,
) )
} else { } else {
@ -128,7 +136,7 @@ export function RichText({
<Text <Text
selectable={selectable} selectable={selectable}
testID={testID} testID={testID}
style={[styles, {pointerEvents: disableLinks ? 'none' : 'auto'}]} style={styles}
numberOfLines={numberOfLines} numberOfLines={numberOfLines}
// @ts-ignore web only -prf // @ts-ignore web only -prf
dataSet={WORD_WRAP}> dataSet={WORD_WRAP}>
@ -143,13 +151,11 @@ function RichTextTag({
style, style,
selectable, selectable,
authorHandle, authorHandle,
disableLinks,
}: { }: {
text: string text: string
tag: string tag: string
selectable?: boolean selectable?: boolean
authorHandle?: string authorHandle?: string
disableLinks?: boolean
} & TextStyleProp) { } & TextStyleProp) {
const t = useTheme() const t = useTheme()
const {_} = useLingui() const {_} = useLingui()
@ -198,7 +204,7 @@ function RichTextTag({
style={[ style={[
style, style,
{ {
pointerEvents: disableLinks ? 'none' : 'auto', pointerEvents: 'auto',
color: t.palette.primary_500, color: t.palette.primary_500,
}, },
web({ web({

View File

@ -91,10 +91,7 @@ export function QuoteEmbed({
const richText = React.useMemo( const richText = React.useMemo(
() => () =>
quote.text.trim() quote.text.trim()
? new RichTextAPI({ ? new RichTextAPI({text: quote.text, facets: quote.facets})
text: quote.text,
facets: quote.facets,
})
: undefined, : undefined,
[quote.text, quote.facets], [quote.text, quote.facets],
) )