Skip to content

Commit

Permalink
unescape HTML when using Canvas's fillText
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettjstevens committed Nov 9, 2018
1 parent 93e92cf commit 0951c99
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/JBrowse/Util.js
Expand Up @@ -41,6 +41,10 @@ Util = {
return str.toString().replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
},

unescapeHTML: function( str ) {
return str.toString().replace(/&amp;/g, '&').replace(/&lt;/g, '<').replace(/&gt;/g, '>');
},

/**
* Fast, simple class-maker, used for classes that need speed more
* than they need dojo.declare's nice features.
Expand Down
12 changes: 6 additions & 6 deletions src/JBrowse/View/FeatureGlyph/Box.js
@@ -1,18 +1,18 @@
define([
'dojo/_base/declare',
'dojo/_base/array',
'dojo/_base/lang',
'JBrowse/Util/FastPromise',
'JBrowse/View/FeatureGlyph',
'./_FeatureLabelMixin'
],
'./_FeatureLabelMixin',
'JBrowse/Util',
],
function(
declare,
array,
lang,
FastPromise,
FeatureGlyph,
FeatureLabelMixin
FeatureLabelMixin,
Util,
) {


Expand Down Expand Up @@ -327,7 +327,7 @@ return declare([ FeatureGlyph, FeatureLabelMixin], {
if (clearTop) context.clearRect(labelLeft,clearTop,fLabelRecord.w,fLabelRecord.h)

context.fillText(
fLabelRecord.text,
Util.unescapeHTML(fLabelRecord.text),
labelLeft,
labelTop
)
Expand Down

0 comments on commit 0951c99

Please sign in to comment.