Escape HTML chars in composer highlights

This is very embarrassing, I know
pull/401/head
Lim Chee Aun 2024-01-17 11:31:33 +08:00
rodzic 37c784dad2
commit b6c4045cb4
1 zmienionych plików z 8 dodań i 1 usunięć

Wyświetl plik

@ -133,7 +133,14 @@ const SCAN_RE = new RegExp(
function highlightText(text, { maxCharacters = Infinity }) {
// Accept text string, return formatted HTML string
let html = text;
// Escape all HTML special characters
let html = text
.replace(/&/g, '&')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&apos;');
// Exceeded characters limit
const { composerCharacterCount } = states;
let leftoverHTML = '';