Sanitizes posts on publish and render (#217)

* Sanatizes posts on publish and render

* lint

* lint and added sanitize to thread view as well

* adjusts indices based on replaced text

* Woops, fixes a bug

* bugfix + cleanup

* comment

* lint

* move sanitize text to later in the flow

* undo changes to compose post

* Add RichText library building upon the sanitizePost library method

* Add lodash.clonedeep dep

* Switch to RichText processing on record load & render

* Fix lint

---------

Co-authored-by: Paul Frazee <pfrazee@gmail.com>
This commit is contained in:
Aryan Goharzad
2023-02-20 15:09:08 -05:00
committed by GitHub
parent af1396e396
commit 1861f95a1f
15 changed files with 556 additions and 31 deletions
+4 -6
View File
@@ -177,7 +177,7 @@ export const PostThreadItem = observer(function PostThreadItem({
</View>
</View>
<View style={[s.pl10, s.pr10, s.pb10]}>
{record.text ? (
{item.richText?.text ? (
<View
style={[
styles.postTextContainer,
@@ -185,8 +185,7 @@ export const PostThreadItem = observer(function PostThreadItem({
]}>
<RichText
type="post-text-lg"
text={record.text}
entities={record.entities}
richText={item.richText}
lineHeight={1.3}
/>
</View>
@@ -301,12 +300,11 @@ export const PostThreadItem = observer(function PostThreadItem({
<FontAwesomeIcon icon={['far', 'eye-slash']} style={s.mr2} />
<Text type="sm">This post is by a muted account.</Text>
</View>
) : record.text ? (
) : item.richText?.text ? (
<View style={styles.postTextContainer}>
<RichText
type="post-text"
text={record.text}
entities={record.entities}
richText={item.richText}
style={pal.text}
lineHeight={1.3}
/>