From 765ed9549a3f78bcfed20c7d92cef075cc75aa59 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 18 Nov 2022 21:02:38 -0500 Subject: [PATCH] Dont render images in tippy. Fixes #776 (#864) --- package.json | 3 + .../components/comment/comment-node.tsx | 11 ++- .../components/comment/comment-nodes.tsx | 2 + .../components/comment/comment-report.tsx | 1 + src/shared/components/post/post-listing.tsx | 4 +- src/shared/utils.ts | 84 ++++++++++++------- yarn.lock | 30 +++++++ 7 files changed, 98 insertions(+), 37 deletions(-) diff --git a/package.json b/package.json index 8b64e5a7..e95b3618 100644 --- a/package.json +++ b/package.json @@ -77,9 +77,12 @@ "@types/autosize": "^4.0.0", "@types/express": "^4.17.13", "@types/html-to-text": "^8.1.1", + "@types/markdown-it": "^12.2.3", + "@types/markdown-it-container": "^2.0.5", "@types/node": "^18.6.2", "@types/node-fetch": "^2.6.2", "@types/serialize-javascript": "^5.0.1", + "@types/toastify-js": "^1.11.1", "@typescript-eslint/eslint-plugin": "^5.31.0", "@typescript-eslint/parser": "^5.31.0", "bootstrap": "^5.2.0", diff --git a/src/shared/components/comment/comment-node.tsx b/src/shared/components/comment/comment-node.tsx index 6d1621c1..4555ff58 100644 --- a/src/shared/components/comment/comment-node.tsx +++ b/src/shared/components/comment/comment-node.tsx @@ -46,6 +46,7 @@ import { isBanned, isMod, mdToHtml, + mdToHtmlNoImages, numToSI, setupTippy, showScores, @@ -103,6 +104,7 @@ interface CommentNodeProps { enableDownvotes: boolean; viewType: CommentViewType; allLanguages: Language[]; + hideImages?: boolean; } export class CommentNode extends Component { @@ -336,9 +338,11 @@ export class CommentNode extends Component { ) : (
)}
@@ -1023,6 +1027,7 @@ export class CommentNode extends Component { enableDownvotes={this.props.enableDownvotes} viewType={this.props.viewType} allLanguages={this.props.allLanguages} + hideImages={this.props.hideImages} /> )} {/* A collapsed clearfix */} diff --git a/src/shared/components/comment/comment-nodes.tsx b/src/shared/components/comment/comment-nodes.tsx index 70810589..5c1f2960 100644 --- a/src/shared/components/comment/comment-nodes.tsx +++ b/src/shared/components/comment/comment-nodes.tsx @@ -24,6 +24,7 @@ interface CommentNodesProps { enableDownvotes?: boolean; viewType: CommentViewType; allLanguages: Language[]; + hideImages?: boolean; } export class CommentNodes extends Component { @@ -54,6 +55,7 @@ export class CommentNodes extends Component { enableDownvotes={this.props.enableDownvotes} viewType={this.props.viewType} allLanguages={this.props.allLanguages} + hideImages={this.props.hideImages} /> ))}
diff --git a/src/shared/components/comment/comment-report.tsx b/src/shared/components/comment/comment-report.tsx index f72f8a6a..b625b447 100644 --- a/src/shared/components/comment/comment-report.tsx +++ b/src/shared/components/comment/comment-report.tsx @@ -65,6 +65,7 @@ export class CommentReport extends Component { viewOnly={true} showCommunity={true} allLanguages={[]} + hideImages />
{i18n.t("reporter")}: diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index be06cb2c..d513b104 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -40,7 +40,7 @@ import { isImage, isMod, isVideo, - md, + mdNoImages, mdToHtml, mdToHtmlInline, numToSI, @@ -392,7 +392,7 @@ export class PostListing extends Component {