From 98a9c2570e86d0c689c358939522131930f7e83c Mon Sep 17 00:00:00 2001 From: Rachel Macfarlane Date: Wed, 22 Aug 2018 17:40:55 -0700 Subject: [PATCH] Don't render images in comments panel, fixes https://github.com/Microsoft/vscode-pull-request-github/issues/214 --- .../comments/electron-browser/commentsTreeViewer.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/vs/workbench/parts/comments/electron-browser/commentsTreeViewer.ts b/src/vs/workbench/parts/comments/electron-browser/commentsTreeViewer.ts index d8672d23d57ad..ed3f817715dd0 100644 --- a/src/vs/workbench/parts/comments/electron-browser/commentsTreeViewer.ts +++ b/src/vs/workbench/parts/comments/electron-browser/commentsTreeViewer.ts @@ -4,6 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as dom from 'vs/base/browser/dom'; +import * as nls from 'vs/nls'; import { renderMarkdown } from 'vs/base/browser/htmlContentRenderer'; import { onUnexpectedError } from 'vs/base/common/errors'; import { Disposable } from 'vs/base/common/lifecycle'; @@ -156,6 +157,14 @@ export class CommentsModelRenderer implements ITreeRenderer { } }); + const images = renderedComment.getElementsByTagName('img'); + for (let i = 0; i < images.length; i++) { + const image = images[i]; + const textDescription = dom.$(''); + textDescription.textContent = image.alt ? nls.localize('imageWithLabel', "Image: {0}", image.alt) : nls.localize('image', "Image"); + image.parentNode.replaceChild(textDescription, image); + } + templateData.commentText.appendChild(renderedComment); } }