Skip to content

Commit

Permalink
apply PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
stocksr authored and davelandry committed Aug 22, 2019
1 parent 1bea142 commit 5e12971
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/TextBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default class TextBox extends BaseClass {
this._width = accessor("width", 200);
this._x = accessor("x", 0);
this._y = accessor("y", 0);
this._tagLookup = {
this._htmlLookup = {
i: "font-style: italic;",
em: "font-style: italic;",
b: "font-weight: bold;",
Expand Down Expand Up @@ -279,7 +279,7 @@ export default class TextBox extends BaseClass {
.replace(/(<[^>^\/]+>)([^<^>]+)$/g, (str, a, b) => `${a}${b}${a.replace("<", "</")}`) // ands end tag to lines before mid-HTML break
.replace(/^([^<^>]+)(<\/[^>]+>)/g, (str, a, b) => `${b.replace("</", "<")}${a}${b}`) // ands start tag to lines after mid-HTML break
.replace(/<([A-z]+)[^>]*>([^<^>]+)<\/[^>]+>/g, (str, a, b) => {
const tag = that._tagLookup[a] ? `<tspan style="${that._tagLookup[a]}">` : "";
const tag = that._htmlLookup[a] ? `<tspan style="${that._htmlLookup[a]}">` : "";
return `${tag.length ? tag : ""}${b}${tag.length ? "</tspan>" : ""}`;
}));

Expand Down Expand Up @@ -529,16 +529,16 @@ function(d) {
/**
@memberof TextBox
@desc Provides the replacment style for html tags. Defaults to `<b>`, `<strong>`, `<i>`, and `<em>`.
@param {Dictionary} [*value* = {
@param {Object} [*value* = {
i: 'font-style: italic;',
em: 'font-style: italic;',
b: 'font-weight: bold;',
strong: 'font-weight: bold;'
}]
@chainable
*/
tagStyling(_) {
return arguments.length ? (this._tagLookup = _, this) : this._html;
htmlStyling(_) {
return arguments.length ? (this._htmlLookup = _, this) : this._htmlLookup;
}

/**
Expand Down

0 comments on commit 5e12971

Please sign in to comment.