about summary refs log tree commit diff
path: root/src/components/RichText.tsx
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-03-01 17:15:45 -0800
committerGitHub <noreply@github.com>2024-03-01 17:15:45 -0800
commitb07846f2fa8e2830e7871c72afd5a81d2eecfe99 (patch)
tree0bb8df7c61da91c9a3f3e53414ffb648bab18509 /src/components/RichText.tsx
parent4fc0b566ef7b64424a0795f5a2a7a463888e0b70 (diff)
downloadvoidsky-b07846f2fa8e2830e7871c72afd5a81d2eecfe99.tar.zst
Revert "Enable tags inside of quotes (#3041)" (#3075)
This reverts commit f016cdbca9660d9e10faefae5c34c8574795419e.
Diffstat (limited to 'src/components/RichText.tsx')
-rw-r--r--src/components/RichText.tsx42
1 files changed, 24 insertions, 18 deletions
diff --git a/src/components/RichText.tsx b/src/components/RichText.tsx
index 83498846b..1a14415cf 100644
--- a/src/components/RichText.tsx
+++ b/src/components/RichText.tsx
@@ -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) {
-      els.push(
-        <InlineLink
-          selectable={selectable}
-          key={key}
-          to={link.uri}
-          style={[...styles, {pointerEvents: disableLinks ? 'none' : 'auto'}]}
-          // @ts-ignore TODO
-          dataSet={WORD_WRAP}>
-          {toShortUrl(segment.text)}
-        </InlineLink>,
-      )
+      if (disableLinks) {
+        els.push(toShortUrl(segment.text))
+      } else {
+        els.push(
+          <InlineLink
+            selectable={selectable}
+            key={key}
+            to={link.uri}
+            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({