text: sanitize html (escape "<" & ">") (#562)

This commit is contained in:
bordun 2019-09-11 10:44:04 +02:00
parent 563ba6ceb7
commit 31f05a1be2
2 changed files with 2 additions and 1 deletions

View file

@ -4,6 +4,7 @@
- widgets
- frames: allow loading local html files without requiring a web server to serve them
- text: escape html tags characters (`<` & `>`)
## 0.47.4

View file

@ -57,7 +57,7 @@ module.exports = class Text extends Widget {
setValue(v, options={}) {
this.value = v==null ? this.defaultValue : v
this.widget.innerHTML = iconify(String(this.value).replace(/\n/g,'<br/>'))
this.widget.innerHTML = iconify(String(this.value).replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\n/g,'<br/>'))
if (options.sync) this.changed(options)