Escape Pango markup characters

This commit is contained in:
Daniel Petri Rocha 2022-07-19 23:00:44 +02:00
parent b148049acc
commit 40d0c454c0

View File

@ -121,7 +121,12 @@ function to_px(pt) {
}
function escapeText(string) {
return string.replace(/['".*+?^${}()|[\]\\\/]/g, '\\$&');
return string
.replace(/&/g, '\\&')
.replace(/'/g, '\\'')
.replace(/>/g, '\\>')
.replace(/</g, '\\&lt;')
.replace(/[~`!".*+?%^${}()|[\]\\\/]/g, '\\$&');
}
function render_textbox(textColor, font, fontSize, textAlign, text, id, textBoxWidth = null) {