Skip to content

Commit

Permalink
check if field type is html to replace newlines by BRs
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruno Camara committed May 12, 2016
1 parent c872929 commit 2589f2f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
return {
refName: field.referenceName,
name: field.name,
type: field.type
};
});
},
Expand Down Expand Up @@ -1095,6 +1096,15 @@
},

buildPatchToAddWorkItemField: function (fieldName, value) {
// Check if the field type is html to replace newlines by br
var field = this.getFieldByFieldRefName(fieldName);
if (field && field.type && value) {
var fieldType = field.type.toLowerCase();
if (fieldType === "html" || fieldType === "history") {
value = value.replace(/\n/g, "<br>");
}
}

return {
op: "add",
path: helpers.fmt("/fields/%@", fieldName),
Expand Down

0 comments on commit 2589f2f

Please # to comment.