mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-22 09:15:33 +03:00
Escape HTML chars in composer highlights
This is very embarrassing, I know
This commit is contained in:
parent
37c784dad2
commit
b6c4045cb4
1 changed files with 8 additions and 1 deletions
|
@ -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, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
|
||||
// Exceeded characters limit
|
||||
const { composerCharacterCount } = states;
|
||||
let leftoverHTML = '';
|
||||
|
|
Loading…
Reference in a new issue