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

View File

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