Merge pull request #1235 from kchadha/xml-escape-comments

XML escape comment text.
This commit is contained in:
kchadha 2018-06-14 14:46:02 -04:00 committed by GitHub
commit 529d271186
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,6 +5,7 @@
const uid = require('../util/uid'); const uid = require('../util/uid');
const Cast = require('../util/cast'); const Cast = require('../util/cast');
const xmlEscape = require('../util/xml-escape');
class Comment { class Comment {
/** /**
@ -31,7 +32,7 @@ class Comment {
toXML () { toXML () {
return `<comment id="${this.id}" x="${this.x}" y="${ return `<comment id="${this.id}" x="${this.x}" y="${
this.y}" w="${this.width}" h="${this.height}" pinned="${ this.y}" w="${this.width}" h="${this.height}" pinned="${
this.blockId !== null}" minimized="${this.minimized}">${this.text}</comment>`; this.blockId !== null}" minimized="${this.minimized}">${xmlEscape(this.text)}</comment>`;
} }
// TODO choose min and defaults for width and height // TODO choose min and defaults for width and height