From 944a424a7a649b32237b2d6ac88b5f1ca404b17b Mon Sep 17 00:00:00 2001 From: Nguyen <87511888+nknguyenhc@users.noreply.github.com> Date: Wed, 21 Feb 2024 19:59:58 +0800 Subject: [PATCH] Fix markdown blockquote preview difference (#1245) Due to DOMPurify, the content used for preview is different. However, given that ngx-markdown already has sufficient sanitation by default, we remove sanitation by DOMPurify. --- package.json | 1 - src/app/shared/comment-editor/comment-editor.component.html | 2 +- src/app/shared/comment-editor/comment-editor.component.ts | 6 ------ 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/package.json b/package.json index e94e8f8e9..af1ea4502 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,6 @@ "arcsecond": "^4.1.0", "core-js": "^3.16.4", "diff-match-patch": "^1.0.4", - "dompurify": "^2.3.1", "graphql": "^15.0.0", "karma-spec-reporter": "0.0.32", "moment": "^2.24.0", diff --git a/src/app/shared/comment-editor/comment-editor.component.html b/src/app/shared/comment-editor/comment-editor.component.html index 67e729946..261bb5da1 100644 --- a/src/app/shared/comment-editor/comment-editor.component.html +++ b/src/app/shared/comment-editor/comment-editor.component.html @@ -57,7 +57,7 @@
- +
Nothing to preview.
diff --git a/src/app/shared/comment-editor/comment-editor.component.ts b/src/app/shared/comment-editor/comment-editor.component.ts index 9d5f27fa7..8da95cc93 100644 --- a/src/app/shared/comment-editor/comment-editor.component.ts +++ b/src/app/shared/comment-editor/comment-editor.component.ts @@ -1,7 +1,6 @@ import { HttpErrorResponse } from '@angular/common/http'; import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; import { AbstractControl, FormGroup, Validators } from '@angular/forms'; -import * as DOMPurify from 'dompurify'; import { UndoRedo } from '../../core/models/undoredo.model'; import { ErrorHandlingService } from '../../core/services/error-handling.service'; import { LoggingService } from '../../core/services/logging.service'; @@ -135,11 +134,6 @@ export class CommentEditorComponent implements OnInit { event.preventDefault(); } - // Sanitize markdown - sanitize(commentFieldValue) { - return DOMPurify.sanitize(commentFieldValue); - } - // To enable file drop in non-input elements, the dragOver event must be cancelled. enableFileDrop(event) { event.preventDefault();